mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
Kernel: Fixing PCI MMIO access mechanism
During initialization of PCI MMIO access mechanism we ensure that we have an allocation from the kernel virtual address space that cannot be taken by other components in the OS. Also, now we ensure that interrupts are disabled so mapping the region doesn't fail. In order to reduce overhead, map_device() will map the requested PCI address only if it's not mapped already. The run script has been changed so now we can boot a Q35 machine, that supports PCI ECAM. To ensure we will be able to load the machine, a PIIX3 IDE controller was added to the Q35 machine configuration in the run script. An AHCI controller was added to the i440fx machine configuration.
This commit is contained in:
parent
5e430e4eb4
commit
2a4a19aed8
4 changed files with 110 additions and 24 deletions
|
@ -51,6 +51,7 @@ struct ID {
|
|||
};
|
||||
|
||||
struct Address {
|
||||
public:
|
||||
Address() {}
|
||||
Address(u16 seg)
|
||||
: m_seg(seg)
|
||||
|
@ -80,13 +81,47 @@ struct Address {
|
|||
return 0x80000000u | (m_bus << 16u) | (m_slot << 11u) | (m_function << 8u) | (field & 0xfc);
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
u32 m_seg { 0 };
|
||||
u8 m_bus { 0 };
|
||||
u8 m_slot { 0 };
|
||||
u8 m_function { 0 };
|
||||
};
|
||||
|
||||
struct ChangeableAddress : public Address {
|
||||
ChangeableAddress()
|
||||
: Address(0)
|
||||
{
|
||||
}
|
||||
explicit ChangeableAddress(u16 seg)
|
||||
: Address(seg)
|
||||
{
|
||||
}
|
||||
ChangeableAddress(u16 seg, u8 bus, u8 slot, u8 function)
|
||||
: Address(seg, bus, slot, function)
|
||||
{
|
||||
}
|
||||
void set_seg(u16 seg) { m_seg = seg; }
|
||||
void set_bus(u8 bus) { m_bus = bus; }
|
||||
void set_slot(u8 slot) { m_slot = slot; }
|
||||
void set_function(u8 function) { m_function = function; }
|
||||
bool operator==(const Address& address)
|
||||
{
|
||||
if (m_seg == address.seg() && m_bus == address.bus() && m_slot == address.slot() && m_function == address.function())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
const ChangeableAddress& operator=(const Address& address)
|
||||
{
|
||||
set_seg(address.seg());
|
||||
set_bus(address.bus());
|
||||
set_slot(address.slot());
|
||||
set_function(address.function());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
void enumerate_all(Function<void(Address, ID)> callback);
|
||||
u8 get_interrupt_line(Address);
|
||||
u32 get_BAR0(Address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue