mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:27:35 +00:00
Kernel/PCI: Convert PCI BAR number to a strong typed enum class
This commit is contained in:
parent
f510c0ba04
commit
bb6f61ee5d
10 changed files with 26 additions and 17 deletions
|
@ -41,7 +41,7 @@ UNMAP_AFTER_INIT ErrorOr<void> BochsGraphicsAdapter::initialize_adapter(PCI::Dev
|
|||
// Note: Bochs (the real bochs graphics adapter in the Bochs emulator) uses revision ID of 0x0
|
||||
// and doesn't support memory-mapped IO registers.
|
||||
bool virtual_box_hardware = (pci_device_identifier.hardware_id().vendor_id == 0x80ee && pci_device_identifier.hardware_id().device_id == 0xbeef);
|
||||
auto bar0_space_size = PCI::get_BAR_space_size(pci_device_identifier.address(), 0);
|
||||
auto bar0_space_size = PCI::get_BAR_space_size(pci_device_identifier.address(), PCI::HeaderType0BaseRegister::BAR0);
|
||||
if (pci_device_identifier.revision_id().value() == 0x0 || virtual_box_hardware) {
|
||||
m_display_connector = BochsDisplayConnector::must_create(PhysicalAddress(PCI::get_BAR0(pci_device_identifier.address()) & 0xfffffff0), bar0_space_size, virtual_box_hardware);
|
||||
} else {
|
||||
|
|
|
@ -40,9 +40,9 @@ ErrorOr<void> IntelNativeGraphicsAdapter::initialize_adapter()
|
|||
{
|
||||
auto address = pci_address();
|
||||
dbgln_if(INTEL_GRAPHICS_DEBUG, "Intel Native Graphics Adapter @ {}", address);
|
||||
auto bar0_space_size = PCI::get_BAR_space_size(address, 0);
|
||||
auto bar0_space_size = PCI::get_BAR_space_size(address, PCI::HeaderType0BaseRegister::BAR0);
|
||||
VERIFY(bar0_space_size == 0x80000);
|
||||
auto bar2_space_size = PCI::get_BAR_space_size(address, 2);
|
||||
auto bar2_space_size = PCI::get_BAR_space_size(address, PCI::HeaderType0BaseRegister::BAR2);
|
||||
dmesgln("Intel Native Graphics Adapter @ {}, MMIO @ {}, space size is {:x} bytes", address, PhysicalAddress(PCI::get_BAR0(address)), bar0_space_size);
|
||||
dmesgln("Intel Native Graphics Adapter @ {}, framebuffer @ {}", address, PhysicalAddress(PCI::get_BAR2(address)));
|
||||
PCI::enable_bus_mastering(address);
|
||||
|
|
|
@ -180,7 +180,7 @@ UNMAP_AFTER_INIT ErrorOr<void> VMWareGraphicsAdapter::initialize_adapter()
|
|||
// Note: enable the device by modesetting the primary screen resolution
|
||||
modeset_primary_screen_resolution(640, 480);
|
||||
|
||||
auto bar1_space_size = PCI::get_BAR_space_size(pci_address(), 1);
|
||||
auto bar1_space_size = PCI::get_BAR_space_size(pci_address(), PCI::HeaderType0BaseRegister::BAR1);
|
||||
|
||||
m_display_connector = VMWareDisplayConnector::must_create(*this, PhysicalAddress(PCI::get_BAR1(pci_address()) & 0xfffffff0), bar1_space_size);
|
||||
TRY(m_display_connector->set_safe_mode_setting());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue