1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
asynts 2021-01-14 22:37:57 +01:00 committed by Andreas Kling
parent dd727d1fec
commit c6ebca5b45
8 changed files with 68 additions and 106 deletions

View file

@ -24,11 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/IO.h>
#include <Kernel/PCI/IOAccess.h>
//#define PCI_DEBUG
namespace Kernel {
namespace PCI {
@ -36,9 +35,7 @@ void IOAccess::initialize()
{
if (!Access::is_initialized()) {
new IOAccess();
#ifdef PCI_DEBUG
dbgln("PCI: IO access initialised.");
#endif
dbgln<debug_pci>("PCI: IO access initialised.");
}
}
@ -52,49 +49,37 @@ IOAccess::IOAccess()
u8 IOAccess::read8_field(Address address, u32 field)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO Reading 8-bit field 0x" << String::formatted("{:08x}", field) << " for " << address;
#endif
dbgln<debug_pci>("PCI: IO Reading 8-bit field {:#08x} for {}", field, address);
return Access::early_read8_field(address, field);
}
u16 IOAccess::read16_field(Address address, u32 field)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO Reading 16-bit field 0x" << String::formatted("{:08x}", field) << " for " << address;
#endif
dbgln<debug_pci>("PCI: IO Reading 16-bit field {:#08x} for {}", field, address);
return Access::early_read16_field(address, field);
}
u32 IOAccess::read32_field(Address address, u32 field)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO Reading 32-bit field 0x" << String::formatted("{:08x}", field) << " for " << address;
#endif
dbgln<debug_pci>("PCI: IO Reading 32-bit field {:#08x} for {}", field, address);
return Access::early_read32_field(address, field);
}
void IOAccess::write8_field(Address address, u32 field, u8 value)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO Writing to 8-bit field 0x" << String::formatted("{:08x}", field) << ", value=0x" << String::formatted("{:02x}", value) << " for " << address;
#endif
dbgln<debug_pci>("PCI: IO Writing to 8-bit field {:#08x}, value={:#02x} for {}", field, value, address);
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
IO::out8(PCI_VALUE_PORT + (field & 3), value);
}
void IOAccess::write16_field(Address address, u32 field, u16 value)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO Writing to 16-bit field 0x" << String::formatted("{:08x}", field) << ", value=0x" << String::formatted("{:04x}", value) << " for " << address;
#endif
dbgln<debug_pci>("PCI: IO Writing to 16-bit field {:#08x}, value={:#02x} for {}", field, value, address);
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
IO::out16(PCI_VALUE_PORT + (field & 2), value);
}
void IOAccess::write32_field(Address address, u32 field, u32 value)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO Writing to 32-bit field 0x" << String::formatted("{:08x}", field) << ", value=0x" << String::formatted("{:08x}", value) << " for " << address;
#endif
dbgln<debug_pci>("PCI: IO Writing to 32-bit field {:#08x}, value={:#02x} for {}", field, value, address);
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
IO::out32(PCI_VALUE_PORT, value);
}