summaryrefslogtreecommitdiff
path: root/Kernel/PCI/IOAccess.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-08 17:29:37 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-08 17:29:37 +0200
commita6a8f36a83049b9c0691320745255f99611d15c4 (patch)
treec03329dbc81416e7143de7c4643d9adc4d3500d4 /Kernel/PCI/IOAccess.cpp
parente5ec332eb164d4eb9b4fd7e0ac6249e1e7379a45 (diff)
downloadserenity-a6a8f36a83049b9c0691320745255f99611d15c4.zip
Kernel: Use nested Kernel::PCI namespaces more to reduce PCI:: spam
Diffstat (limited to 'Kernel/PCI/IOAccess.cpp')
-rw-r--r--Kernel/PCI/IOAccess.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/Kernel/PCI/IOAccess.cpp b/Kernel/PCI/IOAccess.cpp
index e464952f25..c7947b3ecb 100644
--- a/Kernel/PCI/IOAccess.cpp
+++ b/Kernel/PCI/IOAccess.cpp
@@ -28,53 +28,54 @@
#include <LibBareMetal/IO.h>
namespace Kernel {
+namespace PCI {
-void PCI::IOAccess::initialize()
+void IOAccess::initialize()
{
- if (!PCI::Access::is_initialized())
- new PCI::IOAccess();
+ if (!Access::is_initialized())
+ new IOAccess();
}
-PCI::IOAccess::IOAccess()
+IOAccess::IOAccess()
{
klog() << "PCI: Using IO Mechanism for PCI Configuartion Space Access";
}
-u8 PCI::IOAccess::read8_field(Address address, u32 field)
+u8 IOAccess::read8_field(Address address, u32 field)
{
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
return IO::in8(PCI_VALUE_PORT + (field & 3));
}
-u16 PCI::IOAccess::read16_field(Address address, u32 field)
+u16 IOAccess::read16_field(Address address, u32 field)
{
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
return IO::in16(PCI_VALUE_PORT + (field & 2));
}
-u32 PCI::IOAccess::read32_field(Address address, u32 field)
+u32 IOAccess::read32_field(Address address, u32 field)
{
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
return IO::in32(PCI_VALUE_PORT);
}
-void PCI::IOAccess::write8_field(Address address, u32 field, u8 value)
+void IOAccess::write8_field(Address address, u32 field, u8 value)
{
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
IO::out8(PCI_VALUE_PORT + (field & 3), value);
}
-void PCI::IOAccess::write16_field(Address address, u32 field, u16 value)
+void IOAccess::write16_field(Address address, u32 field, u16 value)
{
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
IO::out16(PCI_VALUE_PORT + (field & 2), value);
}
-void PCI::IOAccess::write32_field(Address address, u32 field, u32 value)
+void IOAccess::write32_field(Address address, u32 field, u32 value)
{
IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field));
IO::out32(PCI_VALUE_PORT, value);
}
-void PCI::IOAccess::enumerate_all(Function<void(Address, ID)>& callback)
+void IOAccess::enumerate_all(Function<void(Address, ID)>& callback)
{
// Single PCI host controller.
if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) {
@@ -91,3 +92,4 @@ void PCI::IOAccess::enumerate_all(Function<void(Address, ID)>& callback)
}
}
+}