Kernel: Move ACPI to its own directory and namespace

This commit is contained in:
2024-04-04 14:14:28 +03:00
parent 7d34bd8f82
commit e0011d22f2
10 changed files with 170 additions and 161 deletions

View File

@@ -1,6 +1,6 @@
#include <BAN/ScopeGuard.h>
#include <BAN/StringView.h>
#include <kernel/ACPI.h>
#include <kernel/ACPI/ACPI.h>
#include <kernel/BootInfo.h>
#include <kernel/Memory/PageTable.h>
@@ -9,15 +9,15 @@
#define RSPD_SIZE 20
#define RSPDv2_SIZE 36
namespace Kernel
namespace Kernel::ACPI
{
struct RSDT : public ACPI::SDTHeader
struct RSDT : public SDTHeader
{
uint32_t entries[];
} __attribute__((packed));
struct XSDT : public ACPI::SDTHeader
struct XSDT : public SDTHeader
{
uint64_t entries[];
} __attribute__((packed));
@@ -82,7 +82,7 @@ namespace Kernel
return nullptr;
}
static bool is_valid_std_header(const ACPI::SDTHeader* header)
static bool is_valid_std_header(const SDTHeader* header)
{
uint8_t sum = 0;
for (uint32_t i = 0; i < header->length; i++)
@@ -225,7 +225,7 @@ namespace Kernel
return {};
}
const ACPI::SDTHeader* ACPI::get_header(BAN::StringView signature, uint32_t index)
const SDTHeader* ACPI::get_header(BAN::StringView signature, uint32_t index)
{
if (signature.size() != 4)
{

View File

@@ -1,5 +1,5 @@
#include <BAN/ScopeGuard.h>
#include <kernel/ACPI.h>
#include <kernel/ACPI/ACPI.h>
#include <kernel/APIC.h>
#include <kernel/CPUID.h>
#include <kernel/Debug.h>
@@ -132,7 +132,7 @@ namespace Kernel
return nullptr;
}
const MADT* madt = (const MADT*)Kernel::ACPI::get().get_header("APIC"sv, 0);
const MADT* madt = (const MADT*)ACPI::ACPI::get().get_header("APIC"sv, 0);
if (madt == nullptr)
{
dprintln("Could not find MADT header");

View File

@@ -1,5 +1,5 @@
#include <BAN/ScopeGuard.h>
#include <kernel/ACPI.h>
#include <kernel/ACPI/ACPI.h>
#include <kernel/FS/DevFS/FileSystem.h>
#include <kernel/IDT.h>
#include <kernel/Input/PS2/Config.h>
@@ -244,7 +244,7 @@ namespace Kernel::Input
// FIXME: Initialise USB Controllers
// Determine if the PS/2 Controller Exists
auto* fadt = static_cast<const ACPI::FADT*>(ACPI::get().get_header("FACP"sv, 0));
auto* fadt = static_cast<const ACPI::FADT*>(ACPI::ACPI::get().get_header("FACP"sv, 0));
if (fadt && fadt->revision > 1 && !(fadt->iapc_boot_arch & (1 << 1)))
{
dwarnln_if(DEBUG_PS2, "No PS/2 available");

View File

@@ -1,5 +1,5 @@
#include <BAN/ScopeGuard.h>
#include <kernel/ACPI.h>
#include <kernel/ACPI/ACPI.h>
#include <kernel/IDT.h>
#include <kernel/InterruptController.h>
#include <kernel/Memory/PageTable.h>
@@ -131,7 +131,7 @@ namespace Kernel
BAN::ErrorOr<void> HPET::initialize(bool force_pic)
{
auto* header = static_cast<const ACPI::HPET*>(ACPI::get().get_header("HPET"sv, 0));
auto* header = static_cast<const ACPI::HPET*>(ACPI::ACPI::get().get_header("HPET"sv, 0));
if (header == nullptr)
return BAN::Error::from_errno(ENODEV);

View File

@@ -1,4 +1,4 @@
#include <kernel/ACPI.h>
#include <kernel/ACPI/ACPI.h>
#include <kernel/Arch.h>
#include <kernel/BootInfo.h>
#include <kernel/Debug.h>
@@ -116,7 +116,7 @@ extern "C" void kernel_main(uint32_t boot_magic, uint32_t boot_info)
parse_command_line();
dprintln("command line parsed, root='{}', console='{}'", cmdline.root, cmdline.console);
MUST(ACPI::initialize());
MUST(ACPI::ACPI::initialize());
dprintln("ACPI initialized");
InterruptController::initialize(cmdline.force_pic);

View File

@@ -1,4 +1,4 @@
#include <kernel/ACPI.h>
#include <kernel/ACPI/ACPI.h>
#include <kernel/IO.h>
#include <kernel/Memory/kmalloc.h>
#include <kernel/Memory/PageTable.h>
@@ -51,7 +51,7 @@ void laihost_panic(const char* msg)
void* laihost_scan(const char* sig, size_t index)
{
return (void*)ACPI::get().get_header(sig, index);
return (void*)ACPI::ACPI::get().get_header(sig, index);
}
void* laihost_map(size_t address, size_t count)