xref: /openbmc/linux/include/acpi/actbl2.h (revision fe85f8ff)
195857638SErik Schmauss /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2a8357b0cSBob Moore /******************************************************************************
3a8357b0cSBob Moore  *
45cf4d733SBob Moore  * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
5a8357b0cSBob Moore  *
6612c2932SBob Moore  * Copyright (C) 2000 - 2023, Intel Corp.
7a8357b0cSBob Moore  *
895857638SErik Schmauss  *****************************************************************************/
9a8357b0cSBob Moore 
10b24aad44SBob Moore #ifndef __ACTBL2_H__
11b24aad44SBob Moore #define __ACTBL2_H__
12b24aad44SBob Moore 
13b24aad44SBob Moore /*******************************************************************************
14b24aad44SBob Moore  *
15b24aad44SBob Moore  * Additional ACPI Tables (2)
16b24aad44SBob Moore  *
17b24aad44SBob Moore  * These tables are not consumed directly by the ACPICA subsystem, but are
18b24aad44SBob Moore  * included here to support device drivers and the AML disassembler.
19b24aad44SBob Moore  *
20b24aad44SBob Moore  ******************************************************************************/
21b24aad44SBob Moore 
22b24aad44SBob Moore /*
236e2d5ebdSBob Moore  * Values for description table header signatures for tables defined in this
246e2d5ebdSBob Moore  * file. Useful because they make it more difficult to inadvertently type in
256e2d5ebdSBob Moore  * the wrong signature.
26b24aad44SBob Moore  */
275579649eSIlkka Koskinen #define ACPI_SIG_AGDI           "AGDI"	/* Arm Generic Diagnostic Dump and Reset Device Interface */
281c5d62f5SBesar Wicaksono #define ACPI_SIG_APMT           "APMT"	/* Arm Performance Monitoring Unit table */
299401eafaSBob Moore #define ACPI_SIG_BDAT           "BDAT"	/* BIOS Data ACPI Table */
30407144ebSKuppuswamy Sathyanarayanan #define ACPI_SIG_CCEL           "CCEL"	/* CC Event Log Table */
3151aad1a6SBob Moore #define ACPI_SIG_CDAT           "CDAT"	/* Coherent Device Attribute Table */
32874f6a72SLv Zheng #define ACPI_SIG_IORT           "IORT"	/* IO Remapping Table */
336e2d5ebdSBob Moore #define ACPI_SIG_IVRS           "IVRS"	/* I/O Virtualization Reporting Structure */
34d36d4e30SBob Moore #define ACPI_SIG_LPIT           "LPIT"	/* Low Power Idle Table */
35e62f8227SErik Schmauss #define ACPI_SIG_MADT           "APIC"	/* Multiple APIC Description Table */
36b24aad44SBob Moore #define ACPI_SIG_MCFG           "MCFG"	/* PCI Memory Mapped Configuration table */
370e264f0bSBob Moore #define ACPI_SIG_MCHI           "MCHI"	/* Management Controller Host Interface table */
3847920aaeSHesham Almatary #define ACPI_SIG_MPAM           "MPAM"	/* Memory System Resource Partitioning and Monitoring Table */
39e62f8227SErik Schmauss #define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */
405132f2faSBob Moore #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
41e62f8227SErik Schmauss #define ACPI_SIG_NFIT           "NFIT"	/* NVDIMM Firmware Interface Table */
42a805aab8SBob Moore #define ACPI_SIG_NHLT           "NHLT"	/* Non HD Audio Link Table */
43e62f8227SErik Schmauss #define ACPI_SIG_PCCT           "PCCT"	/* Platform Communications Channel Table */
44e62f8227SErik Schmauss #define ACPI_SIG_PDTT           "PDTT"	/* Platform Debug Trigger Table */
459f400337SErik Kaneda #define ACPI_SIG_PHAT           "PHAT"	/* Platform Health Assessment Table */
46e62f8227SErik Schmauss #define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
47e62f8227SErik Schmauss #define ACPI_SIG_PPTT           "PPTT"	/* Processor Properties Topology Table */
48d71df85aSErik Kaneda #define ACPI_SIG_PRMT           "PRMT"	/* Platform Runtime Mechanism Table */
49e62f8227SErik Schmauss #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
50536e35c9SBob Moore #define ACPI_SIG_RGRT           "RGRT"	/* Regulatory Graphics Resource Table */
51003567a3SSunil V L #define ACPI_SIG_RHCT           "RHCT"	/* RISC-V Hart Capabilities Table */
52e62f8227SErik Schmauss #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */
533bd38469SJames Morse #define ACPI_SIG_SDEI           "SDEI"	/* Software Delegated Exception Interface Table */
54e62f8227SErik Schmauss #define ACPI_SIG_SDEV           "SDEV"	/* Secure Devices table */
558288f69eSKuppuswamy Sathyanarayanan #define ACPI_SIG_SVKL           "SVKL"	/* Storage Volume Key Location Table */
562de6bb92SBob Moore #define ACPI_SIG_TDEL           "TDEL"	/* TD Event Log Table */
574461cf54SBob Moore 
58b24aad44SBob Moore /*
59b24aad44SBob Moore  * All tables must be byte-packed to match the ACPI specification, since
60b24aad44SBob Moore  * the tables are provided by the system BIOS.
61b24aad44SBob Moore  */
62b24aad44SBob Moore #pragma pack(1)
63b24aad44SBob Moore 
64b24aad44SBob Moore /*
65be030a57SBob Moore  * Note: C bitfields are not used for this reason:
66be030a57SBob Moore  *
67be030a57SBob Moore  * "Bitfields are great and easy to read, but unfortunately the C language
68be030a57SBob Moore  * does not specify the layout of bitfields in memory, which means they are
69be030a57SBob Moore  * essentially useless for dealing with packed data in on-disk formats or
70be030a57SBob Moore  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
71be030a57SBob Moore  * this decision was a design error in C. Ritchie could have picked an order
72be030a57SBob Moore  * and stuck with it." Norman Ramsey.
73be030a57SBob Moore  * See http://stackoverflow.com/a/1053662/41661
74b24aad44SBob Moore  */
75b24aad44SBob Moore 
76b24aad44SBob Moore /*******************************************************************************
77b24aad44SBob Moore  *
78e692fa13SBob Moore  * AEST - Arm Error Source Table
79e692fa13SBob Moore  *
80e692fa13SBob Moore  * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
81e692fa13SBob Moore  * September 2020.
82e692fa13SBob Moore  *
83e692fa13SBob Moore  ******************************************************************************/
84e692fa13SBob Moore 
85e692fa13SBob Moore struct acpi_table_aest {
86e692fa13SBob Moore 	struct acpi_table_header header;
87e692fa13SBob Moore };
88e692fa13SBob Moore 
89e692fa13SBob Moore /* Common Subtable header - one per Node Structure (Subtable) */
90e692fa13SBob Moore 
91e692fa13SBob Moore struct acpi_aest_hdr {
92e692fa13SBob Moore 	u8 type;
93e692fa13SBob Moore 	u16 length;
94e692fa13SBob Moore 	u8 reserved;
95e692fa13SBob Moore 	u32 node_specific_offset;
96e692fa13SBob Moore 	u32 node_interface_offset;
97e692fa13SBob Moore 	u32 node_interrupt_offset;
98e692fa13SBob Moore 	u32 node_interrupt_count;
99e692fa13SBob Moore 	u64 timestamp_rate;
100e692fa13SBob Moore 	u64 reserved1;
101e692fa13SBob Moore 	u64 error_injection_rate;
102e692fa13SBob Moore };
103e692fa13SBob Moore 
104e692fa13SBob Moore /* Values for Type above */
105e692fa13SBob Moore 
106e692fa13SBob Moore #define ACPI_AEST_PROCESSOR_ERROR_NODE      0
107e692fa13SBob Moore #define ACPI_AEST_MEMORY_ERROR_NODE         1
108e692fa13SBob Moore #define ACPI_AEST_SMMU_ERROR_NODE           2
109e692fa13SBob Moore #define ACPI_AEST_VENDOR_ERROR_NODE         3
110e692fa13SBob Moore #define ACPI_AEST_GIC_ERROR_NODE            4
111e692fa13SBob Moore #define ACPI_AEST_NODE_TYPE_RESERVED        5	/* 5 and above are reserved */
112e692fa13SBob Moore 
113e692fa13SBob Moore /*
114e692fa13SBob Moore  * AEST subtables (Error nodes)
115e692fa13SBob Moore  */
116e692fa13SBob Moore 
117e692fa13SBob Moore /* 0: Processor Error */
118e692fa13SBob Moore 
119e692fa13SBob Moore typedef struct acpi_aest_processor {
120e692fa13SBob Moore 	u32 processor_id;
121e692fa13SBob Moore 	u8 resource_type;
122e692fa13SBob Moore 	u8 reserved;
123e692fa13SBob Moore 	u8 flags;
124e692fa13SBob Moore 	u8 revision;
125e692fa13SBob Moore 	u64 processor_affinity;
126e692fa13SBob Moore 
127e692fa13SBob Moore } acpi_aest_processor;
128e692fa13SBob Moore 
129e692fa13SBob Moore /* Values for resource_type above, related structs below */
130e692fa13SBob Moore 
131e692fa13SBob Moore #define ACPI_AEST_CACHE_RESOURCE            0
132e692fa13SBob Moore #define ACPI_AEST_TLB_RESOURCE              1
133e692fa13SBob Moore #define ACPI_AEST_GENERIC_RESOURCE          2
134e692fa13SBob Moore #define ACPI_AEST_RESOURCE_RESERVED         3	/* 3 and above are reserved */
135e692fa13SBob Moore 
136e692fa13SBob Moore /* 0R: Processor Cache Resource Substructure */
137e692fa13SBob Moore 
138e692fa13SBob Moore typedef struct acpi_aest_processor_cache {
139e692fa13SBob Moore 	u32 cache_reference;
140e692fa13SBob Moore 	u32 reserved;
141e692fa13SBob Moore 
142e692fa13SBob Moore } acpi_aest_processor_cache;
143e692fa13SBob Moore 
144e692fa13SBob Moore /* Values for cache_type above */
145e692fa13SBob Moore 
146e692fa13SBob Moore #define ACPI_AEST_CACHE_DATA                0
147e692fa13SBob Moore #define ACPI_AEST_CACHE_INSTRUCTION         1
148e692fa13SBob Moore #define ACPI_AEST_CACHE_UNIFIED             2
149e692fa13SBob Moore #define ACPI_AEST_CACHE_RESERVED            3	/* 3 and above are reserved */
150e692fa13SBob Moore 
151e692fa13SBob Moore /* 1R: Processor TLB Resource Substructure */
152e692fa13SBob Moore 
153e692fa13SBob Moore typedef struct acpi_aest_processor_tlb {
154e692fa13SBob Moore 	u32 tlb_level;
155e692fa13SBob Moore 	u32 reserved;
156e692fa13SBob Moore 
157e692fa13SBob Moore } acpi_aest_processor_tlb;
158e692fa13SBob Moore 
159e692fa13SBob Moore /* 2R: Processor Generic Resource Substructure */
160e692fa13SBob Moore 
161e692fa13SBob Moore typedef struct acpi_aest_processor_generic {
16200395b74SShuuichirou Ishii 	u32 resource;
163e692fa13SBob Moore 
164e692fa13SBob Moore } acpi_aest_processor_generic;
165e692fa13SBob Moore 
166e692fa13SBob Moore /* 1: Memory Error */
167e692fa13SBob Moore 
168e692fa13SBob Moore typedef struct acpi_aest_memory {
169e692fa13SBob Moore 	u32 srat_proximity_domain;
170e692fa13SBob Moore 
171e692fa13SBob Moore } acpi_aest_memory;
172e692fa13SBob Moore 
173e692fa13SBob Moore /* 2: Smmu Error */
174e692fa13SBob Moore 
175e692fa13SBob Moore typedef struct acpi_aest_smmu {
176e692fa13SBob Moore 	u32 iort_node_reference;
177e692fa13SBob Moore 	u32 subcomponent_reference;
178e692fa13SBob Moore 
179e692fa13SBob Moore } acpi_aest_smmu;
180e692fa13SBob Moore 
181e692fa13SBob Moore /* 3: Vendor Defined */
182e692fa13SBob Moore 
183e692fa13SBob Moore typedef struct acpi_aest_vendor {
184e692fa13SBob Moore 	u32 acpi_hid;
185e692fa13SBob Moore 	u32 acpi_uid;
186e692fa13SBob Moore 	u8 vendor_specific_data[16];
187e692fa13SBob Moore 
188e692fa13SBob Moore } acpi_aest_vendor;
189e692fa13SBob Moore 
190e692fa13SBob Moore /* 4: Gic Error */
191e692fa13SBob Moore 
192e692fa13SBob Moore typedef struct acpi_aest_gic {
193e692fa13SBob Moore 	u32 interface_type;
194e692fa13SBob Moore 	u32 instance_id;
195e692fa13SBob Moore 
196e692fa13SBob Moore } acpi_aest_gic;
197e692fa13SBob Moore 
198e692fa13SBob Moore /* Values for interface_type above */
199e692fa13SBob Moore 
200e692fa13SBob Moore #define ACPI_AEST_GIC_CPU                   0
201e692fa13SBob Moore #define ACPI_AEST_GIC_DISTRIBUTOR           1
202e692fa13SBob Moore #define ACPI_AEST_GIC_REDISTRIBUTOR         2
203e692fa13SBob Moore #define ACPI_AEST_GIC_ITS                   3
204e692fa13SBob Moore #define ACPI_AEST_GIC_RESERVED              4	/* 4 and above are reserved */
205e692fa13SBob Moore 
206e692fa13SBob Moore /* Node Interface Structure */
207e692fa13SBob Moore 
208e692fa13SBob Moore typedef struct acpi_aest_node_interface {
209e692fa13SBob Moore 	u8 type;
210e692fa13SBob Moore 	u8 reserved[3];
211e692fa13SBob Moore 	u32 flags;
212e692fa13SBob Moore 	u64 address;
213e692fa13SBob Moore 	u32 error_record_index;
214e692fa13SBob Moore 	u32 error_record_count;
215e692fa13SBob Moore 	u64 error_record_implemented;
216e692fa13SBob Moore 	u64 error_status_reporting;
217e692fa13SBob Moore 	u64 addressing_mode;
218e692fa13SBob Moore 
219e692fa13SBob Moore } acpi_aest_node_interface;
220e692fa13SBob Moore 
221e692fa13SBob Moore /* Values for Type field above */
222e692fa13SBob Moore 
223e692fa13SBob Moore #define ACPI_AEST_NODE_SYSTEM_REGISTER      0
224e692fa13SBob Moore #define ACPI_AEST_NODE_MEMORY_MAPPED        1
225e692fa13SBob Moore #define ACPI_AEST_XFACE_RESERVED            2	/* 2 and above are reserved */
226e692fa13SBob Moore 
227e692fa13SBob Moore /* Node Interrupt Structure */
228e692fa13SBob Moore 
229e692fa13SBob Moore typedef struct acpi_aest_node_interrupt {
230e692fa13SBob Moore 	u8 type;
231e692fa13SBob Moore 	u8 reserved[2];
232e692fa13SBob Moore 	u8 flags;
233e692fa13SBob Moore 	u32 gsiv;
234e692fa13SBob Moore 	u8 iort_id;
235e692fa13SBob Moore 	u8 reserved1[3];
236e692fa13SBob Moore 
237e692fa13SBob Moore } acpi_aest_node_interrupt;
238e692fa13SBob Moore 
239e692fa13SBob Moore /* Values for Type field above */
240e692fa13SBob Moore 
241e692fa13SBob Moore #define ACPI_AEST_NODE_FAULT_HANDLING       0
242e692fa13SBob Moore #define ACPI_AEST_NODE_ERROR_RECOVERY       1
243e692fa13SBob Moore #define ACPI_AEST_XRUPT_RESERVED            2	/* 2 and above are reserved */
244e692fa13SBob Moore 
245e692fa13SBob Moore /*******************************************************************************
2465579649eSIlkka Koskinen  * AGDI - Arm Generic Diagnostic Dump and Reset Device Interface
2475579649eSIlkka Koskinen  *
2485579649eSIlkka Koskinen  * Conforms to "ACPI for Arm Components 1.1, Platform Design Document"
2495579649eSIlkka Koskinen  * ARM DEN0093 v1.1
2505579649eSIlkka Koskinen  *
2515579649eSIlkka Koskinen  ******************************************************************************/
2525579649eSIlkka Koskinen struct acpi_table_agdi {
2535579649eSIlkka Koskinen 	struct acpi_table_header header;	/* Common ACPI table header */
2545579649eSIlkka Koskinen 	u8 flags;
2555579649eSIlkka Koskinen 	u8 reserved[3];
2565579649eSIlkka Koskinen 	u32 sdei_event;
2575579649eSIlkka Koskinen 	u32 gsiv;
2585579649eSIlkka Koskinen };
2595579649eSIlkka Koskinen 
2605579649eSIlkka Koskinen /* Mask for Flags field above */
2615579649eSIlkka Koskinen 
2625579649eSIlkka Koskinen #define ACPI_AGDI_SIGNALING_MODE (1)
2635579649eSIlkka Koskinen 
2645579649eSIlkka Koskinen /*******************************************************************************
265e692fa13SBob Moore  *
2661c5d62f5SBesar Wicaksono  * APMT - ARM Performance Monitoring Unit Table
2671c5d62f5SBesar Wicaksono  *
2681c5d62f5SBesar Wicaksono  * Conforms to:
2691c5d62f5SBesar Wicaksono  * ARM Performance Monitoring Unit Architecture 1.0 Platform Design Document
2701c5d62f5SBesar Wicaksono  * ARM DEN0117 v1.0 November 25, 2021
2711c5d62f5SBesar Wicaksono  *
2721c5d62f5SBesar Wicaksono  ******************************************************************************/
2731c5d62f5SBesar Wicaksono 
2741c5d62f5SBesar Wicaksono struct acpi_table_apmt {
2751c5d62f5SBesar Wicaksono 	struct acpi_table_header header;	/* Common ACPI table header */
2761c5d62f5SBesar Wicaksono };
2771c5d62f5SBesar Wicaksono 
2781c5d62f5SBesar Wicaksono #define ACPI_APMT_NODE_ID_LENGTH                4
2791c5d62f5SBesar Wicaksono 
2801c5d62f5SBesar Wicaksono /*
2811c5d62f5SBesar Wicaksono  * APMT subtables
2821c5d62f5SBesar Wicaksono  */
2831c5d62f5SBesar Wicaksono struct acpi_apmt_node {
2841c5d62f5SBesar Wicaksono 	u16 length;
2851c5d62f5SBesar Wicaksono 	u8 flags;
2861c5d62f5SBesar Wicaksono 	u8 type;
2871c5d62f5SBesar Wicaksono 	u32 id;
2881c5d62f5SBesar Wicaksono 	u64 inst_primary;
2891c5d62f5SBesar Wicaksono 	u32 inst_secondary;
2901c5d62f5SBesar Wicaksono 	u64 base_address0;
2911c5d62f5SBesar Wicaksono 	u64 base_address1;
2921c5d62f5SBesar Wicaksono 	u32 ovflw_irq;
2931c5d62f5SBesar Wicaksono 	u32 reserved;
2941c5d62f5SBesar Wicaksono 	u32 ovflw_irq_flags;
2951c5d62f5SBesar Wicaksono 	u32 proc_affinity;
2961c5d62f5SBesar Wicaksono 	u32 impl_id;
2971c5d62f5SBesar Wicaksono };
2981c5d62f5SBesar Wicaksono 
2991c5d62f5SBesar Wicaksono /* Masks for Flags field above */
3001c5d62f5SBesar Wicaksono 
3011c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_DUAL_PAGE               (1<<0)
3021c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_AFFINITY                (1<<1)
3031c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_ATOMIC                  (1<<2)
3041c5d62f5SBesar Wicaksono 
3051c5d62f5SBesar Wicaksono /* Values for Flags dual page field above */
3061c5d62f5SBesar Wicaksono 
3071c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_DUAL_PAGE_NSUPP         (0<<0)
3081c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_DUAL_PAGE_SUPP          (1<<0)
3091c5d62f5SBesar Wicaksono 
3101c5d62f5SBesar Wicaksono /* Values for Flags processor affinity field above */
3111c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_AFFINITY_PROC           (0<<1)
3121c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_AFFINITY_PROC_CONTAINER (1<<1)
3131c5d62f5SBesar Wicaksono 
3141c5d62f5SBesar Wicaksono /* Values for Flags 64-bit atomic field above */
3151c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_ATOMIC_NSUPP            (0<<2)
3161c5d62f5SBesar Wicaksono #define ACPI_APMT_FLAGS_ATOMIC_SUPP             (1<<2)
3171c5d62f5SBesar Wicaksono 
3181c5d62f5SBesar Wicaksono /* Values for Type field above */
3191c5d62f5SBesar Wicaksono 
3201c5d62f5SBesar Wicaksono enum acpi_apmt_node_type {
3211c5d62f5SBesar Wicaksono 	ACPI_APMT_NODE_TYPE_MC = 0x00,
3221c5d62f5SBesar Wicaksono 	ACPI_APMT_NODE_TYPE_SMMU = 0x01,
3231c5d62f5SBesar Wicaksono 	ACPI_APMT_NODE_TYPE_PCIE_ROOT = 0x02,
3241c5d62f5SBesar Wicaksono 	ACPI_APMT_NODE_TYPE_ACPI = 0x03,
3251c5d62f5SBesar Wicaksono 	ACPI_APMT_NODE_TYPE_CACHE = 0x04,
3261c5d62f5SBesar Wicaksono 	ACPI_APMT_NODE_TYPE_COUNT
3271c5d62f5SBesar Wicaksono };
3281c5d62f5SBesar Wicaksono 
3291c5d62f5SBesar Wicaksono /* Masks for ovflw_irq_flags field above */
3301c5d62f5SBesar Wicaksono 
3311c5d62f5SBesar Wicaksono #define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE          (1<<0)
3321c5d62f5SBesar Wicaksono #define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE          (1<<1)
3331c5d62f5SBesar Wicaksono 
3341c5d62f5SBesar Wicaksono /* Values for ovflw_irq_flags mode field above */
3351c5d62f5SBesar Wicaksono 
3361c5d62f5SBesar Wicaksono #define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_LEVEL    (0<<0)
3371c5d62f5SBesar Wicaksono #define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_EDGE     (1<<0)
3381c5d62f5SBesar Wicaksono 
3391c5d62f5SBesar Wicaksono /* Values for ovflw_irq_flags type field above */
3401c5d62f5SBesar Wicaksono 
3411c5d62f5SBesar Wicaksono #define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE_WIRED    (0<<1)
3421c5d62f5SBesar Wicaksono 
3431c5d62f5SBesar Wicaksono /*******************************************************************************
3441c5d62f5SBesar Wicaksono  *
3459401eafaSBob Moore  * BDAT - BIOS Data ACPI Table
3469401eafaSBob Moore  *
3479401eafaSBob Moore  * Conforms to "BIOS Data ACPI Table", Interface Specification v4.0 Draft 5
3489401eafaSBob Moore  * Nov 2020
3499401eafaSBob Moore  *
3509401eafaSBob Moore  ******************************************************************************/
3519401eafaSBob Moore 
3529401eafaSBob Moore struct acpi_table_bdat {
3539401eafaSBob Moore 	struct acpi_table_header header;
3549401eafaSBob Moore 	struct acpi_generic_address gas;
3559401eafaSBob Moore };
3569401eafaSBob Moore 
3579401eafaSBob Moore /*******************************************************************************
3589401eafaSBob Moore  *
359407144ebSKuppuswamy Sathyanarayanan  * CCEL - CC-Event Log
360407144ebSKuppuswamy Sathyanarayanan  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
361407144ebSKuppuswamy Sathyanarayanan  *        Trust Domain Extensions (Intel TDX)". Feb 2022
362407144ebSKuppuswamy Sathyanarayanan  *
363407144ebSKuppuswamy Sathyanarayanan  ******************************************************************************/
364407144ebSKuppuswamy Sathyanarayanan 
365407144ebSKuppuswamy Sathyanarayanan struct acpi_table_ccel {
366407144ebSKuppuswamy Sathyanarayanan 	struct acpi_table_header header;	/* Common ACPI table header */
367407144ebSKuppuswamy Sathyanarayanan 	u8 CCtype;
368407144ebSKuppuswamy Sathyanarayanan 	u8 Ccsub_type;
369407144ebSKuppuswamy Sathyanarayanan 	u16 reserved;
370407144ebSKuppuswamy Sathyanarayanan 	u64 log_area_minimum_length;
371407144ebSKuppuswamy Sathyanarayanan 	u64 log_area_start_address;
372407144ebSKuppuswamy Sathyanarayanan };
373407144ebSKuppuswamy Sathyanarayanan 
374407144ebSKuppuswamy Sathyanarayanan /*******************************************************************************
375407144ebSKuppuswamy Sathyanarayanan  *
376874f6a72SLv Zheng  * IORT - IO Remapping Table
377874f6a72SLv Zheng  *
378874f6a72SLv Zheng  * Conforms to "IO Remapping Table System Software on ARM Platforms",
3793f062a51SRobin Murphy  * Document number: ARM DEN 0049E.e, Sep 2022
380874f6a72SLv Zheng  *
381874f6a72SLv Zheng  ******************************************************************************/
382874f6a72SLv Zheng 
383874f6a72SLv Zheng struct acpi_table_iort {
384874f6a72SLv Zheng 	struct acpi_table_header header;
385874f6a72SLv Zheng 	u32 node_count;
386874f6a72SLv Zheng 	u32 node_offset;
387874f6a72SLv Zheng 	u32 reserved;
388874f6a72SLv Zheng };
389874f6a72SLv Zheng 
390874f6a72SLv Zheng /*
391874f6a72SLv Zheng  * IORT subtables
392874f6a72SLv Zheng  */
393874f6a72SLv Zheng struct acpi_iort_node {
394874f6a72SLv Zheng 	u8 type;
395874f6a72SLv Zheng 	u16 length;
396874f6a72SLv Zheng 	u8 revision;
3978e1fdd7fSShameer Kolothum 	u32 identifier;
398874f6a72SLv Zheng 	u32 mapping_count;
399874f6a72SLv Zheng 	u32 mapping_offset;
40074522feaSKees Cook 	char node_data[];
401874f6a72SLv Zheng };
402874f6a72SLv Zheng 
403874f6a72SLv Zheng /* Values for subtable Type above */
404874f6a72SLv Zheng 
405874f6a72SLv Zheng enum acpi_iort_node_type {
406874f6a72SLv Zheng 	ACPI_IORT_NODE_ITS_GROUP = 0x00,
407874f6a72SLv Zheng 	ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
408874f6a72SLv Zheng 	ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
4094ac78bafSAl Stone 	ACPI_IORT_NODE_SMMU = 0x03,
410a53eaef6SRobin Murphy 	ACPI_IORT_NODE_SMMU_V3 = 0x04,
4118e1fdd7fSShameer Kolothum 	ACPI_IORT_NODE_PMCG = 0x05,
4128e1fdd7fSShameer Kolothum 	ACPI_IORT_NODE_RMR = 0x06,
413874f6a72SLv Zheng };
414874f6a72SLv Zheng 
415874f6a72SLv Zheng struct acpi_iort_id_mapping {
416874f6a72SLv Zheng 	u32 input_base;		/* Lowest value in input range */
417874f6a72SLv Zheng 	u32 id_count;		/* Number of IDs */
418874f6a72SLv Zheng 	u32 output_base;	/* Lowest value in output range */
419874f6a72SLv Zheng 	u32 output_reference;	/* A reference to the output node */
420874f6a72SLv Zheng 	u32 flags;
421874f6a72SLv Zheng };
422874f6a72SLv Zheng 
423874f6a72SLv Zheng /* Masks for Flags field above for IORT subtable */
424874f6a72SLv Zheng 
425874f6a72SLv Zheng #define ACPI_IORT_ID_SINGLE_MAPPING (1)
426874f6a72SLv Zheng 
427874f6a72SLv Zheng struct acpi_iort_memory_access {
428874f6a72SLv Zheng 	u32 cache_coherency;
429874f6a72SLv Zheng 	u8 hints;
430874f6a72SLv Zheng 	u16 reserved;
431874f6a72SLv Zheng 	u8 memory_flags;
432874f6a72SLv Zheng };
433874f6a72SLv Zheng 
434874f6a72SLv Zheng /* Values for cache_coherency field above */
435874f6a72SLv Zheng 
436874f6a72SLv Zheng #define ACPI_IORT_NODE_COHERENT         0x00000001	/* The device node is fully coherent */
437874f6a72SLv Zheng #define ACPI_IORT_NODE_NOT_COHERENT     0x00000000	/* The device node is not coherent */
438874f6a72SLv Zheng 
439874f6a72SLv Zheng /* Masks for Hints field above */
440874f6a72SLv Zheng 
441874f6a72SLv Zheng #define ACPI_IORT_HT_TRANSIENT          (1)
442874f6a72SLv Zheng #define ACPI_IORT_HT_WRITE              (1<<1)
443874f6a72SLv Zheng #define ACPI_IORT_HT_READ               (1<<2)
444874f6a72SLv Zheng #define ACPI_IORT_HT_OVERRIDE           (1<<3)
445874f6a72SLv Zheng 
446874f6a72SLv Zheng /* Masks for memory_flags field above */
447874f6a72SLv Zheng 
448874f6a72SLv Zheng #define ACPI_IORT_MF_COHERENCY          (1)
449874f6a72SLv Zheng #define ACPI_IORT_MF_ATTRIBUTES         (1<<1)
450874f6a72SLv Zheng 
451874f6a72SLv Zheng /*
452874f6a72SLv Zheng  * IORT node specific subtables
453874f6a72SLv Zheng  */
454874f6a72SLv Zheng struct acpi_iort_its_group {
455874f6a72SLv Zheng 	u32 its_count;
45674522feaSKees Cook 	u32 identifiers[];	/* GIC ITS identifier array */
457874f6a72SLv Zheng };
458874f6a72SLv Zheng 
459874f6a72SLv Zheng struct acpi_iort_named_component {
460874f6a72SLv Zheng 	u32 node_flags;
461874f6a72SLv Zheng 	u64 memory_properties;	/* Memory access properties */
462874f6a72SLv Zheng 	u8 memory_address_limit;	/* Memory address size limit */
46374522feaSKees Cook 	char device_name[];	/* Path of namespace object */
464874f6a72SLv Zheng };
465874f6a72SLv Zheng 
466d87be043SRobin Murphy /* Masks for Flags field above */
467d87be043SRobin Murphy 
468d87be043SRobin Murphy #define ACPI_IORT_NC_STALL_SUPPORTED    (1)
469d87be043SRobin Murphy #define ACPI_IORT_NC_PASID_BITS         (31<<1)
470d87be043SRobin Murphy 
471874f6a72SLv Zheng struct acpi_iort_root_complex {
472874f6a72SLv Zheng 	u64 memory_properties;	/* Memory access properties */
473874f6a72SLv Zheng 	u32 ats_attribute;
474874f6a72SLv Zheng 	u32 pci_segment_number;
475d87be043SRobin Murphy 	u8 memory_address_limit;	/* Memory address size limit */
4764fd14753SShameer Kolothum 	u16 pasid_capabilities;	/* PASID Capabilities */
47774522feaSKees Cook 	u8 reserved[];		/* Reserved, must be zero */
478874f6a72SLv Zheng };
479874f6a72SLv Zheng 
4808e1fdd7fSShameer Kolothum /* Masks for ats_attribute field above */
481874f6a72SLv Zheng 
4828e1fdd7fSShameer Kolothum #define ACPI_IORT_ATS_SUPPORTED         (1)	/* The root complex ATS support */
4838e1fdd7fSShameer Kolothum #define ACPI_IORT_PRI_SUPPORTED         (1<<1)	/* The root complex PRI support */
4848e1fdd7fSShameer Kolothum #define ACPI_IORT_PASID_FWD_SUPPORTED   (1<<2)	/* The root complex PASID forward support */
485874f6a72SLv Zheng 
4864fd14753SShameer Kolothum /* Masks for pasid_capabilities field above */
4874fd14753SShameer Kolothum #define ACPI_IORT_PASID_MAX_WIDTH       (0x1F)	/* Bits 0-4 */
4884fd14753SShameer Kolothum 
489874f6a72SLv Zheng struct acpi_iort_smmu {
490874f6a72SLv Zheng 	u64 base_address;	/* SMMU base address */
491874f6a72SLv Zheng 	u64 span;		/* Length of memory range */
492874f6a72SLv Zheng 	u32 model;
493874f6a72SLv Zheng 	u32 flags;
494874f6a72SLv Zheng 	u32 global_interrupt_offset;
495874f6a72SLv Zheng 	u32 context_interrupt_count;
496874f6a72SLv Zheng 	u32 context_interrupt_offset;
497874f6a72SLv Zheng 	u32 pmu_interrupt_count;
498874f6a72SLv Zheng 	u32 pmu_interrupt_offset;
49974522feaSKees Cook 	u64 interrupts[];	/* Interrupt array */
500874f6a72SLv Zheng };
501874f6a72SLv Zheng 
502874f6a72SLv Zheng /* Values for Model field above */
503874f6a72SLv Zheng 
504874f6a72SLv Zheng #define ACPI_IORT_SMMU_V1               0x00000000	/* Generic SMMUv1 */
505874f6a72SLv Zheng #define ACPI_IORT_SMMU_V2               0x00000001	/* Generic SMMUv2 */
506874f6a72SLv Zheng #define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002	/* ARM Corelink MMU-400 */
507874f6a72SLv Zheng #define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003	/* ARM Corelink MMU-500 */
5080c2021c0SRobin Murphy #define ACPI_IORT_SMMU_CORELINK_MMU401  0x00000004	/* ARM Corelink MMU-401 */
5090c2021c0SRobin Murphy #define ACPI_IORT_SMMU_CAVIUM_THUNDERX  0x00000005	/* Cavium thunder_x SMMUv2 */
510874f6a72SLv Zheng 
511874f6a72SLv Zheng /* Masks for Flags field above */
512874f6a72SLv Zheng 
513874f6a72SLv Zheng #define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
514874f6a72SLv Zheng #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
515874f6a72SLv Zheng 
516bb1e23e6SLv Zheng /* Global interrupt format */
517bb1e23e6SLv Zheng 
518bb1e23e6SLv Zheng struct acpi_iort_smmu_gsi {
519bb1e23e6SLv Zheng 	u32 nsg_irpt;
520bb1e23e6SLv Zheng 	u32 nsg_irpt_flags;
521bb1e23e6SLv Zheng 	u32 nsg_cfg_irpt;
522bb1e23e6SLv Zheng 	u32 nsg_cfg_irpt_flags;
523bb1e23e6SLv Zheng };
524bb1e23e6SLv Zheng 
5254ac78bafSAl Stone struct acpi_iort_smmu_v3 {
5264ac78bafSAl Stone 	u64 base_address;	/* SMMUv3 base address */
5274ac78bafSAl Stone 	u32 flags;
5284ac78bafSAl Stone 	u32 reserved;
5294ac78bafSAl Stone 	u64 vatos_address;
5300c2021c0SRobin Murphy 	u32 model;
5314ac78bafSAl Stone 	u32 event_gsiv;
5324ac78bafSAl Stone 	u32 pri_gsiv;
5334ac78bafSAl Stone 	u32 gerr_gsiv;
5344ac78bafSAl Stone 	u32 sync_gsiv;
535d87be043SRobin Murphy 	u32 pxm;
5364c106aa4SHanjun Guo 	u32 id_mapping_index;
5374ac78bafSAl Stone };
5384ac78bafSAl Stone 
5390c2021c0SRobin Murphy /* Values for Model field above */
5400c2021c0SRobin Murphy 
5410c2021c0SRobin Murphy #define ACPI_IORT_SMMU_V3_GENERIC           0x00000000	/* Generic SMMUv3 */
5420c2021c0SRobin Murphy #define ACPI_IORT_SMMU_V3_HISILICON_HI161X  0x00000001	/* hi_silicon Hi161x SMMUv3 */
5430c2021c0SRobin Murphy #define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX     0x00000002	/* Cavium CN99xx SMMUv3 */
5440c2021c0SRobin Murphy 
5454ac78bafSAl Stone /* Masks for Flags field above */
5464ac78bafSAl Stone 
5474ac78bafSAl Stone #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
548d87be043SRobin Murphy #define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE     (3<<1)
549c9442300SGanapatrao Kulkarni #define ACPI_IORT_SMMU_V3_PXM_VALID         (1<<3)
5503f062a51SRobin Murphy #define ACPI_IORT_SMMU_V3_DEVICEID_VALID    (1<<4)
5514ac78bafSAl Stone 
552a53eaef6SRobin Murphy struct acpi_iort_pmcg {
553a53eaef6SRobin Murphy 	u64 page0_base_address;
554a53eaef6SRobin Murphy 	u32 overflow_gsiv;
555a53eaef6SRobin Murphy 	u32 node_reference;
556a53eaef6SRobin Murphy 	u64 page1_base_address;
557a53eaef6SRobin Murphy };
558a53eaef6SRobin Murphy 
5598e1fdd7fSShameer Kolothum struct acpi_iort_rmr {
5608e1fdd7fSShameer Kolothum 	u32 flags;
5618e1fdd7fSShameer Kolothum 	u32 rmr_count;
5628e1fdd7fSShameer Kolothum 	u32 rmr_offset;
5638e1fdd7fSShameer Kolothum };
5648e1fdd7fSShameer Kolothum 
5654fd14753SShameer Kolothum /* Masks for Flags field above */
5664fd14753SShameer Kolothum #define ACPI_IORT_RMR_REMAP_PERMITTED      (1)
5674fd14753SShameer Kolothum #define ACPI_IORT_RMR_ACCESS_PRIVILEGE     (1<<1)
5684fd14753SShameer Kolothum 
5694fd14753SShameer Kolothum /*
5704fd14753SShameer Kolothum  * Macro to access the Access Attributes in flags field above:
5714fd14753SShameer Kolothum  *  Access Attributes is encoded in bits 9:2
5724fd14753SShameer Kolothum  */
5734fd14753SShameer Kolothum #define ACPI_IORT_RMR_ACCESS_ATTRIBUTES(flags)          (((flags) >> 2) & 0xFF)
5744fd14753SShameer Kolothum 
5754fd14753SShameer Kolothum /* Values for above Access Attributes */
5764fd14753SShameer Kolothum 
5774fd14753SShameer Kolothum #define ACPI_IORT_RMR_ATTR_DEVICE_NGNRNE   0x00
5784fd14753SShameer Kolothum #define ACPI_IORT_RMR_ATTR_DEVICE_NGNRE    0x01
5794fd14753SShameer Kolothum #define ACPI_IORT_RMR_ATTR_DEVICE_NGRE     0x02
5804fd14753SShameer Kolothum #define ACPI_IORT_RMR_ATTR_DEVICE_GRE      0x03
5814fd14753SShameer Kolothum #define ACPI_IORT_RMR_ATTR_NORMAL_NC       0x04
5824fd14753SShameer Kolothum #define ACPI_IORT_RMR_ATTR_NORMAL_IWB_OWB  0x05
5834fd14753SShameer Kolothum 
5848e1fdd7fSShameer Kolothum struct acpi_iort_rmr_desc {
5858e1fdd7fSShameer Kolothum 	u64 base_address;
5868e1fdd7fSShameer Kolothum 	u64 length;
5878e1fdd7fSShameer Kolothum 	u32 reserved;
5888e1fdd7fSShameer Kolothum };
5898e1fdd7fSShameer Kolothum 
590874f6a72SLv Zheng /*******************************************************************************
591874f6a72SLv Zheng  *
5926e2d5ebdSBob Moore  * IVRS - I/O Virtualization Reporting Structure
5936e2d5ebdSBob Moore  *        Version 1
5946e2d5ebdSBob Moore  *
5956e2d5ebdSBob Moore  * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
5966e2d5ebdSBob Moore  * Revision 1.26, February 2009.
5976e2d5ebdSBob Moore  *
5986e2d5ebdSBob Moore  ******************************************************************************/
5996e2d5ebdSBob Moore 
6006e2d5ebdSBob Moore struct acpi_table_ivrs {
6016e2d5ebdSBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
6026e2d5ebdSBob Moore 	u32 info;		/* Common virtualization info */
6036e2d5ebdSBob Moore 	u64 reserved;
6046e2d5ebdSBob Moore };
6056e2d5ebdSBob Moore 
6066e2d5ebdSBob Moore /* Values for Info field above */
6076e2d5ebdSBob Moore 
6086e2d5ebdSBob Moore #define ACPI_IVRS_PHYSICAL_SIZE     0x00007F00	/* 7 bits, physical address size */
6096e2d5ebdSBob Moore #define ACPI_IVRS_VIRTUAL_SIZE      0x003F8000	/* 7 bits, virtual address size */
6106e2d5ebdSBob Moore #define ACPI_IVRS_ATS_RESERVED      0x00400000	/* ATS address translation range reserved */
6116e2d5ebdSBob Moore 
6126e2d5ebdSBob Moore /* IVRS subtable header */
6136e2d5ebdSBob Moore 
6146e2d5ebdSBob Moore struct acpi_ivrs_header {
6156e2d5ebdSBob Moore 	u8 type;		/* Subtable type */
6166e2d5ebdSBob Moore 	u8 flags;
6176e2d5ebdSBob Moore 	u16 length;		/* Subtable length */
6186e2d5ebdSBob Moore 	u16 device_id;		/* ID of IOMMU */
6196e2d5ebdSBob Moore };
6206e2d5ebdSBob Moore 
6216e2d5ebdSBob Moore /* Values for subtable Type above */
6226e2d5ebdSBob Moore 
6236e2d5ebdSBob Moore enum acpi_ivrs_type {
6241f6239caSMichał Żygowski 	ACPI_IVRS_TYPE_HARDWARE1 = 0x10,
6251f6239caSMichał Żygowski 	ACPI_IVRS_TYPE_HARDWARE2 = 0x11,
6267ce7a445SAlexander Monakov 	ACPI_IVRS_TYPE_HARDWARE3 = 0x40,
6276e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_MEMORY1 = 0x20,
6286e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_MEMORY2 = 0x21,
6296e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_MEMORY3 = 0x22
6306e2d5ebdSBob Moore };
6316e2d5ebdSBob Moore 
6326e2d5ebdSBob Moore /* Masks for Flags field above for IVHD subtable */
6336e2d5ebdSBob Moore 
6346e2d5ebdSBob Moore #define ACPI_IVHD_TT_ENABLE         (1)
6356e2d5ebdSBob Moore #define ACPI_IVHD_PASS_PW           (1<<1)
6366e2d5ebdSBob Moore #define ACPI_IVHD_RES_PASS_PW       (1<<2)
6376e2d5ebdSBob Moore #define ACPI_IVHD_ISOC              (1<<3)
6386e2d5ebdSBob Moore #define ACPI_IVHD_IOTLB             (1<<4)
6396e2d5ebdSBob Moore 
6406e2d5ebdSBob Moore /* Masks for Flags field above for IVMD subtable */
6416e2d5ebdSBob Moore 
6426e2d5ebdSBob Moore #define ACPI_IVMD_UNITY             (1)
6436e2d5ebdSBob Moore #define ACPI_IVMD_READ              (1<<1)
6446e2d5ebdSBob Moore #define ACPI_IVMD_WRITE             (1<<2)
6456e2d5ebdSBob Moore #define ACPI_IVMD_EXCLUSION_RANGE   (1<<3)
6466e2d5ebdSBob Moore 
6476e2d5ebdSBob Moore /*
6486e2d5ebdSBob Moore  * IVRS subtables, correspond to Type in struct acpi_ivrs_header
6496e2d5ebdSBob Moore  */
6506e2d5ebdSBob Moore 
6516e2d5ebdSBob Moore /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
6526e2d5ebdSBob Moore 
6531f6239caSMichał Żygowski struct acpi_ivrs_hardware_10 {
6546e2d5ebdSBob Moore 	struct acpi_ivrs_header header;
6556e2d5ebdSBob Moore 	u16 capability_offset;	/* Offset for IOMMU control fields */
6566e2d5ebdSBob Moore 	u64 base_address;	/* IOMMU control registers */
6576e2d5ebdSBob Moore 	u16 pci_segment_group;
6586e2d5ebdSBob Moore 	u16 info;		/* MSI number and unit ID */
6590dc7e795SMichał Żygowski 	u32 feature_reporting;
6606e2d5ebdSBob Moore };
6616e2d5ebdSBob Moore 
6621f6239caSMichał Żygowski /* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */
6631f6239caSMichał Żygowski 
6641f6239caSMichał Żygowski struct acpi_ivrs_hardware_11 {
6651f6239caSMichał Żygowski 	struct acpi_ivrs_header header;
6661f6239caSMichał Żygowski 	u16 capability_offset;	/* Offset for IOMMU control fields */
6671f6239caSMichał Żygowski 	u64 base_address;	/* IOMMU control registers */
6681f6239caSMichał Żygowski 	u16 pci_segment_group;
6691f6239caSMichał Żygowski 	u16 info;		/* MSI number and unit ID */
6701f6239caSMichał Żygowski 	u32 attributes;
6711f6239caSMichał Żygowski 	u64 efr_register_image;
6721f6239caSMichał Żygowski 	u64 reserved;
6731f6239caSMichał Żygowski };
6741f6239caSMichał Żygowski 
6756e2d5ebdSBob Moore /* Masks for Info field above */
6766e2d5ebdSBob Moore 
6776e2d5ebdSBob Moore #define ACPI_IVHD_MSI_NUMBER_MASK   0x001F	/* 5 bits, MSI message number */
678ba494beeSBob Moore #define ACPI_IVHD_UNIT_ID_MASK      0x1F00	/* 5 bits, unit_ID */
6796e2d5ebdSBob Moore 
6806e2d5ebdSBob Moore /*
6816e2d5ebdSBob Moore  * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
6826e2d5ebdSBob Moore  * Upper two bits of the Type field are the (encoded) length of the structure.
6836e2d5ebdSBob Moore  * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
6846e2d5ebdSBob Moore  * are reserved for future use but not defined.
6856e2d5ebdSBob Moore  */
6866e2d5ebdSBob Moore struct acpi_ivrs_de_header {
6876e2d5ebdSBob Moore 	u8 type;
6886e2d5ebdSBob Moore 	u16 id;
6896e2d5ebdSBob Moore 	u8 data_setting;
6906e2d5ebdSBob Moore };
6916e2d5ebdSBob Moore 
6926e2d5ebdSBob Moore /* Length of device entry is in the top two bits of Type field above */
6936e2d5ebdSBob Moore 
6946e2d5ebdSBob Moore #define ACPI_IVHD_ENTRY_LENGTH      0xC0
6956e2d5ebdSBob Moore 
6966e2d5ebdSBob Moore /* Values for device entry Type field above */
6976e2d5ebdSBob Moore 
6986e2d5ebdSBob Moore enum acpi_ivrs_device_entry_type {
6996e2d5ebdSBob Moore 	/* 4-byte device entries, all use struct acpi_ivrs_device4 */
7006e2d5ebdSBob Moore 
7016e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_PAD4 = 0,
7026e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_ALL = 1,
7036e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_SELECT = 2,
7046e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_START = 3,
7056e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_END = 4,
7066e2d5ebdSBob Moore 
7076e2d5ebdSBob Moore 	/* 8-byte device entries */
7086e2d5ebdSBob Moore 
7096e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_PAD8 = 64,
7106e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_NOT_USED = 65,
7116e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_ALIAS_SELECT = 66,	/* Uses struct acpi_ivrs_device8a */
7126e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_ALIAS_START = 67,	/* Uses struct acpi_ivrs_device8a */
7136e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_EXT_SELECT = 70,	/* Uses struct acpi_ivrs_device8b */
7146e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_EXT_START = 71,	/* Uses struct acpi_ivrs_device8b */
7157ce7a445SAlexander Monakov 	ACPI_IVRS_TYPE_SPECIAL = 72,	/* Uses struct acpi_ivrs_device8c */
7167ce7a445SAlexander Monakov 
7177ce7a445SAlexander Monakov 	/* Variable-length device entries */
7187ce7a445SAlexander Monakov 
7197ce7a445SAlexander Monakov 	ACPI_IVRS_TYPE_HID = 240	/* Uses ACPI_IVRS_DEVICE_HID */
7206e2d5ebdSBob Moore };
7216e2d5ebdSBob Moore 
7226e2d5ebdSBob Moore /* Values for Data field above */
7236e2d5ebdSBob Moore 
7246e2d5ebdSBob Moore #define ACPI_IVHD_INIT_PASS         (1)
7256e2d5ebdSBob Moore #define ACPI_IVHD_EINT_PASS         (1<<1)
7266e2d5ebdSBob Moore #define ACPI_IVHD_NMI_PASS          (1<<2)
7276e2d5ebdSBob Moore #define ACPI_IVHD_SYSTEM_MGMT       (3<<4)
7286e2d5ebdSBob Moore #define ACPI_IVHD_LINT0_PASS        (1<<6)
7296e2d5ebdSBob Moore #define ACPI_IVHD_LINT1_PASS        (1<<7)
7306e2d5ebdSBob Moore 
7316e2d5ebdSBob Moore /* Types 0-4: 4-byte device entry */
7326e2d5ebdSBob Moore 
7336e2d5ebdSBob Moore struct acpi_ivrs_device4 {
7346e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
7356e2d5ebdSBob Moore };
7366e2d5ebdSBob Moore 
7376e2d5ebdSBob Moore /* Types 66-67: 8-byte device entry */
7386e2d5ebdSBob Moore 
7396e2d5ebdSBob Moore struct acpi_ivrs_device8a {
7406e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
7416e2d5ebdSBob Moore 	u8 reserved1;
7426e2d5ebdSBob Moore 	u16 used_id;
7436e2d5ebdSBob Moore 	u8 reserved2;
7446e2d5ebdSBob Moore };
7456e2d5ebdSBob Moore 
7466e2d5ebdSBob Moore /* Types 70-71: 8-byte device entry */
7476e2d5ebdSBob Moore 
7486e2d5ebdSBob Moore struct acpi_ivrs_device8b {
7496e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
7506e2d5ebdSBob Moore 	u32 extended_data;
7516e2d5ebdSBob Moore };
7526e2d5ebdSBob Moore 
7536e2d5ebdSBob Moore /* Values for extended_data above */
7546e2d5ebdSBob Moore 
7556e2d5ebdSBob Moore #define ACPI_IVHD_ATS_DISABLED      (1<<31)
7566e2d5ebdSBob Moore 
7576e2d5ebdSBob Moore /* Type 72: 8-byte device entry */
7586e2d5ebdSBob Moore 
7596e2d5ebdSBob Moore struct acpi_ivrs_device8c {
7606e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
7616e2d5ebdSBob Moore 	u8 handle;
7626e2d5ebdSBob Moore 	u16 used_id;
7636e2d5ebdSBob Moore 	u8 variety;
7646e2d5ebdSBob Moore };
7656e2d5ebdSBob Moore 
7666e2d5ebdSBob Moore /* Values for Variety field above */
7676e2d5ebdSBob Moore 
7686e2d5ebdSBob Moore #define ACPI_IVHD_IOAPIC            1
7696e2d5ebdSBob Moore #define ACPI_IVHD_HPET              2
7706e2d5ebdSBob Moore 
7717ce7a445SAlexander Monakov /* Type 240: variable-length device entry */
7727ce7a445SAlexander Monakov 
7737ce7a445SAlexander Monakov struct acpi_ivrs_device_hid {
7747ce7a445SAlexander Monakov 	struct acpi_ivrs_de_header header;
7757ce7a445SAlexander Monakov 	u64 acpi_hid;
7767ce7a445SAlexander Monakov 	u64 acpi_cid;
7777ce7a445SAlexander Monakov 	u8 uid_type;
7787ce7a445SAlexander Monakov 	u8 uid_length;
7797ce7a445SAlexander Monakov };
7807ce7a445SAlexander Monakov 
781c160b7d2SBob Moore /* Values for uid_type above */
782c160b7d2SBob Moore 
783c160b7d2SBob Moore #define ACPI_IVRS_UID_NOT_PRESENT   0
784c160b7d2SBob Moore #define ACPI_IVRS_UID_IS_INTEGER    1
785c160b7d2SBob Moore #define ACPI_IVRS_UID_IS_STRING     2
786c160b7d2SBob Moore 
7876e2d5ebdSBob Moore /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
7886e2d5ebdSBob Moore 
7896e2d5ebdSBob Moore struct acpi_ivrs_memory {
7906e2d5ebdSBob Moore 	struct acpi_ivrs_header header;
7916e2d5ebdSBob Moore 	u16 aux_data;
7926e2d5ebdSBob Moore 	u64 reserved;
7936e2d5ebdSBob Moore 	u64 start_address;
7946e2d5ebdSBob Moore 	u64 memory_length;
7956e2d5ebdSBob Moore };
7966e2d5ebdSBob Moore 
7976e2d5ebdSBob Moore /*******************************************************************************
7986e2d5ebdSBob Moore  *
799d36d4e30SBob Moore  * LPIT - Low Power Idle Table
800d36d4e30SBob Moore  *
8019ab8cf1bSBob Moore  * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
802d36d4e30SBob Moore  *
803d36d4e30SBob Moore  ******************************************************************************/
804d36d4e30SBob Moore 
805d36d4e30SBob Moore struct acpi_table_lpit {
806d36d4e30SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
807d36d4e30SBob Moore };
808d36d4e30SBob Moore 
809d36d4e30SBob Moore /* LPIT subtable header */
810d36d4e30SBob Moore 
811d36d4e30SBob Moore struct acpi_lpit_header {
812d36d4e30SBob Moore 	u32 type;		/* Subtable type */
813d36d4e30SBob Moore 	u32 length;		/* Subtable length */
814d36d4e30SBob Moore 	u16 unique_id;
815d36d4e30SBob Moore 	u16 reserved;
816d36d4e30SBob Moore 	u32 flags;
817d36d4e30SBob Moore };
818d36d4e30SBob Moore 
819d36d4e30SBob Moore /* Values for subtable Type above */
820d36d4e30SBob Moore 
821d36d4e30SBob Moore enum acpi_lpit_type {
822d36d4e30SBob Moore 	ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
8239ab8cf1bSBob Moore 	ACPI_LPIT_TYPE_RESERVED = 0x01	/* 1 and above are reserved */
824d36d4e30SBob Moore };
825d36d4e30SBob Moore 
826d36d4e30SBob Moore /* Masks for Flags field above  */
827d36d4e30SBob Moore 
828d36d4e30SBob Moore #define ACPI_LPIT_STATE_DISABLED    (1)
829d36d4e30SBob Moore #define ACPI_LPIT_NO_COUNTER        (1<<1)
830d36d4e30SBob Moore 
831d36d4e30SBob Moore /*
832d36d4e30SBob Moore  * LPIT subtables, correspond to Type in struct acpi_lpit_header
833d36d4e30SBob Moore  */
834d36d4e30SBob Moore 
835d36d4e30SBob Moore /* 0x00: Native C-state instruction based LPI structure */
836d36d4e30SBob Moore 
837d36d4e30SBob Moore struct acpi_lpit_native {
838d36d4e30SBob Moore 	struct acpi_lpit_header header;
839d36d4e30SBob Moore 	struct acpi_generic_address entry_trigger;
840d36d4e30SBob Moore 	u32 residency;
841d36d4e30SBob Moore 	u32 latency;
842d36d4e30SBob Moore 	struct acpi_generic_address residency_counter;
843d36d4e30SBob Moore 	u64 counter_frequency;
844d36d4e30SBob Moore };
845d36d4e30SBob Moore 
846d36d4e30SBob Moore /*******************************************************************************
847d36d4e30SBob Moore  *
848e62f8227SErik Schmauss  * MADT - Multiple APIC Description Table
849e62f8227SErik Schmauss  *        Version 3
850e62f8227SErik Schmauss  *
851e62f8227SErik Schmauss  ******************************************************************************/
852e62f8227SErik Schmauss 
853e62f8227SErik Schmauss struct acpi_table_madt {
854e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
855e62f8227SErik Schmauss 	u32 address;		/* Physical address of local APIC */
856e62f8227SErik Schmauss 	u32 flags;
857e62f8227SErik Schmauss };
858e62f8227SErik Schmauss 
859e62f8227SErik Schmauss /* Masks for Flags field above */
860e62f8227SErik Schmauss 
861e62f8227SErik Schmauss #define ACPI_MADT_PCAT_COMPAT       (1)	/* 00: System also has dual 8259s */
862e62f8227SErik Schmauss 
863e62f8227SErik Schmauss /* Values for PCATCompat flag */
864e62f8227SErik Schmauss 
865e62f8227SErik Schmauss #define ACPI_MADT_DUAL_PIC          1
866e62f8227SErik Schmauss #define ACPI_MADT_MULTIPLE_APIC     0
867e62f8227SErik Schmauss 
868e62f8227SErik Schmauss /* Values for MADT subtable type in struct acpi_subtable_header */
869e62f8227SErik Schmauss 
870e62f8227SErik Schmauss enum acpi_madt_type {
871e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_APIC = 0,
872e62f8227SErik Schmauss 	ACPI_MADT_TYPE_IO_APIC = 1,
873e62f8227SErik Schmauss 	ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
874e62f8227SErik Schmauss 	ACPI_MADT_TYPE_NMI_SOURCE = 3,
875e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
876e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
877e62f8227SErik Schmauss 	ACPI_MADT_TYPE_IO_SAPIC = 6,
878e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
879e62f8227SErik Schmauss 	ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
880e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
881e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
882e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
883e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
884e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
885e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
886e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
8879557cb8cSErik Kaneda 	ACPI_MADT_TYPE_MULTIPROC_WAKEUP = 16,
88860f2096bSHuacai Chen 	ACPI_MADT_TYPE_CORE_PIC = 17,
88960f2096bSHuacai Chen 	ACPI_MADT_TYPE_LIO_PIC = 18,
89060f2096bSHuacai Chen 	ACPI_MADT_TYPE_HT_PIC = 19,
89160f2096bSHuacai Chen 	ACPI_MADT_TYPE_EIO_PIC = 20,
89260f2096bSHuacai Chen 	ACPI_MADT_TYPE_MSI_PIC = 21,
89360f2096bSHuacai Chen 	ACPI_MADT_TYPE_BIO_PIC = 22,
89460f2096bSHuacai Chen 	ACPI_MADT_TYPE_LPC_PIC = 23,
895f2ca92d0SSunil V L 	ACPI_MADT_TYPE_RINTC = 24,
896f3b19adeSSunil V L 	ACPI_MADT_TYPE_IMSIC = 25,
897f3b19adeSSunil V L 	ACPI_MADT_TYPE_APLIC = 26,
898f3b19adeSSunil V L 	ACPI_MADT_TYPE_PLIC = 27,
899f3b19adeSSunil V L 	ACPI_MADT_TYPE_RESERVED = 28,	/* 28 to 0x7F are reserved */
900da6a9bbeSBob Moore 	ACPI_MADT_TYPE_OEM_RESERVED = 0x80	/* 0x80 to 0xFF are reserved for OEM use */
901e62f8227SErik Schmauss };
902e62f8227SErik Schmauss 
903e62f8227SErik Schmauss /*
904e62f8227SErik Schmauss  * MADT Subtables, correspond to Type in struct acpi_subtable_header
905e62f8227SErik Schmauss  */
906e62f8227SErik Schmauss 
907e62f8227SErik Schmauss /* 0: Processor Local APIC */
908e62f8227SErik Schmauss 
909e62f8227SErik Schmauss struct acpi_madt_local_apic {
910e62f8227SErik Schmauss 	struct acpi_subtable_header header;
911e62f8227SErik Schmauss 	u8 processor_id;	/* ACPI processor id */
912e62f8227SErik Schmauss 	u8 id;			/* Processor's local APIC id */
913e62f8227SErik Schmauss 	u32 lapic_flags;
914e62f8227SErik Schmauss };
915e62f8227SErik Schmauss 
916e62f8227SErik Schmauss /* 1: IO APIC */
917e62f8227SErik Schmauss 
918e62f8227SErik Schmauss struct acpi_madt_io_apic {
919e62f8227SErik Schmauss 	struct acpi_subtable_header header;
920e62f8227SErik Schmauss 	u8 id;			/* I/O APIC ID */
921e62f8227SErik Schmauss 	u8 reserved;		/* reserved - must be zero */
922e62f8227SErik Schmauss 	u32 address;		/* APIC physical address */
923e62f8227SErik Schmauss 	u32 global_irq_base;	/* Global system interrupt where INTI lines start */
924e62f8227SErik Schmauss };
925e62f8227SErik Schmauss 
926e62f8227SErik Schmauss /* 2: Interrupt Override */
927e62f8227SErik Schmauss 
928e62f8227SErik Schmauss struct acpi_madt_interrupt_override {
929e62f8227SErik Schmauss 	struct acpi_subtable_header header;
930e62f8227SErik Schmauss 	u8 bus;			/* 0 - ISA */
931e62f8227SErik Schmauss 	u8 source_irq;		/* Interrupt source (IRQ) */
932e62f8227SErik Schmauss 	u32 global_irq;		/* Global system interrupt */
933e62f8227SErik Schmauss 	u16 inti_flags;
934e62f8227SErik Schmauss };
935e62f8227SErik Schmauss 
936e62f8227SErik Schmauss /* 3: NMI Source */
937e62f8227SErik Schmauss 
938e62f8227SErik Schmauss struct acpi_madt_nmi_source {
939e62f8227SErik Schmauss 	struct acpi_subtable_header header;
940e62f8227SErik Schmauss 	u16 inti_flags;
941e62f8227SErik Schmauss 	u32 global_irq;		/* Global system interrupt */
942e62f8227SErik Schmauss };
943e62f8227SErik Schmauss 
944e62f8227SErik Schmauss /* 4: Local APIC NMI */
945e62f8227SErik Schmauss 
946e62f8227SErik Schmauss struct acpi_madt_local_apic_nmi {
947e62f8227SErik Schmauss 	struct acpi_subtable_header header;
948e62f8227SErik Schmauss 	u8 processor_id;	/* ACPI processor id */
949e62f8227SErik Schmauss 	u16 inti_flags;
950e62f8227SErik Schmauss 	u8 lint;		/* LINTn to which NMI is connected */
951e62f8227SErik Schmauss };
952e62f8227SErik Schmauss 
953e62f8227SErik Schmauss /* 5: Address Override */
954e62f8227SErik Schmauss 
955e62f8227SErik Schmauss struct acpi_madt_local_apic_override {
956e62f8227SErik Schmauss 	struct acpi_subtable_header header;
957e62f8227SErik Schmauss 	u16 reserved;		/* Reserved, must be zero */
958e62f8227SErik Schmauss 	u64 address;		/* APIC physical address */
959e62f8227SErik Schmauss };
960e62f8227SErik Schmauss 
961e62f8227SErik Schmauss /* 6: I/O Sapic */
962e62f8227SErik Schmauss 
963e62f8227SErik Schmauss struct acpi_madt_io_sapic {
964e62f8227SErik Schmauss 	struct acpi_subtable_header header;
965e62f8227SErik Schmauss 	u8 id;			/* I/O SAPIC ID */
966e62f8227SErik Schmauss 	u8 reserved;		/* Reserved, must be zero */
967e62f8227SErik Schmauss 	u32 global_irq_base;	/* Global interrupt for SAPIC start */
968e62f8227SErik Schmauss 	u64 address;		/* SAPIC physical address */
969e62f8227SErik Schmauss };
970e62f8227SErik Schmauss 
971e62f8227SErik Schmauss /* 7: Local Sapic */
972e62f8227SErik Schmauss 
973e62f8227SErik Schmauss struct acpi_madt_local_sapic {
974e62f8227SErik Schmauss 	struct acpi_subtable_header header;
975e62f8227SErik Schmauss 	u8 processor_id;	/* ACPI processor id */
976e62f8227SErik Schmauss 	u8 id;			/* SAPIC ID */
977e62f8227SErik Schmauss 	u8 eid;			/* SAPIC EID */
978e62f8227SErik Schmauss 	u8 reserved[3];		/* Reserved, must be zero */
979e62f8227SErik Schmauss 	u32 lapic_flags;
980e62f8227SErik Schmauss 	u32 uid;		/* Numeric UID - ACPI 3.0 */
98174522feaSKees Cook 	char uid_string[];	/* String UID  - ACPI 3.0 */
982e62f8227SErik Schmauss };
983e62f8227SErik Schmauss 
984e62f8227SErik Schmauss /* 8: Platform Interrupt Source */
985e62f8227SErik Schmauss 
986e62f8227SErik Schmauss struct acpi_madt_interrupt_source {
987e62f8227SErik Schmauss 	struct acpi_subtable_header header;
988e62f8227SErik Schmauss 	u16 inti_flags;
989e62f8227SErik Schmauss 	u8 type;		/* 1=PMI, 2=INIT, 3=corrected */
990e62f8227SErik Schmauss 	u8 id;			/* Processor ID */
991e62f8227SErik Schmauss 	u8 eid;			/* Processor EID */
992e62f8227SErik Schmauss 	u8 io_sapic_vector;	/* Vector value for PMI interrupts */
993e62f8227SErik Schmauss 	u32 global_irq;		/* Global system interrupt */
994e62f8227SErik Schmauss 	u32 flags;		/* Interrupt Source Flags */
995e62f8227SErik Schmauss };
996e62f8227SErik Schmauss 
997e62f8227SErik Schmauss /* Masks for Flags field above */
998e62f8227SErik Schmauss 
999e62f8227SErik Schmauss #define ACPI_MADT_CPEI_OVERRIDE     (1)
1000e62f8227SErik Schmauss 
1001e62f8227SErik Schmauss /* 9: Processor Local X2APIC (ACPI 4.0) */
1002e62f8227SErik Schmauss 
1003e62f8227SErik Schmauss struct acpi_madt_local_x2apic {
1004e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1005e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
1006e62f8227SErik Schmauss 	u32 local_apic_id;	/* Processor x2APIC ID  */
1007e62f8227SErik Schmauss 	u32 lapic_flags;
1008e62f8227SErik Schmauss 	u32 uid;		/* ACPI processor UID */
1009e62f8227SErik Schmauss };
1010e62f8227SErik Schmauss 
1011e62f8227SErik Schmauss /* 10: Local X2APIC NMI (ACPI 4.0) */
1012e62f8227SErik Schmauss 
1013e62f8227SErik Schmauss struct acpi_madt_local_x2apic_nmi {
1014e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1015e62f8227SErik Schmauss 	u16 inti_flags;
1016e62f8227SErik Schmauss 	u32 uid;		/* ACPI processor UID */
1017e62f8227SErik Schmauss 	u8 lint;		/* LINTn to which NMI is connected */
1018e62f8227SErik Schmauss 	u8 reserved[3];		/* reserved - must be zero */
1019e62f8227SErik Schmauss };
1020e62f8227SErik Schmauss 
1021377421fcSXiongfeng Wang /* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 + ACPI 6.5 changes) */
1022e62f8227SErik Schmauss 
1023e62f8227SErik Schmauss struct acpi_madt_generic_interrupt {
1024e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1025e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
1026e62f8227SErik Schmauss 	u32 cpu_interface_number;
1027e62f8227SErik Schmauss 	u32 uid;
1028e62f8227SErik Schmauss 	u32 flags;
1029e62f8227SErik Schmauss 	u32 parking_version;
1030e62f8227SErik Schmauss 	u32 performance_interrupt;
1031e62f8227SErik Schmauss 	u64 parked_address;
1032e62f8227SErik Schmauss 	u64 base_address;
1033e62f8227SErik Schmauss 	u64 gicv_base_address;
1034e62f8227SErik Schmauss 	u64 gich_base_address;
1035e62f8227SErik Schmauss 	u32 vgic_interrupt;
1036e62f8227SErik Schmauss 	u64 gicr_base_address;
1037e62f8227SErik Schmauss 	u64 arm_mpidr;
1038e62f8227SErik Schmauss 	u8 efficiency_class;
1039e646e0a5SErik Schmauss 	u8 reserved2[1];
1040e646e0a5SErik Schmauss 	u16 spe_interrupt;	/* ACPI 6.3 */
1041377421fcSXiongfeng Wang 	u16 trbe_interrupt;	/* ACPI 6.5 */
1042e62f8227SErik Schmauss };
1043e62f8227SErik Schmauss 
1044e62f8227SErik Schmauss /* Masks for Flags field above */
1045e62f8227SErik Schmauss 
1046e62f8227SErik Schmauss /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
1047e62f8227SErik Schmauss #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)	/* 01: Performance Interrupt Mode */
1048e62f8227SErik Schmauss #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)	/* 02: VGIC Maintenance Interrupt mode */
1049e62f8227SErik Schmauss 
1050e62f8227SErik Schmauss /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
1051e62f8227SErik Schmauss 
1052e62f8227SErik Schmauss struct acpi_madt_generic_distributor {
1053e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1054e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
1055e62f8227SErik Schmauss 	u32 gic_id;
1056e62f8227SErik Schmauss 	u64 base_address;
1057e62f8227SErik Schmauss 	u32 global_irq_base;
1058e62f8227SErik Schmauss 	u8 version;
1059e62f8227SErik Schmauss 	u8 reserved2[3];	/* reserved - must be zero */
1060e62f8227SErik Schmauss };
1061e62f8227SErik Schmauss 
1062e62f8227SErik Schmauss /* Values for Version field above */
1063e62f8227SErik Schmauss 
1064e62f8227SErik Schmauss enum acpi_madt_gic_version {
1065e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_NONE = 0,
1066e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V1 = 1,
1067e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V2 = 2,
1068e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V3 = 3,
1069e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V4 = 4,
1070e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_RESERVED = 5	/* 5 and greater are reserved */
1071e62f8227SErik Schmauss };
1072e62f8227SErik Schmauss 
1073e62f8227SErik Schmauss /* 13: Generic MSI Frame (ACPI 5.1) */
1074e62f8227SErik Schmauss 
1075e62f8227SErik Schmauss struct acpi_madt_generic_msi_frame {
1076e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1077e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
1078e62f8227SErik Schmauss 	u32 msi_frame_id;
1079e62f8227SErik Schmauss 	u64 base_address;
1080e62f8227SErik Schmauss 	u32 flags;
1081e62f8227SErik Schmauss 	u16 spi_count;
1082e62f8227SErik Schmauss 	u16 spi_base;
1083e62f8227SErik Schmauss };
1084e62f8227SErik Schmauss 
1085e62f8227SErik Schmauss /* Masks for Flags field above */
1086e62f8227SErik Schmauss 
1087e62f8227SErik Schmauss #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
1088e62f8227SErik Schmauss 
1089e62f8227SErik Schmauss /* 14: Generic Redistributor (ACPI 5.1) */
1090e62f8227SErik Schmauss 
1091e62f8227SErik Schmauss struct acpi_madt_generic_redistributor {
1092e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1093e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
1094e62f8227SErik Schmauss 	u64 base_address;
1095e62f8227SErik Schmauss 	u32 length;
1096e62f8227SErik Schmauss };
1097e62f8227SErik Schmauss 
1098e62f8227SErik Schmauss /* 15: Generic Translator (ACPI 6.0) */
1099e62f8227SErik Schmauss 
1100e62f8227SErik Schmauss struct acpi_madt_generic_translator {
1101e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1102e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
1103e62f8227SErik Schmauss 	u32 translation_id;
1104e62f8227SErik Schmauss 	u64 base_address;
1105e62f8227SErik Schmauss 	u32 reserved2;
1106e62f8227SErik Schmauss };
1107e62f8227SErik Schmauss 
11089557cb8cSErik Kaneda /* 16: Multiprocessor wakeup (ACPI 6.4) */
11099557cb8cSErik Kaneda 
11109557cb8cSErik Kaneda struct acpi_madt_multiproc_wakeup {
11119557cb8cSErik Kaneda 	struct acpi_subtable_header header;
11129557cb8cSErik Kaneda 	u16 mailbox_version;
11139557cb8cSErik Kaneda 	u32 reserved;		/* reserved - must be zero */
11149557cb8cSErik Kaneda 	u64 base_address;
11159557cb8cSErik Kaneda };
11169557cb8cSErik Kaneda 
111742d96e16SKuppuswamy Sathyanarayanan #define ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE        2032
111842d96e16SKuppuswamy Sathyanarayanan #define ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE  2048
111942d96e16SKuppuswamy Sathyanarayanan 
112042d96e16SKuppuswamy Sathyanarayanan struct acpi_madt_multiproc_wakeup_mailbox {
112142d96e16SKuppuswamy Sathyanarayanan 	u16 command;
112242d96e16SKuppuswamy Sathyanarayanan 	u16 reserved;		/* reserved - must be zero */
112342d96e16SKuppuswamy Sathyanarayanan 	u32 apic_id;
112442d96e16SKuppuswamy Sathyanarayanan 	u64 wakeup_vector;
112542d96e16SKuppuswamy Sathyanarayanan 	u8 reserved_os[ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE];	/* reserved for OS use */
112642d96e16SKuppuswamy Sathyanarayanan 	u8 reserved_firmware[ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE];	/* reserved for firmware use */
112742d96e16SKuppuswamy Sathyanarayanan };
112842d96e16SKuppuswamy Sathyanarayanan 
112942d96e16SKuppuswamy Sathyanarayanan #define ACPI_MP_WAKE_COMMAND_WAKEUP    1
113042d96e16SKuppuswamy Sathyanarayanan 
113160f2096bSHuacai Chen /* 17: CPU Core Interrupt Controller (ACPI 6.5) */
113260f2096bSHuacai Chen 
113360f2096bSHuacai Chen struct acpi_madt_core_pic {
113460f2096bSHuacai Chen 	struct acpi_subtable_header header;
113560f2096bSHuacai Chen 	u8 version;
113660f2096bSHuacai Chen 	u32 processor_id;
113760f2096bSHuacai Chen 	u32 core_id;
113860f2096bSHuacai Chen 	u32 flags;
113960f2096bSHuacai Chen };
114060f2096bSHuacai Chen 
114160f2096bSHuacai Chen /* Values for Version field above */
114260f2096bSHuacai Chen 
114360f2096bSHuacai Chen enum acpi_madt_core_pic_version {
114460f2096bSHuacai Chen 	ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
114560f2096bSHuacai Chen 	ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
114660f2096bSHuacai Chen 	ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
114760f2096bSHuacai Chen };
114860f2096bSHuacai Chen 
114960f2096bSHuacai Chen /* 18: Legacy I/O Interrupt Controller (ACPI 6.5) */
115060f2096bSHuacai Chen 
115160f2096bSHuacai Chen struct acpi_madt_lio_pic {
115260f2096bSHuacai Chen 	struct acpi_subtable_header header;
115360f2096bSHuacai Chen 	u8 version;
115460f2096bSHuacai Chen 	u64 address;
115560f2096bSHuacai Chen 	u16 size;
115660f2096bSHuacai Chen 	u8 cascade[2];
115760f2096bSHuacai Chen 	u32 cascade_map[2];
115860f2096bSHuacai Chen };
115960f2096bSHuacai Chen 
116060f2096bSHuacai Chen /* Values for Version field above */
116160f2096bSHuacai Chen 
116260f2096bSHuacai Chen enum acpi_madt_lio_pic_version {
116360f2096bSHuacai Chen 	ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
116460f2096bSHuacai Chen 	ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
116560f2096bSHuacai Chen 	ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
116660f2096bSHuacai Chen };
116760f2096bSHuacai Chen 
116860f2096bSHuacai Chen /* 19: HT Interrupt Controller (ACPI 6.5) */
116960f2096bSHuacai Chen 
117060f2096bSHuacai Chen struct acpi_madt_ht_pic {
117160f2096bSHuacai Chen 	struct acpi_subtable_header header;
117260f2096bSHuacai Chen 	u8 version;
117360f2096bSHuacai Chen 	u64 address;
117460f2096bSHuacai Chen 	u16 size;
117560f2096bSHuacai Chen 	u8 cascade[8];
117660f2096bSHuacai Chen };
117760f2096bSHuacai Chen 
117860f2096bSHuacai Chen /* Values for Version field above */
117960f2096bSHuacai Chen 
118060f2096bSHuacai Chen enum acpi_madt_ht_pic_version {
118160f2096bSHuacai Chen 	ACPI_MADT_HT_PIC_VERSION_NONE = 0,
118260f2096bSHuacai Chen 	ACPI_MADT_HT_PIC_VERSION_V1 = 1,
118360f2096bSHuacai Chen 	ACPI_MADT_HT_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
118460f2096bSHuacai Chen };
118560f2096bSHuacai Chen 
118660f2096bSHuacai Chen /* 20: Extend I/O Interrupt Controller (ACPI 6.5) */
118760f2096bSHuacai Chen 
118860f2096bSHuacai Chen struct acpi_madt_eio_pic {
118960f2096bSHuacai Chen 	struct acpi_subtable_header header;
119060f2096bSHuacai Chen 	u8 version;
119160f2096bSHuacai Chen 	u8 cascade;
119260f2096bSHuacai Chen 	u8 node;
119360f2096bSHuacai Chen 	u64 node_map;
119460f2096bSHuacai Chen };
119560f2096bSHuacai Chen 
119660f2096bSHuacai Chen /* Values for Version field above */
119760f2096bSHuacai Chen 
119860f2096bSHuacai Chen enum acpi_madt_eio_pic_version {
119960f2096bSHuacai Chen 	ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
120060f2096bSHuacai Chen 	ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
120160f2096bSHuacai Chen 	ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
120260f2096bSHuacai Chen };
120360f2096bSHuacai Chen 
120460f2096bSHuacai Chen /* 21: MSI Interrupt Controller (ACPI 6.5) */
120560f2096bSHuacai Chen 
120660f2096bSHuacai Chen struct acpi_madt_msi_pic {
120760f2096bSHuacai Chen 	struct acpi_subtable_header header;
120860f2096bSHuacai Chen 	u8 version;
120960f2096bSHuacai Chen 	u64 msg_address;
121060f2096bSHuacai Chen 	u32 start;
121160f2096bSHuacai Chen 	u32 count;
121260f2096bSHuacai Chen };
121360f2096bSHuacai Chen 
121460f2096bSHuacai Chen /* Values for Version field above */
121560f2096bSHuacai Chen 
121660f2096bSHuacai Chen enum acpi_madt_msi_pic_version {
121760f2096bSHuacai Chen 	ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
121860f2096bSHuacai Chen 	ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
121960f2096bSHuacai Chen 	ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
122060f2096bSHuacai Chen };
122160f2096bSHuacai Chen 
122260f2096bSHuacai Chen /* 22: Bridge I/O Interrupt Controller (ACPI 6.5) */
122360f2096bSHuacai Chen 
122460f2096bSHuacai Chen struct acpi_madt_bio_pic {
122560f2096bSHuacai Chen 	struct acpi_subtable_header header;
122660f2096bSHuacai Chen 	u8 version;
122760f2096bSHuacai Chen 	u64 address;
122860f2096bSHuacai Chen 	u16 size;
122960f2096bSHuacai Chen 	u16 id;
123060f2096bSHuacai Chen 	u16 gsi_base;
123160f2096bSHuacai Chen };
123260f2096bSHuacai Chen 
123360f2096bSHuacai Chen /* Values for Version field above */
123460f2096bSHuacai Chen 
123560f2096bSHuacai Chen enum acpi_madt_bio_pic_version {
123660f2096bSHuacai Chen 	ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
123760f2096bSHuacai Chen 	ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
123860f2096bSHuacai Chen 	ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
123960f2096bSHuacai Chen };
124060f2096bSHuacai Chen 
124160f2096bSHuacai Chen /* 23: LPC Interrupt Controller (ACPI 6.5) */
124260f2096bSHuacai Chen 
124360f2096bSHuacai Chen struct acpi_madt_lpc_pic {
124460f2096bSHuacai Chen 	struct acpi_subtable_header header;
124560f2096bSHuacai Chen 	u8 version;
124660f2096bSHuacai Chen 	u64 address;
124760f2096bSHuacai Chen 	u16 size;
124860f2096bSHuacai Chen 	u8 cascade;
124960f2096bSHuacai Chen };
125060f2096bSHuacai Chen 
125160f2096bSHuacai Chen /* Values for Version field above */
125260f2096bSHuacai Chen 
125360f2096bSHuacai Chen enum acpi_madt_lpc_pic_version {
125460f2096bSHuacai Chen 	ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
125560f2096bSHuacai Chen 	ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
125660f2096bSHuacai Chen 	ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
125760f2096bSHuacai Chen };
125860f2096bSHuacai Chen 
1259f2ca92d0SSunil V L /* 24: RISC-V INTC */
1260f2ca92d0SSunil V L struct acpi_madt_rintc {
1261f2ca92d0SSunil V L 	struct acpi_subtable_header header;
1262f2ca92d0SSunil V L 	u8 version;
1263f2ca92d0SSunil V L 	u8 reserved;
1264f2ca92d0SSunil V L 	u32 flags;
1265f2ca92d0SSunil V L 	u64 hart_id;
1266f2ca92d0SSunil V L 	u32 uid;		/* ACPI processor UID */
1267f3b19adeSSunil V L 	u32 ext_intc_id;	/* External INTC Id */
1268f3b19adeSSunil V L 	u64 imsic_addr;		/* IMSIC base address */
1269f3b19adeSSunil V L 	u32 imsic_size;		/* IMSIC size */
1270f2ca92d0SSunil V L };
1271f2ca92d0SSunil V L 
1272f2ca92d0SSunil V L /* Values for RISC-V INTC Version field above */
1273f2ca92d0SSunil V L 
1274f2ca92d0SSunil V L enum acpi_madt_rintc_version {
1275f2ca92d0SSunil V L 	ACPI_MADT_RINTC_VERSION_NONE = 0,
1276f2ca92d0SSunil V L 	ACPI_MADT_RINTC_VERSION_V1 = 1,
1277f2ca92d0SSunil V L 	ACPI_MADT_RINTC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
1278f2ca92d0SSunil V L };
1279f2ca92d0SSunil V L 
1280f3b19adeSSunil V L /* 25: RISC-V IMSIC */
1281f3b19adeSSunil V L struct acpi_madt_imsic {
1282f3b19adeSSunil V L 	struct acpi_subtable_header header;
1283f3b19adeSSunil V L 	u8 version;
1284f3b19adeSSunil V L 	u8 reserved;
1285f3b19adeSSunil V L 	u32 flags;
1286f3b19adeSSunil V L 	u16 num_ids;
1287f3b19adeSSunil V L 	u16 num_guest_ids;
1288f3b19adeSSunil V L 	u8 guest_index_bits;
1289f3b19adeSSunil V L 	u8 hart_index_bits;
1290f3b19adeSSunil V L 	u8 group_index_bits;
1291f3b19adeSSunil V L 	u8 group_index_shift;
1292f3b19adeSSunil V L };
1293f3b19adeSSunil V L 
1294f3b19adeSSunil V L /* 26: RISC-V APLIC */
1295f3b19adeSSunil V L struct acpi_madt_aplic {
1296f3b19adeSSunil V L 	struct acpi_subtable_header header;
1297f3b19adeSSunil V L 	u8 version;
1298f3b19adeSSunil V L 	u8 id;
1299f3b19adeSSunil V L 	u32 flags;
1300f3b19adeSSunil V L 	u8 hw_id[8];
1301f3b19adeSSunil V L 	u16 num_idcs;
1302f3b19adeSSunil V L 	u16 num_sources;
1303f3b19adeSSunil V L 	u32 gsi_base;
1304f3b19adeSSunil V L 	u64 base_addr;
1305f3b19adeSSunil V L 	u32 size;
1306f3b19adeSSunil V L };
1307f3b19adeSSunil V L 
1308f3b19adeSSunil V L /* 27: RISC-V PLIC */
1309f3b19adeSSunil V L struct acpi_madt_plic {
1310f3b19adeSSunil V L 	struct acpi_subtable_header header;
1311f3b19adeSSunil V L 	u8 version;
1312f3b19adeSSunil V L 	u8 id;
1313f3b19adeSSunil V L 	u8 hw_id[8];
1314f3b19adeSSunil V L 	u16 num_irqs;
1315f3b19adeSSunil V L 	u16 max_prio;
1316f3b19adeSSunil V L 	u32 flags;
1317f3b19adeSSunil V L 	u32 size;
1318f3b19adeSSunil V L 	u64 base_addr;
1319f3b19adeSSunil V L 	u32 gsi_base;
1320f3b19adeSSunil V L };
1321f3b19adeSSunil V L 
132260f2096bSHuacai Chen /* 80: OEM data */
1323da6a9bbeSBob Moore 
1324da6a9bbeSBob Moore struct acpi_madt_oem_data {
13252a85fc56SKees Cook 	ACPI_FLEX_ARRAY(u8, oem_data);
1326da6a9bbeSBob Moore };
1327da6a9bbeSBob Moore 
1328e62f8227SErik Schmauss /*
1329e62f8227SErik Schmauss  * Common flags fields for MADT subtables
1330e62f8227SErik Schmauss  */
1331e62f8227SErik Schmauss 
1332e62f8227SErik Schmauss /* MADT Local APIC flags */
1333e62f8227SErik Schmauss 
1334e62f8227SErik Schmauss #define ACPI_MADT_ENABLED           (1)	/* 00: Processor is usable if set */
1335435a8dc8SMario Limonciello #define ACPI_MADT_ONLINE_CAPABLE    (2)	/* 01: System HW supports enabling processor at runtime */
1336e62f8227SErik Schmauss 
1337e62f8227SErik Schmauss /* MADT MPS INTI flags (inti_flags) */
1338e62f8227SErik Schmauss 
1339e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_MASK     (3)	/* 00-01: Polarity of APIC I/O input signals */
1340e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_MASK      (3<<2)	/* 02-03: Trigger mode of APIC input signals */
1341e62f8227SErik Schmauss 
1342e62f8227SErik Schmauss /* Values for MPS INTI flags */
1343e62f8227SErik Schmauss 
1344e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_CONFORMS       0
1345e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
1346e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_RESERVED       2
1347e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
1348e62f8227SErik Schmauss 
1349e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_CONFORMS        (0)
1350e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
1351e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
1352e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
1353e62f8227SErik Schmauss 
1354e62f8227SErik Schmauss /*******************************************************************************
1355e62f8227SErik Schmauss  *
13561a49b72cSBob Moore  * MCFG - PCI Memory Mapped Configuration table and subtable
13576e2d5ebdSBob Moore  *        Version 1
13586e2d5ebdSBob Moore  *
13596e2d5ebdSBob Moore  * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
1360b24aad44SBob Moore  *
1361b24aad44SBob Moore  ******************************************************************************/
1362b24aad44SBob Moore 
1363b24aad44SBob Moore struct acpi_table_mcfg {
1364b24aad44SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
1365b24aad44SBob Moore 	u8 reserved[8];
1366b24aad44SBob Moore };
1367b24aad44SBob Moore 
1368b24aad44SBob Moore /* Subtable */
1369b24aad44SBob Moore 
1370b24aad44SBob Moore struct acpi_mcfg_allocation {
1371b24aad44SBob Moore 	u64 address;		/* Base address, processor-relative */
1372b24aad44SBob Moore 	u16 pci_segment;	/* PCI segment group number */
1373b24aad44SBob Moore 	u8 start_bus_number;	/* Starting PCI Bus number */
1374b24aad44SBob Moore 	u8 end_bus_number;	/* Final PCI Bus number */
1375b24aad44SBob Moore 	u32 reserved;
1376b24aad44SBob Moore };
1377b24aad44SBob Moore 
1378b24aad44SBob Moore /*******************************************************************************
1379b24aad44SBob Moore  *
13800e264f0bSBob Moore  * MCHI - Management Controller Host Interface Table
13810e264f0bSBob Moore  *        Version 1
13820e264f0bSBob Moore  *
13830e264f0bSBob Moore  * Conforms to "Management Component Transport Protocol (MCTP) Host
13840e264f0bSBob Moore  * Interface Specification", Revision 1.0.0a, October 13, 2009
13850e264f0bSBob Moore  *
13860e264f0bSBob Moore  ******************************************************************************/
13870e264f0bSBob Moore 
13880e264f0bSBob Moore struct acpi_table_mchi {
13890e264f0bSBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
13900e264f0bSBob Moore 	u8 interface_type;
13910e264f0bSBob Moore 	u8 protocol;
13920e264f0bSBob Moore 	u64 protocol_data;
13930e264f0bSBob Moore 	u8 interrupt_type;
13940e264f0bSBob Moore 	u8 gpe;
13950e264f0bSBob Moore 	u8 pci_device_flag;
13960e264f0bSBob Moore 	u32 global_interrupt;
13970e264f0bSBob Moore 	struct acpi_generic_address control_register;
13980e264f0bSBob Moore 	u8 pci_segment;
13990e264f0bSBob Moore 	u8 pci_bus;
14000e264f0bSBob Moore 	u8 pci_device;
14010e264f0bSBob Moore 	u8 pci_function;
14020e264f0bSBob Moore };
14030e264f0bSBob Moore 
14040e264f0bSBob Moore /*******************************************************************************
14050e264f0bSBob Moore  *
140647920aaeSHesham Almatary  * MPAM - Memory System Resource Partitioning and Monitoring
140747920aaeSHesham Almatary  *
140847920aaeSHesham Almatary  * Conforms to "ACPI for Memory System Resource Partitioning and Monitoring 2.0"
140947920aaeSHesham Almatary  * Document number: ARM DEN 0065, December, 2022.
141047920aaeSHesham Almatary  *
141147920aaeSHesham Almatary  ******************************************************************************/
141247920aaeSHesham Almatary 
141347920aaeSHesham Almatary /* MPAM RIS locator types. Table 11, Location types */
141447920aaeSHesham Almatary enum acpi_mpam_locator_type {
141547920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE = 0,
141647920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_MEMORY = 1,
141747920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_SMMU = 2,
141847920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE = 3,
141947920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE = 4,
142047920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_INTERCONNECT = 5,
142147920aaeSHesham Almatary 	ACPI_MPAM_LOCATION_TYPE_UNKNOWN = 0xFF
142247920aaeSHesham Almatary };
142347920aaeSHesham Almatary 
142447920aaeSHesham Almatary /* MPAM Functional dependency descriptor. Table 10 */
142547920aaeSHesham Almatary struct acpi_mpam_func_deps {
142647920aaeSHesham Almatary 	u32 producer;
142747920aaeSHesham Almatary 	u32 reserved;
142847920aaeSHesham Almatary };
142947920aaeSHesham Almatary 
143047920aaeSHesham Almatary /* MPAM Processor cache locator descriptor. Table 13 */
143147920aaeSHesham Almatary struct acpi_mpam_resource_cache_locator {
143247920aaeSHesham Almatary 	u64 cache_reference;
143347920aaeSHesham Almatary 	u32 reserved;
143447920aaeSHesham Almatary };
143547920aaeSHesham Almatary 
143647920aaeSHesham Almatary /* MPAM Memory locator descriptor. Table 14 */
143747920aaeSHesham Almatary struct acpi_mpam_resource_memory_locator {
143847920aaeSHesham Almatary 	u64 proximity_domain;
143947920aaeSHesham Almatary 	u32 reserved;
144047920aaeSHesham Almatary };
144147920aaeSHesham Almatary 
144247920aaeSHesham Almatary /* MPAM SMMU locator descriptor. Table 15 */
144347920aaeSHesham Almatary struct acpi_mpam_resource_smmu_locator {
144447920aaeSHesham Almatary 	u64 smmu_interface;
144547920aaeSHesham Almatary 	u32 reserved;
144647920aaeSHesham Almatary };
144747920aaeSHesham Almatary 
144847920aaeSHesham Almatary /* MPAM Memory-side cache locator descriptor. Table 16 */
144947920aaeSHesham Almatary struct acpi_mpam_resource_memcache_locator {
145047920aaeSHesham Almatary 	u8 reserved[7];
145147920aaeSHesham Almatary 	u8 level;
145247920aaeSHesham Almatary 	u32 reference;
145347920aaeSHesham Almatary };
145447920aaeSHesham Almatary 
145547920aaeSHesham Almatary /* MPAM ACPI device locator descriptor. Table 17 */
145647920aaeSHesham Almatary struct acpi_mpam_resource_acpi_locator {
145747920aaeSHesham Almatary 	u64 acpi_hw_id;
145847920aaeSHesham Almatary 	u32 acpi_unique_id;
145947920aaeSHesham Almatary };
146047920aaeSHesham Almatary 
146147920aaeSHesham Almatary /* MPAM Interconnect locator descriptor. Table 18 */
146247920aaeSHesham Almatary struct acpi_mpam_resource_interconnect_locator {
146347920aaeSHesham Almatary 	u64 inter_connect_desc_tbl_off;
146447920aaeSHesham Almatary 	u32 reserved;
146547920aaeSHesham Almatary };
146647920aaeSHesham Almatary 
146747920aaeSHesham Almatary /* MPAM Locator structure. Table 12 */
146847920aaeSHesham Almatary struct acpi_mpam_resource_generic_locator {
146947920aaeSHesham Almatary 	u64 descriptor1;
147047920aaeSHesham Almatary 	u32 descriptor2;
147147920aaeSHesham Almatary };
147247920aaeSHesham Almatary 
147347920aaeSHesham Almatary union acpi_mpam_resource_locator {
147447920aaeSHesham Almatary 	struct acpi_mpam_resource_cache_locator cache_locator;
147547920aaeSHesham Almatary 	struct acpi_mpam_resource_memory_locator memory_locator;
147647920aaeSHesham Almatary 	struct acpi_mpam_resource_smmu_locator smmu_locator;
147747920aaeSHesham Almatary 	struct acpi_mpam_resource_memcache_locator mem_cache_locator;
147847920aaeSHesham Almatary 	struct acpi_mpam_resource_acpi_locator acpi_locator;
147947920aaeSHesham Almatary 	struct acpi_mpam_resource_interconnect_locator interconnect_ifc_locator;
148047920aaeSHesham Almatary 	struct acpi_mpam_resource_generic_locator generic_locator;
148147920aaeSHesham Almatary };
148247920aaeSHesham Almatary 
148347920aaeSHesham Almatary /* Memory System Component Resource Node Structure Table 9 */
148447920aaeSHesham Almatary struct acpi_mpam_resource_node {
148547920aaeSHesham Almatary 	u32 identifier;
148647920aaeSHesham Almatary 	u8 ris_index;
148747920aaeSHesham Almatary 	u16 reserved1;
148847920aaeSHesham Almatary 	u8 locator_type;
148947920aaeSHesham Almatary 	union acpi_mpam_resource_locator locator;
149047920aaeSHesham Almatary 	u32 num_functional_deps;
149147920aaeSHesham Almatary };
149247920aaeSHesham Almatary 
149347920aaeSHesham Almatary /* Memory System Component (MSC) Node Structure. Table 4 */
149447920aaeSHesham Almatary struct acpi_mpam_msc_node {
149547920aaeSHesham Almatary 	u16 length;
149647920aaeSHesham Almatary 	u8 interface_type;
149747920aaeSHesham Almatary 	u8 reserved;
149847920aaeSHesham Almatary 	u32 identifier;
149947920aaeSHesham Almatary 	u64 base_address;
150047920aaeSHesham Almatary 	u32 mmio_size;
150147920aaeSHesham Almatary 	u32 overflow_interrupt;
150247920aaeSHesham Almatary 	u32 overflow_interrupt_flags;
150347920aaeSHesham Almatary 	u32 reserved1;
150447920aaeSHesham Almatary 	u32 overflow_interrupt_affinity;
150547920aaeSHesham Almatary 	u32 error_interrupt;
150647920aaeSHesham Almatary 	u32 error_interrupt_flags;
150747920aaeSHesham Almatary 	u32 reserved2;
150847920aaeSHesham Almatary 	u32 error_interrupt_affinity;
150947920aaeSHesham Almatary 	u32 max_nrdy_usec;
151047920aaeSHesham Almatary 	u64 hardware_id_linked_device;
151147920aaeSHesham Almatary 	u32 instance_id_linked_device;
151247920aaeSHesham Almatary 	u32 num_resouce_nodes;
151347920aaeSHesham Almatary };
151447920aaeSHesham Almatary 
151547920aaeSHesham Almatary struct acpi_table_mpam {
151647920aaeSHesham Almatary 	struct acpi_table_header header;	/* Common ACPI table header */
151747920aaeSHesham Almatary };
151847920aaeSHesham Almatary 
151947920aaeSHesham Almatary /*******************************************************************************
152047920aaeSHesham Almatary  *
1521e62f8227SErik Schmauss  * MPST - Memory Power State Table (ACPI 5.0)
1522e62f8227SErik Schmauss  *        Version 1
1523e62f8227SErik Schmauss  *
1524e62f8227SErik Schmauss  ******************************************************************************/
1525e62f8227SErik Schmauss 
1526e62f8227SErik Schmauss #define ACPI_MPST_CHANNEL_INFO \
1527e62f8227SErik Schmauss 	u8                              channel_id; \
1528e62f8227SErik Schmauss 	u8                              reserved1[3]; \
1529e62f8227SErik Schmauss 	u16                             power_node_count; \
1530e62f8227SErik Schmauss 	u16                             reserved2;
1531e62f8227SErik Schmauss 
1532e62f8227SErik Schmauss /* Main table */
1533e62f8227SErik Schmauss 
1534e62f8227SErik Schmauss struct acpi_table_mpst {
1535e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1536e62f8227SErik Schmauss 	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
1537e62f8227SErik Schmauss };
1538e62f8227SErik Schmauss 
1539e62f8227SErik Schmauss /* Memory Platform Communication Channel Info */
1540e62f8227SErik Schmauss 
1541e62f8227SErik Schmauss struct acpi_mpst_channel {
1542e62f8227SErik Schmauss 	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
1543e62f8227SErik Schmauss };
1544e62f8227SErik Schmauss 
1545e62f8227SErik Schmauss /* Memory Power Node Structure */
1546e62f8227SErik Schmauss 
1547e62f8227SErik Schmauss struct acpi_mpst_power_node {
1548e62f8227SErik Schmauss 	u8 flags;
1549e62f8227SErik Schmauss 	u8 reserved1;
1550e62f8227SErik Schmauss 	u16 node_id;
1551e62f8227SErik Schmauss 	u32 length;
1552e62f8227SErik Schmauss 	u64 range_address;
1553e62f8227SErik Schmauss 	u64 range_length;
1554e62f8227SErik Schmauss 	u32 num_power_states;
1555e62f8227SErik Schmauss 	u32 num_physical_components;
1556e62f8227SErik Schmauss };
1557e62f8227SErik Schmauss 
1558e62f8227SErik Schmauss /* Values for Flags field above */
1559e62f8227SErik Schmauss 
1560e62f8227SErik Schmauss #define ACPI_MPST_ENABLED               1
1561e62f8227SErik Schmauss #define ACPI_MPST_POWER_MANAGED         2
1562e62f8227SErik Schmauss #define ACPI_MPST_HOT_PLUG_CAPABLE      4
1563e62f8227SErik Schmauss 
1564e62f8227SErik Schmauss /* Memory Power State Structure (follows POWER_NODE above) */
1565e62f8227SErik Schmauss 
1566e62f8227SErik Schmauss struct acpi_mpst_power_state {
1567e62f8227SErik Schmauss 	u8 power_state;
1568e62f8227SErik Schmauss 	u8 info_index;
1569e62f8227SErik Schmauss };
1570e62f8227SErik Schmauss 
1571e62f8227SErik Schmauss /* Physical Component ID Structure (follows POWER_STATE above) */
1572e62f8227SErik Schmauss 
1573e62f8227SErik Schmauss struct acpi_mpst_component {
1574e62f8227SErik Schmauss 	u16 component_id;
1575e62f8227SErik Schmauss };
1576e62f8227SErik Schmauss 
1577e62f8227SErik Schmauss /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
1578e62f8227SErik Schmauss 
1579e62f8227SErik Schmauss struct acpi_mpst_data_hdr {
1580e62f8227SErik Schmauss 	u16 characteristics_count;
1581e62f8227SErik Schmauss 	u16 reserved;
1582e62f8227SErik Schmauss };
1583e62f8227SErik Schmauss 
1584e62f8227SErik Schmauss struct acpi_mpst_power_data {
1585e62f8227SErik Schmauss 	u8 structure_id;
1586e62f8227SErik Schmauss 	u8 flags;
1587e62f8227SErik Schmauss 	u16 reserved1;
1588e62f8227SErik Schmauss 	u32 average_power;
1589e62f8227SErik Schmauss 	u32 power_saving;
1590e62f8227SErik Schmauss 	u64 exit_latency;
1591e62f8227SErik Schmauss 	u64 reserved2;
1592e62f8227SErik Schmauss };
1593e62f8227SErik Schmauss 
1594e62f8227SErik Schmauss /* Values for Flags field above */
1595e62f8227SErik Schmauss 
1596e62f8227SErik Schmauss #define ACPI_MPST_PRESERVE              1
1597e62f8227SErik Schmauss #define ACPI_MPST_AUTOENTRY             2
1598e62f8227SErik Schmauss #define ACPI_MPST_AUTOEXIT              4
1599e62f8227SErik Schmauss 
1600e62f8227SErik Schmauss /* Shared Memory Region (not part of an ACPI table) */
1601e62f8227SErik Schmauss 
1602e62f8227SErik Schmauss struct acpi_mpst_shared {
1603e62f8227SErik Schmauss 	u32 signature;
1604e62f8227SErik Schmauss 	u16 pcc_command;
1605e62f8227SErik Schmauss 	u16 pcc_status;
1606e62f8227SErik Schmauss 	u32 command_register;
1607e62f8227SErik Schmauss 	u32 status_register;
1608e62f8227SErik Schmauss 	u32 power_state_id;
1609e62f8227SErik Schmauss 	u32 power_node_id;
1610e62f8227SErik Schmauss 	u64 energy_consumed;
1611e62f8227SErik Schmauss 	u64 average_power;
1612e62f8227SErik Schmauss };
1613e62f8227SErik Schmauss 
1614e62f8227SErik Schmauss /*******************************************************************************
1615e62f8227SErik Schmauss  *
1616e62f8227SErik Schmauss  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
1617e62f8227SErik Schmauss  *        Version 1
1618e62f8227SErik Schmauss  *
1619e62f8227SErik Schmauss  ******************************************************************************/
1620e62f8227SErik Schmauss 
1621e62f8227SErik Schmauss struct acpi_table_msct {
1622e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1623e62f8227SErik Schmauss 	u32 proximity_offset;	/* Location of proximity info struct(s) */
1624e62f8227SErik Schmauss 	u32 max_proximity_domains;	/* Max number of proximity domains */
1625e62f8227SErik Schmauss 	u32 max_clock_domains;	/* Max number of clock domains */
1626e62f8227SErik Schmauss 	u64 max_address;	/* Max physical address in system */
1627e62f8227SErik Schmauss };
1628e62f8227SErik Schmauss 
1629e62f8227SErik Schmauss /* subtable - Maximum Proximity Domain Information. Version 1 */
1630e62f8227SErik Schmauss 
1631e62f8227SErik Schmauss struct acpi_msct_proximity {
1632e62f8227SErik Schmauss 	u8 revision;
1633e62f8227SErik Schmauss 	u8 length;
1634e62f8227SErik Schmauss 	u32 range_start;	/* Start of domain range */
1635e62f8227SErik Schmauss 	u32 range_end;		/* End of domain range */
1636e62f8227SErik Schmauss 	u32 processor_capacity;
1637e62f8227SErik Schmauss 	u64 memory_capacity;	/* In bytes */
1638e62f8227SErik Schmauss };
1639e62f8227SErik Schmauss 
1640e62f8227SErik Schmauss /*******************************************************************************
1641e62f8227SErik Schmauss  *
16425132f2faSBob Moore  * MSDM - Microsoft Data Management table
16435132f2faSBob Moore  *
16445132f2faSBob Moore  * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
16455132f2faSBob Moore  * November 29, 2011. Copyright 2011 Microsoft
16465132f2faSBob Moore  *
16475132f2faSBob Moore  ******************************************************************************/
16485132f2faSBob Moore 
16495132f2faSBob Moore /* Basic MSDM table is only the common ACPI header */
16505132f2faSBob Moore 
16515132f2faSBob Moore struct acpi_table_msdm {
16525132f2faSBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
16535132f2faSBob Moore };
16545132f2faSBob Moore 
16555132f2faSBob Moore /*******************************************************************************
16565132f2faSBob Moore  *
1657e62f8227SErik Schmauss  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
1658e62f8227SErik Schmauss  *        Version 1
1659e62f8227SErik Schmauss  *
1660e62f8227SErik Schmauss  ******************************************************************************/
1661e62f8227SErik Schmauss 
1662e62f8227SErik Schmauss struct acpi_table_nfit {
1663e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1664e62f8227SErik Schmauss 	u32 reserved;		/* Reserved, must be zero */
1665e62f8227SErik Schmauss };
1666e62f8227SErik Schmauss 
1667e62f8227SErik Schmauss /* Subtable header for NFIT */
1668e62f8227SErik Schmauss 
1669e62f8227SErik Schmauss struct acpi_nfit_header {
1670e62f8227SErik Schmauss 	u16 type;
1671e62f8227SErik Schmauss 	u16 length;
1672e62f8227SErik Schmauss };
1673e62f8227SErik Schmauss 
1674e62f8227SErik Schmauss /* Values for subtable type in struct acpi_nfit_header */
1675e62f8227SErik Schmauss 
1676e62f8227SErik Schmauss enum acpi_nfit_type {
1677e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
1678e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_MEMORY_MAP = 1,
1679e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_INTERLEAVE = 2,
1680e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_SMBIOS = 3,
1681e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_CONTROL_REGION = 4,
1682e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_DATA_REGION = 5,
1683e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
1684e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_CAPABILITIES = 7,
1685e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_RESERVED = 8	/* 8 and greater are reserved */
1686e62f8227SErik Schmauss };
1687e62f8227SErik Schmauss 
1688e62f8227SErik Schmauss /*
1689e62f8227SErik Schmauss  * NFIT Subtables
1690e62f8227SErik Schmauss  */
1691e62f8227SErik Schmauss 
1692e62f8227SErik Schmauss /* 0: System Physical Address Range Structure */
1693e62f8227SErik Schmauss 
1694e62f8227SErik Schmauss struct acpi_nfit_system_address {
1695e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1696e62f8227SErik Schmauss 	u16 range_index;
1697e62f8227SErik Schmauss 	u16 flags;
1698e62f8227SErik Schmauss 	u32 reserved;		/* Reserved, must be zero */
1699e62f8227SErik Schmauss 	u32 proximity_domain;
1700e62f8227SErik Schmauss 	u8 range_guid[16];
1701e62f8227SErik Schmauss 	u64 address;
1702e62f8227SErik Schmauss 	u64 length;
1703e62f8227SErik Schmauss 	u64 memory_mapping;
1704cf16b05cSBob Moore 	u64 location_cookie;	/* ACPI 6.4 */
1705e62f8227SErik Schmauss };
1706e62f8227SErik Schmauss 
1707e62f8227SErik Schmauss /* Flags */
1708e62f8227SErik Schmauss 
1709e62f8227SErik Schmauss #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)	/* 00: Add/Online Operation Only */
1710e62f8227SErik Schmauss #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)	/* 01: Proximity Domain Valid */
1711cf16b05cSBob Moore #define ACPI_NFIT_LOCATION_COOKIE_VALID (1<<2)	/* 02: SPA location cookie valid (ACPI 6.4) */
1712e62f8227SErik Schmauss 
1713e62f8227SErik Schmauss /* Range Type GUIDs appear in the include/acuuid.h file */
1714e62f8227SErik Schmauss 
1715e62f8227SErik Schmauss /* 1: Memory Device to System Address Range Map Structure */
1716e62f8227SErik Schmauss 
1717e62f8227SErik Schmauss struct acpi_nfit_memory_map {
1718e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1719e62f8227SErik Schmauss 	u32 device_handle;
1720e62f8227SErik Schmauss 	u16 physical_id;
1721e62f8227SErik Schmauss 	u16 region_id;
1722e62f8227SErik Schmauss 	u16 range_index;
1723e62f8227SErik Schmauss 	u16 region_index;
1724e62f8227SErik Schmauss 	u64 region_size;
1725e62f8227SErik Schmauss 	u64 region_offset;
1726e62f8227SErik Schmauss 	u64 address;
1727e62f8227SErik Schmauss 	u16 interleave_index;
1728e62f8227SErik Schmauss 	u16 interleave_ways;
1729e62f8227SErik Schmauss 	u16 flags;
1730e62f8227SErik Schmauss 	u16 reserved;		/* Reserved, must be zero */
1731e62f8227SErik Schmauss };
1732e62f8227SErik Schmauss 
1733e62f8227SErik Schmauss /* Flags */
1734e62f8227SErik Schmauss 
1735e62f8227SErik Schmauss #define ACPI_NFIT_MEM_SAVE_FAILED       (1)	/* 00: Last SAVE to Memory Device failed */
1736e62f8227SErik Schmauss #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)	/* 01: Last RESTORE from Memory Device failed */
1737e62f8227SErik Schmauss #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)	/* 02: Platform flush failed */
1738e62f8227SErik Schmauss #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)	/* 03: Memory Device is not armed */
1739e62f8227SErik Schmauss #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)	/* 04: Memory Device observed SMART/health events */
1740e62f8227SErik Schmauss #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)	/* 05: SMART/health events enabled */
1741e62f8227SErik Schmauss #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)	/* 06: Mapping to SPA failed */
1742e62f8227SErik Schmauss 
1743e62f8227SErik Schmauss /* 2: Interleave Structure */
1744e62f8227SErik Schmauss 
1745e62f8227SErik Schmauss struct acpi_nfit_interleave {
1746e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1747e62f8227SErik Schmauss 	u16 interleave_index;
1748e62f8227SErik Schmauss 	u16 reserved;		/* Reserved, must be zero */
1749e62f8227SErik Schmauss 	u32 line_count;
1750e62f8227SErik Schmauss 	u32 line_size;
17512a5ab998SKees Cook 	u32 line_offset[];	/* Variable length */
1752e62f8227SErik Schmauss };
1753e62f8227SErik Schmauss 
1754e62f8227SErik Schmauss /* 3: SMBIOS Management Information Structure */
1755e62f8227SErik Schmauss 
1756e62f8227SErik Schmauss struct acpi_nfit_smbios {
1757e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1758e62f8227SErik Schmauss 	u32 reserved;		/* Reserved, must be zero */
175974522feaSKees Cook 	u8 data[];		/* Variable length */
1760e62f8227SErik Schmauss };
1761e62f8227SErik Schmauss 
1762e62f8227SErik Schmauss /* 4: NVDIMM Control Region Structure */
1763e62f8227SErik Schmauss 
1764e62f8227SErik Schmauss struct acpi_nfit_control_region {
1765e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1766e62f8227SErik Schmauss 	u16 region_index;
1767e62f8227SErik Schmauss 	u16 vendor_id;
1768e62f8227SErik Schmauss 	u16 device_id;
1769e62f8227SErik Schmauss 	u16 revision_id;
1770e62f8227SErik Schmauss 	u16 subsystem_vendor_id;
1771e62f8227SErik Schmauss 	u16 subsystem_device_id;
1772e62f8227SErik Schmauss 	u16 subsystem_revision_id;
1773e62f8227SErik Schmauss 	u8 valid_fields;
1774e62f8227SErik Schmauss 	u8 manufacturing_location;
1775e62f8227SErik Schmauss 	u16 manufacturing_date;
1776e62f8227SErik Schmauss 	u8 reserved[2];		/* Reserved, must be zero */
1777e62f8227SErik Schmauss 	u32 serial_number;
1778e62f8227SErik Schmauss 	u16 code;
1779e62f8227SErik Schmauss 	u16 windows;
1780e62f8227SErik Schmauss 	u64 window_size;
1781e62f8227SErik Schmauss 	u64 command_offset;
1782e62f8227SErik Schmauss 	u64 command_size;
1783e62f8227SErik Schmauss 	u64 status_offset;
1784e62f8227SErik Schmauss 	u64 status_size;
1785e62f8227SErik Schmauss 	u16 flags;
1786e62f8227SErik Schmauss 	u8 reserved1[6];	/* Reserved, must be zero */
1787e62f8227SErik Schmauss };
1788e62f8227SErik Schmauss 
1789e62f8227SErik Schmauss /* Flags */
1790e62f8227SErik Schmauss 
1791e62f8227SErik Schmauss #define ACPI_NFIT_CONTROL_BUFFERED          (1)	/* Block Data Windows implementation is buffered */
1792e62f8227SErik Schmauss 
1793e62f8227SErik Schmauss /* valid_fields bits */
1794e62f8227SErik Schmauss 
1795e62f8227SErik Schmauss #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)	/* Manufacturing fields are valid */
1796e62f8227SErik Schmauss 
1797e62f8227SErik Schmauss /* 5: NVDIMM Block Data Window Region Structure */
1798e62f8227SErik Schmauss 
1799e62f8227SErik Schmauss struct acpi_nfit_data_region {
1800e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1801e62f8227SErik Schmauss 	u16 region_index;
1802e62f8227SErik Schmauss 	u16 windows;
1803e62f8227SErik Schmauss 	u64 offset;
1804e62f8227SErik Schmauss 	u64 size;
1805e62f8227SErik Schmauss 	u64 capacity;
1806e62f8227SErik Schmauss 	u64 start_address;
1807e62f8227SErik Schmauss };
1808e62f8227SErik Schmauss 
1809e62f8227SErik Schmauss /* 6: Flush Hint Address Structure */
1810e62f8227SErik Schmauss 
1811e62f8227SErik Schmauss struct acpi_nfit_flush_address {
1812e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1813e62f8227SErik Schmauss 	u32 device_handle;
1814e62f8227SErik Schmauss 	u16 hint_count;
1815e62f8227SErik Schmauss 	u8 reserved[6];		/* Reserved, must be zero */
181674522feaSKees Cook 	u64 hint_address[];	/* Variable length */
1817e62f8227SErik Schmauss };
1818e62f8227SErik Schmauss 
1819e62f8227SErik Schmauss /* 7: Platform Capabilities Structure */
1820e62f8227SErik Schmauss 
1821e62f8227SErik Schmauss struct acpi_nfit_capabilities {
1822e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1823e62f8227SErik Schmauss 	u8 highest_capability;
1824e62f8227SErik Schmauss 	u8 reserved[3];		/* Reserved, must be zero */
1825e62f8227SErik Schmauss 	u32 capabilities;
1826e62f8227SErik Schmauss 	u32 reserved2;
1827e62f8227SErik Schmauss };
1828e62f8227SErik Schmauss 
1829e62f8227SErik Schmauss /* Capabilities Flags */
1830e62f8227SErik Schmauss 
1831e62f8227SErik Schmauss #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)	/* 00: Cache Flush to NVDIMM capable */
1832e62f8227SErik Schmauss #define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)	/* 01: Memory Flush to NVDIMM capable */
1833e62f8227SErik Schmauss #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)	/* 02: Memory Mirroring capable */
1834e62f8227SErik Schmauss 
1835e62f8227SErik Schmauss /*
1836e62f8227SErik Schmauss  * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1837e62f8227SErik Schmauss  */
1838e62f8227SErik Schmauss struct nfit_device_handle {
1839e62f8227SErik Schmauss 	u32 handle;
1840e62f8227SErik Schmauss };
1841e62f8227SErik Schmauss 
1842e62f8227SErik Schmauss /* Device handle construction and extraction macros */
1843e62f8227SErik Schmauss 
1844e62f8227SErik Schmauss #define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
1845e62f8227SErik Schmauss #define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
1846e62f8227SErik Schmauss #define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
1847e62f8227SErik Schmauss #define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
1848e62f8227SErik Schmauss #define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
1849e62f8227SErik Schmauss 
1850e62f8227SErik Schmauss #define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
1851e62f8227SErik Schmauss #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
1852e62f8227SErik Schmauss #define ACPI_NFIT_MEMORY_ID_OFFSET              8
1853e62f8227SErik Schmauss #define ACPI_NFIT_SOCKET_ID_OFFSET              12
1854e62f8227SErik Schmauss #define ACPI_NFIT_NODE_ID_OFFSET                16
1855e62f8227SErik Schmauss 
1856e62f8227SErik Schmauss /* Macro to construct a NFIT/NVDIMM device handle */
1857e62f8227SErik Schmauss 
1858e62f8227SErik Schmauss #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1859e62f8227SErik Schmauss 	((dimm)                                         | \
1860e62f8227SErik Schmauss 	((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
1861e62f8227SErik Schmauss 	((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
1862e62f8227SErik Schmauss 	((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
1863e62f8227SErik Schmauss 	((node)    << ACPI_NFIT_NODE_ID_OFFSET))
1864e62f8227SErik Schmauss 
1865e62f8227SErik Schmauss /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1866e62f8227SErik Schmauss 
1867e62f8227SErik Schmauss #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1868e62f8227SErik Schmauss 	((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1869e62f8227SErik Schmauss 
1870e62f8227SErik Schmauss #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1871e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1872e62f8227SErik Schmauss 
1873e62f8227SErik Schmauss #define ACPI_NFIT_GET_MEMORY_ID(handle) \
1874e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
1875e62f8227SErik Schmauss 
1876e62f8227SErik Schmauss #define ACPI_NFIT_GET_SOCKET_ID(handle) \
1877e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
1878e62f8227SErik Schmauss 
1879e62f8227SErik Schmauss #define ACPI_NFIT_GET_NODE_ID(handle) \
1880e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
1881e62f8227SErik Schmauss 
1882e62f8227SErik Schmauss /*******************************************************************************
1883e62f8227SErik Schmauss  *
1884a805aab8SBob Moore  * NHLT - Non HD Audio Link Table
1885a805aab8SBob Moore  *
1886a805aab8SBob Moore  * Conforms to: Intel Smart Sound Technology NHLT Specification
1887a805aab8SBob Moore  * Version 0.8.1, January 2020.
1888a805aab8SBob Moore  *
1889a805aab8SBob Moore  ******************************************************************************/
1890a805aab8SBob Moore 
1891a805aab8SBob Moore /* Main table */
1892a805aab8SBob Moore 
1893a805aab8SBob Moore struct acpi_table_nhlt {
1894a805aab8SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
1895a805aab8SBob Moore 	u8 endpoint_count;
1896a805aab8SBob Moore };
1897a805aab8SBob Moore 
1898a805aab8SBob Moore struct acpi_nhlt_endpoint {
1899a805aab8SBob Moore 	u32 descriptor_length;
1900a805aab8SBob Moore 	u8 link_type;
1901a805aab8SBob Moore 	u8 instance_id;
1902a805aab8SBob Moore 	u16 vendor_id;
1903a805aab8SBob Moore 	u16 device_id;
1904a805aab8SBob Moore 	u16 revision_id;
1905a805aab8SBob Moore 	u32 subsystem_id;
1906a805aab8SBob Moore 	u8 device_type;
1907a805aab8SBob Moore 	u8 direction;
1908a805aab8SBob Moore 	u8 virtual_bus_id;
1909a805aab8SBob Moore };
1910a805aab8SBob Moore 
1911a805aab8SBob Moore /* Types for link_type field above */
1912a805aab8SBob Moore 
1913a805aab8SBob Moore #define ACPI_NHLT_RESERVED_HD_AUDIO         0
1914a805aab8SBob Moore #define ACPI_NHLT_RESERVED_DSP              1
1915a805aab8SBob Moore #define ACPI_NHLT_PDM                       2
1916a805aab8SBob Moore #define ACPI_NHLT_SSP                       3
1917a805aab8SBob Moore #define ACPI_NHLT_RESERVED_SLIMBUS          4
1918a805aab8SBob Moore #define ACPI_NHLT_RESERVED_SOUNDWIRE        5
1919a805aab8SBob Moore #define ACPI_NHLT_TYPE_RESERVED             6	/* 6 and above are reserved */
1920a805aab8SBob Moore 
1921a805aab8SBob Moore /* All other values above are reserved */
1922a805aab8SBob Moore 
1923a805aab8SBob Moore /* Values for device_id field above */
1924a805aab8SBob Moore 
1925a805aab8SBob Moore #define ACPI_NHLT_PDM_DMIC                  0xAE20
1926a805aab8SBob Moore #define ACPI_NHLT_BT_SIDEBAND               0xAE30
1927a805aab8SBob Moore #define ACPI_NHLT_I2S_TDM_CODECS            0xAE23
1928a805aab8SBob Moore 
1929a805aab8SBob Moore /* Values for device_type field above */
1930a805aab8SBob Moore 
1931a805aab8SBob Moore /* SSP Link */
1932a805aab8SBob Moore 
1933a805aab8SBob Moore #define ACPI_NHLT_LINK_BT_SIDEBAND          0
1934a805aab8SBob Moore #define ACPI_NHLT_LINK_FM                   1
1935a805aab8SBob Moore #define ACPI_NHLT_LINK_MODEM                2
1936a805aab8SBob Moore /* 3 is reserved */
1937a805aab8SBob Moore #define ACPI_NHLT_LINK_SSP_ANALOG_CODEC     4
1938a805aab8SBob Moore 
1939a805aab8SBob Moore /* PDM Link */
1940a805aab8SBob Moore 
1941a805aab8SBob Moore #define ACPI_NHLT_PDM_ON_CAVS_1P8           0
1942a805aab8SBob Moore #define ACPI_NHLT_PDM_ON_CAVS_1P5           1
1943a805aab8SBob Moore 
1944a805aab8SBob Moore /* Values for Direction field above */
1945a805aab8SBob Moore 
1946a805aab8SBob Moore #define ACPI_NHLT_DIR_RENDER                0
1947a805aab8SBob Moore #define ACPI_NHLT_DIR_CAPTURE               1
1948a805aab8SBob Moore #define ACPI_NHLT_DIR_RENDER_LOOPBACK       2
1949a805aab8SBob Moore #define ACPI_NHLT_DIR_RENDER_FEEDBACK       3
1950a805aab8SBob Moore #define ACPI_NHLT_DIR_RESERVED              4	/* 4 and above are reserved */
1951a805aab8SBob Moore 
1952a805aab8SBob Moore struct acpi_nhlt_device_specific_config {
1953a805aab8SBob Moore 	u32 capabilities_size;
1954a805aab8SBob Moore 	u8 virtual_slot;
1955a805aab8SBob Moore 	u8 config_type;
1956a805aab8SBob Moore };
1957a805aab8SBob Moore 
1958a805aab8SBob Moore struct acpi_nhlt_device_specific_config_a {
1959a805aab8SBob Moore 	u32 capabilities_size;
1960a805aab8SBob Moore 	u8 virtual_slot;
1961a805aab8SBob Moore 	u8 config_type;
1962a805aab8SBob Moore 	u8 array_type;
1963a805aab8SBob Moore };
1964a805aab8SBob Moore 
1965a805aab8SBob Moore /* Values for Config Type above */
1966a805aab8SBob Moore 
1967e4a07f5aSBob Moore #define ACPI_NHLT_CONFIG_TYPE_GENERIC              0x00
1968e4a07f5aSBob Moore #define ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY            0x01
1969e4a07f5aSBob Moore #define ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK      0x03
1970e4a07f5aSBob Moore #define ACPI_NHLT_CONFIG_TYPE_RESERVED             0x04	/* 4 and above are reserved */
1971a805aab8SBob Moore 
1972a805aab8SBob Moore struct acpi_nhlt_device_specific_config_b {
1973a805aab8SBob Moore 	u32 capabilities_size;
1974a805aab8SBob Moore };
1975a805aab8SBob Moore 
1976a805aab8SBob Moore struct acpi_nhlt_device_specific_config_c {
1977a805aab8SBob Moore 	u32 capabilities_size;
1978a805aab8SBob Moore 	u8 virtual_slot;
1979a805aab8SBob Moore };
1980a805aab8SBob Moore 
1981e4a07f5aSBob Moore struct acpi_nhlt_render_device_specific_config {
1982e4a07f5aSBob Moore 	u32 capabilities_size;
1983e4a07f5aSBob Moore 	u8 virtual_slot;
1984e4a07f5aSBob Moore };
1985e4a07f5aSBob Moore 
1986a805aab8SBob Moore struct acpi_nhlt_wave_extensible {
1987a805aab8SBob Moore 	u16 format_tag;
1988a805aab8SBob Moore 	u16 channel_count;
1989a805aab8SBob Moore 	u32 samples_per_sec;
1990a805aab8SBob Moore 	u32 avg_bytes_per_sec;
1991a805aab8SBob Moore 	u16 block_align;
1992a805aab8SBob Moore 	u16 bits_per_sample;
1993a805aab8SBob Moore 	u16 extra_format_size;
1994a805aab8SBob Moore 	u16 valid_bits_per_sample;
1995a805aab8SBob Moore 	u32 channel_mask;
1996a805aab8SBob Moore 	u8 sub_format_guid[16];
1997a805aab8SBob Moore };
1998a805aab8SBob Moore 
1999a805aab8SBob Moore /* Values for channel_mask above */
2000a805aab8SBob Moore 
2001a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_LEFT             0x1
2002a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_RIGHT            0x2
2003a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_CENTER           0x4
2004a805aab8SBob Moore #define ACPI_NHLT_SPKR_LOW_FREQ               0x8
2005a805aab8SBob Moore #define ACPI_NHLT_SPKR_BACK_LEFT              0x10
2006a805aab8SBob Moore #define ACPI_NHLT_SPKR_BACK_RIGHT             0x20
2007a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_LEFT_OF_CENTER   0x40
2008a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_RIGHT_OF_CENTER  0x80
2009a805aab8SBob Moore #define ACPI_NHLT_SPKR_BACK_CENTER            0x100
2010a805aab8SBob Moore #define ACPI_NHLT_SPKR_SIDE_LEFT              0x200
2011a805aab8SBob Moore #define ACPI_NHLT_SPKR_SIDE_RIGHT             0x400
2012a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_CENTER             0x800
2013a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_FRONT_LEFT         0x1000
2014a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_FRONT_CENTER       0x2000
2015a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_FRONT_RIGHT        0x4000
2016a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_BACK_LEFT          0x8000
2017a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_BACK_CENTER        0x10000
2018a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_BACK_RIGHT         0x20000
2019a805aab8SBob Moore 
2020a805aab8SBob Moore struct acpi_nhlt_format_config {
2021a805aab8SBob Moore 	struct acpi_nhlt_wave_extensible format;
2022a805aab8SBob Moore 	u32 capability_size;
2023a805aab8SBob Moore 	u8 capabilities[];
2024a805aab8SBob Moore };
2025a805aab8SBob Moore 
2026a805aab8SBob Moore struct acpi_nhlt_formats_config {
2027a805aab8SBob Moore 	u8 formats_count;
2028a805aab8SBob Moore };
2029a805aab8SBob Moore 
2030a805aab8SBob Moore struct acpi_nhlt_device_specific_hdr {
2031a805aab8SBob Moore 	u8 virtual_slot;
2032a805aab8SBob Moore 	u8 config_type;
2033a805aab8SBob Moore };
2034a805aab8SBob Moore 
2035a805aab8SBob Moore /* Types for config_type above */
2036a805aab8SBob Moore 
2037a805aab8SBob Moore #define ACPI_NHLT_GENERIC                   0
2038a805aab8SBob Moore #define ACPI_NHLT_MIC                       1
2039a805aab8SBob Moore #define ACPI_NHLT_RENDER                    3
2040a805aab8SBob Moore 
2041a805aab8SBob Moore struct acpi_nhlt_mic_device_specific_config {
2042a805aab8SBob Moore 	struct acpi_nhlt_device_specific_hdr device_config;
2043a805aab8SBob Moore 	u8 array_type_ext;
2044a805aab8SBob Moore };
2045a805aab8SBob Moore 
2046a805aab8SBob Moore /* Values for array_type_ext above */
2047a805aab8SBob Moore 
204845882a81SBob Moore #define ACPI_NHLT_ARRAY_TYPE_RESERVED               0x09	/* 9 and below are reserved */
2049e4a07f5aSBob Moore #define ACPI_NHLT_SMALL_LINEAR_2ELEMENT             0x0A
2050e4a07f5aSBob Moore #define ACPI_NHLT_BIG_LINEAR_2ELEMENT               0x0B
2051e4a07f5aSBob Moore #define ACPI_NHLT_FIRST_GEOMETRY_LINEAR_4ELEMENT    0x0C
2052e4a07f5aSBob Moore #define ACPI_NHLT_PLANAR_LSHAPED_4ELEMENT           0x0D
2053e4a07f5aSBob Moore #define ACPI_NHLT_SECOND_GEOMETRY_LINEAR_4ELEMENT   0x0E
2054e4a07f5aSBob Moore #define ACPI_NHLT_VENDOR_DEFINED                    0x0F
2055e4a07f5aSBob Moore #define ACPI_NHLT_ARRAY_TYPE_MASK                   0x0F
2056e4a07f5aSBob Moore #define ACPI_NHLT_ARRAY_TYPE_EXT_MASK               0x10
2057a805aab8SBob Moore 
2058e4a07f5aSBob Moore #define ACPI_NHLT_NO_EXTENSION                      0x0
2059e4a07f5aSBob Moore #define ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT           (1<<4)
2060e4a07f5aSBob Moore 
2061e4a07f5aSBob Moore struct acpi_nhlt_vendor_mic_count {
2062e4a07f5aSBob Moore 	u8 microphone_count;
2063e4a07f5aSBob Moore };
2064a805aab8SBob Moore 
2065a805aab8SBob Moore struct acpi_nhlt_vendor_mic_config {
2066a805aab8SBob Moore 	u8 type;
2067a805aab8SBob Moore 	u8 panel;
206845882a81SBob Moore 	u16 speaker_position_distance;	/* mm */
206945882a81SBob Moore 	u16 horizontal_offset;	/* mm */
207045882a81SBob Moore 	u16 vertical_offset;	/* mm */
207145882a81SBob Moore 	u8 frequency_low_band;	/* 5*Hz */
207245882a81SBob Moore 	u8 frequency_high_band;	/* 500*Hz */
207345882a81SBob Moore 	u16 direction_angle;	/* -180 - + 180 */
207445882a81SBob Moore 	u16 elevation_angle;	/* -180 - + 180 */
207545882a81SBob Moore 	u16 work_vertical_angle_begin;	/* -180 - + 180 with 2 deg step */
207645882a81SBob Moore 	u16 work_vertical_angle_end;	/* -180 - + 180 with 2 deg step */
207745882a81SBob Moore 	u16 work_horizontal_angle_begin;	/* -180 - + 180 with 2 deg step */
207845882a81SBob Moore 	u16 work_horizontal_angle_end;	/* -180 - + 180 with 2 deg step */
2079a805aab8SBob Moore };
2080a805aab8SBob Moore 
2081a805aab8SBob Moore /* Values for Type field above */
2082a805aab8SBob Moore 
2083e4a07f5aSBob Moore #define ACPI_NHLT_MIC_OMNIDIRECTIONAL       0
2084e4a07f5aSBob Moore #define ACPI_NHLT_MIC_SUBCARDIOID           1
2085e4a07f5aSBob Moore #define ACPI_NHLT_MIC_CARDIOID              2
2086e4a07f5aSBob Moore #define ACPI_NHLT_MIC_SUPER_CARDIOID        3
2087e4a07f5aSBob Moore #define ACPI_NHLT_MIC_HYPER_CARDIOID        4
2088e4a07f5aSBob Moore #define ACPI_NHLT_MIC_8_SHAPED              5
208945882a81SBob Moore #define ACPI_NHLT_MIC_RESERVED6             6	/* 6 is reserved */
2090e4a07f5aSBob Moore #define ACPI_NHLT_MIC_VENDOR_DEFINED        7
209145882a81SBob Moore #define ACPI_NHLT_MIC_RESERVED              8	/* 8 and above are reserved */
2092a805aab8SBob Moore 
2093a805aab8SBob Moore /* Values for Panel field above */
2094a805aab8SBob Moore 
2095e4a07f5aSBob Moore #define ACPI_NHLT_MIC_POSITION_TOP          0
2096e4a07f5aSBob Moore #define ACPI_NHLT_MIC_POSITION_BOTTOM       1
2097e4a07f5aSBob Moore #define ACPI_NHLT_MIC_POSITION_LEFT         2
2098e4a07f5aSBob Moore #define ACPI_NHLT_MIC_POSITION_RIGHT        3
2099e4a07f5aSBob Moore #define ACPI_NHLT_MIC_POSITION_FRONT        4
2100e4a07f5aSBob Moore #define ACPI_NHLT_MIC_POSITION_BACK         5
210145882a81SBob Moore #define ACPI_NHLT_MIC_POSITION_RESERVED     6	/* 6 and above are reserved */
2102a805aab8SBob Moore 
2103a805aab8SBob Moore struct acpi_nhlt_vendor_mic_device_specific_config {
2104a805aab8SBob Moore 	struct acpi_nhlt_mic_device_specific_config mic_array_device_config;
2105a805aab8SBob Moore 	u8 number_of_microphones;
210645882a81SBob Moore 	struct acpi_nhlt_vendor_mic_config mic_config[];	/* Indexed by number_of_microphones */
2107a805aab8SBob Moore };
2108a805aab8SBob Moore 
2109a805aab8SBob Moore /* Microphone SNR and Sensitivity extension */
2110a805aab8SBob Moore 
2111a805aab8SBob Moore struct acpi_nhlt_mic_snr_sensitivity_extension {
2112a805aab8SBob Moore 	u32 SNR;
2113a805aab8SBob Moore 	u32 sensitivity;
2114a805aab8SBob Moore };
2115a805aab8SBob Moore 
2116e4a07f5aSBob Moore /* Render device with feedback */
2117e4a07f5aSBob Moore 
2118a805aab8SBob Moore struct acpi_nhlt_render_feedback_device_specific_config {
211945882a81SBob Moore 	u8 feedback_virtual_slot;	/* Render slot in case of capture */
212045882a81SBob Moore 	u16 feedback_channels;	/* Informative only */
2121a805aab8SBob Moore 	u16 feedback_valid_bits_per_sample;
2122a805aab8SBob Moore };
2123a805aab8SBob Moore 
21248bd24835SPiotr Maziarz /* Non documented structures */
2125a805aab8SBob Moore 
21268bd24835SPiotr Maziarz struct acpi_nhlt_device_info_count {
2127a805aab8SBob Moore 	u8 structure_count;
2128a805aab8SBob Moore };
2129a805aab8SBob Moore 
21308bd24835SPiotr Maziarz struct acpi_nhlt_device_info {
2131a805aab8SBob Moore 	u8 device_id[16];
2132a805aab8SBob Moore 	u8 device_instance_id;
2133a805aab8SBob Moore 	u8 device_port_id;
21340c9a6727SBob Moore };
21350c9a6727SBob Moore 
2136a805aab8SBob Moore /*******************************************************************************
2137a805aab8SBob Moore  *
2138e62f8227SErik Schmauss  * PCCT - Platform Communications Channel Table (ACPI 5.0)
2139e62f8227SErik Schmauss  *        Version 2 (ACPI 6.2)
2140e62f8227SErik Schmauss  *
2141e62f8227SErik Schmauss  ******************************************************************************/
2142e62f8227SErik Schmauss 
2143e62f8227SErik Schmauss struct acpi_table_pcct {
2144e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2145e62f8227SErik Schmauss 	u32 flags;
2146e62f8227SErik Schmauss 	u64 reserved;
2147e62f8227SErik Schmauss };
2148e62f8227SErik Schmauss 
2149e62f8227SErik Schmauss /* Values for Flags field above */
2150e62f8227SErik Schmauss 
2151e62f8227SErik Schmauss #define ACPI_PCCT_DOORBELL              1
2152e62f8227SErik Schmauss 
2153e62f8227SErik Schmauss /* Values for subtable type in struct acpi_subtable_header */
2154e62f8227SErik Schmauss 
2155e62f8227SErik Schmauss enum acpi_pcct_type {
2156e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
2157e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
2158e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2,	/* ACPI 6.1 */
2159e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3,	/* ACPI 6.2 */
2160e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4,	/* ACPI 6.2 */
216171f79a3fSErik Kaneda 	ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE = 5,	/* ACPI 6.4 */
216271f79a3fSErik Kaneda 	ACPI_PCCT_TYPE_RESERVED = 6	/* 6 and greater are reserved */
2163e62f8227SErik Schmauss };
2164e62f8227SErik Schmauss 
2165e62f8227SErik Schmauss /*
2166e62f8227SErik Schmauss  * PCCT Subtables, correspond to Type in struct acpi_subtable_header
2167e62f8227SErik Schmauss  */
2168e62f8227SErik Schmauss 
2169e62f8227SErik Schmauss /* 0: Generic Communications Subspace */
2170e62f8227SErik Schmauss 
2171e62f8227SErik Schmauss struct acpi_pcct_subspace {
2172e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2173e62f8227SErik Schmauss 	u8 reserved[6];
2174e62f8227SErik Schmauss 	u64 base_address;
2175e62f8227SErik Schmauss 	u64 length;
2176e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
2177e62f8227SErik Schmauss 	u64 preserve_mask;
2178e62f8227SErik Schmauss 	u64 write_mask;
2179e62f8227SErik Schmauss 	u32 latency;
2180e62f8227SErik Schmauss 	u32 max_access_rate;
2181e62f8227SErik Schmauss 	u16 min_turnaround_time;
2182e62f8227SErik Schmauss };
2183e62f8227SErik Schmauss 
2184e62f8227SErik Schmauss /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
2185e62f8227SErik Schmauss 
2186e62f8227SErik Schmauss struct acpi_pcct_hw_reduced {
2187e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2188e62f8227SErik Schmauss 	u32 platform_interrupt;
2189e62f8227SErik Schmauss 	u8 flags;
2190e62f8227SErik Schmauss 	u8 reserved;
2191e62f8227SErik Schmauss 	u64 base_address;
2192e62f8227SErik Schmauss 	u64 length;
2193e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
2194e62f8227SErik Schmauss 	u64 preserve_mask;
2195e62f8227SErik Schmauss 	u64 write_mask;
2196e62f8227SErik Schmauss 	u32 latency;
2197e62f8227SErik Schmauss 	u32 max_access_rate;
2198e62f8227SErik Schmauss 	u16 min_turnaround_time;
2199e62f8227SErik Schmauss };
2200e62f8227SErik Schmauss 
2201e62f8227SErik Schmauss /* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
2202e62f8227SErik Schmauss 
2203e62f8227SErik Schmauss struct acpi_pcct_hw_reduced_type2 {
2204e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2205e62f8227SErik Schmauss 	u32 platform_interrupt;
2206e62f8227SErik Schmauss 	u8 flags;
2207e62f8227SErik Schmauss 	u8 reserved;
2208e62f8227SErik Schmauss 	u64 base_address;
2209e62f8227SErik Schmauss 	u64 length;
2210e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
2211e62f8227SErik Schmauss 	u64 preserve_mask;
2212e62f8227SErik Schmauss 	u64 write_mask;
2213e62f8227SErik Schmauss 	u32 latency;
2214e62f8227SErik Schmauss 	u32 max_access_rate;
2215e62f8227SErik Schmauss 	u16 min_turnaround_time;
2216e62f8227SErik Schmauss 	struct acpi_generic_address platform_ack_register;
2217e62f8227SErik Schmauss 	u64 ack_preserve_mask;
2218e62f8227SErik Schmauss 	u64 ack_write_mask;
2219e62f8227SErik Schmauss };
2220e62f8227SErik Schmauss 
2221e62f8227SErik Schmauss /* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
2222e62f8227SErik Schmauss 
2223e62f8227SErik Schmauss struct acpi_pcct_ext_pcc_master {
2224e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2225e62f8227SErik Schmauss 	u32 platform_interrupt;
2226e62f8227SErik Schmauss 	u8 flags;
2227e62f8227SErik Schmauss 	u8 reserved1;
2228e62f8227SErik Schmauss 	u64 base_address;
2229e62f8227SErik Schmauss 	u32 length;
2230e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
2231e62f8227SErik Schmauss 	u64 preserve_mask;
2232e62f8227SErik Schmauss 	u64 write_mask;
2233e62f8227SErik Schmauss 	u32 latency;
2234e62f8227SErik Schmauss 	u32 max_access_rate;
2235e62f8227SErik Schmauss 	u32 min_turnaround_time;
2236e62f8227SErik Schmauss 	struct acpi_generic_address platform_ack_register;
2237e62f8227SErik Schmauss 	u64 ack_preserve_mask;
2238e62f8227SErik Schmauss 	u64 ack_set_mask;
2239e62f8227SErik Schmauss 	u64 reserved2;
2240e62f8227SErik Schmauss 	struct acpi_generic_address cmd_complete_register;
2241e62f8227SErik Schmauss 	u64 cmd_complete_mask;
2242e62f8227SErik Schmauss 	struct acpi_generic_address cmd_update_register;
2243e62f8227SErik Schmauss 	u64 cmd_update_preserve_mask;
2244e62f8227SErik Schmauss 	u64 cmd_update_set_mask;
2245e62f8227SErik Schmauss 	struct acpi_generic_address error_status_register;
2246e62f8227SErik Schmauss 	u64 error_status_mask;
2247e62f8227SErik Schmauss };
2248e62f8227SErik Schmauss 
2249e62f8227SErik Schmauss /* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
2250e62f8227SErik Schmauss 
2251e62f8227SErik Schmauss struct acpi_pcct_ext_pcc_slave {
2252e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2253e62f8227SErik Schmauss 	u32 platform_interrupt;
2254e62f8227SErik Schmauss 	u8 flags;
2255e62f8227SErik Schmauss 	u8 reserved1;
2256e62f8227SErik Schmauss 	u64 base_address;
2257e62f8227SErik Schmauss 	u32 length;
2258e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
2259e62f8227SErik Schmauss 	u64 preserve_mask;
2260e62f8227SErik Schmauss 	u64 write_mask;
2261e62f8227SErik Schmauss 	u32 latency;
2262e62f8227SErik Schmauss 	u32 max_access_rate;
2263e62f8227SErik Schmauss 	u32 min_turnaround_time;
2264e62f8227SErik Schmauss 	struct acpi_generic_address platform_ack_register;
2265e62f8227SErik Schmauss 	u64 ack_preserve_mask;
2266e62f8227SErik Schmauss 	u64 ack_set_mask;
2267e62f8227SErik Schmauss 	u64 reserved2;
2268e62f8227SErik Schmauss 	struct acpi_generic_address cmd_complete_register;
2269e62f8227SErik Schmauss 	u64 cmd_complete_mask;
2270e62f8227SErik Schmauss 	struct acpi_generic_address cmd_update_register;
2271e62f8227SErik Schmauss 	u64 cmd_update_preserve_mask;
2272e62f8227SErik Schmauss 	u64 cmd_update_set_mask;
2273e62f8227SErik Schmauss 	struct acpi_generic_address error_status_register;
2274e62f8227SErik Schmauss 	u64 error_status_mask;
2275e62f8227SErik Schmauss };
2276e62f8227SErik Schmauss 
227771f79a3fSErik Kaneda /* 5: HW Registers based Communications Subspace */
227871f79a3fSErik Kaneda 
227971f79a3fSErik Kaneda struct acpi_pcct_hw_reg {
228071f79a3fSErik Kaneda 	struct acpi_subtable_header header;
228171f79a3fSErik Kaneda 	u16 version;
228271f79a3fSErik Kaneda 	u64 base_address;
228371f79a3fSErik Kaneda 	u64 length;
228471f79a3fSErik Kaneda 	struct acpi_generic_address doorbell_register;
228571f79a3fSErik Kaneda 	u64 doorbell_preserve;
228671f79a3fSErik Kaneda 	u64 doorbell_write;
228771f79a3fSErik Kaneda 	struct acpi_generic_address cmd_complete_register;
228871f79a3fSErik Kaneda 	u64 cmd_complete_mask;
228971f79a3fSErik Kaneda 	struct acpi_generic_address error_status_register;
229071f79a3fSErik Kaneda 	u64 error_status_mask;
229171f79a3fSErik Kaneda 	u32 nominal_latency;
229271f79a3fSErik Kaneda 	u32 min_turnaround_time;
229371f79a3fSErik Kaneda };
229471f79a3fSErik Kaneda 
2295e62f8227SErik Schmauss /* Values for doorbell flags above */
2296e62f8227SErik Schmauss 
2297e62f8227SErik Schmauss #define ACPI_PCCT_INTERRUPT_POLARITY    (1)
2298e62f8227SErik Schmauss #define ACPI_PCCT_INTERRUPT_MODE        (1<<1)
2299e62f8227SErik Schmauss 
2300e62f8227SErik Schmauss /*
2301e62f8227SErik Schmauss  * PCC memory structures (not part of the ACPI table)
2302e62f8227SErik Schmauss  */
2303e62f8227SErik Schmauss 
2304e62f8227SErik Schmauss /* Shared Memory Region */
2305e62f8227SErik Schmauss 
2306e62f8227SErik Schmauss struct acpi_pcct_shared_memory {
2307e62f8227SErik Schmauss 	u32 signature;
2308e62f8227SErik Schmauss 	u16 command;
2309e62f8227SErik Schmauss 	u16 status;
2310e62f8227SErik Schmauss };
2311e62f8227SErik Schmauss 
2312e62f8227SErik Schmauss /* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
2313e62f8227SErik Schmauss 
2314e62f8227SErik Schmauss struct acpi_pcct_ext_pcc_shared_memory {
2315e62f8227SErik Schmauss 	u32 signature;
2316e62f8227SErik Schmauss 	u32 flags;
2317e62f8227SErik Schmauss 	u32 length;
2318e62f8227SErik Schmauss 	u32 command;
2319e62f8227SErik Schmauss };
2320e62f8227SErik Schmauss 
2321e62f8227SErik Schmauss /*******************************************************************************
2322e62f8227SErik Schmauss  *
2323e62f8227SErik Schmauss  * PDTT - Platform Debug Trigger Table (ACPI 6.2)
2324e62f8227SErik Schmauss  *        Version 0
2325e62f8227SErik Schmauss  *
2326e62f8227SErik Schmauss  ******************************************************************************/
2327e62f8227SErik Schmauss 
2328e62f8227SErik Schmauss struct acpi_table_pdtt {
2329e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2330e62f8227SErik Schmauss 	u8 trigger_count;
2331e62f8227SErik Schmauss 	u8 reserved[3];
2332e62f8227SErik Schmauss 	u32 array_offset;
2333e62f8227SErik Schmauss };
2334e62f8227SErik Schmauss 
2335e62f8227SErik Schmauss /*
2336e62f8227SErik Schmauss  * PDTT Communication Channel Identifier Structure.
2337e62f8227SErik Schmauss  * The number of these structures is defined by trigger_count above,
2338e62f8227SErik Schmauss  * starting at array_offset.
2339e62f8227SErik Schmauss  */
2340e62f8227SErik Schmauss struct acpi_pdtt_channel {
2341e62f8227SErik Schmauss 	u8 subchannel_id;
2342e62f8227SErik Schmauss 	u8 flags;
2343e62f8227SErik Schmauss };
2344e62f8227SErik Schmauss 
2345e62f8227SErik Schmauss /* Flags for above */
2346e62f8227SErik Schmauss 
2347e62f8227SErik Schmauss #define ACPI_PDTT_RUNTIME_TRIGGER           (1)
2348e62f8227SErik Schmauss #define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
2349f00175d0SErik Schmauss #define ACPI_PDTT_TRIGGER_ORDER             (1<<2)
2350e62f8227SErik Schmauss 
2351e62f8227SErik Schmauss /*******************************************************************************
2352e62f8227SErik Schmauss  *
23539f400337SErik Kaneda  * PHAT - Platform Health Assessment Table (ACPI 6.4)
23549f400337SErik Kaneda  *        Version 1
23559f400337SErik Kaneda  *
23569f400337SErik Kaneda  ******************************************************************************/
23579f400337SErik Kaneda 
23589f400337SErik Kaneda struct acpi_table_phat {
23599f400337SErik Kaneda 	struct acpi_table_header header;	/* Common ACPI table header */
23609f400337SErik Kaneda };
23619f400337SErik Kaneda 
23629f400337SErik Kaneda /* Common header for PHAT subtables that follow main table */
23639f400337SErik Kaneda 
23649f400337SErik Kaneda struct acpi_phat_header {
23659f400337SErik Kaneda 	u16 type;
23669f400337SErik Kaneda 	u16 length;
23679f400337SErik Kaneda 	u8 revision;
23689f400337SErik Kaneda };
23699f400337SErik Kaneda 
23709f400337SErik Kaneda /* Values for Type field above */
23719f400337SErik Kaneda 
23729f400337SErik Kaneda #define ACPI_PHAT_TYPE_FW_VERSION_DATA  0
23739f400337SErik Kaneda #define ACPI_PHAT_TYPE_FW_HEALTH_DATA   1
23749f400337SErik Kaneda #define ACPI_PHAT_TYPE_RESERVED         2	/* 0x02-0xFFFF are reserved */
23759f400337SErik Kaneda 
23769f400337SErik Kaneda /*
23779f400337SErik Kaneda  * PHAT subtables, correspond to Type in struct acpi_phat_header
23789f400337SErik Kaneda  */
23799f400337SErik Kaneda 
23809f400337SErik Kaneda /* 0: Firmware Version Data Record */
23819f400337SErik Kaneda 
23829f400337SErik Kaneda struct acpi_phat_version_data {
23839f400337SErik Kaneda 	struct acpi_phat_header header;
23849f400337SErik Kaneda 	u8 reserved[3];
23859f400337SErik Kaneda 	u32 element_count;
23869f400337SErik Kaneda };
23879f400337SErik Kaneda 
23889f400337SErik Kaneda struct acpi_phat_version_element {
23899f400337SErik Kaneda 	u8 guid[16];
23909f400337SErik Kaneda 	u64 version_value;
23919f400337SErik Kaneda 	u32 producer_id;
23929f400337SErik Kaneda };
23939f400337SErik Kaneda 
23949f400337SErik Kaneda /* 1: Firmware Health Data Record */
23959f400337SErik Kaneda 
23969f400337SErik Kaneda struct acpi_phat_health_data {
23979f400337SErik Kaneda 	struct acpi_phat_header header;
23989f400337SErik Kaneda 	u8 reserved[2];
23999f400337SErik Kaneda 	u8 health;
24009f400337SErik Kaneda 	u8 device_guid[16];
24019f400337SErik Kaneda 	u32 device_specific_offset;	/* Zero if no Device-specific data */
24029f400337SErik Kaneda };
24039f400337SErik Kaneda 
24049f400337SErik Kaneda /* Values for Health field above */
24059f400337SErik Kaneda 
24069f400337SErik Kaneda #define ACPI_PHAT_ERRORS_FOUND          0
24079f400337SErik Kaneda #define ACPI_PHAT_NO_ERRORS             1
24089f400337SErik Kaneda #define ACPI_PHAT_UNKNOWN_ERRORS        2
24099f400337SErik Kaneda #define ACPI_PHAT_ADVISORY              3
24109f400337SErik Kaneda 
24119f400337SErik Kaneda /*******************************************************************************
24129f400337SErik Kaneda  *
2413e62f8227SErik Schmauss  * PMTT - Platform Memory Topology Table (ACPI 5.0)
2414e62f8227SErik Schmauss  *        Version 1
2415e62f8227SErik Schmauss  *
2416e62f8227SErik Schmauss  ******************************************************************************/
2417e62f8227SErik Schmauss 
2418e62f8227SErik Schmauss struct acpi_table_pmtt {
2419e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2420cca97d42SBob Moore 	u32 memory_device_count;
2421cca97d42SBob Moore 	/*
2422cca97d42SBob Moore 	 * Immediately followed by:
2423cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2424cca97d42SBob Moore 	 */
2425e62f8227SErik Schmauss };
2426e62f8227SErik Schmauss 
2427e62f8227SErik Schmauss /* Common header for PMTT subtables that follow main table */
2428e62f8227SErik Schmauss 
2429e62f8227SErik Schmauss struct acpi_pmtt_header {
2430e62f8227SErik Schmauss 	u8 type;
2431e62f8227SErik Schmauss 	u8 reserved1;
2432e62f8227SErik Schmauss 	u16 length;
2433e62f8227SErik Schmauss 	u16 flags;
2434e62f8227SErik Schmauss 	u16 reserved2;
2435cca97d42SBob Moore 	u32 memory_device_count;	/* Zero means no memory device structs follow */
2436cca97d42SBob Moore 	/*
2437cca97d42SBob Moore 	 * Immediately followed by:
2438cca97d42SBob Moore 	 * u8 type_specific_data[]
2439cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2440cca97d42SBob Moore 	 */
2441e62f8227SErik Schmauss };
2442e62f8227SErik Schmauss 
2443e62f8227SErik Schmauss /* Values for Type field above */
2444e62f8227SErik Schmauss 
2445e62f8227SErik Schmauss #define ACPI_PMTT_TYPE_SOCKET           0
2446e62f8227SErik Schmauss #define ACPI_PMTT_TYPE_CONTROLLER       1
2447e62f8227SErik Schmauss #define ACPI_PMTT_TYPE_DIMM             2
2448cca97d42SBob Moore #define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFE are reserved */
2449cca97d42SBob Moore #define ACPI_PMTT_TYPE_VENDOR           0xFF
2450e62f8227SErik Schmauss 
2451e62f8227SErik Schmauss /* Values for Flags field above */
2452e62f8227SErik Schmauss 
2453e62f8227SErik Schmauss #define ACPI_PMTT_TOP_LEVEL             0x0001
2454e62f8227SErik Schmauss #define ACPI_PMTT_PHYSICAL              0x0002
2455e62f8227SErik Schmauss #define ACPI_PMTT_MEMORY_TYPE           0x000C
2456e62f8227SErik Schmauss 
2457e62f8227SErik Schmauss /*
2458e62f8227SErik Schmauss  * PMTT subtables, correspond to Type in struct acpi_pmtt_header
2459e62f8227SErik Schmauss  */
2460e62f8227SErik Schmauss 
2461e62f8227SErik Schmauss /* 0: Socket Structure */
2462e62f8227SErik Schmauss 
2463e62f8227SErik Schmauss struct acpi_pmtt_socket {
2464e62f8227SErik Schmauss 	struct acpi_pmtt_header header;
2465e62f8227SErik Schmauss 	u16 socket_id;
2466e62f8227SErik Schmauss 	u16 reserved;
2467e62f8227SErik Schmauss };
2468cca97d42SBob Moore 	/*
2469cca97d42SBob Moore 	 * Immediately followed by:
2470cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2471cca97d42SBob Moore 	 */
2472e62f8227SErik Schmauss 
2473e62f8227SErik Schmauss /* 1: Memory Controller subtable */
2474e62f8227SErik Schmauss 
2475e62f8227SErik Schmauss struct acpi_pmtt_controller {
2476e62f8227SErik Schmauss 	struct acpi_pmtt_header header;
2477cca97d42SBob Moore 	u16 controller_id;
2478e62f8227SErik Schmauss 	u16 reserved;
2479e62f8227SErik Schmauss };
2480cca97d42SBob Moore 	/*
2481cca97d42SBob Moore 	 * Immediately followed by:
2482cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2483cca97d42SBob Moore 	 */
2484e62f8227SErik Schmauss 
2485e62f8227SErik Schmauss /* 2: Physical Component Identifier (DIMM) */
2486e62f8227SErik Schmauss 
2487e62f8227SErik Schmauss struct acpi_pmtt_physical_component {
2488e62f8227SErik Schmauss 	struct acpi_pmtt_header header;
2489e62f8227SErik Schmauss 	u32 bios_handle;
2490e62f8227SErik Schmauss };
2491e62f8227SErik Schmauss 
2492cca97d42SBob Moore /* 0xFF: Vendor Specific Data */
2493cca97d42SBob Moore 
2494cca97d42SBob Moore struct acpi_pmtt_vendor_specific {
2495cca97d42SBob Moore 	struct acpi_pmtt_header header;
2496cca97d42SBob Moore 	u8 type_uuid[16];
2497cca97d42SBob Moore 	u8 specific[];
2498cca97d42SBob Moore 	/*
2499cca97d42SBob Moore 	 * Immediately followed by:
2500cca97d42SBob Moore 	 * u8 vendor_specific_data[];
2501cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2502cca97d42SBob Moore 	 */
2503cca97d42SBob Moore };
2504cca97d42SBob Moore 
2505e62f8227SErik Schmauss /*******************************************************************************
2506e62f8227SErik Schmauss  *
2507e62f8227SErik Schmauss  * PPTT - Processor Properties Topology Table (ACPI 6.2)
2508e62f8227SErik Schmauss  *        Version 1
2509e62f8227SErik Schmauss  *
2510e62f8227SErik Schmauss  ******************************************************************************/
2511e62f8227SErik Schmauss 
2512e62f8227SErik Schmauss struct acpi_table_pptt {
2513e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2514e62f8227SErik Schmauss };
2515e62f8227SErik Schmauss 
2516e62f8227SErik Schmauss /* Values for Type field above */
2517e62f8227SErik Schmauss 
2518e62f8227SErik Schmauss enum acpi_pptt_type {
2519e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_PROCESSOR = 0,
2520e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_CACHE = 1,
2521e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_ID = 2,
2522e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_RESERVED = 3
2523e62f8227SErik Schmauss };
2524e62f8227SErik Schmauss 
2525e62f8227SErik Schmauss /* 0: Processor Hierarchy Node Structure */
2526e62f8227SErik Schmauss 
2527e62f8227SErik Schmauss struct acpi_pptt_processor {
2528e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2529e62f8227SErik Schmauss 	u16 reserved;
2530e62f8227SErik Schmauss 	u32 flags;
2531e62f8227SErik Schmauss 	u32 parent;
2532e62f8227SErik Schmauss 	u32 acpi_processor_id;
2533e62f8227SErik Schmauss 	u32 number_of_priv_resources;
2534e62f8227SErik Schmauss };
2535e62f8227SErik Schmauss 
2536e62f8227SErik Schmauss /* Flags */
2537e62f8227SErik Schmauss 
2538b5eab512SErik Schmauss #define ACPI_PPTT_PHYSICAL_PACKAGE          (1)
2539b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID   (1<<1)
2540b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD  (1<<2)	/* ACPI 6.3 */
2541b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_LEAF_NODE            (1<<3)	/* ACPI 6.3 */
2542b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_IDENTICAL            (1<<4)	/* ACPI 6.3 */
2543e62f8227SErik Schmauss 
2544e62f8227SErik Schmauss /* 1: Cache Type Structure */
2545e62f8227SErik Schmauss 
2546e62f8227SErik Schmauss struct acpi_pptt_cache {
2547e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2548e62f8227SErik Schmauss 	u16 reserved;
2549e62f8227SErik Schmauss 	u32 flags;
2550e62f8227SErik Schmauss 	u32 next_level_of_cache;
2551e62f8227SErik Schmauss 	u32 size;
2552e62f8227SErik Schmauss 	u32 number_of_sets;
2553e62f8227SErik Schmauss 	u8 associativity;
2554e62f8227SErik Schmauss 	u8 attributes;
2555e62f8227SErik Schmauss 	u16 line_size;
2556e62f8227SErik Schmauss };
2557e62f8227SErik Schmauss 
25585e2e86c0SErik Kaneda /* 1: Cache Type Structure for PPTT version 3 */
25595e2e86c0SErik Kaneda 
25605e2e86c0SErik Kaneda struct acpi_pptt_cache_v1 {
25615e2e86c0SErik Kaneda 	u32 cache_id;
25625e2e86c0SErik Kaneda };
25635e2e86c0SErik Kaneda 
2564e62f8227SErik Schmauss /* Flags */
2565e62f8227SErik Schmauss 
2566e62f8227SErik Schmauss #define ACPI_PPTT_SIZE_PROPERTY_VALID       (1)	/* Physical property valid */
2567e62f8227SErik Schmauss #define ACPI_PPTT_NUMBER_OF_SETS_VALID      (1<<1)	/* Number of sets valid */
2568e62f8227SErik Schmauss #define ACPI_PPTT_ASSOCIATIVITY_VALID       (1<<2)	/* Associativity valid */
2569e62f8227SErik Schmauss #define ACPI_PPTT_ALLOCATION_TYPE_VALID     (1<<3)	/* Allocation type valid */
2570e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_VALID          (1<<4)	/* Cache type valid */
2571e62f8227SErik Schmauss #define ACPI_PPTT_WRITE_POLICY_VALID        (1<<5)	/* Write policy valid */
2572e62f8227SErik Schmauss #define ACPI_PPTT_LINE_SIZE_VALID           (1<<6)	/* Line size valid */
25735e2e86c0SErik Kaneda #define ACPI_PPTT_CACHE_ID_VALID            (1<<7)	/* Cache ID valid */
2574e62f8227SErik Schmauss 
2575e62f8227SErik Schmauss /* Masks for Attributes */
2576e62f8227SErik Schmauss 
2577e62f8227SErik Schmauss #define ACPI_PPTT_MASK_ALLOCATION_TYPE      (0x03)	/* Allocation type */
2578e62f8227SErik Schmauss #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)	/* Cache type */
2579e62f8227SErik Schmauss #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)	/* Write policy */
2580e62f8227SErik Schmauss 
2581e62f8227SErik Schmauss /* Attributes describing cache */
2582e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)	/* Cache line is allocated on read */
2583e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)	/* Cache line is allocated on write */
2584e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)	/* Cache line is allocated on read and write */
2585e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)	/* Alternate representation of above */
2586e62f8227SErik Schmauss 
2587e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)	/* Data cache */
2588e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)	/* Instruction cache */
2589e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)	/* Unified I & D cache */
2590e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)	/* Alternate representation of above */
2591e62f8227SErik Schmauss 
2592e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_POLICY_WB           (0x0)	/* Cache is write back */
2593e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)	/* Cache is write through */
2594e62f8227SErik Schmauss 
2595e62f8227SErik Schmauss /* 2: ID Structure */
2596e62f8227SErik Schmauss 
2597e62f8227SErik Schmauss struct acpi_pptt_id {
2598e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2599e62f8227SErik Schmauss 	u16 reserved;
2600e62f8227SErik Schmauss 	u32 vendor_id;
2601e62f8227SErik Schmauss 	u64 level1_id;
2602e62f8227SErik Schmauss 	u64 level2_id;
2603e62f8227SErik Schmauss 	u16 major_rev;
2604e62f8227SErik Schmauss 	u16 minor_rev;
2605e62f8227SErik Schmauss 	u16 spin_rev;
2606e62f8227SErik Schmauss };
2607e62f8227SErik Schmauss 
2608e62f8227SErik Schmauss /*******************************************************************************
2609e62f8227SErik Schmauss  *
2610d71df85aSErik Kaneda  * PRMT - Platform Runtime Mechanism Table
2611d71df85aSErik Kaneda  *        Version 1
2612d71df85aSErik Kaneda  *
2613d71df85aSErik Kaneda  ******************************************************************************/
2614d71df85aSErik Kaneda 
2615d71df85aSErik Kaneda struct acpi_table_prmt {
2616d71df85aSErik Kaneda 	struct acpi_table_header header;	/* Common ACPI table header */
2617d71df85aSErik Kaneda };
2618d71df85aSErik Kaneda 
2619d71df85aSErik Kaneda struct acpi_table_prmt_header {
2620d71df85aSErik Kaneda 	u8 platform_guid[16];
2621d71df85aSErik Kaneda 	u32 module_info_offset;
2622d71df85aSErik Kaneda 	u32 module_info_count;
2623d71df85aSErik Kaneda };
2624d71df85aSErik Kaneda 
26259f8c7baeSErik Kaneda struct acpi_prmt_module_header {
26269f8c7baeSErik Kaneda 	u16 revision;
26279f8c7baeSErik Kaneda 	u16 length;
26289f8c7baeSErik Kaneda };
26299f8c7baeSErik Kaneda 
2630d71df85aSErik Kaneda struct acpi_prmt_module_info {
2631d71df85aSErik Kaneda 	u16 revision;
2632d71df85aSErik Kaneda 	u16 length;
2633d71df85aSErik Kaneda 	u8 module_guid[16];
2634d71df85aSErik Kaneda 	u16 major_rev;
2635d71df85aSErik Kaneda 	u16 minor_rev;
2636d71df85aSErik Kaneda 	u16 handler_info_count;
2637d71df85aSErik Kaneda 	u32 handler_info_offset;
2638d71df85aSErik Kaneda 	u64 mmio_list_pointer;
2639d71df85aSErik Kaneda };
2640d71df85aSErik Kaneda 
2641d71df85aSErik Kaneda struct acpi_prmt_handler_info {
2642d71df85aSErik Kaneda 	u16 revision;
2643d71df85aSErik Kaneda 	u16 length;
2644d71df85aSErik Kaneda 	u8 handler_guid[16];
2645d71df85aSErik Kaneda 	u64 handler_address;
2646d71df85aSErik Kaneda 	u64 static_data_buffer_address;
2647d71df85aSErik Kaneda 	u64 acpi_param_buffer_address;
2648d71df85aSErik Kaneda };
2649d71df85aSErik Kaneda 
2650d71df85aSErik Kaneda /*******************************************************************************
2651d71df85aSErik Kaneda  *
2652e62f8227SErik Schmauss  * RASF - RAS Feature Table (ACPI 5.0)
2653e62f8227SErik Schmauss  *        Version 1
2654e62f8227SErik Schmauss  *
2655e62f8227SErik Schmauss  ******************************************************************************/
2656e62f8227SErik Schmauss 
2657e62f8227SErik Schmauss struct acpi_table_rasf {
2658e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2659e62f8227SErik Schmauss 	u8 channel_id[12];
2660e62f8227SErik Schmauss };
2661e62f8227SErik Schmauss 
2662e62f8227SErik Schmauss /* RASF Platform Communication Channel Shared Memory Region */
2663e62f8227SErik Schmauss 
2664e62f8227SErik Schmauss struct acpi_rasf_shared_memory {
2665e62f8227SErik Schmauss 	u32 signature;
2666e62f8227SErik Schmauss 	u16 command;
2667e62f8227SErik Schmauss 	u16 status;
2668e62f8227SErik Schmauss 	u16 version;
2669e62f8227SErik Schmauss 	u8 capabilities[16];
2670e62f8227SErik Schmauss 	u8 set_capabilities[16];
2671e62f8227SErik Schmauss 	u16 num_parameter_blocks;
2672e62f8227SErik Schmauss 	u32 set_capabilities_status;
2673e62f8227SErik Schmauss };
2674e62f8227SErik Schmauss 
2675e62f8227SErik Schmauss /* RASF Parameter Block Structure Header */
2676e62f8227SErik Schmauss 
2677e62f8227SErik Schmauss struct acpi_rasf_parameter_block {
2678e62f8227SErik Schmauss 	u16 type;
2679e62f8227SErik Schmauss 	u16 version;
2680e62f8227SErik Schmauss 	u16 length;
2681e62f8227SErik Schmauss };
2682e62f8227SErik Schmauss 
2683e62f8227SErik Schmauss /* RASF Parameter Block Structure for PATROL_SCRUB */
2684e62f8227SErik Schmauss 
2685e62f8227SErik Schmauss struct acpi_rasf_patrol_scrub_parameter {
2686e62f8227SErik Schmauss 	struct acpi_rasf_parameter_block header;
2687e62f8227SErik Schmauss 	u16 patrol_scrub_command;
2688e62f8227SErik Schmauss 	u64 requested_address_range[2];
2689e62f8227SErik Schmauss 	u64 actual_address_range[2];
2690e62f8227SErik Schmauss 	u16 flags;
2691e62f8227SErik Schmauss 	u8 requested_speed;
2692e62f8227SErik Schmauss };
2693e62f8227SErik Schmauss 
2694e62f8227SErik Schmauss /* Masks for Flags and Speed fields above */
2695e62f8227SErik Schmauss 
2696e62f8227SErik Schmauss #define ACPI_RASF_SCRUBBER_RUNNING      1
2697e62f8227SErik Schmauss #define ACPI_RASF_SPEED                 (7<<1)
2698e62f8227SErik Schmauss #define ACPI_RASF_SPEED_SLOW            (0<<1)
2699e62f8227SErik Schmauss #define ACPI_RASF_SPEED_MEDIUM          (4<<1)
2700e62f8227SErik Schmauss #define ACPI_RASF_SPEED_FAST            (7<<1)
2701e62f8227SErik Schmauss 
2702e62f8227SErik Schmauss /* Channel Commands */
2703e62f8227SErik Schmauss 
2704e62f8227SErik Schmauss enum acpi_rasf_commands {
2705e62f8227SErik Schmauss 	ACPI_RASF_EXECUTE_RASF_COMMAND = 1
2706e62f8227SErik Schmauss };
2707e62f8227SErik Schmauss 
2708e62f8227SErik Schmauss /* Platform RAS Capabilities */
2709e62f8227SErik Schmauss 
2710e62f8227SErik Schmauss enum acpi_rasf_capabiliities {
2711e62f8227SErik Schmauss 	ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
2712e62f8227SErik Schmauss 	ACPI_SW_PATROL_SCRUB_EXPOSED = 1
2713e62f8227SErik Schmauss };
2714e62f8227SErik Schmauss 
2715e62f8227SErik Schmauss /* Patrol Scrub Commands */
2716e62f8227SErik Schmauss 
2717e62f8227SErik Schmauss enum acpi_rasf_patrol_scrub_commands {
2718e62f8227SErik Schmauss 	ACPI_RASF_GET_PATROL_PARAMETERS = 1,
2719e62f8227SErik Schmauss 	ACPI_RASF_START_PATROL_SCRUBBER = 2,
2720e62f8227SErik Schmauss 	ACPI_RASF_STOP_PATROL_SCRUBBER = 3
2721e62f8227SErik Schmauss };
2722e62f8227SErik Schmauss 
2723e62f8227SErik Schmauss /* Channel Command flags */
2724e62f8227SErik Schmauss 
2725e62f8227SErik Schmauss #define ACPI_RASF_GENERATE_SCI          (1<<15)
2726e62f8227SErik Schmauss 
2727e62f8227SErik Schmauss /* Status values */
2728e62f8227SErik Schmauss 
2729e62f8227SErik Schmauss enum acpi_rasf_status {
2730e62f8227SErik Schmauss 	ACPI_RASF_SUCCESS = 0,
2731e62f8227SErik Schmauss 	ACPI_RASF_NOT_VALID = 1,
2732e62f8227SErik Schmauss 	ACPI_RASF_NOT_SUPPORTED = 2,
2733e62f8227SErik Schmauss 	ACPI_RASF_BUSY = 3,
2734e62f8227SErik Schmauss 	ACPI_RASF_FAILED = 4,
2735e62f8227SErik Schmauss 	ACPI_RASF_ABORTED = 5,
2736e62f8227SErik Schmauss 	ACPI_RASF_INVALID_DATA = 6
2737e62f8227SErik Schmauss };
2738e62f8227SErik Schmauss 
2739e62f8227SErik Schmauss /* Status flags */
2740e62f8227SErik Schmauss 
2741e62f8227SErik Schmauss #define ACPI_RASF_COMMAND_COMPLETE      (1)
2742e62f8227SErik Schmauss #define ACPI_RASF_SCI_DOORBELL          (1<<1)
2743e62f8227SErik Schmauss #define ACPI_RASF_ERROR                 (1<<2)
2744e62f8227SErik Schmauss #define ACPI_RASF_STATUS                (0x1F<<3)
2745e62f8227SErik Schmauss 
2746e62f8227SErik Schmauss /*******************************************************************************
2747e62f8227SErik Schmauss  *
2748536e35c9SBob Moore  * RGRT - Regulatory Graphics Resource Table
2749536e35c9SBob Moore  *        Version 1
2750536e35c9SBob Moore  *
2751536e35c9SBob Moore  * Conforms to "ACPI RGRT" available at:
2752536e35c9SBob Moore  * https://microsoft.github.io/mu/dyn/mu_plus/ms_core_pkg/acpi_RGRT/feature_acpi_rgrt/
2753536e35c9SBob Moore  *
2754536e35c9SBob Moore  ******************************************************************************/
2755536e35c9SBob Moore 
2756536e35c9SBob Moore struct acpi_table_rgrt {
2757536e35c9SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
2758536e35c9SBob Moore 	u16 version;
2759536e35c9SBob Moore 	u8 image_type;
2760536e35c9SBob Moore 	u8 reserved;
2761aa29b208SGustavo A. R. Silva 	u8 image[];
2762536e35c9SBob Moore };
2763536e35c9SBob Moore 
2764536e35c9SBob Moore /* image_type values */
2765536e35c9SBob Moore 
2766536e35c9SBob Moore enum acpi_rgrt_image_type {
2767536e35c9SBob Moore 	ACPI_RGRT_TYPE_RESERVED0 = 0,
2768536e35c9SBob Moore 	ACPI_RGRT_IMAGE_TYPE_PNG = 1,
2769536e35c9SBob Moore 	ACPI_RGRT_TYPE_RESERVED = 2	/* 2 and greater are reserved */
2770536e35c9SBob Moore };
2771536e35c9SBob Moore 
2772536e35c9SBob Moore /*******************************************************************************
2773536e35c9SBob Moore  *
2774003567a3SSunil V L  * RHCT - RISC-V Hart Capabilities Table
2775003567a3SSunil V L  *        Version 1
2776003567a3SSunil V L  *
2777003567a3SSunil V L  ******************************************************************************/
2778003567a3SSunil V L 
2779003567a3SSunil V L struct acpi_table_rhct {
2780003567a3SSunil V L 	struct acpi_table_header header;	/* Common ACPI table header */
2781*fe85f8ffSSunil V L 	u32 flags;		/* RHCT flags */
2782003567a3SSunil V L 	u64 time_base_freq;
2783003567a3SSunil V L 	u32 node_count;
2784003567a3SSunil V L 	u32 node_offset;
2785003567a3SSunil V L };
2786003567a3SSunil V L 
2787*fe85f8ffSSunil V L /* RHCT Flags */
2788*fe85f8ffSSunil V L 
2789*fe85f8ffSSunil V L #define ACPI_RHCT_TIMER_CANNOT_WAKEUP_CPU       (1)
2790003567a3SSunil V L /*
2791003567a3SSunil V L  * RHCT subtables
2792003567a3SSunil V L  */
2793003567a3SSunil V L struct acpi_rhct_node_header {
2794003567a3SSunil V L 	u16 type;
2795003567a3SSunil V L 	u16 length;
2796003567a3SSunil V L 	u16 revision;
2797003567a3SSunil V L };
2798003567a3SSunil V L 
2799003567a3SSunil V L /* Values for RHCT subtable Type above */
2800003567a3SSunil V L 
2801003567a3SSunil V L enum acpi_rhct_node_type {
2802003567a3SSunil V L 	ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000,
2803*fe85f8ffSSunil V L 	ACPI_RHCT_NODE_TYPE_CMO = 0x0001,
2804*fe85f8ffSSunil V L 	ACPI_RHCT_NODE_TYPE_MMU = 0x0002,
2805*fe85f8ffSSunil V L 	ACPI_RHCT_NODE_TYPE_RESERVED = 0x0003,
2806003567a3SSunil V L 	ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF,
2807003567a3SSunil V L };
2808003567a3SSunil V L 
2809003567a3SSunil V L /*
2810003567a3SSunil V L  * RHCT node specific subtables
2811003567a3SSunil V L  */
2812003567a3SSunil V L 
2813003567a3SSunil V L /* ISA string node structure */
2814003567a3SSunil V L struct acpi_rhct_isa_string {
2815003567a3SSunil V L 	u16 isa_length;
2816003567a3SSunil V L 	char isa[];
2817003567a3SSunil V L };
2818003567a3SSunil V L 
2819*fe85f8ffSSunil V L struct acpi_rhct_cmo_node {
2820*fe85f8ffSSunil V L 	u8 reserved;		/* Must be zero */
2821*fe85f8ffSSunil V L 	u8 cbom_size;		/* CBOM size in powerof 2 */
2822*fe85f8ffSSunil V L 	u8 cbop_size;		/* CBOP size in powerof 2 */
2823*fe85f8ffSSunil V L 	u8 cboz_size;		/* CBOZ size in powerof 2 */
2824*fe85f8ffSSunil V L };
2825*fe85f8ffSSunil V L 
2826*fe85f8ffSSunil V L struct acpi_rhct_mmu_node {
2827*fe85f8ffSSunil V L 	u8 reserved;		/* Must be zero */
2828*fe85f8ffSSunil V L 	u8 mmu_type;		/* Virtual Address Scheme */
2829*fe85f8ffSSunil V L };
2830*fe85f8ffSSunil V L 
2831*fe85f8ffSSunil V L enum acpi_rhct_mmu_type {
2832*fe85f8ffSSunil V L 	ACPI_RHCT_MMU_TYPE_SV39 = 0,
2833*fe85f8ffSSunil V L 	ACPI_RHCT_MMU_TYPE_SV48 = 1,
2834*fe85f8ffSSunil V L 	ACPI_RHCT_MMU_TYPE_SV57 = 2
2835*fe85f8ffSSunil V L };
2836*fe85f8ffSSunil V L 
2837003567a3SSunil V L /* Hart Info node structure */
2838003567a3SSunil V L struct acpi_rhct_hart_info {
2839003567a3SSunil V L 	u16 num_offsets;
2840003567a3SSunil V L 	u32 uid;		/* ACPI processor UID */
2841003567a3SSunil V L };
2842003567a3SSunil V L 
2843003567a3SSunil V L /*******************************************************************************
2844003567a3SSunil V L  *
2845e62f8227SErik Schmauss  * SBST - Smart Battery Specification Table
2846e62f8227SErik Schmauss  *        Version 1
2847e62f8227SErik Schmauss  *
2848e62f8227SErik Schmauss  ******************************************************************************/
2849e62f8227SErik Schmauss 
2850e62f8227SErik Schmauss struct acpi_table_sbst {
2851e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2852e62f8227SErik Schmauss 	u32 warning_level;
2853e62f8227SErik Schmauss 	u32 low_level;
2854e62f8227SErik Schmauss 	u32 critical_level;
2855e62f8227SErik Schmauss };
2856e62f8227SErik Schmauss 
2857e62f8227SErik Schmauss /*******************************************************************************
2858e62f8227SErik Schmauss  *
28593bd38469SJames Morse  * SDEI - Software Delegated Exception Interface Descriptor Table
28603bd38469SJames Morse  *
28613bd38469SJames Morse  * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
28623bd38469SJames Morse  * May 8th, 2017. Copyright 2017 ARM Ltd.
28633bd38469SJames Morse  *
28643bd38469SJames Morse  ******************************************************************************/
28653bd38469SJames Morse 
28663bd38469SJames Morse struct acpi_table_sdei {
28673bd38469SJames Morse 	struct acpi_table_header header;	/* Common ACPI table header */
28683bd38469SJames Morse };
28693bd38469SJames Morse 
28703bd38469SJames Morse /*******************************************************************************
28713bd38469SJames Morse  *
2872e62f8227SErik Schmauss  * SDEV - Secure Devices Table (ACPI 6.2)
2873e62f8227SErik Schmauss  *        Version 1
28745cf4d733SBob Moore  *
28755cf4d733SBob Moore  ******************************************************************************/
28765cf4d733SBob Moore 
2877e62f8227SErik Schmauss struct acpi_table_sdev {
28785cf4d733SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
28795cf4d733SBob Moore };
28805cf4d733SBob Moore 
2881e62f8227SErik Schmauss struct acpi_sdev_header {
2882e62f8227SErik Schmauss 	u8 type;
2883e62f8227SErik Schmauss 	u8 flags;
2884e62f8227SErik Schmauss 	u16 length;
2885b24aad44SBob Moore };
2886b24aad44SBob Moore 
2887e62f8227SErik Schmauss /* Values for subtable type above */
28886e2d5ebdSBob Moore 
2889e62f8227SErik Schmauss enum acpi_sdev_type {
2890e62f8227SErik Schmauss 	ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
2891e62f8227SErik Schmauss 	ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
2892e62f8227SErik Schmauss 	ACPI_SDEV_TYPE_RESERVED = 2	/* 2 and greater are reserved */
28936e2d5ebdSBob Moore };
28946e2d5ebdSBob Moore 
2895e62f8227SErik Schmauss /* Values for flags above */
28966e2d5ebdSBob Moore 
2897e62f8227SErik Schmauss #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
289814012d2fSErik Kaneda #define ACPI_SDEV_SECURE_COMPONENTS_PRESENT (1<<1)
289915a61aa1SBob Moore 
290015a61aa1SBob Moore /*
2901e62f8227SErik Schmauss  * SDEV subtables
290215a61aa1SBob Moore  */
290315a61aa1SBob Moore 
2904e62f8227SErik Schmauss /* 0: Namespace Device Based Secure Device Structure */
2905e62f8227SErik Schmauss 
2906e62f8227SErik Schmauss struct acpi_sdev_namespace {
2907e62f8227SErik Schmauss 	struct acpi_sdev_header header;
2908e62f8227SErik Schmauss 	u16 device_id_offset;
2909e62f8227SErik Schmauss 	u16 device_id_length;
2910e62f8227SErik Schmauss 	u16 vendor_data_offset;
2911e62f8227SErik Schmauss 	u16 vendor_data_length;
2912b24aad44SBob Moore };
2913b24aad44SBob Moore 
291414012d2fSErik Kaneda struct acpi_sdev_secure_component {
291514012d2fSErik Kaneda 	u16 secure_component_offset;
291614012d2fSErik Kaneda 	u16 secure_component_length;
291714012d2fSErik Kaneda };
291814012d2fSErik Kaneda 
291914012d2fSErik Kaneda /*
292014012d2fSErik Kaneda  * SDEV sub-subtables ("Components") for above
292114012d2fSErik Kaneda  */
292214012d2fSErik Kaneda struct acpi_sdev_component {
292314012d2fSErik Kaneda 	struct acpi_sdev_header header;
292414012d2fSErik Kaneda };
292514012d2fSErik Kaneda 
292614012d2fSErik Kaneda /* Values for sub-subtable type above */
292714012d2fSErik Kaneda 
292814012d2fSErik Kaneda enum acpi_sac_type {
292914012d2fSErik Kaneda 	ACPI_SDEV_TYPE_ID_COMPONENT = 0,
293014012d2fSErik Kaneda 	ACPI_SDEV_TYPE_MEM_COMPONENT = 1
293114012d2fSErik Kaneda };
293214012d2fSErik Kaneda 
293314012d2fSErik Kaneda struct acpi_sdev_id_component {
293414012d2fSErik Kaneda 	struct acpi_sdev_header header;
293514012d2fSErik Kaneda 	u16 hardware_id_offset;
293614012d2fSErik Kaneda 	u16 hardware_id_length;
293714012d2fSErik Kaneda 	u16 subsystem_id_offset;
293814012d2fSErik Kaneda 	u16 subsystem_id_length;
293914012d2fSErik Kaneda 	u16 hardware_revision;
294014012d2fSErik Kaneda 	u8 hardware_rev_present;
294114012d2fSErik Kaneda 	u8 class_code_present;
294214012d2fSErik Kaneda 	u8 pci_base_class;
294314012d2fSErik Kaneda 	u8 pci_sub_class;
294414012d2fSErik Kaneda 	u8 pci_programming_xface;
294514012d2fSErik Kaneda };
294614012d2fSErik Kaneda 
294714012d2fSErik Kaneda struct acpi_sdev_mem_component {
294814012d2fSErik Kaneda 	struct acpi_sdev_header header;
294914012d2fSErik Kaneda 	u32 reserved;
295014012d2fSErik Kaneda 	u64 memory_base_address;
295114012d2fSErik Kaneda 	u64 memory_length;
295214012d2fSErik Kaneda };
295314012d2fSErik Kaneda 
2954e62f8227SErik Schmauss /* 1: PCIe Endpoint Device Based Device Structure */
2955e62f8227SErik Schmauss 
2956e62f8227SErik Schmauss struct acpi_sdev_pcie {
2957e62f8227SErik Schmauss 	struct acpi_sdev_header header;
2958e62f8227SErik Schmauss 	u16 segment;
2959e62f8227SErik Schmauss 	u16 start_bus;
2960e62f8227SErik Schmauss 	u16 path_offset;
2961e62f8227SErik Schmauss 	u16 path_length;
2962e62f8227SErik Schmauss 	u16 vendor_data_offset;
2963e62f8227SErik Schmauss 	u16 vendor_data_length;
2964e62f8227SErik Schmauss };
2965e62f8227SErik Schmauss 
2966e62f8227SErik Schmauss /* 1a: PCIe Endpoint path entry */
2967e62f8227SErik Schmauss 
2968e62f8227SErik Schmauss struct acpi_sdev_pcie_path {
29699005694eSBob Moore 	u8 device;
29709005694eSBob Moore 	u8 function;
29719005694eSBob Moore };
29729005694eSBob Moore 
29738288f69eSKuppuswamy Sathyanarayanan /*******************************************************************************
29748288f69eSKuppuswamy Sathyanarayanan  *
29758288f69eSKuppuswamy Sathyanarayanan  * SVKL - Storage Volume Key Location Table (ACPI 6.4)
29766496f03eSBob Moore  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
29776496f03eSBob Moore  *        Trust Domain Extensions (Intel TDX)".
29788288f69eSKuppuswamy Sathyanarayanan  *        Version 1
29798288f69eSKuppuswamy Sathyanarayanan  *
29808288f69eSKuppuswamy Sathyanarayanan  ******************************************************************************/
29818288f69eSKuppuswamy Sathyanarayanan 
29828288f69eSKuppuswamy Sathyanarayanan struct acpi_table_svkl {
29838288f69eSKuppuswamy Sathyanarayanan 	struct acpi_table_header header;	/* Common ACPI table header */
29848288f69eSKuppuswamy Sathyanarayanan 	u32 count;
29858288f69eSKuppuswamy Sathyanarayanan };
29868288f69eSKuppuswamy Sathyanarayanan 
29876496f03eSBob Moore struct acpi_svkl_key {
29888288f69eSKuppuswamy Sathyanarayanan 	u16 type;
29898288f69eSKuppuswamy Sathyanarayanan 	u16 format;
29908288f69eSKuppuswamy Sathyanarayanan 	u32 size;
29918288f69eSKuppuswamy Sathyanarayanan 	u64 address;
29928288f69eSKuppuswamy Sathyanarayanan };
29938288f69eSKuppuswamy Sathyanarayanan 
29948288f69eSKuppuswamy Sathyanarayanan enum acpi_svkl_type {
29958288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_TYPE_MAIN_STORAGE = 0,
29968288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_TYPE_RESERVED = 1	/* 1 and greater are reserved */
29978288f69eSKuppuswamy Sathyanarayanan };
29988288f69eSKuppuswamy Sathyanarayanan 
29998288f69eSKuppuswamy Sathyanarayanan enum acpi_svkl_format {
30008288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_FORMAT_RAW_BINARY = 0,
30018288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_FORMAT_RESERVED = 1	/* 1 and greater are reserved */
30028288f69eSKuppuswamy Sathyanarayanan };
30038288f69eSKuppuswamy Sathyanarayanan 
30042de6bb92SBob Moore /*******************************************************************************
30052de6bb92SBob Moore  *
30062de6bb92SBob Moore  * TDEL - TD-Event Log
30072de6bb92SBob Moore  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
30082de6bb92SBob Moore  *        Trust Domain Extensions (Intel TDX)".
30092de6bb92SBob Moore  *        September 2020
30102de6bb92SBob Moore  *
30112de6bb92SBob Moore  ******************************************************************************/
30122de6bb92SBob Moore 
30132de6bb92SBob Moore struct acpi_table_tdel {
30142de6bb92SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
30152de6bb92SBob Moore 	u32 reserved;
30162de6bb92SBob Moore 	u64 log_area_minimum_length;
30172de6bb92SBob Moore 	u64 log_area_start_address;
30182de6bb92SBob Moore };
30192de6bb92SBob Moore 
30206e596084SRobert Moore /* Reset to default packing */
30216e596084SRobert Moore 
30226e596084SRobert Moore #pragma pack()
3023b24aad44SBob Moore 
3024b24aad44SBob Moore #endif				/* __ACTBL2_H__ */
3025