xref: /illumos-gate/usr/src/uts/intel/sys/acpi/actbl.h (revision 03831d35)
1 /******************************************************************************
2  *
3  * Name: actbl.h - Table data structures defined in ACPI specification
4  *       $Revision: 1.74 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #ifndef __ACTBL_H__
118 #define __ACTBL_H__
119 
120 
121 /*
122  * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
123  * This is the only type that is even remotely portable. Anything else is not
124  * portable, so do not use any other bitfield types.
125  */
126 
127 
128 /*
129  *  Values for description table header signatures
130  */
131 #define RSDP_NAME               "RSDP"
132 #define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
133 #define APIC_SIG                "APIC"      /* Multiple APIC Description Table */
134 #define DSDT_SIG                "DSDT"      /* Differentiated System Description Table */
135 #define FADT_SIG                "FACP"      /* Fixed ACPI Description Table */
136 #define FACS_SIG                "FACS"      /* Firmware ACPI Control Structure */
137 #define PSDT_SIG                "PSDT"      /* Persistent System Description Table */
138 #define RSDT_SIG                "RSDT"      /* Root System Description Table */
139 #define XSDT_SIG                "XSDT"      /* Extended  System Description Table */
140 #define SSDT_SIG                "SSDT"      /* Secondary System Description Table */
141 #define SBST_SIG                "SBST"      /* Smart Battery Specification Table */
142 #define SPIC_SIG                "SPIC"      /* IOSAPIC table */
143 #define BOOT_SIG                "BOOT"      /* Boot table */
144 
145 
146 #define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
147 
148 
149 /*
150  * Common table types.  The base code can remain
151  * constant if the underlying tables are changed
152  */
153 #define RSDT_DESCRIPTOR         RSDT_DESCRIPTOR_REV2
154 #define XSDT_DESCRIPTOR         XSDT_DESCRIPTOR_REV2
155 #define FACS_DESCRIPTOR         FACS_DESCRIPTOR_REV2
156 #define FADT_DESCRIPTOR         FADT_DESCRIPTOR_REV2
157 
158 
159 #pragma pack(1)
160 
161 /*
162  * ACPI Version-independent tables
163  *
164  * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
165  * are in separate files.
166  */
167 typedef struct rsdp_descriptor /* Root System Descriptor Pointer */
168 {
169     char                    Signature[8];           /* ACPI signature, contains "RSD PTR " */
170     UINT8                   Checksum;               /* ACPI 1.0 checksum */
171     char                    OemId[6];               /* OEM identification */
172     UINT8                   Revision;               /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
173     UINT32                  RsdtPhysicalAddress;    /* 32-bit physical address of the RSDT */
174     UINT32                  Length;                 /* XSDT Length in bytes, including header */
175     UINT64                  XsdtPhysicalAddress;    /* 64-bit physical address of the XSDT */
176     UINT8                   ExtendedChecksum;       /* Checksum of entire table (ACPI 2.0) */
177     char                    Reserved[3];            /* Reserved, must be zero */
178 
179 } RSDP_DESCRIPTOR;
180 
181 
182 typedef struct acpi_common_facs  /* Common FACS for internal use */
183 {
184     UINT32                  *GlobalLock;
185     UINT64                  *FirmwareWakingVector;
186     UINT8                   VectorWidth;
187 
188 } ACPI_COMMON_FACS;
189 
190 
191 #define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
192     char                    Signature[4];           /* ASCII table signature */\
193     UINT32                  Length;                 /* Length of table in bytes, including this header */\
194     UINT8                   Revision;               /* ACPI Specification minor version # */\
195     UINT8                   Checksum;               /* To make sum of entire table == 0 */\
196     char                    OemId[6];               /* ASCII OEM identification */\
197     char                    OemTableId[8];          /* ASCII OEM table identification */\
198     UINT32                  OemRevision;            /* OEM revision number */\
199     char                    AslCompilerId [4];      /* ASCII ASL compiler vendor ID */\
200     UINT32                  AslCompilerRevision;    /* ASL compiler version */
201 
202 
203 typedef struct acpi_table_header /* ACPI common table header */
204 {
205     ACPI_TABLE_HEADER_DEF
206 
207 } ACPI_TABLE_HEADER;
208 
209 
210 /*
211  * MADT values and structures
212  */
213 
214 /* Values for MADT PCATCompat */
215 
216 #define DUAL_PIC                0
217 #define MULTIPLE_APIC           1
218 
219 /* Master MADT */
220 
221 typedef struct multiple_apic_table
222 {
223     ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
224     UINT32                  LocalApicAddress;       /* Physical address of local APIC */
225 
226     /* Flags (32 bits) */
227 
228     UINT8                   PCATCompat      : 1;    /* 00:    System also has dual 8259s */
229     UINT8                                   : 7;    /* 01-07: Reserved, must be zero */
230     UINT8                   Reserved1[3];           /* 08-31: Reserved, must be zero */
231 
232 } MULTIPLE_APIC_TABLE;
233 
234 /* Values for Type in APIC_HEADER_DEF */
235 
236 #define APIC_PROCESSOR          0
237 #define APIC_IO                 1
238 #define APIC_XRUPT_OVERRIDE     2
239 #define APIC_NMI                3
240 #define APIC_LOCAL_NMI          4
241 #define APIC_ADDRESS_OVERRIDE   5
242 #define APIC_IO_SAPIC           6
243 #define APIC_LOCAL_SAPIC        7
244 #define APIC_XRUPT_SOURCE       8
245 #define APIC_RESERVED           9           /* 9 and greater are reserved */
246 
247 /*
248  * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
249  */
250 #define APIC_HEADER_DEF                     /* Common APIC sub-structure header */\
251     UINT8                   Type; \
252     UINT8                   Length;
253 
254 typedef struct apic_header
255 {
256     APIC_HEADER_DEF
257 
258 } APIC_HEADER;
259 
260 /* Values for MPS INTI flags */
261 
262 #define POLARITY_CONFORMS       0
263 #define POLARITY_ACTIVE_HIGH    1
264 #define POLARITY_RESERVED       2
265 #define POLARITY_ACTIVE_LOW     3
266 
267 #define TRIGGER_CONFORMS        0
268 #define TRIGGER_EDGE            1
269 #define TRIGGER_RESERVED        2
270 #define TRIGGER_LEVEL           3
271 
272 /* Common flag definitions (16 bits each) */
273 
274 #define MPS_INTI_FLAGS \
275     UINT8                   Polarity        : 2;    /* 00-01: Polarity of APIC I/O input signals */\
276     UINT8                   TriggerMode     : 2;    /* 02-03: Trigger mode of APIC input signals */\
277     UINT8                                   : 4;    /* 04-07: Reserved, must be zero */\
278     UINT8                   Reserved1;              /* 08-15: Reserved, must be zero */
279 
280 #define LOCAL_APIC_FLAGS \
281     UINT8                   ProcessorEnabled: 1;    /* 00:    Processor is usable if set */\
282     UINT8                                   : 7;    /* 01-07: Reserved, must be zero */\
283     UINT8                   Reserved2;              /* 08-15: Reserved, must be zero */
284 
285 /* Sub-structures for MADT */
286 
287 typedef struct madt_processor_apic
288 {
289     APIC_HEADER_DEF
290     UINT8                   ProcessorId;            /* ACPI processor id */
291     UINT8                   LocalApicId;            /* Processor's local APIC id */
292     LOCAL_APIC_FLAGS
293 
294 } MADT_PROCESSOR_APIC;
295 
296 typedef struct madt_io_apic
297 {
298     APIC_HEADER_DEF
299     UINT8                   IoApicId;               /* I/O APIC ID */
300     UINT8                   Reserved;               /* Reserved - must be zero */
301     UINT32                  Address;                /* APIC physical address */
302     UINT32                  Interrupt;              /* Global system interrupt where INTI
303                                                      * lines start */
304 } MADT_IO_APIC;
305 
306 typedef struct madt_interrupt_override
307 {
308     APIC_HEADER_DEF
309     UINT8                   Bus;                    /* 0 - ISA */
310     UINT8                   Source;                 /* Interrupt source (IRQ) */
311     UINT32                  Interrupt;              /* Global system interrupt */
312     MPS_INTI_FLAGS
313 
314 } MADT_INTERRUPT_OVERRIDE;
315 
316 typedef struct madt_nmi_source
317 {
318     APIC_HEADER_DEF
319     MPS_INTI_FLAGS
320     UINT32                  Interrupt;              /* Global system interrupt */
321 
322 } MADT_NMI_SOURCE;
323 
324 typedef struct madt_local_apic_nmi
325 {
326     APIC_HEADER_DEF
327     UINT8                   ProcessorId;            /* ACPI processor id */
328     MPS_INTI_FLAGS
329     UINT8                   Lint;                   /* LINTn to which NMI is connected */
330 
331 } MADT_LOCAL_APIC_NMI;
332 
333 typedef struct madt_address_override
334 {
335     APIC_HEADER_DEF
336     UINT16                  Reserved;               /* Reserved, must be zero */
337     UINT64                  Address;                /* APIC physical address */
338 
339 } MADT_ADDRESS_OVERRIDE;
340 
341 typedef struct madt_io_sapic
342 {
343     APIC_HEADER_DEF
344     UINT8                   IoSapicId;              /* I/O SAPIC ID */
345     UINT8                   Reserved;               /* Reserved, must be zero */
346     UINT32                  InterruptBase;          /* Glocal interrupt for SAPIC start */
347     UINT64                  Address;                /* SAPIC physical address */
348 
349 } MADT_IO_SAPIC;
350 
351 typedef struct madt_local_sapic
352 {
353     APIC_HEADER_DEF
354     UINT8                   ProcessorId;            /* ACPI processor id */
355     UINT8                   LocalSapicId;           /* SAPIC ID */
356     UINT8                   LocalSapicEid;          /* SAPIC EID */
357     UINT8                   Reserved[3];            /* Reserved, must be zero */
358     LOCAL_APIC_FLAGS
359     UINT32                  ProcessorUID;           /* Numeric UID - ACPI 3.0 */
360     char                    ProcessorUIDString[1];  /* String UID  - ACPI 3.0 */
361 
362 } MADT_LOCAL_SAPIC;
363 
364 typedef struct madt_interrupt_source
365 {
366     APIC_HEADER_DEF
367     MPS_INTI_FLAGS
368     UINT8                   InterruptType;          /* 1=PMI, 2=INIT, 3=corrected */
369     UINT8                   ProcessorId;            /* Processor ID */
370     UINT8                   ProcessorEid;           /* Processor EID */
371     UINT8                   IoSapicVector;          /* Vector value for PMI interrupts */
372     UINT32                  Interrupt;              /* Global system interrupt */
373     UINT32                  Flags;                  /* Interrupt Source Flags */
374 
375 } MADT_INTERRUPT_SOURCE;
376 
377 
378 /*
379  * Smart Battery
380  */
381 typedef struct smart_battery_table
382 {
383     ACPI_TABLE_HEADER_DEF
384     UINT32                  WarningLevel;
385     UINT32                  LowLevel;
386     UINT32                  CriticalLevel;
387 
388 } SMART_BATTERY_TABLE;
389 
390 
391 #pragma pack()
392 
393 
394 /*
395  * ACPI Table information.  We save the table address, length,
396  * and type of memory allocation (mapped or allocated) for each
397  * table for 1) when we exit, and 2) if a new table is installed
398  */
399 #define ACPI_MEM_NOT_ALLOCATED  0
400 #define ACPI_MEM_ALLOCATED      1
401 #define ACPI_MEM_MAPPED         2
402 
403 /* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
404 
405 #define ACPI_TABLE_SINGLE       0x00
406 #define ACPI_TABLE_MULTIPLE     0x01
407 #define ACPI_TABLE_EXECUTABLE   0x02
408 
409 #define ACPI_TABLE_ROOT         0x00
410 #define ACPI_TABLE_PRIMARY      0x10
411 #define ACPI_TABLE_SECONDARY    0x20
412 #define ACPI_TABLE_ALL          0x30
413 #define ACPI_TABLE_TYPE_MASK    0x30
414 
415 /* Data about each known table type */
416 
417 typedef struct acpi_table_support
418 {
419     char                    *Name;
420     char                    *Signature;
421     void                    **GlobalPtr;
422     UINT8                   SigLength;
423     UINT8                   Flags;
424 
425 } ACPI_TABLE_SUPPORT;
426 
427 
428 /*
429  * Get the ACPI version-specific tables
430  */
431 #include "actbl1.h"   /* Acpi 1.0 table definitions */
432 #include "actbl2.h"   /* Acpi 2.0 table definitions */
433 
434 
435 #pragma pack(1)
436 /*
437  * High performance timer
438  */
439 typedef struct hpet_table
440 {
441     ACPI_TABLE_HEADER_DEF
442     UINT32                  HardwareId;
443     ACPI_GENERIC_ADDRESS    BaseAddress;
444     UINT8                   HpetNumber;
445     UINT16                  ClockTick;
446     UINT8                   Attributes;
447 
448 } HPET_TABLE;
449 
450 #pragma pack()
451 
452 #endif /* __ACTBL_H__ */
453