mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:37:35 +00:00
Kernel: Use IO init method for Bochs emulated VGA adapter
In short: QEMU supports both Memory-Mapped-IO and classic IO methods for controlling the emulated VGA device. Bochs and VirtualBox only support the classic IO method. An excellent write up on the history of these interfaces can be found here: https://www.kraxel.org/blog/2018/10/qemu-vga-emulation-and-bochs-display The IO method was how things were done originally in SerenityOS. Commit6a728e2d76
introduced the MMIO method for all devices, breaking Bochs and VirtualBox compatibility. Later in commit6a9dc5562d
the classic IO method was restored for VirtualBox graphics adapters. QEMU and Bochs use the same PCI VID/DID (0x1234/0x1111) for the emulated VGA adapter. To distinguish betwen QEMU and Bochs we use the PCI revision ID field (0=Bochs, 2=QEMU).
This commit is contained in:
parent
09262e3b77
commit
9d94c85b6a
1 changed files with 8 additions and 2 deletions
|
@ -109,8 +109,14 @@ UNMAP_AFTER_INIT BochsGraphicsAdapter::BochsGraphicsAdapter(PCI::DeviceIdentifie
|
|||
m_framebuffer_console = Graphics::ContiguousFramebufferConsole::initialize(PhysicalAddress(PCI::get_BAR0(pci_device_identifier.address()) & 0xfffffff0), 1024, 768, 1024 * sizeof(u32));
|
||||
GraphicsManagement::the().set_console(*m_framebuffer_console);
|
||||
|
||||
// Note: If we use VirtualBox graphics adapter (which is based on Bochs one), we need to use IO ports
|
||||
if (pci_device_identifier.hardware_id().vendor_id == 0x80ee && pci_device_identifier.hardware_id().device_id == 0xbeef)
|
||||
auto vendor_id = pci_device_identifier.hardware_id().vendor_id;
|
||||
auto device_id = pci_device_identifier.hardware_id().device_id;
|
||||
auto revision_id = pci_device_identifier.revision_id();
|
||||
|
||||
auto is_bochs = vendor_id == PCI::VendorID::QEMUOld && device_id == 0x1111 && revision_id == 0;
|
||||
auto is_virtualbox = vendor_id == PCI::VendorID::VirtualBox && device_id == 0xbeef;
|
||||
|
||||
if (is_bochs || is_virtualbox)
|
||||
m_io_required = true;
|
||||
|
||||
if (pci_device_identifier.class_code().value() == 0x3 && pci_device_identifier.subclass_code().value() == 0x0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue