2021-09-11 05:19:33 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2023-06-09 15:22:30 -03:00
|
|
|
#include <AK/Platform.h>
|
|
|
|
|
#if ARCH(X86_64)
|
|
|
|
|
# include <Kernel/Arch/x86_64/Firmware/PCBIOS/SysFSDirectory.h>
|
|
|
|
|
#endif
|
2022-04-22 06:46:19 -03:00
|
|
|
#include <Kernel/FileSystem/SysFS/Registry.h>
|
2022-04-22 03:44:31 -03:00
|
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.h>
|
2021-09-11 05:19:33 -03:00
|
|
|
#include <Kernel/Firmware/ACPI/Parser.h>
|
|
|
|
|
#include <Kernel/Sections.h>
|
|
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
2023-06-09 15:17:02 -03:00
|
|
|
UNMAP_AFTER_INIT void SysFSFirmwareDirectory::initialize()
|
2021-09-11 05:19:33 -03:00
|
|
|
{
|
2023-06-09 15:17:02 -03:00
|
|
|
auto firmware_directory = adopt_ref_if_nonnull(new (nothrow) SysFSFirmwareDirectory()).release_nonnull();
|
2021-09-11 05:19:33 -03:00
|
|
|
SysFSComponentRegistry::the().register_new_component(firmware_directory);
|
|
|
|
|
firmware_directory->create_components();
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 15:17:02 -03:00
|
|
|
void SysFSFirmwareDirectory::create_components()
|
2021-09-11 05:19:33 -03:00
|
|
|
{
|
2022-04-22 19:06:37 -03:00
|
|
|
MUST(m_child_components.with([&](auto& list) -> ErrorOr<void> {
|
2023-06-09 15:22:30 -03:00
|
|
|
#if ARCH(X86_64)
|
|
|
|
|
list.append(SysFSBIOSDirectory::must_create(*this));
|
|
|
|
|
#endif
|
2022-04-22 19:06:37 -03:00
|
|
|
if (ACPI::is_enabled())
|
|
|
|
|
list.append(ACPI::ACPISysFSDirectory::must_create(*this));
|
|
|
|
|
return {};
|
|
|
|
|
}));
|
2021-09-11 05:19:33 -03:00
|
|
|
}
|
|
|
|
|
|
2023-06-09 15:17:02 -03:00
|
|
|
UNMAP_AFTER_INIT SysFSFirmwareDirectory::SysFSFirmwareDirectory()
|
2021-12-12 11:33:08 -03:00
|
|
|
: SysFSDirectory(SysFSComponentRegistry::the().root_directory())
|
2021-09-11 05:19:33 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|