xref: /reactos/sdk/include/reactos/drivers/acpi/acpi.h (revision ee5ff8ce)
1 /*
2  * PROJECT:         ReactOS PCI Bus Driver
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            include/reactos/drivers/acpi/acpi.h
5  * PURPOSE:         ACPI Tables and NT Registry Data
6  * PROGRAMMERS:     ReactOS Portable Systems Group
7  */
8 
9 //
10 // ACPI BIOS Registry Component Configuration Data
11 //
12 typedef struct _ACPI_E820_ENTRY
13 {
14     PHYSICAL_ADDRESS Base;
15     LARGE_INTEGER Length;
16     ULONGLONG Type;
17 } ACPI_E820_ENTRY, *PACPI_E820_ENTRY;
18 
19 typedef struct _ACPI_BIOS_MULTI_NODE
20 {
21     PHYSICAL_ADDRESS RsdtAddress;
22     ULONGLONG Count;
23     ACPI_E820_ENTRY E820Entry[1];
24 } ACPI_BIOS_MULTI_NODE, *PACPI_BIOS_MULTI_NODE;
25 
26 //
27 // ACPI Signatures
28 //
29 #define RSDP_SIGNATURE 0x2052545020445352       // "RSD PTR "
30 #define FACS_SIGNATURE 0x53434146               // "FACS"
31 #define FADT_SIGNATURE 0x50434146               // "FACP"
32 #define RSDT_SIGNATURE 0x54445352               // "RSDT"
33 #define APIC_SIGNATURE 0x43495041               // "APIC"
34 #define DSDT_SIGNATURE 0x54445344               // "DSDT"
35 #define SSDT_SIGNATURE 0x54445353               // "SSDT"
36 #define PSDT_SIGNATURE 0x54445350               // "PSDT"
37 #define SBST_SIGNATURE 0x54534253               // "SBST"
38 #define DBGP_SIGNATURE 0x50474244               // "DBGP"
39 #define XSDT_SIGNATURE 'TDSX'
40 #define BOOT_SIGNATURE 'TOOB'
41 #define SRAT_SIGNATURE 'TARS'
42 #define WDRT_SIGNATURE 'TRDW'
43 #define BGRT_SIGNATURE  0x54524742      	// "BGRT"
44 
45 //
46 // FADT Flags
47 //
48 #define ACPI_TMR_VAL_EXT 	0x100
49 
50 //
51 // BGRT Flags
52 //
53 #define BGRT_STATUS_IMAGE_VALID 0x01
54 
55 //
56 // BGRT Image Types
57 //
58 typedef enum _BGRT_IMAGE_TYPE
59 {
60     BgrtImageTypeBitmap,
61     BgrtImageTypeMax
62 } BGRT_IMAGE_TYPE, *PBGRT_IMAGE_TYPE;
63 
64 //
65 // ACPI Generic Register Address
66 //
67 #include <pshpack1.h>
68 typedef struct _GEN_ADDR
69 {
70     UCHAR AddressSpaceID;
71     UCHAR BitWidth;
72     UCHAR BitOffset;
73     UCHAR Reserved;
74     PHYSICAL_ADDRESS Address;
75 } GEN_ADDR, *PGEN_ADDR;
76 
77 //
78 // ACPI BIOS Structures (packed)
79 //
80 typedef struct  _RSDP
81 {
82     // ACPI v1.0 (Rev=0)
83     ULONGLONG Signature;
84     UCHAR Checksum;
85     UCHAR OEMID[6];
86     UCHAR Revision; // Was reserved before ACPI v2.0 (Rev=2).
87     ULONG RsdtAddress;
88     // ACPI v2.0 (Rev=2)
89     ULONG Length;
90     PHYSICAL_ADDRESS XsdtAddress;
91     UCHAR XChecksum;
92     UCHAR Reserved33[3];
93 } RSDP;
94 typedef RSDP *PRSDP;
95 
96 typedef struct _DESCRIPTION_HEADER
97 {
98     // ACPI v1.0
99     ULONG Signature;
100     ULONG Length;
101     UCHAR Revision;
102     UCHAR Checksum;
103     UCHAR OEMID[6];
104     UCHAR OEMTableID[8];
105     ULONG OEMRevision;
106     UCHAR CreatorID[4];
107     ULONG CreatorRev;
108 } DESCRIPTION_HEADER;
109 typedef DESCRIPTION_HEADER *PDESCRIPTION_HEADER;
110 
111 typedef struct _FACS
112 {
113     // ACPI v1.0 (Ver=0)
114     ULONG Signature;
115     ULONG Length;
116     ULONG HardwareSignature;
117     ULONG pFirmwareWakingVector;
118     ULONG GlobalLock;
119     ULONG Flags;
120     PHYSICAL_ADDRESS x_FirmwareWakingVector; // Was reserved before ACPI v2.0 (Ver=1).
121     UCHAR Version; // Was reserved before ACPI v2.0 (Ver=1).
122     UCHAR Reserved33[3];
123     ULONG OsFlags; // Was reserved before ACPI v4.0 (Ver=2).
124     UCHAR Reserved40[24];
125 } FACS;
126 typedef FACS *PFACS;
127 
128 typedef struct _FADT
129 {
130     // ACPI v1.0 (H.Rev=1)
131     DESCRIPTION_HEADER Header;
132     ULONG facs;
133     ULONG dsdt;
134     UCHAR reserved44[1]; // Was int_model before ACPI v2.0.
135     UCHAR pm_profile;
136     USHORT sci_int_vector;
137     ULONG smi_cmd_io_port;
138     UCHAR acpi_on_value;
139     UCHAR acpi_off_value;
140     UCHAR s4bios_req;
141     UCHAR pstate_control;
142     ULONG pm1a_evt_blk_io_port;
143     ULONG pm1b_evt_blk_io_port;
144     ULONG pm1a_ctrl_blk_io_port;
145     ULONG pm1b_ctrl_blk_io_port;
146     ULONG pm2_ctrl_blk_io_port;
147     ULONG pm_tmr_blk_io_port;
148     ULONG gp0_blk_io_port;
149     ULONG gp1_blk_io_port;
150     UCHAR pm1_evt_len;
151     UCHAR pm1_ctrl_len;
152     UCHAR pm2_ctrl_len;
153     UCHAR pm_tmr_len;
154     UCHAR gp0_blk_len;
155     UCHAR gp1_blk_len;
156     UCHAR gp1_base;
157     UCHAR cstate_control;
158     USHORT lvl2_latency;
159     USHORT lvl3_latency;
160     USHORT flush_size;
161     USHORT flush_stride;
162     UCHAR duty_offset;
163     UCHAR duty_width;
164     UCHAR day_alarm_index;
165     UCHAR month_alarm_index;
166     UCHAR century_alarm_index;
167     USHORT boot_arch;
168     UCHAR reserved111[1];
169     ULONG flags;
170     // ACPI v1.5 (H.Rev=3)
171     GEN_ADDR reset_reg;
172     UCHAR reset_val;
173     USHORT arm_boot_arch; // Was reserved before ACPI v5.1.
174     UCHAR minor_revision; // Was reserved before ACPI v5.1.
175     PHYSICAL_ADDRESS x_firmware_ctrl;
176     PHYSICAL_ADDRESS x_dsdt;
177     GEN_ADDR x_pm1a_evt_blk;
178     GEN_ADDR x_pm1b_evt_blk;
179     GEN_ADDR x_pm1a_ctrl_blk;
180     GEN_ADDR x_pm1b_ctrl_blk;
181     GEN_ADDR x_pm2_ctrl_blk;
182     GEN_ADDR x_pm_tmr_blk;
183     GEN_ADDR x_gp0_blk;
184     GEN_ADDR x_gp1_blk;
185     // ACPI v5.0 (H.Rev=5)
186     GEN_ADDR sleep_control;
187     GEN_ADDR sleep_status;
188     // ACPI v6.0 (H.Rev=6)
189     ULONGLONG hypervisor_id;
190 } FADT;
191 typedef FADT *PFADT;
192 
193 typedef struct _DSDT
194 {
195     DESCRIPTION_HEADER Header;
196     UCHAR DiffDefBlock[ANYSIZE_ARRAY];
197 } DSDT;
198 typedef DSDT *PDSDT;
199 
200 typedef struct _RSDT
201 {
202     // ACPI v1.0 (H.Rev=1)
203     DESCRIPTION_HEADER Header;
204     ULONG Tables[ANYSIZE_ARRAY];
205 } RSDT;
206 typedef RSDT *PRSDT;
207 
208 typedef struct _XSDT
209 {
210     // ACPI v2.0 (H.Rev=1)
211     DESCRIPTION_HEADER Header;
212     PHYSICAL_ADDRESS Tables[ANYSIZE_ARRAY];
213 } XSDT;
214 typedef XSDT *PXSDT;
215 #include <poppack.h>
216 
217 //
218 // Microsoft-specific (pretty much) ACPI Tables, normal MS ABI packing
219 //
220 typedef struct _DEBUG_PORT_TABLE
221 {
222     DESCRIPTION_HEADER Header;
223     UCHAR InterfaceType;
224     UCHAR Reserved[3];
225     GEN_ADDR BaseAddress;
226 } DEBUG_PORT_TABLE, *PDEBUG_PORT_TABLE;
227 
228 typedef struct _WATCHDOG_TABLE
229 {
230     DESCRIPTION_HEADER Header;
231     GEN_ADDR ControlRegister;
232     GEN_ADDR CountRegister;
233     USHORT PciDeviceId;
234     USHORT PciVendorId;
235     UCHAR PciBus;
236     UCHAR PciDevice;
237     UCHAR PciFunction;
238     UCHAR PciSegment;
239     USHORT MaxCount;
240     UCHAR Units;
241 } WATCHDOG_TABLE, *PWATCHDOG_TABLE;
242 
243 typedef struct _BOOT_TABLE
244 {
245     DESCRIPTION_HEADER Header;
246     UCHAR CMOSIndex;
247     UCHAR Reserved[3];
248 } BOOT_TABLE, *PBOOT_TABLE;
249 
250 typedef struct _ACPI_SRAT
251 {
252     DESCRIPTION_HEADER Header;
253     UCHAR TableRevision;
254     ULONG Reserved[2];
255 } ACPI_SRAT, *PACPI_SRAT;
256 
257 typedef struct _BGRT_TABLE
258 {
259     DESCRIPTION_HEADER Header;
260     USHORT Version;
261     UCHAR Status;
262     UCHAR ImageType;
263     ULONGLONG LogoAddress;
264     ULONG OffsetX;
265     ULONG OffsetY;
266 } BGRT_TABLE, *PBGRT_TABLE;
267 
268 /* EOF */
269