Max OS 0.3
Loading...
Searching...
No Matches
acpi.h
Go to the documentation of this file.
1
9#ifndef MAXOS_HARDWARECOMMUNICATION_ACPI_H
10#define MAXOS_HARDWARECOMMUNICATION_ACPI_H
11
12#include <cstdint>
13#include <cstddef>
14#include <system/multiboot.h>
15#include <common/string.h>
17#include <memory/memoryIO.h>
18#include <memory/physical.h>
19
20namespace MaxOS::hardwarecommunication {
21
29 typedef struct PACKED RSDPDescriptor {
30 char signature[8];
31 uint8_t checksum;
32 char OEMID[6];
33 uint8_t revision;
34 uint32_t rsdt_address;
35 } rsdp_descriptor_t;
36
44 typedef struct PACKED RSDPDescriptor2 {
46 uint32_t length;
47 uint64_t xsdt_address;
49 uint8_t reserved[3];
50 } rsdp_descriptor2_t;
51
59 typedef struct PACKED ACPISDTHeader {
60 char signature[4];
61 uint32_t length;
62 uint8_t revision;
63 uint8_t checksum;
64 char OEM_id[6];
65 char OEM_table_id[8];
66 uint32_t OEM_revision;
67 uint32_t creator_id;
69 } acpi_sdt_header_t;
70
78 typedef struct RSDT {
80 uint32_t pointers[];
81 } rsdt_t;
82
90 typedef struct XSDT {
92 uint64_t pointers[];
93 } xsdt_t;
94
100 private:
101 bool m_using_new_acpi = false;
102 acpi_sdt_header_t* m_header;
103
104 xsdt_t* m_xsdt;
105 rsdt_t* m_rsdt;
106
107 rsdp_descriptor_t* m_rsdp;
108 rsdp_descriptor2_t* m_rsdp2;
109
110 static bool validate(const char* descriptor, size_t length);
111
112 void map_tables(uint8_t size_of_table);
113 memory::virtual_address_t* map_descriptor(uint64_t physical);
114
115 uint64_t get_rsdt_pointer(size_t index);
116
117 bool valid_checksum();
118
119 public:
122
123 acpi_sdt_header_t* find(const char* signature);
124 };
125
126}
127
128
129#endif // MAXOS_HARDWARECOMMUNICATION_ACPI_H
struct PACKED MaxOS::hardwarecommunication::ACPISDTHeader acpi_sdt_header_t
Alias for ACPISDTHeader struct.
struct PACKED MaxOS::hardwarecommunication::RSDPDescriptor2 rsdp_descriptor2_t
Alias for RSDPDescriptor2 struct.
struct PACKED MaxOS::hardwarecommunication::RSDPDescriptor rsdp_descriptor_t
Alias for RSDPDescriptor struct.
Handles ACPI table parsing and retrieval.
Definition acpi.h:99
acpi_sdt_header_t * find(const char *signature)
Finds a table with the given signature.
Definition acpi.cpp:163
Parses and provides access to Multiboot 2 information.
Definition multiboot.h:518
Defines classes for memory input and output operations of various bit widths (8, 16,...
Defines a MemoryManager class for handling memory allocation and deallocation.
Defines a PhysicalMemoryManager class for managing physical memory allocation and deallocation of pag...
void virtual_address_t
A type representing a virtual address (used for readability)
Definition physical.h:29
Defines a String class for dynamically sized strings with various operations.
Common header for all ACPI System Description Tables (SDTs)
Definition acpi.h:59
uint32_t creator_revision
The revision number of the utility that created the table.
Definition acpi.h:68
uint8_t checksum
This byte added to all bytes in the table must equal zero mod 0x100 for the table to be valid (includ...
Definition acpi.h:63
uint8_t revision
The version of the ACPI specification that is supported (higher means more features and is backwards ...
Definition acpi.h:62
uint32_t OEM_revision
The revision number of the table as supplied by the OEM.
Definition acpi.h:66
uint32_t length
The size of the entire table, including the header, in bytes.
Definition acpi.h:61
uint32_t creator_id
A vendor ID of the utility that created the table.
Definition acpi.h:67
Root System Description Pointer (RSDP) structure for ACPI 2 and above.
Definition acpi.h:44
uint64_t xsdt_address
The physical address of the XSDT.
Definition acpi.h:47
uint8_t extended_checksum
This byte added to all bytes in the table must equal zero for the table to be valid (including the ve...
Definition acpi.h:48
uint32_t length
The total length of the RSDP structure (including the version 1 part)
Definition acpi.h:46
RSDPDescriptor version_1_info
The ACPI 1 RSDP structure (see rsdp_descriptor_t)
Definition acpi.h:45
Root System Description Pointer (RSDP) structure for ACPI 1.
Definition acpi.h:29
uint8_t checksum
This byte added to all bytes in the table must equal zero for the table to be valid.
Definition acpi.h:31
uint32_t rsdt_address
The physical address of the RSDT (.
Definition acpi.h:34
uint8_t revision
The version of the ACPI specification that is supported (higher means more features and is backwards ...
Definition acpi.h:33
Root System Description Table (RSDT) structure for ACPI 1. Contains the header and an array of pointe...
Definition acpi.h:78
ACPISDTHeader header
The common header for all ACPI SDTs (see acpi_sdt_header_t)
Definition acpi.h:79
uint32_t pointers[]
An array of physical addresses pointing to other ACPI SDTs.
Definition acpi.h:80
Extended System Description Table (XSDT) structure for ACPI 2 and above. Contains the header and an a...
Definition acpi.h:90
uint64_t pointers[]
An array of physical addresses pointing to other ACPI SDTs.
Definition acpi.h:92
ACPISDTHeader header
The common header for all ACPI SDTs (see acpi_sdt_header_t)
Definition acpi.h:91