Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/libsaio/intel_acpi.h

  • Property svn:executable set to *
1/* Per ACPI 3.0a spec */
2
3/*
4 Copyright (c) 2010, Intel Corporation
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 * Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
15 * Neither the name of Intel Corporation nor the names of its contributors
16 may be used to endorse or promote products derived from this software
17 without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30#ifndef __LIBSAIO_INTEL_ACPI_H
31#define __LIBSAIO_INTEL_ACPI_H
32
33#include "datatype.h"
34#include "ppmsetup.h"
35//
36// All tables and structures must be byte-packed to match the ACPI specification
37//#pragma pack(1)
38
39#define ACPI_SIG_DSDT "DSDT" // Differentiated System Description Table
40#define ACPI_SIG_FADT "FACP" // Fixed ACPI Description Table
41#define ACPI_SIG_FACS "FACS" // Firmware ACPI Control Structure
42#define ACPI_SIG_PSDT "PSDT" // Persistent System Description Table
43#define ACPI_SIG_RSDP "RSD PTR " // Root System Description Pointer
44#define ACPI_SIG_RSDT "RSDT" // Root System Description Table
45#define ACPI_SIG_XSDT "XSDT" // Extended System Description Table
46#define ACPI_SIG_SSDT "SSDT" // Secondary System Description Table
47#define ACPI_RSDP_NAME "RSDP" // Short name for RSDP, not signature
48#define ACPI_SIG_MADT "APIC" // Multiple APIC Description Table
49#define ACPI_SIG_SBST "SBST" // Smart Battery Specification Table
50#define ACPI_SIG_ECDT "ECDT" // Embedded Controller Boot Resources Table
51#define ACPI_SIG_ASF "ASF!" // Alert Standard Format table
52#define ACPI_SIG_DMAR "DMAR" // DMA Remapping table
53#define ACPI_SIG_HPET "HPET" // High Precision Event Timer table
54#define ACPI_SIG_MCFG "MCFG" // PCI Memory Mapped Configuration table
55#define ACPI_SIG_UEFI "UEFI" // Uefi Boot Optimization Table
56
57
58#ifndef nameseg_defined
59#define nameseg_defined
60#define NAMESEG(s) (((U32)(s[0]) << 0) \
61|((U32)(s[1]) << 8) \
62|((U32)(s[2]) << 16) \
63|((U32)(s[3]) << 24))
64#endif
65
66#define NAMESEG64(s) (((U64)(s[0]) << 0) \
67|((U64)(s[1]) << 8) \
68|((U64)(s[2]) << 16) \
69|((U64)(s[3]) << 24) \
70|((U64)(s[4]) << 32) \
71|((U64)(s[5]) << 40) \
72|((U64)(s[6]) << 48) \
73|((U64)(s[7]) << 56)) \
74
75
76// Data Objects Encoding values.
77#define AML_EXT_OP_PREFIX 0x5B
78
79// Name Space Modifier Objects Encoding values.
80#define AML_NAME_OP 0x08 // Name operator.
81#define AML_SCOPE_OP 0x10 // Scope operator.
82
83// Named Objects Encoding values.
84#define AML_MUTEX_OP 0x01
85#define AML_METHOD_OP 0x14 // Method operator.
86#define AML_OPREGION_OP 0x80 // Operation Region operator.
87#define AML_FIELD_OP 0x81
88#define AML_DEVICE_OP 0x82
89#define AML_PROCESSOR_OP 0x83 // Processor operator.
90
91// Type2 Opcodes Encoding values.
92#define AML_NULL_NAME 0x00
93#define AML_ZERO_OP 0x00
94#define AML_ALIAS_OP 0x06
95#define AML_ONE_OP 0x01
96#define AML_BYTE_OP 0x0a
97#define AML_WORD_OP 0x0b
98#define AML_DWORD_OP 0x0c
99#define AML_STRING_OP 0x0d
100#define AML_QWORD_OP 0x0e
101#define AML_BUFFER_OP 0x11
102#define AML_PACKAGE_OP 0x12
103#define AML_COND_REF_OF_OP 0x12 // Requires AML_EXT_OP_PREFIX
104#define AML_CREATE_FIELD_OP 0x13 // Requires AML_EXT_OP_PREFIX
105#define AML_DUAL_NAME_PREFIX 0x2e
106#define AML_MULTI_NAME_PREFIX 0x2f
107#define AML_REVISION_OP 0x30 // Requires AML_EXT_OP_PREFIX
108#define AML_DEBUG_OP 0x31
109#define AML_ROOT_PREFIX 0x5c
110#define AML_PARENT_PREFIX 0x5e
111#define AML_LOCAL0_OP 0x60
112#define AML_LOCAL1_OP 0x61
113#define AML_LOCAL2_OP 0x62
114#define AML_LOCAL3_OP 0x63
115#define AML_LOCAL4_OP 0x64
116#define AML_LOCAL5_OP 0x65
117#define AML_LOCAL6_OP 0x66
118#define AML_LOCAL7_OP 0x67
119#define AML_ARG0_OP 0x68
120#define AML_ARG1_OP 0x69
121#define AML_ARG2_OP 0x6A
122#define AML_ARG3_OP 0x6B
123#define AML_ARG4_OP 0x6C
124#define AML_ARG5_OP 0x6D
125#define AML_ARG6_OP 0x6E
126#define AML_STORE_OP 0x70
127#define AML_CONCAT_OP 0x73
128#define AML_SUBTRACT_OP 0x74
129#define AML_MULTIPLY_OP 0x77
130#define AML_AND_OP 0x7B
131#define AML_END_TAG_OP 0x79
132#define AML_GEN_REG_FIELD 0x82
133#define AML_PROCESSOR_OP 0x83
134#define AML_INDEXFIELD_OP 0x86 // Requires AML_EXT_OP_PREFIX
135#define AML_SIZEOF_OP 0x87
136#define AML_INDEX_OP 0x88
137#define AML_CREATE_DWORD_FIELD_OP 0x8A
138#define AML_LAND_OP 0x90
139#define AML_LOR_OP 0x91
140#define AML_LNOT_OP 0x92
141#define AML_LEQUAL_OP 0x93
142#define AML_LGREATER_OP 0x94
143#define AML_LLESS_OP 0x95
144#define AML_IF_OP 0xA0
145#define AML_ELSE_OP 0xA1
146#define AML_RETURN_OP 0xA4
147#define AML_ONES_OP 0xFF
148
149#define GAS_TYPE_FFH 0x7f
150#define GAS_TYPE_SYSTEM_IO 0x01
151#define GAS_VENDOR_INTEL 0x01
152#define GAS_CLASS_CODE_NATIVE 0x02
153
154// Define the Generic System Description Table Structure.
155// This common header is used by all tables except the RSDP and FACS.
156// The define is used for direct inclusion of header into other ACPI tables
157typedef struct acpi_table_header {
158 U8 Signature[4]; // ASCII table signature
159 U32 Length; // Length of table in bytes, including this header
160 U8 Revision; // ACPI Specification minor version #
161 U8 Checksum; // To make checksum of entire table == 0
162 U8 OemId[6]; // ASCII OEM identification
163 U8 OemTableId[8]; // ASCII OEM table identification
164 U32 OemRevision; // OEM revision number
165 U8 AslCompilerId[4]; // ASCII ASL compiler vendor ID
166 U32 AslCompilerRevision; // ASL compiler version
167} __attribute__((packed))ACPI_TABLE_HEADER;
168
169// GAS - Generic Address Structure (ACPI 2.0+)
170typedef struct acpi_generic_address {
171 U8 SpaceId; // Address space where struct or register exists
172 U8 BitWidth; // Size in bits of given register
173 U8 BitOffset; // Bit offset within the register
174 U8 AccessWidth; // Minimum Access size (ACPI 3.0)
175 U64 Address; // 64-bit address of struct or register
176} __attribute__((packed))ACPI_GENERIC_ADDRESS;
177
178// RSDP - Root System Description Pointer (Signature is "RSD PTR ")
179typedef struct acpi_table_rsdp {
180 U8 Signature[8]; // ACPI signature, contains "RSD PTR "
181 U8 Checksum; // ACPI 1.0 checksum
182 U8 OemId[6]; // OEM identification
183 U8 Revision; // Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+
184 U32 RsdtPhysicalAddress; // 32-bit physical address of the RSDT
185 U32 Length; // Table length in bytes, including header (ACPI 2.0+)
186 U64 XsdtPhysicalAddress; // 64-bit physical address of the XSDT (ACPI 2.0+)
187 U8 ExtendedChecksum; // Checksum of entire table (ACPI 2.0+)
188 U8 Reserved[3]; // Reserved, must be zero
189} __attribute__((packed))ACPI_TABLE_RSDP;
190
191#define ACPI_RSDP_REV0_SIZE 20 // Size of original ACPI 1.0 RSDP
192
193// RSDT - Root System Description Table
194typedef struct acpi_table_rsdt {
195 ACPI_TABLE_HEADER Header; // Common ACPI table header
196 U32 TableOffsetEntry[1]; // Array of pointers to ACPI tables
197} __attribute__((packed))ACPI_TABLE_RSDT;
198
199
200// XSDT - Root System Description Table
201typedef struct acpi_table_xsdt {
202 ACPI_TABLE_HEADER Header; // Common ACPI table header
203 U64 TableOffsetEntry[1]; // Array of pointers to ACPI tables
204} __attribute__((packed))ACPI_TABLE_XSDT;
205
206// DSDT - Differentiated System Description Table
207typedef struct acpi_table_dsdt {
208 ACPI_TABLE_HEADER Header; // Common ACPI table header
209 U32 EntryStart;
210} __attribute__((packed))ACPI_TABLE_DSDT;
211
212// FACS - Firmware ACPI Control Structure (FACS)
213typedef struct acpi_table_facs {
214 U8 Signature[4]; // ASCII table signature
215 U32 Length; // Length of structure, in bytes
216 U32 HardwareSignature; // Hardware configuration signature
217 U32 FirmwareWakingVector; // 32-bit physical address of the Firmware Waking Vector
218 U32 GlobalLock; // Global Lock for shared hardware resources
219 U32 Flags;
220 U64 XFirmwareWakingVector; // 64-bit version of the Firmware Waking Vector (ACPI 2.0+)
221 U8 Version; // Version of this table (ACPI 2.0+)
222 U8 Reserved[31]; // Reserved, must be zero
223} __attribute__((packed))ACPI_TABLE_FACS;
224
225// SBST - Smart Battery Specification Table - Version 1
226typedef struct acpi_table_sbst
227{
228 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
229 U32 WarningLevel;
230 U32 LowLevel;
231 U32 CriticalLevel;
232
233} __attribute__((packed))ACPI_TABLE_SBST;
234
235// ASF - Alert Standard Format table (Signature "ASF!")
236typedef struct acpi_table_asf
237{
238 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
239
240} ACPI_TABLE_ASF;
241
242// DMAR - DMA Remapping table - Version 1
243typedef struct acpi_table_dmar
244{
245 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
246 U8Width; /* Host Address Width */
247 U8Flags;
248 U8Reserved[10];
249
250} __attribute__((packed))ACPI_TABLE_DMAR;
251
252// HPET - High Precision Event Timer table - Version 1
253typedef struct acpi_table_hpet
254{
255 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
256 U32Id; /* Hardware ID of event timer block */
257 ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */
258 U8Sequence; /* HPET sequence number */
259 U16MinimumTick; /* Main counter min tick, periodic mode */
260 U8Flags;
261
262} __attribute__((packed))ACPI_TABLE_HPET;
263
264//MCFG - PCI Memory Mapped Configuration table and sub-table - Version 1
265typedef struct acpi_table_mcfg
266{
267 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
268 U8Reserved[8];
269
270} ACPI_TABLE_MCFG;
271
272//UEFI - UEFI Boot optimization Table - Version 1
273typedef struct acpi_table_uefi
274{
275 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
276 U8Identifier[16]; /* UUID identifier */
277 U16DataOffset; /* Offset of remaining data in table */
278
279} __attribute__((packed))ACPI_TABLE_UEFI;
280
281// ECDT - Embedded Controller Boot Resources Table - Version 1
282typedef struct acpi_table_ecdt
283{
284 ACPI_TABLE_HEADER Header; /* Common ACPI table header */
285 ACPI_GENERIC_ADDRESS Control; /* Address of EC command/status register */
286 ACPI_GENERIC_ADDRESS Data; /* Address of EC data register */
287 U32Uid; /* Unique ID - must be same as the EC _UID method */
288 U8Gpe; /* The GPE for the EC */
289 U8Id[1]; /* Full namepath of the EC in the ACPI namespace */
290
291} __attribute__((packed))ACPI_TABLE_ECDT;
292
293// FADT - Fixed ACPI Description Table (Signature "FACP")
294typedef struct acpi_table_fadt {
295 ACPI_TABLE_HEADER Header; // Common ACPI table header
296 U32 Facs; // 32-bit physical address of FACS
297 U32 Dsdt; // 32-bit physical address of DSDT
298 U8 Model; // System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+
299 U8 PreferredProfile; // Conveys preferred power management profile to OSPM.
300 U16 SciInterrupt; // System vector of SCI interrupt
301 U32 SmiCommand; // 32-bit Port address of SMI command port
302 U8 AcpiEnable; // Value to write to smi_cmd to enable ACPI
303 U8 AcpiDisable; // Value to write to smi_cmd to disable ACPI
304 U8 S4BiosRequest; // Value to write to SMI CMD to enter S4BIOS state
305 U8 PstateControl; // Processor performance state control
306 U32 Pm1aEventBlock; // 32-bit Port address of Power Mgt 1a Event Reg Blk
307 U32 Pm1bEventBlock; // 32-bit Port address of Power Mgt 1b Event Reg Blk
308 U32 Pm1aControlBlock; // 32-bit Port address of Power Mgt 1a Control Reg Blk
309 U32 Pm1bControlBlock; // 32-bit Port address of Power Mgt 1b Control Reg Blk
310 U32 Pm2ControlBlock; // 32-bit Port address of Power Mgt 2 Control Reg Blk
311 U32 PmTimerBlock; // 32-bit Port address of Power Mgt Timer Ctrl Reg Blk
312 U32 Gpe0Block; // 32-bit Port address of General Purpose Event 0 Reg Blk
313 U32 Gpe1Block; // 32-bit Port address of General Purpose Event 1 Reg Blk
314 U8 Pm1EventLength; // Byte Length of ports at Pm1xEventBlock
315 U8 Pm1ControlLength; // Byte Length of ports at Pm1xControlBlock
316 U8 Pm2ControlLength; // Byte Length of ports at Pm2ControlBlock
317 U8 PmTimerLength; // Byte Length of ports at PmTimerBlock
318 U8 Gpe0BlockLength; // Byte Length of ports at Gpe0Block
319 U8 Gpe1BlockLength; // Byte Length of ports at Gpe1Block
320 U8 Gpe1Base; // Offset in GPE number space where GPE1 events start
321 U8 CstControl; // Support for the _CST object and C States change notification
322 U16 C2Latency; // Worst case HW latency to enter/exit C2 state
323 U16 C3Latency; // Worst case HW latency to enter/exit C3 state
324 U16 FlushSize; // Processor's memory cache line width, in bytes
325 U16 FlushStride; // Number of flush strides that need to be read
326 U8 DutyOffset; // Processor duty cycle index in processor's P_CNT reg
327 U8 DutyWidth; // Processor duty cycle value bit width in P_CNT register.
328 U8 DayAlarm; // Index to day-of-month alarm in RTC CMOS RAM
329 U8 MonthAlarm; // Index to month-of-year alarm in RTC CMOS RAM
330 U8 Century; // Index to century in RTC CMOS RAM
331 U16 BootFlags; // IA-PC Boot Architecture Flags. See Table 5-10 for description
332 U8 Reserved; // Reserved, must be zero
333 U32 Flags; // Miscellaneous flag bits (see below for individual flags)
334 ACPI_GENERIC_ADDRESS ResetRegister; // 64-bit address of the Reset register
335 U8 ResetValue; // Value to write to the ResetRegister port to reset the system
336 U8 Reserved4[3]; // Reserved, must be zero
337 U64 XFacs; // 64-bit physical address of FACS
338 U64 XDsdt; // 64-bit physical address of DSDT
339 ACPI_GENERIC_ADDRESS XPm1aEventBlock; // 64-bit Extended Power Mgt 1a Event Reg Blk address
340 ACPI_GENERIC_ADDRESS XPm1bEventBlock; // 64-bit Extended Power Mgt 1b Event Reg Blk address
341 ACPI_GENERIC_ADDRESS XPm1aControlBlock; // 64-bit Extended Power Mgt 1a Control Reg Blk address
342 ACPI_GENERIC_ADDRESS XPm1bControlBlock; // 64-bit Extended Power Mgt 1b Control Reg Blk address
343 ACPI_GENERIC_ADDRESS XPm2ControlBlock; // 64-bit Extended Power Mgt 2 Control Reg Blk address
344 ACPI_GENERIC_ADDRESS XPmTimerBlock; // 64-bit Extended Power Mgt Timer Ctrl Reg Blk address
345 ACPI_GENERIC_ADDRESS XGpe0Block; // 64-bit Extended General Purpose Event 0 Reg Blk address
346 ACPI_GENERIC_ADDRESS XGpe1Block; // 64-bit Extended General Purpose Event 1 Reg Blk address
347} __attribute__((packed))ACPI_TABLE_FADT;
348
349// SSDT - Secondary System Description Table
350typedef struct acpi_table_ssdt {
351 ACPI_TABLE_HEADER Header; // Common ACPI table header
352} __attribute__((packed))ACPI_TABLE_SSDT;
353
354//MADT - Multiple APIC Description Table
355typedef struct acpi_table_madt {
356 ACPI_TABLE_HEADER Header; // Common ACPI table header
357 U32 Address; // Physical address of local APIC
358 U32 Flags;
359} __attribute__((packed))ACPI_TABLE_MADT;
360
361
362// Values for subtable type in ACPI_SUBTABLE_HEADER
363enum AcpiMadtType {
364 ACPI_MADT_TYPE_LOCAL_APIC = 0,
365 ACPI_MADT_TYPE_IO_APIC = 1,
366 ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
367 ACPI_MADT_TYPE_NMI_SOURCE = 3,
368 ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
369 ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
370 ACPI_MADT_TYPE_IO_SAPIC = 6,
371 ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
372 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
373 ACPI_MADT_TYPE_X2APIC = 9,
374 ACPI_MADT_TYPE_RESERVED = 10 // 10 and greater are reserved
375};
376
377// Common Sub-table header (used in MADT, SRAT, etc.)
378typedef struct acpi_subtable_header {
379 U8 Type;
380 U8 Length;
381} __attribute__((packed))ACPI_SUBTABLE_HEADER;
382
383// MADT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER
384
385// 0: Processor Local APIC
386typedef struct acpi_madt_local_apic {
387 ACPI_SUBTABLE_HEADER Header;
388 U8 ProcessorId; // ACPI processor id
389 U8 Id; // Processor's local APIC id
390 U32 LapicFlags;
391} __attribute__((packed))ACPI_MADT_LOCAL_APIC;
392
393// 1: IO APIC
394typedef struct acpi_madt_io_apic {
395 ACPI_SUBTABLE_HEADER Header;
396 U8 Id; // I/O APIC ID
397 U8 Reserved; // Reserved - must be zero
398 U32 Address; // APIC physical address
399 U32 GlobalIrqBase; // Global system interrupt where INTI lines start
400} __attribute__((packed))ACPI_MADT_IO_APIC;
401
402// 2: Interrupt Override
403typedef struct acpi_madt_interrupt_override {
404 ACPI_SUBTABLE_HEADER Header;
405 U8 Bus; // 0 - ISA
406 U8 SourceIrq; // Interrupt source (IRQ)
407 U32 GlobalIrq; // Global system interrupt
408 U16 IntiFlags;
409} __attribute__((packed))ACPI_MADT_INTERRUPT_OVERRIDE;
410
411// 3: NMI Source
412typedef struct acpi_madt_nmi_source {
413 ACPI_SUBTABLE_HEADER Header;
414 U16 IntiFlags;
415 U32 GlobalIrq; // Global system interrupt
416} __attribute__((packed))ACPI_MADT_NMI_SOURCE;
417
418// 4: Local APIC NMI
419typedef struct acpi_madt_local_apic_nmi {
420 ACPI_SUBTABLE_HEADER Header;
421 U8 ProcessorId; // ACPI processor id
422 U16 IntiFlags;
423 U8 Lint; // LINTn to which NMI is connected
424} __attribute__((packed))ACPI_MADT_LOCAL_APIC_NMI;
425
426// 5: Address Override
427typedef struct acpi_madt_local_apic_override {
428 ACPI_SUBTABLE_HEADER Header;
429 U16 Reserved; // Reserved, must be zero
430 U64 Address; // APIC physical address
431} __attribute__((packed))ACPI_MADT_LOCAL_APIC_OVERRIDE;
432
433// 6: I/O Sapic
434typedef struct acpi_madt_io_sapic {
435 ACPI_SUBTABLE_HEADER Header;
436 U8 Id; // I/O SAPIC ID
437 U8 Reserved; // Reserved, must be zero
438 U32 GlobalIrqBase; // Global interrupt for SAPIC start
439 U64 Address; // SAPIC physical address
440} __attribute__((packed))ACPI_MADT_IO_SAPIC;
441
442// 7: Local Sapic
443typedef struct acpi_madt_local_sapic {
444 ACPI_SUBTABLE_HEADER Header;
445 U8 ProcessorId; // ACPI processor id
446 U8 Id; // SAPIC ID
447 U8 Eid; // SAPIC EID
448 U8 Reserved[3]; // Reserved, must be zero
449 U32 LapicFlags;
450 U32 Uid; // Numeric UID - ACPI 3.0
451 char UidString[1]; // String UID - ACPI 3.0
452} __attribute__((packed))ACPI_MADT_LOCAL_SAPIC;
453
454// 8: Platform Interrupt Source
455typedef struct acpi_madt_interrupt_source {
456 ACPI_SUBTABLE_HEADER Header;
457 U16 IntiFlags;
458 U8 Type; // 1=PMI, 2=INIT, 3=corrected
459 U8 Id; // Processor ID
460 U8 Eid; // Processor EID
461 U8 IoSapicVector; // Vector value for PMI interrupts
462 U32 GlobalIrq; // Global system interrupt
463 U32 Flags; // Interrupt Source Flags
464} __attribute__((packed))ACPI_MADT_INTERRUPT_SOURCE;
465
466// 9: Processor X2APIC
467typedef struct acpi_madt_x2apic {
468 ACPI_SUBTABLE_HEADER Header;
469 U16 Reserved; // Must be zero
470 U32 x2apicId; // Processor's X2APIC ID
471 U32 x2apicFlags;
472 U32 UID;
473} __attribute__((packed))ACPI_MADT_X2APIC;
474
475// Common flags fields for MADT subtables
476
477// MADT Local APIC flags (LapicFlags)
478#define ACPI_MADT_ENABLED (1) // 00: Processor is usable if set
479
480// MADT MPS INTI flags (IntiFlags)
481#define ACPI_MADT_POLARITY_MASK (3) // 00-01: Polarity of APIC I/O input signals
482#define ACPI_MADT_TRIGGER_MASK (3<<2) // 02-03: Trigger mode of APIC input signals
483
484// Values for MPS INTI flags
485#define ACPI_MADT_POLARITY_CONFORMS 0
486#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
487#define ACPI_MADT_POLARITY_RESERVED 2
488#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
489
490#define ACPI_MADT_TRIGGER_CONFORMS (0)
491#define ACPI_MADT_TRIGGER_EDGE (1<<2)
492#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
493#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
494
495#define ACPI_COORD_TYPE_SW_ALL 0xFC
496#define ACPI_COORD_TYPE_SW_ANY 0xFD
497#define ACPI_COORD_TYPE_HW_ALL 0xFE
498
499typedef struct packageLength {
500 U8 packageLength0;
501 U8 packageLength1;
502} __attribute__((packed))ACPI_PACKAGE_LENGTH;
503
504typedef struct acpi_scope {
505 U8 scopeOpcode;
506 ACPI_PACKAGE_LENGTH pkgLength;
507 U8 rootChar;
508} __attribute__((packed))ACPI_SCOPE;
509
510typedef struct dual_name_path {
511 U8 prefix;
512 U32 nameseg[2];
513} __attribute__((packed))DUAL_NAME_PATH;
514
515typedef struct multi_name_path {
516 U8 prefix;
517 U8 segCount;
518 U32 nameseg[MAX_SUPPORTED_CPU_NAMESEGS];
519} __attribute__((packed))MULTI_NAME_PATH;
520
521typedef struct generic_register {
522 U8 genericRegisterField;
523 ACPI_PACKAGE_LENGTH pkgLength;
524 ACPI_GENERIC_ADDRESS gas;
525} __attribute__((packed))ACPI_GENERIC_REGISTER;
526
527typedef struct package {
528 U8 packageOpcode;
529 ACPI_PACKAGE_LENGTH pkgLength;
530 U8 numElements;
531} __attribute__((packed))ACPI_PACKAGE;
532
533typedef struct small_package {
534 U8 packageOpcode;
535 U8 packageLength;
536 U8 numElements;
537} __attribute__((packed))ACPI_SMALL_PACKAGE;
538
539typedef struct small_buffer {
540 U8 bufferOpcode;
541 U8 packageLength;
542} __attribute__((packed))ACPI_SMALL_BUFFER;
543
544typedef struct end_tag {
545 U8 endTagField;
546 U8 checksum;
547} __attribute__((packed))ACPI_END_TAG;
548
549typedef struct return_name_seg {
550 U8 returnOpcode;
551 U32 name;
552} __attribute__((packed))ACPI_RETURN_NAME_SEG;
553
554typedef struct return_package {
555 U8 returnOpcode;
556 ACPI_PACKAGE package;
557} __attribute__((packed))ACPI_RETURN_PACKAGE;
558
559typedef struct return_zero {
560 U8 returnOpcode;
561 U8 zeroOpcode;
562} __attribute__((packed))ACPI_RETURN_ZERO;
563
564typedef struct return_opcode {
565 U8 returnOpcode;
566 U8 opcodeToReturn;
567} __attribute__((packed))ACPI_RETURN_OPCODE;
568
569typedef struct byteConst {
570 U8 byteOpcode;
571 U8 byteData;
572} __attribute__((packed))ACPI_BYTE_CONST;
573
574typedef struct wordConst {
575 U8 wordOpcode;
576 U16 wordData;
577} __attribute__((packed))ACPI_WORD_CONST;
578
579typedef struct dwordConst {
580 U8 dwordOpcode;
581 U32 dwordData;
582} __attribute__((packed))ACPI_DWORD_CONST;
583
584typedef struct small_method {
585 U8 methodOpcode;
586 U8 packageLength;
587 U32 name;
588 U8 methodFlags;
589} __attribute__((packed))ACPI_SMALL_METHOD;
590
591typedef struct method {
592 U8 methodOpcode;
593 ACPI_PACKAGE_LENGTH pkgLength;
594 U32 name;
595 U8 methodFlags;
596} __attribute__((packed))ACPI_METHOD;
597
598typedef struct namePath {
599 U8 nameOpcode;
600 U32 name;
601} __attribute__((packed))ACPI_NAME_PATH;
602
603typedef struct named_dword {
604 ACPI_NAME_PATH namePath;
605 ACPI_DWORD_CONST dword;
606} __attribute__((packed))ACPI_NAMED_DWORD;
607
608typedef struct rootNamePath {
609 U8 nameOpcode;
610 U8 rootPrefix;
611 U32 name;
612} ACPI_ROOT_NAME_PATH;
613
614typedef struct root_named_dword {
615 ACPI_ROOT_NAME_PATH rootNamePath;
616 ACPI_DWORD_CONST dword;
617} __attribute__((packed))ACPI_ROOT_NAMED_DWORD;
618
619typedef struct named_object {
620 ACPI_NAME_PATH namePath;
621 ACPI_PACKAGE package;
622} __attribute__((packed))ACPI_NAMED_OBJECT;
623
624typedef struct small_named_object {
625 ACPI_NAME_PATH namePath;
626 ACPI_SMALL_PACKAGE package;
627} __attribute__((packed))ACPI_SMALL_NAMED_OBJECT;
628
629typedef struct create_dword_field {
630 ACPI_NAME_PATH namePath;
631 ACPI_SMALL_PACKAGE package;
632} __attribute__((packed))ACPI_CREATE_DWORD_FIELD;
633
634typedef struct tstate_package {
635 ACPI_SMALL_PACKAGE package;
636 ACPI_DWORD_CONST FreqPercent;
637 ACPI_DWORD_CONST Power;
638 ACPI_DWORD_CONST TransLatency;
639 ACPI_DWORD_CONST Control;
640 ACPI_DWORD_CONST Status;
641} __attribute__((packed))ACPI_TSTATE_PACKAGE;
642
643typedef struct pstate_package {
644 ACPI_SMALL_PACKAGE package;
645 ACPI_DWORD_CONST CoreFreq;
646 ACPI_DWORD_CONST Power;
647 ACPI_DWORD_CONST TransLatency;
648 ACPI_DWORD_CONST BMLatency;
649 ACPI_DWORD_CONST Control;
650 ACPI_DWORD_CONST Status;
651} __attribute__((packed))ACPI_PSTATE_PACKAGE;
652
653typedef struct psd_package {
654 ACPI_SMALL_PACKAGE package;
655 ACPI_BYTE_CONST NumberOfEntries;
656 ACPI_BYTE_CONST Revision;
657 ACPI_DWORD_CONST Domain;
658 ACPI_DWORD_CONST CoordType;
659 ACPI_DWORD_CONST NumProcessors;
660} __attribute__((packed))ACPI_PSD_PACKAGE;
661
662typedef struct csd_package {
663 ACPI_SMALL_PACKAGE package;
664 ACPI_BYTE_CONST NumberOfEntries;
665 ACPI_BYTE_CONST Revision;
666 ACPI_DWORD_CONST Domain;
667 ACPI_DWORD_CONST CoordType;
668 ACPI_DWORD_CONST NumProcessors;
669 ACPI_DWORD_CONST Index;
670} __attribute__((packed))ACPI_CSD_PACKAGE;
671
672typedef struct tsd_package {
673 ACPI_SMALL_PACKAGE package;
674 ACPI_BYTE_CONST NumberOfEntries;
675 ACPI_BYTE_CONST Revision;
676 ACPI_DWORD_CONST Domain;
677 ACPI_DWORD_CONST CoordType;
678 ACPI_DWORD_CONST NumProcessors;
679} __attribute__((packed))ACPI_TSD_PACKAGE;
680
681typedef struct processor {
682 U8 processorOpCode;
683 U8 packageLength;
684 U8 numElements;
685 ACPI_BYTE_CONST ProcID;
686 ACPI_DWORD_CONST PblkAddr;
687 ACPI_BYTE_CONST PblkLen;
688} __attribute__((packed))ACPI_PROCESSOR;
689
690//#pragma pack()
691
692#endif /* !__LIBSAIO_INTEL_ACPI_H */
693

Archive Download this file

Revision: 1972