ladybird/Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.cpp
Liav A d550b09871 Kernel: Move PC BIOS-related code to the x86_64 architecture directory
All code that is related to PC BIOS should not be in the Kernel/Firmware
directory as this directory is for abstracted and platform-agnostic code
like ACPI (and device tree parsing in the future).

This fixes a problem with the aarch64 architecure, as these machines
don't have any PC-BIOS in them so actually trying to access these memory
locations (EBDA, BIOS ROM) does not make any sense, as they're specific
to x86 machines only.
2023-06-19 23:49:00 +02:00

42 lines
1.2 KiB
C++

/*
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Platform.h>
#if ARCH(X86_64)
# include <Kernel/Arch/x86_64/Firmware/PCBIOS/SysFSDirectory.h>
#endif
#include <Kernel/FileSystem/SysFS/Registry.h>
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.h>
#include <Kernel/Firmware/ACPI/Parser.h>
#include <Kernel/Sections.h>
namespace Kernel {
UNMAP_AFTER_INIT void SysFSFirmwareDirectory::initialize()
{
auto firmware_directory = adopt_ref_if_nonnull(new (nothrow) SysFSFirmwareDirectory()).release_nonnull();
SysFSComponentRegistry::the().register_new_component(firmware_directory);
firmware_directory->create_components();
}
void SysFSFirmwareDirectory::create_components()
{
MUST(m_child_components.with([&](auto& list) -> ErrorOr<void> {
#if ARCH(X86_64)
list.append(SysFSBIOSDirectory::must_create(*this));
#endif
if (ACPI::is_enabled())
list.append(ACPI::ACPISysFSDirectory::must_create(*this));
return {};
}));
}
UNMAP_AFTER_INIT SysFSFirmwareDirectory::SysFSFirmwareDirectory()
: SysFSDirectory(SysFSComponentRegistry::the().root_directory())
{
}
}