79 lines
1.4 KiB
C
79 lines
1.4 KiB
C
#pragma once
|
|
|
|
#include "../types.h"
|
|
|
|
struct AcpiRSDP;
|
|
struct AcpiXSDT;
|
|
|
|
/**
|
|
* Common ACPI table header
|
|
*/
|
|
struct AcpiSDTHeader {
|
|
c8 Signature[4];
|
|
u32 Length;
|
|
u8 Revision;
|
|
u8 Checksum;
|
|
c8 OEMID[6];
|
|
c8 OEMTableID[6];
|
|
u32 OEMRevision;
|
|
u32 CreatorID;
|
|
u32 CreatorRevision;
|
|
};
|
|
|
|
/**
|
|
* ACPI Root System Description Pointer
|
|
*/
|
|
struct [[gnu::packed]] AcpiRSDP {
|
|
c8 Signature[8];
|
|
u8 Checksum;
|
|
c8 OEM[6];
|
|
u8 Revision;
|
|
[[gnu::deprecated]] // we dont care :>
|
|
u32 RSDTAddress;
|
|
u32 Length;
|
|
struct AcpiXSDT* XSDTAddress;
|
|
u8 ExtendedChecksum;
|
|
u8 Reserved[3];
|
|
};
|
|
|
|
/**
|
|
* The table of tables
|
|
*/
|
|
struct AcpiXSDT {
|
|
struct AcpiSDTHeader Header;
|
|
|
|
/// Pointers to other tables
|
|
[[gnu::aligned(4), gnu::packed]]
|
|
struct AcpiSDTHeader* Tables[];
|
|
};
|
|
|
|
/**
|
|
* Initialize ACPI code
|
|
*/
|
|
void AcpiInitialize();
|
|
|
|
/**
|
|
* Check if ACPI is present
|
|
*/
|
|
bool AcpiPresent();
|
|
|
|
/**
|
|
* Get the ACPI RSDP, only call if ACPI is present
|
|
*/
|
|
struct AcpiRSDP* AcpiGetRSDP();
|
|
|
|
/**
|
|
* Get the ACPI XSDT, only call if ACPI is present
|
|
*/
|
|
struct AcpiXSDT* AcpiGetXSDT();
|
|
|
|
/**
|
|
* Get the ACPI XSDT entry count, only call if ACPI is present
|
|
*/
|
|
u32 AcpiGetXSDTLength();
|
|
|
|
/**
|
|
* Get the ACPI table with the specified name, returns NULL if not found
|
|
*/
|
|
void* AcpiGetTable(const char TableName[4]);
|