xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl1.h (revision b65adbdfbc322bb7d86d74049389c688e9962f15)
1 /******************************************************************************
2  *
3  * Name: actbl1.h - Additional ACPI table definitions
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 #ifndef __ACTBL1_H__
117 #define __ACTBL1_H__
118 
119 
120 /*******************************************************************************
121  *
122  * Additional ACPI Tables (1)
123  *
124  * These tables are not consumed directly by the ACPICA subsystem, but are
125  * included here to support device drivers and the AML disassembler.
126  *
127  * The tables in this file are fully defined within the ACPI specification.
128  *
129  ******************************************************************************/
130 
131 
132 /*
133  * Values for description table header signatures for tables defined in this
134  * file. Useful because they make it more difficult to inadvertently type in
135  * the wrong signature.
136  */
137 #define ACPI_SIG_BERT           "BERT"      /* Boot Error Record Table */
138 #define ACPI_SIG_CPEP           "CPEP"      /* Corrected Platform Error Polling table */
139 #define ACPI_SIG_ECDT           "ECDT"      /* Embedded Controller Boot Resources Table */
140 #define ACPI_SIG_EINJ           "EINJ"      /* Error Injection table */
141 #define ACPI_SIG_ERST           "ERST"      /* Error Record Serialization Table */
142 #define ACPI_SIG_HEST           "HEST"      /* Hardware Error Source Table */
143 #define ACPI_SIG_MADT           "APIC"      /* Multiple APIC Description Table */
144 #define ACPI_SIG_MSCT           "MSCT"      /* Maximum System Characteristics Table */
145 #define ACPI_SIG_SBST           "SBST"      /* Smart Battery Specification Table */
146 #define ACPI_SIG_SLIT           "SLIT"      /* System Locality Distance Information Table */
147 #define ACPI_SIG_SRAT           "SRAT"      /* System Resource Affinity Table */
148 #define ACPI_SIG_NFIT           "NFIT"      /* NVDIMM Firmware Interface Table */
149 
150 
151 /*
152  * All tables must be byte-packed to match the ACPI specification, since
153  * the tables are provided by the system BIOS.
154  */
155 #pragma pack(1)
156 
157 /*
158  * Note: C bitfields are not used for this reason:
159  *
160  * "Bitfields are great and easy to read, but unfortunately the C language
161  * does not specify the layout of bitfields in memory, which means they are
162  * essentially useless for dealing with packed data in on-disk formats or
163  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
164  * this decision was a design error in C. Ritchie could have picked an order
165  * and stuck with it." Norman Ramsey.
166  * See http://stackoverflow.com/a/1053662/41661
167  */
168 
169 
170 /*******************************************************************************
171  *
172  * Common subtable headers
173  *
174  ******************************************************************************/
175 
176 /* Generic subtable header (used in MADT, SRAT, etc.) */
177 
178 typedef struct acpi_subtable_header
179 {
180     UINT8                   Type;
181     UINT8                   Length;
182 
183 } ACPI_SUBTABLE_HEADER;
184 
185 
186 /* Subtable header for WHEA tables (EINJ, ERST, WDAT) */
187 
188 typedef struct acpi_whea_header
189 {
190     UINT8                   Action;
191     UINT8                   Instruction;
192     UINT8                   Flags;
193     UINT8                   Reserved;
194     ACPI_GENERIC_ADDRESS    RegisterRegion;
195     UINT64                  Value;              /* Value used with Read/Write register */
196     UINT64                  Mask;               /* Bitmask required for this register instruction */
197 
198 } ACPI_WHEA_HEADER;
199 
200 
201 /*******************************************************************************
202  *
203  * BERT - Boot Error Record Table (ACPI 4.0)
204  *        Version 1
205  *
206  ******************************************************************************/
207 
208 typedef struct acpi_table_bert
209 {
210     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
211     UINT32                  RegionLength;       /* Length of the boot error region */
212     UINT64                  Address;            /* Physical address of the error region */
213 
214 } ACPI_TABLE_BERT;
215 
216 
217 /* Boot Error Region (not a subtable, pointed to by Address field above) */
218 
219 typedef struct acpi_bert_region
220 {
221     UINT32                  BlockStatus;        /* Type of error information */
222     UINT32                  RawDataOffset;      /* Offset to raw error data */
223     UINT32                  RawDataLength;      /* Length of raw error data */
224     UINT32                  DataLength;         /* Length of generic error data */
225     UINT32                  ErrorSeverity;      /* Severity code */
226 
227 } ACPI_BERT_REGION;
228 
229 /* Values for BlockStatus flags above */
230 
231 #define ACPI_BERT_UNCORRECTABLE             (1)
232 #define ACPI_BERT_CORRECTABLE               (1<<1)
233 #define ACPI_BERT_MULTIPLE_UNCORRECTABLE    (1<<2)
234 #define ACPI_BERT_MULTIPLE_CORRECTABLE      (1<<3)
235 #define ACPI_BERT_ERROR_ENTRY_COUNT         (0xFF<<4) /* 8 bits, error count */
236 
237 /* Values for ErrorSeverity above */
238 
239 enum AcpiBertErrorSeverity
240 {
241     ACPI_BERT_ERROR_CORRECTABLE     = 0,
242     ACPI_BERT_ERROR_FATAL           = 1,
243     ACPI_BERT_ERROR_CORRECTED       = 2,
244     ACPI_BERT_ERROR_NONE            = 3,
245     ACPI_BERT_ERROR_RESERVED        = 4     /* 4 and greater are reserved */
246 };
247 
248 /*
249  * Note: The generic error data that follows the ErrorSeverity field above
250  * uses the ACPI_HEST_GENERIC_DATA defined under the HEST table below
251  */
252 
253 
254 /*******************************************************************************
255  *
256  * CPEP - Corrected Platform Error Polling table (ACPI 4.0)
257  *        Version 1
258  *
259  ******************************************************************************/
260 
261 typedef struct acpi_table_cpep
262 {
263     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
264     UINT64                  Reserved;
265 
266 } ACPI_TABLE_CPEP;
267 
268 
269 /* Subtable */
270 
271 typedef struct acpi_cpep_polling
272 {
273     ACPI_SUBTABLE_HEADER    Header;
274     UINT8                   Id;                 /* Processor ID */
275     UINT8                   Eid;                /* Processor EID */
276     UINT32                  Interval;           /* Polling interval (msec) */
277 
278 } ACPI_CPEP_POLLING;
279 
280 
281 /*******************************************************************************
282  *
283  * ECDT - Embedded Controller Boot Resources Table
284  *        Version 1
285  *
286  ******************************************************************************/
287 
288 typedef struct acpi_table_ecdt
289 {
290     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
291     ACPI_GENERIC_ADDRESS    Control;            /* Address of EC command/status register */
292     ACPI_GENERIC_ADDRESS    Data;               /* Address of EC data register */
293     UINT32                  Uid;                /* Unique ID - must be same as the EC _UID method */
294     UINT8                   Gpe;                /* The GPE for the EC */
295     UINT8                   Id[1];              /* Full namepath of the EC in the ACPI namespace */
296 
297 } ACPI_TABLE_ECDT;
298 
299 
300 /*******************************************************************************
301  *
302  * EINJ - Error Injection Table (ACPI 4.0)
303  *        Version 1
304  *
305  ******************************************************************************/
306 
307 typedef struct acpi_table_einj
308 {
309     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
310     UINT32                  HeaderLength;
311     UINT8                   Flags;
312     UINT8                   Reserved[3];
313     UINT32                  Entries;
314 
315 } ACPI_TABLE_EINJ;
316 
317 
318 /* EINJ Injection Instruction Entries (actions) */
319 
320 typedef struct acpi_einj_entry
321 {
322     ACPI_WHEA_HEADER        WheaHeader;         /* Common header for WHEA tables */
323 
324 } ACPI_EINJ_ENTRY;
325 
326 /* Masks for Flags field above */
327 
328 #define ACPI_EINJ_PRESERVE          (1)
329 
330 /* Values for Action field above */
331 
332 enum AcpiEinjActions
333 {
334     ACPI_EINJ_BEGIN_OPERATION               = 0,
335     ACPI_EINJ_GET_TRIGGER_TABLE             = 1,
336     ACPI_EINJ_SET_ERROR_TYPE                = 2,
337     ACPI_EINJ_GET_ERROR_TYPE                = 3,
338     ACPI_EINJ_END_OPERATION                 = 4,
339     ACPI_EINJ_EXECUTE_OPERATION             = 5,
340     ACPI_EINJ_CHECK_BUSY_STATUS             = 6,
341     ACPI_EINJ_GET_COMMAND_STATUS            = 7,
342     ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS   = 8,
343     ACPI_EINJ_GET_EXECUTE_TIMINGS           = 9,
344     ACPI_EINJ_ACTION_RESERVED               = 10,    /* 10 and greater are reserved */
345     ACPI_EINJ_TRIGGER_ERROR                 = 0xFF   /* Except for this value */
346 };
347 
348 /* Values for Instruction field above */
349 
350 enum AcpiEinjInstructions
351 {
352     ACPI_EINJ_READ_REGISTER         = 0,
353     ACPI_EINJ_READ_REGISTER_VALUE   = 1,
354     ACPI_EINJ_WRITE_REGISTER        = 2,
355     ACPI_EINJ_WRITE_REGISTER_VALUE  = 3,
356     ACPI_EINJ_NOOP                  = 4,
357     ACPI_EINJ_FLUSH_CACHELINE       = 5,
358     ACPI_EINJ_INSTRUCTION_RESERVED  = 6     /* 6 and greater are reserved */
359 };
360 
361 typedef struct acpi_einj_error_type_with_addr
362 {
363     UINT32                  ErrorType;
364     UINT32                  VendorStructOffset;
365     UINT32                  Flags;
366     UINT32                  ApicId;
367     UINT64                  Address;
368     UINT64                  Range;
369     UINT32                  PcieId;
370 
371 } ACPI_EINJ_ERROR_TYPE_WITH_ADDR;
372 
373 typedef struct acpi_einj_vendor
374 {
375     UINT32                  Length;
376     UINT32                  PcieId;
377     UINT16                  VendorId;
378     UINT16                  DeviceId;
379     UINT8                   RevisionId;
380     UINT8                   Reserved[3];
381 
382 } ACPI_EINJ_VENDOR;
383 
384 
385 /* EINJ Trigger Error Action Table */
386 
387 typedef struct acpi_einj_trigger
388 {
389     UINT32                  HeaderSize;
390     UINT32                  Revision;
391     UINT32                  TableSize;
392     UINT32                  EntryCount;
393 
394 } ACPI_EINJ_TRIGGER;
395 
396 /* Command status return values */
397 
398 enum AcpiEinjCommandStatus
399 {
400     ACPI_EINJ_SUCCESS               = 0,
401     ACPI_EINJ_FAILURE               = 1,
402     ACPI_EINJ_INVALID_ACCESS        = 2,
403     ACPI_EINJ_STATUS_RESERVED       = 3     /* 3 and greater are reserved */
404 };
405 
406 
407 /* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */
408 
409 #define ACPI_EINJ_PROCESSOR_CORRECTABLE     (1)
410 #define ACPI_EINJ_PROCESSOR_UNCORRECTABLE   (1<<1)
411 #define ACPI_EINJ_PROCESSOR_FATAL           (1<<2)
412 #define ACPI_EINJ_MEMORY_CORRECTABLE        (1<<3)
413 #define ACPI_EINJ_MEMORY_UNCORRECTABLE      (1<<4)
414 #define ACPI_EINJ_MEMORY_FATAL              (1<<5)
415 #define ACPI_EINJ_PCIX_CORRECTABLE          (1<<6)
416 #define ACPI_EINJ_PCIX_UNCORRECTABLE        (1<<7)
417 #define ACPI_EINJ_PCIX_FATAL                (1<<8)
418 #define ACPI_EINJ_PLATFORM_CORRECTABLE      (1<<9)
419 #define ACPI_EINJ_PLATFORM_UNCORRECTABLE    (1<<10)
420 #define ACPI_EINJ_PLATFORM_FATAL            (1<<11)
421 #define ACPI_EINJ_VENDOR_DEFINED            (1<<31)
422 
423 
424 /*******************************************************************************
425  *
426  * ERST - Error Record Serialization Table (ACPI 4.0)
427  *        Version 1
428  *
429  ******************************************************************************/
430 
431 typedef struct acpi_table_erst
432 {
433     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
434     UINT32                  HeaderLength;
435     UINT32                  Reserved;
436     UINT32                  Entries;
437 
438 } ACPI_TABLE_ERST;
439 
440 
441 /* ERST Serialization Entries (actions) */
442 
443 typedef struct acpi_erst_entry
444 {
445     ACPI_WHEA_HEADER        WheaHeader;         /* Common header for WHEA tables */
446 
447 } ACPI_ERST_ENTRY;
448 
449 /* Masks for Flags field above */
450 
451 #define ACPI_ERST_PRESERVE          (1)
452 
453 /* Values for Action field above */
454 
455 enum AcpiErstActions
456 {
457     ACPI_ERST_BEGIN_WRITE           = 0,
458     ACPI_ERST_BEGIN_READ            = 1,
459     ACPI_ERST_BEGIN_CLEAR           = 2,
460     ACPI_ERST_END                   = 3,
461     ACPI_ERST_SET_RECORD_OFFSET     = 4,
462     ACPI_ERST_EXECUTE_OPERATION     = 5,
463     ACPI_ERST_CHECK_BUSY_STATUS     = 6,
464     ACPI_ERST_GET_COMMAND_STATUS    = 7,
465     ACPI_ERST_GET_RECORD_ID         = 8,
466     ACPI_ERST_SET_RECORD_ID         = 9,
467     ACPI_ERST_GET_RECORD_COUNT      = 10,
468     ACPI_ERST_BEGIN_DUMMY_WRIITE    = 11,
469     ACPI_ERST_NOT_USED              = 12,
470     ACPI_ERST_GET_ERROR_RANGE       = 13,
471     ACPI_ERST_GET_ERROR_LENGTH      = 14,
472     ACPI_ERST_GET_ERROR_ATTRIBUTES  = 15,
473     ACPI_ERST_EXECUTE_TIMINGS       = 16,
474     ACPI_ERST_ACTION_RESERVED       = 17    /* 17 and greater are reserved */
475 };
476 
477 /* Values for Instruction field above */
478 
479 enum AcpiErstInstructions
480 {
481     ACPI_ERST_READ_REGISTER         = 0,
482     ACPI_ERST_READ_REGISTER_VALUE   = 1,
483     ACPI_ERST_WRITE_REGISTER        = 2,
484     ACPI_ERST_WRITE_REGISTER_VALUE  = 3,
485     ACPI_ERST_NOOP                  = 4,
486     ACPI_ERST_LOAD_VAR1             = 5,
487     ACPI_ERST_LOAD_VAR2             = 6,
488     ACPI_ERST_STORE_VAR1            = 7,
489     ACPI_ERST_ADD                   = 8,
490     ACPI_ERST_SUBTRACT              = 9,
491     ACPI_ERST_ADD_VALUE             = 10,
492     ACPI_ERST_SUBTRACT_VALUE        = 11,
493     ACPI_ERST_STALL                 = 12,
494     ACPI_ERST_STALL_WHILE_TRUE      = 13,
495     ACPI_ERST_SKIP_NEXT_IF_TRUE     = 14,
496     ACPI_ERST_GOTO                  = 15,
497     ACPI_ERST_SET_SRC_ADDRESS_BASE  = 16,
498     ACPI_ERST_SET_DST_ADDRESS_BASE  = 17,
499     ACPI_ERST_MOVE_DATA             = 18,
500     ACPI_ERST_INSTRUCTION_RESERVED  = 19    /* 19 and greater are reserved */
501 };
502 
503 /* Command status return values */
504 
505 enum AcpiErstCommandStatus
506 {
507     ACPI_ERST_SUCESS                = 0,
508     ACPI_ERST_NO_SPACE              = 1,
509     ACPI_ERST_NOT_AVAILABLE         = 2,
510     ACPI_ERST_FAILURE               = 3,
511     ACPI_ERST_RECORD_EMPTY          = 4,
512     ACPI_ERST_NOT_FOUND             = 5,
513     ACPI_ERST_STATUS_RESERVED       = 6     /* 6 and greater are reserved */
514 };
515 
516 
517 /* Error Record Serialization Information */
518 
519 typedef struct acpi_erst_info
520 {
521     UINT16                  Signature;          /* Should be "ER" */
522     UINT8                   Data[48];
523 
524 } ACPI_ERST_INFO;
525 
526 
527 /*******************************************************************************
528  *
529  * HEST - Hardware Error Source Table (ACPI 4.0)
530  *        Version 1
531  *
532  ******************************************************************************/
533 
534 typedef struct acpi_table_hest
535 {
536     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
537     UINT32                  ErrorSourceCount;
538 
539 } ACPI_TABLE_HEST;
540 
541 
542 /* HEST subtable header */
543 
544 typedef struct acpi_hest_header
545 {
546     UINT16                  Type;
547     UINT16                  SourceId;
548 
549 } ACPI_HEST_HEADER;
550 
551 
552 /* Values for Type field above for subtables */
553 
554 enum AcpiHestTypes
555 {
556     ACPI_HEST_TYPE_IA32_CHECK           = 0,
557     ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1,
558     ACPI_HEST_TYPE_IA32_NMI             = 2,
559     ACPI_HEST_TYPE_NOT_USED3            = 3,
560     ACPI_HEST_TYPE_NOT_USED4            = 4,
561     ACPI_HEST_TYPE_NOT_USED5            = 5,
562     ACPI_HEST_TYPE_AER_ROOT_PORT        = 6,
563     ACPI_HEST_TYPE_AER_ENDPOINT         = 7,
564     ACPI_HEST_TYPE_AER_BRIDGE           = 8,
565     ACPI_HEST_TYPE_GENERIC_ERROR        = 9,
566     ACPI_HEST_TYPE_GENERIC_ERROR_V2     = 10,
567     ACPI_HEST_TYPE_RESERVED             = 11    /* 11 and greater are reserved */
568 };
569 
570 
571 /*
572  * HEST substructures contained in subtables
573  */
574 
575 /*
576  * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and
577  * ACPI_HEST_IA_CORRECTED structures.
578  */
579 typedef struct acpi_hest_ia_error_bank
580 {
581     UINT8                   BankNumber;
582     UINT8                   ClearStatusOnInit;
583     UINT8                   StatusFormat;
584     UINT8                   Reserved;
585     UINT32                  ControlRegister;
586     UINT64                  ControlData;
587     UINT32                  StatusRegister;
588     UINT32                  AddressRegister;
589     UINT32                  MiscRegister;
590 
591 } ACPI_HEST_IA_ERROR_BANK;
592 
593 
594 /* Common HEST sub-structure for PCI/AER structures below (6,7,8) */
595 
596 typedef struct acpi_hest_aer_common
597 {
598     UINT16                  Reserved1;
599     UINT8                   Flags;
600     UINT8                   Enabled;
601     UINT32                  RecordsToPreallocate;
602     UINT32                  MaxSectionsPerRecord;
603     UINT32                  Bus;                    /* Bus and Segment numbers */
604     UINT16                  Device;
605     UINT16                  Function;
606     UINT16                  DeviceControl;
607     UINT16                  Reserved2;
608     UINT32                  UncorrectableMask;
609     UINT32                  UncorrectableSeverity;
610     UINT32                  CorrectableMask;
611     UINT32                  AdvancedCapabilities;
612 
613 } ACPI_HEST_AER_COMMON;
614 
615 /* Masks for HEST Flags fields */
616 
617 #define ACPI_HEST_FIRMWARE_FIRST        (1)
618 #define ACPI_HEST_GLOBAL                (1<<1)
619 
620 /*
621  * Macros to access the bus/segment numbers in Bus field above:
622  *  Bus number is encoded in bits 7:0
623  *  Segment number is encoded in bits 23:8
624  */
625 #define ACPI_HEST_BUS(Bus)              ((Bus) & 0xFF)
626 #define ACPI_HEST_SEGMENT(Bus)          (((Bus) >> 8) & 0xFFFF)
627 
628 
629 /* Hardware Error Notification */
630 
631 typedef struct acpi_hest_notify
632 {
633     UINT8                   Type;
634     UINT8                   Length;
635     UINT16                  ConfigWriteEnable;
636     UINT32                  PollInterval;
637     UINT32                  Vector;
638     UINT32                  PollingThresholdValue;
639     UINT32                  PollingThresholdWindow;
640     UINT32                  ErrorThresholdValue;
641     UINT32                  ErrorThresholdWindow;
642 
643 } ACPI_HEST_NOTIFY;
644 
645 /* Values for Notify Type field above */
646 
647 enum AcpiHestNotifyTypes
648 {
649     ACPI_HEST_NOTIFY_POLLED     = 0,
650     ACPI_HEST_NOTIFY_EXTERNAL   = 1,
651     ACPI_HEST_NOTIFY_LOCAL      = 2,
652     ACPI_HEST_NOTIFY_SCI        = 3,
653     ACPI_HEST_NOTIFY_NMI        = 4,
654     ACPI_HEST_NOTIFY_CMCI       = 5,    /* ACPI 5.0 */
655     ACPI_HEST_NOTIFY_MCE        = 6,    /* ACPI 5.0 */
656     ACPI_HEST_NOTIFY_GPIO       = 7,    /* ACPI 6.0 */
657     ACPI_HEST_NOTIFY_SEA        = 8,    /* ACPI 6.1 */
658     ACPI_HEST_NOTIFY_SEI        = 9,    /* ACPI 6.1 */
659     ACPI_HEST_NOTIFY_GSIV       = 10,   /* ACPI 6.1 */
660     ACPI_HEST_NOTIFY_RESERVED   = 11    /* 11 and greater are reserved */
661 };
662 
663 /* Values for ConfigWriteEnable bitfield above */
664 
665 #define ACPI_HEST_TYPE                  (1)
666 #define ACPI_HEST_POLL_INTERVAL         (1<<1)
667 #define ACPI_HEST_POLL_THRESHOLD_VALUE  (1<<2)
668 #define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3)
669 #define ACPI_HEST_ERR_THRESHOLD_VALUE   (1<<4)
670 #define ACPI_HEST_ERR_THRESHOLD_WINDOW  (1<<5)
671 
672 
673 /*
674  * HEST subtables
675  */
676 
677 /* 0: IA32 Machine Check Exception */
678 
679 typedef struct acpi_hest_ia_machine_check
680 {
681     ACPI_HEST_HEADER        Header;
682     UINT16                  Reserved1;
683     UINT8                   Flags;
684     UINT8                   Enabled;
685     UINT32                  RecordsToPreallocate;
686     UINT32                  MaxSectionsPerRecord;
687     UINT64                  GlobalCapabilityData;
688     UINT64                  GlobalControlData;
689     UINT8                   NumHardwareBanks;
690     UINT8                   Reserved3[7];
691 
692 } ACPI_HEST_IA_MACHINE_CHECK;
693 
694 
695 /* 1: IA32 Corrected Machine Check */
696 
697 typedef struct acpi_hest_ia_corrected
698 {
699     ACPI_HEST_HEADER        Header;
700     UINT16                  Reserved1;
701     UINT8                   Flags;
702     UINT8                   Enabled;
703     UINT32                  RecordsToPreallocate;
704     UINT32                  MaxSectionsPerRecord;
705     ACPI_HEST_NOTIFY        Notify;
706     UINT8                   NumHardwareBanks;
707     UINT8                   Reserved2[3];
708 
709 } ACPI_HEST_IA_CORRECTED;
710 
711 
712 /* 2: IA32 Non-Maskable Interrupt */
713 
714 typedef struct acpi_hest_ia_nmi
715 {
716     ACPI_HEST_HEADER        Header;
717     UINT32                  Reserved;
718     UINT32                  RecordsToPreallocate;
719     UINT32                  MaxSectionsPerRecord;
720     UINT32                  MaxRawDataLength;
721 
722 } ACPI_HEST_IA_NMI;
723 
724 
725 /* 3,4,5: Not used */
726 
727 /* 6: PCI Express Root Port AER */
728 
729 typedef struct acpi_hest_aer_root
730 {
731     ACPI_HEST_HEADER        Header;
732     ACPI_HEST_AER_COMMON    Aer;
733     UINT32                  RootErrorCommand;
734 
735 } ACPI_HEST_AER_ROOT;
736 
737 
738 /* 7: PCI Express AER (AER Endpoint) */
739 
740 typedef struct acpi_hest_aer
741 {
742     ACPI_HEST_HEADER        Header;
743     ACPI_HEST_AER_COMMON    Aer;
744 
745 } ACPI_HEST_AER;
746 
747 
748 /* 8: PCI Express/PCI-X Bridge AER */
749 
750 typedef struct acpi_hest_aer_bridge
751 {
752     ACPI_HEST_HEADER        Header;
753     ACPI_HEST_AER_COMMON    Aer;
754     UINT32                  UncorrectableMask2;
755     UINT32                  UncorrectableSeverity2;
756     UINT32                  AdvancedCapabilities2;
757 
758 } ACPI_HEST_AER_BRIDGE;
759 
760 
761 /* 9: Generic Hardware Error Source */
762 
763 typedef struct acpi_hest_generic
764 {
765     ACPI_HEST_HEADER        Header;
766     UINT16                  RelatedSourceId;
767     UINT8                   Reserved;
768     UINT8                   Enabled;
769     UINT32                  RecordsToPreallocate;
770     UINT32                  MaxSectionsPerRecord;
771     UINT32                  MaxRawDataLength;
772     ACPI_GENERIC_ADDRESS    ErrorStatusAddress;
773     ACPI_HEST_NOTIFY        Notify;
774     UINT32                  ErrorBlockLength;
775 
776 } ACPI_HEST_GENERIC;
777 
778 
779 /* 10: Generic Hardware Error Source, version 2 */
780 
781 typedef struct acpi_hest_generic_v2
782 {
783     ACPI_HEST_HEADER        Header;
784     UINT16                  RelatedSourceId;
785     UINT8                   Reserved;
786     UINT8                   Enabled;
787     UINT32                  RecordsToPreallocate;
788     UINT32                  MaxSectionsPerRecord;
789     UINT32                  MaxRawDataLength;
790     ACPI_GENERIC_ADDRESS    ErrorStatusAddress;
791     ACPI_HEST_NOTIFY        Notify;
792     UINT32                  ErrorBlockLength;
793     ACPI_GENERIC_ADDRESS    ReadAckRegister;
794     UINT64                  ReadAckPreserve;
795     UINT64                  ReadAckWrite;
796 
797 } ACPI_HEST_GENERIC_V2;
798 
799 
800 /* Generic Error Status block */
801 
802 typedef struct acpi_hest_generic_status
803 {
804     UINT32                  BlockStatus;
805     UINT32                  RawDataOffset;
806     UINT32                  RawDataLength;
807     UINT32                  DataLength;
808     UINT32                  ErrorSeverity;
809 
810 } ACPI_HEST_GENERIC_STATUS;
811 
812 /* Values for BlockStatus flags above */
813 
814 #define ACPI_HEST_UNCORRECTABLE             (1)
815 #define ACPI_HEST_CORRECTABLE               (1<<1)
816 #define ACPI_HEST_MULTIPLE_UNCORRECTABLE    (1<<2)
817 #define ACPI_HEST_MULTIPLE_CORRECTABLE      (1<<3)
818 #define ACPI_HEST_ERROR_ENTRY_COUNT         (0xFF<<4) /* 8 bits, error count */
819 
820 
821 /* Generic Error Data entry */
822 
823 typedef struct acpi_hest_generic_data
824 {
825     UINT8                   SectionType[16];
826     UINT32                  ErrorSeverity;
827     UINT16                  Revision;
828     UINT8                   ValidationBits;
829     UINT8                   Flags;
830     UINT32                  ErrorDataLength;
831     UINT8                   FruId[16];
832     UINT8                   FruText[20];
833 
834 } ACPI_HEST_GENERIC_DATA;
835 
836 /* Extension for revision 0x0300 */
837 
838 typedef struct acpi_hest_generic_data_v300
839 {
840     UINT8                   SectionType[16];
841     UINT32                  ErrorSeverity;
842     UINT16                  Revision;
843     UINT8                   ValidationBits;
844     UINT8                   Flags;
845     UINT32                  ErrorDataLength;
846     UINT8                   FruId[16];
847     UINT8                   FruText[20];
848     UINT64                  TimeStamp;
849 
850 } ACPI_HEST_GENERIC_DATA_V300;
851 
852 /* Values for ErrorSeverity above */
853 
854 #define ACPI_HEST_GEN_ERROR_RECOVERABLE     0
855 #define ACPI_HEST_GEN_ERROR_FATAL           1
856 #define ACPI_HEST_GEN_ERROR_CORRECTED       2
857 #define ACPI_HEST_GEN_ERROR_NONE            3
858 
859 /* Flags for ValidationBits above */
860 
861 #define ACPI_HEST_GEN_VALID_FRU_ID          (1)
862 #define ACPI_HEST_GEN_VALID_FRU_STRING      (1<<1)
863 #define ACPI_HEST_GEN_VALID_TIMESTAMP       (1<<2)
864 
865 
866 /*******************************************************************************
867  *
868  * MADT - Multiple APIC Description Table
869  *        Version 3
870  *
871  ******************************************************************************/
872 
873 typedef struct acpi_table_madt
874 {
875     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
876     UINT32                  Address;            /* Physical address of local APIC */
877     UINT32                  Flags;
878 
879 } ACPI_TABLE_MADT;
880 
881 /* Masks for Flags field above */
882 
883 #define ACPI_MADT_PCAT_COMPAT       (1)         /* 00: System also has dual 8259s */
884 
885 /* Values for PCATCompat flag */
886 
887 #define ACPI_MADT_DUAL_PIC          0
888 #define ACPI_MADT_MULTIPLE_APIC     1
889 
890 
891 /* Values for MADT subtable type in ACPI_SUBTABLE_HEADER */
892 
893 enum AcpiMadtType
894 {
895     ACPI_MADT_TYPE_LOCAL_APIC               = 0,
896     ACPI_MADT_TYPE_IO_APIC                  = 1,
897     ACPI_MADT_TYPE_INTERRUPT_OVERRIDE       = 2,
898     ACPI_MADT_TYPE_NMI_SOURCE               = 3,
899     ACPI_MADT_TYPE_LOCAL_APIC_NMI           = 4,
900     ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE      = 5,
901     ACPI_MADT_TYPE_IO_SAPIC                 = 6,
902     ACPI_MADT_TYPE_LOCAL_SAPIC              = 7,
903     ACPI_MADT_TYPE_INTERRUPT_SOURCE         = 8,
904     ACPI_MADT_TYPE_LOCAL_X2APIC             = 9,
905     ACPI_MADT_TYPE_LOCAL_X2APIC_NMI         = 10,
906     ACPI_MADT_TYPE_GENERIC_INTERRUPT        = 11,
907     ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR      = 12,
908     ACPI_MADT_TYPE_GENERIC_MSI_FRAME        = 13,
909     ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR    = 14,
910     ACPI_MADT_TYPE_GENERIC_TRANSLATOR       = 15,
911     ACPI_MADT_TYPE_RESERVED                 = 16    /* 16 and greater are reserved */
912 };
913 
914 
915 /*
916  * MADT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
917  */
918 
919 /* 0: Processor Local APIC */
920 
921 typedef struct acpi_madt_local_apic
922 {
923     ACPI_SUBTABLE_HEADER    Header;
924     UINT8                   ProcessorId;        /* ACPI processor id */
925     UINT8                   Id;                 /* Processor's local APIC id */
926     UINT32                  LapicFlags;
927 
928 } ACPI_MADT_LOCAL_APIC;
929 
930 
931 /* 1: IO APIC */
932 
933 typedef struct acpi_madt_io_apic
934 {
935     ACPI_SUBTABLE_HEADER    Header;
936     UINT8                   Id;                 /* I/O APIC ID */
937     UINT8                   Reserved;           /* Reserved - must be zero */
938     UINT32                  Address;            /* APIC physical address */
939     UINT32                  GlobalIrqBase;      /* Global system interrupt where INTI lines start */
940 
941 } ACPI_MADT_IO_APIC;
942 
943 
944 /* 2: Interrupt Override */
945 
946 typedef struct acpi_madt_interrupt_override
947 {
948     ACPI_SUBTABLE_HEADER    Header;
949     UINT8                   Bus;                /* 0 - ISA */
950     UINT8                   SourceIrq;          /* Interrupt source (IRQ) */
951     UINT32                  GlobalIrq;          /* Global system interrupt */
952     UINT16                  IntiFlags;
953 
954 } ACPI_MADT_INTERRUPT_OVERRIDE;
955 
956 
957 /* 3: NMI Source */
958 
959 typedef struct acpi_madt_nmi_source
960 {
961     ACPI_SUBTABLE_HEADER    Header;
962     UINT16                  IntiFlags;
963     UINT32                  GlobalIrq;          /* Global system interrupt */
964 
965 } ACPI_MADT_NMI_SOURCE;
966 
967 
968 /* 4: Local APIC NMI */
969 
970 typedef struct acpi_madt_local_apic_nmi
971 {
972     ACPI_SUBTABLE_HEADER    Header;
973     UINT8                   ProcessorId;        /* ACPI processor id */
974     UINT16                  IntiFlags;
975     UINT8                   Lint;               /* LINTn to which NMI is connected */
976 
977 } ACPI_MADT_LOCAL_APIC_NMI;
978 
979 
980 /* 5: Address Override */
981 
982 typedef struct acpi_madt_local_apic_override
983 {
984     ACPI_SUBTABLE_HEADER    Header;
985     UINT16                  Reserved;           /* Reserved, must be zero */
986     UINT64                  Address;            /* APIC physical address */
987 
988 } ACPI_MADT_LOCAL_APIC_OVERRIDE;
989 
990 
991 /* 6: I/O Sapic */
992 
993 typedef struct acpi_madt_io_sapic
994 {
995     ACPI_SUBTABLE_HEADER    Header;
996     UINT8                   Id;                 /* I/O SAPIC ID */
997     UINT8                   Reserved;           /* Reserved, must be zero */
998     UINT32                  GlobalIrqBase;      /* Global interrupt for SAPIC start */
999     UINT64                  Address;            /* SAPIC physical address */
1000 
1001 } ACPI_MADT_IO_SAPIC;
1002 
1003 
1004 /* 7: Local Sapic */
1005 
1006 typedef struct acpi_madt_local_sapic
1007 {
1008     ACPI_SUBTABLE_HEADER    Header;
1009     UINT8                   ProcessorId;        /* ACPI processor id */
1010     UINT8                   Id;                 /* SAPIC ID */
1011     UINT8                   Eid;                /* SAPIC EID */
1012     UINT8                   Reserved[3];        /* Reserved, must be zero */
1013     UINT32                  LapicFlags;
1014     UINT32                  Uid;                /* Numeric UID - ACPI 3.0 */
1015     char                    UidString[1];       /* String UID  - ACPI 3.0 */
1016 
1017 } ACPI_MADT_LOCAL_SAPIC;
1018 
1019 
1020 /* 8: Platform Interrupt Source */
1021 
1022 typedef struct acpi_madt_interrupt_source
1023 {
1024     ACPI_SUBTABLE_HEADER    Header;
1025     UINT16                  IntiFlags;
1026     UINT8                   Type;               /* 1=PMI, 2=INIT, 3=corrected */
1027     UINT8                   Id;                 /* Processor ID */
1028     UINT8                   Eid;                /* Processor EID */
1029     UINT8                   IoSapicVector;      /* Vector value for PMI interrupts */
1030     UINT32                  GlobalIrq;          /* Global system interrupt */
1031     UINT32                  Flags;              /* Interrupt Source Flags */
1032 
1033 } ACPI_MADT_INTERRUPT_SOURCE;
1034 
1035 /* Masks for Flags field above */
1036 
1037 #define ACPI_MADT_CPEI_OVERRIDE     (1)
1038 
1039 
1040 /* 9: Processor Local X2APIC (ACPI 4.0) */
1041 
1042 typedef struct acpi_madt_local_x2apic
1043 {
1044     ACPI_SUBTABLE_HEADER    Header;
1045     UINT16                  Reserved;           /* Reserved - must be zero */
1046     UINT32                  LocalApicId;        /* Processor x2APIC ID  */
1047     UINT32                  LapicFlags;
1048     UINT32                  Uid;                /* ACPI processor UID */
1049 
1050 } ACPI_MADT_LOCAL_X2APIC;
1051 
1052 
1053 /* 10: Local X2APIC NMI (ACPI 4.0) */
1054 
1055 typedef struct acpi_madt_local_x2apic_nmi
1056 {
1057     ACPI_SUBTABLE_HEADER    Header;
1058     UINT16                  IntiFlags;
1059     UINT32                  Uid;                /* ACPI processor UID */
1060     UINT8                   Lint;               /* LINTn to which NMI is connected */
1061     UINT8                   Reserved[3];        /* Reserved - must be zero */
1062 
1063 } ACPI_MADT_LOCAL_X2APIC_NMI;
1064 
1065 
1066 /* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */
1067 
1068 typedef struct acpi_madt_generic_interrupt
1069 {
1070     ACPI_SUBTABLE_HEADER    Header;
1071     UINT16                  Reserved;           /* Reserved - must be zero */
1072     UINT32                  CpuInterfaceNumber;
1073     UINT32                  Uid;
1074     UINT32                  Flags;
1075     UINT32                  ParkingVersion;
1076     UINT32                  PerformanceInterrupt;
1077     UINT64                  ParkedAddress;
1078     UINT64                  BaseAddress;
1079     UINT64                  GicvBaseAddress;
1080     UINT64                  GichBaseAddress;
1081     UINT32                  VgicInterrupt;
1082     UINT64                  GicrBaseAddress;
1083     UINT64                  ArmMpidr;
1084     UINT8                   EfficiencyClass;
1085     UINT8                   Reserved2[3];
1086 
1087 } ACPI_MADT_GENERIC_INTERRUPT;
1088 
1089 /* Masks for Flags field above */
1090 
1091 /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
1092 #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)  /* 01: Performance Interrupt Mode */
1093 #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)  /* 02: VGIC Maintenance Interrupt mode */
1094 
1095 
1096 /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
1097 
1098 typedef struct acpi_madt_generic_distributor
1099 {
1100     ACPI_SUBTABLE_HEADER    Header;
1101     UINT16                  Reserved;           /* Reserved - must be zero */
1102     UINT32                  GicId;
1103     UINT64                  BaseAddress;
1104     UINT32                  GlobalIrqBase;
1105     UINT8                   Version;
1106     UINT8                   Reserved2[3];       /* Reserved - must be zero */
1107 
1108 } ACPI_MADT_GENERIC_DISTRIBUTOR;
1109 
1110 /* Values for Version field above */
1111 
1112 enum AcpiMadtGicVersion
1113 {
1114     ACPI_MADT_GIC_VERSION_NONE          = 0,
1115     ACPI_MADT_GIC_VERSION_V1            = 1,
1116     ACPI_MADT_GIC_VERSION_V2            = 2,
1117     ACPI_MADT_GIC_VERSION_V3            = 3,
1118     ACPI_MADT_GIC_VERSION_V4            = 4,
1119     ACPI_MADT_GIC_VERSION_RESERVED      = 5     /* 5 and greater are reserved */
1120 };
1121 
1122 
1123 /* 13: Generic MSI Frame (ACPI 5.1) */
1124 
1125 typedef struct acpi_madt_generic_msi_frame
1126 {
1127     ACPI_SUBTABLE_HEADER    Header;
1128     UINT16                  Reserved;           /* Reserved - must be zero */
1129     UINT32                  MsiFrameId;
1130     UINT64                  BaseAddress;
1131     UINT32                  Flags;
1132     UINT16                  SpiCount;
1133     UINT16                  SpiBase;
1134 
1135 } ACPI_MADT_GENERIC_MSI_FRAME;
1136 
1137 /* Masks for Flags field above */
1138 
1139 #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
1140 
1141 
1142 /* 14: Generic Redistributor (ACPI 5.1) */
1143 
1144 typedef struct acpi_madt_generic_redistributor
1145 {
1146     ACPI_SUBTABLE_HEADER    Header;
1147     UINT16                  Reserved;           /* reserved - must be zero */
1148     UINT64                  BaseAddress;
1149     UINT32                  Length;
1150 
1151 } ACPI_MADT_GENERIC_REDISTRIBUTOR;
1152 
1153 
1154 /* 15: Generic Translator (ACPI 6.0) */
1155 
1156 typedef struct acpi_madt_generic_translator
1157 {
1158     ACPI_SUBTABLE_HEADER    Header;
1159     UINT16                  Reserved;           /* reserved - must be zero */
1160     UINT32                  TranslationId;
1161     UINT64                  BaseAddress;
1162     UINT32                  Reserved2;
1163 
1164 } ACPI_MADT_GENERIC_TRANSLATOR;
1165 
1166 
1167 /*
1168  * Common flags fields for MADT subtables
1169  */
1170 
1171 /* MADT Local APIC flags */
1172 
1173 #define ACPI_MADT_ENABLED           (1)         /* 00: Processor is usable if set */
1174 
1175 /* MADT MPS INTI flags (IntiFlags) */
1176 
1177 #define ACPI_MADT_POLARITY_MASK     (3)         /* 00-01: Polarity of APIC I/O input signals */
1178 #define ACPI_MADT_TRIGGER_MASK      (3<<2)      /* 02-03: Trigger mode of APIC input signals */
1179 
1180 /* Values for MPS INTI flags */
1181 
1182 #define ACPI_MADT_POLARITY_CONFORMS       0
1183 #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
1184 #define ACPI_MADT_POLARITY_RESERVED       2
1185 #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
1186 
1187 #define ACPI_MADT_TRIGGER_CONFORMS        (0)
1188 #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
1189 #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
1190 #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
1191 
1192 
1193 /*******************************************************************************
1194  *
1195  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
1196  *        Version 1
1197  *
1198  ******************************************************************************/
1199 
1200 typedef struct acpi_table_msct
1201 {
1202     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1203     UINT32                  ProximityOffset;    /* Location of proximity info struct(s) */
1204     UINT32                  MaxProximityDomains;/* Max number of proximity domains */
1205     UINT32                  MaxClockDomains;    /* Max number of clock domains */
1206     UINT64                  MaxAddress;         /* Max physical address in system */
1207 
1208 } ACPI_TABLE_MSCT;
1209 
1210 
1211 /* Subtable - Maximum Proximity Domain Information. Version 1 */
1212 
1213 typedef struct acpi_msct_proximity
1214 {
1215     UINT8                   Revision;
1216     UINT8                   Length;
1217     UINT32                  RangeStart;         /* Start of domain range */
1218     UINT32                  RangeEnd;           /* End of domain range */
1219     UINT32                  ProcessorCapacity;
1220     UINT64                  MemoryCapacity;     /* In bytes */
1221 
1222 } ACPI_MSCT_PROXIMITY;
1223 
1224 
1225 /*******************************************************************************
1226  *
1227  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
1228  *        Version 1
1229  *
1230  ******************************************************************************/
1231 
1232 typedef struct acpi_table_nfit
1233 {
1234     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1235     UINT32                  Reserved;           /* Reserved, must be zero */
1236 
1237 } ACPI_TABLE_NFIT;
1238 
1239 /* Subtable header for NFIT */
1240 
1241 typedef struct acpi_nfit_header
1242 {
1243     UINT16                   Type;
1244     UINT16                   Length;
1245 
1246 } ACPI_NFIT_HEADER;
1247 
1248 
1249 /* Values for subtable type in ACPI_NFIT_HEADER */
1250 
1251 enum AcpiNfitType
1252 {
1253     ACPI_NFIT_TYPE_SYSTEM_ADDRESS       = 0,
1254     ACPI_NFIT_TYPE_MEMORY_MAP           = 1,
1255     ACPI_NFIT_TYPE_INTERLEAVE           = 2,
1256     ACPI_NFIT_TYPE_SMBIOS               = 3,
1257     ACPI_NFIT_TYPE_CONTROL_REGION       = 4,
1258     ACPI_NFIT_TYPE_DATA_REGION          = 5,
1259     ACPI_NFIT_TYPE_FLUSH_ADDRESS        = 6,
1260     ACPI_NFIT_TYPE_RESERVED             = 7     /* 7 and greater are reserved */
1261 };
1262 
1263 /*
1264  * NFIT Subtables
1265  */
1266 
1267 /* 0: System Physical Address Range Structure */
1268 
1269 typedef struct acpi_nfit_system_address
1270 {
1271     ACPI_NFIT_HEADER        Header;
1272     UINT16                  RangeIndex;
1273     UINT16                  Flags;
1274     UINT32                  Reserved;           /* Reseved, must be zero */
1275     UINT32                  ProximityDomain;
1276     UINT8                   RangeGuid[16];
1277     UINT64                  Address;
1278     UINT64                  Length;
1279     UINT64                  MemoryMapping;
1280 
1281 } ACPI_NFIT_SYSTEM_ADDRESS;
1282 
1283 /* Flags */
1284 
1285 #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)     /* 00: Add/Online Operation Only */
1286 #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)  /* 01: Proximity Domain Valid */
1287 
1288 /* Range Type GUIDs appear in the include/acuuid.h file */
1289 
1290 
1291 /* 1: Memory Device to System Address Range Map Structure */
1292 
1293 typedef struct acpi_nfit_memory_map
1294 {
1295     ACPI_NFIT_HEADER        Header;
1296     UINT32                  DeviceHandle;
1297     UINT16                  PhysicalId;
1298     UINT16                  RegionId;
1299     UINT16                  RangeIndex;
1300     UINT16                  RegionIndex;
1301     UINT64                  RegionSize;
1302     UINT64                  RegionOffset;
1303     UINT64                  Address;
1304     UINT16                  InterleaveIndex;
1305     UINT16                  InterleaveWays;
1306     UINT16                  Flags;
1307     UINT16                  Reserved;           /* Reserved, must be zero */
1308 
1309 } ACPI_NFIT_MEMORY_MAP;
1310 
1311 /* Flags */
1312 
1313 #define ACPI_NFIT_MEM_SAVE_FAILED       (1)     /* 00: Last SAVE to Memory Device failed */
1314 #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)  /* 01: Last RESTORE from Memory Device failed */
1315 #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)  /* 02: Platform flush failed */
1316 #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)  /* 03: Memory Device is not armed */
1317 #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)  /* 04: Memory Device observed SMART/health events */
1318 #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)  /* 05: SMART/health events enabled */
1319 #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)  /* 06: Mapping to SPA failed */
1320 
1321 
1322 /* 2: Interleave Structure */
1323 
1324 typedef struct acpi_nfit_interleave
1325 {
1326     ACPI_NFIT_HEADER        Header;
1327     UINT16                  InterleaveIndex;
1328     UINT16                  Reserved;           /* Reserved, must be zero */
1329     UINT32                  LineCount;
1330     UINT32                  LineSize;
1331     UINT32                  LineOffset[1];      /* Variable length */
1332 
1333 } ACPI_NFIT_INTERLEAVE;
1334 
1335 
1336 /* 3: SMBIOS Management Information Structure */
1337 
1338 typedef struct acpi_nfit_smbios
1339 {
1340     ACPI_NFIT_HEADER        Header;
1341     UINT32                  Reserved;           /* Reserved, must be zero */
1342     UINT8                   Data[1];            /* Variable length */
1343 
1344 } ACPI_NFIT_SMBIOS;
1345 
1346 
1347 /* 4: NVDIMM Control Region Structure */
1348 
1349 typedef struct acpi_nfit_control_region
1350 {
1351     ACPI_NFIT_HEADER        Header;
1352     UINT16                  RegionIndex;
1353     UINT16                  VendorId;
1354     UINT16                  DeviceId;
1355     UINT16                  RevisionId;
1356     UINT16                  SubsystemVendorId;
1357     UINT16                  SubsystemDeviceId;
1358     UINT16                  SubsystemRevisionId;
1359     UINT8                   ValidFields;
1360     UINT8                   ManufacturingLocation;
1361     UINT16                  ManufacturingDate;
1362     UINT8                   Reserved[2];        /* Reserved, must be zero */
1363     UINT32                  SerialNumber;
1364     UINT16                  Code;
1365     UINT16                  Windows;
1366     UINT64                  WindowSize;
1367     UINT64                  CommandOffset;
1368     UINT64                  CommandSize;
1369     UINT64                  StatusOffset;
1370     UINT64                  StatusSize;
1371     UINT16                  Flags;
1372     UINT8                   Reserved1[6];       /* Reserved, must be zero */
1373 
1374 } ACPI_NFIT_CONTROL_REGION;
1375 
1376 /* Flags */
1377 
1378 #define ACPI_NFIT_CONTROL_BUFFERED          (1)     /* Block Data Windows implementation is buffered */
1379 
1380 /* ValidFields bits */
1381 
1382 #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)     /* Manufacturing fields are valid */
1383 
1384 
1385 /* 5: NVDIMM Block Data Window Region Structure */
1386 
1387 typedef struct acpi_nfit_data_region
1388 {
1389     ACPI_NFIT_HEADER        Header;
1390     UINT16                  RegionIndex;
1391     UINT16                  Windows;
1392     UINT64                  Offset;
1393     UINT64                  Size;
1394     UINT64                  Capacity;
1395     UINT64                  StartAddress;
1396 
1397 } ACPI_NFIT_DATA_REGION;
1398 
1399 
1400 /* 6: Flush Hint Address Structure */
1401 
1402 typedef struct acpi_nfit_flush_address
1403 {
1404     ACPI_NFIT_HEADER        Header;
1405     UINT32                  DeviceHandle;
1406     UINT16                  HintCount;
1407     UINT8                   Reserved[6];        /* Reserved, must be zero */
1408     UINT64                  HintAddress[1];     /* Variable length */
1409 
1410 } ACPI_NFIT_FLUSH_ADDRESS;
1411 
1412 
1413 /*******************************************************************************
1414  *
1415  * SBST - Smart Battery Specification Table
1416  *        Version 1
1417  *
1418  ******************************************************************************/
1419 
1420 typedef struct acpi_table_sbst
1421 {
1422     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1423     UINT32                  WarningLevel;
1424     UINT32                  LowLevel;
1425     UINT32                  CriticalLevel;
1426 
1427 } ACPI_TABLE_SBST;
1428 
1429 
1430 /*******************************************************************************
1431  *
1432  * SLIT - System Locality Distance Information Table
1433  *        Version 1
1434  *
1435  ******************************************************************************/
1436 
1437 typedef struct acpi_table_slit
1438 {
1439     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1440     UINT64                  LocalityCount;
1441     UINT8                   Entry[1];           /* Real size = localities^2 */
1442 
1443 } ACPI_TABLE_SLIT;
1444 
1445 
1446 /*******************************************************************************
1447  *
1448  * SRAT - System Resource Affinity Table
1449  *        Version 3
1450  *
1451  ******************************************************************************/
1452 
1453 typedef struct acpi_table_srat
1454 {
1455     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
1456     UINT32                  TableRevision;      /* Must be value '1' */
1457     UINT64                  Reserved;           /* Reserved, must be zero */
1458 
1459 } ACPI_TABLE_SRAT;
1460 
1461 /* Values for subtable type in ACPI_SUBTABLE_HEADER */
1462 
1463 enum AcpiSratType
1464 {
1465     ACPI_SRAT_TYPE_CPU_AFFINITY         = 0,
1466     ACPI_SRAT_TYPE_MEMORY_AFFINITY      = 1,
1467     ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY  = 2,
1468     ACPI_SRAT_TYPE_GICC_AFFINITY        = 3,
1469     ACPI_SRAT_TYPE_RESERVED             = 4     /* 4 and greater are reserved */
1470 };
1471 
1472 /*
1473  * SRAT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
1474  */
1475 
1476 /* 0: Processor Local APIC/SAPIC Affinity */
1477 
1478 typedef struct acpi_srat_cpu_affinity
1479 {
1480     ACPI_SUBTABLE_HEADER    Header;
1481     UINT8                   ProximityDomainLo;
1482     UINT8                   ApicId;
1483     UINT32                  Flags;
1484     UINT8                   LocalSapicEid;
1485     UINT8                   ProximityDomainHi[3];
1486     UINT32                  ClockDomain;
1487 
1488 } ACPI_SRAT_CPU_AFFINITY;
1489 
1490 /* Flags */
1491 
1492 #define ACPI_SRAT_CPU_USE_AFFINITY  (1)         /* 00: Use affinity structure */
1493 
1494 
1495 /* 1: Memory Affinity */
1496 
1497 typedef struct acpi_srat_mem_affinity
1498 {
1499     ACPI_SUBTABLE_HEADER    Header;
1500     UINT32                  ProximityDomain;
1501     UINT16                  Reserved;           /* Reserved, must be zero */
1502     UINT64                  BaseAddress;
1503     UINT64                  Length;
1504     UINT32                  Reserved1;
1505     UINT32                  Flags;
1506     UINT64                  Reserved2;          /* Reserved, must be zero */
1507 
1508 } ACPI_SRAT_MEM_AFFINITY;
1509 
1510 /* Flags */
1511 
1512 #define ACPI_SRAT_MEM_ENABLED       (1)         /* 00: Use affinity structure */
1513 #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1)      /* 01: Memory region is hot pluggable */
1514 #define ACPI_SRAT_MEM_NON_VOLATILE  (1<<2)      /* 02: Memory region is non-volatile */
1515 
1516 
1517 /* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
1518 
1519 typedef struct acpi_srat_x2apic_cpu_affinity
1520 {
1521     ACPI_SUBTABLE_HEADER    Header;
1522     UINT16                  Reserved;           /* Reserved, must be zero */
1523     UINT32                  ProximityDomain;
1524     UINT32                  ApicId;
1525     UINT32                  Flags;
1526     UINT32                  ClockDomain;
1527     UINT32                  Reserved2;
1528 
1529 } ACPI_SRAT_X2APIC_CPU_AFFINITY;
1530 
1531 /* Flags for ACPI_SRAT_CPU_AFFINITY and ACPI_SRAT_X2APIC_CPU_AFFINITY */
1532 
1533 #define ACPI_SRAT_CPU_ENABLED       (1)         /* 00: Use affinity structure */
1534 
1535 
1536 /* 3: GICC Affinity (ACPI 5.1) */
1537 
1538 typedef struct acpi_srat_gicc_affinity
1539 {
1540     ACPI_SUBTABLE_HEADER    Header;
1541     UINT32                  ProximityDomain;
1542     UINT32                  AcpiProcessorUid;
1543     UINT32                  Flags;
1544     UINT32                  ClockDomain;
1545 
1546 } ACPI_SRAT_GICC_AFFINITY;
1547 
1548 /* Flags for ACPI_SRAT_GICC_AFFINITY */
1549 
1550 #define ACPI_SRAT_GICC_ENABLED     (1)         /* 00: Use affinity structure */
1551 
1552 
1553 /* Reset to default packing */
1554 
1555 #pragma pack()
1556 
1557 #endif /* __ACTBL1_H__ */
1558