drivers/video/fbdev/efifb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/efifb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/efifb.c- Extension
.c- Size
- 16862 bytes
- Lines
- 609
- Domain
- Driver Families
- Bucket
- drivers/video
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/aperture.hlinux/kernel.hlinux/efi.hlinux/efi-bgrt.hlinux/errno.hlinux/fb.hlinux/platform_device.hlinux/printk.hlinux/sysfb.hvideo/vga.hasm/efi.hdrm/drm_utils.hdrm/drm_connector.h
Detected Declarations
struct bmp_file_headerstruct bmp_dib_headerstruct efifb_parfunction efifb_setcolregfunction graphicsfunction efifb_bgrt_sanity_checkfunction efifb_bgrt_sanity_checkfunction efifb_show_boot_graphicsfunction efifb_show_boot_graphicsfunction efifb_setupfunction fb_base_is_validfunction efifb_probe
Annotated Snippet
struct bmp_file_header {
u16 id;
u32 file_size;
u32 reserved;
u32 bitmap_offset;
} __packed;
struct bmp_dib_header {
u32 dib_header_size;
s32 width;
s32 height;
u16 planes;
u16 bpp;
u32 compression;
u32 bitmap_size;
u32 horz_resolution;
u32 vert_resolution;
u32 colors_used;
u32 colors_important;
} __packed;
static bool use_bgrt = true;
static bool request_mem_succeeded = false;
static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC;
struct efifb_par {
u32 pseudo_palette[16];
resource_size_t base;
resource_size_t size;
};
static struct fb_var_screeninfo efifb_defined = {
.activate = FB_ACTIVATE_NOW,
.height = -1,
.width = -1,
.right_margin = 32,
.upper_margin = 16,
.lower_margin = 4,
.vsync_len = 4,
.vmode = FB_VMODE_NONINTERLACED,
};
static struct fb_fix_screeninfo efifb_fix = {
.id = "EFI VGA",
.type = FB_TYPE_PACKED_PIXELS,
.accel = FB_ACCEL_NONE,
.visual = FB_VISUAL_TRUECOLOR,
};
static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *info)
{
/*
* Set a single color register. The values supplied are
* already rounded down to the hardware's capabilities
* (according to the entries in the `var' structure). Return
* != 0 for invalid regno.
*/
if (regno >= info->cmap.len)
return 1;
if (regno < 16) {
red >>= 16 - info->var.red.length;
green >>= 16 - info->var.green.length;
blue >>= 16 - info->var.blue.length;
((u32 *)(info->pseudo_palette))[regno] =
(red << info->var.red.offset) |
(green << info->var.green.offset) |
(blue << info->var.blue.offset);
}
return 0;
}
/*
* If fbcon deffered console takeover is configured, the intent is for the
* framebuffer to show the boot graphics (e.g. vendor logo) until there is some
* (error) message to display. But the boot graphics may have been destroyed by
* e.g. option ROM output, detect this and restore the boot graphics.
*/
#if defined CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER && \
defined CONFIG_ACPI_BGRT
static void efifb_copy_bmp(u8 *src, u32 *dst, int width, const struct screen_info *si)
{
u8 r, g, b;
while (width--) {
b = *src++;
g = *src++;
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/kernel.h`, `linux/efi.h`, `linux/efi-bgrt.h`, `linux/errno.h`, `linux/fb.h`, `linux/platform_device.h`, `linux/printk.h`.
- Detected declarations: `struct bmp_file_header`, `struct bmp_dib_header`, `struct efifb_par`, `function efifb_setcolreg`, `function graphics`, `function efifb_bgrt_sanity_check`, `function efifb_bgrt_sanity_check`, `function efifb_show_boot_graphics`, `function efifb_show_boot_graphics`, `function efifb_setup`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.