diff options
| author | Alexey Gavrilov <rebovas@yahoo.com> | 2024-03-19 16:44:56 +0700 |
|---|---|---|
| committer | Alexey Gavrilov <rebovas@yahoo.com> | 2024-03-19 16:44:56 +0700 |
| commit | 3678f5d1970feea92f787928ceb9f53ed0b4c1e2 (patch) | |
| tree | e2e5ff20d9144cda59b7a651d9622ad22ee89e86 /drivers/acpi/acpi.h | |
| parent | 32e05e127197275bc4931e0beb6e1f7f29fb5d4d (diff) | |
Implementation acpi tables through structs
Diffstat (limited to 'drivers/acpi/acpi.h')
| -rw-r--r-- | drivers/acpi/acpi.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/acpi/acpi.h b/drivers/acpi/acpi.h new file mode 100644 index 0000000..28221d7 --- /dev/null +++ b/drivers/acpi/acpi.h @@ -0,0 +1,101 @@ +#include <types.h> +#include <StringOperations.h> + + +typedef decltype(nullptr) nulltype; + +struct descHeader +{ + char signature[4]; + uint32 length; + uint8 revision; + uint8 checksum; + char oemId[6]; + uint64 oemTableId; + uint32 oemRevision; + uint32 creatorId; + uint32 creatorRevision; +} __attribute__((packed)); + +struct rsdt +{ + descHeader header; + uint32 firstEntryAddr; +} __attribute__((packed, aligned(sizeof(uint32)))); + +struct xsdt +{ + descHeader header; + uint64 firstEntryAddr; +} __attribute__((packed, aligned(sizeof(uint32)))); + +struct rsdp +{ + char signature[8]; + uint8 checksum; + char oemId[6]; + uint8 revision; + uint32 rsdtAddress; + uint32 length; + uint32 xsdtAddress; + uint8 extendedChecksum; + char reserved[3]; +} __attribute__((packed)); + +class DescriptorTable +{ + +}; + +class Entry +{ + private: + uint32 sizeHeadersInBytes; + const struct descHeader **headers; + // DescriptorTable &tables; + public: + Entry() = delete; + Entry(const uint32 sizeEntriesBytes, const uint32 *entryAddress); + Entry(const nulltype null); +}; + +class Rsdt +{ + private: + const struct rsdt* rsdtStruct; + Entry entry; + public: + Rsdt() = delete; + Rsdt(const uint32 addr); + Rsdt(const nulltype null); + const Entry& getEntries(); +}; + +class Xsdt +{ + private: + const struct xsdt* xsdtStruct; + public: + Xsdt() = delete; + Xsdt(const uint32 addr); + Xsdt(const nulltype null); +}; + +class Rsdp +{ + private: + const uint8 validFieldRevision = 2; + // RSDP memory address areas in IA-PC systems + const char *rsdpSign = "RSD PTR "; + const MemArea rsdpRomMemArea = MemArea(0xe0000, 0xfffff); + const MemArea rsdpEbdaMemArea = MemArea(0x80000, 0x803ff); + + const struct rsdp *rsdpStruct; + Rsdt rsdtObj; + Xsdt xsdtObj; + public: + Rsdp(); + const Rsdt *getRsdt() const; + const Xsdt *getXsdt() const; + +}; |
