1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +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:
Liav A 2020-01-02 15:54:32 +02:00 committed by Andreas Kling
parent 5e430e4eb4
commit 2a4a19aed8
4 changed files with 110 additions and 24 deletions

View file

@ -4,8 +4,10 @@
#include <AK/Types.h>
#include <Kernel/ACPI/Definitions.h>
#include <Kernel/PCI/Access.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/PhysicalRegion.h>
#include <Kernel/VM/Region.h>
#include <Kernel/VM/VMObject.h>
class PCI::MMIOAccess final : public PCI::Access {
public:
@ -15,7 +17,7 @@ public:
virtual String get_access_type() override final { return "MMIO-Access"; };
protected:
MMIOAccess(ACPI_RAW::MCFG&);
explicit MMIOAccess(ACPI_RAW::MCFG&);
private:
virtual u8 read8_field(Address address, u32) override final;
@ -35,7 +37,9 @@ private:
ACPI_RAW::MCFG& m_mcfg;
HashMap<u16, MMIOSegment*>& m_segments;
OwnPtr<Region> m_mmio_segment;
RefPtr<VMObject> m_mmio_window;
OwnPtr<Region> m_mmio_window_region;
PCI::ChangeableAddress m_mapped_address;
};
class PCI::MMIOSegment {