From f8df21c7e72e3b4fab0c6688b21580b9852118f9 Mon Sep 17 00:00:00 2001 From: Liav A Date: Thu, 10 Feb 2022 15:15:06 +0200 Subject: Kernel: Expose PCI BAR addresses in sysfs Regardless of whether we use those BARs or not, expose them so userland can use these values for its usage. --- Kernel/Bus/PCI/SysFSPCI.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Kernel') diff --git a/Kernel/Bus/PCI/SysFSPCI.cpp b/Kernel/Bus/PCI/SysFSPCI.cpp index e1f3e42703..2f9d28a44f 100644 --- a/Kernel/Bus/PCI/SysFSPCI.cpp +++ b/Kernel/Bus/PCI/SysFSPCI.cpp @@ -32,6 +32,13 @@ UNMAP_AFTER_INIT PCIDeviceSysFSDirectory::PCIDeviceSysFSDirectory(NonnullOwnPtr< m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::PROG_IF, 1)); m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::SUBSYSTEM_VENDOR_ID, 2)); m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::SUBSYSTEM_ID, 2)); + + m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR0, 4)); + m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR1, 4)); + m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR2, 4)); + m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR3, 4)); + m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR4, 4)); + m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR5, 4)); } UNMAP_AFTER_INIT void PCIBusSysFSDirectory::initialize() @@ -68,6 +75,18 @@ StringView PCIDeviceAttributeSysFSComponent::name() const return "subsystem_vendor"sv; case PCI::RegisterOffset::SUBSYSTEM_ID: return "subsystem_id"sv; + case PCI::RegisterOffset::BAR0: + return "bar0"sv; + case PCI::RegisterOffset::BAR1: + return "bar1"sv; + case PCI::RegisterOffset::BAR2: + return "bar2"sv; + case PCI::RegisterOffset::BAR3: + return "bar3"sv; + case PCI::RegisterOffset::BAR4: + return "bar4"sv; + case PCI::RegisterOffset::BAR5: + return "bar5"sv; default: VERIFY_NOT_REACHED(); } -- cgit v1.2.3