mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
Kernel/PCI: Create device configuration space mapping before creating a physical ID
When enumerating the hardware using MMIO mode, it would attempt to create a physical ID first. To create a physical ID, it needs to retrieve the capabilities of the device. When enumerating the first device, there would be no device configuration space mappings. Access::get_capabilities_pointer calls PCI::read16, which in turn goes to MMIOAccess::read16_field. MMIOAccess::read16_field attempts to get a device configuration space and fully expects to get one. However, since this is the first device, there are none and it crashes with an m_has_value assertion failure. This fixes this by creating the device configuration space mapping before creating the physical ID. Testing with VMware Player 16.1.0.
This commit is contained in:
parent
a95d230a3e
commit
9ab9e548f4
1 changed files with 1 additions and 1 deletions
|
@ -122,8 +122,8 @@ MMIOAccess::MMIOAccess(PhysicalAddress p_mcfg)
|
|||
InterruptDisabler disabler;
|
||||
|
||||
enumerate_hardware([&](const Address& address, ID id) {
|
||||
m_physical_ids.append({ address, id, get_capabilities(address) });
|
||||
m_mapped_device_regions.append(make<DeviceConfigurationSpaceMapping>(address, m_segments.get(address.seg()).value()));
|
||||
m_physical_ids.append({ address, id, get_capabilities(address) });
|
||||
#ifdef PCI_DEBUG
|
||||
dbg() << "PCI: Mapping device @ pci (" << String::format("%w", address.seg()) << ":" << String::format("%b", address.bus()) << ":" << String::format("%b", address.slot()) << "." << String::format("%b", address.function()) << ")"
|
||||
<< " " << m_mapped_device_regions.last().vaddr() << " " << m_mapped_device_regions.last().paddr();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue