xref: /openbmc/linux/include/acpi/actbl2.h (revision a805aab8)
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  *
64441e55dSBob Moore  * Copyright (C) 2000 - 2021, 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  */
279401eafaSBob Moore #define ACPI_SIG_BDAT           "BDAT"	/* BIOS Data ACPI Table */
28874f6a72SLv Zheng #define ACPI_SIG_IORT           "IORT"	/* IO Remapping Table */
296e2d5ebdSBob Moore #define ACPI_SIG_IVRS           "IVRS"	/* I/O Virtualization Reporting Structure */
30d36d4e30SBob Moore #define ACPI_SIG_LPIT           "LPIT"	/* Low Power Idle Table */
31e62f8227SErik Schmauss #define ACPI_SIG_MADT           "APIC"	/* Multiple APIC Description Table */
32b24aad44SBob Moore #define ACPI_SIG_MCFG           "MCFG"	/* PCI Memory Mapped Configuration table */
330e264f0bSBob Moore #define ACPI_SIG_MCHI           "MCHI"	/* Management Controller Host Interface table */
34e62f8227SErik Schmauss #define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */
35e62f8227SErik Schmauss #define ACPI_SIG_MSCT           "MSCT"	/* Maximum System Characteristics Table */
365132f2faSBob Moore #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
37e62f8227SErik Schmauss #define ACPI_SIG_NFIT           "NFIT"	/* NVDIMM Firmware Interface Table */
38*a805aab8SBob Moore #define ACPI_SIG_NHLT           "NHLT"	/* Non HD Audio Link Table */
39e62f8227SErik Schmauss #define ACPI_SIG_PCCT           "PCCT"	/* Platform Communications Channel Table */
40e62f8227SErik Schmauss #define ACPI_SIG_PDTT           "PDTT"	/* Platform Debug Trigger Table */
419f400337SErik Kaneda #define ACPI_SIG_PHAT           "PHAT"	/* Platform Health Assessment Table */
42e62f8227SErik Schmauss #define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
43e62f8227SErik Schmauss #define ACPI_SIG_PPTT           "PPTT"	/* Processor Properties Topology Table */
44d71df85aSErik Kaneda #define ACPI_SIG_PRMT           "PRMT"	/* Platform Runtime Mechanism Table */
45e62f8227SErik Schmauss #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
46536e35c9SBob Moore #define ACPI_SIG_RGRT           "RGRT"	/* Regulatory Graphics Resource Table */
47e62f8227SErik Schmauss #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */
483bd38469SJames Morse #define ACPI_SIG_SDEI           "SDEI"	/* Software Delegated Exception Interface Table */
49e62f8227SErik Schmauss #define ACPI_SIG_SDEV           "SDEV"	/* Secure Devices table */
508288f69eSKuppuswamy Sathyanarayanan #define ACPI_SIG_SVKL           "SVKL"	/* Storage Volume Key Location Table */
514461cf54SBob Moore 
52b24aad44SBob Moore /*
53b24aad44SBob Moore  * All tables must be byte-packed to match the ACPI specification, since
54b24aad44SBob Moore  * the tables are provided by the system BIOS.
55b24aad44SBob Moore  */
56b24aad44SBob Moore #pragma pack(1)
57b24aad44SBob Moore 
58b24aad44SBob Moore /*
59be030a57SBob Moore  * Note: C bitfields are not used for this reason:
60be030a57SBob Moore  *
61be030a57SBob Moore  * "Bitfields are great and easy to read, but unfortunately the C language
62be030a57SBob Moore  * does not specify the layout of bitfields in memory, which means they are
63be030a57SBob Moore  * essentially useless for dealing with packed data in on-disk formats or
64be030a57SBob Moore  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
65be030a57SBob Moore  * this decision was a design error in C. Ritchie could have picked an order
66be030a57SBob Moore  * and stuck with it." Norman Ramsey.
67be030a57SBob Moore  * See http://stackoverflow.com/a/1053662/41661
68b24aad44SBob Moore  */
69b24aad44SBob Moore 
70b24aad44SBob Moore /*******************************************************************************
71b24aad44SBob Moore  *
72e692fa13SBob Moore  * AEST - Arm Error Source Table
73e692fa13SBob Moore  *
74e692fa13SBob Moore  * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
75e692fa13SBob Moore  * September 2020.
76e692fa13SBob Moore  *
77e692fa13SBob Moore  ******************************************************************************/
78e692fa13SBob Moore 
79e692fa13SBob Moore struct acpi_table_aest {
80e692fa13SBob Moore 	struct acpi_table_header header;
81e692fa13SBob Moore 	void *node_array[];
82e692fa13SBob Moore };
83e692fa13SBob Moore 
84e692fa13SBob Moore /* Common Subtable header - one per Node Structure (Subtable) */
85e692fa13SBob Moore 
86e692fa13SBob Moore struct acpi_aest_hdr {
87e692fa13SBob Moore 	u8 type;
88e692fa13SBob Moore 	u16 length;
89e692fa13SBob Moore 	u8 reserved;
90e692fa13SBob Moore 	u32 node_specific_offset;
91e692fa13SBob Moore 	u32 node_interface_offset;
92e692fa13SBob Moore 	u32 node_interrupt_offset;
93e692fa13SBob Moore 	u32 node_interrupt_count;
94e692fa13SBob Moore 	u64 timestamp_rate;
95e692fa13SBob Moore 	u64 reserved1;
96e692fa13SBob Moore 	u64 error_injection_rate;
97e692fa13SBob Moore };
98e692fa13SBob Moore 
99e692fa13SBob Moore /* Values for Type above */
100e692fa13SBob Moore 
101e692fa13SBob Moore #define ACPI_AEST_PROCESSOR_ERROR_NODE      0
102e692fa13SBob Moore #define ACPI_AEST_MEMORY_ERROR_NODE         1
103e692fa13SBob Moore #define ACPI_AEST_SMMU_ERROR_NODE           2
104e692fa13SBob Moore #define ACPI_AEST_VENDOR_ERROR_NODE         3
105e692fa13SBob Moore #define ACPI_AEST_GIC_ERROR_NODE            4
106e692fa13SBob Moore #define ACPI_AEST_NODE_TYPE_RESERVED        5	/* 5 and above are reserved */
107e692fa13SBob Moore 
108e692fa13SBob Moore /*
109e692fa13SBob Moore  * AEST subtables (Error nodes)
110e692fa13SBob Moore  */
111e692fa13SBob Moore 
112e692fa13SBob Moore /* 0: Processor Error */
113e692fa13SBob Moore 
114e692fa13SBob Moore typedef struct acpi_aest_processor {
115e692fa13SBob Moore 	u32 processor_id;
116e692fa13SBob Moore 	u8 resource_type;
117e692fa13SBob Moore 	u8 reserved;
118e692fa13SBob Moore 	u8 flags;
119e692fa13SBob Moore 	u8 revision;
120e692fa13SBob Moore 	u64 processor_affinity;
121e692fa13SBob Moore 
122e692fa13SBob Moore } acpi_aest_processor;
123e692fa13SBob Moore 
124e692fa13SBob Moore /* Values for resource_type above, related structs below */
125e692fa13SBob Moore 
126e692fa13SBob Moore #define ACPI_AEST_CACHE_RESOURCE            0
127e692fa13SBob Moore #define ACPI_AEST_TLB_RESOURCE              1
128e692fa13SBob Moore #define ACPI_AEST_GENERIC_RESOURCE          2
129e692fa13SBob Moore #define ACPI_AEST_RESOURCE_RESERVED         3	/* 3 and above are reserved */
130e692fa13SBob Moore 
131e692fa13SBob Moore /* 0R: Processor Cache Resource Substructure */
132e692fa13SBob Moore 
133e692fa13SBob Moore typedef struct acpi_aest_processor_cache {
134e692fa13SBob Moore 	u32 cache_reference;
135e692fa13SBob Moore 	u32 reserved;
136e692fa13SBob Moore 
137e692fa13SBob Moore } acpi_aest_processor_cache;
138e692fa13SBob Moore 
139e692fa13SBob Moore /* Values for cache_type above */
140e692fa13SBob Moore 
141e692fa13SBob Moore #define ACPI_AEST_CACHE_DATA                0
142e692fa13SBob Moore #define ACPI_AEST_CACHE_INSTRUCTION         1
143e692fa13SBob Moore #define ACPI_AEST_CACHE_UNIFIED             2
144e692fa13SBob Moore #define ACPI_AEST_CACHE_RESERVED            3	/* 3 and above are reserved */
145e692fa13SBob Moore 
146e692fa13SBob Moore /* 1R: Processor TLB Resource Substructure */
147e692fa13SBob Moore 
148e692fa13SBob Moore typedef struct acpi_aest_processor_tlb {
149e692fa13SBob Moore 	u32 tlb_level;
150e692fa13SBob Moore 	u32 reserved;
151e692fa13SBob Moore 
152e692fa13SBob Moore } acpi_aest_processor_tlb;
153e692fa13SBob Moore 
154e692fa13SBob Moore /* 2R: Processor Generic Resource Substructure */
155e692fa13SBob Moore 
156e692fa13SBob Moore typedef struct acpi_aest_processor_generic {
157e692fa13SBob Moore 	u8 *resource;
158e692fa13SBob Moore 
159e692fa13SBob Moore } acpi_aest_processor_generic;
160e692fa13SBob Moore 
161e692fa13SBob Moore /* 1: Memory Error */
162e692fa13SBob Moore 
163e692fa13SBob Moore typedef struct acpi_aest_memory {
164e692fa13SBob Moore 	u32 srat_proximity_domain;
165e692fa13SBob Moore 
166e692fa13SBob Moore } acpi_aest_memory;
167e692fa13SBob Moore 
168e692fa13SBob Moore /* 2: Smmu Error */
169e692fa13SBob Moore 
170e692fa13SBob Moore typedef struct acpi_aest_smmu {
171e692fa13SBob Moore 	u32 iort_node_reference;
172e692fa13SBob Moore 	u32 subcomponent_reference;
173e692fa13SBob Moore 
174e692fa13SBob Moore } acpi_aest_smmu;
175e692fa13SBob Moore 
176e692fa13SBob Moore /* 3: Vendor Defined */
177e692fa13SBob Moore 
178e692fa13SBob Moore typedef struct acpi_aest_vendor {
179e692fa13SBob Moore 	u32 acpi_hid;
180e692fa13SBob Moore 	u32 acpi_uid;
181e692fa13SBob Moore 	u8 vendor_specific_data[16];
182e692fa13SBob Moore 
183e692fa13SBob Moore } acpi_aest_vendor;
184e692fa13SBob Moore 
185e692fa13SBob Moore /* 4: Gic Error */
186e692fa13SBob Moore 
187e692fa13SBob Moore typedef struct acpi_aest_gic {
188e692fa13SBob Moore 	u32 interface_type;
189e692fa13SBob Moore 	u32 instance_id;
190e692fa13SBob Moore 
191e692fa13SBob Moore } acpi_aest_gic;
192e692fa13SBob Moore 
193e692fa13SBob Moore /* Values for interface_type above */
194e692fa13SBob Moore 
195e692fa13SBob Moore #define ACPI_AEST_GIC_CPU                   0
196e692fa13SBob Moore #define ACPI_AEST_GIC_DISTRIBUTOR           1
197e692fa13SBob Moore #define ACPI_AEST_GIC_REDISTRIBUTOR         2
198e692fa13SBob Moore #define ACPI_AEST_GIC_ITS                   3
199e692fa13SBob Moore #define ACPI_AEST_GIC_RESERVED              4	/* 4 and above are reserved */
200e692fa13SBob Moore 
201e692fa13SBob Moore /* Node Interface Structure */
202e692fa13SBob Moore 
203e692fa13SBob Moore typedef struct acpi_aest_node_interface {
204e692fa13SBob Moore 	u8 type;
205e692fa13SBob Moore 	u8 reserved[3];
206e692fa13SBob Moore 	u32 flags;
207e692fa13SBob Moore 	u64 address;
208e692fa13SBob Moore 	u32 error_record_index;
209e692fa13SBob Moore 	u32 error_record_count;
210e692fa13SBob Moore 	u64 error_record_implemented;
211e692fa13SBob Moore 	u64 error_status_reporting;
212e692fa13SBob Moore 	u64 addressing_mode;
213e692fa13SBob Moore 
214e692fa13SBob Moore } acpi_aest_node_interface;
215e692fa13SBob Moore 
216e692fa13SBob Moore /* Values for Type field above */
217e692fa13SBob Moore 
218e692fa13SBob Moore #define ACPI_AEST_NODE_SYSTEM_REGISTER      0
219e692fa13SBob Moore #define ACPI_AEST_NODE_MEMORY_MAPPED        1
220e692fa13SBob Moore #define ACPI_AEST_XFACE_RESERVED            2	/* 2 and above are reserved */
221e692fa13SBob Moore 
222e692fa13SBob Moore /* Node Interrupt Structure */
223e692fa13SBob Moore 
224e692fa13SBob Moore typedef struct acpi_aest_node_interrupt {
225e692fa13SBob Moore 	u8 type;
226e692fa13SBob Moore 	u8 reserved[2];
227e692fa13SBob Moore 	u8 flags;
228e692fa13SBob Moore 	u32 gsiv;
229e692fa13SBob Moore 	u8 iort_id;
230e692fa13SBob Moore 	u8 reserved1[3];
231e692fa13SBob Moore 
232e692fa13SBob Moore } acpi_aest_node_interrupt;
233e692fa13SBob Moore 
234e692fa13SBob Moore /* Values for Type field above */
235e692fa13SBob Moore 
236e692fa13SBob Moore #define ACPI_AEST_NODE_FAULT_HANDLING       0
237e692fa13SBob Moore #define ACPI_AEST_NODE_ERROR_RECOVERY       1
238e692fa13SBob Moore #define ACPI_AEST_XRUPT_RESERVED            2	/* 2 and above are reserved */
239e692fa13SBob Moore 
240e692fa13SBob Moore /*******************************************************************************
241e692fa13SBob Moore  *
2429401eafaSBob Moore  * BDAT - BIOS Data ACPI Table
2439401eafaSBob Moore  *
2449401eafaSBob Moore  * Conforms to "BIOS Data ACPI Table", Interface Specification v4.0 Draft 5
2459401eafaSBob Moore  * Nov 2020
2469401eafaSBob Moore  *
2479401eafaSBob Moore  ******************************************************************************/
2489401eafaSBob Moore 
2499401eafaSBob Moore struct acpi_table_bdat {
2509401eafaSBob Moore 	struct acpi_table_header header;
2519401eafaSBob Moore 	struct acpi_generic_address gas;
2529401eafaSBob Moore };
2539401eafaSBob Moore 
2549401eafaSBob Moore /*******************************************************************************
2559401eafaSBob Moore  *
256874f6a72SLv Zheng  * IORT - IO Remapping Table
257874f6a72SLv Zheng  *
258874f6a72SLv Zheng  * Conforms to "IO Remapping Table System Software on ARM Platforms",
2598e1fdd7fSShameer Kolothum  * Document number: ARM DEN 0049E.b, Feb 2021
260874f6a72SLv Zheng  *
261874f6a72SLv Zheng  ******************************************************************************/
262874f6a72SLv Zheng 
263874f6a72SLv Zheng struct acpi_table_iort {
264874f6a72SLv Zheng 	struct acpi_table_header header;
265874f6a72SLv Zheng 	u32 node_count;
266874f6a72SLv Zheng 	u32 node_offset;
267874f6a72SLv Zheng 	u32 reserved;
268874f6a72SLv Zheng };
269874f6a72SLv Zheng 
270874f6a72SLv Zheng /*
271874f6a72SLv Zheng  * IORT subtables
272874f6a72SLv Zheng  */
273874f6a72SLv Zheng struct acpi_iort_node {
274874f6a72SLv Zheng 	u8 type;
275874f6a72SLv Zheng 	u16 length;
276874f6a72SLv Zheng 	u8 revision;
2778e1fdd7fSShameer Kolothum 	u32 identifier;
278874f6a72SLv Zheng 	u32 mapping_count;
279874f6a72SLv Zheng 	u32 mapping_offset;
280874f6a72SLv Zheng 	char node_data[1];
281874f6a72SLv Zheng };
282874f6a72SLv Zheng 
283874f6a72SLv Zheng /* Values for subtable Type above */
284874f6a72SLv Zheng 
285874f6a72SLv Zheng enum acpi_iort_node_type {
286874f6a72SLv Zheng 	ACPI_IORT_NODE_ITS_GROUP = 0x00,
287874f6a72SLv Zheng 	ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
288874f6a72SLv Zheng 	ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
2894ac78bafSAl Stone 	ACPI_IORT_NODE_SMMU = 0x03,
290a53eaef6SRobin Murphy 	ACPI_IORT_NODE_SMMU_V3 = 0x04,
2918e1fdd7fSShameer Kolothum 	ACPI_IORT_NODE_PMCG = 0x05,
2928e1fdd7fSShameer Kolothum 	ACPI_IORT_NODE_RMR = 0x06,
293874f6a72SLv Zheng };
294874f6a72SLv Zheng 
295874f6a72SLv Zheng struct acpi_iort_id_mapping {
296874f6a72SLv Zheng 	u32 input_base;		/* Lowest value in input range */
297874f6a72SLv Zheng 	u32 id_count;		/* Number of IDs */
298874f6a72SLv Zheng 	u32 output_base;	/* Lowest value in output range */
299874f6a72SLv Zheng 	u32 output_reference;	/* A reference to the output node */
300874f6a72SLv Zheng 	u32 flags;
301874f6a72SLv Zheng };
302874f6a72SLv Zheng 
303874f6a72SLv Zheng /* Masks for Flags field above for IORT subtable */
304874f6a72SLv Zheng 
305874f6a72SLv Zheng #define ACPI_IORT_ID_SINGLE_MAPPING (1)
306874f6a72SLv Zheng 
307874f6a72SLv Zheng struct acpi_iort_memory_access {
308874f6a72SLv Zheng 	u32 cache_coherency;
309874f6a72SLv Zheng 	u8 hints;
310874f6a72SLv Zheng 	u16 reserved;
311874f6a72SLv Zheng 	u8 memory_flags;
312874f6a72SLv Zheng };
313874f6a72SLv Zheng 
314874f6a72SLv Zheng /* Values for cache_coherency field above */
315874f6a72SLv Zheng 
316874f6a72SLv Zheng #define ACPI_IORT_NODE_COHERENT         0x00000001	/* The device node is fully coherent */
317874f6a72SLv Zheng #define ACPI_IORT_NODE_NOT_COHERENT     0x00000000	/* The device node is not coherent */
318874f6a72SLv Zheng 
319874f6a72SLv Zheng /* Masks for Hints field above */
320874f6a72SLv Zheng 
321874f6a72SLv Zheng #define ACPI_IORT_HT_TRANSIENT          (1)
322874f6a72SLv Zheng #define ACPI_IORT_HT_WRITE              (1<<1)
323874f6a72SLv Zheng #define ACPI_IORT_HT_READ               (1<<2)
324874f6a72SLv Zheng #define ACPI_IORT_HT_OVERRIDE           (1<<3)
325874f6a72SLv Zheng 
326874f6a72SLv Zheng /* Masks for memory_flags field above */
327874f6a72SLv Zheng 
328874f6a72SLv Zheng #define ACPI_IORT_MF_COHERENCY          (1)
329874f6a72SLv Zheng #define ACPI_IORT_MF_ATTRIBUTES         (1<<1)
330874f6a72SLv Zheng 
331874f6a72SLv Zheng /*
332874f6a72SLv Zheng  * IORT node specific subtables
333874f6a72SLv Zheng  */
334874f6a72SLv Zheng struct acpi_iort_its_group {
335874f6a72SLv Zheng 	u32 its_count;
336c163f90cSErik Schmauss 	u32 identifiers[1];	/* GIC ITS identifier array */
337874f6a72SLv Zheng };
338874f6a72SLv Zheng 
339874f6a72SLv Zheng struct acpi_iort_named_component {
340874f6a72SLv Zheng 	u32 node_flags;
341874f6a72SLv Zheng 	u64 memory_properties;	/* Memory access properties */
342874f6a72SLv Zheng 	u8 memory_address_limit;	/* Memory address size limit */
343874f6a72SLv Zheng 	char device_name[1];	/* Path of namespace object */
344874f6a72SLv Zheng };
345874f6a72SLv Zheng 
346d87be043SRobin Murphy /* Masks for Flags field above */
347d87be043SRobin Murphy 
348d87be043SRobin Murphy #define ACPI_IORT_NC_STALL_SUPPORTED    (1)
349d87be043SRobin Murphy #define ACPI_IORT_NC_PASID_BITS         (31<<1)
350d87be043SRobin Murphy 
351874f6a72SLv Zheng struct acpi_iort_root_complex {
352874f6a72SLv Zheng 	u64 memory_properties;	/* Memory access properties */
353874f6a72SLv Zheng 	u32 ats_attribute;
354874f6a72SLv Zheng 	u32 pci_segment_number;
355d87be043SRobin Murphy 	u8 memory_address_limit;	/* Memory address size limit */
356d87be043SRobin Murphy 	u8 reserved[3];		/* Reserved, must be zero */
357874f6a72SLv Zheng };
358874f6a72SLv Zheng 
3598e1fdd7fSShameer Kolothum /* Masks for ats_attribute field above */
360874f6a72SLv Zheng 
3618e1fdd7fSShameer Kolothum #define ACPI_IORT_ATS_SUPPORTED         (1)	/* The root complex ATS support */
3628e1fdd7fSShameer Kolothum #define ACPI_IORT_PRI_SUPPORTED         (1<<1)	/* The root complex PRI support */
3638e1fdd7fSShameer Kolothum #define ACPI_IORT_PASID_FWD_SUPPORTED   (1<<2)	/* The root complex PASID forward support */
364874f6a72SLv Zheng 
365874f6a72SLv Zheng struct acpi_iort_smmu {
366874f6a72SLv Zheng 	u64 base_address;	/* SMMU base address */
367874f6a72SLv Zheng 	u64 span;		/* Length of memory range */
368874f6a72SLv Zheng 	u32 model;
369874f6a72SLv Zheng 	u32 flags;
370874f6a72SLv Zheng 	u32 global_interrupt_offset;
371874f6a72SLv Zheng 	u32 context_interrupt_count;
372874f6a72SLv Zheng 	u32 context_interrupt_offset;
373874f6a72SLv Zheng 	u32 pmu_interrupt_count;
374874f6a72SLv Zheng 	u32 pmu_interrupt_offset;
375874f6a72SLv Zheng 	u64 interrupts[1];	/* Interrupt array */
376874f6a72SLv Zheng };
377874f6a72SLv Zheng 
378874f6a72SLv Zheng /* Values for Model field above */
379874f6a72SLv Zheng 
380874f6a72SLv Zheng #define ACPI_IORT_SMMU_V1               0x00000000	/* Generic SMMUv1 */
381874f6a72SLv Zheng #define ACPI_IORT_SMMU_V2               0x00000001	/* Generic SMMUv2 */
382874f6a72SLv Zheng #define ACPI_IORT_SMMU_CORELINK_MMU400  0x00000002	/* ARM Corelink MMU-400 */
383874f6a72SLv Zheng #define ACPI_IORT_SMMU_CORELINK_MMU500  0x00000003	/* ARM Corelink MMU-500 */
3840c2021c0SRobin Murphy #define ACPI_IORT_SMMU_CORELINK_MMU401  0x00000004	/* ARM Corelink MMU-401 */
3850c2021c0SRobin Murphy #define ACPI_IORT_SMMU_CAVIUM_THUNDERX  0x00000005	/* Cavium thunder_x SMMUv2 */
386874f6a72SLv Zheng 
387874f6a72SLv Zheng /* Masks for Flags field above */
388874f6a72SLv Zheng 
389874f6a72SLv Zheng #define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
390874f6a72SLv Zheng #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
391874f6a72SLv Zheng 
392bb1e23e6SLv Zheng /* Global interrupt format */
393bb1e23e6SLv Zheng 
394bb1e23e6SLv Zheng struct acpi_iort_smmu_gsi {
395bb1e23e6SLv Zheng 	u32 nsg_irpt;
396bb1e23e6SLv Zheng 	u32 nsg_irpt_flags;
397bb1e23e6SLv Zheng 	u32 nsg_cfg_irpt;
398bb1e23e6SLv Zheng 	u32 nsg_cfg_irpt_flags;
399bb1e23e6SLv Zheng };
400bb1e23e6SLv Zheng 
4014ac78bafSAl Stone struct acpi_iort_smmu_v3 {
4024ac78bafSAl Stone 	u64 base_address;	/* SMMUv3 base address */
4034ac78bafSAl Stone 	u32 flags;
4044ac78bafSAl Stone 	u32 reserved;
4054ac78bafSAl Stone 	u64 vatos_address;
4060c2021c0SRobin Murphy 	u32 model;
4074ac78bafSAl Stone 	u32 event_gsiv;
4084ac78bafSAl Stone 	u32 pri_gsiv;
4094ac78bafSAl Stone 	u32 gerr_gsiv;
4104ac78bafSAl Stone 	u32 sync_gsiv;
411d87be043SRobin Murphy 	u32 pxm;
4124c106aa4SHanjun Guo 	u32 id_mapping_index;
4134ac78bafSAl Stone };
4144ac78bafSAl Stone 
4150c2021c0SRobin Murphy /* Values for Model field above */
4160c2021c0SRobin Murphy 
4170c2021c0SRobin Murphy #define ACPI_IORT_SMMU_V3_GENERIC           0x00000000	/* Generic SMMUv3 */
4180c2021c0SRobin Murphy #define ACPI_IORT_SMMU_V3_HISILICON_HI161X  0x00000001	/* hi_silicon Hi161x SMMUv3 */
4190c2021c0SRobin Murphy #define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX     0x00000002	/* Cavium CN99xx SMMUv3 */
4200c2021c0SRobin Murphy 
4214ac78bafSAl Stone /* Masks for Flags field above */
4224ac78bafSAl Stone 
4234ac78bafSAl Stone #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
424d87be043SRobin Murphy #define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE     (3<<1)
425c9442300SGanapatrao Kulkarni #define ACPI_IORT_SMMU_V3_PXM_VALID         (1<<3)
4264ac78bafSAl Stone 
427a53eaef6SRobin Murphy struct acpi_iort_pmcg {
428a53eaef6SRobin Murphy 	u64 page0_base_address;
429a53eaef6SRobin Murphy 	u32 overflow_gsiv;
430a53eaef6SRobin Murphy 	u32 node_reference;
431a53eaef6SRobin Murphy 	u64 page1_base_address;
432a53eaef6SRobin Murphy };
433a53eaef6SRobin Murphy 
4348e1fdd7fSShameer Kolothum struct acpi_iort_rmr {
4358e1fdd7fSShameer Kolothum 	u32 flags;
4368e1fdd7fSShameer Kolothum 	u32 rmr_count;
4378e1fdd7fSShameer Kolothum 	u32 rmr_offset;
4388e1fdd7fSShameer Kolothum };
4398e1fdd7fSShameer Kolothum 
4408e1fdd7fSShameer Kolothum struct acpi_iort_rmr_desc {
4418e1fdd7fSShameer Kolothum 	u64 base_address;
4428e1fdd7fSShameer Kolothum 	u64 length;
4438e1fdd7fSShameer Kolothum 	u32 reserved;
4448e1fdd7fSShameer Kolothum };
4458e1fdd7fSShameer Kolothum 
446874f6a72SLv Zheng /*******************************************************************************
447874f6a72SLv Zheng  *
4486e2d5ebdSBob Moore  * IVRS - I/O Virtualization Reporting Structure
4496e2d5ebdSBob Moore  *        Version 1
4506e2d5ebdSBob Moore  *
4516e2d5ebdSBob Moore  * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
4526e2d5ebdSBob Moore  * Revision 1.26, February 2009.
4536e2d5ebdSBob Moore  *
4546e2d5ebdSBob Moore  ******************************************************************************/
4556e2d5ebdSBob Moore 
4566e2d5ebdSBob Moore struct acpi_table_ivrs {
4576e2d5ebdSBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
4586e2d5ebdSBob Moore 	u32 info;		/* Common virtualization info */
4596e2d5ebdSBob Moore 	u64 reserved;
4606e2d5ebdSBob Moore };
4616e2d5ebdSBob Moore 
4626e2d5ebdSBob Moore /* Values for Info field above */
4636e2d5ebdSBob Moore 
4646e2d5ebdSBob Moore #define ACPI_IVRS_PHYSICAL_SIZE     0x00007F00	/* 7 bits, physical address size */
4656e2d5ebdSBob Moore #define ACPI_IVRS_VIRTUAL_SIZE      0x003F8000	/* 7 bits, virtual address size */
4666e2d5ebdSBob Moore #define ACPI_IVRS_ATS_RESERVED      0x00400000	/* ATS address translation range reserved */
4676e2d5ebdSBob Moore 
4686e2d5ebdSBob Moore /* IVRS subtable header */
4696e2d5ebdSBob Moore 
4706e2d5ebdSBob Moore struct acpi_ivrs_header {
4716e2d5ebdSBob Moore 	u8 type;		/* Subtable type */
4726e2d5ebdSBob Moore 	u8 flags;
4736e2d5ebdSBob Moore 	u16 length;		/* Subtable length */
4746e2d5ebdSBob Moore 	u16 device_id;		/* ID of IOMMU */
4756e2d5ebdSBob Moore };
4766e2d5ebdSBob Moore 
4776e2d5ebdSBob Moore /* Values for subtable Type above */
4786e2d5ebdSBob Moore 
4796e2d5ebdSBob Moore enum acpi_ivrs_type {
4801f6239caSMichał Żygowski 	ACPI_IVRS_TYPE_HARDWARE1 = 0x10,
4811f6239caSMichał Żygowski 	ACPI_IVRS_TYPE_HARDWARE2 = 0x11,
4827ce7a445SAlexander Monakov 	ACPI_IVRS_TYPE_HARDWARE3 = 0x40,
4836e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_MEMORY1 = 0x20,
4846e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_MEMORY2 = 0x21,
4856e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_MEMORY3 = 0x22
4866e2d5ebdSBob Moore };
4876e2d5ebdSBob Moore 
4886e2d5ebdSBob Moore /* Masks for Flags field above for IVHD subtable */
4896e2d5ebdSBob Moore 
4906e2d5ebdSBob Moore #define ACPI_IVHD_TT_ENABLE         (1)
4916e2d5ebdSBob Moore #define ACPI_IVHD_PASS_PW           (1<<1)
4926e2d5ebdSBob Moore #define ACPI_IVHD_RES_PASS_PW       (1<<2)
4936e2d5ebdSBob Moore #define ACPI_IVHD_ISOC              (1<<3)
4946e2d5ebdSBob Moore #define ACPI_IVHD_IOTLB             (1<<4)
4956e2d5ebdSBob Moore 
4966e2d5ebdSBob Moore /* Masks for Flags field above for IVMD subtable */
4976e2d5ebdSBob Moore 
4986e2d5ebdSBob Moore #define ACPI_IVMD_UNITY             (1)
4996e2d5ebdSBob Moore #define ACPI_IVMD_READ              (1<<1)
5006e2d5ebdSBob Moore #define ACPI_IVMD_WRITE             (1<<2)
5016e2d5ebdSBob Moore #define ACPI_IVMD_EXCLUSION_RANGE   (1<<3)
5026e2d5ebdSBob Moore 
5036e2d5ebdSBob Moore /*
5046e2d5ebdSBob Moore  * IVRS subtables, correspond to Type in struct acpi_ivrs_header
5056e2d5ebdSBob Moore  */
5066e2d5ebdSBob Moore 
5076e2d5ebdSBob Moore /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
5086e2d5ebdSBob Moore 
5091f6239caSMichał Żygowski struct acpi_ivrs_hardware_10 {
5106e2d5ebdSBob Moore 	struct acpi_ivrs_header header;
5116e2d5ebdSBob Moore 	u16 capability_offset;	/* Offset for IOMMU control fields */
5126e2d5ebdSBob Moore 	u64 base_address;	/* IOMMU control registers */
5136e2d5ebdSBob Moore 	u16 pci_segment_group;
5146e2d5ebdSBob Moore 	u16 info;		/* MSI number and unit ID */
5150dc7e795SMichał Żygowski 	u32 feature_reporting;
5166e2d5ebdSBob Moore };
5176e2d5ebdSBob Moore 
5181f6239caSMichał Żygowski /* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */
5191f6239caSMichał Żygowski 
5201f6239caSMichał Żygowski struct acpi_ivrs_hardware_11 {
5211f6239caSMichał Żygowski 	struct acpi_ivrs_header header;
5221f6239caSMichał Żygowski 	u16 capability_offset;	/* Offset for IOMMU control fields */
5231f6239caSMichał Żygowski 	u64 base_address;	/* IOMMU control registers */
5241f6239caSMichał Żygowski 	u16 pci_segment_group;
5251f6239caSMichał Żygowski 	u16 info;		/* MSI number and unit ID */
5261f6239caSMichał Żygowski 	u32 attributes;
5271f6239caSMichał Żygowski 	u64 efr_register_image;
5281f6239caSMichał Żygowski 	u64 reserved;
5291f6239caSMichał Żygowski };
5301f6239caSMichał Żygowski 
5316e2d5ebdSBob Moore /* Masks for Info field above */
5326e2d5ebdSBob Moore 
5336e2d5ebdSBob Moore #define ACPI_IVHD_MSI_NUMBER_MASK   0x001F	/* 5 bits, MSI message number */
534ba494beeSBob Moore #define ACPI_IVHD_UNIT_ID_MASK      0x1F00	/* 5 bits, unit_ID */
5356e2d5ebdSBob Moore 
5366e2d5ebdSBob Moore /*
5376e2d5ebdSBob Moore  * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
5386e2d5ebdSBob Moore  * Upper two bits of the Type field are the (encoded) length of the structure.
5396e2d5ebdSBob Moore  * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
5406e2d5ebdSBob Moore  * are reserved for future use but not defined.
5416e2d5ebdSBob Moore  */
5426e2d5ebdSBob Moore struct acpi_ivrs_de_header {
5436e2d5ebdSBob Moore 	u8 type;
5446e2d5ebdSBob Moore 	u16 id;
5456e2d5ebdSBob Moore 	u8 data_setting;
5466e2d5ebdSBob Moore };
5476e2d5ebdSBob Moore 
5486e2d5ebdSBob Moore /* Length of device entry is in the top two bits of Type field above */
5496e2d5ebdSBob Moore 
5506e2d5ebdSBob Moore #define ACPI_IVHD_ENTRY_LENGTH      0xC0
5516e2d5ebdSBob Moore 
5526e2d5ebdSBob Moore /* Values for device entry Type field above */
5536e2d5ebdSBob Moore 
5546e2d5ebdSBob Moore enum acpi_ivrs_device_entry_type {
5556e2d5ebdSBob Moore 	/* 4-byte device entries, all use struct acpi_ivrs_device4 */
5566e2d5ebdSBob Moore 
5576e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_PAD4 = 0,
5586e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_ALL = 1,
5596e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_SELECT = 2,
5606e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_START = 3,
5616e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_END = 4,
5626e2d5ebdSBob Moore 
5636e2d5ebdSBob Moore 	/* 8-byte device entries */
5646e2d5ebdSBob Moore 
5656e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_PAD8 = 64,
5666e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_NOT_USED = 65,
5676e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_ALIAS_SELECT = 66,	/* Uses struct acpi_ivrs_device8a */
5686e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_ALIAS_START = 67,	/* Uses struct acpi_ivrs_device8a */
5696e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_EXT_SELECT = 70,	/* Uses struct acpi_ivrs_device8b */
5706e2d5ebdSBob Moore 	ACPI_IVRS_TYPE_EXT_START = 71,	/* Uses struct acpi_ivrs_device8b */
5717ce7a445SAlexander Monakov 	ACPI_IVRS_TYPE_SPECIAL = 72,	/* Uses struct acpi_ivrs_device8c */
5727ce7a445SAlexander Monakov 
5737ce7a445SAlexander Monakov 	/* Variable-length device entries */
5747ce7a445SAlexander Monakov 
5757ce7a445SAlexander Monakov 	ACPI_IVRS_TYPE_HID = 240	/* Uses ACPI_IVRS_DEVICE_HID */
5766e2d5ebdSBob Moore };
5776e2d5ebdSBob Moore 
5786e2d5ebdSBob Moore /* Values for Data field above */
5796e2d5ebdSBob Moore 
5806e2d5ebdSBob Moore #define ACPI_IVHD_INIT_PASS         (1)
5816e2d5ebdSBob Moore #define ACPI_IVHD_EINT_PASS         (1<<1)
5826e2d5ebdSBob Moore #define ACPI_IVHD_NMI_PASS          (1<<2)
5836e2d5ebdSBob Moore #define ACPI_IVHD_SYSTEM_MGMT       (3<<4)
5846e2d5ebdSBob Moore #define ACPI_IVHD_LINT0_PASS        (1<<6)
5856e2d5ebdSBob Moore #define ACPI_IVHD_LINT1_PASS        (1<<7)
5866e2d5ebdSBob Moore 
5876e2d5ebdSBob Moore /* Types 0-4: 4-byte device entry */
5886e2d5ebdSBob Moore 
5896e2d5ebdSBob Moore struct acpi_ivrs_device4 {
5906e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
5916e2d5ebdSBob Moore };
5926e2d5ebdSBob Moore 
5936e2d5ebdSBob Moore /* Types 66-67: 8-byte device entry */
5946e2d5ebdSBob Moore 
5956e2d5ebdSBob Moore struct acpi_ivrs_device8a {
5966e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
5976e2d5ebdSBob Moore 	u8 reserved1;
5986e2d5ebdSBob Moore 	u16 used_id;
5996e2d5ebdSBob Moore 	u8 reserved2;
6006e2d5ebdSBob Moore };
6016e2d5ebdSBob Moore 
6026e2d5ebdSBob Moore /* Types 70-71: 8-byte device entry */
6036e2d5ebdSBob Moore 
6046e2d5ebdSBob Moore struct acpi_ivrs_device8b {
6056e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
6066e2d5ebdSBob Moore 	u32 extended_data;
6076e2d5ebdSBob Moore };
6086e2d5ebdSBob Moore 
6096e2d5ebdSBob Moore /* Values for extended_data above */
6106e2d5ebdSBob Moore 
6116e2d5ebdSBob Moore #define ACPI_IVHD_ATS_DISABLED      (1<<31)
6126e2d5ebdSBob Moore 
6136e2d5ebdSBob Moore /* Type 72: 8-byte device entry */
6146e2d5ebdSBob Moore 
6156e2d5ebdSBob Moore struct acpi_ivrs_device8c {
6166e2d5ebdSBob Moore 	struct acpi_ivrs_de_header header;
6176e2d5ebdSBob Moore 	u8 handle;
6186e2d5ebdSBob Moore 	u16 used_id;
6196e2d5ebdSBob Moore 	u8 variety;
6206e2d5ebdSBob Moore };
6216e2d5ebdSBob Moore 
6226e2d5ebdSBob Moore /* Values for Variety field above */
6236e2d5ebdSBob Moore 
6246e2d5ebdSBob Moore #define ACPI_IVHD_IOAPIC            1
6256e2d5ebdSBob Moore #define ACPI_IVHD_HPET              2
6266e2d5ebdSBob Moore 
6277ce7a445SAlexander Monakov /* Type 240: variable-length device entry */
6287ce7a445SAlexander Monakov 
6297ce7a445SAlexander Monakov struct acpi_ivrs_device_hid {
6307ce7a445SAlexander Monakov 	struct acpi_ivrs_de_header header;
6317ce7a445SAlexander Monakov 	u64 acpi_hid;
6327ce7a445SAlexander Monakov 	u64 acpi_cid;
6337ce7a445SAlexander Monakov 	u8 uid_type;
6347ce7a445SAlexander Monakov 	u8 uid_length;
6357ce7a445SAlexander Monakov };
6367ce7a445SAlexander Monakov 
637c160b7d2SBob Moore /* Values for uid_type above */
638c160b7d2SBob Moore 
639c160b7d2SBob Moore #define ACPI_IVRS_UID_NOT_PRESENT   0
640c160b7d2SBob Moore #define ACPI_IVRS_UID_IS_INTEGER    1
641c160b7d2SBob Moore #define ACPI_IVRS_UID_IS_STRING     2
642c160b7d2SBob Moore 
6436e2d5ebdSBob Moore /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
6446e2d5ebdSBob Moore 
6456e2d5ebdSBob Moore struct acpi_ivrs_memory {
6466e2d5ebdSBob Moore 	struct acpi_ivrs_header header;
6476e2d5ebdSBob Moore 	u16 aux_data;
6486e2d5ebdSBob Moore 	u64 reserved;
6496e2d5ebdSBob Moore 	u64 start_address;
6506e2d5ebdSBob Moore 	u64 memory_length;
6516e2d5ebdSBob Moore };
6526e2d5ebdSBob Moore 
6536e2d5ebdSBob Moore /*******************************************************************************
6546e2d5ebdSBob Moore  *
655d36d4e30SBob Moore  * LPIT - Low Power Idle Table
656d36d4e30SBob Moore  *
6579ab8cf1bSBob Moore  * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
658d36d4e30SBob Moore  *
659d36d4e30SBob Moore  ******************************************************************************/
660d36d4e30SBob Moore 
661d36d4e30SBob Moore struct acpi_table_lpit {
662d36d4e30SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
663d36d4e30SBob Moore };
664d36d4e30SBob Moore 
665d36d4e30SBob Moore /* LPIT subtable header */
666d36d4e30SBob Moore 
667d36d4e30SBob Moore struct acpi_lpit_header {
668d36d4e30SBob Moore 	u32 type;		/* Subtable type */
669d36d4e30SBob Moore 	u32 length;		/* Subtable length */
670d36d4e30SBob Moore 	u16 unique_id;
671d36d4e30SBob Moore 	u16 reserved;
672d36d4e30SBob Moore 	u32 flags;
673d36d4e30SBob Moore };
674d36d4e30SBob Moore 
675d36d4e30SBob Moore /* Values for subtable Type above */
676d36d4e30SBob Moore 
677d36d4e30SBob Moore enum acpi_lpit_type {
678d36d4e30SBob Moore 	ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
6799ab8cf1bSBob Moore 	ACPI_LPIT_TYPE_RESERVED = 0x01	/* 1 and above are reserved */
680d36d4e30SBob Moore };
681d36d4e30SBob Moore 
682d36d4e30SBob Moore /* Masks for Flags field above  */
683d36d4e30SBob Moore 
684d36d4e30SBob Moore #define ACPI_LPIT_STATE_DISABLED    (1)
685d36d4e30SBob Moore #define ACPI_LPIT_NO_COUNTER        (1<<1)
686d36d4e30SBob Moore 
687d36d4e30SBob Moore /*
688d36d4e30SBob Moore  * LPIT subtables, correspond to Type in struct acpi_lpit_header
689d36d4e30SBob Moore  */
690d36d4e30SBob Moore 
691d36d4e30SBob Moore /* 0x00: Native C-state instruction based LPI structure */
692d36d4e30SBob Moore 
693d36d4e30SBob Moore struct acpi_lpit_native {
694d36d4e30SBob Moore 	struct acpi_lpit_header header;
695d36d4e30SBob Moore 	struct acpi_generic_address entry_trigger;
696d36d4e30SBob Moore 	u32 residency;
697d36d4e30SBob Moore 	u32 latency;
698d36d4e30SBob Moore 	struct acpi_generic_address residency_counter;
699d36d4e30SBob Moore 	u64 counter_frequency;
700d36d4e30SBob Moore };
701d36d4e30SBob Moore 
702d36d4e30SBob Moore /*******************************************************************************
703d36d4e30SBob Moore  *
704e62f8227SErik Schmauss  * MADT - Multiple APIC Description Table
705e62f8227SErik Schmauss  *        Version 3
706e62f8227SErik Schmauss  *
707e62f8227SErik Schmauss  ******************************************************************************/
708e62f8227SErik Schmauss 
709e62f8227SErik Schmauss struct acpi_table_madt {
710e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
711e62f8227SErik Schmauss 	u32 address;		/* Physical address of local APIC */
712e62f8227SErik Schmauss 	u32 flags;
713e62f8227SErik Schmauss };
714e62f8227SErik Schmauss 
715e62f8227SErik Schmauss /* Masks for Flags field above */
716e62f8227SErik Schmauss 
717e62f8227SErik Schmauss #define ACPI_MADT_PCAT_COMPAT       (1)	/* 00: System also has dual 8259s */
718e62f8227SErik Schmauss 
719e62f8227SErik Schmauss /* Values for PCATCompat flag */
720e62f8227SErik Schmauss 
721e62f8227SErik Schmauss #define ACPI_MADT_DUAL_PIC          1
722e62f8227SErik Schmauss #define ACPI_MADT_MULTIPLE_APIC     0
723e62f8227SErik Schmauss 
724e62f8227SErik Schmauss /* Values for MADT subtable type in struct acpi_subtable_header */
725e62f8227SErik Schmauss 
726e62f8227SErik Schmauss enum acpi_madt_type {
727e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_APIC = 0,
728e62f8227SErik Schmauss 	ACPI_MADT_TYPE_IO_APIC = 1,
729e62f8227SErik Schmauss 	ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
730e62f8227SErik Schmauss 	ACPI_MADT_TYPE_NMI_SOURCE = 3,
731e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
732e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
733e62f8227SErik Schmauss 	ACPI_MADT_TYPE_IO_SAPIC = 6,
734e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
735e62f8227SErik Schmauss 	ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
736e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
737e62f8227SErik Schmauss 	ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
738e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
739e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
740e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
741e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
742e62f8227SErik Schmauss 	ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
7439557cb8cSErik Kaneda 	ACPI_MADT_TYPE_MULTIPROC_WAKEUP = 16,
7449557cb8cSErik Kaneda 	ACPI_MADT_TYPE_RESERVED = 17	/* 17 and greater are reserved */
745e62f8227SErik Schmauss };
746e62f8227SErik Schmauss 
747e62f8227SErik Schmauss /*
748e62f8227SErik Schmauss  * MADT Subtables, correspond to Type in struct acpi_subtable_header
749e62f8227SErik Schmauss  */
750e62f8227SErik Schmauss 
751e62f8227SErik Schmauss /* 0: Processor Local APIC */
752e62f8227SErik Schmauss 
753e62f8227SErik Schmauss struct acpi_madt_local_apic {
754e62f8227SErik Schmauss 	struct acpi_subtable_header header;
755e62f8227SErik Schmauss 	u8 processor_id;	/* ACPI processor id */
756e62f8227SErik Schmauss 	u8 id;			/* Processor's local APIC id */
757e62f8227SErik Schmauss 	u32 lapic_flags;
758e62f8227SErik Schmauss };
759e62f8227SErik Schmauss 
760e62f8227SErik Schmauss /* 1: IO APIC */
761e62f8227SErik Schmauss 
762e62f8227SErik Schmauss struct acpi_madt_io_apic {
763e62f8227SErik Schmauss 	struct acpi_subtable_header header;
764e62f8227SErik Schmauss 	u8 id;			/* I/O APIC ID */
765e62f8227SErik Schmauss 	u8 reserved;		/* reserved - must be zero */
766e62f8227SErik Schmauss 	u32 address;		/* APIC physical address */
767e62f8227SErik Schmauss 	u32 global_irq_base;	/* Global system interrupt where INTI lines start */
768e62f8227SErik Schmauss };
769e62f8227SErik Schmauss 
770e62f8227SErik Schmauss /* 2: Interrupt Override */
771e62f8227SErik Schmauss 
772e62f8227SErik Schmauss struct acpi_madt_interrupt_override {
773e62f8227SErik Schmauss 	struct acpi_subtable_header header;
774e62f8227SErik Schmauss 	u8 bus;			/* 0 - ISA */
775e62f8227SErik Schmauss 	u8 source_irq;		/* Interrupt source (IRQ) */
776e62f8227SErik Schmauss 	u32 global_irq;		/* Global system interrupt */
777e62f8227SErik Schmauss 	u16 inti_flags;
778e62f8227SErik Schmauss };
779e62f8227SErik Schmauss 
780e62f8227SErik Schmauss /* 3: NMI Source */
781e62f8227SErik Schmauss 
782e62f8227SErik Schmauss struct acpi_madt_nmi_source {
783e62f8227SErik Schmauss 	struct acpi_subtable_header header;
784e62f8227SErik Schmauss 	u16 inti_flags;
785e62f8227SErik Schmauss 	u32 global_irq;		/* Global system interrupt */
786e62f8227SErik Schmauss };
787e62f8227SErik Schmauss 
788e62f8227SErik Schmauss /* 4: Local APIC NMI */
789e62f8227SErik Schmauss 
790e62f8227SErik Schmauss struct acpi_madt_local_apic_nmi {
791e62f8227SErik Schmauss 	struct acpi_subtable_header header;
792e62f8227SErik Schmauss 	u8 processor_id;	/* ACPI processor id */
793e62f8227SErik Schmauss 	u16 inti_flags;
794e62f8227SErik Schmauss 	u8 lint;		/* LINTn to which NMI is connected */
795e62f8227SErik Schmauss };
796e62f8227SErik Schmauss 
797e62f8227SErik Schmauss /* 5: Address Override */
798e62f8227SErik Schmauss 
799e62f8227SErik Schmauss struct acpi_madt_local_apic_override {
800e62f8227SErik Schmauss 	struct acpi_subtable_header header;
801e62f8227SErik Schmauss 	u16 reserved;		/* Reserved, must be zero */
802e62f8227SErik Schmauss 	u64 address;		/* APIC physical address */
803e62f8227SErik Schmauss };
804e62f8227SErik Schmauss 
805e62f8227SErik Schmauss /* 6: I/O Sapic */
806e62f8227SErik Schmauss 
807e62f8227SErik Schmauss struct acpi_madt_io_sapic {
808e62f8227SErik Schmauss 	struct acpi_subtable_header header;
809e62f8227SErik Schmauss 	u8 id;			/* I/O SAPIC ID */
810e62f8227SErik Schmauss 	u8 reserved;		/* Reserved, must be zero */
811e62f8227SErik Schmauss 	u32 global_irq_base;	/* Global interrupt for SAPIC start */
812e62f8227SErik Schmauss 	u64 address;		/* SAPIC physical address */
813e62f8227SErik Schmauss };
814e62f8227SErik Schmauss 
815e62f8227SErik Schmauss /* 7: Local Sapic */
816e62f8227SErik Schmauss 
817e62f8227SErik Schmauss struct acpi_madt_local_sapic {
818e62f8227SErik Schmauss 	struct acpi_subtable_header header;
819e62f8227SErik Schmauss 	u8 processor_id;	/* ACPI processor id */
820e62f8227SErik Schmauss 	u8 id;			/* SAPIC ID */
821e62f8227SErik Schmauss 	u8 eid;			/* SAPIC EID */
822e62f8227SErik Schmauss 	u8 reserved[3];		/* Reserved, must be zero */
823e62f8227SErik Schmauss 	u32 lapic_flags;
824e62f8227SErik Schmauss 	u32 uid;		/* Numeric UID - ACPI 3.0 */
825e62f8227SErik Schmauss 	char uid_string[1];	/* String UID  - ACPI 3.0 */
826e62f8227SErik Schmauss };
827e62f8227SErik Schmauss 
828e62f8227SErik Schmauss /* 8: Platform Interrupt Source */
829e62f8227SErik Schmauss 
830e62f8227SErik Schmauss struct acpi_madt_interrupt_source {
831e62f8227SErik Schmauss 	struct acpi_subtable_header header;
832e62f8227SErik Schmauss 	u16 inti_flags;
833e62f8227SErik Schmauss 	u8 type;		/* 1=PMI, 2=INIT, 3=corrected */
834e62f8227SErik Schmauss 	u8 id;			/* Processor ID */
835e62f8227SErik Schmauss 	u8 eid;			/* Processor EID */
836e62f8227SErik Schmauss 	u8 io_sapic_vector;	/* Vector value for PMI interrupts */
837e62f8227SErik Schmauss 	u32 global_irq;		/* Global system interrupt */
838e62f8227SErik Schmauss 	u32 flags;		/* Interrupt Source Flags */
839e62f8227SErik Schmauss };
840e62f8227SErik Schmauss 
841e62f8227SErik Schmauss /* Masks for Flags field above */
842e62f8227SErik Schmauss 
843e62f8227SErik Schmauss #define ACPI_MADT_CPEI_OVERRIDE     (1)
844e62f8227SErik Schmauss 
845e62f8227SErik Schmauss /* 9: Processor Local X2APIC (ACPI 4.0) */
846e62f8227SErik Schmauss 
847e62f8227SErik Schmauss struct acpi_madt_local_x2apic {
848e62f8227SErik Schmauss 	struct acpi_subtable_header header;
849e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
850e62f8227SErik Schmauss 	u32 local_apic_id;	/* Processor x2APIC ID  */
851e62f8227SErik Schmauss 	u32 lapic_flags;
852e62f8227SErik Schmauss 	u32 uid;		/* ACPI processor UID */
853e62f8227SErik Schmauss };
854e62f8227SErik Schmauss 
855e62f8227SErik Schmauss /* 10: Local X2APIC NMI (ACPI 4.0) */
856e62f8227SErik Schmauss 
857e62f8227SErik Schmauss struct acpi_madt_local_x2apic_nmi {
858e62f8227SErik Schmauss 	struct acpi_subtable_header header;
859e62f8227SErik Schmauss 	u16 inti_flags;
860e62f8227SErik Schmauss 	u32 uid;		/* ACPI processor UID */
861e62f8227SErik Schmauss 	u8 lint;		/* LINTn to which NMI is connected */
862e62f8227SErik Schmauss 	u8 reserved[3];		/* reserved - must be zero */
863e62f8227SErik Schmauss };
864e62f8227SErik Schmauss 
865e646e0a5SErik Schmauss /* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 changes) */
866e62f8227SErik Schmauss 
867e62f8227SErik Schmauss struct acpi_madt_generic_interrupt {
868e62f8227SErik Schmauss 	struct acpi_subtable_header header;
869e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
870e62f8227SErik Schmauss 	u32 cpu_interface_number;
871e62f8227SErik Schmauss 	u32 uid;
872e62f8227SErik Schmauss 	u32 flags;
873e62f8227SErik Schmauss 	u32 parking_version;
874e62f8227SErik Schmauss 	u32 performance_interrupt;
875e62f8227SErik Schmauss 	u64 parked_address;
876e62f8227SErik Schmauss 	u64 base_address;
877e62f8227SErik Schmauss 	u64 gicv_base_address;
878e62f8227SErik Schmauss 	u64 gich_base_address;
879e62f8227SErik Schmauss 	u32 vgic_interrupt;
880e62f8227SErik Schmauss 	u64 gicr_base_address;
881e62f8227SErik Schmauss 	u64 arm_mpidr;
882e62f8227SErik Schmauss 	u8 efficiency_class;
883e646e0a5SErik Schmauss 	u8 reserved2[1];
884e646e0a5SErik Schmauss 	u16 spe_interrupt;	/* ACPI 6.3 */
885e62f8227SErik Schmauss };
886e62f8227SErik Schmauss 
887e62f8227SErik Schmauss /* Masks for Flags field above */
888e62f8227SErik Schmauss 
889e62f8227SErik Schmauss /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
890e62f8227SErik Schmauss #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)	/* 01: Performance Interrupt Mode */
891e62f8227SErik Schmauss #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)	/* 02: VGIC Maintenance Interrupt mode */
892e62f8227SErik Schmauss 
893e62f8227SErik Schmauss /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
894e62f8227SErik Schmauss 
895e62f8227SErik Schmauss struct acpi_madt_generic_distributor {
896e62f8227SErik Schmauss 	struct acpi_subtable_header header;
897e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
898e62f8227SErik Schmauss 	u32 gic_id;
899e62f8227SErik Schmauss 	u64 base_address;
900e62f8227SErik Schmauss 	u32 global_irq_base;
901e62f8227SErik Schmauss 	u8 version;
902e62f8227SErik Schmauss 	u8 reserved2[3];	/* reserved - must be zero */
903e62f8227SErik Schmauss };
904e62f8227SErik Schmauss 
905e62f8227SErik Schmauss /* Values for Version field above */
906e62f8227SErik Schmauss 
907e62f8227SErik Schmauss enum acpi_madt_gic_version {
908e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_NONE = 0,
909e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V1 = 1,
910e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V2 = 2,
911e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V3 = 3,
912e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_V4 = 4,
913e62f8227SErik Schmauss 	ACPI_MADT_GIC_VERSION_RESERVED = 5	/* 5 and greater are reserved */
914e62f8227SErik Schmauss };
915e62f8227SErik Schmauss 
916e62f8227SErik Schmauss /* 13: Generic MSI Frame (ACPI 5.1) */
917e62f8227SErik Schmauss 
918e62f8227SErik Schmauss struct acpi_madt_generic_msi_frame {
919e62f8227SErik Schmauss 	struct acpi_subtable_header header;
920e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
921e62f8227SErik Schmauss 	u32 msi_frame_id;
922e62f8227SErik Schmauss 	u64 base_address;
923e62f8227SErik Schmauss 	u32 flags;
924e62f8227SErik Schmauss 	u16 spi_count;
925e62f8227SErik Schmauss 	u16 spi_base;
926e62f8227SErik Schmauss };
927e62f8227SErik Schmauss 
928e62f8227SErik Schmauss /* Masks for Flags field above */
929e62f8227SErik Schmauss 
930e62f8227SErik Schmauss #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
931e62f8227SErik Schmauss 
932e62f8227SErik Schmauss /* 14: Generic Redistributor (ACPI 5.1) */
933e62f8227SErik Schmauss 
934e62f8227SErik Schmauss struct acpi_madt_generic_redistributor {
935e62f8227SErik Schmauss 	struct acpi_subtable_header header;
936e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
937e62f8227SErik Schmauss 	u64 base_address;
938e62f8227SErik Schmauss 	u32 length;
939e62f8227SErik Schmauss };
940e62f8227SErik Schmauss 
941e62f8227SErik Schmauss /* 15: Generic Translator (ACPI 6.0) */
942e62f8227SErik Schmauss 
943e62f8227SErik Schmauss struct acpi_madt_generic_translator {
944e62f8227SErik Schmauss 	struct acpi_subtable_header header;
945e62f8227SErik Schmauss 	u16 reserved;		/* reserved - must be zero */
946e62f8227SErik Schmauss 	u32 translation_id;
947e62f8227SErik Schmauss 	u64 base_address;
948e62f8227SErik Schmauss 	u32 reserved2;
949e62f8227SErik Schmauss };
950e62f8227SErik Schmauss 
9519557cb8cSErik Kaneda /* 16: Multiprocessor wakeup (ACPI 6.4) */
9529557cb8cSErik Kaneda 
9539557cb8cSErik Kaneda struct acpi_madt_multiproc_wakeup {
9549557cb8cSErik Kaneda 	struct acpi_subtable_header header;
9559557cb8cSErik Kaneda 	u16 mailbox_version;
9569557cb8cSErik Kaneda 	u32 reserved;		/* reserved - must be zero */
9579557cb8cSErik Kaneda 	u64 base_address;
9589557cb8cSErik Kaneda };
9599557cb8cSErik Kaneda 
96042d96e16SKuppuswamy Sathyanarayanan #define ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE	2032
96142d96e16SKuppuswamy Sathyanarayanan #define ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE	2048
96242d96e16SKuppuswamy Sathyanarayanan 
96342d96e16SKuppuswamy Sathyanarayanan struct acpi_madt_multiproc_wakeup_mailbox {
96442d96e16SKuppuswamy Sathyanarayanan 	u16 command;
96542d96e16SKuppuswamy Sathyanarayanan 	u16 reserved;		/* reserved - must be zero */
96642d96e16SKuppuswamy Sathyanarayanan 	u32 apic_id;
96742d96e16SKuppuswamy Sathyanarayanan 	u64 wakeup_vector;
96842d96e16SKuppuswamy Sathyanarayanan 	u8 reserved_os[ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE];	/* reserved for OS use */
96942d96e16SKuppuswamy Sathyanarayanan 	u8 reserved_firmware[ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE];	/* reserved for firmware use */
97042d96e16SKuppuswamy Sathyanarayanan };
97142d96e16SKuppuswamy Sathyanarayanan 
97242d96e16SKuppuswamy Sathyanarayanan #define ACPI_MP_WAKE_COMMAND_WAKEUP    1
97342d96e16SKuppuswamy Sathyanarayanan 
974e62f8227SErik Schmauss /*
975e62f8227SErik Schmauss  * Common flags fields for MADT subtables
976e62f8227SErik Schmauss  */
977e62f8227SErik Schmauss 
978e62f8227SErik Schmauss /* MADT Local APIC flags */
979e62f8227SErik Schmauss 
980e62f8227SErik Schmauss #define ACPI_MADT_ENABLED           (1)	/* 00: Processor is usable if set */
981e62f8227SErik Schmauss 
982e62f8227SErik Schmauss /* MADT MPS INTI flags (inti_flags) */
983e62f8227SErik Schmauss 
984e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_MASK     (3)	/* 00-01: Polarity of APIC I/O input signals */
985e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_MASK      (3<<2)	/* 02-03: Trigger mode of APIC input signals */
986e62f8227SErik Schmauss 
987e62f8227SErik Schmauss /* Values for MPS INTI flags */
988e62f8227SErik Schmauss 
989e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_CONFORMS       0
990e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
991e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_RESERVED       2
992e62f8227SErik Schmauss #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
993e62f8227SErik Schmauss 
994e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_CONFORMS        (0)
995e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
996e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
997e62f8227SErik Schmauss #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
998e62f8227SErik Schmauss 
999e62f8227SErik Schmauss /*******************************************************************************
1000e62f8227SErik Schmauss  *
10011a49b72cSBob Moore  * MCFG - PCI Memory Mapped Configuration table and subtable
10026e2d5ebdSBob Moore  *        Version 1
10036e2d5ebdSBob Moore  *
10046e2d5ebdSBob Moore  * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
1005b24aad44SBob Moore  *
1006b24aad44SBob Moore  ******************************************************************************/
1007b24aad44SBob Moore 
1008b24aad44SBob Moore struct acpi_table_mcfg {
1009b24aad44SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
1010b24aad44SBob Moore 	u8 reserved[8];
1011b24aad44SBob Moore };
1012b24aad44SBob Moore 
1013b24aad44SBob Moore /* Subtable */
1014b24aad44SBob Moore 
1015b24aad44SBob Moore struct acpi_mcfg_allocation {
1016b24aad44SBob Moore 	u64 address;		/* Base address, processor-relative */
1017b24aad44SBob Moore 	u16 pci_segment;	/* PCI segment group number */
1018b24aad44SBob Moore 	u8 start_bus_number;	/* Starting PCI Bus number */
1019b24aad44SBob Moore 	u8 end_bus_number;	/* Final PCI Bus number */
1020b24aad44SBob Moore 	u32 reserved;
1021b24aad44SBob Moore };
1022b24aad44SBob Moore 
1023b24aad44SBob Moore /*******************************************************************************
1024b24aad44SBob Moore  *
10250e264f0bSBob Moore  * MCHI - Management Controller Host Interface Table
10260e264f0bSBob Moore  *        Version 1
10270e264f0bSBob Moore  *
10280e264f0bSBob Moore  * Conforms to "Management Component Transport Protocol (MCTP) Host
10290e264f0bSBob Moore  * Interface Specification", Revision 1.0.0a, October 13, 2009
10300e264f0bSBob Moore  *
10310e264f0bSBob Moore  ******************************************************************************/
10320e264f0bSBob Moore 
10330e264f0bSBob Moore struct acpi_table_mchi {
10340e264f0bSBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
10350e264f0bSBob Moore 	u8 interface_type;
10360e264f0bSBob Moore 	u8 protocol;
10370e264f0bSBob Moore 	u64 protocol_data;
10380e264f0bSBob Moore 	u8 interrupt_type;
10390e264f0bSBob Moore 	u8 gpe;
10400e264f0bSBob Moore 	u8 pci_device_flag;
10410e264f0bSBob Moore 	u32 global_interrupt;
10420e264f0bSBob Moore 	struct acpi_generic_address control_register;
10430e264f0bSBob Moore 	u8 pci_segment;
10440e264f0bSBob Moore 	u8 pci_bus;
10450e264f0bSBob Moore 	u8 pci_device;
10460e264f0bSBob Moore 	u8 pci_function;
10470e264f0bSBob Moore };
10480e264f0bSBob Moore 
10490e264f0bSBob Moore /*******************************************************************************
10500e264f0bSBob Moore  *
1051e62f8227SErik Schmauss  * MPST - Memory Power State Table (ACPI 5.0)
1052e62f8227SErik Schmauss  *        Version 1
1053e62f8227SErik Schmauss  *
1054e62f8227SErik Schmauss  ******************************************************************************/
1055e62f8227SErik Schmauss 
1056e62f8227SErik Schmauss #define ACPI_MPST_CHANNEL_INFO \
1057e62f8227SErik Schmauss 	u8                              channel_id; \
1058e62f8227SErik Schmauss 	u8                              reserved1[3]; \
1059e62f8227SErik Schmauss 	u16                             power_node_count; \
1060e62f8227SErik Schmauss 	u16                             reserved2;
1061e62f8227SErik Schmauss 
1062e62f8227SErik Schmauss /* Main table */
1063e62f8227SErik Schmauss 
1064e62f8227SErik Schmauss struct acpi_table_mpst {
1065e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1066e62f8227SErik Schmauss 	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
1067e62f8227SErik Schmauss };
1068e62f8227SErik Schmauss 
1069e62f8227SErik Schmauss /* Memory Platform Communication Channel Info */
1070e62f8227SErik Schmauss 
1071e62f8227SErik Schmauss struct acpi_mpst_channel {
1072e62f8227SErik Schmauss 	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
1073e62f8227SErik Schmauss };
1074e62f8227SErik Schmauss 
1075e62f8227SErik Schmauss /* Memory Power Node Structure */
1076e62f8227SErik Schmauss 
1077e62f8227SErik Schmauss struct acpi_mpst_power_node {
1078e62f8227SErik Schmauss 	u8 flags;
1079e62f8227SErik Schmauss 	u8 reserved1;
1080e62f8227SErik Schmauss 	u16 node_id;
1081e62f8227SErik Schmauss 	u32 length;
1082e62f8227SErik Schmauss 	u64 range_address;
1083e62f8227SErik Schmauss 	u64 range_length;
1084e62f8227SErik Schmauss 	u32 num_power_states;
1085e62f8227SErik Schmauss 	u32 num_physical_components;
1086e62f8227SErik Schmauss };
1087e62f8227SErik Schmauss 
1088e62f8227SErik Schmauss /* Values for Flags field above */
1089e62f8227SErik Schmauss 
1090e62f8227SErik Schmauss #define ACPI_MPST_ENABLED               1
1091e62f8227SErik Schmauss #define ACPI_MPST_POWER_MANAGED         2
1092e62f8227SErik Schmauss #define ACPI_MPST_HOT_PLUG_CAPABLE      4
1093e62f8227SErik Schmauss 
1094e62f8227SErik Schmauss /* Memory Power State Structure (follows POWER_NODE above) */
1095e62f8227SErik Schmauss 
1096e62f8227SErik Schmauss struct acpi_mpst_power_state {
1097e62f8227SErik Schmauss 	u8 power_state;
1098e62f8227SErik Schmauss 	u8 info_index;
1099e62f8227SErik Schmauss };
1100e62f8227SErik Schmauss 
1101e62f8227SErik Schmauss /* Physical Component ID Structure (follows POWER_STATE above) */
1102e62f8227SErik Schmauss 
1103e62f8227SErik Schmauss struct acpi_mpst_component {
1104e62f8227SErik Schmauss 	u16 component_id;
1105e62f8227SErik Schmauss };
1106e62f8227SErik Schmauss 
1107e62f8227SErik Schmauss /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
1108e62f8227SErik Schmauss 
1109e62f8227SErik Schmauss struct acpi_mpst_data_hdr {
1110e62f8227SErik Schmauss 	u16 characteristics_count;
1111e62f8227SErik Schmauss 	u16 reserved;
1112e62f8227SErik Schmauss };
1113e62f8227SErik Schmauss 
1114e62f8227SErik Schmauss struct acpi_mpst_power_data {
1115e62f8227SErik Schmauss 	u8 structure_id;
1116e62f8227SErik Schmauss 	u8 flags;
1117e62f8227SErik Schmauss 	u16 reserved1;
1118e62f8227SErik Schmauss 	u32 average_power;
1119e62f8227SErik Schmauss 	u32 power_saving;
1120e62f8227SErik Schmauss 	u64 exit_latency;
1121e62f8227SErik Schmauss 	u64 reserved2;
1122e62f8227SErik Schmauss };
1123e62f8227SErik Schmauss 
1124e62f8227SErik Schmauss /* Values for Flags field above */
1125e62f8227SErik Schmauss 
1126e62f8227SErik Schmauss #define ACPI_MPST_PRESERVE              1
1127e62f8227SErik Schmauss #define ACPI_MPST_AUTOENTRY             2
1128e62f8227SErik Schmauss #define ACPI_MPST_AUTOEXIT              4
1129e62f8227SErik Schmauss 
1130e62f8227SErik Schmauss /* Shared Memory Region (not part of an ACPI table) */
1131e62f8227SErik Schmauss 
1132e62f8227SErik Schmauss struct acpi_mpst_shared {
1133e62f8227SErik Schmauss 	u32 signature;
1134e62f8227SErik Schmauss 	u16 pcc_command;
1135e62f8227SErik Schmauss 	u16 pcc_status;
1136e62f8227SErik Schmauss 	u32 command_register;
1137e62f8227SErik Schmauss 	u32 status_register;
1138e62f8227SErik Schmauss 	u32 power_state_id;
1139e62f8227SErik Schmauss 	u32 power_node_id;
1140e62f8227SErik Schmauss 	u64 energy_consumed;
1141e62f8227SErik Schmauss 	u64 average_power;
1142e62f8227SErik Schmauss };
1143e62f8227SErik Schmauss 
1144e62f8227SErik Schmauss /*******************************************************************************
1145e62f8227SErik Schmauss  *
1146e62f8227SErik Schmauss  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
1147e62f8227SErik Schmauss  *        Version 1
1148e62f8227SErik Schmauss  *
1149e62f8227SErik Schmauss  ******************************************************************************/
1150e62f8227SErik Schmauss 
1151e62f8227SErik Schmauss struct acpi_table_msct {
1152e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1153e62f8227SErik Schmauss 	u32 proximity_offset;	/* Location of proximity info struct(s) */
1154e62f8227SErik Schmauss 	u32 max_proximity_domains;	/* Max number of proximity domains */
1155e62f8227SErik Schmauss 	u32 max_clock_domains;	/* Max number of clock domains */
1156e62f8227SErik Schmauss 	u64 max_address;	/* Max physical address in system */
1157e62f8227SErik Schmauss };
1158e62f8227SErik Schmauss 
1159e62f8227SErik Schmauss /* subtable - Maximum Proximity Domain Information. Version 1 */
1160e62f8227SErik Schmauss 
1161e62f8227SErik Schmauss struct acpi_msct_proximity {
1162e62f8227SErik Schmauss 	u8 revision;
1163e62f8227SErik Schmauss 	u8 length;
1164e62f8227SErik Schmauss 	u32 range_start;	/* Start of domain range */
1165e62f8227SErik Schmauss 	u32 range_end;		/* End of domain range */
1166e62f8227SErik Schmauss 	u32 processor_capacity;
1167e62f8227SErik Schmauss 	u64 memory_capacity;	/* In bytes */
1168e62f8227SErik Schmauss };
1169e62f8227SErik Schmauss 
1170e62f8227SErik Schmauss /*******************************************************************************
1171e62f8227SErik Schmauss  *
11725132f2faSBob Moore  * MSDM - Microsoft Data Management table
11735132f2faSBob Moore  *
11745132f2faSBob Moore  * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
11755132f2faSBob Moore  * November 29, 2011. Copyright 2011 Microsoft
11765132f2faSBob Moore  *
11775132f2faSBob Moore  ******************************************************************************/
11785132f2faSBob Moore 
11795132f2faSBob Moore /* Basic MSDM table is only the common ACPI header */
11805132f2faSBob Moore 
11815132f2faSBob Moore struct acpi_table_msdm {
11825132f2faSBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
11835132f2faSBob Moore };
11845132f2faSBob Moore 
11855132f2faSBob Moore /*******************************************************************************
11865132f2faSBob Moore  *
1187e62f8227SErik Schmauss  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
1188e62f8227SErik Schmauss  *        Version 1
1189e62f8227SErik Schmauss  *
1190e62f8227SErik Schmauss  ******************************************************************************/
1191e62f8227SErik Schmauss 
1192e62f8227SErik Schmauss struct acpi_table_nfit {
1193e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1194e62f8227SErik Schmauss 	u32 reserved;		/* Reserved, must be zero */
1195e62f8227SErik Schmauss };
1196e62f8227SErik Schmauss 
1197e62f8227SErik Schmauss /* Subtable header for NFIT */
1198e62f8227SErik Schmauss 
1199e62f8227SErik Schmauss struct acpi_nfit_header {
1200e62f8227SErik Schmauss 	u16 type;
1201e62f8227SErik Schmauss 	u16 length;
1202e62f8227SErik Schmauss };
1203e62f8227SErik Schmauss 
1204e62f8227SErik Schmauss /* Values for subtable type in struct acpi_nfit_header */
1205e62f8227SErik Schmauss 
1206e62f8227SErik Schmauss enum acpi_nfit_type {
1207e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
1208e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_MEMORY_MAP = 1,
1209e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_INTERLEAVE = 2,
1210e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_SMBIOS = 3,
1211e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_CONTROL_REGION = 4,
1212e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_DATA_REGION = 5,
1213e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
1214e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_CAPABILITIES = 7,
1215e62f8227SErik Schmauss 	ACPI_NFIT_TYPE_RESERVED = 8	/* 8 and greater are reserved */
1216e62f8227SErik Schmauss };
1217e62f8227SErik Schmauss 
1218e62f8227SErik Schmauss /*
1219e62f8227SErik Schmauss  * NFIT Subtables
1220e62f8227SErik Schmauss  */
1221e62f8227SErik Schmauss 
1222e62f8227SErik Schmauss /* 0: System Physical Address Range Structure */
1223e62f8227SErik Schmauss 
1224e62f8227SErik Schmauss struct acpi_nfit_system_address {
1225e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1226e62f8227SErik Schmauss 	u16 range_index;
1227e62f8227SErik Schmauss 	u16 flags;
1228e62f8227SErik Schmauss 	u32 reserved;		/* Reserved, must be zero */
1229e62f8227SErik Schmauss 	u32 proximity_domain;
1230e62f8227SErik Schmauss 	u8 range_guid[16];
1231e62f8227SErik Schmauss 	u64 address;
1232e62f8227SErik Schmauss 	u64 length;
1233e62f8227SErik Schmauss 	u64 memory_mapping;
1234cf16b05cSBob Moore 	u64 location_cookie;	/* ACPI 6.4 */
1235e62f8227SErik Schmauss };
1236e62f8227SErik Schmauss 
1237e62f8227SErik Schmauss /* Flags */
1238e62f8227SErik Schmauss 
1239e62f8227SErik Schmauss #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)	/* 00: Add/Online Operation Only */
1240e62f8227SErik Schmauss #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)	/* 01: Proximity Domain Valid */
1241cf16b05cSBob Moore #define ACPI_NFIT_LOCATION_COOKIE_VALID (1<<2)	/* 02: SPA location cookie valid (ACPI 6.4) */
1242e62f8227SErik Schmauss 
1243e62f8227SErik Schmauss /* Range Type GUIDs appear in the include/acuuid.h file */
1244e62f8227SErik Schmauss 
1245e62f8227SErik Schmauss /* 1: Memory Device to System Address Range Map Structure */
1246e62f8227SErik Schmauss 
1247e62f8227SErik Schmauss struct acpi_nfit_memory_map {
1248e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1249e62f8227SErik Schmauss 	u32 device_handle;
1250e62f8227SErik Schmauss 	u16 physical_id;
1251e62f8227SErik Schmauss 	u16 region_id;
1252e62f8227SErik Schmauss 	u16 range_index;
1253e62f8227SErik Schmauss 	u16 region_index;
1254e62f8227SErik Schmauss 	u64 region_size;
1255e62f8227SErik Schmauss 	u64 region_offset;
1256e62f8227SErik Schmauss 	u64 address;
1257e62f8227SErik Schmauss 	u16 interleave_index;
1258e62f8227SErik Schmauss 	u16 interleave_ways;
1259e62f8227SErik Schmauss 	u16 flags;
1260e62f8227SErik Schmauss 	u16 reserved;		/* Reserved, must be zero */
1261e62f8227SErik Schmauss };
1262e62f8227SErik Schmauss 
1263e62f8227SErik Schmauss /* Flags */
1264e62f8227SErik Schmauss 
1265e62f8227SErik Schmauss #define ACPI_NFIT_MEM_SAVE_FAILED       (1)	/* 00: Last SAVE to Memory Device failed */
1266e62f8227SErik Schmauss #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)	/* 01: Last RESTORE from Memory Device failed */
1267e62f8227SErik Schmauss #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)	/* 02: Platform flush failed */
1268e62f8227SErik Schmauss #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)	/* 03: Memory Device is not armed */
1269e62f8227SErik Schmauss #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)	/* 04: Memory Device observed SMART/health events */
1270e62f8227SErik Schmauss #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)	/* 05: SMART/health events enabled */
1271e62f8227SErik Schmauss #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)	/* 06: Mapping to SPA failed */
1272e62f8227SErik Schmauss 
1273e62f8227SErik Schmauss /* 2: Interleave Structure */
1274e62f8227SErik Schmauss 
1275e62f8227SErik Schmauss struct acpi_nfit_interleave {
1276e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1277e62f8227SErik Schmauss 	u16 interleave_index;
1278e62f8227SErik Schmauss 	u16 reserved;		/* Reserved, must be zero */
1279e62f8227SErik Schmauss 	u32 line_count;
1280e62f8227SErik Schmauss 	u32 line_size;
1281e62f8227SErik Schmauss 	u32 line_offset[1];	/* Variable length */
1282e62f8227SErik Schmauss };
1283e62f8227SErik Schmauss 
1284e62f8227SErik Schmauss /* 3: SMBIOS Management Information Structure */
1285e62f8227SErik Schmauss 
1286e62f8227SErik Schmauss struct acpi_nfit_smbios {
1287e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1288e62f8227SErik Schmauss 	u32 reserved;		/* Reserved, must be zero */
1289e62f8227SErik Schmauss 	u8 data[1];		/* Variable length */
1290e62f8227SErik Schmauss };
1291e62f8227SErik Schmauss 
1292e62f8227SErik Schmauss /* 4: NVDIMM Control Region Structure */
1293e62f8227SErik Schmauss 
1294e62f8227SErik Schmauss struct acpi_nfit_control_region {
1295e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1296e62f8227SErik Schmauss 	u16 region_index;
1297e62f8227SErik Schmauss 	u16 vendor_id;
1298e62f8227SErik Schmauss 	u16 device_id;
1299e62f8227SErik Schmauss 	u16 revision_id;
1300e62f8227SErik Schmauss 	u16 subsystem_vendor_id;
1301e62f8227SErik Schmauss 	u16 subsystem_device_id;
1302e62f8227SErik Schmauss 	u16 subsystem_revision_id;
1303e62f8227SErik Schmauss 	u8 valid_fields;
1304e62f8227SErik Schmauss 	u8 manufacturing_location;
1305e62f8227SErik Schmauss 	u16 manufacturing_date;
1306e62f8227SErik Schmauss 	u8 reserved[2];		/* Reserved, must be zero */
1307e62f8227SErik Schmauss 	u32 serial_number;
1308e62f8227SErik Schmauss 	u16 code;
1309e62f8227SErik Schmauss 	u16 windows;
1310e62f8227SErik Schmauss 	u64 window_size;
1311e62f8227SErik Schmauss 	u64 command_offset;
1312e62f8227SErik Schmauss 	u64 command_size;
1313e62f8227SErik Schmauss 	u64 status_offset;
1314e62f8227SErik Schmauss 	u64 status_size;
1315e62f8227SErik Schmauss 	u16 flags;
1316e62f8227SErik Schmauss 	u8 reserved1[6];	/* Reserved, must be zero */
1317e62f8227SErik Schmauss };
1318e62f8227SErik Schmauss 
1319e62f8227SErik Schmauss /* Flags */
1320e62f8227SErik Schmauss 
1321e62f8227SErik Schmauss #define ACPI_NFIT_CONTROL_BUFFERED          (1)	/* Block Data Windows implementation is buffered */
1322e62f8227SErik Schmauss 
1323e62f8227SErik Schmauss /* valid_fields bits */
1324e62f8227SErik Schmauss 
1325e62f8227SErik Schmauss #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)	/* Manufacturing fields are valid */
1326e62f8227SErik Schmauss 
1327e62f8227SErik Schmauss /* 5: NVDIMM Block Data Window Region Structure */
1328e62f8227SErik Schmauss 
1329e62f8227SErik Schmauss struct acpi_nfit_data_region {
1330e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1331e62f8227SErik Schmauss 	u16 region_index;
1332e62f8227SErik Schmauss 	u16 windows;
1333e62f8227SErik Schmauss 	u64 offset;
1334e62f8227SErik Schmauss 	u64 size;
1335e62f8227SErik Schmauss 	u64 capacity;
1336e62f8227SErik Schmauss 	u64 start_address;
1337e62f8227SErik Schmauss };
1338e62f8227SErik Schmauss 
1339e62f8227SErik Schmauss /* 6: Flush Hint Address Structure */
1340e62f8227SErik Schmauss 
1341e62f8227SErik Schmauss struct acpi_nfit_flush_address {
1342e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1343e62f8227SErik Schmauss 	u32 device_handle;
1344e62f8227SErik Schmauss 	u16 hint_count;
1345e62f8227SErik Schmauss 	u8 reserved[6];		/* Reserved, must be zero */
1346e62f8227SErik Schmauss 	u64 hint_address[1];	/* Variable length */
1347e62f8227SErik Schmauss };
1348e62f8227SErik Schmauss 
1349e62f8227SErik Schmauss /* 7: Platform Capabilities Structure */
1350e62f8227SErik Schmauss 
1351e62f8227SErik Schmauss struct acpi_nfit_capabilities {
1352e62f8227SErik Schmauss 	struct acpi_nfit_header header;
1353e62f8227SErik Schmauss 	u8 highest_capability;
1354e62f8227SErik Schmauss 	u8 reserved[3];		/* Reserved, must be zero */
1355e62f8227SErik Schmauss 	u32 capabilities;
1356e62f8227SErik Schmauss 	u32 reserved2;
1357e62f8227SErik Schmauss };
1358e62f8227SErik Schmauss 
1359e62f8227SErik Schmauss /* Capabilities Flags */
1360e62f8227SErik Schmauss 
1361e62f8227SErik Schmauss #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)	/* 00: Cache Flush to NVDIMM capable */
1362e62f8227SErik Schmauss #define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)	/* 01: Memory Flush to NVDIMM capable */
1363e62f8227SErik Schmauss #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)	/* 02: Memory Mirroring capable */
1364e62f8227SErik Schmauss 
1365e62f8227SErik Schmauss /*
1366e62f8227SErik Schmauss  * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1367e62f8227SErik Schmauss  */
1368e62f8227SErik Schmauss struct nfit_device_handle {
1369e62f8227SErik Schmauss 	u32 handle;
1370e62f8227SErik Schmauss };
1371e62f8227SErik Schmauss 
1372e62f8227SErik Schmauss /* Device handle construction and extraction macros */
1373e62f8227SErik Schmauss 
1374e62f8227SErik Schmauss #define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
1375e62f8227SErik Schmauss #define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
1376e62f8227SErik Schmauss #define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
1377e62f8227SErik Schmauss #define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
1378e62f8227SErik Schmauss #define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
1379e62f8227SErik Schmauss 
1380e62f8227SErik Schmauss #define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
1381e62f8227SErik Schmauss #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
1382e62f8227SErik Schmauss #define ACPI_NFIT_MEMORY_ID_OFFSET              8
1383e62f8227SErik Schmauss #define ACPI_NFIT_SOCKET_ID_OFFSET              12
1384e62f8227SErik Schmauss #define ACPI_NFIT_NODE_ID_OFFSET                16
1385e62f8227SErik Schmauss 
1386e62f8227SErik Schmauss /* Macro to construct a NFIT/NVDIMM device handle */
1387e62f8227SErik Schmauss 
1388e62f8227SErik Schmauss #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1389e62f8227SErik Schmauss 	((dimm)                                         | \
1390e62f8227SErik Schmauss 	((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
1391e62f8227SErik Schmauss 	((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
1392e62f8227SErik Schmauss 	((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
1393e62f8227SErik Schmauss 	((node)    << ACPI_NFIT_NODE_ID_OFFSET))
1394e62f8227SErik Schmauss 
1395e62f8227SErik Schmauss /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1396e62f8227SErik Schmauss 
1397e62f8227SErik Schmauss #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1398e62f8227SErik Schmauss 	((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1399e62f8227SErik Schmauss 
1400e62f8227SErik Schmauss #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1401e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1402e62f8227SErik Schmauss 
1403e62f8227SErik Schmauss #define ACPI_NFIT_GET_MEMORY_ID(handle) \
1404e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
1405e62f8227SErik Schmauss 
1406e62f8227SErik Schmauss #define ACPI_NFIT_GET_SOCKET_ID(handle) \
1407e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
1408e62f8227SErik Schmauss 
1409e62f8227SErik Schmauss #define ACPI_NFIT_GET_NODE_ID(handle) \
1410e62f8227SErik Schmauss 	(((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
1411e62f8227SErik Schmauss 
1412e62f8227SErik Schmauss /*******************************************************************************
1413e62f8227SErik Schmauss  *
1414*a805aab8SBob Moore  * NHLT - Non HD Audio Link Table
1415*a805aab8SBob Moore  *
1416*a805aab8SBob Moore  * Conforms to: Intel Smart Sound Technology NHLT Specification
1417*a805aab8SBob Moore  * Version 0.8.1, January 2020.
1418*a805aab8SBob Moore  *
1419*a805aab8SBob Moore  ******************************************************************************/
1420*a805aab8SBob Moore 
1421*a805aab8SBob Moore /* Main table */
1422*a805aab8SBob Moore 
1423*a805aab8SBob Moore struct acpi_table_nhlt {
1424*a805aab8SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
1425*a805aab8SBob Moore 	u8 endpoint_count;
1426*a805aab8SBob Moore };
1427*a805aab8SBob Moore 
1428*a805aab8SBob Moore struct acpi_nhlt_endpoint {
1429*a805aab8SBob Moore 	u32 descriptor_length;
1430*a805aab8SBob Moore 	u8 link_type;
1431*a805aab8SBob Moore 	u8 instance_id;
1432*a805aab8SBob Moore 	u16 vendor_id;
1433*a805aab8SBob Moore 	u16 device_id;
1434*a805aab8SBob Moore 	u16 revision_id;
1435*a805aab8SBob Moore 	u32 subsystem_id;
1436*a805aab8SBob Moore 	u8 device_type;
1437*a805aab8SBob Moore 	u8 direction;
1438*a805aab8SBob Moore 	u8 virtual_bus_id;
1439*a805aab8SBob Moore };
1440*a805aab8SBob Moore 
1441*a805aab8SBob Moore /* Types for link_type field above */
1442*a805aab8SBob Moore 
1443*a805aab8SBob Moore #define ACPI_NHLT_RESERVED_HD_AUDIO         0
1444*a805aab8SBob Moore #define ACPI_NHLT_RESERVED_DSP              1
1445*a805aab8SBob Moore #define ACPI_NHLT_PDM                       2
1446*a805aab8SBob Moore #define ACPI_NHLT_SSP                       3
1447*a805aab8SBob Moore #define ACPI_NHLT_RESERVED_SLIMBUS          4
1448*a805aab8SBob Moore #define ACPI_NHLT_RESERVED_SOUNDWIRE        5
1449*a805aab8SBob Moore #define ACPI_NHLT_TYPE_RESERVED             6	/* 6 and above are reserved */
1450*a805aab8SBob Moore 
1451*a805aab8SBob Moore /* All other values above are reserved */
1452*a805aab8SBob Moore 
1453*a805aab8SBob Moore /* Values for device_id field above */
1454*a805aab8SBob Moore 
1455*a805aab8SBob Moore #define ACPI_NHLT_PDM_DMIC                  0xAE20
1456*a805aab8SBob Moore #define ACPI_NHLT_BT_SIDEBAND               0xAE30
1457*a805aab8SBob Moore #define ACPI_NHLT_I2S_TDM_CODECS            0xAE23
1458*a805aab8SBob Moore 
1459*a805aab8SBob Moore /* Values for device_type field above */
1460*a805aab8SBob Moore 
1461*a805aab8SBob Moore /* SSP Link */
1462*a805aab8SBob Moore 
1463*a805aab8SBob Moore #define ACPI_NHLT_LINK_BT_SIDEBAND          0
1464*a805aab8SBob Moore #define ACPI_NHLT_LINK_FM                   1
1465*a805aab8SBob Moore #define ACPI_NHLT_LINK_MODEM                2
1466*a805aab8SBob Moore /* 3 is reserved */
1467*a805aab8SBob Moore #define ACPI_NHLT_LINK_SSP_ANALOG_CODEC     4
1468*a805aab8SBob Moore 
1469*a805aab8SBob Moore /* PDM Link */
1470*a805aab8SBob Moore 
1471*a805aab8SBob Moore #define ACPI_NHLT_PDM_ON_CAVS_1P8           0
1472*a805aab8SBob Moore #define ACPI_NHLT_PDM_ON_CAVS_1P5           1
1473*a805aab8SBob Moore 
1474*a805aab8SBob Moore /* Values for Direction field above */
1475*a805aab8SBob Moore 
1476*a805aab8SBob Moore #define ACPI_NHLT_DIR_RENDER                0
1477*a805aab8SBob Moore #define ACPI_NHLT_DIR_CAPTURE               1
1478*a805aab8SBob Moore #define ACPI_NHLT_DIR_RENDER_LOOPBACK       2
1479*a805aab8SBob Moore #define ACPI_NHLT_DIR_RENDER_FEEDBACK       3
1480*a805aab8SBob Moore #define ACPI_NHLT_DIR_RESERVED              4	/* 4 and above are reserved */
1481*a805aab8SBob Moore 
1482*a805aab8SBob Moore struct acpi_nhlt_device_specific_config {
1483*a805aab8SBob Moore 	u32 capabilities_size;
1484*a805aab8SBob Moore 	u8 virtual_slot;
1485*a805aab8SBob Moore 	u8 config_type;
1486*a805aab8SBob Moore };
1487*a805aab8SBob Moore 
1488*a805aab8SBob Moore struct acpi_nhlt_device_specific_config_a {
1489*a805aab8SBob Moore 	u32 capabilities_size;
1490*a805aab8SBob Moore 	u8 virtual_slot;
1491*a805aab8SBob Moore 	u8 config_type;
1492*a805aab8SBob Moore 	u8 array_type;
1493*a805aab8SBob Moore };
1494*a805aab8SBob Moore 
1495*a805aab8SBob Moore /* Values for Config Type above */
1496*a805aab8SBob Moore 
1497*a805aab8SBob Moore #define ACPI_NHLT_TYPE_MIC_ARRAY            0x01
1498*a805aab8SBob Moore #define ACPI_NHLT_TYPE_GENERIC              0x00
1499*a805aab8SBob Moore 
1500*a805aab8SBob Moore /* Mask for Extension field of array_type */
1501*a805aab8SBob Moore 
1502*a805aab8SBob Moore #define ACPI_NHLT_ARRAY_TYPE_MASK           0x10
1503*a805aab8SBob Moore 
1504*a805aab8SBob Moore struct acpi_nhlt_device_specific_config_b {
1505*a805aab8SBob Moore 	u32 capabilities_size;
1506*a805aab8SBob Moore };
1507*a805aab8SBob Moore 
1508*a805aab8SBob Moore struct acpi_nhlt_device_specific_config_c {
1509*a805aab8SBob Moore 	u32 capabilities_size;
1510*a805aab8SBob Moore 	u8 virtual_slot;
1511*a805aab8SBob Moore };
1512*a805aab8SBob Moore 
1513*a805aab8SBob Moore struct acpi_nhlt_wave_extensible {
1514*a805aab8SBob Moore 	u16 format_tag;
1515*a805aab8SBob Moore 	u16 channel_count;
1516*a805aab8SBob Moore 	u32 samples_per_sec;
1517*a805aab8SBob Moore 	u32 avg_bytes_per_sec;
1518*a805aab8SBob Moore 	u16 block_align;
1519*a805aab8SBob Moore 	u16 bits_per_sample;
1520*a805aab8SBob Moore 	u16 extra_format_size;
1521*a805aab8SBob Moore 	u16 valid_bits_per_sample;
1522*a805aab8SBob Moore 	u32 channel_mask;
1523*a805aab8SBob Moore 	u8 sub_format_guid[16];
1524*a805aab8SBob Moore };
1525*a805aab8SBob Moore 
1526*a805aab8SBob Moore /* Values for channel_mask above */
1527*a805aab8SBob Moore 
1528*a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_LEFT             0x1
1529*a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_RIGHT            0x2
1530*a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_CENTER           0x4
1531*a805aab8SBob Moore #define ACPI_NHLT_SPKR_LOW_FREQ               0x8
1532*a805aab8SBob Moore #define ACPI_NHLT_SPKR_BACK_LEFT              0x10
1533*a805aab8SBob Moore #define ACPI_NHLT_SPKR_BACK_RIGHT             0x20
1534*a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_LEFT_OF_CENTER   0x40
1535*a805aab8SBob Moore #define ACPI_NHLT_SPKR_FRONT_RIGHT_OF_CENTER  0x80
1536*a805aab8SBob Moore #define ACPI_NHLT_SPKR_BACK_CENTER            0x100
1537*a805aab8SBob Moore #define ACPI_NHLT_SPKR_SIDE_LEFT              0x200
1538*a805aab8SBob Moore #define ACPI_NHLT_SPKR_SIDE_RIGHT             0x400
1539*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_CENTER             0x800
1540*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_FRONT_LEFT         0x1000
1541*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_FRONT_CENTER       0x2000
1542*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_FRONT_RIGHT        0x4000
1543*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_BACK_LEFT          0x8000
1544*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_BACK_CENTER        0x10000
1545*a805aab8SBob Moore #define ACPI_NHLT_SPKR_TOP_BACK_RIGHT         0x20000
1546*a805aab8SBob Moore 
1547*a805aab8SBob Moore struct acpi_nhlt_format_config {
1548*a805aab8SBob Moore 	struct acpi_nhlt_wave_extensible format;
1549*a805aab8SBob Moore 	u32 capability_size;
1550*a805aab8SBob Moore 	u8 capabilities[];
1551*a805aab8SBob Moore };
1552*a805aab8SBob Moore 
1553*a805aab8SBob Moore struct acpi_nhlt_formats_config {
1554*a805aab8SBob Moore 	u8 formats_count;
1555*a805aab8SBob Moore };
1556*a805aab8SBob Moore 
1557*a805aab8SBob Moore struct acpi_nhlt_device_specific_hdr {
1558*a805aab8SBob Moore 	u8 virtual_slot;
1559*a805aab8SBob Moore 	u8 config_type;
1560*a805aab8SBob Moore };
1561*a805aab8SBob Moore 
1562*a805aab8SBob Moore /* Types for config_type above */
1563*a805aab8SBob Moore 
1564*a805aab8SBob Moore #define ACPI_NHLT_GENERIC                   0
1565*a805aab8SBob Moore #define ACPI_NHLT_MIC                       1
1566*a805aab8SBob Moore #define ACPI_NHLT_RENDER                    3
1567*a805aab8SBob Moore 
1568*a805aab8SBob Moore struct acpi_nhlt_mic_device_specific_config {
1569*a805aab8SBob Moore 	struct acpi_nhlt_device_specific_hdr device_config;
1570*a805aab8SBob Moore 	u8 array_type_ext;
1571*a805aab8SBob Moore };
1572*a805aab8SBob Moore 
1573*a805aab8SBob Moore /* Values for array_type_ext above */
1574*a805aab8SBob Moore 
1575*a805aab8SBob Moore #define SMALL_LINEAR_2ELEMENT               0x0A
1576*a805aab8SBob Moore #define BIG_LINEAR_2ELEMENT                 0x0B
1577*a805aab8SBob Moore #define FIRST_GEOMETRY_LINEAR_4ELEMENT      0x0C
1578*a805aab8SBob Moore #define PLANAR_LSHAPED_4ELEMENT             0x0D
1579*a805aab8SBob Moore #define SECOND_GEOMETRY_LINEAR_4ELEMENT     0x0E
1580*a805aab8SBob Moore #define VENDOR_DEFINED                      0x0F
1581*a805aab8SBob Moore #define ARRAY_TYPE_MASK                     0x0F
1582*a805aab8SBob Moore #define ARRAY_TYPE_EXT_MASK                 0x10
1583*a805aab8SBob Moore 
1584*a805aab8SBob Moore #define NO_EXTENSION                        0x0
1585*a805aab8SBob Moore #define MIC_SNR_SENSITIVITY_EXT             0x1
1586*a805aab8SBob Moore 
1587*a805aab8SBob Moore struct acpi_nhlt_vendor_mic_config {
1588*a805aab8SBob Moore 	u8 type;
1589*a805aab8SBob Moore 	u8 panel;
1590*a805aab8SBob Moore 	u16 speaker_position_distance;	// mm
1591*a805aab8SBob Moore 	u16 horizontal_offset;	// mm
1592*a805aab8SBob Moore 	u16 vertical_offset;	// mm
1593*a805aab8SBob Moore 	u8 frequency_low_band;	// 5*hz
1594*a805aab8SBob Moore 	u8 frequency_high_band;	// 500*hz
1595*a805aab8SBob Moore 	u16 direction_angle;	// -180 - + 180
1596*a805aab8SBob Moore 	u16 elevation_angle;	// -180 - + 180
1597*a805aab8SBob Moore 	u16 work_vertical_angle_begin;	// -180 - + 180 with 2 deg step
1598*a805aab8SBob Moore 	u16 work_vertical_angle_end;	// -180 - + 180 with 2 deg step
1599*a805aab8SBob Moore 	u16 work_horizontal_angle_begin;	// -180 - + 180 with 2 deg step
1600*a805aab8SBob Moore 	u16 work_horizontal_angle_end;	// -180 - + 180 with 2 deg step
1601*a805aab8SBob Moore };
1602*a805aab8SBob Moore 
1603*a805aab8SBob Moore /* Values for Type field above */
1604*a805aab8SBob Moore 
1605*a805aab8SBob Moore #define MIC_OMNIDIRECTIONAL                 0
1606*a805aab8SBob Moore #define MIC_SUBCARDIOID                     1
1607*a805aab8SBob Moore #define MIC_CARDIOID                        2
1608*a805aab8SBob Moore #define MIC_SUPER_CARDIOID                  3
1609*a805aab8SBob Moore #define MIC_HYPER_CARDIOID                  4
1610*a805aab8SBob Moore #define MIC_8_SHAPED                        5
1611*a805aab8SBob Moore #define MIC_VENDOR_DEFINED                  7
1612*a805aab8SBob Moore 
1613*a805aab8SBob Moore /* Values for Panel field above */
1614*a805aab8SBob Moore 
1615*a805aab8SBob Moore #define MIC_TOP                             0
1616*a805aab8SBob Moore #define MIC_BOTTOM                          1
1617*a805aab8SBob Moore #define MIC_LEFT                            2
1618*a805aab8SBob Moore #define MIC_RIGHT                           3
1619*a805aab8SBob Moore #define MIC_FRONT                           4
1620*a805aab8SBob Moore #define MIC_REAR                            5
1621*a805aab8SBob Moore 
1622*a805aab8SBob Moore struct acpi_nhlt_vendor_mic_device_specific_config {
1623*a805aab8SBob Moore 	struct acpi_nhlt_mic_device_specific_config mic_array_device_config;
1624*a805aab8SBob Moore 	u8 number_of_microphones;
1625*a805aab8SBob Moore 	struct acpi_nhlt_vendor_mic_config mic_config[];	// indexed by number_of_microphones
1626*a805aab8SBob Moore };
1627*a805aab8SBob Moore 
1628*a805aab8SBob Moore /* Microphone SNR and Sensitivity extension */
1629*a805aab8SBob Moore 
1630*a805aab8SBob Moore struct acpi_nhlt_mic_snr_sensitivity_extension {
1631*a805aab8SBob Moore 	u32 SNR;
1632*a805aab8SBob Moore 	u32 sensitivity;
1633*a805aab8SBob Moore };
1634*a805aab8SBob Moore 
1635*a805aab8SBob Moore struct acpi_nhlt_render_feedback_device_specific_config {
1636*a805aab8SBob Moore 	struct acpi_nhlt_device_specific_config device_config;
1637*a805aab8SBob Moore 	u8 feedback_virtual_slot;	// render slot in case of capture
1638*a805aab8SBob Moore 	u16 feedback_channels;	// informative only
1639*a805aab8SBob Moore 	u16 feedback_valid_bits_per_sample;
1640*a805aab8SBob Moore };
1641*a805aab8SBob Moore 
1642*a805aab8SBob Moore /* Linux-specific structures */
1643*a805aab8SBob Moore 
1644*a805aab8SBob Moore struct acpi_nhlt_linux_specific_count {
1645*a805aab8SBob Moore 	u8 structure_count;
1646*a805aab8SBob Moore };
1647*a805aab8SBob Moore 
1648*a805aab8SBob Moore struct acpi_nhlt_linux_specific_data {
1649*a805aab8SBob Moore 	u8 device_id[16];
1650*a805aab8SBob Moore 	u8 device_instance_id;
1651*a805aab8SBob Moore 	u8 device_port_id;
1652*a805aab8SBob Moore 	u8 filler[18];
1653*a805aab8SBob Moore };
1654*a805aab8SBob Moore 
1655*a805aab8SBob Moore struct acpi_nhlt_table_terminator {
1656*a805aab8SBob Moore 	u32 terminator_value;
1657*a805aab8SBob Moore 	u32 terminator_signature;
1658*a805aab8SBob Moore };
1659*a805aab8SBob Moore 
1660*a805aab8SBob Moore /*******************************************************************************
1661*a805aab8SBob Moore  *
1662e62f8227SErik Schmauss  * PCCT - Platform Communications Channel Table (ACPI 5.0)
1663e62f8227SErik Schmauss  *        Version 2 (ACPI 6.2)
1664e62f8227SErik Schmauss  *
1665e62f8227SErik Schmauss  ******************************************************************************/
1666e62f8227SErik Schmauss 
1667e62f8227SErik Schmauss struct acpi_table_pcct {
1668e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1669e62f8227SErik Schmauss 	u32 flags;
1670e62f8227SErik Schmauss 	u64 reserved;
1671e62f8227SErik Schmauss };
1672e62f8227SErik Schmauss 
1673e62f8227SErik Schmauss /* Values for Flags field above */
1674e62f8227SErik Schmauss 
1675e62f8227SErik Schmauss #define ACPI_PCCT_DOORBELL              1
1676e62f8227SErik Schmauss 
1677e62f8227SErik Schmauss /* Values for subtable type in struct acpi_subtable_header */
1678e62f8227SErik Schmauss 
1679e62f8227SErik Schmauss enum acpi_pcct_type {
1680e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
1681e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
1682e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2,	/* ACPI 6.1 */
1683e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3,	/* ACPI 6.2 */
1684e62f8227SErik Schmauss 	ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4,	/* ACPI 6.2 */
168571f79a3fSErik Kaneda 	ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE = 5,	/* ACPI 6.4 */
168671f79a3fSErik Kaneda 	ACPI_PCCT_TYPE_RESERVED = 6	/* 6 and greater are reserved */
1687e62f8227SErik Schmauss };
1688e62f8227SErik Schmauss 
1689e62f8227SErik Schmauss /*
1690e62f8227SErik Schmauss  * PCCT Subtables, correspond to Type in struct acpi_subtable_header
1691e62f8227SErik Schmauss  */
1692e62f8227SErik Schmauss 
1693e62f8227SErik Schmauss /* 0: Generic Communications Subspace */
1694e62f8227SErik Schmauss 
1695e62f8227SErik Schmauss struct acpi_pcct_subspace {
1696e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1697e62f8227SErik Schmauss 	u8 reserved[6];
1698e62f8227SErik Schmauss 	u64 base_address;
1699e62f8227SErik Schmauss 	u64 length;
1700e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
1701e62f8227SErik Schmauss 	u64 preserve_mask;
1702e62f8227SErik Schmauss 	u64 write_mask;
1703e62f8227SErik Schmauss 	u32 latency;
1704e62f8227SErik Schmauss 	u32 max_access_rate;
1705e62f8227SErik Schmauss 	u16 min_turnaround_time;
1706e62f8227SErik Schmauss };
1707e62f8227SErik Schmauss 
1708e62f8227SErik Schmauss /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
1709e62f8227SErik Schmauss 
1710e62f8227SErik Schmauss struct acpi_pcct_hw_reduced {
1711e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1712e62f8227SErik Schmauss 	u32 platform_interrupt;
1713e62f8227SErik Schmauss 	u8 flags;
1714e62f8227SErik Schmauss 	u8 reserved;
1715e62f8227SErik Schmauss 	u64 base_address;
1716e62f8227SErik Schmauss 	u64 length;
1717e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
1718e62f8227SErik Schmauss 	u64 preserve_mask;
1719e62f8227SErik Schmauss 	u64 write_mask;
1720e62f8227SErik Schmauss 	u32 latency;
1721e62f8227SErik Schmauss 	u32 max_access_rate;
1722e62f8227SErik Schmauss 	u16 min_turnaround_time;
1723e62f8227SErik Schmauss };
1724e62f8227SErik Schmauss 
1725e62f8227SErik Schmauss /* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
1726e62f8227SErik Schmauss 
1727e62f8227SErik Schmauss struct acpi_pcct_hw_reduced_type2 {
1728e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1729e62f8227SErik Schmauss 	u32 platform_interrupt;
1730e62f8227SErik Schmauss 	u8 flags;
1731e62f8227SErik Schmauss 	u8 reserved;
1732e62f8227SErik Schmauss 	u64 base_address;
1733e62f8227SErik Schmauss 	u64 length;
1734e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
1735e62f8227SErik Schmauss 	u64 preserve_mask;
1736e62f8227SErik Schmauss 	u64 write_mask;
1737e62f8227SErik Schmauss 	u32 latency;
1738e62f8227SErik Schmauss 	u32 max_access_rate;
1739e62f8227SErik Schmauss 	u16 min_turnaround_time;
1740e62f8227SErik Schmauss 	struct acpi_generic_address platform_ack_register;
1741e62f8227SErik Schmauss 	u64 ack_preserve_mask;
1742e62f8227SErik Schmauss 	u64 ack_write_mask;
1743e62f8227SErik Schmauss };
1744e62f8227SErik Schmauss 
1745e62f8227SErik Schmauss /* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
1746e62f8227SErik Schmauss 
1747e62f8227SErik Schmauss struct acpi_pcct_ext_pcc_master {
1748e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1749e62f8227SErik Schmauss 	u32 platform_interrupt;
1750e62f8227SErik Schmauss 	u8 flags;
1751e62f8227SErik Schmauss 	u8 reserved1;
1752e62f8227SErik Schmauss 	u64 base_address;
1753e62f8227SErik Schmauss 	u32 length;
1754e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
1755e62f8227SErik Schmauss 	u64 preserve_mask;
1756e62f8227SErik Schmauss 	u64 write_mask;
1757e62f8227SErik Schmauss 	u32 latency;
1758e62f8227SErik Schmauss 	u32 max_access_rate;
1759e62f8227SErik Schmauss 	u32 min_turnaround_time;
1760e62f8227SErik Schmauss 	struct acpi_generic_address platform_ack_register;
1761e62f8227SErik Schmauss 	u64 ack_preserve_mask;
1762e62f8227SErik Schmauss 	u64 ack_set_mask;
1763e62f8227SErik Schmauss 	u64 reserved2;
1764e62f8227SErik Schmauss 	struct acpi_generic_address cmd_complete_register;
1765e62f8227SErik Schmauss 	u64 cmd_complete_mask;
1766e62f8227SErik Schmauss 	struct acpi_generic_address cmd_update_register;
1767e62f8227SErik Schmauss 	u64 cmd_update_preserve_mask;
1768e62f8227SErik Schmauss 	u64 cmd_update_set_mask;
1769e62f8227SErik Schmauss 	struct acpi_generic_address error_status_register;
1770e62f8227SErik Schmauss 	u64 error_status_mask;
1771e62f8227SErik Schmauss };
1772e62f8227SErik Schmauss 
1773e62f8227SErik Schmauss /* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
1774e62f8227SErik Schmauss 
1775e62f8227SErik Schmauss struct acpi_pcct_ext_pcc_slave {
1776e62f8227SErik Schmauss 	struct acpi_subtable_header header;
1777e62f8227SErik Schmauss 	u32 platform_interrupt;
1778e62f8227SErik Schmauss 	u8 flags;
1779e62f8227SErik Schmauss 	u8 reserved1;
1780e62f8227SErik Schmauss 	u64 base_address;
1781e62f8227SErik Schmauss 	u32 length;
1782e62f8227SErik Schmauss 	struct acpi_generic_address doorbell_register;
1783e62f8227SErik Schmauss 	u64 preserve_mask;
1784e62f8227SErik Schmauss 	u64 write_mask;
1785e62f8227SErik Schmauss 	u32 latency;
1786e62f8227SErik Schmauss 	u32 max_access_rate;
1787e62f8227SErik Schmauss 	u32 min_turnaround_time;
1788e62f8227SErik Schmauss 	struct acpi_generic_address platform_ack_register;
1789e62f8227SErik Schmauss 	u64 ack_preserve_mask;
1790e62f8227SErik Schmauss 	u64 ack_set_mask;
1791e62f8227SErik Schmauss 	u64 reserved2;
1792e62f8227SErik Schmauss 	struct acpi_generic_address cmd_complete_register;
1793e62f8227SErik Schmauss 	u64 cmd_complete_mask;
1794e62f8227SErik Schmauss 	struct acpi_generic_address cmd_update_register;
1795e62f8227SErik Schmauss 	u64 cmd_update_preserve_mask;
1796e62f8227SErik Schmauss 	u64 cmd_update_set_mask;
1797e62f8227SErik Schmauss 	struct acpi_generic_address error_status_register;
1798e62f8227SErik Schmauss 	u64 error_status_mask;
1799e62f8227SErik Schmauss };
1800e62f8227SErik Schmauss 
180171f79a3fSErik Kaneda /* 5: HW Registers based Communications Subspace */
180271f79a3fSErik Kaneda 
180371f79a3fSErik Kaneda struct acpi_pcct_hw_reg {
180471f79a3fSErik Kaneda 	struct acpi_subtable_header header;
180571f79a3fSErik Kaneda 	u16 version;
180671f79a3fSErik Kaneda 	u64 base_address;
180771f79a3fSErik Kaneda 	u64 length;
180871f79a3fSErik Kaneda 	struct acpi_generic_address doorbell_register;
180971f79a3fSErik Kaneda 	u64 doorbell_preserve;
181071f79a3fSErik Kaneda 	u64 doorbell_write;
181171f79a3fSErik Kaneda 	struct acpi_generic_address cmd_complete_register;
181271f79a3fSErik Kaneda 	u64 cmd_complete_mask;
181371f79a3fSErik Kaneda 	struct acpi_generic_address error_status_register;
181471f79a3fSErik Kaneda 	u64 error_status_mask;
181571f79a3fSErik Kaneda 	u32 nominal_latency;
181671f79a3fSErik Kaneda 	u32 min_turnaround_time;
181771f79a3fSErik Kaneda };
181871f79a3fSErik Kaneda 
1819e62f8227SErik Schmauss /* Values for doorbell flags above */
1820e62f8227SErik Schmauss 
1821e62f8227SErik Schmauss #define ACPI_PCCT_INTERRUPT_POLARITY    (1)
1822e62f8227SErik Schmauss #define ACPI_PCCT_INTERRUPT_MODE        (1<<1)
1823e62f8227SErik Schmauss 
1824e62f8227SErik Schmauss /*
1825e62f8227SErik Schmauss  * PCC memory structures (not part of the ACPI table)
1826e62f8227SErik Schmauss  */
1827e62f8227SErik Schmauss 
1828e62f8227SErik Schmauss /* Shared Memory Region */
1829e62f8227SErik Schmauss 
1830e62f8227SErik Schmauss struct acpi_pcct_shared_memory {
1831e62f8227SErik Schmauss 	u32 signature;
1832e62f8227SErik Schmauss 	u16 command;
1833e62f8227SErik Schmauss 	u16 status;
1834e62f8227SErik Schmauss };
1835e62f8227SErik Schmauss 
1836e62f8227SErik Schmauss /* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
1837e62f8227SErik Schmauss 
1838e62f8227SErik Schmauss struct acpi_pcct_ext_pcc_shared_memory {
1839e62f8227SErik Schmauss 	u32 signature;
1840e62f8227SErik Schmauss 	u32 flags;
1841e62f8227SErik Schmauss 	u32 length;
1842e62f8227SErik Schmauss 	u32 command;
1843e62f8227SErik Schmauss };
1844e62f8227SErik Schmauss 
1845e62f8227SErik Schmauss /*******************************************************************************
1846e62f8227SErik Schmauss  *
1847e62f8227SErik Schmauss  * PDTT - Platform Debug Trigger Table (ACPI 6.2)
1848e62f8227SErik Schmauss  *        Version 0
1849e62f8227SErik Schmauss  *
1850e62f8227SErik Schmauss  ******************************************************************************/
1851e62f8227SErik Schmauss 
1852e62f8227SErik Schmauss struct acpi_table_pdtt {
1853e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1854e62f8227SErik Schmauss 	u8 trigger_count;
1855e62f8227SErik Schmauss 	u8 reserved[3];
1856e62f8227SErik Schmauss 	u32 array_offset;
1857e62f8227SErik Schmauss };
1858e62f8227SErik Schmauss 
1859e62f8227SErik Schmauss /*
1860e62f8227SErik Schmauss  * PDTT Communication Channel Identifier Structure.
1861e62f8227SErik Schmauss  * The number of these structures is defined by trigger_count above,
1862e62f8227SErik Schmauss  * starting at array_offset.
1863e62f8227SErik Schmauss  */
1864e62f8227SErik Schmauss struct acpi_pdtt_channel {
1865e62f8227SErik Schmauss 	u8 subchannel_id;
1866e62f8227SErik Schmauss 	u8 flags;
1867e62f8227SErik Schmauss };
1868e62f8227SErik Schmauss 
1869e62f8227SErik Schmauss /* Flags for above */
1870e62f8227SErik Schmauss 
1871e62f8227SErik Schmauss #define ACPI_PDTT_RUNTIME_TRIGGER           (1)
1872e62f8227SErik Schmauss #define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
1873f00175d0SErik Schmauss #define ACPI_PDTT_TRIGGER_ORDER             (1<<2)
1874e62f8227SErik Schmauss 
1875e62f8227SErik Schmauss /*******************************************************************************
1876e62f8227SErik Schmauss  *
18779f400337SErik Kaneda  * PHAT - Platform Health Assessment Table (ACPI 6.4)
18789f400337SErik Kaneda  *        Version 1
18799f400337SErik Kaneda  *
18809f400337SErik Kaneda  ******************************************************************************/
18819f400337SErik Kaneda 
18829f400337SErik Kaneda struct acpi_table_phat {
18839f400337SErik Kaneda 	struct acpi_table_header header;	/* Common ACPI table header */
18849f400337SErik Kaneda };
18859f400337SErik Kaneda 
18869f400337SErik Kaneda /* Common header for PHAT subtables that follow main table */
18879f400337SErik Kaneda 
18889f400337SErik Kaneda struct acpi_phat_header {
18899f400337SErik Kaneda 	u16 type;
18909f400337SErik Kaneda 	u16 length;
18919f400337SErik Kaneda 	u8 revision;
18929f400337SErik Kaneda };
18939f400337SErik Kaneda 
18949f400337SErik Kaneda /* Values for Type field above */
18959f400337SErik Kaneda 
18969f400337SErik Kaneda #define ACPI_PHAT_TYPE_FW_VERSION_DATA  0
18979f400337SErik Kaneda #define ACPI_PHAT_TYPE_FW_HEALTH_DATA   1
18989f400337SErik Kaneda #define ACPI_PHAT_TYPE_RESERVED         2	/* 0x02-0xFFFF are reserved */
18999f400337SErik Kaneda 
19009f400337SErik Kaneda /*
19019f400337SErik Kaneda  * PHAT subtables, correspond to Type in struct acpi_phat_header
19029f400337SErik Kaneda  */
19039f400337SErik Kaneda 
19049f400337SErik Kaneda /* 0: Firmware Version Data Record */
19059f400337SErik Kaneda 
19069f400337SErik Kaneda struct acpi_phat_version_data {
19079f400337SErik Kaneda 	struct acpi_phat_header header;
19089f400337SErik Kaneda 	u8 reserved[3];
19099f400337SErik Kaneda 	u32 element_count;
19109f400337SErik Kaneda };
19119f400337SErik Kaneda 
19129f400337SErik Kaneda struct acpi_phat_version_element {
19139f400337SErik Kaneda 	u8 guid[16];
19149f400337SErik Kaneda 	u64 version_value;
19159f400337SErik Kaneda 	u32 producer_id;
19169f400337SErik Kaneda };
19179f400337SErik Kaneda 
19189f400337SErik Kaneda /* 1: Firmware Health Data Record */
19199f400337SErik Kaneda 
19209f400337SErik Kaneda struct acpi_phat_health_data {
19219f400337SErik Kaneda 	struct acpi_phat_header header;
19229f400337SErik Kaneda 	u8 reserved[2];
19239f400337SErik Kaneda 	u8 health;
19249f400337SErik Kaneda 	u8 device_guid[16];
19259f400337SErik Kaneda 	u32 device_specific_offset;	/* Zero if no Device-specific data */
19269f400337SErik Kaneda };
19279f400337SErik Kaneda 
19289f400337SErik Kaneda /* Values for Health field above */
19299f400337SErik Kaneda 
19309f400337SErik Kaneda #define ACPI_PHAT_ERRORS_FOUND          0
19319f400337SErik Kaneda #define ACPI_PHAT_NO_ERRORS             1
19329f400337SErik Kaneda #define ACPI_PHAT_UNKNOWN_ERRORS        2
19339f400337SErik Kaneda #define ACPI_PHAT_ADVISORY              3
19349f400337SErik Kaneda 
19359f400337SErik Kaneda /*******************************************************************************
19369f400337SErik Kaneda  *
1937e62f8227SErik Schmauss  * PMTT - Platform Memory Topology Table (ACPI 5.0)
1938e62f8227SErik Schmauss  *        Version 1
1939e62f8227SErik Schmauss  *
1940e62f8227SErik Schmauss  ******************************************************************************/
1941e62f8227SErik Schmauss 
1942e62f8227SErik Schmauss struct acpi_table_pmtt {
1943e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
1944cca97d42SBob Moore 	u32 memory_device_count;
1945cca97d42SBob Moore 	/*
1946cca97d42SBob Moore 	 * Immediately followed by:
1947cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
1948cca97d42SBob Moore 	 */
1949e62f8227SErik Schmauss };
1950e62f8227SErik Schmauss 
1951e62f8227SErik Schmauss /* Common header for PMTT subtables that follow main table */
1952e62f8227SErik Schmauss 
1953e62f8227SErik Schmauss struct acpi_pmtt_header {
1954e62f8227SErik Schmauss 	u8 type;
1955e62f8227SErik Schmauss 	u8 reserved1;
1956e62f8227SErik Schmauss 	u16 length;
1957e62f8227SErik Schmauss 	u16 flags;
1958e62f8227SErik Schmauss 	u16 reserved2;
1959cca97d42SBob Moore 	u32 memory_device_count;	/* Zero means no memory device structs follow */
1960cca97d42SBob Moore 	/*
1961cca97d42SBob Moore 	 * Immediately followed by:
1962cca97d42SBob Moore 	 * u8 type_specific_data[]
1963cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
1964cca97d42SBob Moore 	 */
1965e62f8227SErik Schmauss };
1966e62f8227SErik Schmauss 
1967e62f8227SErik Schmauss /* Values for Type field above */
1968e62f8227SErik Schmauss 
1969e62f8227SErik Schmauss #define ACPI_PMTT_TYPE_SOCKET           0
1970e62f8227SErik Schmauss #define ACPI_PMTT_TYPE_CONTROLLER       1
1971e62f8227SErik Schmauss #define ACPI_PMTT_TYPE_DIMM             2
1972cca97d42SBob Moore #define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFE are reserved */
1973cca97d42SBob Moore #define ACPI_PMTT_TYPE_VENDOR           0xFF
1974e62f8227SErik Schmauss 
1975e62f8227SErik Schmauss /* Values for Flags field above */
1976e62f8227SErik Schmauss 
1977e62f8227SErik Schmauss #define ACPI_PMTT_TOP_LEVEL             0x0001
1978e62f8227SErik Schmauss #define ACPI_PMTT_PHYSICAL              0x0002
1979e62f8227SErik Schmauss #define ACPI_PMTT_MEMORY_TYPE           0x000C
1980e62f8227SErik Schmauss 
1981e62f8227SErik Schmauss /*
1982e62f8227SErik Schmauss  * PMTT subtables, correspond to Type in struct acpi_pmtt_header
1983e62f8227SErik Schmauss  */
1984e62f8227SErik Schmauss 
1985e62f8227SErik Schmauss /* 0: Socket Structure */
1986e62f8227SErik Schmauss 
1987e62f8227SErik Schmauss struct acpi_pmtt_socket {
1988e62f8227SErik Schmauss 	struct acpi_pmtt_header header;
1989e62f8227SErik Schmauss 	u16 socket_id;
1990e62f8227SErik Schmauss 	u16 reserved;
1991e62f8227SErik Schmauss };
1992cca97d42SBob Moore 	/*
1993cca97d42SBob Moore 	 * Immediately followed by:
1994cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
1995cca97d42SBob Moore 	 */
1996e62f8227SErik Schmauss 
1997e62f8227SErik Schmauss /* 1: Memory Controller subtable */
1998e62f8227SErik Schmauss 
1999e62f8227SErik Schmauss struct acpi_pmtt_controller {
2000e62f8227SErik Schmauss 	struct acpi_pmtt_header header;
2001cca97d42SBob Moore 	u16 controller_id;
2002e62f8227SErik Schmauss 	u16 reserved;
2003e62f8227SErik Schmauss };
2004cca97d42SBob Moore 	/*
2005cca97d42SBob Moore 	 * Immediately followed by:
2006cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2007cca97d42SBob Moore 	 */
2008e62f8227SErik Schmauss 
2009e62f8227SErik Schmauss /* 2: Physical Component Identifier (DIMM) */
2010e62f8227SErik Schmauss 
2011e62f8227SErik Schmauss struct acpi_pmtt_physical_component {
2012e62f8227SErik Schmauss 	struct acpi_pmtt_header header;
2013e62f8227SErik Schmauss 	u32 bios_handle;
2014e62f8227SErik Schmauss };
2015e62f8227SErik Schmauss 
2016cca97d42SBob Moore /* 0xFF: Vendor Specific Data */
2017cca97d42SBob Moore 
2018cca97d42SBob Moore struct acpi_pmtt_vendor_specific {
2019cca97d42SBob Moore 	struct acpi_pmtt_header header;
2020cca97d42SBob Moore 	u8 type_uuid[16];
2021cca97d42SBob Moore 	u8 specific[];
2022cca97d42SBob Moore 	/*
2023cca97d42SBob Moore 	 * Immediately followed by:
2024cca97d42SBob Moore 	 * u8 vendor_specific_data[];
2025cca97d42SBob Moore 	 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2026cca97d42SBob Moore 	 */
2027cca97d42SBob Moore };
2028cca97d42SBob Moore 
2029e62f8227SErik Schmauss /*******************************************************************************
2030e62f8227SErik Schmauss  *
2031e62f8227SErik Schmauss  * PPTT - Processor Properties Topology Table (ACPI 6.2)
2032e62f8227SErik Schmauss  *        Version 1
2033e62f8227SErik Schmauss  *
2034e62f8227SErik Schmauss  ******************************************************************************/
2035e62f8227SErik Schmauss 
2036e62f8227SErik Schmauss struct acpi_table_pptt {
2037e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2038e62f8227SErik Schmauss };
2039e62f8227SErik Schmauss 
2040e62f8227SErik Schmauss /* Values for Type field above */
2041e62f8227SErik Schmauss 
2042e62f8227SErik Schmauss enum acpi_pptt_type {
2043e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_PROCESSOR = 0,
2044e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_CACHE = 1,
2045e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_ID = 2,
2046e62f8227SErik Schmauss 	ACPI_PPTT_TYPE_RESERVED = 3
2047e62f8227SErik Schmauss };
2048e62f8227SErik Schmauss 
2049e62f8227SErik Schmauss /* 0: Processor Hierarchy Node Structure */
2050e62f8227SErik Schmauss 
2051e62f8227SErik Schmauss struct acpi_pptt_processor {
2052e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2053e62f8227SErik Schmauss 	u16 reserved;
2054e62f8227SErik Schmauss 	u32 flags;
2055e62f8227SErik Schmauss 	u32 parent;
2056e62f8227SErik Schmauss 	u32 acpi_processor_id;
2057e62f8227SErik Schmauss 	u32 number_of_priv_resources;
2058e62f8227SErik Schmauss };
2059e62f8227SErik Schmauss 
2060e62f8227SErik Schmauss /* Flags */
2061e62f8227SErik Schmauss 
2062b5eab512SErik Schmauss #define ACPI_PPTT_PHYSICAL_PACKAGE          (1)
2063b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID   (1<<1)
2064b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD  (1<<2)	/* ACPI 6.3 */
2065b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_LEAF_NODE            (1<<3)	/* ACPI 6.3 */
2066b5eab512SErik Schmauss #define ACPI_PPTT_ACPI_IDENTICAL            (1<<4)	/* ACPI 6.3 */
2067e62f8227SErik Schmauss 
2068e62f8227SErik Schmauss /* 1: Cache Type Structure */
2069e62f8227SErik Schmauss 
2070e62f8227SErik Schmauss struct acpi_pptt_cache {
2071e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2072e62f8227SErik Schmauss 	u16 reserved;
2073e62f8227SErik Schmauss 	u32 flags;
2074e62f8227SErik Schmauss 	u32 next_level_of_cache;
2075e62f8227SErik Schmauss 	u32 size;
2076e62f8227SErik Schmauss 	u32 number_of_sets;
2077e62f8227SErik Schmauss 	u8 associativity;
2078e62f8227SErik Schmauss 	u8 attributes;
2079e62f8227SErik Schmauss 	u16 line_size;
2080e62f8227SErik Schmauss };
2081e62f8227SErik Schmauss 
20825e2e86c0SErik Kaneda /* 1: Cache Type Structure for PPTT version 3 */
20835e2e86c0SErik Kaneda 
20845e2e86c0SErik Kaneda struct acpi_pptt_cache_v1 {
20855e2e86c0SErik Kaneda 	u32 cache_id;
20865e2e86c0SErik Kaneda };
20875e2e86c0SErik Kaneda 
2088e62f8227SErik Schmauss /* Flags */
2089e62f8227SErik Schmauss 
2090e62f8227SErik Schmauss #define ACPI_PPTT_SIZE_PROPERTY_VALID       (1)	/* Physical property valid */
2091e62f8227SErik Schmauss #define ACPI_PPTT_NUMBER_OF_SETS_VALID      (1<<1)	/* Number of sets valid */
2092e62f8227SErik Schmauss #define ACPI_PPTT_ASSOCIATIVITY_VALID       (1<<2)	/* Associativity valid */
2093e62f8227SErik Schmauss #define ACPI_PPTT_ALLOCATION_TYPE_VALID     (1<<3)	/* Allocation type valid */
2094e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_VALID          (1<<4)	/* Cache type valid */
2095e62f8227SErik Schmauss #define ACPI_PPTT_WRITE_POLICY_VALID        (1<<5)	/* Write policy valid */
2096e62f8227SErik Schmauss #define ACPI_PPTT_LINE_SIZE_VALID           (1<<6)	/* Line size valid */
20975e2e86c0SErik Kaneda #define ACPI_PPTT_CACHE_ID_VALID            (1<<7)	/* Cache ID valid */
2098e62f8227SErik Schmauss 
2099e62f8227SErik Schmauss /* Masks for Attributes */
2100e62f8227SErik Schmauss 
2101e62f8227SErik Schmauss #define ACPI_PPTT_MASK_ALLOCATION_TYPE      (0x03)	/* Allocation type */
2102e62f8227SErik Schmauss #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)	/* Cache type */
2103e62f8227SErik Schmauss #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)	/* Write policy */
2104e62f8227SErik Schmauss 
2105e62f8227SErik Schmauss /* Attributes describing cache */
2106e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)	/* Cache line is allocated on read */
2107e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)	/* Cache line is allocated on write */
2108e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)	/* Cache line is allocated on read and write */
2109e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)	/* Alternate representation of above */
2110e62f8227SErik Schmauss 
2111e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)	/* Data cache */
2112e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)	/* Instruction cache */
2113e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)	/* Unified I & D cache */
2114e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)	/* Alternate representation of above */
2115e62f8227SErik Schmauss 
2116e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_POLICY_WB           (0x0)	/* Cache is write back */
2117e62f8227SErik Schmauss #define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)	/* Cache is write through */
2118e62f8227SErik Schmauss 
2119e62f8227SErik Schmauss /* 2: ID Structure */
2120e62f8227SErik Schmauss 
2121e62f8227SErik Schmauss struct acpi_pptt_id {
2122e62f8227SErik Schmauss 	struct acpi_subtable_header header;
2123e62f8227SErik Schmauss 	u16 reserved;
2124e62f8227SErik Schmauss 	u32 vendor_id;
2125e62f8227SErik Schmauss 	u64 level1_id;
2126e62f8227SErik Schmauss 	u64 level2_id;
2127e62f8227SErik Schmauss 	u16 major_rev;
2128e62f8227SErik Schmauss 	u16 minor_rev;
2129e62f8227SErik Schmauss 	u16 spin_rev;
2130e62f8227SErik Schmauss };
2131e62f8227SErik Schmauss 
2132e62f8227SErik Schmauss /*******************************************************************************
2133e62f8227SErik Schmauss  *
2134d71df85aSErik Kaneda  * PRMT - Platform Runtime Mechanism Table
2135d71df85aSErik Kaneda  *        Version 1
2136d71df85aSErik Kaneda  *
2137d71df85aSErik Kaneda  ******************************************************************************/
2138d71df85aSErik Kaneda 
2139d71df85aSErik Kaneda struct acpi_table_prmt {
2140d71df85aSErik Kaneda 	struct acpi_table_header header;	/* Common ACPI table header */
2141d71df85aSErik Kaneda };
2142d71df85aSErik Kaneda 
2143d71df85aSErik Kaneda struct acpi_table_prmt_header {
2144d71df85aSErik Kaneda 	u8 platform_guid[16];
2145d71df85aSErik Kaneda 	u32 module_info_offset;
2146d71df85aSErik Kaneda 	u32 module_info_count;
2147d71df85aSErik Kaneda };
2148d71df85aSErik Kaneda 
21499f8c7baeSErik Kaneda struct acpi_prmt_module_header {
21509f8c7baeSErik Kaneda 	u16 revision;
21519f8c7baeSErik Kaneda 	u16 length;
21529f8c7baeSErik Kaneda };
21539f8c7baeSErik Kaneda 
2154d71df85aSErik Kaneda struct acpi_prmt_module_info {
2155d71df85aSErik Kaneda 	u16 revision;
2156d71df85aSErik Kaneda 	u16 length;
2157d71df85aSErik Kaneda 	u8 module_guid[16];
2158d71df85aSErik Kaneda 	u16 major_rev;
2159d71df85aSErik Kaneda 	u16 minor_rev;
2160d71df85aSErik Kaneda 	u16 handler_info_count;
2161d71df85aSErik Kaneda 	u32 handler_info_offset;
2162d71df85aSErik Kaneda 	u64 mmio_list_pointer;
2163d71df85aSErik Kaneda };
2164d71df85aSErik Kaneda 
2165d71df85aSErik Kaneda struct acpi_prmt_handler_info {
2166d71df85aSErik Kaneda 	u16 revision;
2167d71df85aSErik Kaneda 	u16 length;
2168d71df85aSErik Kaneda 	u8 handler_guid[16];
2169d71df85aSErik Kaneda 	u64 handler_address;
2170d71df85aSErik Kaneda 	u64 static_data_buffer_address;
2171d71df85aSErik Kaneda 	u64 acpi_param_buffer_address;
2172d71df85aSErik Kaneda };
2173d71df85aSErik Kaneda 
2174d71df85aSErik Kaneda /*******************************************************************************
2175d71df85aSErik Kaneda  *
2176e62f8227SErik Schmauss  * RASF - RAS Feature Table (ACPI 5.0)
2177e62f8227SErik Schmauss  *        Version 1
2178e62f8227SErik Schmauss  *
2179e62f8227SErik Schmauss  ******************************************************************************/
2180e62f8227SErik Schmauss 
2181e62f8227SErik Schmauss struct acpi_table_rasf {
2182e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2183e62f8227SErik Schmauss 	u8 channel_id[12];
2184e62f8227SErik Schmauss };
2185e62f8227SErik Schmauss 
2186e62f8227SErik Schmauss /* RASF Platform Communication Channel Shared Memory Region */
2187e62f8227SErik Schmauss 
2188e62f8227SErik Schmauss struct acpi_rasf_shared_memory {
2189e62f8227SErik Schmauss 	u32 signature;
2190e62f8227SErik Schmauss 	u16 command;
2191e62f8227SErik Schmauss 	u16 status;
2192e62f8227SErik Schmauss 	u16 version;
2193e62f8227SErik Schmauss 	u8 capabilities[16];
2194e62f8227SErik Schmauss 	u8 set_capabilities[16];
2195e62f8227SErik Schmauss 	u16 num_parameter_blocks;
2196e62f8227SErik Schmauss 	u32 set_capabilities_status;
2197e62f8227SErik Schmauss };
2198e62f8227SErik Schmauss 
2199e62f8227SErik Schmauss /* RASF Parameter Block Structure Header */
2200e62f8227SErik Schmauss 
2201e62f8227SErik Schmauss struct acpi_rasf_parameter_block {
2202e62f8227SErik Schmauss 	u16 type;
2203e62f8227SErik Schmauss 	u16 version;
2204e62f8227SErik Schmauss 	u16 length;
2205e62f8227SErik Schmauss };
2206e62f8227SErik Schmauss 
2207e62f8227SErik Schmauss /* RASF Parameter Block Structure for PATROL_SCRUB */
2208e62f8227SErik Schmauss 
2209e62f8227SErik Schmauss struct acpi_rasf_patrol_scrub_parameter {
2210e62f8227SErik Schmauss 	struct acpi_rasf_parameter_block header;
2211e62f8227SErik Schmauss 	u16 patrol_scrub_command;
2212e62f8227SErik Schmauss 	u64 requested_address_range[2];
2213e62f8227SErik Schmauss 	u64 actual_address_range[2];
2214e62f8227SErik Schmauss 	u16 flags;
2215e62f8227SErik Schmauss 	u8 requested_speed;
2216e62f8227SErik Schmauss };
2217e62f8227SErik Schmauss 
2218e62f8227SErik Schmauss /* Masks for Flags and Speed fields above */
2219e62f8227SErik Schmauss 
2220e62f8227SErik Schmauss #define ACPI_RASF_SCRUBBER_RUNNING      1
2221e62f8227SErik Schmauss #define ACPI_RASF_SPEED                 (7<<1)
2222e62f8227SErik Schmauss #define ACPI_RASF_SPEED_SLOW            (0<<1)
2223e62f8227SErik Schmauss #define ACPI_RASF_SPEED_MEDIUM          (4<<1)
2224e62f8227SErik Schmauss #define ACPI_RASF_SPEED_FAST            (7<<1)
2225e62f8227SErik Schmauss 
2226e62f8227SErik Schmauss /* Channel Commands */
2227e62f8227SErik Schmauss 
2228e62f8227SErik Schmauss enum acpi_rasf_commands {
2229e62f8227SErik Schmauss 	ACPI_RASF_EXECUTE_RASF_COMMAND = 1
2230e62f8227SErik Schmauss };
2231e62f8227SErik Schmauss 
2232e62f8227SErik Schmauss /* Platform RAS Capabilities */
2233e62f8227SErik Schmauss 
2234e62f8227SErik Schmauss enum acpi_rasf_capabiliities {
2235e62f8227SErik Schmauss 	ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
2236e62f8227SErik Schmauss 	ACPI_SW_PATROL_SCRUB_EXPOSED = 1
2237e62f8227SErik Schmauss };
2238e62f8227SErik Schmauss 
2239e62f8227SErik Schmauss /* Patrol Scrub Commands */
2240e62f8227SErik Schmauss 
2241e62f8227SErik Schmauss enum acpi_rasf_patrol_scrub_commands {
2242e62f8227SErik Schmauss 	ACPI_RASF_GET_PATROL_PARAMETERS = 1,
2243e62f8227SErik Schmauss 	ACPI_RASF_START_PATROL_SCRUBBER = 2,
2244e62f8227SErik Schmauss 	ACPI_RASF_STOP_PATROL_SCRUBBER = 3
2245e62f8227SErik Schmauss };
2246e62f8227SErik Schmauss 
2247e62f8227SErik Schmauss /* Channel Command flags */
2248e62f8227SErik Schmauss 
2249e62f8227SErik Schmauss #define ACPI_RASF_GENERATE_SCI          (1<<15)
2250e62f8227SErik Schmauss 
2251e62f8227SErik Schmauss /* Status values */
2252e62f8227SErik Schmauss 
2253e62f8227SErik Schmauss enum acpi_rasf_status {
2254e62f8227SErik Schmauss 	ACPI_RASF_SUCCESS = 0,
2255e62f8227SErik Schmauss 	ACPI_RASF_NOT_VALID = 1,
2256e62f8227SErik Schmauss 	ACPI_RASF_NOT_SUPPORTED = 2,
2257e62f8227SErik Schmauss 	ACPI_RASF_BUSY = 3,
2258e62f8227SErik Schmauss 	ACPI_RASF_FAILED = 4,
2259e62f8227SErik Schmauss 	ACPI_RASF_ABORTED = 5,
2260e62f8227SErik Schmauss 	ACPI_RASF_INVALID_DATA = 6
2261e62f8227SErik Schmauss };
2262e62f8227SErik Schmauss 
2263e62f8227SErik Schmauss /* Status flags */
2264e62f8227SErik Schmauss 
2265e62f8227SErik Schmauss #define ACPI_RASF_COMMAND_COMPLETE      (1)
2266e62f8227SErik Schmauss #define ACPI_RASF_SCI_DOORBELL          (1<<1)
2267e62f8227SErik Schmauss #define ACPI_RASF_ERROR                 (1<<2)
2268e62f8227SErik Schmauss #define ACPI_RASF_STATUS                (0x1F<<3)
2269e62f8227SErik Schmauss 
2270e62f8227SErik Schmauss /*******************************************************************************
2271e62f8227SErik Schmauss  *
2272536e35c9SBob Moore  * RGRT - Regulatory Graphics Resource Table
2273536e35c9SBob Moore  *        Version 1
2274536e35c9SBob Moore  *
2275536e35c9SBob Moore  * Conforms to "ACPI RGRT" available at:
2276536e35c9SBob Moore  * https://microsoft.github.io/mu/dyn/mu_plus/ms_core_pkg/acpi_RGRT/feature_acpi_rgrt/
2277536e35c9SBob Moore  *
2278536e35c9SBob Moore  ******************************************************************************/
2279536e35c9SBob Moore 
2280536e35c9SBob Moore struct acpi_table_rgrt {
2281536e35c9SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
2282536e35c9SBob Moore 	u16 version;
2283536e35c9SBob Moore 	u8 image_type;
2284536e35c9SBob Moore 	u8 reserved;
2285536e35c9SBob Moore 	u8 image[0];
2286536e35c9SBob Moore };
2287536e35c9SBob Moore 
2288536e35c9SBob Moore /* image_type values */
2289536e35c9SBob Moore 
2290536e35c9SBob Moore enum acpi_rgrt_image_type {
2291536e35c9SBob Moore 	ACPI_RGRT_TYPE_RESERVED0 = 0,
2292536e35c9SBob Moore 	ACPI_RGRT_IMAGE_TYPE_PNG = 1,
2293536e35c9SBob Moore 	ACPI_RGRT_TYPE_RESERVED = 2	/* 2 and greater are reserved */
2294536e35c9SBob Moore };
2295536e35c9SBob Moore 
2296536e35c9SBob Moore /*******************************************************************************
2297536e35c9SBob Moore  *
2298e62f8227SErik Schmauss  * SBST - Smart Battery Specification Table
2299e62f8227SErik Schmauss  *        Version 1
2300e62f8227SErik Schmauss  *
2301e62f8227SErik Schmauss  ******************************************************************************/
2302e62f8227SErik Schmauss 
2303e62f8227SErik Schmauss struct acpi_table_sbst {
2304e62f8227SErik Schmauss 	struct acpi_table_header header;	/* Common ACPI table header */
2305e62f8227SErik Schmauss 	u32 warning_level;
2306e62f8227SErik Schmauss 	u32 low_level;
2307e62f8227SErik Schmauss 	u32 critical_level;
2308e62f8227SErik Schmauss };
2309e62f8227SErik Schmauss 
2310e62f8227SErik Schmauss /*******************************************************************************
2311e62f8227SErik Schmauss  *
23123bd38469SJames Morse  * SDEI - Software Delegated Exception Interface Descriptor Table
23133bd38469SJames Morse  *
23143bd38469SJames Morse  * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
23153bd38469SJames Morse  * May 8th, 2017. Copyright 2017 ARM Ltd.
23163bd38469SJames Morse  *
23173bd38469SJames Morse  ******************************************************************************/
23183bd38469SJames Morse 
23193bd38469SJames Morse struct acpi_table_sdei {
23203bd38469SJames Morse 	struct acpi_table_header header;	/* Common ACPI table header */
23213bd38469SJames Morse };
23223bd38469SJames Morse 
23233bd38469SJames Morse /*******************************************************************************
23243bd38469SJames Morse  *
2325e62f8227SErik Schmauss  * SDEV - Secure Devices Table (ACPI 6.2)
2326e62f8227SErik Schmauss  *        Version 1
23275cf4d733SBob Moore  *
23285cf4d733SBob Moore  ******************************************************************************/
23295cf4d733SBob Moore 
2330e62f8227SErik Schmauss struct acpi_table_sdev {
23315cf4d733SBob Moore 	struct acpi_table_header header;	/* Common ACPI table header */
23325cf4d733SBob Moore };
23335cf4d733SBob Moore 
2334e62f8227SErik Schmauss struct acpi_sdev_header {
2335e62f8227SErik Schmauss 	u8 type;
2336e62f8227SErik Schmauss 	u8 flags;
2337e62f8227SErik Schmauss 	u16 length;
2338b24aad44SBob Moore };
2339b24aad44SBob Moore 
2340e62f8227SErik Schmauss /* Values for subtable type above */
23416e2d5ebdSBob Moore 
2342e62f8227SErik Schmauss enum acpi_sdev_type {
2343e62f8227SErik Schmauss 	ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
2344e62f8227SErik Schmauss 	ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
2345e62f8227SErik Schmauss 	ACPI_SDEV_TYPE_RESERVED = 2	/* 2 and greater are reserved */
23466e2d5ebdSBob Moore };
23476e2d5ebdSBob Moore 
2348e62f8227SErik Schmauss /* Values for flags above */
23496e2d5ebdSBob Moore 
2350e62f8227SErik Schmauss #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
235114012d2fSErik Kaneda #define ACPI_SDEV_SECURE_COMPONENTS_PRESENT (1<<1)
235215a61aa1SBob Moore 
235315a61aa1SBob Moore /*
2354e62f8227SErik Schmauss  * SDEV subtables
235515a61aa1SBob Moore  */
235615a61aa1SBob Moore 
2357e62f8227SErik Schmauss /* 0: Namespace Device Based Secure Device Structure */
2358e62f8227SErik Schmauss 
2359e62f8227SErik Schmauss struct acpi_sdev_namespace {
2360e62f8227SErik Schmauss 	struct acpi_sdev_header header;
2361e62f8227SErik Schmauss 	u16 device_id_offset;
2362e62f8227SErik Schmauss 	u16 device_id_length;
2363e62f8227SErik Schmauss 	u16 vendor_data_offset;
2364e62f8227SErik Schmauss 	u16 vendor_data_length;
2365b24aad44SBob Moore };
2366b24aad44SBob Moore 
236714012d2fSErik Kaneda struct acpi_sdev_secure_component {
236814012d2fSErik Kaneda 	u16 secure_component_offset;
236914012d2fSErik Kaneda 	u16 secure_component_length;
237014012d2fSErik Kaneda };
237114012d2fSErik Kaneda 
237214012d2fSErik Kaneda /*
237314012d2fSErik Kaneda  * SDEV sub-subtables ("Components") for above
237414012d2fSErik Kaneda  */
237514012d2fSErik Kaneda struct acpi_sdev_component {
237614012d2fSErik Kaneda 	struct acpi_sdev_header header;
237714012d2fSErik Kaneda };
237814012d2fSErik Kaneda 
237914012d2fSErik Kaneda /* Values for sub-subtable type above */
238014012d2fSErik Kaneda 
238114012d2fSErik Kaneda enum acpi_sac_type {
238214012d2fSErik Kaneda 	ACPI_SDEV_TYPE_ID_COMPONENT = 0,
238314012d2fSErik Kaneda 	ACPI_SDEV_TYPE_MEM_COMPONENT = 1
238414012d2fSErik Kaneda };
238514012d2fSErik Kaneda 
238614012d2fSErik Kaneda struct acpi_sdev_id_component {
238714012d2fSErik Kaneda 	struct acpi_sdev_header header;
238814012d2fSErik Kaneda 	u16 hardware_id_offset;
238914012d2fSErik Kaneda 	u16 hardware_id_length;
239014012d2fSErik Kaneda 	u16 subsystem_id_offset;
239114012d2fSErik Kaneda 	u16 subsystem_id_length;
239214012d2fSErik Kaneda 	u16 hardware_revision;
239314012d2fSErik Kaneda 	u8 hardware_rev_present;
239414012d2fSErik Kaneda 	u8 class_code_present;
239514012d2fSErik Kaneda 	u8 pci_base_class;
239614012d2fSErik Kaneda 	u8 pci_sub_class;
239714012d2fSErik Kaneda 	u8 pci_programming_xface;
239814012d2fSErik Kaneda };
239914012d2fSErik Kaneda 
240014012d2fSErik Kaneda struct acpi_sdev_mem_component {
240114012d2fSErik Kaneda 	struct acpi_sdev_header header;
240214012d2fSErik Kaneda 	u32 reserved;
240314012d2fSErik Kaneda 	u64 memory_base_address;
240414012d2fSErik Kaneda 	u64 memory_length;
240514012d2fSErik Kaneda };
240614012d2fSErik Kaneda 
2407e62f8227SErik Schmauss /* 1: PCIe Endpoint Device Based Device Structure */
2408e62f8227SErik Schmauss 
2409e62f8227SErik Schmauss struct acpi_sdev_pcie {
2410e62f8227SErik Schmauss 	struct acpi_sdev_header header;
2411e62f8227SErik Schmauss 	u16 segment;
2412e62f8227SErik Schmauss 	u16 start_bus;
2413e62f8227SErik Schmauss 	u16 path_offset;
2414e62f8227SErik Schmauss 	u16 path_length;
2415e62f8227SErik Schmauss 	u16 vendor_data_offset;
2416e62f8227SErik Schmauss 	u16 vendor_data_length;
2417e62f8227SErik Schmauss };
2418e62f8227SErik Schmauss 
2419e62f8227SErik Schmauss /* 1a: PCIe Endpoint path entry */
2420e62f8227SErik Schmauss 
2421e62f8227SErik Schmauss struct acpi_sdev_pcie_path {
24229005694eSBob Moore 	u8 device;
24239005694eSBob Moore 	u8 function;
24249005694eSBob Moore };
24259005694eSBob Moore 
24268288f69eSKuppuswamy Sathyanarayanan /*******************************************************************************
24278288f69eSKuppuswamy Sathyanarayanan  *
24288288f69eSKuppuswamy Sathyanarayanan  * SVKL - Storage Volume Key Location Table (ACPI 6.4)
24296496f03eSBob Moore  *        From: "Guest-Host-Communication Interface (GHCI) for Intel
24306496f03eSBob Moore  *        Trust Domain Extensions (Intel TDX)".
24318288f69eSKuppuswamy Sathyanarayanan  *        Version 1
24328288f69eSKuppuswamy Sathyanarayanan  *
24338288f69eSKuppuswamy Sathyanarayanan  ******************************************************************************/
24348288f69eSKuppuswamy Sathyanarayanan 
24358288f69eSKuppuswamy Sathyanarayanan struct acpi_table_svkl {
24368288f69eSKuppuswamy Sathyanarayanan 	struct acpi_table_header header;	/* Common ACPI table header */
24378288f69eSKuppuswamy Sathyanarayanan 	u32 count;
24388288f69eSKuppuswamy Sathyanarayanan };
24398288f69eSKuppuswamy Sathyanarayanan 
24406496f03eSBob Moore struct acpi_svkl_key {
24418288f69eSKuppuswamy Sathyanarayanan 	u16 type;
24428288f69eSKuppuswamy Sathyanarayanan 	u16 format;
24438288f69eSKuppuswamy Sathyanarayanan 	u32 size;
24448288f69eSKuppuswamy Sathyanarayanan 	u64 address;
24458288f69eSKuppuswamy Sathyanarayanan };
24468288f69eSKuppuswamy Sathyanarayanan 
24478288f69eSKuppuswamy Sathyanarayanan enum acpi_svkl_type {
24488288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_TYPE_MAIN_STORAGE = 0,
24498288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_TYPE_RESERVED = 1	/* 1 and greater are reserved */
24508288f69eSKuppuswamy Sathyanarayanan };
24518288f69eSKuppuswamy Sathyanarayanan 
24528288f69eSKuppuswamy Sathyanarayanan enum acpi_svkl_format {
24538288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_FORMAT_RAW_BINARY = 0,
24548288f69eSKuppuswamy Sathyanarayanan 	ACPI_SVKL_FORMAT_RESERVED = 1	/* 1 and greater are reserved */
24558288f69eSKuppuswamy Sathyanarayanan };
24568288f69eSKuppuswamy Sathyanarayanan 
24576e596084SRobert Moore /* Reset to default packing */
24586e596084SRobert Moore 
24596e596084SRobert Moore #pragma pack()
2460b24aad44SBob Moore 
2461b24aad44SBob Moore #endif				/* __ACTBL2_H__ */
2462