diff options
Diffstat (limited to 'Kernel/PCI')
-rw-r--r-- | Kernel/PCI/Access.h | 8 | ||||
-rw-r--r-- | Kernel/PCI/IOAccess.h | 28 | ||||
-rw-r--r-- | Kernel/PCI/MMIOAccess.cpp | 10 | ||||
-rw-r--r-- | Kernel/PCI/MMIOAccess.h | 8 |
4 files changed, 29 insertions, 25 deletions
diff --git a/Kernel/PCI/Access.h b/Kernel/PCI/Access.h index 40f8d37495..d6a3877ed2 100644 --- a/Kernel/PCI/Access.h +++ b/Kernel/PCI/Access.h @@ -41,10 +41,10 @@ public: static Access& the(); static bool is_initialized(); - virtual uint32_t get_segments_count() = 0; - virtual uint8_t get_segment_start_bus(u32 segment) = 0; - virtual uint8_t get_segment_end_bus(u32 segment) = 0; - virtual String get_access_type() = 0; + virtual uint32_t segment_count() const = 0; + virtual uint8_t segment_start_bus(u32 segment) const = 0; + virtual uint8_t segment_end_bus(u32 segment) const = 0; + virtual const char* access_type() const = 0; virtual void write8_field(Address address, u32 field, u8 value) = 0; virtual void write16_field(Address address, u32 field, u16 value) = 0; diff --git a/Kernel/PCI/IOAccess.h b/Kernel/PCI/IOAccess.h index 7fc58e148b..665d2d6560 100644 --- a/Kernel/PCI/IOAccess.h +++ b/Kernel/PCI/IOAccess.h @@ -28,29 +28,29 @@ #include <Kernel/PCI/Access.h> namespace Kernel { +namespace PCI { -class PCI::IOAccess final : public PCI::Access { +class IOAccess final : public PCI::Access { public: static void initialize(); - virtual void enumerate_all(Function<void(Address, ID)>&) override final; - - virtual String get_access_type() override final { return "IO-Access"; }; - virtual uint32_t get_segments_count() { return 1; }; - - virtual void write8_field(Address address, u32, u8) override final; - virtual void write16_field(Address address, u32, u16) override final; - virtual void write32_field(Address address, u32, u32) override final; protected: IOAccess(); private: - virtual u8 read8_field(Address address, u32) override final; - virtual u16 read16_field(Address address, u32) override final; - virtual u32 read32_field(Address address, u32) override final; + virtual void enumerate_all(Function<void(Address, ID)>&) override; + virtual const char* access_type() const override { return "IO-Access"; }; + virtual uint32_t segment_count() const override { return 1; }; + virtual void write8_field(Address address, u32, u8) override final; + virtual void write16_field(Address address, u32, u16) override final; + virtual void write32_field(Address address, u32, u32) override final; + virtual u8 read8_field(Address address, u32) override; + virtual u16 read16_field(Address address, u32) override; + virtual u32 read32_field(Address address, u32) override; - virtual uint8_t get_segment_start_bus(u32) { return 0x0; }; - virtual uint8_t get_segment_end_bus(u32) { return 0xFF; }; + virtual uint8_t segment_start_bus(u32) const override { return 0x0; } + virtual uint8_t segment_end_bus(u32) const override { return 0xFF; } }; } +} diff --git a/Kernel/PCI/MMIOAccess.cpp b/Kernel/PCI/MMIOAccess.cpp index ae3b3ca751..aebb5dfce4 100644 --- a/Kernel/PCI/MMIOAccess.cpp +++ b/Kernel/PCI/MMIOAccess.cpp @@ -33,16 +33,18 @@ namespace Kernel { #define PCI_MMIO_CONFIG_SPACE_SIZE 4096 -uint32_t PCI::MMIOAccess::get_segments_count() +uint32_t PCI::MMIOAccess::segment_count() const { return m_segments.size(); } -uint8_t PCI::MMIOAccess::get_segment_start_bus(u32 seg) + +uint8_t PCI::MMIOAccess::segment_start_bus(u32 seg) const { ASSERT(m_segments.contains(seg)); return m_segments.get(seg).value()->get_start_bus(); } -uint8_t PCI::MMIOAccess::get_segment_end_bus(u32 seg) + +uint8_t PCI::MMIOAccess::segment_end_bus(u32 seg) const { ASSERT(m_segments.contains(seg)); return m_segments.get(seg).value()->get_end_bus(); @@ -213,10 +215,12 @@ PCI::MMIOSegment::MMIOSegment(PhysicalAddress segment_base_addr, u8 start_bus, u , m_end_bus(end_bus) { } + u8 PCI::MMIOSegment::get_start_bus() { return m_start_bus; } + u8 PCI::MMIOSegment::get_end_bus() { return m_end_bus; diff --git a/Kernel/PCI/MMIOAccess.h b/Kernel/PCI/MMIOAccess.h index f03bb18885..ae408bb5fb 100644 --- a/Kernel/PCI/MMIOAccess.h +++ b/Kernel/PCI/MMIOAccess.h @@ -42,8 +42,8 @@ public: static void initialize(PhysicalAddress mcfg); virtual void enumerate_all(Function<void(Address, ID)>&) override final; - virtual String get_access_type() override final { return "MMIO-Access"; }; - virtual u32 get_segments_count(); + virtual const char* access_type() const override { return "MMIO-Access"; }; + virtual u32 segment_count() const override; virtual void write8_field(Address address, u32, u8) override final; virtual void write16_field(Address address, u32, u16) override final; @@ -58,8 +58,8 @@ private: virtual u32 read32_field(Address address, u32) override final; void map_device(Address address); - virtual u8 get_segment_start_bus(u32); - virtual u8 get_segment_end_bus(u32); + virtual u8 segment_start_bus(u32) const override; + virtual u8 segment_end_bus(u32) const override; PhysicalAddress m_mcfg; HashMap<u16, MMIOSegment*>& m_segments; |