summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-02-10 15:15:06 +0200
committerAndreas Kling <kling@serenityos.org>2022-03-08 21:52:10 +0100
commitf8df21c7e72e3b4fab0c6688b21580b9852118f9 (patch)
tree4b82072412a5f5965a821edcff3ab2212ae1e521 /Kernel
parenta91da672160f30a31cd81fc4825857bd33e9f534 (diff)
downloadserenity-f8df21c7e72e3b4fab0c6688b21580b9852118f9.zip
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.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Bus/PCI/SysFSPCI.cpp19
1 files changed, 19 insertions, 0 deletions
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();
}