diff options
author | Liav A <liavalb@gmail.com> | 2022-01-07 14:10:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-08 23:49:26 +0100 |
commit | ac2c01320be494ed550954250df36796dda2f94c (patch) | |
tree | cb7ecd6f0a2a26f6c81e9369c24fb7bd8834c817 /Kernel/Bus/PCI/Definitions.h | |
parent | 46f6c86362dd66c6dc8bef43cf9e2b7bea50a6cb (diff) | |
download | serenity-ac2c01320be494ed550954250df36796dda2f94c.zip |
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.
Diffstat (limited to 'Kernel/Bus/PCI/Definitions.h')
-rw-r--r-- | Kernel/Bus/PCI/Definitions.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Kernel/Bus/PCI/Definitions.h b/Kernel/Bus/PCI/Definitions.h index 1b0faf4411..4d9447020d 100644 --- a/Kernel/Bus/PCI/Definitions.h +++ b/Kernel/Bus/PCI/Definitions.h @@ -128,18 +128,18 @@ struct HardwareID { class Domain { public: Domain() = delete; - Domain(PhysicalAddress base_address, u8 start_bus, u8 end_bus) - : m_base_addr(base_address) + Domain(u32 domain_number, u8 start_bus, u8 end_bus) + : m_domain_number(domain_number) , m_start_bus(start_bus) , m_end_bus(end_bus) { } u8 start_bus() const { return m_start_bus; } u8 end_bus() const { return m_end_bus; } - PhysicalAddress paddr() const { return m_base_addr; } + u32 domain_number() const { return m_domain_number; } private: - PhysicalAddress m_base_addr; + u32 m_domain_number; u8 m_start_bus; u8 m_end_bus; }; @@ -189,11 +189,6 @@ public: u8 device() const { return m_device; } u8 function() const { return m_function; } - u32 io_address_for_field(u8 field) const - { - return 0x80000000u | (m_bus << 16u) | (m_device << 11u) | (m_function << 8u) | (field & 0xfc); - } - private: u32 m_domain { 0 }; u8 m_bus { 0 }; |