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