diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp index f5b17f040a3..fa6b8873813 100644 --- a/Kernel/Bus/PCI/Access.cpp +++ b/Kernel/Bus/PCI/Access.cpp @@ -368,45 +368,45 @@ void Capability::write32(u32 field, u32 value) PCI::write32(m_address, m_ptr + field, value); } -UNMAP_AFTER_INIT NonnullRefPtr ExposedDeviceFolder::create(const SysFSDirectory& parent_folder, Address address) +UNMAP_AFTER_INIT NonnullRefPtr PCIDeviceSysFSDirectory::create(const SysFSDirectory& parent_folder, Address address) { - return adopt_ref(*new (nothrow) ExposedDeviceFolder(parent_folder, address)); + return adopt_ref(*new (nothrow) PCIDeviceSysFSDirectory(parent_folder, address)); } -UNMAP_AFTER_INIT ExposedDeviceFolder::ExposedDeviceFolder(const SysFSDirectory& parent_folder, Address address) +UNMAP_AFTER_INIT PCIDeviceSysFSDirectory::PCIDeviceSysFSDirectory(const SysFSDirectory& parent_folder, Address address) : SysFSDirectory(String::formatted("{:04x}:{:04x}:{:02x}.{}", address.seg(), address.bus(), address.device(), address.function()), parent_folder) { - m_components.append(ExposedAttribute::create("vendor", *this, PCI_VENDOR_ID, 2)); - m_components.append(ExposedAttribute::create("device_id", *this, PCI_DEVICE_ID, 2)); - m_components.append(ExposedAttribute::create("class", *this, PCI_CLASS, 1)); - m_components.append(ExposedAttribute::create("subclass", *this, PCI_SUBCLASS, 1)); - m_components.append(ExposedAttribute::create("revision", *this, PCI_REVISION_ID, 1)); - m_components.append(ExposedAttribute::create("progif", *this, PCI_PROG_IF, 1)); - m_components.append(ExposedAttribute::create("subsystem_vendor", *this, PCI_SUBSYSTEM_VENDOR_ID, 2)); - m_components.append(ExposedAttribute::create("subsystem_id", *this, PCI_SUBSYSTEM_ID, 2)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("vendor", *this, PCI_VENDOR_ID, 2)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("device_id", *this, PCI_DEVICE_ID, 2)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("class", *this, PCI_CLASS, 1)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("subclass", *this, PCI_SUBCLASS, 1)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("revision", *this, PCI_REVISION_ID, 1)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("progif", *this, PCI_PROG_IF, 1)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("subsystem_vendor", *this, PCI_SUBSYSTEM_VENDOR_ID, 2)); + m_components.append(PCIDeviceAttributeSysFSComponent::create("subsystem_id", *this, PCI_SUBSYSTEM_ID, 2)); } -UNMAP_AFTER_INIT void BusExposedFolder::initialize() +UNMAP_AFTER_INIT void PCIBusSysFSDirectory::initialize() { - auto pci_folder = adopt_ref(*new (nothrow) BusExposedFolder()); + auto pci_folder = adopt_ref(*new (nothrow) PCIBusSysFSDirectory()); SysFSComponentRegistry::the().register_new_component(pci_folder); } -UNMAP_AFTER_INIT BusExposedFolder::BusExposedFolder() +UNMAP_AFTER_INIT PCIBusSysFSDirectory::PCIBusSysFSDirectory() : SysFSDirectory("pci", SysFSComponentRegistry::the().root_folder()) { PCI::enumerate([&](const Address& address, ID) { - auto pci_device = PCI::ExposedDeviceFolder::create(*this, address); + auto pci_device = PCI::PCIDeviceSysFSDirectory::create(*this, address); m_components.append(pci_device); }); } -NonnullRefPtr ExposedAttribute::create(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width) +NonnullRefPtr PCIDeviceAttributeSysFSComponent::create(String name, const PCIDeviceSysFSDirectory& device, size_t offset, size_t field_bytes_width) { - return adopt_ref(*new (nothrow) ExposedAttribute(name, device, offset, field_bytes_width)); + return adopt_ref(*new (nothrow) PCIDeviceAttributeSysFSComponent(name, device, offset, field_bytes_width)); } -ExposedAttribute::ExposedAttribute(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width) +PCIDeviceAttributeSysFSComponent::PCIDeviceAttributeSysFSComponent(String name, const PCIDeviceSysFSDirectory& device, size_t offset, size_t field_bytes_width) : SysFSComponent(name) , m_device(device) , m_offset(offset) @@ -414,7 +414,7 @@ ExposedAttribute::ExposedAttribute(String name, const ExposedDeviceFolder& devic { } -KResultOr ExposedAttribute::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription*) const +KResultOr PCIDeviceAttributeSysFSComponent::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription*) const { auto blob = try_to_generate_buffer(); if (!blob) @@ -429,7 +429,7 @@ KResultOr ExposedAttribute::read_bytes(off_t offset, size_t count, UserO return nread; } -size_t ExposedAttribute::size() const +size_t PCIDeviceAttributeSysFSComponent::size() const { auto buffer = try_to_generate_buffer(); if (!buffer) @@ -437,7 +437,7 @@ size_t ExposedAttribute::size() const return buffer->size(); } -OwnPtr ExposedAttribute::try_to_generate_buffer() const +OwnPtr PCIDeviceAttributeSysFSComponent::try_to_generate_buffer() const { String value; switch (m_field_bytes_width) { diff --git a/Kernel/Bus/PCI/Access.h b/Kernel/Bus/PCI/Access.h index 6ef4915bc36..16a82b0b25e 100644 --- a/Kernel/Bus/PCI/Access.h +++ b/Kernel/Bus/PCI/Access.h @@ -14,37 +14,37 @@ namespace Kernel::PCI { -class BusExposedFolder final : public SysFSDirectory { +class PCIBusSysFSDirectory final : public SysFSDirectory { public: static void initialize(); private: - BusExposedFolder(); + PCIBusSysFSDirectory(); }; -class ExposedDeviceFolder final : public SysFSDirectory { +class PCIDeviceSysFSDirectory final : public SysFSDirectory { public: - static NonnullRefPtr create(const SysFSDirectory&, Address); + static NonnullRefPtr create(const SysFSDirectory&, Address); const Address& address() const { return m_address; } private: - ExposedDeviceFolder(const SysFSDirectory&, Address); + PCIDeviceSysFSDirectory(const SysFSDirectory&, Address); Address m_address; }; -class ExposedAttribute : public SysFSComponent { +class PCIDeviceAttributeSysFSComponent : public SysFSComponent { public: - static NonnullRefPtr create(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width); + static NonnullRefPtr create(String name, const PCIDeviceSysFSDirectory& device, size_t offset, size_t field_bytes_width); virtual KResultOr read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override; - virtual ~ExposedAttribute() {}; + virtual ~PCIDeviceAttributeSysFSComponent() {}; virtual size_t size() const override; protected: virtual OwnPtr try_to_generate_buffer() const; - ExposedAttribute(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width); - NonnullRefPtr m_device; + PCIDeviceAttributeSysFSComponent(String name, const PCIDeviceSysFSDirectory& device, size_t offset, size_t field_bytes_width); + NonnullRefPtr m_device; size_t m_offset; size_t m_field_bytes_width; }; diff --git a/Kernel/Bus/PCI/Initializer.cpp b/Kernel/Bus/PCI/Initializer.cpp index 466ea84f310..ffcf449a647 100644 --- a/Kernel/Bus/PCI/Initializer.cpp +++ b/Kernel/Bus/PCI/Initializer.cpp @@ -51,7 +51,7 @@ UNMAP_AFTER_INIT void initialize() VERIFY_NOT_REACHED(); } - PCI::BusExposedFolder::initialize(); + PCI::PCIBusSysFSDirectory::initialize(); PCI::enumerate([&](const Address& address, ID id) { dmesgln("{} {}", address, id);