mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 02:05:07 +00:00
Kernel/PCI: Split host bridge code from the Access singleton
Two classes are added - HostBridge and MemoryBackedHostBridge, which both derive from HostController class. This allows the kernel to map different busses from different PCI domains in the same time. Each HostController implementation doesn't take the Address object to address PCI devices but instead we take distinct numbers of the PCI bus, device and function as it allows us to specify arbitrary PCI domains in the Address structure and still to get the correct PCI devices. This also matches the hardware behavior of PCI domains - the host bridge merely takes memory operations or IO operations and translates them to addressing of three components - PCI bus, device and function. These changes also greatly simplify how enumeration of Host Bridges work now - scanning of the hardware depends on what the Host bridges can do for us, so in case we have multiple host bridges that expose a memory mapped region or IO ports to access PCI configuration space, we simply let the code of the host bridge to figure out how to fetch data for us. Another semantical change is that a PCI domain structure is no longer attached to a PhysicalAddress, so even in the case that the machine doesn't implement PCI domains, we still treat that machine to contain 1 PCI domain to treat that one host bridge in the same way, like with a machine with one or more PCI domains.
This commit is contained in:
parent
46f6c86362
commit
ac2c01320b
10 changed files with 529 additions and 438 deletions
|
@ -40,12 +40,12 @@ UNMAP_AFTER_INIT void initialize()
|
|||
case PCIAccessLevel::MemoryAddressing: {
|
||||
auto mcfg = ACPI::Parser::the()->find_table("MCFG");
|
||||
VERIFY(mcfg.has_value());
|
||||
auto success = Access::initialize_for_memory_access(mcfg.value());
|
||||
auto success = Access::initialize_for_multiple_pci_domains(mcfg.value());
|
||||
VERIFY(success);
|
||||
break;
|
||||
}
|
||||
case PCIAccessLevel::IOAddressing: {
|
||||
auto success = Access::initialize_for_io_access();
|
||||
auto success = Access::initialize_for_one_pci_domain();
|
||||
VERIFY(success);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue