mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
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.
This commit is contained in:
parent
b28202e356
commit
252c92d565
7 changed files with 75 additions and 12 deletions
|
@ -7,6 +7,9 @@
|
|||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Arch/Delay.h>
|
||||
#include <Kernel/Arch/x86/IO.h>
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
# include <Kernel/Arch/x86/Hypervisor/BochsDisplayConnector.h>
|
||||
#endif
|
||||
#include <Kernel/Bus/PCI/API.h>
|
||||
#include <Kernel/Bus/PCI/IDs.h>
|
||||
#include <Kernel/CommandLine.h>
|
||||
|
@ -206,6 +209,25 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
|
|||
return true;
|
||||
}
|
||||
|
||||
// Note: Don't try to initialize an ISA Bochs VGA adapter if PCI hardware is
|
||||
// present but the user decided to disable its usage nevertheless.
|
||||
// Otherwise we risk using the Bochs VBE driver on a wrong physical address
|
||||
// for the framebuffer.
|
||||
if (PCI::Access::is_hardware_disabled() && !(graphics_subsystem_mode == CommandLine::GraphicsSubsystemMode::Limited && !multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB)) {
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
auto vga_isa_bochs_display_connector = BochsDisplayConnector::try_create_for_vga_isa_connector();
|
||||
if (vga_isa_bochs_display_connector) {
|
||||
dmesgln("Graphics: Using a Bochs ISA VGA compatible adapter");
|
||||
MUST(vga_isa_bochs_display_connector->set_safe_mode_setting());
|
||||
m_platform_board_specific_display_connector = vga_isa_bochs_display_connector;
|
||||
dmesgln("Graphics: Invoking manual blanking with VGA ISA ports");
|
||||
SpinlockLocker locker(m_main_vga_lock);
|
||||
IO::out8(0x3c0, 0x20);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (graphics_subsystem_mode == CommandLine::GraphicsSubsystemMode::Limited && !multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB) {
|
||||
initialize_preset_resolution_generic_display_connector();
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue