From 252c92d565120eeaa1a5dd4b52c006120afdde09 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 16 Sep 2022 13:17:02 +0300 Subject: Kernel/Graphics: Introduce support for QEMU isa-vga device This device is supposed to be used in microvm and ISA-PC machine types, and we assume that if we are able to probe for the QEMU BGA version of 0xB0C5, then we have an existing ISA Bochs VGA adapter to utilize. To ensure we don't instantiate the driver for non isa-vga devices, we try to ensure that PCI is disabled because hardware IO test probe failed so we can be sure that we use this special handling code only in the QEMU microvm and ISA-PC machine types. Unfortunately, this means that if for some reason the isa-vga device is attached for the i440FX or Q35 machine types, we simply are not able to drive the device in such setups at all. To determine the amount of VRAM being available, we read VBE register at offset 0xA. That register holds the amount of VRAM divided by 64K, so we need to multiply the value in our code to use the actual VRAM size value again. The isa-vga device requires us to hardcode the framebuffer physical address to 0xE0000000, and that address is not expected to change in the future as many other projects rely on the isa-vga framebuffer to be present at that physical memory address. --- Kernel/Graphics/Bochs/Definitions.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Kernel/Graphics/Bochs/Definitions.h') diff --git a/Kernel/Graphics/Bochs/Definitions.h b/Kernel/Graphics/Bochs/Definitions.h index 12ba53650a..1891b9f756 100644 --- a/Kernel/Graphics/Bochs/Definitions.h +++ b/Kernel/Graphics/Bochs/Definitions.h @@ -34,6 +34,7 @@ enum class BochsDISPIRegisters { VIRT_HEIGHT = 0x7, X_OFFSET = 0x8, Y_OFFSET = 0x9, + VIDEO_RAM_64K_CHUNKS_COUNT = 0xA, }; struct [[gnu::packed]] DISPIInterface { @@ -47,6 +48,7 @@ struct [[gnu::packed]] DISPIInterface { u16 virt_height; u16 x_offset; u16 y_offset; + u16 vram_64k_chunks_count; }; struct [[gnu::packed]] ExtensionRegisters { -- cgit v1.2.3