1 | #ifndef __LIBSAIO_ACPI_H␊ |
2 | #define __LIBSAIO_ACPI_H␊ |
3 | ␊ |
4 | #define ACPI_RANGE_START 0x0E0000␊ |
5 | #define ACPI_RANGE_END 0x0FFFFF␊ |
6 | #define EBDA_RANGE_MIN 0x080000␊ |
7 | #define EBDA_RANGE_END 0x09FFFF␊ |
8 | #define BDA_EBDA_START 0x00040E␊ |
9 | ␊ |
10 | #define UINT64_LE_FROM_CHARS(a,b,c,d,e,f,g,h) \␊ |
11 | ( ((uint64_t)h << 56) \␊ |
12 | | ((uint64_t)g << 48) \␊ |
13 | | ((uint64_t)f << 40) \␊ |
14 | | ((uint64_t)e << 32) \␊ |
15 | | ((uint64_t)d << 24) \␊ |
16 | | ((uint64_t)c << 16) \␊ |
17 | | ((uint64_t)b << 8) \␊ |
18 | | ((uint64_t)a << 0) \␊ |
19 | )␊ |
20 | ␊ |
21 | #define ACPI_SIGNATURE_UINT64_LE UINT64_LE_FROM_CHARS('R','S','D',' ','P','T','R',' ')␊ |
22 | ␊ |
23 | #define swapUint16(x) ((((uint16_t)x & 0xFF00) >> 8) | \␊ |
24 | (((uint16_t)x & 0x00FF) << 8))␊ |
25 | ␊ |
26 | #define swapUint32(x) ((((uint32_t)x & 0xFF000000) >> 24) | \␊ |
27 | (((uint32_t)x & 0x00FF0000) >> 16) | \␊ |
28 | (((uint32_t)x & 0x0000FF00) >> 8) | \␊ |
29 | (((uint32_t)x & 0x000000FF) << 24))␊ |
30 | ␊ |
31 | /* Per ACPI 3.0a spec */␊ |
32 | ␊ |
33 | // TODO Migrate␊ |
34 | struct acpi_2_rsdp␊ |
35 | {␊ |
36 | ␉// 1.0␊ |
37 | ␉char␉␉␉Signature[8];␊ |
38 | ␉uint8_t␉␉␉Checksum;␊ |
39 | ␉char␉␉␉OEMID[6];␊ |
40 | ␉uint8_t␉␉␉Revision;␊ |
41 | ␉uint32_t␉␉RsdtAddress;␊ |
42 | ␉// 2.0␊ |
43 | ␉uint32_t␉␉Length;␊ |
44 | ␉uint64_t␉␉XsdtAddress;␊ |
45 | ␉uint8_t␉␉␉ExtendedChecksum;␊ |
46 | ␉char␉␉␉Reserved[3];␊ |
47 | } __attribute__((packed));␊ |
48 | ␊ |
49 | struct acpi_2_header␊ |
50 | {␊ |
51 | ␉char␉␉␉Signature[4];␊ |
52 | ␉uint32_t␉␉Length;␊ |
53 | ␉uint8_t␉␉␉Revision;␊ |
54 | ␉uint8_t␉␉␉Checksum;␊ |
55 | ␉char␉␉␉OEMID[6];␊ |
56 | ␉char␉␉␉OEMTableId[8];␊ |
57 | ␉uint32_t␉␉OEMRevision;␊ |
58 | ␉uint32_t␉␉CreatorId;␊ |
59 | ␉uint32_t␉␉CreatorRevision;␊ |
60 | } __attribute__((packed));␊ |
61 | ␊ |
62 | // TODO Migrate␊ |
63 | struct acpi_2_rsdt␊ |
64 | {␊ |
65 | ␉char␉␉␉Signature[4];␊ |
66 | ␉uint32_t␉␉Length;␊ |
67 | ␉uint8_t␉␉␉Revision;␊ |
68 | ␉uint8_t␉␉␉Checksum;␊ |
69 | ␉char␉␉␉OEMID[6];␊ |
70 | ␉char␉␉␉OEMTableId[8];␊ |
71 | ␉uint32_t␉␉OEMRevision;␊ |
72 | ␉uint32_t␉␉CreatorId;␊ |
73 | ␉uint32_t␉␉CreatorRevision;␊ |
74 | } __attribute__((packed));␊ |
75 | ␊ |
76 | // TODO Migrate␊ |
77 | struct acpi_2_xsdt␊ |
78 | {␊ |
79 | ␉char␉␉␉Signature[4];␊ |
80 | ␉uint32_t␉␉Length;␊ |
81 | ␉uint8_t␉␉␉Revision;␊ |
82 | ␉uint8_t␉␉␉Checksum;␊ |
83 | ␉char␉␉␉OEMID[6];␊ |
84 | ␉char␉␉␉OEMTableId[8];␊ |
85 | ␉uint32_t␉␉OEMRevision;␊ |
86 | ␉uint32_t␉␉CreatorId;␊ |
87 | ␉uint32_t␉␉CreatorRevision;␊ |
88 | } __attribute__((packed));␊ |
89 | ␊ |
90 | // TODO Migrate␊ |
91 | struct acpi_2_ssdt␊ |
92 | {␊ |
93 | ␉char␉␉␉Signature[4];␊ |
94 | ␉uint32_t␉␉Length;␊ |
95 | ␉uint8_t␉␉␉Revision;␊ |
96 | ␉uint8_t␉␉␉Checksum;␊ |
97 | ␉char␉␉␉OEMID[6];␊ |
98 | ␉char␉␉␉OEMTableId[8];␊ |
99 | ␉uint32_t␉␉OEMRevision;␊ |
100 | ␉uint32_t␉␉CreatorId;␊ |
101 | ␉uint32_t␉␉CreatorRevision;␊ |
102 | } __attribute__((packed));␊ |
103 | ␊ |
104 | struct ssdt_pmref␊ |
105 | {␊ |
106 | ␉char oemTabID[9];␊ |
107 | ␉char byte1;␊ |
108 | ␉uint32_t addr;␊ |
109 | ␉char byte2;␊ |
110 | ␉uint32_t length;␊ |
111 | ␉char byte3;␊ |
112 | } __attribute__((packed));␊ |
113 | ␊ |
114 | // TODO Migrate␊ |
115 | struct acpi_2_dsdt␊ |
116 | {␊ |
117 | ␉char␉␉␉Signature[4];␊ |
118 | ␉uint32_t␉␉Length;␊ |
119 | ␉uint8_t␉␉␉Revision;␊ |
120 | ␉uint8_t␉␉␉Checksum;␊ |
121 | ␉char␉␉␉OEMID[6];␊ |
122 | ␉char␉␉␉OEMTableId[8];␊ |
123 | ␉uint32_t␉␉OEMRevision;␊ |
124 | ␉uint32_t␉␉CreatorId;␊ |
125 | ␉uint32_t␉␉CreatorRevision;␊ |
126 | } __attribute__((packed));␊ |
127 | ␊ |
128 | // TODO Migrate␊ |
129 | struct acpi_2_fadt␊ |
130 | {␊ |
131 | ␉char␉␉␉Signature[4];␊ |
132 | ␉uint32_t␉␉Length;␊ |
133 | ␉uint8_t␉␉␉Revision;␊ |
134 | ␉uint8_t␉␉␉Checksum;␊ |
135 | ␉char␉␉␉OEMID[6];␊ |
136 | ␉char␉␉␉OEMTableId[8];␊ |
137 | ␉uint32_t␉␉OEMRevision;␊ |
138 | ␉uint32_t␉␉CreatorId;␊ |
139 | ␉uint32_t␉␉CreatorRevision;␊ |
140 | ␉uint32_t␉␉FACS;␊ |
141 | ␉uint32_t␉␉DSDT;␊ |
142 | ␉uint8_t␉␉␉Model;␉␉␉// JrCs␊ |
143 | ␉uint8_t␉␉␉PM_Profile;␉␉// JrCs␊ |
144 | ␉uint16_t␉␉SCI_Interrupt;␊ |
145 | ␉uint32_t␉␉SMI_Command_Port;␊ |
146 | ␉uint8_t␉␉␉ACPI_Enable;␊ |
147 | ␉uint8_t␉␉␉ACPI_Disable;␊ |
148 | ␉uint8_t␉␉␉S4BIOS_Command;␊ |
149 | ␉uint8_t␉␉␉PState_Control;␊ |
150 | ␉uint32_t␉␉PM1A_Event_Block_Address;␊ |
151 | ␉uint32_t␉␉PM1B_Event_Block_Address;␊ |
152 | ␉uint32_t␉␉PM1A_Control_Block_Address;␊ |
153 | ␉uint32_t␉␉PM1B_Control_Block_Address;␊ |
154 | ␉uint32_t␉␉PM2_Control_Block_Address;␊ |
155 | ␉uint32_t␉␉PM_Timer_Block_Address;␊ |
156 | ␉uint32_t␉␉GPE0_Block_Address;␊ |
157 | ␉uint32_t␉␉GPE1_Block_Address;␊ |
158 | ␉uint8_t␉␉␉PM1_Event_Block_Length;␊ |
159 | ␉uint8_t␉␉␉PM1_Control_Block_Length;␊ |
160 | ␉uint8_t␉␉␉PM2_Control_Block_Length;␊ |
161 | ␉uint8_t␉␉␉PM_Timer_Block_Length;␊ |
162 | ␉uint8_t␉␉␉GPE0_Block_Length;␊ |
163 | ␉uint8_t␉␉␉GPE1_Block_Length;␊ |
164 | ␉uint8_t␉␉␉GPE1_Base_Offset;␊ |
165 | ␉uint8_t␉␉␉CST_Support;␊ |
166 | ␉uint16_t␉␉C2_Latency;␊ |
167 | ␉uint16_t␉␉C3_Latency;␊ |
168 | ␉uint16_t␉␉CPU_Cache_Size;␊ |
169 | ␉uint16_t␉␉Cache_Flush_Stride;␊ |
170 | ␉uint8_t␉␉␉Duty_Cycle_Offset;␊ |
171 | ␉uint8_t␉␉␉Duty_Cycle_Width;␊ |
172 | ␉uint8_t␉␉␉RTC_Day_Alarm_Index;␊ |
173 | ␉uint8_t␉␉␉RTC_Month_Alarm_Index;␊ |
174 | ␉uint8_t␉␉␉RTC_Century_Index;␊ |
175 | ␉uint16_t␉␉Boot_Flags;␊ |
176 | ␉uint8_t␉␉␉Reserved0;␊ |
177 | /* Begin Asere */␊ |
178 | ␉//Reset Fix␊ |
179 | ␉uint32_t Flags;␊ |
180 | ␉// Reset Register␊ |
181 | ␉uint8_t Reset_SpaceID;␊ |
182 | ␉uint8_t Reset_BitWidth;␊ |
183 | ␉uint8_t Reset_BitOffset;␊ |
184 | ␉uint8_t Reset_AccessWidth;␊ |
185 | ␉uint64_t Reset_Address;␊ |
186 | ␉uint8_t Reset_Value;␊ |
187 | ␉uint8_t Reserved[3];␊ |
188 | ␉uint64_t␉ X_FACS;␊ |
189 | ␉uint64_t␉ X_DSDT;␊ |
190 | /* End Asere */␊ |
191 | ␉/*We absolutely don't care about theese fields*/␊ |
192 | ␉uint8_t notimp2[96];␊ |
193 | } __attribute__((packed));␊ |
194 | ␊ |
195 | struct acpi_2_facs␊ |
196 | {␊ |
197 | ␉char␉␉Signature[4];␊ |
198 | ␉uint32_t␉Length;␊ |
199 | ␉uint32_t HWSignature;␊ |
200 | ␉uint32_t FWWakingVector32;␊ |
201 | ␉uint32_t GlobalLock;␊ |
202 | ␉uint32_t Flags;␊ |
203 | ␉uint64_t FWWakingVector64;␊ |
204 | ␉uint8_t Version;␊ |
205 | ␉uint8_t Reserved[31];␊ |
206 | } __attribute__((packed));␊ |
207 | ␊ |
208 | #endif /* !__LIBSAIO_ACPI_H */␊ |
209 | |