xref: /openbmc/linux/include/acpi/actbl1.h (revision 44c6dc94)
1 /******************************************************************************
2  *
3  * Name: actbl1.h - Additional ACPI table definitions
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2017, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #ifndef __ACTBL1_H__
45 #define __ACTBL1_H__
46 
47 /*******************************************************************************
48  *
49  * Additional ACPI Tables (1)
50  *
51  * These tables are not consumed directly by the ACPICA subsystem, but are
52  * included here to support device drivers and the AML disassembler.
53  *
54  * The tables in this file are fully defined within the ACPI specification.
55  *
56  ******************************************************************************/
57 
58 /*
59  * Values for description table header signatures for tables defined in this
60  * file. Useful because they make it more difficult to inadvertently type in
61  * the wrong signature.
62  */
63 #define ACPI_SIG_BERT           "BERT"	/* Boot Error Record Table */
64 #define ACPI_SIG_CPEP           "CPEP"	/* Corrected Platform Error Polling table */
65 #define ACPI_SIG_ECDT           "ECDT"	/* Embedded Controller Boot Resources Table */
66 #define ACPI_SIG_EINJ           "EINJ"	/* Error Injection table */
67 #define ACPI_SIG_ERST           "ERST"	/* Error Record Serialization Table */
68 #define ACPI_SIG_HMAT           "HMAT"	/* Heterogeneous Memory Attributes Table */
69 #define ACPI_SIG_HEST           "HEST"	/* Hardware Error Source Table */
70 #define ACPI_SIG_MADT           "APIC"	/* Multiple APIC Description Table */
71 #define ACPI_SIG_MSCT           "MSCT"	/* Maximum System Characteristics Table */
72 #define ACPI_SIG_PDTT           "PDTT"	/* Platform Debug Trigger Table */
73 #define ACPI_SIG_PPTT           "PPTT"	/* Processor Properties Topology Table */
74 #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */
75 #define ACPI_SIG_SDEV           "SDEV"	/* Secure Devices table */
76 #define ACPI_SIG_SLIT           "SLIT"	/* System Locality Distance Information Table */
77 #define ACPI_SIG_SRAT           "SRAT"	/* System Resource Affinity Table */
78 #define ACPI_SIG_NFIT           "NFIT"	/* NVDIMM Firmware Interface Table */
79 
80 /*
81  * All tables must be byte-packed to match the ACPI specification, since
82  * the tables are provided by the system BIOS.
83  */
84 #pragma pack(1)
85 
86 /*
87  * Note: C bitfields are not used for this reason:
88  *
89  * "Bitfields are great and easy to read, but unfortunately the C language
90  * does not specify the layout of bitfields in memory, which means they are
91  * essentially useless for dealing with packed data in on-disk formats or
92  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
93  * this decision was a design error in C. Ritchie could have picked an order
94  * and stuck with it." Norman Ramsey.
95  * See http://stackoverflow.com/a/1053662/41661
96  */
97 
98 /*******************************************************************************
99  *
100  * Common subtable headers
101  *
102  ******************************************************************************/
103 
104 /* Generic subtable header (used in MADT, SRAT, etc.) */
105 
106 struct acpi_subtable_header {
107 	u8 type;
108 	u8 length;
109 };
110 
111 /* Subtable header for WHEA tables (EINJ, ERST, WDAT) */
112 
113 struct acpi_whea_header {
114 	u8 action;
115 	u8 instruction;
116 	u8 flags;
117 	u8 reserved;
118 	struct acpi_generic_address register_region;
119 	u64 value;		/* Value used with Read/Write register */
120 	u64 mask;		/* Bitmask required for this register instruction */
121 };
122 
123 /*******************************************************************************
124  *
125  * BERT - Boot Error Record Table (ACPI 4.0)
126  *        Version 1
127  *
128  ******************************************************************************/
129 
130 struct acpi_table_bert {
131 	struct acpi_table_header header;	/* Common ACPI table header */
132 	u32 region_length;	/* Length of the boot error region */
133 	u64 address;		/* Physical address of the error region */
134 };
135 
136 /* Boot Error Region (not a subtable, pointed to by Address field above) */
137 
138 struct acpi_bert_region {
139 	u32 block_status;	/* Type of error information */
140 	u32 raw_data_offset;	/* Offset to raw error data */
141 	u32 raw_data_length;	/* Length of raw error data */
142 	u32 data_length;	/* Length of generic error data */
143 	u32 error_severity;	/* Severity code */
144 };
145 
146 /* Values for block_status flags above */
147 
148 #define ACPI_BERT_UNCORRECTABLE             (1)
149 #define ACPI_BERT_CORRECTABLE               (1<<1)
150 #define ACPI_BERT_MULTIPLE_UNCORRECTABLE    (1<<2)
151 #define ACPI_BERT_MULTIPLE_CORRECTABLE      (1<<3)
152 #define ACPI_BERT_ERROR_ENTRY_COUNT         (0xFF<<4)	/* 8 bits, error count */
153 
154 /* Values for error_severity above */
155 
156 enum acpi_bert_error_severity {
157 	ACPI_BERT_ERROR_CORRECTABLE = 0,
158 	ACPI_BERT_ERROR_FATAL = 1,
159 	ACPI_BERT_ERROR_CORRECTED = 2,
160 	ACPI_BERT_ERROR_NONE = 3,
161 	ACPI_BERT_ERROR_RESERVED = 4	/* 4 and greater are reserved */
162 };
163 
164 /*
165  * Note: The generic error data that follows the error_severity field above
166  * uses the struct acpi_hest_generic_data defined under the HEST table below
167  */
168 
169 /*******************************************************************************
170  *
171  * CPEP - Corrected Platform Error Polling table (ACPI 4.0)
172  *        Version 1
173  *
174  ******************************************************************************/
175 
176 struct acpi_table_cpep {
177 	struct acpi_table_header header;	/* Common ACPI table header */
178 	u64 reserved;
179 };
180 
181 /* Subtable */
182 
183 struct acpi_cpep_polling {
184 	struct acpi_subtable_header header;
185 	u8 id;			/* Processor ID */
186 	u8 eid;			/* Processor EID */
187 	u32 interval;		/* Polling interval (msec) */
188 };
189 
190 /*******************************************************************************
191  *
192  * ECDT - Embedded Controller Boot Resources Table
193  *        Version 1
194  *
195  ******************************************************************************/
196 
197 struct acpi_table_ecdt {
198 	struct acpi_table_header header;	/* Common ACPI table header */
199 	struct acpi_generic_address control;	/* Address of EC command/status register */
200 	struct acpi_generic_address data;	/* Address of EC data register */
201 	u32 uid;		/* Unique ID - must be same as the EC _UID method */
202 	u8 gpe;			/* The GPE for the EC */
203 	u8 id[1];		/* Full namepath of the EC in the ACPI namespace */
204 };
205 
206 /*******************************************************************************
207  *
208  * EINJ - Error Injection Table (ACPI 4.0)
209  *        Version 1
210  *
211  ******************************************************************************/
212 
213 struct acpi_table_einj {
214 	struct acpi_table_header header;	/* Common ACPI table header */
215 	u32 header_length;
216 	u8 flags;
217 	u8 reserved[3];
218 	u32 entries;
219 };
220 
221 /* EINJ Injection Instruction Entries (actions) */
222 
223 struct acpi_einj_entry {
224 	struct acpi_whea_header whea_header;	/* Common header for WHEA tables */
225 };
226 
227 /* Masks for Flags field above */
228 
229 #define ACPI_EINJ_PRESERVE          (1)
230 
231 /* Values for Action field above */
232 
233 enum acpi_einj_actions {
234 	ACPI_EINJ_BEGIN_OPERATION = 0,
235 	ACPI_EINJ_GET_TRIGGER_TABLE = 1,
236 	ACPI_EINJ_SET_ERROR_TYPE = 2,
237 	ACPI_EINJ_GET_ERROR_TYPE = 3,
238 	ACPI_EINJ_END_OPERATION = 4,
239 	ACPI_EINJ_EXECUTE_OPERATION = 5,
240 	ACPI_EINJ_CHECK_BUSY_STATUS = 6,
241 	ACPI_EINJ_GET_COMMAND_STATUS = 7,
242 	ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
243 	ACPI_EINJ_GET_EXECUTE_TIMINGS = 9,
244 	ACPI_EINJ_ACTION_RESERVED = 10,	/* 10 and greater are reserved */
245 	ACPI_EINJ_TRIGGER_ERROR = 0xFF	/* Except for this value */
246 };
247 
248 /* Values for Instruction field above */
249 
250 enum acpi_einj_instructions {
251 	ACPI_EINJ_READ_REGISTER = 0,
252 	ACPI_EINJ_READ_REGISTER_VALUE = 1,
253 	ACPI_EINJ_WRITE_REGISTER = 2,
254 	ACPI_EINJ_WRITE_REGISTER_VALUE = 3,
255 	ACPI_EINJ_NOOP = 4,
256 	ACPI_EINJ_FLUSH_CACHELINE = 5,
257 	ACPI_EINJ_INSTRUCTION_RESERVED = 6	/* 6 and greater are reserved */
258 };
259 
260 struct acpi_einj_error_type_with_addr {
261 	u32 error_type;
262 	u32 vendor_struct_offset;
263 	u32 flags;
264 	u32 apic_id;
265 	u64 address;
266 	u64 range;
267 	u32 pcie_id;
268 };
269 
270 struct acpi_einj_vendor {
271 	u32 length;
272 	u32 pcie_id;
273 	u16 vendor_id;
274 	u16 device_id;
275 	u8 revision_id;
276 	u8 reserved[3];
277 };
278 
279 /* EINJ Trigger Error Action Table */
280 
281 struct acpi_einj_trigger {
282 	u32 header_size;
283 	u32 revision;
284 	u32 table_size;
285 	u32 entry_count;
286 };
287 
288 /* Command status return values */
289 
290 enum acpi_einj_command_status {
291 	ACPI_EINJ_SUCCESS = 0,
292 	ACPI_EINJ_FAILURE = 1,
293 	ACPI_EINJ_INVALID_ACCESS = 2,
294 	ACPI_EINJ_STATUS_RESERVED = 3	/* 3 and greater are reserved */
295 };
296 
297 /* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */
298 
299 #define ACPI_EINJ_PROCESSOR_CORRECTABLE     (1)
300 #define ACPI_EINJ_PROCESSOR_UNCORRECTABLE   (1<<1)
301 #define ACPI_EINJ_PROCESSOR_FATAL           (1<<2)
302 #define ACPI_EINJ_MEMORY_CORRECTABLE        (1<<3)
303 #define ACPI_EINJ_MEMORY_UNCORRECTABLE      (1<<4)
304 #define ACPI_EINJ_MEMORY_FATAL              (1<<5)
305 #define ACPI_EINJ_PCIX_CORRECTABLE          (1<<6)
306 #define ACPI_EINJ_PCIX_UNCORRECTABLE        (1<<7)
307 #define ACPI_EINJ_PCIX_FATAL                (1<<8)
308 #define ACPI_EINJ_PLATFORM_CORRECTABLE      (1<<9)
309 #define ACPI_EINJ_PLATFORM_UNCORRECTABLE    (1<<10)
310 #define ACPI_EINJ_PLATFORM_FATAL            (1<<11)
311 #define ACPI_EINJ_VENDOR_DEFINED            (1<<31)
312 
313 /*******************************************************************************
314  *
315  * ERST - Error Record Serialization Table (ACPI 4.0)
316  *        Version 1
317  *
318  ******************************************************************************/
319 
320 struct acpi_table_erst {
321 	struct acpi_table_header header;	/* Common ACPI table header */
322 	u32 header_length;
323 	u32 reserved;
324 	u32 entries;
325 };
326 
327 /* ERST Serialization Entries (actions) */
328 
329 struct acpi_erst_entry {
330 	struct acpi_whea_header whea_header;	/* Common header for WHEA tables */
331 };
332 
333 /* Masks for Flags field above */
334 
335 #define ACPI_ERST_PRESERVE          (1)
336 
337 /* Values for Action field above */
338 
339 enum acpi_erst_actions {
340 	ACPI_ERST_BEGIN_WRITE = 0,
341 	ACPI_ERST_BEGIN_READ = 1,
342 	ACPI_ERST_BEGIN_CLEAR = 2,
343 	ACPI_ERST_END = 3,
344 	ACPI_ERST_SET_RECORD_OFFSET = 4,
345 	ACPI_ERST_EXECUTE_OPERATION = 5,
346 	ACPI_ERST_CHECK_BUSY_STATUS = 6,
347 	ACPI_ERST_GET_COMMAND_STATUS = 7,
348 	ACPI_ERST_GET_RECORD_ID = 8,
349 	ACPI_ERST_SET_RECORD_ID = 9,
350 	ACPI_ERST_GET_RECORD_COUNT = 10,
351 	ACPI_ERST_BEGIN_DUMMY_WRIITE = 11,
352 	ACPI_ERST_NOT_USED = 12,
353 	ACPI_ERST_GET_ERROR_RANGE = 13,
354 	ACPI_ERST_GET_ERROR_LENGTH = 14,
355 	ACPI_ERST_GET_ERROR_ATTRIBUTES = 15,
356 	ACPI_ERST_EXECUTE_TIMINGS = 16,
357 	ACPI_ERST_ACTION_RESERVED = 17	/* 17 and greater are reserved */
358 };
359 
360 /* Values for Instruction field above */
361 
362 enum acpi_erst_instructions {
363 	ACPI_ERST_READ_REGISTER = 0,
364 	ACPI_ERST_READ_REGISTER_VALUE = 1,
365 	ACPI_ERST_WRITE_REGISTER = 2,
366 	ACPI_ERST_WRITE_REGISTER_VALUE = 3,
367 	ACPI_ERST_NOOP = 4,
368 	ACPI_ERST_LOAD_VAR1 = 5,
369 	ACPI_ERST_LOAD_VAR2 = 6,
370 	ACPI_ERST_STORE_VAR1 = 7,
371 	ACPI_ERST_ADD = 8,
372 	ACPI_ERST_SUBTRACT = 9,
373 	ACPI_ERST_ADD_VALUE = 10,
374 	ACPI_ERST_SUBTRACT_VALUE = 11,
375 	ACPI_ERST_STALL = 12,
376 	ACPI_ERST_STALL_WHILE_TRUE = 13,
377 	ACPI_ERST_SKIP_NEXT_IF_TRUE = 14,
378 	ACPI_ERST_GOTO = 15,
379 	ACPI_ERST_SET_SRC_ADDRESS_BASE = 16,
380 	ACPI_ERST_SET_DST_ADDRESS_BASE = 17,
381 	ACPI_ERST_MOVE_DATA = 18,
382 	ACPI_ERST_INSTRUCTION_RESERVED = 19	/* 19 and greater are reserved */
383 };
384 
385 /* Command status return values */
386 
387 enum acpi_erst_command_status {
388 	ACPI_ERST_SUCESS = 0,
389 	ACPI_ERST_NO_SPACE = 1,
390 	ACPI_ERST_NOT_AVAILABLE = 2,
391 	ACPI_ERST_FAILURE = 3,
392 	ACPI_ERST_RECORD_EMPTY = 4,
393 	ACPI_ERST_NOT_FOUND = 5,
394 	ACPI_ERST_STATUS_RESERVED = 6	/* 6 and greater are reserved */
395 };
396 
397 /* Error Record Serialization Information */
398 
399 struct acpi_erst_info {
400 	u16 signature;		/* Should be "ER" */
401 	u8 data[48];
402 };
403 
404 /*******************************************************************************
405  *
406  * HEST - Hardware Error Source Table (ACPI 4.0)
407  *        Version 1
408  *
409  ******************************************************************************/
410 
411 struct acpi_table_hest {
412 	struct acpi_table_header header;	/* Common ACPI table header */
413 	u32 error_source_count;
414 };
415 
416 /* HEST subtable header */
417 
418 struct acpi_hest_header {
419 	u16 type;
420 	u16 source_id;
421 };
422 
423 /* Values for Type field above for subtables */
424 
425 enum acpi_hest_types {
426 	ACPI_HEST_TYPE_IA32_CHECK = 0,
427 	ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1,
428 	ACPI_HEST_TYPE_IA32_NMI = 2,
429 	ACPI_HEST_TYPE_NOT_USED3 = 3,
430 	ACPI_HEST_TYPE_NOT_USED4 = 4,
431 	ACPI_HEST_TYPE_NOT_USED5 = 5,
432 	ACPI_HEST_TYPE_AER_ROOT_PORT = 6,
433 	ACPI_HEST_TYPE_AER_ENDPOINT = 7,
434 	ACPI_HEST_TYPE_AER_BRIDGE = 8,
435 	ACPI_HEST_TYPE_GENERIC_ERROR = 9,
436 	ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10,
437 	ACPI_HEST_TYPE_IA32_DEFERRED_CHECK = 11,
438 	ACPI_HEST_TYPE_RESERVED = 12	/* 12 and greater are reserved */
439 };
440 
441 /*
442  * HEST substructures contained in subtables
443  */
444 
445 /*
446  * IA32 Error Bank(s) - Follows the struct acpi_hest_ia_machine_check and
447  * struct acpi_hest_ia_corrected structures.
448  */
449 struct acpi_hest_ia_error_bank {
450 	u8 bank_number;
451 	u8 clear_status_on_init;
452 	u8 status_format;
453 	u8 reserved;
454 	u32 control_register;
455 	u64 control_data;
456 	u32 status_register;
457 	u32 address_register;
458 	u32 misc_register;
459 };
460 
461 /* Common HEST sub-structure for PCI/AER structures below (6,7,8) */
462 
463 struct acpi_hest_aer_common {
464 	u16 reserved1;
465 	u8 flags;
466 	u8 enabled;
467 	u32 records_to_preallocate;
468 	u32 max_sections_per_record;
469 	u32 bus;		/* Bus and Segment numbers */
470 	u16 device;
471 	u16 function;
472 	u16 device_control;
473 	u16 reserved2;
474 	u32 uncorrectable_mask;
475 	u32 uncorrectable_severity;
476 	u32 correctable_mask;
477 	u32 advanced_capabilities;
478 };
479 
480 /* Masks for HEST Flags fields */
481 
482 #define ACPI_HEST_FIRMWARE_FIRST        (1)
483 #define ACPI_HEST_GLOBAL                (1<<1)
484 #define ACPI_HEST_GHES_ASSIST           (1<<2)
485 
486 /*
487  * Macros to access the bus/segment numbers in Bus field above:
488  *  Bus number is encoded in bits 7:0
489  *  Segment number is encoded in bits 23:8
490  */
491 #define ACPI_HEST_BUS(bus)              ((bus) & 0xFF)
492 #define ACPI_HEST_SEGMENT(bus)          (((bus) >> 8) & 0xFFFF)
493 
494 /* Hardware Error Notification */
495 
496 struct acpi_hest_notify {
497 	u8 type;
498 	u8 length;
499 	u16 config_write_enable;
500 	u32 poll_interval;
501 	u32 vector;
502 	u32 polling_threshold_value;
503 	u32 polling_threshold_window;
504 	u32 error_threshold_value;
505 	u32 error_threshold_window;
506 };
507 
508 /* Values for Notify Type field above */
509 
510 enum acpi_hest_notify_types {
511 	ACPI_HEST_NOTIFY_POLLED = 0,
512 	ACPI_HEST_NOTIFY_EXTERNAL = 1,
513 	ACPI_HEST_NOTIFY_LOCAL = 2,
514 	ACPI_HEST_NOTIFY_SCI = 3,
515 	ACPI_HEST_NOTIFY_NMI = 4,
516 	ACPI_HEST_NOTIFY_CMCI = 5,	/* ACPI 5.0 */
517 	ACPI_HEST_NOTIFY_MCE = 6,	/* ACPI 5.0 */
518 	ACPI_HEST_NOTIFY_GPIO = 7,	/* ACPI 6.0 */
519 	ACPI_HEST_NOTIFY_SEA = 8,	/* ACPI 6.1 */
520 	ACPI_HEST_NOTIFY_SEI = 9,	/* ACPI 6.1 */
521 	ACPI_HEST_NOTIFY_GSIV = 10,	/* ACPI 6.1 */
522 	ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11,	/* ACPI 6.2 */
523 	ACPI_HEST_NOTIFY_RESERVED = 12	/* 12 and greater are reserved */
524 };
525 
526 /* Values for config_write_enable bitfield above */
527 
528 #define ACPI_HEST_TYPE                  (1)
529 #define ACPI_HEST_POLL_INTERVAL         (1<<1)
530 #define ACPI_HEST_POLL_THRESHOLD_VALUE  (1<<2)
531 #define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3)
532 #define ACPI_HEST_ERR_THRESHOLD_VALUE   (1<<4)
533 #define ACPI_HEST_ERR_THRESHOLD_WINDOW  (1<<5)
534 
535 /*
536  * HEST subtables
537  */
538 
539 /* 0: IA32 Machine Check Exception */
540 
541 struct acpi_hest_ia_machine_check {
542 	struct acpi_hest_header header;
543 	u16 reserved1;
544 	u8 flags;		/* See flags ACPI_HEST_GLOBAL, etc. above */
545 	u8 enabled;
546 	u32 records_to_preallocate;
547 	u32 max_sections_per_record;
548 	u64 global_capability_data;
549 	u64 global_control_data;
550 	u8 num_hardware_banks;
551 	u8 reserved3[7];
552 };
553 
554 /* 1: IA32 Corrected Machine Check */
555 
556 struct acpi_hest_ia_corrected {
557 	struct acpi_hest_header header;
558 	u16 reserved1;
559 	u8 flags;		/* See flags ACPI_HEST_GLOBAL, etc. above */
560 	u8 enabled;
561 	u32 records_to_preallocate;
562 	u32 max_sections_per_record;
563 	struct acpi_hest_notify notify;
564 	u8 num_hardware_banks;
565 	u8 reserved2[3];
566 };
567 
568 /* 2: IA32 Non-Maskable Interrupt */
569 
570 struct acpi_hest_ia_nmi {
571 	struct acpi_hest_header header;
572 	u32 reserved;
573 	u32 records_to_preallocate;
574 	u32 max_sections_per_record;
575 	u32 max_raw_data_length;
576 };
577 
578 /* 3,4,5: Not used */
579 
580 /* 6: PCI Express Root Port AER */
581 
582 struct acpi_hest_aer_root {
583 	struct acpi_hest_header header;
584 	struct acpi_hest_aer_common aer;
585 	u32 root_error_command;
586 };
587 
588 /* 7: PCI Express AER (AER Endpoint) */
589 
590 struct acpi_hest_aer {
591 	struct acpi_hest_header header;
592 	struct acpi_hest_aer_common aer;
593 };
594 
595 /* 8: PCI Express/PCI-X Bridge AER */
596 
597 struct acpi_hest_aer_bridge {
598 	struct acpi_hest_header header;
599 	struct acpi_hest_aer_common aer;
600 	u32 uncorrectable_mask2;
601 	u32 uncorrectable_severity2;
602 	u32 advanced_capabilities2;
603 };
604 
605 /* 9: Generic Hardware Error Source */
606 
607 struct acpi_hest_generic {
608 	struct acpi_hest_header header;
609 	u16 related_source_id;
610 	u8 reserved;
611 	u8 enabled;
612 	u32 records_to_preallocate;
613 	u32 max_sections_per_record;
614 	u32 max_raw_data_length;
615 	struct acpi_generic_address error_status_address;
616 	struct acpi_hest_notify notify;
617 	u32 error_block_length;
618 };
619 
620 /* 10: Generic Hardware Error Source, version 2 */
621 
622 struct acpi_hest_generic_v2 {
623 	struct acpi_hest_header header;
624 	u16 related_source_id;
625 	u8 reserved;
626 	u8 enabled;
627 	u32 records_to_preallocate;
628 	u32 max_sections_per_record;
629 	u32 max_raw_data_length;
630 	struct acpi_generic_address error_status_address;
631 	struct acpi_hest_notify notify;
632 	u32 error_block_length;
633 	struct acpi_generic_address read_ack_register;
634 	u64 read_ack_preserve;
635 	u64 read_ack_write;
636 };
637 
638 /* Generic Error Status block */
639 
640 struct acpi_hest_generic_status {
641 	u32 block_status;
642 	u32 raw_data_offset;
643 	u32 raw_data_length;
644 	u32 data_length;
645 	u32 error_severity;
646 };
647 
648 /* Values for block_status flags above */
649 
650 #define ACPI_HEST_UNCORRECTABLE             (1)
651 #define ACPI_HEST_CORRECTABLE               (1<<1)
652 #define ACPI_HEST_MULTIPLE_UNCORRECTABLE    (1<<2)
653 #define ACPI_HEST_MULTIPLE_CORRECTABLE      (1<<3)
654 #define ACPI_HEST_ERROR_ENTRY_COUNT         (0xFF<<4)	/* 8 bits, error count */
655 
656 /* Generic Error Data entry */
657 
658 struct acpi_hest_generic_data {
659 	u8 section_type[16];
660 	u32 error_severity;
661 	u16 revision;
662 	u8 validation_bits;
663 	u8 flags;
664 	u32 error_data_length;
665 	u8 fru_id[16];
666 	u8 fru_text[20];
667 };
668 
669 /* Extension for revision 0x0300 */
670 
671 struct acpi_hest_generic_data_v300 {
672 	u8 section_type[16];
673 	u32 error_severity;
674 	u16 revision;
675 	u8 validation_bits;
676 	u8 flags;
677 	u32 error_data_length;
678 	u8 fru_id[16];
679 	u8 fru_text[20];
680 	u64 time_stamp;
681 };
682 
683 /* Values for error_severity above */
684 
685 #define ACPI_HEST_GEN_ERROR_RECOVERABLE     0
686 #define ACPI_HEST_GEN_ERROR_FATAL           1
687 #define ACPI_HEST_GEN_ERROR_CORRECTED       2
688 #define ACPI_HEST_GEN_ERROR_NONE            3
689 
690 /* Flags for validation_bits above */
691 
692 #define ACPI_HEST_GEN_VALID_FRU_ID          (1)
693 #define ACPI_HEST_GEN_VALID_FRU_STRING      (1<<1)
694 #define ACPI_HEST_GEN_VALID_TIMESTAMP       (1<<2)
695 
696 /* 11: IA32 Deferred Machine Check Exception (ACPI 6.2) */
697 
698 struct acpi_hest_ia_deferred_check {
699 	struct acpi_hest_header header;
700 	u16 reserved1;
701 	u8 flags;		/* See flags ACPI_HEST_GLOBAL, etc. above */
702 	u8 enabled;
703 	u32 records_to_preallocate;
704 	u32 max_sections_per_record;
705 	struct acpi_hest_notify notify;
706 	u8 num_hardware_banks;
707 	u8 reserved2[3];
708 };
709 
710 /*******************************************************************************
711  *
712  * HMAT - Heterogeneous Memory Attributes Table (ACPI 6.2)
713  *        Version 1
714  *
715  ******************************************************************************/
716 
717 struct acpi_table_hmat {
718 	struct acpi_table_header header;	/* Common ACPI table header */
719 	u32 reserved;
720 };
721 
722 /* Values for HMAT structure types */
723 
724 enum acpi_hmat_type {
725 	ACPI_HMAT_TYPE_ADDRESS_RANGE = 0,	/* Memory subystem address range */
726 	ACPI_HMAT_TYPE_LOCALITY = 1,	/* System locality latency and bandwidth information */
727 	ACPI_HMAT_TYPE_CACHE = 2,	/* Memory side cache information */
728 	ACPI_HMAT_TYPE_RESERVED = 3	/* 3 and greater are reserved */
729 };
730 
731 struct acpi_hmat_structure {
732 	u16 type;
733 	u16 reserved;
734 	u32 length;
735 };
736 
737 /*
738  * HMAT Structures, correspond to Type in struct acpi_hmat_structure
739  */
740 
741 /* 0: Memory subystem address range */
742 
743 struct acpi_hmat_address_range {
744 	struct acpi_hmat_structure header;
745 	u16 flags;
746 	u16 reserved1;
747 	u32 processor_PD;	/* Processor proximity domain */
748 	u32 memory_PD;		/* Memory proximity domain */
749 	u32 reserved2;
750 	u64 physical_address_base;	/* Physical address range base */
751 	u64 physical_address_length;	/* Physical address range length */
752 };
753 
754 /* Masks for Flags field above */
755 
756 #define ACPI_HMAT_PROCESSOR_PD_VALID    (1)	/* 1: processor_PD field is valid */
757 #define ACPI_HMAT_MEMORY_PD_VALID       (1<<1)	/* 1: memory_PD field is valid */
758 #define ACPI_HMAT_RESERVATION_HINT      (1<<2)	/* 1: Reservation hint */
759 
760 /* 1: System locality latency and bandwidth information */
761 
762 struct acpi_hmat_locality {
763 	struct acpi_hmat_structure header;
764 	u8 flags;
765 	u8 data_type;
766 	u16 reserved1;
767 	u32 number_of_initiator_Pds;
768 	u32 number_of_target_Pds;
769 	u32 reserved2;
770 	u64 entry_base_unit;
771 };
772 
773 /* Masks for Flags field above */
774 
775 #define ACPI_HMAT_MEMORY_HIERARCHY  (0x0F)
776 
777 /* Values for Memory Hierarchy flag */
778 
779 #define ACPI_HMAT_MEMORY            0
780 #define ACPI_HMAT_LAST_LEVEL_CACHE  1
781 #define ACPI_HMAT_1ST_LEVEL_CACHE   2
782 #define ACPI_HMAT_2ND_LEVEL_CACHE   3
783 #define ACPI_HMAT_3RD_LEVEL_CACHE   4
784 
785 /* Values for data_type field above */
786 
787 #define ACPI_HMAT_ACCESS_LATENCY    0
788 #define ACPI_HMAT_READ_LATENCY      1
789 #define ACPI_HMAT_WRITE_LATENCY     2
790 #define ACPI_HMAT_ACCESS_BANDWIDTH  3
791 #define ACPI_HMAT_READ_BANDWIDTH    4
792 #define ACPI_HMAT_WRITE_BANDWIDTH   5
793 
794 /* 2: Memory side cache information */
795 
796 struct acpi_hmat_cache {
797 	struct acpi_hmat_structure header;
798 	u32 memory_PD;
799 	u32 reserved1;
800 	u64 cache_size;
801 	u32 cache_attributes;
802 	u16 reserved2;
803 	u16 number_of_SMBIOShandles;
804 };
805 
806 /* Masks for cache_attributes field above */
807 
808 #define ACPI_HMAT_TOTAL_CACHE_LEVEL     (0x0000000F)
809 #define ACPI_HMAT_CACHE_LEVEL           (0x000000F0)
810 #define ACPI_HMAT_CACHE_ASSOCIATIVITY   (0x00000F00)
811 #define ACPI_HMAT_WRITE_POLICY          (0x0000F000)
812 #define ACPI_HMAT_CACHE_LINE_SIZE       (0xFFFF0000)
813 
814 /* Values for cache associativity flag */
815 
816 #define ACPI_HMAT_CA_NONE                     (0)
817 #define ACPI_HMAT_CA_DIRECT_MAPPED            (1)
818 #define ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING   (2)
819 
820 /* Values for write policy flag */
821 
822 #define ACPI_HMAT_CP_NONE   (0)
823 #define ACPI_HMAT_CP_WB     (1)
824 #define ACPI_HMAT_CP_WT     (2)
825 
826 /*******************************************************************************
827  *
828  * MADT - Multiple APIC Description Table
829  *        Version 3
830  *
831  ******************************************************************************/
832 
833 struct acpi_table_madt {
834 	struct acpi_table_header header;	/* Common ACPI table header */
835 	u32 address;		/* Physical address of local APIC */
836 	u32 flags;
837 };
838 
839 /* Masks for Flags field above */
840 
841 #define ACPI_MADT_PCAT_COMPAT       (1)	/* 00: System also has dual 8259s */
842 
843 /* Values for PCATCompat flag */
844 
845 #define ACPI_MADT_DUAL_PIC          1
846 #define ACPI_MADT_MULTIPLE_APIC     0
847 
848 /* Values for MADT subtable type in struct acpi_subtable_header */
849 
850 enum acpi_madt_type {
851 	ACPI_MADT_TYPE_LOCAL_APIC = 0,
852 	ACPI_MADT_TYPE_IO_APIC = 1,
853 	ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
854 	ACPI_MADT_TYPE_NMI_SOURCE = 3,
855 	ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
856 	ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
857 	ACPI_MADT_TYPE_IO_SAPIC = 6,
858 	ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
859 	ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
860 	ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
861 	ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
862 	ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
863 	ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
864 	ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
865 	ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
866 	ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
867 	ACPI_MADT_TYPE_RESERVED = 16	/* 16 and greater are reserved */
868 };
869 
870 /*
871  * MADT Subtables, correspond to Type in struct acpi_subtable_header
872  */
873 
874 /* 0: Processor Local APIC */
875 
876 struct acpi_madt_local_apic {
877 	struct acpi_subtable_header header;
878 	u8 processor_id;	/* ACPI processor id */
879 	u8 id;			/* Processor's local APIC id */
880 	u32 lapic_flags;
881 };
882 
883 /* 1: IO APIC */
884 
885 struct acpi_madt_io_apic {
886 	struct acpi_subtable_header header;
887 	u8 id;			/* I/O APIC ID */
888 	u8 reserved;		/* reserved - must be zero */
889 	u32 address;		/* APIC physical address */
890 	u32 global_irq_base;	/* Global system interrupt where INTI lines start */
891 };
892 
893 /* 2: Interrupt Override */
894 
895 struct acpi_madt_interrupt_override {
896 	struct acpi_subtable_header header;
897 	u8 bus;			/* 0 - ISA */
898 	u8 source_irq;		/* Interrupt source (IRQ) */
899 	u32 global_irq;		/* Global system interrupt */
900 	u16 inti_flags;
901 };
902 
903 /* 3: NMI Source */
904 
905 struct acpi_madt_nmi_source {
906 	struct acpi_subtable_header header;
907 	u16 inti_flags;
908 	u32 global_irq;		/* Global system interrupt */
909 };
910 
911 /* 4: Local APIC NMI */
912 
913 struct acpi_madt_local_apic_nmi {
914 	struct acpi_subtable_header header;
915 	u8 processor_id;	/* ACPI processor id */
916 	u16 inti_flags;
917 	u8 lint;		/* LINTn to which NMI is connected */
918 };
919 
920 /* 5: Address Override */
921 
922 struct acpi_madt_local_apic_override {
923 	struct acpi_subtable_header header;
924 	u16 reserved;		/* Reserved, must be zero */
925 	u64 address;		/* APIC physical address */
926 };
927 
928 /* 6: I/O Sapic */
929 
930 struct acpi_madt_io_sapic {
931 	struct acpi_subtable_header header;
932 	u8 id;			/* I/O SAPIC ID */
933 	u8 reserved;		/* Reserved, must be zero */
934 	u32 global_irq_base;	/* Global interrupt for SAPIC start */
935 	u64 address;		/* SAPIC physical address */
936 };
937 
938 /* 7: Local Sapic */
939 
940 struct acpi_madt_local_sapic {
941 	struct acpi_subtable_header header;
942 	u8 processor_id;	/* ACPI processor id */
943 	u8 id;			/* SAPIC ID */
944 	u8 eid;			/* SAPIC EID */
945 	u8 reserved[3];		/* Reserved, must be zero */
946 	u32 lapic_flags;
947 	u32 uid;		/* Numeric UID - ACPI 3.0 */
948 	char uid_string[1];	/* String UID  - ACPI 3.0 */
949 };
950 
951 /* 8: Platform Interrupt Source */
952 
953 struct acpi_madt_interrupt_source {
954 	struct acpi_subtable_header header;
955 	u16 inti_flags;
956 	u8 type;		/* 1=PMI, 2=INIT, 3=corrected */
957 	u8 id;			/* Processor ID */
958 	u8 eid;			/* Processor EID */
959 	u8 io_sapic_vector;	/* Vector value for PMI interrupts */
960 	u32 global_irq;		/* Global system interrupt */
961 	u32 flags;		/* Interrupt Source Flags */
962 };
963 
964 /* Masks for Flags field above */
965 
966 #define ACPI_MADT_CPEI_OVERRIDE     (1)
967 
968 /* 9: Processor Local X2APIC (ACPI 4.0) */
969 
970 struct acpi_madt_local_x2apic {
971 	struct acpi_subtable_header header;
972 	u16 reserved;		/* reserved - must be zero */
973 	u32 local_apic_id;	/* Processor x2APIC ID  */
974 	u32 lapic_flags;
975 	u32 uid;		/* ACPI processor UID */
976 };
977 
978 /* 10: Local X2APIC NMI (ACPI 4.0) */
979 
980 struct acpi_madt_local_x2apic_nmi {
981 	struct acpi_subtable_header header;
982 	u16 inti_flags;
983 	u32 uid;		/* ACPI processor UID */
984 	u8 lint;		/* LINTn to which NMI is connected */
985 	u8 reserved[3];		/* reserved - must be zero */
986 };
987 
988 /* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */
989 
990 struct acpi_madt_generic_interrupt {
991 	struct acpi_subtable_header header;
992 	u16 reserved;		/* reserved - must be zero */
993 	u32 cpu_interface_number;
994 	u32 uid;
995 	u32 flags;
996 	u32 parking_version;
997 	u32 performance_interrupt;
998 	u64 parked_address;
999 	u64 base_address;
1000 	u64 gicv_base_address;
1001 	u64 gich_base_address;
1002 	u32 vgic_interrupt;
1003 	u64 gicr_base_address;
1004 	u64 arm_mpidr;
1005 	u8 efficiency_class;
1006 	u8 reserved2[3];
1007 };
1008 
1009 /* Masks for Flags field above */
1010 
1011 /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
1012 #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)	/* 01: Performance Interrupt Mode */
1013 #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)	/* 02: VGIC Maintenance Interrupt mode */
1014 
1015 /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
1016 
1017 struct acpi_madt_generic_distributor {
1018 	struct acpi_subtable_header header;
1019 	u16 reserved;		/* reserved - must be zero */
1020 	u32 gic_id;
1021 	u64 base_address;
1022 	u32 global_irq_base;
1023 	u8 version;
1024 	u8 reserved2[3];	/* reserved - must be zero */
1025 };
1026 
1027 /* Values for Version field above */
1028 
1029 enum acpi_madt_gic_version {
1030 	ACPI_MADT_GIC_VERSION_NONE = 0,
1031 	ACPI_MADT_GIC_VERSION_V1 = 1,
1032 	ACPI_MADT_GIC_VERSION_V2 = 2,
1033 	ACPI_MADT_GIC_VERSION_V3 = 3,
1034 	ACPI_MADT_GIC_VERSION_V4 = 4,
1035 	ACPI_MADT_GIC_VERSION_RESERVED = 5	/* 5 and greater are reserved */
1036 };
1037 
1038 /* 13: Generic MSI Frame (ACPI 5.1) */
1039 
1040 struct acpi_madt_generic_msi_frame {
1041 	struct acpi_subtable_header header;
1042 	u16 reserved;		/* reserved - must be zero */
1043 	u32 msi_frame_id;
1044 	u64 base_address;
1045 	u32 flags;
1046 	u16 spi_count;
1047 	u16 spi_base;
1048 };
1049 
1050 /* Masks for Flags field above */
1051 
1052 #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
1053 
1054 /* 14: Generic Redistributor (ACPI 5.1) */
1055 
1056 struct acpi_madt_generic_redistributor {
1057 	struct acpi_subtable_header header;
1058 	u16 reserved;		/* reserved - must be zero */
1059 	u64 base_address;
1060 	u32 length;
1061 };
1062 
1063 /* 15: Generic Translator (ACPI 6.0) */
1064 
1065 struct acpi_madt_generic_translator {
1066 	struct acpi_subtable_header header;
1067 	u16 reserved;		/* reserved - must be zero */
1068 	u32 translation_id;
1069 	u64 base_address;
1070 	u32 reserved2;
1071 };
1072 
1073 /*
1074  * Common flags fields for MADT subtables
1075  */
1076 
1077 /* MADT Local APIC flags */
1078 
1079 #define ACPI_MADT_ENABLED           (1)	/* 00: Processor is usable if set */
1080 
1081 /* MADT MPS INTI flags (inti_flags) */
1082 
1083 #define ACPI_MADT_POLARITY_MASK     (3)	/* 00-01: Polarity of APIC I/O input signals */
1084 #define ACPI_MADT_TRIGGER_MASK      (3<<2)	/* 02-03: Trigger mode of APIC input signals */
1085 
1086 /* Values for MPS INTI flags */
1087 
1088 #define ACPI_MADT_POLARITY_CONFORMS       0
1089 #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
1090 #define ACPI_MADT_POLARITY_RESERVED       2
1091 #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
1092 
1093 #define ACPI_MADT_TRIGGER_CONFORMS        (0)
1094 #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
1095 #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
1096 #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
1097 
1098 /*******************************************************************************
1099  *
1100  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
1101  *        Version 1
1102  *
1103  ******************************************************************************/
1104 
1105 struct acpi_table_msct {
1106 	struct acpi_table_header header;	/* Common ACPI table header */
1107 	u32 proximity_offset;	/* Location of proximity info struct(s) */
1108 	u32 max_proximity_domains;	/* Max number of proximity domains */
1109 	u32 max_clock_domains;	/* Max number of clock domains */
1110 	u64 max_address;	/* Max physical address in system */
1111 };
1112 
1113 /* subtable - Maximum Proximity Domain Information. Version 1 */
1114 
1115 struct acpi_msct_proximity {
1116 	u8 revision;
1117 	u8 length;
1118 	u32 range_start;	/* Start of domain range */
1119 	u32 range_end;		/* End of domain range */
1120 	u32 processor_capacity;
1121 	u64 memory_capacity;	/* In bytes */
1122 };
1123 
1124 /*******************************************************************************
1125  *
1126  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
1127  *        Version 1
1128  *
1129  ******************************************************************************/
1130 
1131 struct acpi_table_nfit {
1132 	struct acpi_table_header header;	/* Common ACPI table header */
1133 	u32 reserved;		/* Reserved, must be zero */
1134 };
1135 
1136 /* Subtable header for NFIT */
1137 
1138 struct acpi_nfit_header {
1139 	u16 type;
1140 	u16 length;
1141 };
1142 
1143 /* Values for subtable type in struct acpi_nfit_header */
1144 
1145 enum acpi_nfit_type {
1146 	ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
1147 	ACPI_NFIT_TYPE_MEMORY_MAP = 1,
1148 	ACPI_NFIT_TYPE_INTERLEAVE = 2,
1149 	ACPI_NFIT_TYPE_SMBIOS = 3,
1150 	ACPI_NFIT_TYPE_CONTROL_REGION = 4,
1151 	ACPI_NFIT_TYPE_DATA_REGION = 5,
1152 	ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
1153 	ACPI_NFIT_TYPE_CAPABILITIES = 7,
1154 	ACPI_NFIT_TYPE_RESERVED = 8	/* 8 and greater are reserved */
1155 };
1156 
1157 /*
1158  * NFIT Subtables
1159  */
1160 
1161 /* 0: System Physical Address Range Structure */
1162 
1163 struct acpi_nfit_system_address {
1164 	struct acpi_nfit_header header;
1165 	u16 range_index;
1166 	u16 flags;
1167 	u32 reserved;		/* Reserved, must be zero */
1168 	u32 proximity_domain;
1169 	u8 range_guid[16];
1170 	u64 address;
1171 	u64 length;
1172 	u64 memory_mapping;
1173 };
1174 
1175 /* Flags */
1176 
1177 #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)	/* 00: Add/Online Operation Only */
1178 #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)	/* 01: Proximity Domain Valid */
1179 
1180 /* Range Type GUIDs appear in the include/acuuid.h file */
1181 
1182 /* 1: Memory Device to System Address Range Map Structure */
1183 
1184 struct acpi_nfit_memory_map {
1185 	struct acpi_nfit_header header;
1186 	u32 device_handle;
1187 	u16 physical_id;
1188 	u16 region_id;
1189 	u16 range_index;
1190 	u16 region_index;
1191 	u64 region_size;
1192 	u64 region_offset;
1193 	u64 address;
1194 	u16 interleave_index;
1195 	u16 interleave_ways;
1196 	u16 flags;
1197 	u16 reserved;		/* Reserved, must be zero */
1198 };
1199 
1200 /* Flags */
1201 
1202 #define ACPI_NFIT_MEM_SAVE_FAILED       (1)	/* 00: Last SAVE to Memory Device failed */
1203 #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)	/* 01: Last RESTORE from Memory Device failed */
1204 #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)	/* 02: Platform flush failed */
1205 #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)	/* 03: Memory Device is not armed */
1206 #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)	/* 04: Memory Device observed SMART/health events */
1207 #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)	/* 05: SMART/health events enabled */
1208 #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)	/* 06: Mapping to SPA failed */
1209 
1210 /* 2: Interleave Structure */
1211 
1212 struct acpi_nfit_interleave {
1213 	struct acpi_nfit_header header;
1214 	u16 interleave_index;
1215 	u16 reserved;		/* Reserved, must be zero */
1216 	u32 line_count;
1217 	u32 line_size;
1218 	u32 line_offset[1];	/* Variable length */
1219 };
1220 
1221 /* 3: SMBIOS Management Information Structure */
1222 
1223 struct acpi_nfit_smbios {
1224 	struct acpi_nfit_header header;
1225 	u32 reserved;		/* Reserved, must be zero */
1226 	u8 data[1];		/* Variable length */
1227 };
1228 
1229 /* 4: NVDIMM Control Region Structure */
1230 
1231 struct acpi_nfit_control_region {
1232 	struct acpi_nfit_header header;
1233 	u16 region_index;
1234 	u16 vendor_id;
1235 	u16 device_id;
1236 	u16 revision_id;
1237 	u16 subsystem_vendor_id;
1238 	u16 subsystem_device_id;
1239 	u16 subsystem_revision_id;
1240 	u8 valid_fields;
1241 	u8 manufacturing_location;
1242 	u16 manufacturing_date;
1243 	u8 reserved[2];		/* Reserved, must be zero */
1244 	u32 serial_number;
1245 	u16 code;
1246 	u16 windows;
1247 	u64 window_size;
1248 	u64 command_offset;
1249 	u64 command_size;
1250 	u64 status_offset;
1251 	u64 status_size;
1252 	u16 flags;
1253 	u8 reserved1[6];	/* Reserved, must be zero */
1254 };
1255 
1256 /* Flags */
1257 
1258 #define ACPI_NFIT_CONTROL_BUFFERED          (1)	/* Block Data Windows implementation is buffered */
1259 
1260 /* valid_fields bits */
1261 
1262 #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)	/* Manufacturing fields are valid */
1263 
1264 /* 5: NVDIMM Block Data Window Region Structure */
1265 
1266 struct acpi_nfit_data_region {
1267 	struct acpi_nfit_header header;
1268 	u16 region_index;
1269 	u16 windows;
1270 	u64 offset;
1271 	u64 size;
1272 	u64 capacity;
1273 	u64 start_address;
1274 };
1275 
1276 /* 6: Flush Hint Address Structure */
1277 
1278 struct acpi_nfit_flush_address {
1279 	struct acpi_nfit_header header;
1280 	u32 device_handle;
1281 	u16 hint_count;
1282 	u8 reserved[6];		/* Reserved, must be zero */
1283 	u64 hint_address[1];	/* Variable length */
1284 };
1285 
1286 /* 7: Platform Capabilities Structure */
1287 
1288 struct acpi_nfit_capabilities {
1289 	struct acpi_nfit_header header;
1290 	u8 highest_capability;
1291 	u8 reserved[3];		/* Reserved, must be zero */
1292 	u32 capabilities;
1293 	u32 reserved2;
1294 };
1295 
1296 /* Capabilities Flags */
1297 
1298 #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)	/* 00: Cache Flush to NVDIMM capable */
1299 #define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)	/* 01: Memory Flush to NVDIMM capable */
1300 #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)	/* 02: Memory Mirroring capable */
1301 
1302 /*
1303  * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1304  */
1305 struct nfit_device_handle {
1306 	u32 handle;
1307 };
1308 
1309 /* Device handle construction and extraction macros */
1310 
1311 #define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
1312 #define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
1313 #define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
1314 #define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
1315 #define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
1316 
1317 #define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
1318 #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
1319 #define ACPI_NFIT_MEMORY_ID_OFFSET              8
1320 #define ACPI_NFIT_SOCKET_ID_OFFSET              12
1321 #define ACPI_NFIT_NODE_ID_OFFSET                16
1322 
1323 /* Macro to construct a NFIT/NVDIMM device handle */
1324 
1325 #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1326 	((dimm)                                         | \
1327 	((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
1328 	((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
1329 	((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
1330 	((node)    << ACPI_NFIT_NODE_ID_OFFSET))
1331 
1332 /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1333 
1334 #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1335 	((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1336 
1337 #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1338 	(((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1339 
1340 #define ACPI_NFIT_GET_MEMORY_ID(handle) \
1341 	(((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
1342 
1343 #define ACPI_NFIT_GET_SOCKET_ID(handle) \
1344 	(((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
1345 
1346 #define ACPI_NFIT_GET_NODE_ID(handle) \
1347 	(((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
1348 
1349 /*******************************************************************************
1350  *
1351  * PDTT - Platform Debug Trigger Table (ACPI 6.2)
1352  *        Version 0
1353  *
1354  ******************************************************************************/
1355 
1356 struct acpi_table_pdtt {
1357 	struct acpi_table_header header;	/* Common ACPI table header */
1358 	u8 trigger_count;
1359 	u8 reserved[3];
1360 	u32 array_offset;
1361 };
1362 
1363 /*
1364  * PDTT Communication Channel Identifier Structure.
1365  * The number of these structures is defined by trigger_count above,
1366  * starting at array_offset.
1367  */
1368 struct acpi_pdtt_channel {
1369 	u8 subchannel_id;
1370 	u8 flags;
1371 };
1372 
1373 /* Flags for above */
1374 
1375 #define ACPI_PDTT_RUNTIME_TRIGGER           (1)
1376 #define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
1377 
1378 /*******************************************************************************
1379  *
1380  * PPTT - Processor Properties Topology Table (ACPI 6.2)
1381  *        Version 1
1382  *
1383  ******************************************************************************/
1384 
1385 struct acpi_table_pptt {
1386 	struct acpi_table_header header;	/* Common ACPI table header */
1387 };
1388 
1389 /* Values for Type field above */
1390 
1391 enum acpi_pptt_type {
1392 	ACPI_PPTT_TYPE_PROCESSOR = 0,
1393 	ACPI_PPTT_TYPE_CACHE = 1,
1394 	ACPI_PPTT_TYPE_ID = 2,
1395 	ACPI_PPTT_TYPE_RESERVED = 3
1396 };
1397 
1398 /* 0: Processor Hierarchy Node Structure */
1399 
1400 struct acpi_pptt_processor {
1401 	struct acpi_subtable_header header;
1402 	u16 reserved;
1403 	u32 flags;
1404 	u32 parent;
1405 	u32 acpi_processor_id;
1406 	u32 number_of_priv_resources;
1407 };
1408 
1409 /* Flags */
1410 
1411 #define ACPI_PPTT_PHYSICAL_PACKAGE          (1)	/* Physical package */
1412 #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID   (2)	/* ACPI Processor ID valid */
1413 
1414 /* 1: Cache Type Structure */
1415 
1416 struct acpi_pptt_cache {
1417 	struct acpi_subtable_header header;
1418 	u16 reserved;
1419 	u32 flags;
1420 	u32 next_level_of_cache;
1421 	u32 size;
1422 	u32 number_of_sets;
1423 	u8 associativity;
1424 	u8 attributes;
1425 	u16 line_size;
1426 };
1427 
1428 /* Flags */
1429 
1430 #define ACPI_PPTT_SIZE_PROPERTY_VALID       (1)	/* Physical property valid */
1431 #define ACPI_PPTT_NUMBER_OF_SETS_VALID      (1<<1)	/* Number of sets valid */
1432 #define ACPI_PPTT_ASSOCIATIVITY_VALID       (1<<2)	/* Associativity valid */
1433 #define ACPI_PPTT_ALLOCATION_TYPE_VALID     (1<<3)	/* Allocation type valid */
1434 #define ACPI_PPTT_CACHE_TYPE_VALID          (1<<4)	/* Cache type valid */
1435 #define ACPI_PPTT_WRITE_POLICY_VALID        (1<<5)	/* Write policy valid */
1436 #define ACPI_PPTT_LINE_SIZE_VALID           (1<<6)	/* Line size valid */
1437 
1438 /* Masks for Attributes */
1439 
1440 #define ACPI_PPTT_MASK_ALLOCATION_TYPE      (0x03)	/* Allocation type */
1441 #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)	/* Cache type */
1442 #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)	/* Write policy */
1443 
1444 /* Attributes describing cache */
1445 #define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)	/* Cache line is allocated on read */
1446 #define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)	/* Cache line is allocated on write */
1447 #define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)	/* Cache line is allocated on read and write */
1448 #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)	/* Alternate representation of above */
1449 
1450 #define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)	/* Data cache */
1451 #define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)	/* Instruction cache */
1452 #define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)	/* Unified I & D cache */
1453 #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)	/* Alternate representation of above */
1454 
1455 #define ACPI_PPTT_CACHE_POLICY_WB           (0x0)	/* Cache is write back */
1456 #define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)	/* Cache is write through */
1457 
1458 /* 2: ID Structure */
1459 
1460 struct acpi_pptt_id {
1461 	struct acpi_subtable_header header;
1462 	u16 reserved;
1463 	u32 vendor_id;
1464 	u64 level1_id;
1465 	u64 level2_id;
1466 	u16 major_rev;
1467 	u16 minor_rev;
1468 	u16 spin_rev;
1469 };
1470 
1471 /*******************************************************************************
1472  *
1473  * SBST - Smart Battery Specification Table
1474  *        Version 1
1475  *
1476  ******************************************************************************/
1477 
1478 struct acpi_table_sbst {
1479 	struct acpi_table_header header;	/* Common ACPI table header */
1480 	u32 warning_level;
1481 	u32 low_level;
1482 	u32 critical_level;
1483 };
1484 
1485 /*******************************************************************************
1486  *
1487  * SDEV - Secure Devices Table (ACPI 6.2)
1488  *        Version 1
1489  *
1490  ******************************************************************************/
1491 
1492 struct acpi_table_sdev {
1493 	struct acpi_table_header header;	/* Common ACPI table header */
1494 };
1495 
1496 struct acpi_sdev_header {
1497 	u8 type;
1498 	u8 flags;
1499 	u16 length;
1500 };
1501 
1502 /* Values for subtable type above */
1503 
1504 enum acpi_sdev_type {
1505 	ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
1506 	ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
1507 	ACPI_SDEV_TYPE_RESERVED = 2	/* 2 and greater are reserved */
1508 };
1509 
1510 /* Values for flags above */
1511 
1512 #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
1513 
1514 /*
1515  * SDEV subtables
1516  */
1517 
1518 /* 0: Namespace Device Based Secure Device Structure */
1519 
1520 struct acpi_sdev_namespace {
1521 	struct acpi_sdev_header header;
1522 	u16 device_id_offset;
1523 	u16 device_id_length;
1524 	u16 vendor_data_offset;
1525 	u16 vendor_data_length;
1526 };
1527 
1528 /* 1: PCIe Endpoint Device Based Device Structure */
1529 
1530 struct acpi_sdev_pcie {
1531 	struct acpi_sdev_header header;
1532 	u16 segment;
1533 	u16 start_bus;
1534 	u16 path_offset;
1535 	u16 path_length;
1536 	u16 vendor_data_offset;
1537 	u16 vendor_data_length;
1538 };
1539 
1540 /* 1a: PCIe Endpoint path entry */
1541 
1542 struct acpi_sdev_pcie_path {
1543 	u8 device;
1544 	u8 function;
1545 };
1546 
1547 /*******************************************************************************
1548  *
1549  * SLIT - System Locality Distance Information Table
1550  *        Version 1
1551  *
1552  ******************************************************************************/
1553 
1554 struct acpi_table_slit {
1555 	struct acpi_table_header header;	/* Common ACPI table header */
1556 	u64 locality_count;
1557 	u8 entry[1];		/* Real size = localities^2 */
1558 };
1559 
1560 /*******************************************************************************
1561  *
1562  * SRAT - System Resource Affinity Table
1563  *        Version 3
1564  *
1565  ******************************************************************************/
1566 
1567 struct acpi_table_srat {
1568 	struct acpi_table_header header;	/* Common ACPI table header */
1569 	u32 table_revision;	/* Must be value '1' */
1570 	u64 reserved;		/* Reserved, must be zero */
1571 };
1572 
1573 /* Values for subtable type in struct acpi_subtable_header */
1574 
1575 enum acpi_srat_type {
1576 	ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
1577 	ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
1578 	ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2,
1579 	ACPI_SRAT_TYPE_GICC_AFFINITY = 3,
1580 	ACPI_SRAT_TYPE_GIC_ITS_AFFINITY = 4,	/* ACPI 6.2 */
1581 	ACPI_SRAT_TYPE_RESERVED = 5	/* 5 and greater are reserved */
1582 };
1583 
1584 /*
1585  * SRAT Subtables, correspond to Type in struct acpi_subtable_header
1586  */
1587 
1588 /* 0: Processor Local APIC/SAPIC Affinity */
1589 
1590 struct acpi_srat_cpu_affinity {
1591 	struct acpi_subtable_header header;
1592 	u8 proximity_domain_lo;
1593 	u8 apic_id;
1594 	u32 flags;
1595 	u8 local_sapic_eid;
1596 	u8 proximity_domain_hi[3];
1597 	u32 clock_domain;
1598 };
1599 
1600 /* Flags */
1601 
1602 #define ACPI_SRAT_CPU_USE_AFFINITY  (1)	/* 00: Use affinity structure */
1603 
1604 /* 1: Memory Affinity */
1605 
1606 struct acpi_srat_mem_affinity {
1607 	struct acpi_subtable_header header;
1608 	u32 proximity_domain;
1609 	u16 reserved;		/* Reserved, must be zero */
1610 	u64 base_address;
1611 	u64 length;
1612        u32 reserved1;
1613 	u32 flags;
1614        u64 reserved2;	       /* Reserved, must be zero */
1615 };
1616 
1617 /* Flags */
1618 
1619 #define ACPI_SRAT_MEM_ENABLED       (1)	/* 00: Use affinity structure */
1620 #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1)	/* 01: Memory region is hot pluggable */
1621 #define ACPI_SRAT_MEM_NON_VOLATILE  (1<<2)	/* 02: Memory region is non-volatile */
1622 
1623 /* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
1624 
1625 struct acpi_srat_x2apic_cpu_affinity {
1626 	struct acpi_subtable_header header;
1627 	u16 reserved;		/* Reserved, must be zero */
1628 	u32 proximity_domain;
1629 	u32 apic_id;
1630 	u32 flags;
1631 	u32 clock_domain;
1632 	u32 reserved2;
1633 };
1634 
1635 /* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */
1636 
1637 #define ACPI_SRAT_CPU_ENABLED       (1)	/* 00: Use affinity structure */
1638 
1639 /* 3: GICC Affinity (ACPI 5.1) */
1640 
1641 struct acpi_srat_gicc_affinity {
1642 	struct acpi_subtable_header header;
1643 	u32 proximity_domain;
1644 	u32 acpi_processor_uid;
1645 	u32 flags;
1646 	u32 clock_domain;
1647 };
1648 
1649 /* Flags for struct acpi_srat_gicc_affinity */
1650 
1651 #define ACPI_SRAT_GICC_ENABLED     (1)	/* 00: Use affinity structure */
1652 
1653 /* 4: GCC ITS Affinity (ACPI 6.2) */
1654 
1655 struct acpi_srat_gic_its_affinity {
1656 	struct acpi_subtable_header header;
1657 	u32 proximity_domain;
1658 	u16 reserved;
1659 	u32 its_id;
1660 };
1661 
1662 /* Reset to default packing */
1663 
1664 #pragma pack()
1665 
1666 #endif				/* __ACTBL1_H__ */
1667