mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
Everywhere: Debug macros instead of constexpr.
This was done with the following script: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
This commit is contained in:
parent
bb483f7ef4
commit
8465683dcf
98 changed files with 414 additions and 972 deletions
|
@ -74,34 +74,34 @@ PhysicalID Access::get_physical_id(Address address) const
|
|||
|
||||
u8 Access::early_read8_field(Address address, u32 field)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Early reading 8-bit field {:#08x} for {}", field, address);
|
||||
dbgln<PCI_DEBUG>("PCI: Early reading 8-bit field {:#08x} for {}", field, address);
|
||||
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
||||
return IO::in8(PCI_VALUE_PORT + (field & 3));
|
||||
}
|
||||
|
||||
u16 Access::early_read16_field(Address address, u32 field)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Early reading 16-bit field {:#08x} for {}", field, address);
|
||||
dbgln<PCI_DEBUG>("PCI: Early reading 16-bit field {:#08x} for {}", field, address);
|
||||
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
||||
return IO::in16(PCI_VALUE_PORT + (field & 2));
|
||||
}
|
||||
|
||||
u32 Access::early_read32_field(Address address, u32 field)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Early reading 32-bit field {:#08x} for {}", field, address);
|
||||
dbgln<PCI_DEBUG>("PCI: Early reading 32-bit field {:#08x} for {}", field, address);
|
||||
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
|
||||
return IO::in32(PCI_VALUE_PORT);
|
||||
}
|
||||
|
||||
u16 Access::early_read_type(Address address)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Early reading type for {}", address);
|
||||
dbgln<PCI_DEBUG>("PCI: Early reading type for {}", address);
|
||||
return (early_read8_field(address, PCI_CLASS) << 8u) | early_read8_field(address, PCI_SUBCLASS);
|
||||
}
|
||||
|
||||
void Access::enumerate_functions(int type, u8 bus, u8 slot, u8 function, Function<void(Address, ID)>& callback)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Enumerating function type={}, bus={}, slot={}, function={}", type, bus, slot, function);
|
||||
dbgln<PCI_DEBUG>("PCI: Enumerating function type={}, bus={}, slot={}, function={}", type, bus, slot, function);
|
||||
Address address(0, bus, slot, function);
|
||||
if (type == -1 || type == early_read_type(address))
|
||||
callback(address, { early_read16_field(address, PCI_VENDOR_ID), early_read16_field(address, PCI_DEVICE_ID) });
|
||||
|
@ -117,7 +117,7 @@ void Access::enumerate_functions(int type, u8 bus, u8 slot, u8 function, Functio
|
|||
|
||||
void Access::enumerate_slot(int type, u8 bus, u8 slot, Function<void(Address, ID)>& callback)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Enumerating slot type={}, bus={}, slot={}", type, bus, slot);
|
||||
dbgln<PCI_DEBUG>("PCI: Enumerating slot type={}, bus={}, slot={}", type, bus, slot);
|
||||
Address address(0, bus, slot, 0);
|
||||
if (early_read16_field(address, PCI_VENDOR_ID) == PCI_NONE)
|
||||
return;
|
||||
|
@ -133,7 +133,7 @@ void Access::enumerate_slot(int type, u8 bus, u8 slot, Function<void(Address, ID
|
|||
|
||||
void Access::enumerate_bus(int type, u8 bus, Function<void(Address, ID)>& callback)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Enumerating bus type={}, bus={}", type, bus);
|
||||
dbgln<PCI_DEBUG>("PCI: Enumerating bus type={}, bus={}", type, bus);
|
||||
for (u8 slot = 0; slot < 32; ++slot)
|
||||
enumerate_slot(type, bus, slot, callback);
|
||||
}
|
||||
|
@ -152,12 +152,12 @@ void enumerate(Function<void(Address, ID)> callback)
|
|||
|
||||
Optional<u8> get_capabilities_pointer(Address address)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Getting capabilities pointer for {}", address);
|
||||
dbgln<PCI_DEBUG>("PCI: Getting capabilities pointer for {}", address);
|
||||
if (PCI::read16(address, PCI_STATUS) & (1 << 4)) {
|
||||
dbgln<debug_pci>("PCI: Found capabilities pointer for {}", address);
|
||||
dbgln<PCI_DEBUG>("PCI: Found capabilities pointer for {}", address);
|
||||
return PCI::read8(address, PCI_CAPABILITIES_POINTER);
|
||||
}
|
||||
dbgln<debug_pci>("PCI: No capabilities pointer for {}", address);
|
||||
dbgln<PCI_DEBUG>("PCI: No capabilities pointer for {}", address);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -168,16 +168,16 @@ PhysicalID get_physical_id(Address address)
|
|||
|
||||
Vector<Capability> get_capabilities(Address address)
|
||||
{
|
||||
dbgln<debug_pci>("PCI: Getting capabilities for {}", address);
|
||||
dbgln<PCI_DEBUG>("PCI: Getting capabilities for {}", address);
|
||||
auto capabilities_pointer = PCI::get_capabilities_pointer(address);
|
||||
if (!capabilities_pointer.has_value()) {
|
||||
dbgln<debug_pci>("PCI: No capabilities for {}", address);
|
||||
dbgln<PCI_DEBUG>("PCI: No capabilities for {}", address);
|
||||
return {};
|
||||
}
|
||||
Vector<Capability> capabilities;
|
||||
auto capability_pointer = capabilities_pointer.value();
|
||||
while (capability_pointer != 0) {
|
||||
dbgln<debug_pci>("PCI: Reading in capability at {:#02x} for {}", capability_pointer, address);
|
||||
dbgln<PCI_DEBUG>("PCI: Reading in capability at {:#02x} for {}", capability_pointer, address);
|
||||
u16 capability_header = PCI::read16(address, capability_pointer);
|
||||
u8 capability_id = capability_header & 0xff;
|
||||
capability_pointer = capability_header >> 8;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue