From 38bf7863d0bcaa0ee77a17bd9c1460e909d8b0d7 Mon Sep 17 00:00:00 2001 From: Liav A Date: Wed, 27 Jul 2022 18:13:42 +0300 Subject: [PATCH] Kernel: Remove PCI information node from ProcFS The SystemMonitor program was the last client to utilize this node, and now it is not using this node anymore, we can simply remove this for good. --- Kernel/Bus/PCI/Access.cpp | 2 -- Kernel/GlobalProcessExposed.cpp | 50 --------------------------------- Kernel/ProcessExposed.h | 1 - 3 files changed, 53 deletions(-) diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp index c8c7af840d4..22b2ff1ea2b 100644 --- a/Kernel/Bus/PCI/Access.cpp +++ b/Kernel/Bus/PCI/Access.cpp @@ -96,7 +96,6 @@ 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; @@ -108,7 +107,6 @@ 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)); diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp index adb00f3e876..dc0c0eba552 100644 --- a/Kernel/GlobalProcessExposed.cpp +++ b/Kernel/GlobalProcessExposed.cpp @@ -728,43 +728,6 @@ private: } }; -// FIXME: Remove this after we enumerate the SysFS from lspci and SystemMonitor -class ProcFSPCI final : public ProcFSGlobalInformation { -public: - static NonnullRefPtr must_create(); - -private: - ProcFSPCI(); - virtual ErrorOr try_generate(KBufferBuilder& builder) override - { - auto array = TRY(JsonArraySerializer<>::try_create(builder)); - ErrorOr result; // FIXME: Make this nicer - TRY(PCI::enumerate([&array, &result](PCI::DeviceIdentifier const& device_identifier) { - if (result.is_error()) - return; - result = ([&]() -> ErrorOr { - auto obj = TRY(array.add_object()); - TRY(obj.add("domain"sv, device_identifier.address().domain())); - TRY(obj.add("bus"sv, device_identifier.address().bus())); - TRY(obj.add("device"sv, device_identifier.address().device())); - TRY(obj.add("function"sv, device_identifier.address().function())); - TRY(obj.add("vendor_id"sv, device_identifier.hardware_id().vendor_id)); - TRY(obj.add("device_id"sv, device_identifier.hardware_id().device_id)); - TRY(obj.add("revision_id"sv, device_identifier.revision_id().value())); - TRY(obj.add("subclass"sv, device_identifier.subclass_code().value())); - TRY(obj.add("class"sv, device_identifier.class_code().value())); - TRY(obj.add("subsystem_id"sv, device_identifier.subsystem_id().value())); - TRY(obj.add("subsystem_vendor_id"sv, device_identifier.subsystem_vendor_id().value())); - TRY(obj.finish()); - return {}; - })(); - })); - TRY(result); - TRY(array.finish()); - return {}; - } -}; - class ProcFSDevices final : public ProcFSGlobalInformation { public: static NonnullRefPtr must_create(); @@ -901,10 +864,6 @@ UNMAP_AFTER_INIT NonnullRefPtr ProcFSKeymap::must_create() { return adopt_ref_if_nonnull(new (nothrow) ProcFSKeymap).release_nonnull(); } -UNMAP_AFTER_INIT NonnullRefPtr ProcFSPCI::must_create() -{ - return adopt_ref_if_nonnull(new (nothrow) ProcFSPCI).release_nonnull(); -} UNMAP_AFTER_INIT NonnullRefPtr ProcFSDevices::must_create() { return adopt_ref_if_nonnull(new (nothrow) ProcFSDevices).release_nonnull(); @@ -967,10 +926,6 @@ UNMAP_AFTER_INIT ProcFSKeymap::ProcFSKeymap() : ProcFSGlobalInformation("keymap"sv) { } -UNMAP_AFTER_INIT ProcFSPCI::ProcFSPCI() - : ProcFSGlobalInformation("pci"sv) -{ -} UNMAP_AFTER_INIT ProcFSDevices::ProcFSDevices() : ProcFSGlobalInformation("devices"sv) { @@ -1011,11 +966,6 @@ UNMAP_AFTER_INIT ProcFSSystemDirectory::ProcFSSystemDirectory(ProcFSRootDirector { } -UNMAP_AFTER_INIT void ProcFSRootDirectory::add_pci_node(Badge) -{ - m_components.append(ProcFSPCI::must_create()); -} - UNMAP_AFTER_INIT NonnullRefPtr ProcFSRootDirectory::must_create() { auto directory = adopt_ref(*new (nothrow) ProcFSRootDirectory); diff --git a/Kernel/ProcessExposed.h b/Kernel/ProcessExposed.h index cd2edf5321b..6a51aafa070 100644 --- a/Kernel/ProcessExposed.h +++ b/Kernel/ProcessExposed.h @@ -152,7 +152,6 @@ public: virtual ErrorOr> lookup(StringView name) override; static NonnullRefPtr must_create(); - void add_pci_node(Badge); virtual ~ProcFSRootDirectory(); private: