mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
Kernel/PCI: Introduce a new ECAM access mechanism
Now the kernel supports 2 ECAM access methods. MMIOAccess was renamed to WindowedMMIOAccess and is what we had until now - each device that is detected on boot is assigned to a memory-mapped window, so IO operations on multiple devices can occur simultaneously due to creating multiple virtual mappings, hence the name is a memory-mapped window. This commit adds a new class called MMIOAccess (not to be confused with the old MMIOAccess class). This class creates one memory-mapped window. On each IO operation on a configuration space of a device, it maps the requested PCI bus region to that window. Therefore it holds a SpinLock during the operation to ensure that no other PCI bus region was mapped during the call. A user can choose to either use PCI ECAM with memory-mapped window for each device, or for an entire bus. By default, the kernel prefers to map the entire PCI bus region.
This commit is contained in:
parent
441e374396
commit
8abbb7e090
11 changed files with 320 additions and 100 deletions
|
@ -108,13 +108,15 @@ UNMAP_AFTER_INIT bool CommandLine::is_vmmouse_enabled() const
|
|||
return lookup("vmmouse").value_or("on") == "on";
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT bool CommandLine::is_pci_ecam_enabled() const
|
||||
UNMAP_AFTER_INIT PCIAccessLevel CommandLine::pci_access_level() const
|
||||
{
|
||||
auto value = lookup("pci_ecam").value_or("on");
|
||||
if (value == "on")
|
||||
return true;
|
||||
return PCIAccessLevel::MappingPerBus;
|
||||
if (value == "per-device")
|
||||
return PCIAccessLevel::MappingPerDevice;
|
||||
if (value == "off")
|
||||
return false;
|
||||
return PCIAccessLevel::IOAddressing;
|
||||
PANIC("Unknown PCI ECAM setting: {}", value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue