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