Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/acpi.h

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
34struct acpi_2_rsdp
35{
36// 1.0
37charSignature[8];
38uint8_tChecksum;
39charOEMID[6];
40uint8_tRevision;
41uint32_tRsdtAddress;
42// 2.0
43uint32_tLength;
44uint64_tXsdtAddress;
45uint8_tExtendedChecksum;
46charReserved[3];
47} __attribute__((packed));
48
49struct acpi_2_header
50{
51charSignature[4];
52uint32_tLength;
53uint8_tRevision;
54uint8_tChecksum;
55charOEMID[6];
56charOEMTableId[8];
57uint32_tOEMRevision;
58uint32_tCreatorId;
59uint32_tCreatorRevision;
60} __attribute__((packed));
61
62// TODO Migrate
63struct acpi_2_rsdt
64{
65charSignature[4];
66uint32_tLength;
67uint8_tRevision;
68uint8_tChecksum;
69charOEMID[6];
70charOEMTableId[8];
71uint32_tOEMRevision;
72uint32_tCreatorId;
73uint32_tCreatorRevision;
74} __attribute__((packed));
75
76// TODO Migrate
77struct acpi_2_xsdt
78{
79charSignature[4];
80uint32_tLength;
81uint8_tRevision;
82uint8_tChecksum;
83charOEMID[6];
84charOEMTableId[8];
85uint32_tOEMRevision;
86uint32_tCreatorId;
87uint32_tCreatorRevision;
88} __attribute__((packed));
89
90// TODO Migrate
91struct acpi_2_ssdt
92{
93charSignature[4];
94uint32_tLength;
95uint8_tRevision;
96uint8_tChecksum;
97charOEMID[6];
98charOEMTableId[8];
99uint32_tOEMRevision;
100uint32_tCreatorId;
101uint32_tCreatorRevision;
102} __attribute__((packed));
103
104struct ssdt_pmref
105{
106char oemTabID[9];
107char byte1;
108uint32_t addr;
109char byte2;
110uint32_t length;
111char byte3;
112} __attribute__((packed));
113
114// TODO Migrate
115struct acpi_2_dsdt
116{
117charSignature[4];
118uint32_tLength;
119uint8_tRevision;
120uint8_tChecksum;
121charOEMID[6];
122charOEMTableId[8];
123uint32_tOEMRevision;
124uint32_tCreatorId;
125uint32_tCreatorRevision;
126} __attribute__((packed));
127
128// TODO Migrate
129struct acpi_2_fadt
130{
131charSignature[4];
132uint32_tLength;
133uint8_tRevision;
134uint8_tChecksum;
135charOEMID[6];
136charOEMTableId[8];
137uint32_tOEMRevision;
138uint32_tCreatorId;
139uint32_tCreatorRevision;
140uint32_tFACS;
141uint32_tDSDT;
142uint8_tModel;// JrCs
143uint8_tPM_Profile;// JrCs
144uint16_tSCI_Interrupt;
145uint32_tSMI_Command_Port;
146uint8_tACPI_Enable;
147uint8_tACPI_Disable;
148uint8_tS4BIOS_Command;
149uint8_tPState_Control;
150uint32_tPM1A_Event_Block_Address;
151uint32_tPM1B_Event_Block_Address;
152uint32_tPM1A_Control_Block_Address;
153uint32_tPM1B_Control_Block_Address;
154uint32_tPM2_Control_Block_Address;
155uint32_tPM_Timer_Block_Address;
156uint32_tGPE0_Block_Address;
157uint32_tGPE1_Block_Address;
158uint8_tPM1_Event_Block_Length;
159uint8_tPM1_Control_Block_Length;
160uint8_tPM2_Control_Block_Length;
161uint8_tPM_Timer_Block_Length;
162uint8_tGPE0_Block_Length;
163uint8_tGPE1_Block_Length;
164uint8_tGPE1_Base_Offset;
165uint8_tCST_Support;
166uint16_tC2_Latency;
167uint16_tC3_Latency;
168uint16_tCPU_Cache_Size;
169uint16_tCache_Flush_Stride;
170uint8_tDuty_Cycle_Offset;
171uint8_tDuty_Cycle_Width;
172uint8_tRTC_Day_Alarm_Index;
173uint8_tRTC_Month_Alarm_Index;
174uint8_tRTC_Century_Index;
175uint16_tBoot_Flags;
176uint8_tReserved0;
177/* Begin Asere */
178//Reset Fix
179uint32_t Flags;
180// Reset Register
181uint8_t Reset_SpaceID;
182uint8_t Reset_BitWidth;
183uint8_t Reset_BitOffset;
184uint8_t Reset_AccessWidth;
185uint64_t Reset_Address;
186uint8_t Reset_Value;
187uint8_t Reserved[3];
188
189uint64_t X_FACS;
190uint64_t X_DSDT;
191/* End Asere */
192/*We absolutely don't care about theese fields*/
193uint8_tnotimp2[96];
194} __attribute__((packed));
195
196struct acpi_2_facs
197{
198charSignature[4];
199uint32_tLength;
200uint32_t HWSignature;
201uint32_t FWWakingVector32;
202uint32_t GlobalLock;
203uint32_t Flags;
204uint64_t FWWakingVector64;
205uint8_t Version;
206uint8_t Reserved[31];
207} __attribute__((packed));
208
209#endif /* !__LIBSAIO_ACPI_H */
210

Archive Download this file

Revision: 2683