diff options
author | Liav A <liavalb@gmail.com> | 2022-01-21 18:09:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-02 18:41:54 +0100 |
commit | b849e4f907b38a1bb2f4f7f10153f733d606cd61 (patch) | |
tree | a67bbc41bd0c4aebce5f00cf424f935eca398186 /Kernel/Bus | |
parent | 2272d932150f5858a8b80b1c5c35fdb8e953150a (diff) | |
download | serenity-b849e4f907b38a1bb2f4f7f10153f733d606cd61.zip |
Kernel/PCI: Don't create /proc/pci if PCI is disabled
Reading from /proc/pci assumes we have PCI enabled and also enumerated.
However, if PCI is disabled for some reason, we can't allow the user to
read from it as there's no valuable data we can supply.
Diffstat (limited to 'Kernel/Bus')
-rw-r--r-- | Kernel/Bus/PCI/Access.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp index f33191106f..67c3cea1f2 100644 --- a/Kernel/Bus/PCI/Access.cpp +++ b/Kernel/Bus/PCI/Access.cpp @@ -17,6 +17,7 @@ #include <Kernel/Memory/MemoryManager.h> #include <Kernel/Memory/Region.h> #include <Kernel/Memory/TypedMapping.h> +#include <Kernel/ProcessExposed.h> #include <Kernel/Sections.h> namespace Kernel::PCI { @@ -95,6 +96,7 @@ UNMAP_AFTER_INIT bool Access::find_and_register_pci_host_bridges_from_acpi_mcfg_ UNMAP_AFTER_INIT bool Access::initialize_for_multiple_pci_domains(PhysicalAddress mcfg_table) { VERIFY(!Access::is_initialized()); + ProcFSComponentRegistry::the().root_directory().add_pci_node({}); auto* access = new Access(); if (!access->find_and_register_pci_host_bridges_from_acpi_mcfg_table(mcfg_table)) return false; @@ -106,6 +108,7 @@ UNMAP_AFTER_INIT bool Access::initialize_for_multiple_pci_domains(PhysicalAddres UNMAP_AFTER_INIT bool Access::initialize_for_one_pci_domain() { VERIFY(!Access::is_initialized()); + ProcFSComponentRegistry::the().root_directory().add_pci_node({}); auto* access = new Access(); auto host_bridge = HostBridge::must_create_with_io_access(); access->add_host_controller(move(host_bridge)); |