xref: /linux/include/acpi/actbl2.h (revision 486b257357c23743d9729ea715136d105fff461e)
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
3  *
4  * Name: actbl2.h - ACPI Table Definitions
5  *
6  * Copyright (C) 2000 - 2026, Intel Corp.
7  *
8  *****************************************************************************/
9 
10 #ifndef __ACTBL2_H__
11 #define __ACTBL2_H__
12 
13 /*******************************************************************************
14  *
15  * Additional ACPI Tables (2)
16  *
17  * These tables are not consumed directly by the ACPICA subsystem, but are
18  * included here to support device drivers and the AML disassembler.
19  *
20  ******************************************************************************/
21 
22 /*
23  * Values for description table header signatures for tables defined in this
24  * file. Useful because they make it more difficult to inadvertently type in
25  * the wrong signature.
26  */
27 #define ACPI_SIG_AGDI           "AGDI"	/* Arm Generic Diagnostic Dump and Reset Device Interface */
28 #define ACPI_SIG_APMT           "APMT"	/* Arm Performance Monitoring Unit table */
29 #define ACPI_SIG_BDAT           "BDAT"	/* BIOS Data ACPI Table */
30 #define ACPI_SIG_CCEL           "CCEL"	/* CC Event Log Table */
31 #define ACPI_SIG_CDAT           "CDAT"	/* Coherent Device Attribute Table */
32 #define ACPI_SIG_ERDT           "ERDT"	/* Enhanced Resource Director Technology */
33 #define ACPI_SIG_IORT           "IORT"	/* IO Remapping Table */
34 #define ACPI_SIG_IOVT           "IOVT"	/* I/O Virtualization Table */
35 #define ACPI_SIG_IVRS           "IVRS"	/* I/O Virtualization Reporting Structure */
36 #define ACPI_SIG_KEYP           "KEYP"	/* Key Programming Interface for IDE */
37 #define ACPI_SIG_LPIT           "LPIT"	/* Low Power Idle Table */
38 #define ACPI_SIG_MADT           "APIC"	/* Multiple APIC Description Table */
39 #define ACPI_SIG_MCFG           "MCFG"	/* PCI Memory Mapped Configuration table */
40 #define ACPI_SIG_MCHI           "MCHI"	/* Management Controller Host Interface table */
41 #define ACPI_SIG_MPAM           "MPAM"	/* Memory System Resource Partitioning and Monitoring Table */
42 #define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */
43 #define ACPI_SIG_MRRM           "MRRM"	/* Memory Range and Region Mapping table */
44 #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
45 #define ACPI_SIG_NFIT           "NFIT"	/* NVDIMM Firmware Interface Table */
46 #define ACPI_SIG_NHLT           "NHLT"	/* Non HD Audio Link Table */
47 #define ACPI_SIG_PCCT           "PCCT"	/* Platform Communications Channel Table */
48 #define ACPI_SIG_PDTT           "PDTT"	/* Platform Debug Trigger Table */
49 #define ACPI_SIG_PHAT           "PHAT"	/* Platform Health Assessment Table */
50 #define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
51 #define ACPI_SIG_PPTT           "PPTT"	/* Processor Properties Topology Table */
52 #define ACPI_SIG_PRMT           "PRMT"	/* Platform Runtime Mechanism Table */
53 #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
54 #define ACPI_SIG_RAS2           "RAS2"	/* RAS2 Feature table */
55 #define ACPI_SIG_RGRT           "RGRT"	/* Regulatory Graphics Resource Table */
56 #define ACPI_SIG_RHCT           "RHCT"	/* RISC-V Hart Capabilities Table */
57 #define ACPI_SIG_RIMT           "RIMT"	/* RISC-V IO Mapping Table */
58 #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */
59 #define ACPI_SIG_SDEI           "SDEI"	/* Software Delegated Exception Interface Table */
60 #define ACPI_SIG_SDEV           "SDEV"	/* Secure Devices table */
61 #define ACPI_SIG_SVKL           "SVKL"	/* Storage Volume Key Location Table */
62 #define ACPI_SIG_SWFT           "SWFT"	/* SoundWire File Table */
63 #define ACPI_SIG_TDEL           "TDEL"	/* TD Event Log Table */
64 
65 /*
66  * All tables must be byte-packed to match the ACPI specification, since
67  * the tables are provided by the system BIOS.
68  */
69 #pragma pack(1)
70 
71 /*
72  * Note: C bitfields are not used for this reason:
73  *
74  * "Bitfields are great and easy to read, but unfortunately the C language
75  * does not specify the layout of bitfields in memory, which means they are
76  * essentially useless for dealing with packed data in on-disk formats or
77  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
78  * this decision was a design error in C. Ritchie could have picked an order
79  * and stuck with it." Norman Ramsey.
80  * See http://stackoverflow.com/a/1053662/41661
81  */
82 
83 /*******************************************************************************
84  *
85  * AEST - Arm Error Source Table
86  *
87  * Conforms to: ACPI for the Armv8 RAS Extensions 1.1(Sep 2020) and
88  * 2.0(May 2023) Platform Design Document.
89  *
90  ******************************************************************************/
91 
92 struct acpi_table_aest {
93 	struct acpi_table_header header;
94 };
95 
96 /* Common Subtable header - one per Node Structure (Subtable) */
97 
98 struct acpi_aest_hdr {
99 	u8 type;
100 	u16 length;
101 	u8 reserved;
102 	u32 node_specific_offset;
103 	u32 node_interface_offset;
104 	u32 node_interrupt_offset;
105 	u32 node_interrupt_count;
106 	u64 timestamp_rate;
107 	u64 reserved1;
108 	u64 error_injection_rate;
109 };
110 
111 /* Values for Type above */
112 
113 #define ACPI_AEST_PROCESSOR_ERROR_NODE      0
114 #define ACPI_AEST_MEMORY_ERROR_NODE         1
115 #define ACPI_AEST_SMMU_ERROR_NODE           2
116 #define ACPI_AEST_VENDOR_ERROR_NODE         3
117 #define ACPI_AEST_GIC_ERROR_NODE            4
118 #define ACPI_AEST_PCIE_ERROR_NODE           5
119 #define ACPI_AEST_PROXY_ERROR_NODE          6
120 #define ACPI_AEST_NODE_TYPE_RESERVED        7 /* 7 and above are reserved */
121 
122 /*
123  * AEST subtables (Error nodes)
124  */
125 
126 /* 0: Processor Error */
127 
128 typedef struct acpi_aest_processor {
129 	u32 processor_id;
130 	u8 resource_type;
131 	u8 reserved;
132 	u8 flags;
133 	u8 revision;
134 	u64 processor_affinity;
135 
136 } acpi_aest_processor;
137 
138 /* Values for resource_type above, related structs below */
139 
140 #define ACPI_AEST_CACHE_RESOURCE            0
141 #define ACPI_AEST_TLB_RESOURCE              1
142 #define ACPI_AEST_GENERIC_RESOURCE          2
143 #define ACPI_AEST_RESOURCE_RESERVED         3	/* 3 and above are reserved */
144 
145 /* 0R: Processor Cache Resource Substructure */
146 
147 typedef struct acpi_aest_processor_cache {
148 	u32 cache_reference;
149 	u32 reserved;
150 
151 } acpi_aest_processor_cache;
152 
153 /* Values for cache_type above */
154 
155 #define ACPI_AEST_CACHE_DATA                0
156 #define ACPI_AEST_CACHE_INSTRUCTION         1
157 #define ACPI_AEST_CACHE_UNIFIED             2
158 #define ACPI_AEST_CACHE_RESERVED            3	/* 3 and above are reserved */
159 
160 /* 1R: Processor TLB Resource Substructure */
161 
162 typedef struct acpi_aest_processor_tlb {
163 	u32 tlb_level;
164 	u32 reserved;
165 
166 } acpi_aest_processor_tlb;
167 
168 /* 2R: Processor Generic Resource Substructure */
169 
170 typedef struct acpi_aest_processor_generic {
171 	u32 resource;
172 
173 } acpi_aest_processor_generic;
174 
175 /* 1: Memory Error */
176 
177 typedef struct acpi_aest_memory {
178 	u32 srat_proximity_domain;
179 
180 } acpi_aest_memory;
181 
182 /* 2: Smmu Error */
183 
184 typedef struct acpi_aest_smmu {
185 	u32 iort_node_reference;
186 	u32 subcomponent_reference;
187 
188 } acpi_aest_smmu;
189 
190 /* 3: Vendor Defined */
191 
192 typedef struct acpi_aest_vendor {
193 	u32 acpi_hid;
194 	u32 acpi_uid;
195 	u8 vendor_specific_data[16];
196 
197 } acpi_aest_vendor;
198 
199 struct acpi_aest_vendor_v2 {
200 	char acpi_hid[8];
201 	u32 acpi_uid;
202 	u8 vendor_specific_data[16];
203 };
204 
205 /* 4: Gic Error */
206 
207 typedef struct acpi_aest_gic {
208 	u32 interface_type;
209 	u32 instance_id;
210 
211 } acpi_aest_gic;
212 
213 /* Values for interface_type above */
214 
215 #define ACPI_AEST_GIC_CPU                   0
216 #define ACPI_AEST_GIC_DISTRIBUTOR           1
217 #define ACPI_AEST_GIC_REDISTRIBUTOR         2
218 #define ACPI_AEST_GIC_ITS                   3
219 #define ACPI_AEST_GIC_RESERVED              4	/* 4 and above are reserved */
220 
221 /* 5: PCIe Error */
222 
223 struct acpi_aest_pcie {
224 	u32 iort_node_reference;
225 };
226 
227 /* 6: Proxy Error */
228 
229 struct acpi_aest_proxy {
230 	u64 node_address;
231 };
232 
233 /* Node Interface Structure */
234 
235 typedef struct acpi_aest_node_interface {
236 	u8 type;
237 	u8 reserved[3];
238 	u32 flags;
239 	u64 address;
240 	u32 error_record_index;
241 	u32 error_record_count;
242 	u64 error_record_implemented;
243 	u64 error_status_reporting;
244 	u64 addressing_mode;
245 
246 } acpi_aest_node_interface;
247 
248 /* Node Interface Structure V2 */
249 
250 struct acpi_aest_node_interface_header {
251 	u8 type;
252 	u8 group_format;
253 	u8 reserved[2];
254 	u32 flags;
255 	u64 address;
256 	u32 error_record_index;
257 	u32 error_record_count;
258 };
259 
260 #define ACPI_AEST_NODE_GROUP_FORMAT_4K          0
261 #define ACPI_AEST_NODE_GROUP_FORMAT_16K         1
262 #define ACPI_AEST_NODE_GROUP_FORMAT_64K         2
263 
264 struct acpi_aest_node_interface_common {
265 	u32 error_node_device;
266 	u32 processor_affinity;
267 	u64 error_group_register_base;
268 	u64 fault_inject_register_base;
269 	u64 interrupt_config_register_base;
270 };
271 
272 struct acpi_aest_node_interface_4k {
273 	u64 error_record_implemented;
274 	u64 error_status_reporting;
275 	u64 addressing_mode;
276 	struct acpi_aest_node_interface_common common;
277 };
278 
279 struct acpi_aest_node_interface_16k {
280 	u64 error_record_implemented[4];
281 	u64 error_status_reporting[4];
282 	u64 addressing_mode[4];
283 	struct acpi_aest_node_interface_common common;
284 };
285 
286 struct acpi_aest_node_interface_64k {
287 	u64 error_record_implemented[14];
288 	u64 error_status_reporting[14];
289 	u64 addressing_mode[14];
290 	struct acpi_aest_node_interface_common common;
291 };
292 
293 /* Values for Type field above */
294 
295 #define ACPI_AEST_NODE_SYSTEM_REGISTER			0
296 #define ACPI_AEST_NODE_MEMORY_MAPPED			1
297 #define ACPI_AEST_NODE_SINGLE_RECORD_MEMORY_MAPPED	2
298 #define ACPI_AEST_XFACE_RESERVED			3   /* 2 and above are reserved */
299 
300 /* Node Interrupt Structure */
301 
302 typedef struct acpi_aest_node_interrupt {
303 	u8 type;
304 	u8 reserved[2];
305 	u8 flags;
306 	u32 gsiv;
307 	u8 iort_id;
308 	u8 reserved1[3];
309 
310 } acpi_aest_node_interrupt;
311 
312 /* Node Interrupt Structure V2 */
313 
314 struct acpi_aest_node_interrupt_v2 {
315 	u8 type;
316 	u8 reserved[2];
317 	u8 flags;
318 	u32 gsiv;
319 	u8 reserved1[4];
320 };
321 
322 /* Values for Type field above */
323 
324 #define ACPI_AEST_NODE_FAULT_HANDLING       0
325 #define ACPI_AEST_NODE_ERROR_RECOVERY       1
326 #define ACPI_AEST_XRUPT_RESERVED            2	/* 2 and above are reserved */
327 
328 /*******************************************************************************
329  * AGDI - Arm Generic Diagnostic Dump and Reset Device Interface
330  *
331  * Conforms to "ACPI for Arm Components 1.1, Platform Design Document"
332  * ARM DEN0093 v1.1
333  *
334  ******************************************************************************/
335 struct acpi_table_agdi {
336 	struct acpi_table_header header;	/* Common ACPI table header */
337 	u8 flags;
338 	u8 reserved[3];
339 	u32 sdei_event;
340 	u32 gsiv;
341 };
342 
343 /* Mask for Flags field above */
344 
345 #define ACPI_AGDI_SIGNALING_MODE (1)
346 
347 /*******************************************************************************
348  *
349  * APMT - ARM Performance Monitoring Unit Table
350  *
351  * Conforms to:
352  * ARM Performance Monitoring Unit Architecture 1.0 Platform Design Document
353  * ARM DEN0117 v1.0 November 25, 2021
354  *
355  ******************************************************************************/
356 
357 struct acpi_table_apmt {
358 	struct acpi_table_header header;	/* Common ACPI table header */
359 };
360 
361 #define ACPI_APMT_NODE_ID_LENGTH                4
362 
363 /*
364  * APMT subtables
365  */
366 struct acpi_apmt_node {
367 	u16 length;
368 	u8 flags;
369 	u8 type;
370 	u32 id;
371 	u64 inst_primary;
372 	u32 inst_secondary;
373 	u64 base_address0;
374 	u64 base_address1;
375 	u32 ovflw_irq;
376 	u32 reserved;
377 	u32 ovflw_irq_flags;
378 	u32 proc_affinity;
379 	u32 impl_id;
380 };
381 
382 /* Masks for Flags field above */
383 
384 #define ACPI_APMT_FLAGS_DUAL_PAGE               (1<<0)
385 #define ACPI_APMT_FLAGS_AFFINITY                (1<<1)
386 #define ACPI_APMT_FLAGS_ATOMIC                  (1<<2)
387 
388 /* Values for Flags dual page field above */
389 
390 #define ACPI_APMT_FLAGS_DUAL_PAGE_NSUPP         (0<<0)
391 #define ACPI_APMT_FLAGS_DUAL_PAGE_SUPP          (1<<0)
392 
393 /* Values for Flags processor affinity field above */
394 #define ACPI_APMT_FLAGS_AFFINITY_PROC           (0<<1)
395 #define ACPI_APMT_FLAGS_AFFINITY_PROC_CONTAINER (1<<1)
396 
397 /* Values for Flags 64-bit atomic field above */
398 #define ACPI_APMT_FLAGS_ATOMIC_NSUPP            (0<<2)
399 #define ACPI_APMT_FLAGS_ATOMIC_SUPP             (1<<2)
400 
401 /* Values for Type field above */
402 
403 enum acpi_apmt_node_type {
404 	ACPI_APMT_NODE_TYPE_MC = 0x00,
405 	ACPI_APMT_NODE_TYPE_SMMU = 0x01,
406 	ACPI_APMT_NODE_TYPE_PCIE_ROOT = 0x02,
407 	ACPI_APMT_NODE_TYPE_ACPI = 0x03,
408 	ACPI_APMT_NODE_TYPE_CACHE = 0x04,
409 	ACPI_APMT_NODE_TYPE_COUNT
410 };
411 
412 /* Masks for ovflw_irq_flags field above */
413 
414 #define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE          (1<<0)
415 #define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE          (1<<1)
416 
417 /* Values for ovflw_irq_flags mode field above */
418 
419 #define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_LEVEL    (0<<0)
420 #define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_EDGE     (1<<0)
421 
422 /* Values for ovflw_irq_flags type field above */
423 
424 #define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE_WIRED    (0<<1)
425 
426 /*******************************************************************************
427  *
428  * BDAT - BIOS Data ACPI Table
429  *
430  * Conforms to "BIOS Data ACPI Table", Interface Specification v4.0 Draft 5
431  * Nov 2020
432  *
433  ******************************************************************************/
434 
435 struct acpi_table_bdat {
436 	struct acpi_table_header header;
437 	struct acpi_generic_address gas;
438 };
439 
440 /*******************************************************************************
441  *
442  * CCEL - CC-Event Log
443  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
444  *        Trust Domain Extensions (Intel TDX)". Feb 2022
445  *
446  ******************************************************************************/
447 
448 struct acpi_table_ccel {
449 	struct acpi_table_header header;	/* Common ACPI table header */
450 	u8 CCtype;
451 	u8 Ccsub_type;
452 	u16 reserved;
453 	u64 log_area_minimum_length;
454 	u64 log_area_start_address;
455 };
456 
457 /*******************************************************************************
458  *
459  * ERDT - Enhanced Resource Director Technology (ERDT) table
460  *
461  * Conforms to "Intel Resource Director Technology Architecture Specification"
462  * Version 1.1, January 2025
463  *
464  ******************************************************************************/
465 
466 struct acpi_table_erdt {
467 	struct acpi_table_header header;	/* Common ACPI table header */
468 	u32 max_clos;		/* Maximum classes of service */
469 	u8 reserved[24];
470 	u8 erdt_substructures[];
471 };
472 
473 /* Values for subtable type in struct acpi_subtbl_hdr_16 */
474 
475 enum acpi_erdt_type {
476 	ACPI_ERDT_TYPE_RMDD = 0,
477 	ACPI_ERDT_TYPE_CACD = 1,
478 	ACPI_ERDT_TYPE_DACD = 2,
479 	ACPI_ERDT_TYPE_CMRC = 3,
480 	ACPI_ERDT_TYPE_MMRC = 4,
481 	ACPI_ERDT_TYPE_MARC = 5,
482 	ACPI_ERDT_TYPE_CARC = 6,
483 	ACPI_ERDT_TYPE_CMRD = 7,
484 	ACPI_ERDT_TYPE_IBRD = 8,
485 	ACPI_ERDT_TYPE_IBAD = 9,
486 	ACPI_ERDT_TYPE_CARD = 10,
487 	ACPI_ERDT_TYPE_RESERVED = 11	/* 11 and above are reserved */
488 };
489 
490 /*
491  * ERDT Subtables, correspond to Type in struct acpi_subtbl_hdr_16
492  */
493 
494 /* 0: RMDD - Resource Management Domain Description */
495 
496 struct acpi_erdt_rmdd {
497 	struct acpi_subtbl_hdr_16 header;
498 	u16 flags;
499 	u16 IO_l3_slices;	/* Number of slices in IO cache */
500 	u8 IO_l3_sets;		/* Number of sets in IO cache */
501 	u8 IO_l3_ways;		/* Number of ways in IO cache */
502 	u64 reserved;
503 	u16 domain_id;		/* Unique domain ID */
504 	u32 max_rmid;		/* Maximun RMID supported */
505 	u64 creg_base;		/* Control Register Base Address */
506 	u16 creg_size;		/* Control Register Size (4K pages) */
507 	u8 rmdd_structs[];
508 };
509 
510 /* 1: CACD - CPU Agent Collection Description */
511 
512 struct acpi_erdt_cacd {
513 	struct acpi_subtbl_hdr_16 header;
514 	u16 reserved;
515 	u16 domain_id;		/* Unique domain ID */
516 	u32 X2APICIDS[];
517 };
518 
519 /* 2: DACD - Device Agent Collection Description */
520 
521 struct acpi_erdt_dacd {
522 	struct acpi_subtbl_hdr_16 header;
523 	u16 reserved;
524 	u16 domain_id;		/* Unique domain ID */
525 	u8 dev_paths[];
526 };
527 
528 struct acpi_erdt_dacd_dev_paths {
529 	struct acpi_subtable_header header;
530 	u16 segment;
531 	u8 reserved;
532 	u8 start_bus;
533 	u8 path[];
534 };
535 
536 /* 3: CMRC - Cache Monitoring Registers for CPU Agents */
537 
538 struct acpi_erdt_cmrc {
539 	struct acpi_subtbl_hdr_16 header;
540 	u32 reserved1;
541 	u32 flags;
542 	u8 index_fn;
543 	u8 reserved2[11];
544 	u64 cmt_reg_base;
545 	u32 cmt_reg_size;
546 	u16 clump_size;
547 	u16 clump_stride;
548 	u64 up_scale;
549 };
550 
551 /* 4: MMRC - Memory-bandwidth Monitoring Registers for CPU Agents */
552 
553 struct acpi_erdt_mmrc {
554 	struct acpi_subtbl_hdr_16 header;
555 	u32 reserved1;
556 	u32 flags;
557 	u8 index_fn;
558 	u8 reserved2[11];
559 	u64 reg_base;
560 	u32 reg_size;
561 	u8 counter_width;
562 	u64 up_scale;
563 	u8 reserved3[7];
564 	u32 corr_factor_list_len;
565 	u32 corr_factor_list[];
566 };
567 
568 /* 5: MARC - Memory-bandwidth Allocation Registers for CPU Agents */
569 
570 struct acpi_erdt_marc {
571 	struct acpi_subtbl_hdr_16 header;
572 	u16 reserved1;
573 	u16 flags;
574 	u8 index_fn;
575 	u8 reserved2[7];
576 	u64 reg_base_opt;
577 	u64 reg_base_min;
578 	u64 reg_base_max;
579 	u32 mba_reg_size;
580 	u32 mba_ctrl_range;
581 };
582 
583 /* 6: CARC - Cache Allocation Registers for CPU Agents */
584 
585 struct acpi_erdt_carc {
586 	struct acpi_subtbl_hdr_16 header;
587 };
588 
589 /* 7: CMRD - Cache Monitoring Registers for Device Agents */
590 
591 struct acpi_erdt_cmrd {
592 	struct acpi_subtbl_hdr_16 header;
593 	u32 reserved1;
594 	u32 flags;
595 	u8 index_fn;
596 	u8 reserved2[11];
597 	u64 reg_base;
598 	u32 reg_size;
599 	u16 cmt_reg_off;
600 	u16 cmt_clump_size;
601 	u64 up_scale;
602 };
603 
604 /* 8: IBRD - Cache Monitoring Registers for Device Agents */
605 
606 struct acpi_erdt_ibrd {
607 	struct acpi_subtbl_hdr_16 header;
608 	u32 reserved1;
609 	u32 flags;
610 	u8 index_fn;
611 	u8 reserved2[11];
612 	u64 reg_base;
613 	u32 reg_size;
614 	u16 total_bw_offset;
615 	u16 Iomiss_bw_offset;
616 	u16 total_bw_clump;
617 	u16 Iomiss_bw_clump;
618 	u8 reserved3[7];
619 	u8 counter_width;
620 	u64 up_scale;
621 	u32 corr_factor_list_len;
622 	u32 corr_factor_list[];
623 };
624 
625 /* 9: IBAD - IO bandwidth Allocation Registers for device agents */
626 
627 struct acpi_erdt_ibad {
628 	struct acpi_subtbl_hdr_16 header;
629 };
630 
631 /* 10: CARD - IO bandwidth Allocation Registers for Device Agents */
632 
633 struct acpi_erdt_card {
634 	struct acpi_subtbl_hdr_16 header;
635 	u32 reserved1;
636 	u32 flags;
637 	u32 contention_mask;
638 	u8 index_fn;
639 	u8 reserved2[7];
640 	u64 reg_base;
641 	u32 reg_size;
642 	u16 cat_reg_offset;
643 	u16 cat_reg_block_size;
644 };
645 
646 /*******************************************************************************
647  *
648  * IORT - IO Remapping Table
649  *
650  * Conforms to "IO Remapping Table System Software on ARM Platforms",
651  * Document number: ARM DEN 0049E.f, Apr 2024
652  *
653  ******************************************************************************/
654 
655 struct acpi_table_iort {
656 	struct acpi_table_header header;
657 	u32 node_count;
658 	u32 node_offset;
659 	u32 reserved;
660 };
661 
662 /*
663  * IORT subtables
664  */
665 struct acpi_iort_node {
666 	u8 type;
667 	u16 length;
668 	u8 revision;
669 	u32 identifier;
670 	u32 mapping_count;
671 	u32 mapping_offset;
672 	char node_data[];
673 };
674 
675 /* Values for subtable Type above */
676 
677 enum acpi_iort_node_type {
678 	ACPI_IORT_NODE_ITS_GROUP = 0x00,
679 	ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
680 	ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
681 	ACPI_IORT_NODE_SMMU = 0x03,
682 	ACPI_IORT_NODE_SMMU_V3 = 0x04,
683 	ACPI_IORT_NODE_PMCG = 0x05,
684 	ACPI_IORT_NODE_RMR = 0x06,
685 	ACPI_IORT_NODE_IWB = 0x07,
686 };
687 
688 struct acpi_iort_id_mapping {
689 	u32 input_base;		/* Lowest value in input range */
690 	u32 id_count;		/* Number of IDs */
691 	u32 output_base;	/* Lowest value in output range */
692 	u32 output_reference;	/* A reference to the output node */
693 	u32 flags;
694 };
695 
696 /* Masks for Flags field above for IORT subtable */
697 
698 #define ACPI_IORT_ID_SINGLE_MAPPING (1)
699 
700 struct acpi_iort_memory_access {
701 	u32 cache_coherency;
702 	u8 hints;
703 	u16 reserved;
704 	u8 memory_flags;
705 };
706 
707 /* Values for cache_coherency field above */
708 
709 #define ACPI_IORT_NODE_COHERENT         0x00000001	/* The device node is fully coherent */
710 #define ACPI_IORT_NODE_NOT_COHERENT     0x00000000	/* The device node is not coherent */
711 
712 /* Masks for Hints field above */
713 
714 #define ACPI_IORT_HT_TRANSIENT          (1)
715 #define ACPI_IORT_HT_WRITE              (1<<1)
716 #define ACPI_IORT_HT_READ               (1<<2)
717 #define ACPI_IORT_HT_OVERRIDE           (1<<3)
718 
719 /* Masks for memory_flags field above */
720 
721 #define ACPI_IORT_MF_COHERENCY          (1)
722 #define ACPI_IORT_MF_ATTRIBUTES         (1<<1)
723 #define ACPI_IORT_MF_CANWBS             (1<<2)
724 
725 /*
726  * IORT node specific subtables
727  */
728 struct acpi_iort_its_group {
729 	u32 its_count;
730 	u32 identifiers[];	/* GIC ITS identifier array */
731 };
732 
733 struct acpi_iort_named_component {
734 	u32 node_flags;
735 	u64 memory_properties;	/* Memory access properties */
736 	u8 memory_address_limit;	/* Memory address size limit */
737 	char device_name[];	/* Path of namespace object */
738 };
739 
740 /* Masks for Flags field above */
741 
742 #define ACPI_IORT_NC_STALL_SUPPORTED    (1)
743 #define ACPI_IORT_NC_PASID_BITS         (31<<1)
744 
745 struct acpi_iort_root_complex {
746 	u64 memory_properties;	/* Memory access properties */
747 	u32 ats_attribute;
748 	u32 pci_segment_number;
749 	u8 memory_address_limit;	/* Memory address size limit */
750 	u16 pasid_capabilities;	/* PASID Capabilities */
751 	u8 reserved[];		/* Reserved, must be zero */
752 };
753 
754 /* Masks for ats_attribute field above */
755 
756 #define ACPI_IORT_ATS_SUPPORTED         (1)	/* The root complex ATS support */
757 #define ACPI_IORT_PRI_SUPPORTED         (1<<1)	/* The root complex PRI support */
758 #define ACPI_IORT_PASID_FWD_SUPPORTED   (1<<2)	/* The root complex PASID forward support */
759 
760 /* Masks for pasid_capabilities field above */
761 #define ACPI_IORT_PASID_MAX_WIDTH       (0x1F)	/* Bits 0-4 */
762 
763 struct acpi_iort_smmu {
764 	u64 base_address;	/* SMMU base address */
765 	u64 span;		/* Length of memory range */
766 	u32 model;
767 	u32 flags;
768 	u32 global_interrupt_offset;
769 	u32 context_interrupt_count;
770 	u32 context_interrupt_offset;
771 	u32 pmu_interrupt_count;
772 	u32 pmu_interrupt_offset;
773 	u64 interrupts[];	/* Interrupt array */
774 };
775 
776 /* Values for Model field above */
777 
778 #define ACPI_IORT_SMMU_V1               0x00000000	/* Generic SMMUv1 */
779 #define ACPI_IORT_SMMU_V2               0x00000001	/* Generic SMMUv2 */
780 #define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002	/* ARM Corelink MMU-400 */
781 #define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003	/* ARM Corelink MMU-500 */
782 #define ACPI_IORT_SMMU_CORELINK_MMU401  0x00000004	/* ARM Corelink MMU-401 */
783 #define ACPI_IORT_SMMU_CAVIUM_THUNDERX  0x00000005	/* Cavium thunder_x SMMUv2 */
784 
785 /* Masks for Flags field above */
786 
787 #define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
788 #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
789 
790 /* Global interrupt format */
791 
792 struct acpi_iort_smmu_gsi {
793 	u32 nsg_irpt;
794 	u32 nsg_irpt_flags;
795 	u32 nsg_cfg_irpt;
796 	u32 nsg_cfg_irpt_flags;
797 };
798 
799 struct acpi_iort_smmu_v3 {
800 	u64 base_address;	/* SMMUv3 base address */
801 	u32 flags;
802 	u32 reserved;
803 	u64 vatos_address;
804 	u32 model;
805 	u32 event_gsiv;
806 	u32 pri_gsiv;
807 	u32 gerr_gsiv;
808 	u32 sync_gsiv;
809 	u32 pxm;
810 	u32 id_mapping_index;
811 };
812 
813 /* Values for Model field above */
814 
815 #define ACPI_IORT_SMMU_V3_GENERIC           0x00000000	/* Generic SMMUv3 */
816 #define ACPI_IORT_SMMU_V3_HISILICON_HI161X  0x00000001	/* hi_silicon Hi161x SMMUv3 */
817 #define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX     0x00000002	/* Cavium CN99xx SMMUv3 */
818 
819 /* Masks for Flags field above */
820 
821 #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
822 #define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE     (3<<1)
823 #define ACPI_IORT_SMMU_V3_PXM_VALID         (1<<3)
824 #define ACPI_IORT_SMMU_V3_DEVICEID_VALID    (1<<4)
825 
826 struct acpi_iort_pmcg {
827 	u64 page0_base_address;
828 	u32 overflow_gsiv;
829 	u32 node_reference;
830 	u64 page1_base_address;
831 };
832 
833 struct acpi_iort_rmr {
834 	u32 flags;
835 	u32 rmr_count;
836 	u32 rmr_offset;
837 };
838 
839 /* Masks for Flags field above */
840 #define ACPI_IORT_RMR_REMAP_PERMITTED      (1)
841 #define ACPI_IORT_RMR_ACCESS_PRIVILEGE     (1<<1)
842 
843 /*
844  * Macro to access the Access Attributes in flags field above:
845  *  Access Attributes is encoded in bits 9:2
846  */
847 #define ACPI_IORT_RMR_ACCESS_ATTRIBUTES(flags)          (((flags) >> 2) & 0xFF)
848 
849 /* Values for above Access Attributes */
850 
851 #define ACPI_IORT_RMR_ATTR_DEVICE_NGNRNE   0x00
852 #define ACPI_IORT_RMR_ATTR_DEVICE_NGNRE    0x01
853 #define ACPI_IORT_RMR_ATTR_DEVICE_NGRE     0x02
854 #define ACPI_IORT_RMR_ATTR_DEVICE_GRE      0x03
855 #define ACPI_IORT_RMR_ATTR_NORMAL_NC       0x04
856 #define ACPI_IORT_RMR_ATTR_NORMAL_IWB_OWB  0x05
857 
858 struct acpi_iort_rmr_desc {
859 	u64 base_address;
860 	u64 length;
861 	u32 reserved;
862 };
863 
864 struct acpi_iort_iwb {
865 	u64 base_address;
866 	u16 iwb_index;		/* Unique IWB identifier matching with the IWB GSI namespace. */
867 	char device_name[];	/* Path of the IWB namespace object */
868 };
869 
870 /*******************************************************************************
871  *
872  * IOVT - I/O Virtualization Table
873  *
874  * Conforms to "LoongArch I/O Virtualization Table",
875  *        Version 0.1, October 2024
876  *
877  ******************************************************************************/
878 
879 struct acpi_table_iovt {
880 	struct acpi_table_header header;	/* Common ACPI table header */
881 	u16 iommu_count;
882 	u16 iommu_offset;
883 	u8 reserved[8];
884 };
885 
886 /* IOVT subtable header */
887 
888 struct acpi_iovt_header {
889 	u16 type;
890 	u16 length;
891 };
892 
893 /* Values for Type field above */
894 
895 enum acpi_iovt_iommu_type {
896 	ACPI_IOVT_IOMMU_V1 = 0x00,
897 	ACPI_IOVT_IOMMU_RESERVED = 0x01	/* 1 and greater are reserved */
898 };
899 
900 /* IOVT subtables */
901 
902 struct acpi_iovt_iommu {
903 	struct acpi_iovt_header header;
904 	u32 flags;
905 	u16 segment;
906 	u16 phy_width;		/* Physical Address Width */
907 	u16 virt_width;		/* Virtual Address Width */
908 	u16 max_page_level;
909 	u64 page_size;
910 	u32 device_id;
911 	u64 base_address;
912 	u32 address_space_size;
913 	u8 interrupt_type;
914 	u8 reserved[3];
915 	u32 gsi_number;
916 	u32 proximity_domain;
917 	u32 max_device_num;
918 	u32 device_entry_num;
919 	u32 device_entry_offset;
920 };
921 
922 /* Masks for Flags field above */
923 #define ACPI_IOVT_IOMMU_PCI_DEVICE		(1<<0)
924 #define ACPI_IOVT_IOMMU_PXM_VALID		(1<<1)
925 #define ACPI_IOVT_IOMMU_MAGAGE_BY_SEGMENT	(1<<2)
926 #define ACPI_IOVT_IOMMU_HW_CAP_SUPPORT		(1<<3)
927 #define ACPI_IOVT_IOMMU_MSI_INT_BYPASS		(1<<4)
928 
929 struct acpi_iovt_device_entry {
930 	u8 type;
931 	u8 length;
932 	u8 flags;
933 	u8 reserved[3];
934 	u16 device_id;
935 };
936 
937 enum acpi_iovt_device_entry_type {
938 	ACPI_IOVT_DEVICE_ENTRY_SINGLE = 0x00,
939 	ACPI_IOVT_DEVICE_ENTRY_START = 0x01,
940 	ACPI_IOVT_DEVICE_ENTRY_END = 0x02,
941 	ACPI_IOVT_DEVICE_ENTRY_RESERVED = 0x03	/* 3 and greater are reserved */
942 };
943 
944 /*******************************************************************************
945  *
946  * IVRS - I/O Virtualization Reporting Structure
947  *        Version 1
948  *
949  * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
950  * Revision 1.26, February 2009.
951  *
952  ******************************************************************************/
953 
954 struct acpi_table_ivrs {
955 	struct acpi_table_header header;	/* Common ACPI table header */
956 	u32 info;		/* Common virtualization info */
957 	u64 reserved;
958 };
959 
960 /* Values for Info field above */
961 
962 #define ACPI_IVRS_PHYSICAL_SIZE     0x00007F00	/* 7 bits, physical address size */
963 #define ACPI_IVRS_VIRTUAL_SIZE      0x003F8000	/* 7 bits, virtual address size */
964 #define ACPI_IVRS_ATS_RESERVED      0x00400000	/* ATS address translation range reserved */
965 
966 /* IVRS subtable header */
967 
968 struct acpi_ivrs_header {
969 	u8 type;		/* Subtable type */
970 	u8 flags;
971 	u16 length;		/* Subtable length */
972 	u16 device_id;		/* ID of IOMMU */
973 };
974 
975 /* Values for subtable Type above */
976 
977 enum acpi_ivrs_type {
978 	ACPI_IVRS_TYPE_HARDWARE1 = 0x10,
979 	ACPI_IVRS_TYPE_HARDWARE2 = 0x11,
980 	ACPI_IVRS_TYPE_HARDWARE3 = 0x40,
981 	ACPI_IVRS_TYPE_MEMORY1 = 0x20,
982 	ACPI_IVRS_TYPE_MEMORY2 = 0x21,
983 	ACPI_IVRS_TYPE_MEMORY3 = 0x22
984 };
985 
986 /* Masks for Flags field above for IVHD subtable */
987 
988 #define ACPI_IVHD_TT_ENABLE         (1)
989 #define ACPI_IVHD_PASS_PW           (1<<1)
990 #define ACPI_IVHD_RES_PASS_PW       (1<<2)
991 #define ACPI_IVHD_ISOC              (1<<3)
992 #define ACPI_IVHD_IOTLB             (1<<4)
993 
994 /* Masks for Flags field above for IVMD subtable */
995 
996 #define ACPI_IVMD_UNITY             (1)
997 #define ACPI_IVMD_READ              (1<<1)
998 #define ACPI_IVMD_WRITE             (1<<2)
999 #define ACPI_IVMD_EXCLUSION_RANGE   (1<<3)
1000 
1001 /*
1002  * IVRS subtables, correspond to Type in struct acpi_ivrs_header
1003  */
1004 
1005 /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
1006 
1007 struct acpi_ivrs_hardware_10 {
1008 	struct acpi_ivrs_header header;
1009 	u16 capability_offset;	/* Offset for IOMMU control fields */
1010 	u64 base_address;	/* IOMMU control registers */
1011 	u16 pci_segment_group;
1012 	u16 info;		/* MSI number and unit ID */
1013 	u32 feature_reporting;
1014 };
1015 
1016 /* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */
1017 
1018 struct acpi_ivrs_hardware_11 {
1019 	struct acpi_ivrs_header header;
1020 	u16 capability_offset;	/* Offset for IOMMU control fields */
1021 	u64 base_address;	/* IOMMU control registers */
1022 	u16 pci_segment_group;
1023 	u16 info;		/* MSI number and unit ID */
1024 	u32 attributes;
1025 	u64 efr_register_image;
1026 	u64 reserved;
1027 };
1028 
1029 /* Masks for Info field above */
1030 
1031 #define ACPI_IVHD_MSI_NUMBER_MASK   0x001F	/* 5 bits, MSI message number */
1032 #define ACPI_IVHD_UNIT_ID_MASK      0x1F00	/* 5 bits, unit_ID */
1033 
1034 /*
1035  * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
1036  * Upper two bits of the Type field are the (encoded) length of the structure.
1037  * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
1038  * are reserved for future use but not defined.
1039  */
1040 struct acpi_ivrs_de_header {
1041 	u8 type;
1042 	u16 id;
1043 	u8 data_setting;
1044 };
1045 
1046 /* Length of device entry is in the top two bits of Type field above */
1047 
1048 #define ACPI_IVHD_ENTRY_LENGTH      0xC0
1049 
1050 /* Values for device entry Type field above */
1051 
1052 enum acpi_ivrs_device_entry_type {
1053 	/* 4-byte device entries, all use struct acpi_ivrs_device4 */
1054 
1055 	ACPI_IVRS_TYPE_PAD4 = 0,
1056 	ACPI_IVRS_TYPE_ALL = 1,
1057 	ACPI_IVRS_TYPE_SELECT = 2,
1058 	ACPI_IVRS_TYPE_START = 3,
1059 	ACPI_IVRS_TYPE_END = 4,
1060 
1061 	/* 8-byte device entries */
1062 
1063 	ACPI_IVRS_TYPE_PAD8 = 64,
1064 	ACPI_IVRS_TYPE_NOT_USED = 65,
1065 	ACPI_IVRS_TYPE_ALIAS_SELECT = 66,	/* Uses struct acpi_ivrs_device8a */
1066 	ACPI_IVRS_TYPE_ALIAS_START = 67,	/* Uses struct acpi_ivrs_device8a */
1067 	ACPI_IVRS_TYPE_EXT_SELECT = 70,	/* Uses struct acpi_ivrs_device8b */
1068 	ACPI_IVRS_TYPE_EXT_START = 71,	/* Uses struct acpi_ivrs_device8b */
1069 	ACPI_IVRS_TYPE_SPECIAL = 72,	/* Uses struct acpi_ivrs_device8c */
1070 
1071 	/* Variable-length device entries */
1072 
1073 	ACPI_IVRS_TYPE_HID = 240	/* Uses ACPI_IVRS_DEVICE_HID */
1074 };
1075 
1076 /* Values for Data field above */
1077 
1078 #define ACPI_IVHD_INIT_PASS         (1)
1079 #define ACPI_IVHD_EINT_PASS         (1<<1)
1080 #define ACPI_IVHD_NMI_PASS          (1<<2)
1081 #define ACPI_IVHD_SYSTEM_MGMT       (3<<4)
1082 #define ACPI_IVHD_LINT0_PASS        (1<<6)
1083 #define ACPI_IVHD_LINT1_PASS        (1<<7)
1084 
1085 /* Types 0-4: 4-byte device entry */
1086 
1087 struct acpi_ivrs_device4 {
1088 	struct acpi_ivrs_de_header header;
1089 };
1090 
1091 /* Types 66-67: 8-byte device entry */
1092 
1093 struct acpi_ivrs_device8a {
1094 	struct acpi_ivrs_de_header header;
1095 	u8 reserved1;
1096 	u16 used_id;
1097 	u8 reserved2;
1098 };
1099 
1100 /* Types 70-71: 8-byte device entry */
1101 
1102 struct acpi_ivrs_device8b {
1103 	struct acpi_ivrs_de_header header;
1104 	u32 extended_data;
1105 };
1106 
1107 /* Values for extended_data above */
1108 
1109 #define ACPI_IVHD_ATS_DISABLED      (1<<31)
1110 
1111 /* Type 72: 8-byte device entry */
1112 
1113 struct acpi_ivrs_device8c {
1114 	struct acpi_ivrs_de_header header;
1115 	u8 handle;
1116 	u16 used_id;
1117 	u8 variety;
1118 };
1119 
1120 /* Values for Variety field above */
1121 
1122 #define ACPI_IVHD_IOAPIC            1
1123 #define ACPI_IVHD_HPET              2
1124 
1125 /* Type 240: variable-length device entry */
1126 
1127 struct acpi_ivrs_device_hid {
1128 	struct acpi_ivrs_de_header header;
1129 	u64 acpi_hid;
1130 	u64 acpi_cid;
1131 	u8 uid_type;
1132 	u8 uid_length;
1133 };
1134 
1135 /* Values for uid_type above */
1136 
1137 #define ACPI_IVRS_UID_NOT_PRESENT   0
1138 #define ACPI_IVRS_UID_IS_INTEGER    1
1139 #define ACPI_IVRS_UID_IS_STRING     2
1140 
1141 /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
1142 
1143 struct acpi_ivrs_memory {
1144 	struct acpi_ivrs_header header;
1145 	u16 aux_data;
1146 	u64 reserved;
1147 	u64 start_address;
1148 	u64 memory_length;
1149 };
1150 
1151 /*******************************************************************************
1152  *
1153  * KEYP - Key Programming Interface for Root Complex Integrity and Data
1154  *        Encryption (IDE)
1155  *        Version 1
1156  *
1157  * Conforms to "Key Programming Interface for Root Complex Integrity and Data
1158  * Encryption (IDE)" document. See under ACPI-Related Documents.
1159  *
1160  ******************************************************************************/
1161 struct acpi_table_keyp {
1162 	struct acpi_table_header header;	/* Common ACPI table header */
1163 	u32 reserved;
1164 };
1165 
1166 /* KEYP common subtable header */
1167 
1168 struct acpi_keyp_common_header {
1169 	u8 type;
1170 	u8 reserved;
1171 	u16 length;
1172 };
1173 
1174 /* Values for Type field above */
1175 
1176 enum acpi_keyp_type {
1177 	ACPI_KEYP_TYPE_CONFIG_UNIT = 0,
1178 };
1179 
1180 /* Root Port Information Structure */
1181 
1182 struct acpi_keyp_rp_info {
1183 	u16 segment;
1184 	u8 bus;
1185 	u8 devfn;
1186 };
1187 
1188 /* Key Configuration Unit Structure */
1189 
1190 struct acpi_keyp_config_unit {
1191 	struct acpi_keyp_common_header header;
1192 	u8 protocol_type;
1193 	u8 version;
1194 	u8 root_port_count;
1195 	u8 flags;
1196 	u64 register_base_address;
1197 	struct acpi_keyp_rp_info rp_info[];
1198 };
1199 
1200 enum acpi_keyp_protocol_type {
1201 	ACPI_KEYP_PROTO_TYPE_INVALID = 0,
1202 	ACPI_KEYP_PROTO_TYPE_PCIE,
1203 	ACPI_KEYP_PROTO_TYPE_CXL,
1204 	ACPI_KEYP_PROTO_TYPE_RESERVED
1205 };
1206 
1207 #define ACPI_KEYP_F_TVM_USABLE      (1)
1208 
1209 /*******************************************************************************
1210  *
1211  * LPIT - Low Power Idle Table
1212  *
1213  * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
1214  *
1215  ******************************************************************************/
1216 
1217 struct acpi_table_lpit {
1218 	struct acpi_table_header header;	/* Common ACPI table header */
1219 };
1220 
1221 /* LPIT subtable header */
1222 
1223 struct acpi_lpit_header {
1224 	u32 type;		/* Subtable type */
1225 	u32 length;		/* Subtable length */
1226 	u16 unique_id;
1227 	u16 reserved;
1228 	u32 flags;
1229 };
1230 
1231 /* Values for subtable Type above */
1232 
1233 enum acpi_lpit_type {
1234 	ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
1235 	ACPI_LPIT_TYPE_RESERVED = 0x01	/* 1 and above are reserved */
1236 };
1237 
1238 /* Masks for Flags field above  */
1239 
1240 #define ACPI_LPIT_STATE_DISABLED    (1)
1241 #define ACPI_LPIT_NO_COUNTER        (1<<1)
1242 
1243 /*
1244  * LPIT subtables, correspond to Type in struct acpi_lpit_header
1245  */
1246 
1247 /* 0x00: Native C-state instruction based LPI structure */
1248 
1249 struct acpi_lpit_native {
1250 	struct acpi_lpit_header header;
1251 	struct acpi_generic_address entry_trigger;
1252 	u32 residency;
1253 	u32 latency;
1254 	struct acpi_generic_address residency_counter;
1255 	u64 counter_frequency;
1256 };
1257 
1258 /*******************************************************************************
1259  *
1260  * MADT - Multiple APIC Description Table
1261  *        Version 3
1262  *
1263  ******************************************************************************/
1264 
1265 struct acpi_table_madt {
1266 	struct acpi_table_header header;	/* Common ACPI table header */
1267 	u32 address;		/* Physical address of local APIC */
1268 	u32 flags;
1269 };
1270 
1271 /* Masks for Flags field above */
1272 
1273 #define ACPI_MADT_PCAT_COMPAT       (1)	/* 00: System also has dual 8259s */
1274 
1275 /* Values for PCATCompat flag */
1276 
1277 #define ACPI_MADT_DUAL_PIC          1
1278 #define ACPI_MADT_MULTIPLE_APIC     0
1279 
1280 /* Values for MADT subtable type in struct acpi_subtable_header */
1281 
1282 enum acpi_madt_type {
1283 	ACPI_MADT_TYPE_LOCAL_APIC = 0,
1284 	ACPI_MADT_TYPE_IO_APIC = 1,
1285 	ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
1286 	ACPI_MADT_TYPE_NMI_SOURCE = 3,
1287 	ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
1288 	ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
1289 	ACPI_MADT_TYPE_IO_SAPIC = 6,
1290 	ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
1291 	ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
1292 	ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
1293 	ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
1294 	ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
1295 	ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
1296 	ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
1297 	ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
1298 	ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
1299 	ACPI_MADT_TYPE_MULTIPROC_WAKEUP = 16,
1300 	ACPI_MADT_TYPE_CORE_PIC = 17,
1301 	ACPI_MADT_TYPE_LIO_PIC = 18,
1302 	ACPI_MADT_TYPE_HT_PIC = 19,
1303 	ACPI_MADT_TYPE_EIO_PIC = 20,
1304 	ACPI_MADT_TYPE_MSI_PIC = 21,
1305 	ACPI_MADT_TYPE_BIO_PIC = 22,
1306 	ACPI_MADT_TYPE_LPC_PIC = 23,
1307 	ACPI_MADT_TYPE_RINTC = 24,
1308 	ACPI_MADT_TYPE_IMSIC = 25,
1309 	ACPI_MADT_TYPE_APLIC = 26,
1310 	ACPI_MADT_TYPE_PLIC = 27,
1311 	ACPI_MADT_TYPE_GICV5_IRS = 28,
1312 	ACPI_MADT_TYPE_GICV5_ITS = 29,
1313 	ACPI_MADT_TYPE_GICV5_ITS_TRANSLATE = 30,
1314 	ACPI_MADT_TYPE_RESERVED = 31,	/* 31 to 0x7F are reserved */
1315 	ACPI_MADT_TYPE_OEM_RESERVED = 0x80	/* 0x80 to 0xFF are reserved for OEM use */
1316 };
1317 
1318 /*
1319  * MADT Subtables, correspond to Type in struct acpi_subtable_header
1320  */
1321 
1322 /* 0: Processor Local APIC */
1323 
1324 struct acpi_madt_local_apic {
1325 	struct acpi_subtable_header header;
1326 	u8 processor_id;	/* ACPI processor id */
1327 	u8 id;			/* Processor's local APIC id */
1328 	u32 lapic_flags;
1329 };
1330 
1331 /* 1: IO APIC */
1332 
1333 struct acpi_madt_io_apic {
1334 	struct acpi_subtable_header header;
1335 	u8 id;			/* I/O APIC ID */
1336 	u8 reserved;		/* reserved - must be zero */
1337 	u32 address;		/* APIC physical address */
1338 	u32 global_irq_base;	/* Global system interrupt where INTI lines start */
1339 };
1340 
1341 /* 2: Interrupt Override */
1342 
1343 struct acpi_madt_interrupt_override {
1344 	struct acpi_subtable_header header;
1345 	u8 bus;			/* 0 - ISA */
1346 	u8 source_irq;		/* Interrupt source (IRQ) */
1347 	u32 global_irq;		/* Global system interrupt */
1348 	u16 inti_flags;
1349 };
1350 
1351 /* 3: NMI Source */
1352 
1353 struct acpi_madt_nmi_source {
1354 	struct acpi_subtable_header header;
1355 	u16 inti_flags;
1356 	u32 global_irq;		/* Global system interrupt */
1357 };
1358 
1359 /* 4: Local APIC NMI */
1360 
1361 struct acpi_madt_local_apic_nmi {
1362 	struct acpi_subtable_header header;
1363 	u8 processor_id;	/* ACPI processor id */
1364 	u16 inti_flags;
1365 	u8 lint;		/* LINTn to which NMI is connected */
1366 };
1367 
1368 /* 5: Address Override */
1369 
1370 struct acpi_madt_local_apic_override {
1371 	struct acpi_subtable_header header;
1372 	u16 reserved;		/* Reserved, must be zero */
1373 	u64 address;		/* APIC physical address */
1374 };
1375 
1376 /* 6: I/O Sapic */
1377 
1378 struct acpi_madt_io_sapic {
1379 	struct acpi_subtable_header header;
1380 	u8 id;			/* I/O SAPIC ID */
1381 	u8 reserved;		/* Reserved, must be zero */
1382 	u32 global_irq_base;	/* Global interrupt for SAPIC start */
1383 	u64 address;		/* SAPIC physical address */
1384 };
1385 
1386 /* 7: Local Sapic */
1387 
1388 struct acpi_madt_local_sapic {
1389 	struct acpi_subtable_header header;
1390 	u8 processor_id;	/* ACPI processor id */
1391 	u8 id;			/* SAPIC ID */
1392 	u8 eid;			/* SAPIC EID */
1393 	u8 reserved[3];		/* Reserved, must be zero */
1394 	u32 lapic_flags;
1395 	u32 uid;		/* Numeric UID - ACPI 3.0 */
1396 	char uid_string[];	/* String UID  - ACPI 3.0 */
1397 };
1398 
1399 /* 8: Platform Interrupt Source */
1400 
1401 struct acpi_madt_interrupt_source {
1402 	struct acpi_subtable_header header;
1403 	u16 inti_flags;
1404 	u8 type;		/* 1=PMI, 2=INIT, 3=corrected */
1405 	u8 id;			/* Processor ID */
1406 	u8 eid;			/* Processor EID */
1407 	u8 io_sapic_vector;	/* Vector value for PMI interrupts */
1408 	u32 global_irq;		/* Global system interrupt */
1409 	u32 flags;		/* Interrupt Source Flags */
1410 };
1411 
1412 /* Masks for Flags field above */
1413 
1414 #define ACPI_MADT_CPEI_OVERRIDE     (1)
1415 
1416 /* 9: Processor Local X2APIC (ACPI 4.0) */
1417 
1418 struct acpi_madt_local_x2apic {
1419 	struct acpi_subtable_header header;
1420 	u16 reserved;		/* reserved - must be zero */
1421 	u32 local_apic_id;	/* Processor x2APIC ID  */
1422 	u32 lapic_flags;
1423 	u32 uid;		/* ACPI processor UID */
1424 };
1425 
1426 /* 10: Local X2APIC NMI (ACPI 4.0) */
1427 
1428 struct acpi_madt_local_x2apic_nmi {
1429 	struct acpi_subtable_header header;
1430 	u16 inti_flags;
1431 	u32 uid;		/* ACPI processor UID */
1432 	u8 lint;		/* LINTn to which NMI is connected */
1433 	u8 reserved[3];		/* reserved - must be zero */
1434 };
1435 
1436 /* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 + ACPI 6.5 + ACPI 6.7 changes) */
1437 
1438 struct acpi_madt_generic_interrupt {
1439 	struct acpi_subtable_header header;
1440 	u16 reserved;		/* reserved - must be zero */
1441 	u32 cpu_interface_number;
1442 	u32 uid;
1443 	u32 flags;
1444 	u32 parking_version;
1445 	u32 performance_interrupt;
1446 	u64 parked_address;
1447 	u64 base_address;
1448 	u64 gicv_base_address;
1449 	u64 gich_base_address;
1450 	u32 vgic_interrupt;
1451 	u64 gicr_base_address;
1452 	u64 arm_mpidr;
1453 	u8 efficiency_class;
1454 	u8 reserved2[1];
1455 	u16 spe_interrupt;	/* ACPI 6.3 */
1456 	u16 trbe_interrupt;	/* ACPI 6.5 */
1457 	u16 iaffid;		/* ACPI 6.7 */
1458 	u32 irs_id;
1459 };
1460 
1461 /* Masks for Flags field above */
1462 
1463 /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
1464 #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)	/* 01: Performance Interrupt Mode */
1465 #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)	/* 02: VGIC Maintenance Interrupt mode */
1466 #define ACPI_MADT_GICC_ONLINE_CAPABLE   (1<<3)	/* 03: Processor is online capable  */
1467 #define ACPI_MADT_GICC_NON_COHERENT     (1<<4)	/* 04: GIC redistributor is not coherent */
1468 
1469 /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
1470 
1471 struct acpi_madt_generic_distributor {
1472 	struct acpi_subtable_header header;
1473 	u16 reserved;		/* reserved - must be zero */
1474 	u32 gic_id;
1475 	u64 base_address;
1476 	u32 global_irq_base;
1477 	u8 version;
1478 	u8 reserved2[3];	/* reserved - must be zero */
1479 };
1480 
1481 /* Values for Version field above and Version field in acpi_madt_gicv5_irs */
1482 
1483 enum acpi_madt_gic_version {
1484 	ACPI_MADT_GIC_VERSION_NONE = 0,
1485 	ACPI_MADT_GIC_VERSION_V1 = 1,
1486 	ACPI_MADT_GIC_VERSION_V2 = 2,
1487 	ACPI_MADT_GIC_VERSION_V3 = 3,
1488 	ACPI_MADT_GIC_VERSION_V4 = 4,
1489 	ACPI_MADT_GIC_VERSION_V5 = 5,
1490 	ACPI_MADT_GIC_VERSION_RESERVED = 6	/* 6 and greater are reserved */
1491 };
1492 
1493 /* 13: Generic MSI Frame (ACPI 5.1) */
1494 
1495 struct acpi_madt_generic_msi_frame {
1496 	struct acpi_subtable_header header;
1497 	u16 reserved;		/* reserved - must be zero */
1498 	u32 msi_frame_id;
1499 	u64 base_address;
1500 	u32 flags;
1501 	u16 spi_count;
1502 	u16 spi_base;
1503 };
1504 
1505 /* Masks for Flags field above */
1506 
1507 #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
1508 
1509 /* 14: Generic Redistributor (ACPI 5.1) */
1510 
1511 struct acpi_madt_generic_redistributor {
1512 	struct acpi_subtable_header header;
1513 	u8 flags;
1514 	u8 reserved;		/* reserved - must be zero */
1515 	u64 base_address;
1516 	u32 length;
1517 };
1518 
1519 #define ACPI_MADT_GICR_NON_COHERENT     (1)
1520 
1521 /* 15: Generic Translator (ACPI 6.0) */
1522 
1523 struct acpi_madt_generic_translator {
1524 	struct acpi_subtable_header header;
1525 	u8 flags;
1526 	u8 reserved;		/* reserved - must be zero */
1527 	u32 translation_id;
1528 	u64 base_address;
1529 	u32 reserved2;
1530 };
1531 
1532 #define ACPI_MADT_ITS_NON_COHERENT      (1)
1533 
1534 /* 16: Multiprocessor wakeup (ACPI 6.6) */
1535 
1536 struct acpi_madt_multiproc_wakeup {
1537 	struct acpi_subtable_header header;
1538 	u16 version;
1539 	u32 reserved;		/* reserved - must be zero */
1540 	u64 mailbox_address;
1541 	u64 reset_vector;
1542 };
1543 
1544 /* Values for Version field above */
1545 
1546 enum acpi_madt_multiproc_wakeup_version {
1547 	ACPI_MADT_MP_WAKEUP_VERSION_NONE = 0,
1548 	ACPI_MADT_MP_WAKEUP_VERSION_V1 = 1,
1549 	ACPI_MADT_MP_WAKEUP_VERSION_RESERVED = 2, /* 2 and greater are reserved */
1550 };
1551 
1552 #define ACPI_MADT_MP_WAKEUP_SIZE_V0	16
1553 #define ACPI_MADT_MP_WAKEUP_SIZE_V1	24
1554 
1555 #define ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE        2032
1556 #define ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE  2048
1557 
1558 struct acpi_madt_multiproc_wakeup_mailbox {
1559 	u16 command;
1560 	u16 reserved;		/* reserved - must be zero */
1561 	u32 apic_id;
1562 	u64 wakeup_vector;
1563 	u8 reserved_os[ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE];	/* reserved for OS use */
1564 	u8 reserved_firmware[ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE];	/* reserved for firmware use */
1565 };
1566 
1567 #define ACPI_MP_WAKE_COMMAND_WAKEUP	1
1568 #define ACPI_MP_WAKE_COMMAND_TEST	2
1569 
1570 /* 17: CPU Core Interrupt Controller (ACPI 6.5) */
1571 
1572 struct acpi_madt_core_pic {
1573 	struct acpi_subtable_header header;
1574 	u8 version;
1575 	u32 processor_id;
1576 	u32 core_id;
1577 	u32 flags;
1578 };
1579 
1580 /* Values for Version field above */
1581 
1582 enum acpi_madt_core_pic_version {
1583 	ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
1584 	ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
1585 	ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1586 };
1587 
1588 /* 18: Legacy I/O Interrupt Controller (ACPI 6.5) */
1589 
1590 struct acpi_madt_lio_pic {
1591 	struct acpi_subtable_header header;
1592 	u8 version;
1593 	u64 address;
1594 	u16 size;
1595 	u8 cascade[2];
1596 	u32 cascade_map[2];
1597 };
1598 
1599 /* Values for Version field above */
1600 
1601 enum acpi_madt_lio_pic_version {
1602 	ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
1603 	ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
1604 	ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1605 };
1606 
1607 /* 19: HT Interrupt Controller (ACPI 6.5) */
1608 
1609 struct acpi_madt_ht_pic {
1610 	struct acpi_subtable_header header;
1611 	u8 version;
1612 	u64 address;
1613 	u16 size;
1614 	u8 cascade[8];
1615 };
1616 
1617 /* Values for Version field above */
1618 
1619 enum acpi_madt_ht_pic_version {
1620 	ACPI_MADT_HT_PIC_VERSION_NONE = 0,
1621 	ACPI_MADT_HT_PIC_VERSION_V1 = 1,
1622 	ACPI_MADT_HT_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1623 };
1624 
1625 /* 20: Extend I/O Interrupt Controller (ACPI 6.5) */
1626 
1627 struct acpi_madt_eio_pic {
1628 	struct acpi_subtable_header header;
1629 	u8 version;
1630 	u8 cascade;
1631 	u8 node;
1632 	u64 node_map;
1633 };
1634 
1635 /* Values for Version field above */
1636 
1637 enum acpi_madt_eio_pic_version {
1638 	ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
1639 	ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
1640 	ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1641 };
1642 
1643 /* 21: MSI Interrupt Controller (ACPI 6.5) */
1644 
1645 struct acpi_madt_msi_pic {
1646 	struct acpi_subtable_header header;
1647 	u8 version;
1648 	u64 msg_address;
1649 	u32 start;
1650 	u32 count;
1651 };
1652 
1653 /* Values for Version field above */
1654 
1655 enum acpi_madt_msi_pic_version {
1656 	ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
1657 	ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
1658 	ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1659 };
1660 
1661 /* 22: Bridge I/O Interrupt Controller (ACPI 6.5) */
1662 
1663 struct acpi_madt_bio_pic {
1664 	struct acpi_subtable_header header;
1665 	u8 version;
1666 	u64 address;
1667 	u16 size;
1668 	u16 id;
1669 	u16 gsi_base;
1670 };
1671 
1672 /* Values for Version field above */
1673 
1674 enum acpi_madt_bio_pic_version {
1675 	ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
1676 	ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
1677 	ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1678 };
1679 
1680 /* 23: LPC Interrupt Controller (ACPI 6.5) */
1681 
1682 struct acpi_madt_lpc_pic {
1683 	struct acpi_subtable_header header;
1684 	u8 version;
1685 	u64 address;
1686 	u16 size;
1687 	u8 cascade;
1688 };
1689 
1690 /* Values for Version field above */
1691 
1692 enum acpi_madt_lpc_pic_version {
1693 	ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
1694 	ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
1695 	ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1696 };
1697 
1698 /* 24: RISC-V INTC */
1699 struct acpi_madt_rintc {
1700 	struct acpi_subtable_header header;
1701 	u8 version;
1702 	u8 reserved;
1703 	u32 flags;
1704 	u64 hart_id;
1705 	u32 uid;		/* ACPI processor UID */
1706 	u32 ext_intc_id;	/* External INTC Id */
1707 	u64 imsic_addr;		/* IMSIC base address */
1708 	u32 imsic_size;		/* IMSIC size */
1709 };
1710 
1711 /* Values for RISC-V INTC Version field above */
1712 
1713 enum acpi_madt_rintc_version {
1714 	ACPI_MADT_RINTC_VERSION_NONE = 0,
1715 	ACPI_MADT_RINTC_VERSION_V1 = 1,
1716 	ACPI_MADT_RINTC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1717 };
1718 
1719 /* 25: RISC-V IMSIC */
1720 struct acpi_madt_imsic {
1721 	struct acpi_subtable_header header;
1722 	u8 version;
1723 	u8 reserved;
1724 	u32 flags;
1725 	u16 num_ids;
1726 	u16 num_guest_ids;
1727 	u8 guest_index_bits;
1728 	u8 hart_index_bits;
1729 	u8 group_index_bits;
1730 	u8 group_index_shift;
1731 };
1732 
1733 /* 26: RISC-V APLIC */
1734 struct acpi_madt_aplic {
1735 	struct acpi_subtable_header header;
1736 	u8 version;
1737 	u8 id;
1738 	u32 flags;
1739 	u8 hw_id[8];
1740 	u16 num_idcs;
1741 	u16 num_sources;
1742 	u32 gsi_base;
1743 	u64 base_addr;
1744 	u32 size;
1745 };
1746 
1747 /* 27: RISC-V PLIC */
1748 struct acpi_madt_plic {
1749 	struct acpi_subtable_header header;
1750 	u8 version;
1751 	u8 id;
1752 	u8 hw_id[8];
1753 	u16 num_irqs;
1754 	u16 max_prio;
1755 	u32 flags;
1756 	u32 size;
1757 	u64 base_addr;
1758 	u32 gsi_base;
1759 };
1760 
1761 /* 28: Arm GICv5 IRS (ACPI 6.7) */
1762 struct acpi_madt_gicv5_irs {
1763 	struct acpi_subtable_header header;
1764 	u8 version;
1765 	u8 reserved;
1766 	u32 irs_id;
1767 	u32 flags;
1768 	u32 reserved2;
1769 	u64 config_base_address;
1770 	u64 setlpi_base_address;
1771 };
1772 
1773 #define ACPI_MADT_IRS_NON_COHERENT      (1)
1774 
1775 /* 29: Arm GICv5 ITS Config Frame (ACPI 6.7) */
1776 struct acpi_madt_gicv5_translator {
1777 	struct acpi_subtable_header header;
1778 	u8 flags;
1779 	u8 reserved;		/* reserved - must be zero */
1780 	u32 translator_id;
1781 	u64 base_address;
1782 };
1783 
1784 #define ACPI_MADT_GICV5_ITS_NON_COHERENT      (1)
1785 
1786 /* 30: Arm GICv5 ITS Translate Frame (ACPI 6.7) */
1787 struct acpi_madt_gicv5_translate_frame {
1788 	struct acpi_subtable_header header;
1789 	u16 reserved;		/* reserved - must be zero */
1790 	u32 linked_translator_id;
1791 	u32 translate_frame_id;
1792 	u32 reserved2;
1793 	u64 base_address;
1794 };
1795 
1796 /* 80: OEM data */
1797 
1798 struct acpi_madt_oem_data {
1799 	ACPI_FLEX_ARRAY(u8, oem_data);
1800 };
1801 
1802 /*
1803  * Common flags fields for MADT subtables
1804  */
1805 
1806 /* MADT Local APIC flags */
1807 
1808 #define ACPI_MADT_ENABLED           (1)	/* 00: Processor is usable if set */
1809 #define ACPI_MADT_ONLINE_CAPABLE    (2)	/* 01: System HW supports enabling processor at runtime */
1810 
1811 /* MADT MPS INTI flags (inti_flags) */
1812 
1813 #define ACPI_MADT_POLARITY_MASK     (3)	/* 00-01: Polarity of APIC I/O input signals */
1814 #define ACPI_MADT_TRIGGER_MASK      (3<<2)	/* 02-03: Trigger mode of APIC input signals */
1815 
1816 /* Values for MPS INTI flags */
1817 
1818 #define ACPI_MADT_POLARITY_CONFORMS       0
1819 #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
1820 #define ACPI_MADT_POLARITY_RESERVED       2
1821 #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
1822 
1823 #define ACPI_MADT_TRIGGER_CONFORMS        (0)
1824 #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
1825 #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
1826 #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
1827 
1828 /*******************************************************************************
1829  *
1830  * MCFG - PCI Memory Mapped Configuration table and subtable
1831  *        Version 1
1832  *
1833  * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
1834  *
1835  ******************************************************************************/
1836 
1837 struct acpi_table_mcfg {
1838 	struct acpi_table_header header;	/* Common ACPI table header */
1839 	u8 reserved[8];
1840 };
1841 
1842 /* Subtable */
1843 
1844 struct acpi_mcfg_allocation {
1845 	u64 address;		/* Base address, processor-relative */
1846 	u16 pci_segment;	/* PCI segment group number */
1847 	u8 start_bus_number;	/* Starting PCI Bus number */
1848 	u8 end_bus_number;	/* Final PCI Bus number */
1849 	u32 reserved;
1850 };
1851 
1852 /*******************************************************************************
1853  *
1854  * MCHI - Management Controller Host Interface Table
1855  *        Version 1
1856  *
1857  * Conforms to "Management Component Transport Protocol (MCTP) Host
1858  * Interface Specification", Revision 1.0.0a, October 13, 2009
1859  *
1860  ******************************************************************************/
1861 
1862 struct acpi_table_mchi {
1863 	struct acpi_table_header header;	/* Common ACPI table header */
1864 	u8 interface_type;
1865 	u8 protocol;
1866 	u64 protocol_data;
1867 	u8 interrupt_type;
1868 	u8 gpe;
1869 	u8 pci_device_flag;
1870 	u32 global_interrupt;
1871 	struct acpi_generic_address control_register;
1872 	u8 pci_segment;
1873 	u8 pci_bus;
1874 	u8 pci_device;
1875 	u8 pci_function;
1876 };
1877 
1878 /*******************************************************************************
1879  *
1880  * MPAM - Memory System Resource Partitioning and Monitoring
1881  *
1882  * Conforms to "ACPI for Memory System Resource Partitioning and Monitoring 2.0"
1883  * Document number: ARM DEN 0065, December, 2022.
1884  *
1885  ******************************************************************************/
1886 
1887 /* MPAM RIS locator types. Table 11, Location types */
1888 enum acpi_mpam_locator_type {
1889 	ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE = 0,
1890 	ACPI_MPAM_LOCATION_TYPE_MEMORY = 1,
1891 	ACPI_MPAM_LOCATION_TYPE_SMMU = 2,
1892 	ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE = 3,
1893 	ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE = 4,
1894 	ACPI_MPAM_LOCATION_TYPE_INTERCONNECT = 5,
1895 	ACPI_MPAM_LOCATION_TYPE_UNKNOWN = 0xFF
1896 };
1897 
1898 /* MPAM Functional dependency descriptor. Table 10 */
1899 struct acpi_mpam_func_deps {
1900 	u32 producer;
1901 	u32 reserved;
1902 };
1903 
1904 /* MPAM Processor cache locator descriptor. Table 13 */
1905 struct acpi_mpam_resource_cache_locator {
1906 	u64 cache_reference;
1907 	u32 reserved;
1908 };
1909 
1910 /* MPAM Memory locator descriptor. Table 14 */
1911 struct acpi_mpam_resource_memory_locator {
1912 	u64 proximity_domain;
1913 	u32 reserved;
1914 };
1915 
1916 /* MPAM SMMU locator descriptor. Table 15 */
1917 struct acpi_mpam_resource_smmu_locator {
1918 	u64 smmu_interface;
1919 	u32 reserved;
1920 };
1921 
1922 /* MPAM Memory-side cache locator descriptor. Table 16 */
1923 struct acpi_mpam_resource_memcache_locator {
1924 	u8 reserved[7];
1925 	u8 level;
1926 	u32 reference;
1927 };
1928 
1929 /* MPAM ACPI device locator descriptor. Table 17 */
1930 struct acpi_mpam_resource_acpi_locator {
1931 	u64 acpi_hw_id;
1932 	u32 acpi_unique_id;
1933 };
1934 
1935 /* MPAM Interconnect locator descriptor. Table 18 */
1936 struct acpi_mpam_resource_interconnect_locator {
1937 	u64 inter_connect_desc_tbl_off;
1938 	u32 reserved;
1939 };
1940 
1941 /* MPAM Locator structure. Table 12 */
1942 struct acpi_mpam_resource_generic_locator {
1943 	u64 descriptor1;
1944 	u32 descriptor2;
1945 };
1946 
1947 union acpi_mpam_resource_locator {
1948 	struct acpi_mpam_resource_cache_locator cache_locator;
1949 	struct acpi_mpam_resource_memory_locator memory_locator;
1950 	struct acpi_mpam_resource_smmu_locator smmu_locator;
1951 	struct acpi_mpam_resource_memcache_locator mem_cache_locator;
1952 	struct acpi_mpam_resource_acpi_locator acpi_locator;
1953 	struct acpi_mpam_resource_interconnect_locator interconnect_ifc_locator;
1954 	struct acpi_mpam_resource_generic_locator generic_locator;
1955 };
1956 
1957 /* Memory System Component Resource Node Structure Table 9 */
1958 struct acpi_mpam_resource_node {
1959 	u32 identifier;
1960 	u8 ris_index;
1961 	u16 reserved1;
1962 	u8 locator_type;
1963 	union acpi_mpam_resource_locator locator;
1964 	u32 num_functional_deps;
1965 };
1966 
1967 /* Memory System Component (MSC) Node Structure. Table 4 */
1968 struct acpi_mpam_msc_node {
1969 	u16 length;
1970 	u8 interface_type;
1971 	u8 reserved;
1972 	u32 identifier;
1973 	u64 base_address;
1974 	u32 mmio_size;
1975 	u32 overflow_interrupt;
1976 	u32 overflow_interrupt_flags;
1977 	u32 reserved1;
1978 	u32 overflow_interrupt_affinity;
1979 	u32 error_interrupt;
1980 	u32 error_interrupt_flags;
1981 	u32 reserved2;
1982 	u32 error_interrupt_affinity;
1983 	u32 max_nrdy_usec;
1984 	u64 hardware_id_linked_device;
1985 	u32 instance_id_linked_device;
1986 	u32 num_resource_nodes;
1987 };
1988 
1989 struct acpi_table_mpam {
1990 	struct acpi_table_header header;	/* Common ACPI table header */
1991 };
1992 
1993 /*******************************************************************************
1994  *
1995  * MPST - Memory Power State Table (ACPI 5.0)
1996  *        Version 1
1997  *
1998  ******************************************************************************/
1999 
2000 #define ACPI_MPST_CHANNEL_INFO \
2001 	u8                              channel_id; \
2002 	u8                              reserved1[3]; \
2003 	u16                             power_node_count; \
2004 	u16                             reserved2;
2005 
2006 /* Main table */
2007 
2008 struct acpi_table_mpst {
2009 	struct acpi_table_header header;	/* Common ACPI table header */
2010 	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
2011 };
2012 
2013 /* Memory Platform Communication Channel Info */
2014 
2015 struct acpi_mpst_channel {
2016 	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
2017 };
2018 
2019 /* Memory Power Node Structure */
2020 
2021 struct acpi_mpst_power_node {
2022 	u8 flags;
2023 	u8 reserved1;
2024 	u16 node_id;
2025 	u32 length;
2026 	u64 range_address;
2027 	u64 range_length;
2028 	u32 num_power_states;
2029 	u32 num_physical_components;
2030 };
2031 
2032 /* Values for Flags field above */
2033 
2034 #define ACPI_MPST_ENABLED               1
2035 #define ACPI_MPST_POWER_MANAGED         2
2036 #define ACPI_MPST_HOT_PLUG_CAPABLE      4
2037 
2038 /* Memory Power State Structure (follows POWER_NODE above) */
2039 
2040 struct acpi_mpst_power_state {
2041 	u8 power_state;
2042 	u8 info_index;
2043 };
2044 
2045 /* Physical Component ID Structure (follows POWER_STATE above) */
2046 
2047 struct acpi_mpst_component {
2048 	u16 component_id;
2049 };
2050 
2051 /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
2052 
2053 struct acpi_mpst_data_hdr {
2054 	u16 characteristics_count;
2055 	u16 reserved;
2056 };
2057 
2058 struct acpi_mpst_power_data {
2059 	u8 structure_id;
2060 	u8 flags;
2061 	u16 reserved1;
2062 	u32 average_power;
2063 	u32 power_saving;
2064 	u64 exit_latency;
2065 	u64 reserved2;
2066 };
2067 
2068 /* Values for Flags field above */
2069 
2070 #define ACPI_MPST_PRESERVE              1
2071 #define ACPI_MPST_AUTOENTRY             2
2072 #define ACPI_MPST_AUTOEXIT              4
2073 
2074 /* Shared Memory Region (not part of an ACPI table) */
2075 
2076 struct acpi_mpst_shared {
2077 	u32 signature;
2078 	u16 pcc_command;
2079 	u16 pcc_status;
2080 	u32 command_register;
2081 	u32 status_register;
2082 	u32 power_state_id;
2083 	u32 power_node_id;
2084 	u64 energy_consumed;
2085 	u64 average_power;
2086 };
2087 
2088 /*******************************************************************************
2089  *
2090  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
2091  *        Version 1
2092  *
2093  ******************************************************************************/
2094 
2095 struct acpi_table_msct {
2096 	struct acpi_table_header header;	/* Common ACPI table header */
2097 	u32 proximity_offset;	/* Location of proximity info struct(s) */
2098 	u32 max_proximity_domains;	/* Max number of proximity domains */
2099 	u32 max_clock_domains;	/* Max number of clock domains */
2100 	u64 max_address;	/* Max physical address in system */
2101 };
2102 
2103 /* subtable - Maximum Proximity Domain Information. Version 1 */
2104 
2105 struct acpi_msct_proximity {
2106 	u8 revision;
2107 	u8 length;
2108 	u32 range_start;	/* Start of domain range */
2109 	u32 range_end;		/* End of domain range */
2110 	u32 processor_capacity;
2111 	u64 memory_capacity;	/* In bytes */
2112 };
2113 
2114 /*******************************************************************************
2115  *
2116  * MRRM - Memory Range and Region Mapping (MRRM) table
2117  * Conforms to "Intel Resource Director Technology Architecture Specification"
2118  * Version 1.1, January 2025
2119  *
2120  ******************************************************************************/
2121 
2122 struct acpi_table_mrrm {
2123 	struct acpi_table_header header;	/* Common ACPI table header */
2124 	u8 max_mem_region;	/* Max Memory Regions supported */
2125 	u8 flags;		/* Region assignment type */
2126 	u8 reserved[26];
2127 	u8 memory_range_entry[];
2128 };
2129 
2130 /* Flags */
2131 #define ACPI_MRRM_FLAGS_REGION_ASSIGNMENT_OS    (1<<0)
2132 
2133 /*******************************************************************************
2134 	*
2135 	* Memory Range entry - Memory Range entry in MRRM table
2136 	*
2137 	******************************************************************************/
2138 
2139 struct acpi_mrrm_mem_range_entry {
2140 	struct acpi_subtbl_hdr_16 header;
2141 	u32 reserved0;		/* Reserved */
2142 	u64 addr_base;		/* Base addr of the mem range */
2143 	u64 addr_len;		/* Length of the mem range */
2144 	u16 region_id_flags;	/* Valid local or remote Region-ID */
2145 	u8 local_region_id;	/* Platform-assigned static local Region-ID */
2146 	u8 remote_region_id;	/* Platform-assigned static remote Region-ID */
2147 	u32 reserved1;		/* Reserved */
2148 	/* Region-ID Programming Registers[] */
2149 };
2150 
2151 /* Values for region_id_flags above */
2152 #define ACPI_MRRM_VALID_REGION_ID_FLAGS_LOCAL   (1<<0)
2153 #define ACPI_MRRM_VALID_REGION_ID_FLAGS_REMOTE  (1<<1)
2154 
2155 /*******************************************************************************
2156  *
2157  * MSDM - Microsoft Data Management table
2158  *
2159  * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
2160  * November 29, 2011. Copyright 2011 Microsoft
2161  *
2162  ******************************************************************************/
2163 
2164 /* Basic MSDM table is only the common ACPI header */
2165 
2166 struct acpi_table_msdm {
2167 	struct acpi_table_header header;	/* Common ACPI table header */
2168 };
2169 
2170 /*******************************************************************************
2171  *
2172  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
2173  *        Version 1
2174  *
2175  ******************************************************************************/
2176 
2177 struct acpi_table_nfit {
2178 	struct acpi_table_header header;	/* Common ACPI table header */
2179 	u32 reserved;		/* Reserved, must be zero */
2180 };
2181 
2182 /* Subtable header for NFIT */
2183 
2184 struct acpi_nfit_header {
2185 	u16 type;
2186 	u16 length;
2187 };
2188 
2189 /* Values for subtable type in struct acpi_nfit_header */
2190 
2191 enum acpi_nfit_type {
2192 	ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
2193 	ACPI_NFIT_TYPE_MEMORY_MAP = 1,
2194 	ACPI_NFIT_TYPE_INTERLEAVE = 2,
2195 	ACPI_NFIT_TYPE_SMBIOS = 3,
2196 	ACPI_NFIT_TYPE_CONTROL_REGION = 4,
2197 	ACPI_NFIT_TYPE_DATA_REGION = 5,
2198 	ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
2199 	ACPI_NFIT_TYPE_CAPABILITIES = 7,
2200 	ACPI_NFIT_TYPE_RESERVED = 8	/* 8 and greater are reserved */
2201 };
2202 
2203 /*
2204  * NFIT Subtables
2205  */
2206 
2207 /* 0: System Physical Address Range Structure */
2208 
2209 struct acpi_nfit_system_address {
2210 	struct acpi_nfit_header header;
2211 	u16 range_index;
2212 	u16 flags;
2213 	u32 reserved;		/* Reserved, must be zero */
2214 	u32 proximity_domain;
2215 	u8 range_guid[16];
2216 	u64 address;
2217 	u64 length;
2218 	u64 memory_mapping;
2219 	u64 location_cookie;	/* ACPI 6.4 */
2220 };
2221 
2222 /* Flags */
2223 
2224 #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)	/* 00: Add/Online Operation Only */
2225 #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)	/* 01: Proximity Domain Valid */
2226 #define ACPI_NFIT_LOCATION_COOKIE_VALID (1<<2)	/* 02: SPA location cookie valid (ACPI 6.4) */
2227 
2228 /* Range Type GUIDs appear in the include/acuuid.h file */
2229 
2230 /* 1: Memory Device to System Address Range Map Structure */
2231 
2232 struct acpi_nfit_memory_map {
2233 	struct acpi_nfit_header header;
2234 	u32 device_handle;
2235 	u16 physical_id;
2236 	u16 region_id;
2237 	u16 range_index;
2238 	u16 region_index;
2239 	u64 region_size;
2240 	u64 region_offset;
2241 	u64 address;
2242 	u16 interleave_index;
2243 	u16 interleave_ways;
2244 	u16 flags;
2245 	u16 reserved;		/* Reserved, must be zero */
2246 };
2247 
2248 /* Flags */
2249 
2250 #define ACPI_NFIT_MEM_SAVE_FAILED       (1)	/* 00: Last SAVE to Memory Device failed */
2251 #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)	/* 01: Last RESTORE from Memory Device failed */
2252 #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)	/* 02: Platform flush failed */
2253 #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)	/* 03: Memory Device is not armed */
2254 #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)	/* 04: Memory Device observed SMART/health events */
2255 #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)	/* 05: SMART/health events enabled */
2256 #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)	/* 06: Mapping to SPA failed */
2257 
2258 /* 2: Interleave Structure */
2259 
2260 struct acpi_nfit_interleave {
2261 	struct acpi_nfit_header header;
2262 	u16 interleave_index;
2263 	u16 reserved;		/* Reserved, must be zero */
2264 	u32 line_count;
2265 	u32 line_size;
2266 	u32 line_offset[];	/* Variable length */
2267 };
2268 
2269 /* 3: SMBIOS Management Information Structure */
2270 
2271 struct acpi_nfit_smbios {
2272 	struct acpi_nfit_header header;
2273 	u32 reserved;		/* Reserved, must be zero */
2274 	u8 data[];		/* Variable length */
2275 };
2276 
2277 /* 4: NVDIMM Control Region Structure */
2278 
2279 struct acpi_nfit_control_region {
2280 	struct acpi_nfit_header header;
2281 	u16 region_index;
2282 	u16 vendor_id;
2283 	u16 device_id;
2284 	u16 revision_id;
2285 	u16 subsystem_vendor_id;
2286 	u16 subsystem_device_id;
2287 	u16 subsystem_revision_id;
2288 	u8 valid_fields;
2289 	u8 manufacturing_location;
2290 	u16 manufacturing_date;
2291 	u8 reserved[2];		/* Reserved, must be zero */
2292 	u32 serial_number;
2293 	u16 code;
2294 	u16 windows;
2295 	u64 window_size;
2296 	u64 command_offset;
2297 	u64 command_size;
2298 	u64 status_offset;
2299 	u64 status_size;
2300 	u16 flags;
2301 	u8 reserved1[6];	/* Reserved, must be zero */
2302 };
2303 
2304 /* Flags */
2305 
2306 #define ACPI_NFIT_CONTROL_BUFFERED          (1)	/* Block Data Windows implementation is buffered */
2307 
2308 /* valid_fields bits */
2309 
2310 #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)	/* Manufacturing fields are valid */
2311 
2312 /* 5: NVDIMM Block Data Window Region Structure */
2313 
2314 struct acpi_nfit_data_region {
2315 	struct acpi_nfit_header header;
2316 	u16 region_index;
2317 	u16 windows;
2318 	u64 offset;
2319 	u64 size;
2320 	u64 capacity;
2321 	u64 start_address;
2322 };
2323 
2324 /* 6: Flush Hint Address Structure */
2325 
2326 struct acpi_nfit_flush_address {
2327 	struct acpi_nfit_header header;
2328 	u32 device_handle;
2329 	u16 hint_count;
2330 	u8 reserved[6];		/* Reserved, must be zero */
2331 	u64 hint_address[];	/* Variable length */
2332 };
2333 
2334 /* 7: Platform Capabilities Structure */
2335 
2336 struct acpi_nfit_capabilities {
2337 	struct acpi_nfit_header header;
2338 	u8 highest_capability;
2339 	u8 reserved[3];		/* Reserved, must be zero */
2340 	u32 capabilities;
2341 	u32 reserved2;
2342 };
2343 
2344 /* Capabilities Flags */
2345 
2346 #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)	/* 00: Cache Flush to NVDIMM capable */
2347 #define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)	/* 01: Memory Flush to NVDIMM capable */
2348 #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)	/* 02: Memory Mirroring capable */
2349 
2350 /*
2351  * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
2352  */
2353 struct nfit_device_handle {
2354 	u32 handle;
2355 };
2356 
2357 /* Device handle construction and extraction macros */
2358 
2359 #define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
2360 #define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
2361 #define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
2362 #define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
2363 #define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
2364 
2365 #define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
2366 #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
2367 #define ACPI_NFIT_MEMORY_ID_OFFSET              8
2368 #define ACPI_NFIT_SOCKET_ID_OFFSET              12
2369 #define ACPI_NFIT_NODE_ID_OFFSET                16
2370 
2371 /* Macro to construct a NFIT/NVDIMM device handle */
2372 
2373 #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
2374 	((dimm)                                         | \
2375 	((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
2376 	((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
2377 	((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
2378 	((node)    << ACPI_NFIT_NODE_ID_OFFSET))
2379 
2380 /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
2381 
2382 #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
2383 	((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
2384 
2385 #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
2386 	(((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
2387 
2388 #define ACPI_NFIT_GET_MEMORY_ID(handle) \
2389 	(((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
2390 
2391 #define ACPI_NFIT_GET_SOCKET_ID(handle) \
2392 	(((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
2393 
2394 #define ACPI_NFIT_GET_NODE_ID(handle) \
2395 	(((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
2396 
2397 /*******************************************************************************
2398  *
2399  * NHLT - Non HDAudio Link Table
2400  *        Version 1
2401  *
2402  ******************************************************************************/
2403 
2404 struct acpi_table_nhlt {
2405 	struct acpi_table_header header;	/* Common ACPI table header */
2406 	u8 endpoints_count;
2407 	/*
2408 	 * struct acpi_nhlt_endpoint endpoints[];
2409 	 * struct acpi_nhlt_config oed_config;
2410 	 */
2411 };
2412 
2413 struct acpi_nhlt_endpoint {
2414 	u32 length;
2415 	u8 link_type;
2416 	u8 instance_id;
2417 	u16 vendor_id;
2418 	u16 device_id;
2419 	u16 revision_id;
2420 	u32 subsystem_id;
2421 	u8 device_type;
2422 	u8 direction;
2423 	u8 virtual_bus_id;
2424 	/*
2425 	 * struct acpi_nhlt_config device_config;
2426 	 * struct acpi_nhlt_formats_config formats_config;
2427 	 * struct acpi_nhlt_devices_info devices_info;
2428 	 */
2429 };
2430 
2431 /*
2432  * Values for link_type field above
2433  *
2434  * Only types PDM and SSP are used
2435  */
2436 #define ACPI_NHLT_LINKTYPE_HDA			0
2437 #define ACPI_NHLT_LINKTYPE_DSP			1
2438 #define ACPI_NHLT_LINKTYPE_PDM			2
2439 #define ACPI_NHLT_LINKTYPE_SSP			3
2440 #define ACPI_NHLT_LINKTYPE_SLIMBUS		4
2441 #define ACPI_NHLT_LINKTYPE_SDW			5
2442 #define ACPI_NHLT_LINKTYPE_UAOL			6
2443 
2444 /* Values for device_id field above */
2445 
2446 #define ACPI_NHLT_DEVICEID_DMIC			0xAE20
2447 #define ACPI_NHLT_DEVICEID_BT			0xAE30
2448 #define ACPI_NHLT_DEVICEID_I2S			0xAE34
2449 
2450 /* Values for device_type field above */
2451 
2452 /*
2453  * Device types unique to endpoint of link_type=PDM
2454  *
2455  * Type PDM used for all SKL+ platforms
2456  */
2457 #define ACPI_NHLT_DEVICETYPE_PDM		0
2458 #define ACPI_NHLT_DEVICETYPE_PDM_SKL		1
2459 /* Device types unique to endpoint of link_type=SSP */
2460 #define ACPI_NHLT_DEVICETYPE_BT			0
2461 #define ACPI_NHLT_DEVICETYPE_FM			1
2462 #define ACPI_NHLT_DEVICETYPE_MODEM		2
2463 #define ACPI_NHLT_DEVICETYPE_CODEC		4
2464 
2465 /* Values for Direction field above */
2466 
2467 #define ACPI_NHLT_DIR_RENDER			0
2468 #define ACPI_NHLT_DIR_CAPTURE			1
2469 
2470 struct acpi_nhlt_config {
2471 	u32 capabilities_size;
2472 	u8 capabilities[];
2473 };
2474 
2475 struct acpi_nhlt_gendevice_config {
2476 	u8 virtual_slot;
2477 	u8 config_type;
2478 };
2479 
2480 /* Values for config_type field above */
2481 
2482 #define ACPI_NHLT_CONFIGTYPE_GENERIC		0
2483 #define ACPI_NHLT_CONFIGTYPE_MICARRAY		1
2484 
2485 struct acpi_nhlt_micdevice_config {
2486 	u8 virtual_slot;
2487 	u8 config_type;
2488 	u8 array_type;
2489 };
2490 
2491 /* Values for array_type field above */
2492 
2493 #define ACPI_NHLT_ARRAYTYPE_LINEAR2_SMALL	0xA
2494 #define ACPI_NHLT_ARRAYTYPE_LINEAR2_BIG		0xB
2495 #define ACPI_NHLT_ARRAYTYPE_LINEAR4_GEO1	0xC
2496 #define ACPI_NHLT_ARRAYTYPE_PLANAR4_LSHAPED	0xD
2497 #define ACPI_NHLT_ARRAYTYPE_LINEAR4_GEO2	0xE
2498 #define ACPI_NHLT_ARRAYTYPE_VENDOR		0xF
2499 
2500 struct acpi_nhlt_vendor_mic_config {
2501 	u8 type;
2502 	u8 panel;
2503 	u16 speaker_position_distance;		/* mm */
2504 	u16 horizontal_offset;			/* mm */
2505 	u16 vertical_offset;			/* mm */
2506 	u8 frequency_low_band;			/* 5*Hz */
2507 	u8 frequency_high_band;			/* 500*Hz */
2508 	u16 direction_angle;			/* -180 - +180 */
2509 	u16 elevation_angle;			/* -180 - +180 */
2510 	u16 work_vertical_angle_begin;		/* -180 - +180 with 2 deg step */
2511 	u16 work_vertical_angle_end;		/* -180 - +180 with 2 deg step */
2512 	u16 work_horizontal_angle_begin;	/* -180 - +180 with 2 deg step */
2513 	u16 work_horizontal_angle_end;		/* -180 - +180 with 2 deg step */
2514 };
2515 
2516 /* Values for Type field above */
2517 
2518 #define ACPI_NHLT_MICTYPE_OMNIDIRECTIONAL	0
2519 #define ACPI_NHLT_MICTYPE_SUBCARDIOID		1
2520 #define ACPI_NHLT_MICTYPE_CARDIOID		2
2521 #define ACPI_NHLT_MICTYPE_SUPERCARDIOID		3
2522 #define ACPI_NHLT_MICTYPE_HYPERCARDIOID		4
2523 #define ACPI_NHLT_MICTYPE_8SHAPED		5
2524 #define ACPI_NHLT_MICTYPE_RESERVED		6
2525 #define ACPI_NHLT_MICTYPE_VENDORDEFINED		7
2526 
2527 /* Values for Panel field above */
2528 
2529 #define ACPI_NHLT_MICLOCATION_TOP		0
2530 #define ACPI_NHLT_MICLOCATION_BOTTOM		1
2531 #define ACPI_NHLT_MICLOCATION_LEFT		2
2532 #define ACPI_NHLT_MICLOCATION_RIGHT		3
2533 #define ACPI_NHLT_MICLOCATION_FRONT		4
2534 #define ACPI_NHLT_MICLOCATION_REAR		5
2535 
2536 struct acpi_nhlt_vendor_micdevice_config {
2537 	u8 virtual_slot;
2538 	u8 config_type;
2539 	u8 array_type;
2540 	u8 mics_count;
2541 	struct acpi_nhlt_vendor_mic_config mics[];
2542 };
2543 
2544 union acpi_nhlt_device_config {
2545 	u8 virtual_slot;
2546 	struct acpi_nhlt_gendevice_config gen;
2547 	struct acpi_nhlt_micdevice_config mic;
2548 	struct acpi_nhlt_vendor_micdevice_config vendor_mic;
2549 };
2550 
2551 /* Inherited from Microsoft's WAVEFORMATEXTENSIBLE. */
2552 struct acpi_nhlt_wave_formatext {
2553 	u16 format_tag;
2554 	u16 channel_count;
2555 	u32 samples_per_sec;
2556 	u32 avg_bytes_per_sec;
2557 	u16 block_align;
2558 	u16 bits_per_sample;
2559 	u16 extra_format_size;
2560 	u16 valid_bits_per_sample;
2561 	u32 channel_mask;
2562 	u8 subformat[16];
2563 };
2564 
2565 struct acpi_nhlt_format_config {
2566 	struct acpi_nhlt_wave_formatext format;
2567 	struct acpi_nhlt_config config;
2568 };
2569 
2570 struct acpi_nhlt_formats_config {
2571 	u8 formats_count;
2572 	struct acpi_nhlt_format_config formats[];
2573 };
2574 
2575 struct acpi_nhlt_device_info {
2576 	u8 id[16];
2577 	u8 instance_id;
2578 	u8 port_id;
2579 };
2580 
2581 struct acpi_nhlt_devices_info {
2582 	u8 devices_count;
2583 	struct acpi_nhlt_device_info devices[];
2584 };
2585 
2586 /*******************************************************************************
2587  *
2588  * PCCT - Platform Communications Channel Table (ACPI 5.0)
2589  *        Version 2 (ACPI 6.2)
2590  *
2591  ******************************************************************************/
2592 
2593 struct acpi_table_pcct {
2594 	struct acpi_table_header header;	/* Common ACPI table header */
2595 	u32 flags;
2596 	u64 reserved;
2597 };
2598 
2599 /* Values for Flags field above */
2600 
2601 #define ACPI_PCCT_DOORBELL              1
2602 
2603 /* Values for subtable type in struct acpi_subtable_header */
2604 
2605 enum acpi_pcct_type {
2606 	ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
2607 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
2608 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2,	/* ACPI 6.1 */
2609 	ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3,	/* ACPI 6.2 */
2610 	ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4,	/* ACPI 6.2 */
2611 	ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE = 5,	/* ACPI 6.4 */
2612 	ACPI_PCCT_TYPE_RESERVED = 6	/* 6 and greater are reserved */
2613 };
2614 
2615 /*
2616  * PCCT Subtables, correspond to Type in struct acpi_subtable_header
2617  */
2618 
2619 /* 0: Generic Communications Subspace */
2620 
2621 struct acpi_pcct_subspace {
2622 	struct acpi_subtable_header header;
2623 	u8 reserved[6];
2624 	u64 base_address;
2625 	u64 length;
2626 	struct acpi_generic_address doorbell_register;
2627 	u64 preserve_mask;
2628 	u64 write_mask;
2629 	u32 latency;
2630 	u32 max_access_rate;
2631 	u16 min_turnaround_time;
2632 };
2633 
2634 /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
2635 
2636 struct acpi_pcct_hw_reduced {
2637 	struct acpi_subtable_header header;
2638 	u32 platform_interrupt;
2639 	u8 flags;
2640 	u8 reserved;
2641 	u64 base_address;
2642 	u64 length;
2643 	struct acpi_generic_address doorbell_register;
2644 	u64 preserve_mask;
2645 	u64 write_mask;
2646 	u32 latency;
2647 	u32 max_access_rate;
2648 	u16 min_turnaround_time;
2649 };
2650 
2651 /* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
2652 
2653 struct acpi_pcct_hw_reduced_type2 {
2654 	struct acpi_subtable_header header;
2655 	u32 platform_interrupt;
2656 	u8 flags;
2657 	u8 reserved;
2658 	u64 base_address;
2659 	u64 length;
2660 	struct acpi_generic_address doorbell_register;
2661 	u64 preserve_mask;
2662 	u64 write_mask;
2663 	u32 latency;
2664 	u32 max_access_rate;
2665 	u16 min_turnaround_time;
2666 	struct acpi_generic_address platform_ack_register;
2667 	u64 ack_preserve_mask;
2668 	u64 ack_write_mask;
2669 };
2670 
2671 /* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
2672 
2673 struct acpi_pcct_ext_pcc_master {
2674 	struct acpi_subtable_header header;
2675 	u32 platform_interrupt;
2676 	u8 flags;
2677 	u8 reserved1;
2678 	u64 base_address;
2679 	u32 length;
2680 	struct acpi_generic_address doorbell_register;
2681 	u64 preserve_mask;
2682 	u64 write_mask;
2683 	u32 latency;
2684 	u32 max_access_rate;
2685 	u32 min_turnaround_time;
2686 	struct acpi_generic_address platform_ack_register;
2687 	u64 ack_preserve_mask;
2688 	u64 ack_set_mask;
2689 	u64 reserved2;
2690 	struct acpi_generic_address cmd_complete_register;
2691 	u64 cmd_complete_mask;
2692 	struct acpi_generic_address cmd_update_register;
2693 	u64 cmd_update_preserve_mask;
2694 	u64 cmd_update_set_mask;
2695 	struct acpi_generic_address error_status_register;
2696 	u64 error_status_mask;
2697 };
2698 
2699 /* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
2700 
2701 struct acpi_pcct_ext_pcc_slave {
2702 	struct acpi_subtable_header header;
2703 	u32 platform_interrupt;
2704 	u8 flags;
2705 	u8 reserved1;
2706 	u64 base_address;
2707 	u32 length;
2708 	struct acpi_generic_address doorbell_register;
2709 	u64 preserve_mask;
2710 	u64 write_mask;
2711 	u32 latency;
2712 	u32 max_access_rate;
2713 	u32 min_turnaround_time;
2714 	struct acpi_generic_address platform_ack_register;
2715 	u64 ack_preserve_mask;
2716 	u64 ack_set_mask;
2717 	u64 reserved2;
2718 	struct acpi_generic_address cmd_complete_register;
2719 	u64 cmd_complete_mask;
2720 	struct acpi_generic_address cmd_update_register;
2721 	u64 cmd_update_preserve_mask;
2722 	u64 cmd_update_set_mask;
2723 	struct acpi_generic_address error_status_register;
2724 	u64 error_status_mask;
2725 };
2726 
2727 /* 5: HW Registers based Communications Subspace */
2728 
2729 struct acpi_pcct_hw_reg {
2730 	struct acpi_subtable_header header;
2731 	u16 version;
2732 	u64 base_address;
2733 	u64 length;
2734 	struct acpi_generic_address doorbell_register;
2735 	u64 doorbell_preserve;
2736 	u64 doorbell_write;
2737 	struct acpi_generic_address cmd_complete_register;
2738 	u64 cmd_complete_mask;
2739 	struct acpi_generic_address error_status_register;
2740 	u64 error_status_mask;
2741 	u32 nominal_latency;
2742 	u32 min_turnaround_time;
2743 };
2744 
2745 /* Values for doorbell flags above */
2746 
2747 #define ACPI_PCCT_INTERRUPT_POLARITY    (1)
2748 #define ACPI_PCCT_INTERRUPT_MODE        (1<<1)
2749 
2750 /*
2751  * PCC memory structures (not part of the ACPI table)
2752  */
2753 
2754 /* Shared Memory Region */
2755 
2756 struct acpi_pcct_shared_memory {
2757 	u32 signature;
2758 	u16 command;
2759 	u16 status;
2760 };
2761 
2762 /* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
2763 
2764 struct acpi_pcct_ext_pcc_shared_memory {
2765 	u32 signature;
2766 	u32 flags;
2767 	u32 length;
2768 	u32 command;
2769 };
2770 
2771 /*******************************************************************************
2772  *
2773  * PDTT - Platform Debug Trigger Table (ACPI 6.2)
2774  *        Version 0
2775  *
2776  ******************************************************************************/
2777 
2778 struct acpi_table_pdtt {
2779 	struct acpi_table_header header;	/* Common ACPI table header */
2780 	u8 trigger_count;
2781 	u8 reserved[3];
2782 	u32 array_offset;
2783 };
2784 
2785 /*
2786  * PDTT Communication Channel Identifier Structure.
2787  * The number of these structures is defined by trigger_count above,
2788  * starting at array_offset.
2789  */
2790 struct acpi_pdtt_channel {
2791 	u8 subchannel_id;
2792 	u8 flags;
2793 };
2794 
2795 /* Flags for above */
2796 
2797 #define ACPI_PDTT_RUNTIME_TRIGGER           (1)
2798 #define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
2799 #define ACPI_PDTT_TRIGGER_ORDER             (1<<2)
2800 
2801 /*******************************************************************************
2802  *
2803  * PHAT - Platform Health Assessment Table (ACPI 6.4)
2804  *        Version 1
2805  *
2806  ******************************************************************************/
2807 
2808 struct acpi_table_phat {
2809 	struct acpi_table_header header;	/* Common ACPI table header */
2810 };
2811 
2812 /* Common header for PHAT subtables that follow main table */
2813 
2814 struct acpi_phat_header {
2815 	u16 type;
2816 	u16 length;
2817 	u8 revision;
2818 };
2819 
2820 /* Values for Type field above */
2821 
2822 #define ACPI_PHAT_TYPE_FW_VERSION_DATA  0
2823 #define ACPI_PHAT_TYPE_FW_HEALTH_DATA   1
2824 #define ACPI_PHAT_TYPE_RESERVED         2	/* 0x02-0xFFFF are reserved */
2825 
2826 /*
2827  * PHAT subtables, correspond to Type in struct acpi_phat_header
2828  */
2829 
2830 /* 0: Firmware Version Data Record */
2831 
2832 struct acpi_phat_version_data {
2833 	struct acpi_phat_header header;
2834 	u8 reserved[3];
2835 	u32 element_count;
2836 };
2837 
2838 struct acpi_phat_version_element {
2839 	u8 guid[16];
2840 	u64 version_value;
2841 	u32 producer_id;
2842 };
2843 
2844 /* 1: Firmware Health Data Record */
2845 
2846 struct acpi_phat_health_data {
2847 	struct acpi_phat_header header;
2848 	u8 reserved[2];
2849 	u8 health;
2850 	u8 device_guid[16];
2851 	u32 device_specific_offset;	/* Zero if no Device-specific data */
2852 };
2853 
2854 /* Values for Health field above */
2855 
2856 #define ACPI_PHAT_ERRORS_FOUND          0
2857 #define ACPI_PHAT_NO_ERRORS             1
2858 #define ACPI_PHAT_UNKNOWN_ERRORS        2
2859 #define ACPI_PHAT_ADVISORY              3
2860 
2861 /*******************************************************************************
2862  *
2863  * PMTT - Platform Memory Topology Table (ACPI 5.0)
2864  *        Version 1
2865  *
2866  ******************************************************************************/
2867 
2868 struct acpi_table_pmtt {
2869 	struct acpi_table_header header;	/* Common ACPI table header */
2870 	u32 memory_device_count;
2871 	/*
2872 	 * Immediately followed by:
2873 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2874 	 */
2875 };
2876 
2877 /* Common header for PMTT subtables that follow main table */
2878 
2879 struct acpi_pmtt_header {
2880 	u8 type;
2881 	u8 reserved1;
2882 	u16 length;
2883 	u16 flags;
2884 	u16 reserved2;
2885 	u32 memory_device_count;	/* Zero means no memory device structs follow */
2886 	/*
2887 	 * Immediately followed by:
2888 	 * u8 type_specific_data[]
2889 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2890 	 */
2891 };
2892 
2893 /* Values for Type field above */
2894 
2895 #define ACPI_PMTT_TYPE_SOCKET           0
2896 #define ACPI_PMTT_TYPE_CONTROLLER       1
2897 #define ACPI_PMTT_TYPE_DIMM             2
2898 #define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFE are reserved */
2899 #define ACPI_PMTT_TYPE_VENDOR           0xFF
2900 
2901 /* Values for Flags field above */
2902 
2903 #define ACPI_PMTT_TOP_LEVEL             0x0001
2904 #define ACPI_PMTT_PHYSICAL              0x0002
2905 #define ACPI_PMTT_MEMORY_TYPE           0x000C
2906 
2907 /*
2908  * PMTT subtables, correspond to Type in struct acpi_pmtt_header
2909  */
2910 
2911 /* 0: Socket Structure */
2912 
2913 struct acpi_pmtt_socket {
2914 	struct acpi_pmtt_header header;
2915 	u16 socket_id;
2916 	u16 reserved;
2917 };
2918 	/*
2919 	 * Immediately followed by:
2920 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2921 	 */
2922 
2923 /* 1: Memory Controller subtable */
2924 
2925 struct acpi_pmtt_controller {
2926 	struct acpi_pmtt_header header;
2927 	u16 controller_id;
2928 	u16 reserved;
2929 };
2930 	/*
2931 	 * Immediately followed by:
2932 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2933 	 */
2934 
2935 /* 2: Physical Component Identifier (DIMM) */
2936 
2937 struct acpi_pmtt_physical_component {
2938 	struct acpi_pmtt_header header;
2939 	u32 bios_handle;
2940 };
2941 
2942 /* 0xFF: Vendor Specific Data */
2943 
2944 struct acpi_pmtt_vendor_specific {
2945 	struct acpi_pmtt_header header;
2946 	u8 type_uuid[16];
2947 	u8 specific[];
2948 	/*
2949 	 * Immediately followed by:
2950 	 * u8 vendor_specific_data[];
2951 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2952 	 */
2953 };
2954 
2955 /*******************************************************************************
2956  *
2957  * PPTT - Processor Properties Topology Table (ACPI 6.2)
2958  *        Version 1
2959  *
2960  ******************************************************************************/
2961 
2962 struct acpi_table_pptt {
2963 	struct acpi_table_header header;	/* Common ACPI table header */
2964 };
2965 
2966 /* Values for Type field above */
2967 
2968 enum acpi_pptt_type {
2969 	ACPI_PPTT_TYPE_PROCESSOR = 0,
2970 	ACPI_PPTT_TYPE_CACHE = 1,
2971 	ACPI_PPTT_TYPE_ID = 2,
2972 	ACPI_PPTT_TYPE_RESERVED = 3
2973 };
2974 
2975 /* 0: Processor Hierarchy Node Structure */
2976 
2977 struct acpi_pptt_processor {
2978 	struct acpi_subtable_header header;
2979 	u16 reserved;
2980 	u32 flags;
2981 	u32 parent;
2982 	u32 acpi_processor_id;
2983 	u32 number_of_priv_resources;
2984 };
2985 
2986 /* Flags */
2987 
2988 #define ACPI_PPTT_PHYSICAL_PACKAGE          (1)
2989 #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID   (1<<1)
2990 #define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD  (1<<2)	/* ACPI 6.3 */
2991 #define ACPI_PPTT_ACPI_LEAF_NODE            (1<<3)	/* ACPI 6.3 */
2992 #define ACPI_PPTT_ACPI_IDENTICAL            (1<<4)	/* ACPI 6.3 */
2993 
2994 /* 1: Cache Type Structure */
2995 
2996 struct acpi_pptt_cache {
2997 	struct acpi_subtable_header header;
2998 	u16 reserved;
2999 	u32 flags;
3000 	u32 next_level_of_cache;
3001 	u32 size;
3002 	u32 number_of_sets;
3003 	u8 associativity;
3004 	u8 attributes;
3005 	u16 line_size;
3006 };
3007 
3008 /* 1: Cache Type Structure for PPTT version 3 */
3009 
3010 struct acpi_pptt_cache_v1 {
3011 	struct acpi_subtable_header header;
3012 	u16 reserved;
3013 	u32 flags;
3014 	u32 next_level_of_cache;
3015 	u32 size;
3016 	u32 number_of_sets;
3017 	u8 associativity;
3018 	u8 attributes;
3019 	u16 line_size;
3020 	u32 cache_id;
3021 };
3022 
3023 /* Flags */
3024 
3025 #define ACPI_PPTT_SIZE_PROPERTY_VALID       (1)	/* Physical property valid */
3026 #define ACPI_PPTT_NUMBER_OF_SETS_VALID      (1<<1)	/* Number of sets valid */
3027 #define ACPI_PPTT_ASSOCIATIVITY_VALID       (1<<2)	/* Associativity valid */
3028 #define ACPI_PPTT_ALLOCATION_TYPE_VALID     (1<<3)	/* Allocation type valid */
3029 #define ACPI_PPTT_CACHE_TYPE_VALID          (1<<4)	/* Cache type valid */
3030 #define ACPI_PPTT_WRITE_POLICY_VALID        (1<<5)	/* Write policy valid */
3031 #define ACPI_PPTT_LINE_SIZE_VALID           (1<<6)	/* Line size valid */
3032 #define ACPI_PPTT_CACHE_ID_VALID            (1<<7)	/* Cache ID valid */
3033 
3034 /* Masks for Attributes */
3035 
3036 #define ACPI_PPTT_MASK_ALLOCATION_TYPE      (0x03)	/* Allocation type */
3037 #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)	/* Cache type */
3038 #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)	/* Write policy */
3039 
3040 /* Attributes describing cache */
3041 #define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)	/* Cache line is allocated on read */
3042 #define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)	/* Cache line is allocated on write */
3043 #define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)	/* Cache line is allocated on read and write */
3044 #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)	/* Alternate representation of above */
3045 
3046 #define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)	/* Data cache */
3047 #define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)	/* Instruction cache */
3048 #define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)	/* Unified I & D cache */
3049 #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)	/* Alternate representation of above */
3050 
3051 #define ACPI_PPTT_CACHE_POLICY_WB           (0x0)	/* Cache is write back */
3052 #define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)	/* Cache is write through */
3053 
3054 /* 2: ID Structure */
3055 
3056 struct acpi_pptt_id {
3057 	struct acpi_subtable_header header;
3058 	u16 reserved;
3059 	u32 vendor_id;
3060 	u64 level1_id;
3061 	u64 level2_id;
3062 	u16 major_rev;
3063 	u16 minor_rev;
3064 	u16 spin_rev;
3065 };
3066 
3067 /*******************************************************************************
3068  *
3069  * PRMT - Platform Runtime Mechanism Table
3070  *        Version 1
3071  *
3072  ******************************************************************************/
3073 
3074 struct acpi_table_prmt {
3075 	struct acpi_table_header header;	/* Common ACPI table header */
3076 };
3077 
3078 struct acpi_table_prmt_header {
3079 	u8 platform_guid[16];
3080 	u32 module_info_offset;
3081 	u32 module_info_count;
3082 };
3083 
3084 struct acpi_prmt_module_header {
3085 	u16 revision;
3086 	u16 length;
3087 };
3088 
3089 struct acpi_prmt_module_info {
3090 	u16 revision;
3091 	u16 length;
3092 	u8 module_guid[16];
3093 	u16 major_rev;
3094 	u16 minor_rev;
3095 	u16 handler_info_count;
3096 	u32 handler_info_offset;
3097 	u64 mmio_list_pointer;
3098 };
3099 
3100 struct acpi_prmt_handler_info {
3101 	u16 revision;
3102 	u16 length;
3103 	u8 handler_guid[16];
3104 	u64 handler_address;
3105 	u64 static_data_buffer_address;
3106 	u64 acpi_param_buffer_address;
3107 };
3108 
3109 /*******************************************************************************
3110  *
3111  * RASF - RAS Feature Table (ACPI 5.0)
3112  *        Version 1
3113  *
3114  ******************************************************************************/
3115 
3116 struct acpi_table_rasf {
3117 	struct acpi_table_header header;	/* Common ACPI table header */
3118 	u8 channel_id[12];
3119 };
3120 
3121 /* RASF Platform Communication Channel Shared Memory Region */
3122 
3123 struct acpi_rasf_shared_memory {
3124 	u32 signature;
3125 	u16 command;
3126 	u16 status;
3127 	u16 version;
3128 	u8 capabilities[16];
3129 	u8 set_capabilities[16];
3130 	u16 num_parameter_blocks;
3131 	u32 set_capabilities_status;
3132 };
3133 
3134 /* RASF Parameter Block Structure Header */
3135 
3136 struct acpi_rasf_parameter_block {
3137 	u16 type;
3138 	u16 version;
3139 	u16 length;
3140 };
3141 
3142 /* RASF Parameter Block Structure for PATROL_SCRUB */
3143 
3144 struct acpi_rasf_patrol_scrub_parameter {
3145 	struct acpi_rasf_parameter_block header;
3146 	u16 patrol_scrub_command;
3147 	u64 requested_address_range[2];
3148 	u64 actual_address_range[2];
3149 	u16 flags;
3150 	u8 requested_speed;
3151 };
3152 
3153 /* Masks for Flags and Speed fields above */
3154 
3155 #define ACPI_RASF_SCRUBBER_RUNNING      1
3156 #define ACPI_RASF_SPEED                 (7<<1)
3157 #define ACPI_RASF_SPEED_SLOW            (0<<1)
3158 #define ACPI_RASF_SPEED_MEDIUM          (4<<1)
3159 #define ACPI_RASF_SPEED_FAST            (7<<1)
3160 
3161 /* Channel Commands */
3162 
3163 enum acpi_rasf_commands {
3164 	ACPI_RASF_EXECUTE_RASF_COMMAND = 1
3165 };
3166 
3167 /* Platform RAS Capabilities */
3168 
3169 enum acpi_rasf_capabiliities {
3170 	ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
3171 	ACPI_SW_PATROL_SCRUB_EXPOSED = 1
3172 };
3173 
3174 /* Patrol Scrub Commands */
3175 
3176 enum acpi_rasf_patrol_scrub_commands {
3177 	ACPI_RASF_GET_PATROL_PARAMETERS = 1,
3178 	ACPI_RASF_START_PATROL_SCRUBBER = 2,
3179 	ACPI_RASF_STOP_PATROL_SCRUBBER = 3
3180 };
3181 
3182 /* Channel Command flags */
3183 
3184 #define ACPI_RASF_GENERATE_SCI          (1<<15)
3185 
3186 /* Status values */
3187 
3188 enum acpi_rasf_status {
3189 	ACPI_RASF_SUCCESS = 0,
3190 	ACPI_RASF_NOT_VALID = 1,
3191 	ACPI_RASF_NOT_SUPPORTED = 2,
3192 	ACPI_RASF_BUSY = 3,
3193 	ACPI_RASF_FAILED = 4,
3194 	ACPI_RASF_ABORTED = 5,
3195 	ACPI_RASF_INVALID_DATA = 6
3196 };
3197 
3198 /* Status flags */
3199 
3200 #define ACPI_RASF_COMMAND_COMPLETE      (1)
3201 #define ACPI_RASF_SCI_DOORBELL          (1<<1)
3202 #define ACPI_RASF_ERROR                 (1<<2)
3203 #define ACPI_RASF_STATUS                (0x1F<<3)
3204 
3205 /*******************************************************************************
3206  *
3207  * RAS2 - RAS2 Feature Table (ACPI 6.5)
3208  *        Version 1
3209  *
3210  *
3211  ******************************************************************************/
3212 
3213 struct acpi_table_ras2 {
3214 	struct acpi_table_header header;	/* Common ACPI table header */
3215 	u16 reserved;
3216 	u16 num_pcc_descs;
3217 };
3218 
3219 /* RAS2 Platform Communication Channel Descriptor */
3220 
3221 struct acpi_ras2_pcc_desc {
3222 	u8 channel_id;
3223 	u16 reserved;
3224 	u8 feature_type;
3225 	u32 instance;
3226 };
3227 
3228 /* RAS2 Platform Communication Channel Shared Memory Region */
3229 
3230 struct acpi_ras2_shmem {
3231 	u32 signature;
3232 	u16 command;
3233 	u16 status;
3234 	u16 version;
3235 	u8 features[16];
3236 	u8 set_caps[16];
3237 	u16 num_param_blks;
3238 	u32 set_caps_status;
3239 };
3240 
3241 /* RAS2 Parameter Block Structure for PATROL_SCRUB */
3242 
3243 struct acpi_ras2_parameter_block {
3244 	u16 type;
3245 	u16 version;
3246 	u16 length;
3247 };
3248 
3249 /* RAS2 Parameter Block Structure for PATROL_SCRUB */
3250 
3251 struct acpi_ras2_patrol_scrub_param {
3252 	struct acpi_ras2_parameter_block header;
3253 	u16 command;
3254 	u64 req_addr_range[2];
3255 	u64 actl_addr_range[2];
3256 	u32 flags;
3257 	u32 scrub_params_out;
3258 	u32 scrub_params_in;
3259 	u32 ext_scrub_params;
3260 	u8 scrub_rate_desc[256];
3261 };
3262 
3263 /* Masks for Flags field above */
3264 
3265 #define ACPI_RAS2_SCRUBBER_RUNNING      1
3266 
3267 /* RAS2 Parameter Block Structure for LA2PA_TRANSLATION */
3268 
3269 struct acpi_ras2_la2pa_translation_parameter {
3270 	struct acpi_ras2_parameter_block header;
3271 	u16 addr_translation_command;
3272 	u64 sub_inst_id;
3273 	u64 logical_address;
3274 	u64 physical_address;
3275 	u32 status;
3276 };
3277 
3278 /* Channel Commands */
3279 
3280 enum acpi_ras2_commands {
3281 	ACPI_RAS2_EXECUTE_RAS2_COMMAND = 1
3282 };
3283 
3284 /* Platform RAS2 Features */
3285 
3286 enum acpi_ras2_features {
3287 	ACPI_RAS2_PATROL_SCRUB_SUPPORTED = 0,
3288 	ACPI_RAS2_LA2PA_TRANSLATION = 1
3289 };
3290 
3291 /* RAS2 Patrol Scrub Commands */
3292 
3293 enum acpi_ras2_patrol_scrub_commands {
3294 	ACPI_RAS2_GET_PATROL_PARAMETERS = 1,
3295 	ACPI_RAS2_START_PATROL_SCRUBBER = 2,
3296 	ACPI_RAS2_STOP_PATROL_SCRUBBER = 3
3297 };
3298 
3299 /* RAS2 LA2PA Translation Commands */
3300 
3301 enum acpi_ras2_la2_pa_translation_commands {
3302 	ACPI_RAS2_GET_LA2PA_TRANSLATION = 1,
3303 };
3304 
3305 /* RAS2 LA2PA Translation Status values */
3306 
3307 enum acpi_ras2_la2_pa_translation_status {
3308 	ACPI_RAS2_LA2PA_TRANSLATION_SUCCESS = 0,
3309 	ACPI_RAS2_LA2PA_TRANSLATION_FAIL = 1,
3310 };
3311 
3312 /* Channel Command flags */
3313 
3314 #define ACPI_RAS2_GENERATE_SCI          (1<<15)
3315 
3316 /* Status values */
3317 
3318 enum acpi_ras2_status {
3319 	ACPI_RAS2_SUCCESS = 0,
3320 	ACPI_RAS2_NOT_VALID = 1,
3321 	ACPI_RAS2_NOT_SUPPORTED = 2,
3322 	ACPI_RAS2_BUSY = 3,
3323 	ACPI_RAS2_FAILED = 4,
3324 	ACPI_RAS2_ABORTED = 5,
3325 	ACPI_RAS2_INVALID_DATA = 6
3326 };
3327 
3328 /* Status flags */
3329 
3330 #define ACPI_RAS2_COMMAND_COMPLETE      (1)
3331 #define ACPI_RAS2_SCI_DOORBELL          (1<<1)
3332 #define ACPI_RAS2_ERROR                 (1<<2)
3333 #define ACPI_RAS2_STATUS                (0x1F<<3)
3334 
3335 /*******************************************************************************
3336  *
3337  * RGRT - Regulatory Graphics Resource Table
3338  *        Version 1
3339  *
3340  * Conforms to "ACPI RGRT" available at:
3341  * https://microsoft.github.io/mu/dyn/mu_plus/ms_core_pkg/acpi_RGRT/feature_acpi_rgrt/
3342  *
3343  ******************************************************************************/
3344 
3345 struct acpi_table_rgrt {
3346 	struct acpi_table_header header;	/* Common ACPI table header */
3347 	u16 version;
3348 	u8 image_type;
3349 	u8 reserved;
3350 	u8 image[];
3351 };
3352 
3353 /* image_type values */
3354 
3355 enum acpi_rgrt_image_type {
3356 	ACPI_RGRT_TYPE_RESERVED0 = 0,
3357 	ACPI_RGRT_IMAGE_TYPE_PNG = 1,
3358 	ACPI_RGRT_TYPE_RESERVED = 2	/* 2 and greater are reserved */
3359 };
3360 
3361 /*******************************************************************************
3362  *
3363  * RHCT - RISC-V Hart Capabilities Table
3364  *        Version 1
3365  *
3366  ******************************************************************************/
3367 
3368 struct acpi_table_rhct {
3369 	struct acpi_table_header header;	/* Common ACPI table header */
3370 	u32 flags;		/* RHCT flags */
3371 	u64 time_base_freq;
3372 	u32 node_count;
3373 	u32 node_offset;
3374 };
3375 
3376 /* RHCT Flags */
3377 
3378 #define ACPI_RHCT_TIMER_CANNOT_WAKEUP_CPU       (1)
3379 /*
3380  * RHCT subtables
3381  */
3382 struct acpi_rhct_node_header {
3383 	u16 type;
3384 	u16 length;
3385 	u16 revision;
3386 };
3387 
3388 /* Values for RHCT subtable Type above */
3389 
3390 enum acpi_rhct_node_type {
3391 	ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000,
3392 	ACPI_RHCT_NODE_TYPE_CMO = 0x0001,
3393 	ACPI_RHCT_NODE_TYPE_MMU = 0x0002,
3394 	ACPI_RHCT_NODE_TYPE_RESERVED = 0x0003,
3395 	ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF,
3396 };
3397 
3398 /*
3399  * RHCT node specific subtables
3400  */
3401 
3402 /* ISA string node structure */
3403 struct acpi_rhct_isa_string {
3404 	u16 isa_length;
3405 	char isa[];
3406 };
3407 
3408 struct acpi_rhct_cmo_node {
3409 	u8 reserved;		/* Must be zero */
3410 	u8 cbom_size;		/* CBOM size in powerof 2 */
3411 	u8 cbop_size;		/* CBOP size in powerof 2 */
3412 	u8 cboz_size;		/* CBOZ size in powerof 2 */
3413 };
3414 
3415 struct acpi_rhct_mmu_node {
3416 	u8 reserved;		/* Must be zero */
3417 	u8 mmu_type;		/* Virtual Address Scheme */
3418 };
3419 
3420 enum acpi_rhct_mmu_type {
3421 	ACPI_RHCT_MMU_TYPE_SV39 = 0,
3422 	ACPI_RHCT_MMU_TYPE_SV48 = 1,
3423 	ACPI_RHCT_MMU_TYPE_SV57 = 2
3424 };
3425 
3426 /* Hart Info node structure */
3427 struct acpi_rhct_hart_info {
3428 	u16 num_offsets;
3429 	u32 uid;		/* ACPI processor UID */
3430 };
3431 
3432 /*******************************************************************************
3433  *
3434  * RIMT - RISC-V IO Remapping Table
3435  *
3436  * https://github.com/riscv-non-isa/riscv-acpi-rimt
3437  *
3438  ******************************************************************************/
3439 
3440 struct acpi_table_rimt {
3441 	struct acpi_table_header header;	/* Common ACPI table header */
3442 	u32 num_nodes;		/* Number of RIMT Nodes */
3443 	u32 node_offset;	/* Offset to RIMT Node Array */
3444 	u32 reserved;
3445 };
3446 
3447 struct acpi_rimt_node {
3448 	u8 type;
3449 	u8 revision;
3450 	u16 length;
3451 	u16 reserved;
3452 	u16 id;
3453 	char node_data[];
3454 };
3455 
3456 enum acpi_rimt_node_type {
3457 	ACPI_RIMT_NODE_TYPE_IOMMU = 0x0,
3458 	ACPI_RIMT_NODE_TYPE_PCIE_ROOT_COMPLEX = 0x1,
3459 	ACPI_RIMT_NODE_TYPE_PLAT_DEVICE = 0x2,
3460 };
3461 
3462 struct acpi_rimt_iommu {
3463 	u8 hardware_id[8];	/* Hardware ID */
3464 	u64 base_address;	/* Base Address */
3465 	u32 flags;		/* Flags */
3466 	u32 proximity_domain;	/* Proximity Domain */
3467 	u16 pcie_segment_number;	/* PCIe Segment number */
3468 	u16 pcie_bdf;		/* PCIe B/D/F */
3469 	u16 num_interrupt_wires;	/* Number of interrupt wires */
3470 	u16 interrupt_wire_offset;	/* Interrupt wire array offset */
3471 	u64 interrupt_wire[];	/* Interrupt wire array */
3472 };
3473 
3474 /* IOMMU Node Flags */
3475 #define ACPI_RIMT_IOMMU_FLAGS_PCIE      (1)
3476 #define ACPI_RIMT_IOMMU_FLAGS_PXM_VALID (1 << 1)
3477 
3478 /* Interrupt Wire Structure */
3479 struct acpi_rimt_iommu_wire_gsi {
3480 	u32 irq_num;		/* Interrupt Number */
3481 	u32 flags;		/* Flags */
3482 };
3483 
3484 /* Interrupt Wire Flags */
3485 #define ACPI_RIMT_GSI_LEVEL_TRIGGERRED  (1)
3486 #define ACPI_RIMT_GSI_ACTIVE_HIGH       (1 << 1)
3487 
3488 struct acpi_rimt_id_mapping {
3489 	u32 source_id_base;	/* Source ID Base */
3490 	u32 num_ids;		/* Number of IDs */
3491 	u32 dest_id_base;	/* Destination Device ID Base */
3492 	u32 dest_offset;	/* Destination IOMMU Offset */
3493 	u32 flags;		/* Flags */
3494 };
3495 
3496 struct acpi_rimt_pcie_rc {
3497 	u32 flags;		/* Flags */
3498 	u16 reserved;		/* Reserved */
3499 	u16 pcie_segment_number;	/* PCIe Segment number */
3500 	u16 id_mapping_offset;	/* ID mapping array offset */
3501 	u16 num_id_mappings;	/* Number of ID mappings */
3502 };
3503 
3504 /* PCIe Root Complex Node Flags */
3505 #define ACPI_RIMT_PCIE_ATS_SUPPORTED   (1)
3506 #define ACPI_RIMT_PCIE_PRI_SUPPORTED   (1 << 1)
3507 
3508 struct acpi_rimt_platform_device {
3509 	u16 id_mapping_offset;	/* ID Mapping array offset */
3510 	u16 num_id_mappings;	/* Number of ID mappings */
3511 	char device_name[];	/* Device Object Name */
3512 };
3513 
3514 /*******************************************************************************
3515  *
3516  * SBST - Smart Battery Specification Table
3517  *        Version 1
3518  *
3519  ******************************************************************************/
3520 
3521 struct acpi_table_sbst {
3522 	struct acpi_table_header header;	/* Common ACPI table header */
3523 	u32 warning_level;
3524 	u32 low_level;
3525 	u32 critical_level;
3526 };
3527 
3528 /*******************************************************************************
3529  *
3530  * SDEI - Software Delegated Exception Interface Descriptor Table
3531  *
3532  * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
3533  * May 8th, 2017. Copyright 2017 ARM Ltd.
3534  *
3535  ******************************************************************************/
3536 
3537 struct acpi_table_sdei {
3538 	struct acpi_table_header header;	/* Common ACPI table header */
3539 };
3540 
3541 /*******************************************************************************
3542  *
3543  * SDEV - Secure Devices Table (ACPI 6.2)
3544  *        Version 1
3545  *
3546  ******************************************************************************/
3547 
3548 struct acpi_table_sdev {
3549 	struct acpi_table_header header;	/* Common ACPI table header */
3550 };
3551 
3552 struct acpi_sdev_header {
3553 	u8 type;
3554 	u8 flags;
3555 	u16 length;
3556 };
3557 
3558 /* Values for subtable type above */
3559 
3560 enum acpi_sdev_type {
3561 	ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
3562 	ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
3563 	ACPI_SDEV_TYPE_RESERVED = 2	/* 2 and greater are reserved */
3564 };
3565 
3566 /* Values for flags above */
3567 
3568 #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
3569 #define ACPI_SDEV_SECURE_COMPONENTS_PRESENT (1<<1)
3570 
3571 /*
3572  * SDEV subtables
3573  */
3574 
3575 /* 0: Namespace Device Based Secure Device Structure */
3576 
3577 struct acpi_sdev_namespace {
3578 	struct acpi_sdev_header header;
3579 	u16 device_id_offset;
3580 	u16 device_id_length;
3581 	u16 vendor_data_offset;
3582 	u16 vendor_data_length;
3583 };
3584 
3585 struct acpi_sdev_secure_component {
3586 	u16 secure_component_offset;
3587 	u16 secure_component_length;
3588 };
3589 
3590 /*
3591  * SDEV sub-subtables ("Components") for above
3592  */
3593 struct acpi_sdev_component {
3594 	struct acpi_sdev_header header;
3595 };
3596 
3597 /* Values for sub-subtable type above */
3598 
3599 enum acpi_sac_type {
3600 	ACPI_SDEV_TYPE_ID_COMPONENT = 0,
3601 	ACPI_SDEV_TYPE_MEM_COMPONENT = 1
3602 };
3603 
3604 struct acpi_sdev_id_component {
3605 	struct acpi_sdev_header header;
3606 	u16 hardware_id_offset;
3607 	u16 hardware_id_length;
3608 	u16 subsystem_id_offset;
3609 	u16 subsystem_id_length;
3610 	u16 hardware_revision;
3611 	u8 hardware_rev_present;
3612 	u8 class_code_present;
3613 	u8 pci_base_class;
3614 	u8 pci_sub_class;
3615 	u8 pci_programming_xface;
3616 };
3617 
3618 struct acpi_sdev_mem_component {
3619 	struct acpi_sdev_header header;
3620 	u32 reserved;
3621 	u64 memory_base_address;
3622 	u64 memory_length;
3623 };
3624 
3625 /* 1: PCIe Endpoint Device Based Device Structure */
3626 
3627 struct acpi_sdev_pcie {
3628 	struct acpi_sdev_header header;
3629 	u16 segment;
3630 	u16 start_bus;
3631 	u16 path_offset;
3632 	u16 path_length;
3633 	u16 vendor_data_offset;
3634 	u16 vendor_data_length;
3635 };
3636 
3637 /* 1a: PCIe Endpoint path entry */
3638 
3639 struct acpi_sdev_pcie_path {
3640 	u8 device;
3641 	u8 function;
3642 };
3643 
3644 /*******************************************************************************
3645  *
3646  * SVKL - Storage Volume Key Location Table (ACPI 6.4)
3647  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
3648  *        Trust Domain Extensions (Intel TDX)".
3649  *        Version 1
3650  *
3651  ******************************************************************************/
3652 
3653 struct acpi_table_svkl {
3654 	struct acpi_table_header header;	/* Common ACPI table header */
3655 	u32 count;
3656 };
3657 
3658 struct acpi_svkl_key {
3659 	u16 type;
3660 	u16 format;
3661 	u32 size;
3662 	u64 address;
3663 };
3664 
3665 enum acpi_svkl_type {
3666 	ACPI_SVKL_TYPE_MAIN_STORAGE = 0,
3667 	ACPI_SVKL_TYPE_RESERVED = 1	/* 1 and greater are reserved */
3668 };
3669 
3670 enum acpi_svkl_format {
3671 	ACPI_SVKL_FORMAT_RAW_BINARY = 0,
3672 	ACPI_SVKL_FORMAT_RESERVED = 1	/* 1 and greater are reserved */
3673 };
3674 
3675 /*******************************************************************************
3676  * SWFT - SoundWire File Table
3677  *
3678  * Conforms to "Discovery and Configuration (DisCo) Specification for SoundWire"
3679  * Version 2.1, 2 October 2023
3680  *
3681  ******************************************************************************/
3682 struct acpi_sw_file {
3683 	u16 vendor_id;
3684 	u32 file_id;
3685 	u16 file_version;
3686 	u32 file_length;
3687 	u8 data[];
3688 };
3689 
3690 struct acpi_table_swft {
3691 	struct acpi_table_header header;
3692 	struct acpi_sw_file files[];
3693 };
3694 
3695 /*******************************************************************************
3696  *
3697  * TDEL - TD-Event Log
3698  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
3699  *        Trust Domain Extensions (Intel TDX)".
3700  *        September 2020
3701  *
3702  ******************************************************************************/
3703 
3704 struct acpi_table_tdel {
3705 	struct acpi_table_header header;	/* Common ACPI table header */
3706 	u32 reserved;
3707 	u64 log_area_minimum_length;
3708 	u64 log_area_start_address;
3709 };
3710 
3711 /* Reset to default packing */
3712 
3713 #pragma pack()
3714 
3715 #endif				/* __ACTBL2_H__ */
3716