summaryrefslogtreecommitdiff
path: root/Kernel/Firmware
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-12-12 16:58:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-12-14 09:01:33 +0100
commitbbdb55126c69b06dec4655613bd4aacd81437f84 (patch)
tree4d121554d8d9d9136263c32a03db9fa988c4a11a /Kernel/Firmware
parent381fdaa163d8af320f71f817e2922c5d396e2b28 (diff)
downloadserenity-bbdb55126c69b06dec4655613bd4aacd81437f84.zip
Kernel/SysFS: Don't allocate ACPISysFS components in constructors
Instead defer it to a method to be called after the construction of ACPISysFSDirectory.
Diffstat (limited to 'Kernel/Firmware')
-rw-r--r--Kernel/Firmware/ACPI/Parser.cpp21
-rw-r--r--Kernel/Firmware/ACPI/Parser.h1
2 files changed, 14 insertions, 8 deletions
diff --git a/Kernel/Firmware/ACPI/Parser.cpp b/Kernel/Firmware/ACPI/Parser.cpp
index ea3458824b..706cfa284f 100644
--- a/Kernel/Firmware/ACPI/Parser.cpp
+++ b/Kernel/Firmware/ACPI/Parser.cpp
@@ -67,14 +67,7 @@ UNMAP_AFTER_INIT ACPISysFSComponent::ACPISysFSComponent(NonnullOwnPtr<KString> t
{
}
-UNMAP_AFTER_INIT NonnullRefPtr<ACPISysFSDirectory> ACPISysFSDirectory::must_create(FirmwareSysFSDirectory& firmware_directory)
-{
- auto acpi_directory = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) ACPISysFSDirectory(firmware_directory)));
- return acpi_directory;
-}
-
-UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory)
- : SysFSDirectory(firmware_directory)
+UNMAP_AFTER_INIT void ACPISysFSDirectory::find_tables_and_register_them_as_components()
{
NonnullRefPtrVector<SysFSComponent> components;
size_t ssdt_count = 0;
@@ -99,6 +92,18 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory&
}
}
+UNMAP_AFTER_INIT NonnullRefPtr<ACPISysFSDirectory> ACPISysFSDirectory::must_create(FirmwareSysFSDirectory& firmware_directory)
+{
+ auto acpi_directory = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) ACPISysFSDirectory(firmware_directory)));
+ acpi_directory->find_tables_and_register_them_as_components();
+ return acpi_directory;
+}
+
+UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory)
+ : SysFSDirectory(firmware_directory)
+{
+}
+
void Parser::enumerate_static_tables(Function<void(StringView, PhysicalAddress, size_t)> callback)
{
for (auto& p_table : m_sdt_pointers) {
diff --git a/Kernel/Firmware/ACPI/Parser.h b/Kernel/Firmware/ACPI/Parser.h
index b00525221e..ee300cf9c3 100644
--- a/Kernel/Firmware/ACPI/Parser.h
+++ b/Kernel/Firmware/ACPI/Parser.h
@@ -26,6 +26,7 @@ public:
static NonnullRefPtr<ACPISysFSDirectory> must_create(FirmwareSysFSDirectory& firmware_directory);
private:
+ void find_tables_and_register_them_as_components();
explicit ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory);
};