Lines Matching +full:assigned +full:- +full:resolution +full:- +full:bits
1 // SPDX-License-Identifier: GPL-2.0
5 * (c) 2006 Edgar Hucek <gimli@dark-green.com>
6 * Original efi driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
12 #include <linux/efi-bgrt.h>
51 .height = -1,
52 .width = -1,
78 if (regno >= info->cmap.len) in efifb_setcolreg()
82 red >>= 16 - info->var.red.length; in efifb_setcolreg()
83 green >>= 16 - info->var.green.length; in efifb_setcolreg()
84 blue >>= 16 - info->var.blue.length; in efifb_setcolreg()
85 ((u32 *)(info->pseudo_palette))[regno] = in efifb_setcolreg()
86 (red << info->var.red.offset) | in efifb_setcolreg()
87 (green << info->var.green.offset) | in efifb_setcolreg()
88 (blue << info->var.blue.offset); in efifb_setcolreg()
105 while (width--) { in efifb_copy_bmp()
109 *dst++ = (r << si->red_pos) | in efifb_copy_bmp()
110 (g << si->green_pos) | in efifb_copy_bmp()
111 (b << si->blue_pos); in efifb_copy_bmp()
117 * On x86 some firmwares use a low non native resolution for the display when
119 * for the native resolution. If the bgrt image intended for the native
120 * resolution still fits, it will be displayed very close to the right edge of
129 u32 expected_xoffset = (si->lfb_width - bmp_width) / 2; in efifb_bgrt_sanity_check()
147 u8 *dst = info->screen_base; in efifb_show_boot_graphics()
163 if (si->lfb_depth != 32) { in efifb_show_boot_graphics()
164 pr_info("efifb: not 32 bits, not showing boot graphics\n"); in efifb_show_boot_graphics()
179 if (file_header->id != 0x4d42 || file_header->reserved != 0) in efifb_show_boot_graphics()
183 if (dib_header->dib_header_size != 40 || dib_header->width < 0 || in efifb_show_boot_graphics()
184 dib_header->planes != 1 || dib_header->bpp != 24 || in efifb_show_boot_graphics()
185 dib_header->compression != 0) in efifb_show_boot_graphics()
188 bmp_width = dib_header->width; in efifb_show_boot_graphics()
189 bmp_height = abs(dib_header->height); in efifb_show_boot_graphics()
191 screen_pitch = si->lfb_linelength; in efifb_show_boot_graphics()
193 if ((file_header->bitmap_offset + bmp_pitch * bmp_height) > in efifb_show_boot_graphics()
197 if ((bgrt_tab.image_offset_x + bmp_width) > si->lfb_width || in efifb_show_boot_graphics()
198 (bgrt_tab.image_offset_y + bmp_height) > si->lfb_height) in efifb_show_boot_graphics()
206 for (y = 0; y < si->lfb_height; y++, dst += si->lfb_linelength) { in efifb_show_boot_graphics()
210 memset(dst, 0, 4 * si->lfb_width); in efifb_show_boot_graphics()
214 src_y = y - bgrt_tab.image_offset_y; in efifb_show_boot_graphics()
216 if (dib_header->height > 0) in efifb_show_boot_graphics()
217 src_y = (bmp_height - 1) - src_y; in efifb_show_boot_graphics()
221 efifb_copy_bmp(bgrt_image + file_header->bitmap_offset + in efifb_show_boot_graphics()
225 memset((u32 *)dst + dst_x, 0, (si->lfb_width - dst_x) * 4); in efifb_show_boot_graphics()
241 if (info->screen_base) { in efifb_destroy()
243 iounmap(info->screen_base); in efifb_destroy()
245 memunmap(info->screen_base); in efifb_destroy()
248 release_mem_region(info->apertures->ranges[0].base, in efifb_destroy()
249 info->apertures->ranges[0].size); in efifb_destroy()
250 fb_dealloc_cmap(&info->cmap); in efifb_destroy()
346 return -ENODEV; in efifb_probe()
349 return -ENODEV; in efifb_probe()
357 return -ENODEV; in efifb_probe()
365 return -ENODEV; in efifb_probe()
391 bar_resource->start + bar_offset != efifb_fix.smem_start) { in efifb_probe()
392 dev_info(&efifb_pci_dev->dev, in efifb_probe()
394 efifb_fix.smem_start = bar_resource->start + bar_offset; in efifb_probe()
402 /* size_vmode -- that is the amount of memory needed for the in efifb_probe()
407 /* size_total -- all video memory we have. Used for in efifb_probe()
414 /* size_remap -- the amount of video memory we are going to in efifb_probe()
422 size_remap += PAGE_SIZE - (size_remap % PAGE_SIZE); in efifb_probe()
434 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); in efifb_probe()
437 err = -ENOMEM; in efifb_probe()
441 info->pseudo_palette = info->par; in efifb_probe()
442 info->par = NULL; in efifb_probe()
444 info->apertures = alloc_apertures(1); in efifb_probe()
445 if (!info->apertures) { in efifb_probe()
446 err = -ENOMEM; in efifb_probe()
449 info->apertures->ranges[0].base = efifb_fix.smem_start; in efifb_probe()
450 info->apertures->ranges[0].size = size_remap; in efifb_probe()
458 err = -EIO; in efifb_probe()
473 info->screen_base = ioremap_wc(efifb_fix.smem_start, in efifb_probe()
476 info->screen_base = ioremap(efifb_fix.smem_start, in efifb_probe()
479 info->screen_base = memremap(efifb_fix.smem_start, in efifb_probe()
482 info->screen_base = memremap(efifb_fix.smem_start, in efifb_probe()
484 if (!info->screen_base) { in efifb_probe()
487 err = -EIO; in efifb_probe()
536 info->fbops = &efifb_ops; in efifb_probe()
537 info->var = efifb_defined; in efifb_probe()
538 info->fix = efifb_fix; in efifb_probe()
539 info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE; in efifb_probe()
545 info->fbcon_rotate_hint = FB_ROTATE_UR; in efifb_probe()
548 info->fbcon_rotate_hint = FB_ROTATE_UD; in efifb_probe()
551 info->fbcon_rotate_hint = FB_ROTATE_CCW; in efifb_probe()
554 info->fbcon_rotate_hint = FB_ROTATE_CW; in efifb_probe()
558 err = sysfs_create_groups(&dev->dev.kobj, efifb_groups); in efifb_probe()
563 err = fb_alloc_cmap(&info->cmap, 256, 0); in efifb_probe()
573 fb_info(info, "%s frame buffer device\n", info->fix.id); in efifb_probe()
577 fb_dealloc_cmap(&info->cmap); in efifb_probe()
579 sysfs_remove_groups(&dev->dev.kobj, efifb_groups); in efifb_probe()
582 iounmap(info->screen_base); in efifb_probe()
584 memunmap(info->screen_base); in efifb_probe()
598 sysfs_remove_groups(&pdev->dev.kobj, efifb_groups); in efifb_remove()
606 .name = "efi-framebuffer",
625 dev_err(&dev->dev, in record_efifb_bar_resource()
626 "BAR %d: assigned to efifb but device is disabled!\n", in record_efifb_bar_resource()
631 bar_resource = &dev->resource[idx]; in record_efifb_bar_resource()
634 dev_info(&dev->dev, "BAR %d: assigned to efifb\n", idx); in record_efifb_bar_resource()
653 struct resource *res = &dev->resource[i]; in efifb_fixup_resources()
655 if (!(res->flags & IORESOURCE_MEM)) in efifb_fixup_resources()
658 if (res->start <= base && res->end >= base + size - 1) { in efifb_fixup_resources()
659 record_efifb_bar_resource(dev, i, base - res->start); in efifb_fixup_resources()