acpi detection
parent
bd0acf8836
commit
8f9329da62
@ -0,0 +1,51 @@
|
||||
#include "textoutput.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
extern TextOutput& term;
|
||||
extern std::uint32_t *acpiRsdp;
|
||||
extern std::uint32_t *acpiRsdpV2;
|
||||
|
||||
struct XSDP {
|
||||
char Signature[8];
|
||||
std::uint8_t Checksum;
|
||||
char OEMID[6];
|
||||
std::uint8_t Revision;
|
||||
std::uint32_t RsdtAddress; // deprecated since version 2.0
|
||||
|
||||
// v2 only!
|
||||
std::uint32_t Length;
|
||||
std::uint64_t XsdtAddress;
|
||||
std::uint8_t ExtendedChecksum;
|
||||
std::uint8_t reserved[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct SDTHeader {
|
||||
char Signature[4];
|
||||
std::uint32_t Length;
|
||||
std::uint8_t Revision;
|
||||
std::uint8_t Checksum;
|
||||
char OEMID[6];
|
||||
char OEMTableID[8];
|
||||
std::uint32_t OEMRevision;
|
||||
std::uint32_t CreatorID;
|
||||
std::uint32_t CreatorRevision;
|
||||
};
|
||||
|
||||
static XSDP *rsdp = nullptr;
|
||||
|
||||
void acpi_initialize()
|
||||
{
|
||||
if (acpiRsdp) {
|
||||
term.write("ACPI v1 detected.\n");
|
||||
rsdp = reinterpret_cast<XSDP *>(acpiRsdp);
|
||||
} else if (acpiRsdpV2) {
|
||||
term.write("ACPI v2 detected, treating as v1.\n");
|
||||
rsdp = reinterpret_cast<XSDP *>(acpiRsdpV2);
|
||||
}
|
||||
|
||||
//if (rsdp) {
|
||||
// auto sdt = reinterpret_cast<SDTHeader *>(rsdp->RsdtAddress);
|
||||
//}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
#ifndef ACPI_HPP
|
||||
#define ACPI_HPP
|
||||
|
||||
void acpi_initialize();
|
||||
|
||||
#endif // ACPI_HPP
|
||||
|
Loading…
Reference in New Issue