mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
Kernel: Mark PCI Access enumeration functions as UNMAP_AFTER_INIT
This commit is contained in:
parent
9e6f0fd925
commit
40ea464fb0
1 changed files with 11 additions and 11 deletions
|
@ -53,34 +53,34 @@ PhysicalID Access::get_physical_id(Address address) const
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 Access::early_read8_field(Address address, u32 field)
|
UNMAP_AFTER_INIT u8 Access::early_read8_field(Address address, u32 field)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Early reading 8-bit field {:#08x} for {}", field, address);
|
dbgln_if(PCI_DEBUG, "PCI: Early reading 8-bit field {:#08x} for {}", field, address);
|
||||||
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
||||||
return IO::in8(PCI_VALUE_PORT + (field & 3));
|
return IO::in8(PCI_VALUE_PORT + (field & 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 Access::early_read16_field(Address address, u32 field)
|
UNMAP_AFTER_INIT u16 Access::early_read16_field(Address address, u32 field)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Early reading 16-bit field {:#08x} for {}", field, address);
|
dbgln_if(PCI_DEBUG, "PCI: Early reading 16-bit field {:#08x} for {}", field, address);
|
||||||
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
||||||
return IO::in16(PCI_VALUE_PORT + (field & 2));
|
return IO::in16(PCI_VALUE_PORT + (field & 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Access::early_read32_field(Address address, u32 field)
|
UNMAP_AFTER_INIT u32 Access::early_read32_field(Address address, u32 field)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Early reading 32-bit field {:#08x} for {}", field, address);
|
dbgln_if(PCI_DEBUG, "PCI: Early reading 32-bit field {:#08x} for {}", field, address);
|
||||||
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
||||||
return IO::in32(PCI_VALUE_PORT);
|
return IO::in32(PCI_VALUE_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 Access::early_read_type(Address address)
|
UNMAP_AFTER_INIT u16 Access::early_read_type(Address address)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Early reading type for {}", address);
|
dbgln_if(PCI_DEBUG, "PCI: Early reading type for {}", address);
|
||||||
return (early_read8_field(address, PCI_CLASS) << 8u) | early_read8_field(address, PCI_SUBCLASS);
|
return (early_read8_field(address, PCI_CLASS) << 8u) | early_read8_field(address, PCI_SUBCLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Access::enumerate_functions(int type, u8 bus, u8 device, u8 function, Function<void(Address, ID)>& callback, bool recursive)
|
UNMAP_AFTER_INIT void Access::enumerate_functions(int type, u8 bus, u8 device, u8 function, Function<void(Address, ID)>& callback, bool recursive)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Enumerating function type={}, bus={}, device={}, function={}", type, bus, device, function);
|
dbgln_if(PCI_DEBUG, "PCI: Enumerating function type={}, bus={}, device={}, function={}", type, bus, device, function);
|
||||||
Address address(0, bus, device, function);
|
Address address(0, bus, device, function);
|
||||||
|
@ -95,7 +95,7 @@ void Access::enumerate_functions(int type, u8 bus, u8 device, u8 function, Funct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Access::enumerate_device(int type, u8 bus, u8 device, Function<void(Address, ID)>& callback, bool recursive)
|
UNMAP_AFTER_INIT void Access::enumerate_device(int type, u8 bus, u8 device, Function<void(Address, ID)>& callback, bool recursive)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Enumerating device type={}, bus={}, device={}", type, bus, device);
|
dbgln_if(PCI_DEBUG, "PCI: Enumerating device type={}, bus={}, device={}", type, bus, device);
|
||||||
Address address(0, bus, device, 0);
|
Address address(0, bus, device, 0);
|
||||||
|
@ -111,26 +111,26 @@ void Access::enumerate_device(int type, u8 bus, u8 device, Function<void(Address
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Access::enumerate_bus(int type, u8 bus, Function<void(Address, ID)>& callback, bool recursive)
|
UNMAP_AFTER_INIT void Access::enumerate_bus(int type, u8 bus, Function<void(Address, ID)>& callback, bool recursive)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Enumerating bus type={}, bus={}", type, bus);
|
dbgln_if(PCI_DEBUG, "PCI: Enumerating bus type={}, bus={}", type, bus);
|
||||||
for (u8 device = 0; device < 32; ++device)
|
for (u8 device = 0; device < 32; ++device)
|
||||||
enumerate_device(type, bus, device, callback, recursive);
|
enumerate_device(type, bus, device, callback, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Access::enumerate(Function<void(Address, ID)>& callback) const
|
UNMAP_AFTER_INIT void Access::enumerate(Function<void(Address, ID)>& callback) const
|
||||||
{
|
{
|
||||||
for (auto& physical_id : m_physical_ids) {
|
for (auto& physical_id : m_physical_ids) {
|
||||||
callback(physical_id.address(), physical_id.id());
|
callback(physical_id.address(), physical_id.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enumerate(Function<void(Address, ID)> callback)
|
UNMAP_AFTER_INIT void enumerate(Function<void(Address, ID)> callback)
|
||||||
{
|
{
|
||||||
Access::the().enumerate(callback);
|
Access::the().enumerate(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<u8> get_capabilities_pointer(Address address)
|
UNMAP_AFTER_INIT Optional<u8> get_capabilities_pointer(Address address)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Getting capabilities pointer for {}", address);
|
dbgln_if(PCI_DEBUG, "PCI: Getting capabilities pointer for {}", address);
|
||||||
if (PCI::read16(address, PCI_STATUS) & (1 << 4)) {
|
if (PCI::read16(address, PCI_STATUS) & (1 << 4)) {
|
||||||
|
@ -146,7 +146,7 @@ PhysicalID get_physical_id(Address address)
|
||||||
return Access::the().get_physical_id(address);
|
return Access::the().get_physical_id(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Capability> get_capabilities(Address address)
|
UNMAP_AFTER_INIT Vector<Capability> get_capabilities(Address address)
|
||||||
{
|
{
|
||||||
dbgln_if(PCI_DEBUG, "PCI: Getting capabilities for {}", address);
|
dbgln_if(PCI_DEBUG, "PCI: Getting capabilities for {}", address);
|
||||||
auto capabilities_pointer = PCI::get_capabilities_pointer(address);
|
auto capabilities_pointer = PCI::get_capabilities_pointer(address);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue