drivers/video/console/vgacon.c
Source file repositories/reference/linux-study-clean/drivers/video/console/vgacon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/console/vgacon.c- Extension
.c- Size
- 36811 bytes
- Lines
- 1227
- Domain
- Driver Families
- Bucket
- drivers/video
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/types.hlinux/fs.hlinux/kernel.hlinux/console.hlinux/string.hlinux/kd.hlinux/slab.hlinux/vt_kern.hlinux/sched.hlinux/selection.hlinux/spinlock.hlinux/ioport.hlinux/init.hlinux/screen_info.hvideo/vga.hasm/io.h
Detected Declarations
function no_scrollfunction write_vgafunction vga_set_mem_topfunction vgacon_scrolldeltafunction vgacon_restore_screenfunction vgacon_initfunction vgacon_deinitfunction vgacon_build_attrfunction vgacon_invert_regionfunction vgacon_set_cursor_sizefunction vgacon_cursorfunction vgacon_doresizefunction vgacon_switchfunction vga_set_palettefunction vgacon_set_palettefunction vga_vesa_blankfunction vga_vesa_unblankfunction vga_pal_blankfunction vgacon_blankfunction Hoffmanfunction vgacon_adjust_heightfunction vgacon_font_setfunction vgacon_font_getfunction vgacon_resizefunction vgacon_set_originfunction vgacon_save_screenfunction vgacon_scrollfunction vgacon_clearfunction vgacon_register_screenexport vga_con
Annotated Snippet
if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) {
static struct resource ega_console_resource =
{ .name = "ega",
.flags = IORESOURCE_IO,
.start = 0x3B0,
.end = 0x3BF };
vga_video_type = VIDEO_TYPE_EGAM;
vga_vram_size = 0x8000;
display_desc = "EGA+";
request_resource(&ioport_resource,
&ega_console_resource);
} else {
static struct resource mda1_console_resource =
{ .name = "mda",
.flags = IORESOURCE_IO,
.start = 0x3B0,
.end = 0x3BB };
static struct resource mda2_console_resource =
{ .name = "mda",
.flags = IORESOURCE_IO,
.start = 0x3BF,
.end = 0x3BF };
vga_video_type = VIDEO_TYPE_MDA;
vga_vram_size = 0x2000;
display_desc = "*MDA";
request_resource(&ioport_resource,
&mda1_console_resource);
request_resource(&ioport_resource,
&mda2_console_resource);
vga_video_font_height = 14;
}
} else {
/* If not, it is color. */
vga_can_do_color = true;
vga_vram_base = 0xb8000;
vga_video_port_reg = VGA_CRT_IC;
vga_video_port_val = VGA_CRT_DC;
if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) {
int i;
vga_vram_size = 0x8000;
if (!vga_si->orig_video_isVGA) {
static struct resource ega_console_resource =
{ .name = "ega",
.flags = IORESOURCE_IO,
.start = 0x3C0,
.end = 0x3DF };
vga_video_type = VIDEO_TYPE_EGAC;
display_desc = "EGA";
request_resource(&ioport_resource,
&ega_console_resource);
} else {
static struct resource vga_console_resource =
{ .name = "vga+",
.flags = IORESOURCE_IO,
.start = 0x3C0,
.end = 0x3DF };
vga_video_type = VIDEO_TYPE_VGAC;
display_desc = "VGA+";
request_resource(&ioport_resource,
&vga_console_resource);
/*
* Normalise the palette registers, to point
* the 16 screen colours to the first 16
* DAC entries.
*/
for (i = 0; i < 16; i++) {
inb_p(VGA_IS1_RC);
outb_p(i, VGA_ATT_W);
outb_p(i, VGA_ATT_W);
}
outb_p(0x20, VGA_ATT_W);
/*
* Now set the DAC registers back to their
* default values
*/
for (i = 0; i < 16; i++) {
outb_p(color_table[i], VGA_PEL_IW);
outb_p(default_red[i], VGA_PEL_D);
outb_p(default_grn[i], VGA_PEL_D);
outb_p(default_blu[i], VGA_PEL_D);
}
}
} else {
static struct resource cga_console_resource =
{ .name = "cga",
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/fs.h`, `linux/kernel.h`, `linux/console.h`, `linux/string.h`, `linux/kd.h`, `linux/slab.h`.
- Detected declarations: `function no_scroll`, `function write_vga`, `function vga_set_mem_top`, `function vgacon_scrolldelta`, `function vgacon_restore_screen`, `function vgacon_init`, `function vgacon_deinit`, `function vgacon_build_attr`, `function vgacon_invert_region`, `function vgacon_set_cursor_size`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.