Merge tag 'kvm-s390-next-6.4-2' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / include / acpi / actbl2.h
CommitLineData
95857638 1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
a8357b0c
BM
2/******************************************************************************
3 *
5cf4d733 4 * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
a8357b0c 5 *
612c2932 6 * Copyright (C) 2000 - 2023, Intel Corp.
a8357b0c 7 *
95857638 8 *****************************************************************************/
a8357b0c 9
b24aad44
BM
10#ifndef __ACTBL2_H__
11#define __ACTBL2_H__
12
13/*******************************************************************************
14 *
15 * Additional ACPI Tables (2)
16 *
17 * These tables are not consumed directly by the ACPICA subsystem, but are
18 * included here to support device drivers and the AML disassembler.
19 *
b24aad44
BM
20 ******************************************************************************/
21
22/*
6e2d5ebd
BM
23 * Values for description table header signatures for tables defined in this
24 * file. Useful because they make it more difficult to inadvertently type in
25 * the wrong signature.
b24aad44 26 */
5579649e 27#define ACPI_SIG_AGDI "AGDI" /* Arm Generic Diagnostic Dump and Reset Device Interface */
1c5d62f5 28#define ACPI_SIG_APMT "APMT" /* Arm Performance Monitoring Unit table */
9401eafa 29#define ACPI_SIG_BDAT "BDAT" /* BIOS Data ACPI Table */
407144eb 30#define ACPI_SIG_CCEL "CCEL" /* CC Event Log Table */
51aad1a6 31#define ACPI_SIG_CDAT "CDAT" /* Coherent Device Attribute Table */
874f6a72 32#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */
6e2d5ebd 33#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
d36d4e30 34#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */
e62f8227 35#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
b24aad44 36#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
0e264f0b 37#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
47920aae 38#define ACPI_SIG_MPAM "MPAM" /* Memory System Resource Partitioning and Monitoring Table */
e62f8227 39#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */
5132f2fa 40#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
e62f8227 41#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */
a805aab8 42#define ACPI_SIG_NHLT "NHLT" /* Non HD Audio Link Table */
e62f8227
ES
43#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */
44#define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */
9f400337 45#define ACPI_SIG_PHAT "PHAT" /* Platform Health Assessment Table */
e62f8227
ES
46#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */
47#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */
d71df85a 48#define ACPI_SIG_PRMT "PRMT" /* Platform Runtime Mechanism Table */
e62f8227 49#define ACPI_SIG_RASF "RASF" /* RAS Feature table */
536e35c9 50#define ACPI_SIG_RGRT "RGRT" /* Regulatory Graphics Resource Table */
003567a3 51#define ACPI_SIG_RHCT "RHCT" /* RISC-V Hart Capabilities Table */
e62f8227 52#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
3bd38469 53#define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */
e62f8227 54#define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */
8288f69e 55#define ACPI_SIG_SVKL "SVKL" /* Storage Volume Key Location Table */
2de6bb92 56#define ACPI_SIG_TDEL "TDEL" /* TD Event Log Table */
4461cf54 57
b24aad44
BM
58/*
59 * All tables must be byte-packed to match the ACPI specification, since
60 * the tables are provided by the system BIOS.
61 */
62#pragma pack(1)
63
64/*
be030a57
BM
65 * Note: C bitfields are not used for this reason:
66 *
67 * "Bitfields are great and easy to read, but unfortunately the C language
68 * does not specify the layout of bitfields in memory, which means they are
69 * essentially useless for dealing with packed data in on-disk formats or
70 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
71 * this decision was a design error in C. Ritchie could have picked an order
72 * and stuck with it." Norman Ramsey.
73 * See http://stackoverflow.com/a/1053662/41661
b24aad44
BM
74 */
75
e692fa13
BM
76/*******************************************************************************
77 *
78 * AEST - Arm Error Source Table
79 *
80 * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
81 * September 2020.
82 *
83 ******************************************************************************/
84
85struct acpi_table_aest {
86 struct acpi_table_header header;
e692fa13
BM
87};
88
89/* Common Subtable header - one per Node Structure (Subtable) */
90
91struct acpi_aest_hdr {
92 u8 type;
93 u16 length;
94 u8 reserved;
95 u32 node_specific_offset;
96 u32 node_interface_offset;
97 u32 node_interrupt_offset;
98 u32 node_interrupt_count;
99 u64 timestamp_rate;
100 u64 reserved1;
101 u64 error_injection_rate;
102};
103
104/* Values for Type above */
105
106#define ACPI_AEST_PROCESSOR_ERROR_NODE 0
107#define ACPI_AEST_MEMORY_ERROR_NODE 1
108#define ACPI_AEST_SMMU_ERROR_NODE 2
109#define ACPI_AEST_VENDOR_ERROR_NODE 3
110#define ACPI_AEST_GIC_ERROR_NODE 4
111#define ACPI_AEST_NODE_TYPE_RESERVED 5 /* 5 and above are reserved */
112
113/*
114 * AEST subtables (Error nodes)
115 */
116
117/* 0: Processor Error */
118
119typedef struct acpi_aest_processor {
120 u32 processor_id;
121 u8 resource_type;
122 u8 reserved;
123 u8 flags;
124 u8 revision;
125 u64 processor_affinity;
126
127} acpi_aest_processor;
128
129/* Values for resource_type above, related structs below */
130
131#define ACPI_AEST_CACHE_RESOURCE 0
132#define ACPI_AEST_TLB_RESOURCE 1
133#define ACPI_AEST_GENERIC_RESOURCE 2
134#define ACPI_AEST_RESOURCE_RESERVED 3 /* 3 and above are reserved */
135
136/* 0R: Processor Cache Resource Substructure */
137
138typedef struct acpi_aest_processor_cache {
139 u32 cache_reference;
140 u32 reserved;
141
142} acpi_aest_processor_cache;
143
144/* Values for cache_type above */
145
146#define ACPI_AEST_CACHE_DATA 0
147#define ACPI_AEST_CACHE_INSTRUCTION 1
148#define ACPI_AEST_CACHE_UNIFIED 2
149#define ACPI_AEST_CACHE_RESERVED 3 /* 3 and above are reserved */
150
151/* 1R: Processor TLB Resource Substructure */
152
153typedef struct acpi_aest_processor_tlb {
154 u32 tlb_level;
155 u32 reserved;
156
157} acpi_aest_processor_tlb;
158
159/* 2R: Processor Generic Resource Substructure */
160
161typedef struct acpi_aest_processor_generic {
00395b74 162 u32 resource;
e692fa13
BM
163
164} acpi_aest_processor_generic;
165
166/* 1: Memory Error */
167
168typedef struct acpi_aest_memory {
169 u32 srat_proximity_domain;
170
171} acpi_aest_memory;
172
173/* 2: Smmu Error */
174
175typedef struct acpi_aest_smmu {
176 u32 iort_node_reference;
177 u32 subcomponent_reference;
178
179} acpi_aest_smmu;
180
181/* 3: Vendor Defined */
182
183typedef struct acpi_aest_vendor {
184 u32 acpi_hid;
185 u32 acpi_uid;
186 u8 vendor_specific_data[16];
187
188} acpi_aest_vendor;
189
190/* 4: Gic Error */
191
192typedef struct acpi_aest_gic {
193 u32 interface_type;
194 u32 instance_id;
195
196} acpi_aest_gic;
197
198/* Values for interface_type above */
199
200#define ACPI_AEST_GIC_CPU 0
201#define ACPI_AEST_GIC_DISTRIBUTOR 1
202#define ACPI_AEST_GIC_REDISTRIBUTOR 2
203#define ACPI_AEST_GIC_ITS 3
204#define ACPI_AEST_GIC_RESERVED 4 /* 4 and above are reserved */
205
206/* Node Interface Structure */
207
208typedef struct acpi_aest_node_interface {
209 u8 type;
210 u8 reserved[3];
211 u32 flags;
212 u64 address;
213 u32 error_record_index;
214 u32 error_record_count;
215 u64 error_record_implemented;
216 u64 error_status_reporting;
217 u64 addressing_mode;
218
219} acpi_aest_node_interface;
220
221/* Values for Type field above */
222
223#define ACPI_AEST_NODE_SYSTEM_REGISTER 0
224#define ACPI_AEST_NODE_MEMORY_MAPPED 1
225#define ACPI_AEST_XFACE_RESERVED 2 /* 2 and above are reserved */
226
227/* Node Interrupt Structure */
228
229typedef struct acpi_aest_node_interrupt {
230 u8 type;
231 u8 reserved[2];
232 u8 flags;
233 u32 gsiv;
234 u8 iort_id;
235 u8 reserved1[3];
236
237} acpi_aest_node_interrupt;
238
239/* Values for Type field above */
240
241#define ACPI_AEST_NODE_FAULT_HANDLING 0
242#define ACPI_AEST_NODE_ERROR_RECOVERY 1
243#define ACPI_AEST_XRUPT_RESERVED 2 /* 2 and above are reserved */
244
5579649e
IK
245/*******************************************************************************
246 * AGDI - Arm Generic Diagnostic Dump and Reset Device Interface
247 *
248 * Conforms to "ACPI for Arm Components 1.1, Platform Design Document"
249 * ARM DEN0093 v1.1
250 *
251 ******************************************************************************/
252struct acpi_table_agdi {
253 struct acpi_table_header header; /* Common ACPI table header */
254 u8 flags;
255 u8 reserved[3];
256 u32 sdei_event;
257 u32 gsiv;
258};
259
260/* Mask for Flags field above */
261
262#define ACPI_AGDI_SIGNALING_MODE (1)
263
1c5d62f5
BW
264/*******************************************************************************
265 *
266 * APMT - ARM Performance Monitoring Unit Table
267 *
268 * Conforms to:
269 * ARM Performance Monitoring Unit Architecture 1.0 Platform Design Document
270 * ARM DEN0117 v1.0 November 25, 2021
271 *
272 ******************************************************************************/
273
274struct acpi_table_apmt {
275 struct acpi_table_header header; /* Common ACPI table header */
276};
277
278#define ACPI_APMT_NODE_ID_LENGTH 4
279
280/*
281 * APMT subtables
282 */
283struct acpi_apmt_node {
284 u16 length;
285 u8 flags;
286 u8 type;
287 u32 id;
288 u64 inst_primary;
289 u32 inst_secondary;
290 u64 base_address0;
291 u64 base_address1;
292 u32 ovflw_irq;
293 u32 reserved;
294 u32 ovflw_irq_flags;
295 u32 proc_affinity;
296 u32 impl_id;
297};
298
299/* Masks for Flags field above */
300
301#define ACPI_APMT_FLAGS_DUAL_PAGE (1<<0)
302#define ACPI_APMT_FLAGS_AFFINITY (1<<1)
303#define ACPI_APMT_FLAGS_ATOMIC (1<<2)
304
305/* Values for Flags dual page field above */
306
307#define ACPI_APMT_FLAGS_DUAL_PAGE_NSUPP (0<<0)
308#define ACPI_APMT_FLAGS_DUAL_PAGE_SUPP (1<<0)
309
310/* Values for Flags processor affinity field above */
311#define ACPI_APMT_FLAGS_AFFINITY_PROC (0<<1)
312#define ACPI_APMT_FLAGS_AFFINITY_PROC_CONTAINER (1<<1)
313
314/* Values for Flags 64-bit atomic field above */
315#define ACPI_APMT_FLAGS_ATOMIC_NSUPP (0<<2)
316#define ACPI_APMT_FLAGS_ATOMIC_SUPP (1<<2)
317
318/* Values for Type field above */
319
320enum acpi_apmt_node_type {
321 ACPI_APMT_NODE_TYPE_MC = 0x00,
322 ACPI_APMT_NODE_TYPE_SMMU = 0x01,
323 ACPI_APMT_NODE_TYPE_PCIE_ROOT = 0x02,
324 ACPI_APMT_NODE_TYPE_ACPI = 0x03,
325 ACPI_APMT_NODE_TYPE_CACHE = 0x04,
326 ACPI_APMT_NODE_TYPE_COUNT
327};
328
329/* Masks for ovflw_irq_flags field above */
330
331#define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE (1<<0)
332#define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE (1<<1)
333
334/* Values for ovflw_irq_flags mode field above */
335
336#define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_LEVEL (0<<0)
337#define ACPI_APMT_OVFLW_IRQ_FLAGS_MODE_EDGE (1<<0)
338
339/* Values for ovflw_irq_flags type field above */
340
341#define ACPI_APMT_OVFLW_IRQ_FLAGS_TYPE_WIRED (0<<1)
342
9401eafa
BM
343/*******************************************************************************
344 *
345 * BDAT - BIOS Data ACPI Table
346 *
347 * Conforms to "BIOS Data ACPI Table", Interface Specification v4.0 Draft 5
348 * Nov 2020
349 *
350 ******************************************************************************/
351
352struct acpi_table_bdat {
353 struct acpi_table_header header;
354 struct acpi_generic_address gas;
355};
356
407144eb
KS
357/*******************************************************************************
358 *
359 * CCEL - CC-Event Log
360 * From: "Guest-Host-Communication Interface (GHCI) for Intel
361 * Trust Domain Extensions (Intel TDX)". Feb 2022
362 *
363 ******************************************************************************/
364
365struct acpi_table_ccel {
366 struct acpi_table_header header; /* Common ACPI table header */
367 u8 CCtype;
368 u8 Ccsub_type;
369 u16 reserved;
370 u64 log_area_minimum_length;
371 u64 log_area_start_address;
372};
373
874f6a72
LZ
374/*******************************************************************************
375 *
376 * IORT - IO Remapping Table
377 *
378 * Conforms to "IO Remapping Table System Software on ARM Platforms",
3f062a51 379 * Document number: ARM DEN 0049E.e, Sep 2022
874f6a72
LZ
380 *
381 ******************************************************************************/
382
383struct acpi_table_iort {
384 struct acpi_table_header header;
385 u32 node_count;
386 u32 node_offset;
387 u32 reserved;
388};
389
390/*
391 * IORT subtables
392 */
393struct acpi_iort_node {
394 u8 type;
395 u16 length;
396 u8 revision;
8e1fdd7f 397 u32 identifier;
874f6a72
LZ
398 u32 mapping_count;
399 u32 mapping_offset;
74522fea 400 char node_data[];
874f6a72
LZ
401};
402
403/* Values for subtable Type above */
404
405enum acpi_iort_node_type {
406 ACPI_IORT_NODE_ITS_GROUP = 0x00,
407 ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
408 ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
4ac78baf 409 ACPI_IORT_NODE_SMMU = 0x03,
a53eaef6 410 ACPI_IORT_NODE_SMMU_V3 = 0x04,
8e1fdd7f
SK
411 ACPI_IORT_NODE_PMCG = 0x05,
412 ACPI_IORT_NODE_RMR = 0x06,
874f6a72
LZ
413};
414
415struct acpi_iort_id_mapping {
416 u32 input_base; /* Lowest value in input range */
417 u32 id_count; /* Number of IDs */
418 u32 output_base; /* Lowest value in output range */
419 u32 output_reference; /* A reference to the output node */
420 u32 flags;
421};
422
423/* Masks for Flags field above for IORT subtable */
424
425#define ACPI_IORT_ID_SINGLE_MAPPING (1)
426
427struct acpi_iort_memory_access {
428 u32 cache_coherency;
429 u8 hints;
430 u16 reserved;
431 u8 memory_flags;
432};
433
434/* Values for cache_coherency field above */
435
436#define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */
437#define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */
438
439/* Masks for Hints field above */
440
441#define ACPI_IORT_HT_TRANSIENT (1)
442#define ACPI_IORT_HT_WRITE (1<<1)
443#define ACPI_IORT_HT_READ (1<<2)
444#define ACPI_IORT_HT_OVERRIDE (1<<3)
445
446/* Masks for memory_flags field above */
447
448#define ACPI_IORT_MF_COHERENCY (1)
449#define ACPI_IORT_MF_ATTRIBUTES (1<<1)
450
451/*
452 * IORT node specific subtables
453 */
454struct acpi_iort_its_group {
455 u32 its_count;
74522fea 456 u32 identifiers[]; /* GIC ITS identifier array */
874f6a72
LZ
457};
458
459struct acpi_iort_named_component {
460 u32 node_flags;
461 u64 memory_properties; /* Memory access properties */
462 u8 memory_address_limit; /* Memory address size limit */
74522fea 463 char device_name[]; /* Path of namespace object */
874f6a72
LZ
464};
465
d87be043
RM
466/* Masks for Flags field above */
467
468#define ACPI_IORT_NC_STALL_SUPPORTED (1)
469#define ACPI_IORT_NC_PASID_BITS (31<<1)
470
874f6a72
LZ
471struct acpi_iort_root_complex {
472 u64 memory_properties; /* Memory access properties */
473 u32 ats_attribute;
474 u32 pci_segment_number;
d87be043 475 u8 memory_address_limit; /* Memory address size limit */
4fd14753 476 u16 pasid_capabilities; /* PASID Capabilities */
74522fea 477 u8 reserved[]; /* Reserved, must be zero */
874f6a72
LZ
478};
479
8e1fdd7f 480/* Masks for ats_attribute field above */
874f6a72 481
8e1fdd7f
SK
482#define ACPI_IORT_ATS_SUPPORTED (1) /* The root complex ATS support */
483#define ACPI_IORT_PRI_SUPPORTED (1<<1) /* The root complex PRI support */
484#define ACPI_IORT_PASID_FWD_SUPPORTED (1<<2) /* The root complex PASID forward support */
874f6a72 485
4fd14753
SK
486/* Masks for pasid_capabilities field above */
487#define ACPI_IORT_PASID_MAX_WIDTH (0x1F) /* Bits 0-4 */
488
874f6a72
LZ
489struct acpi_iort_smmu {
490 u64 base_address; /* SMMU base address */
491 u64 span; /* Length of memory range */
492 u32 model;
493 u32 flags;
494 u32 global_interrupt_offset;
495 u32 context_interrupt_count;
496 u32 context_interrupt_offset;
497 u32 pmu_interrupt_count;
498 u32 pmu_interrupt_offset;
74522fea 499 u64 interrupts[]; /* Interrupt array */
874f6a72
LZ
500};
501
502/* Values for Model field above */
503
504#define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */
505#define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */
506#define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */
507#define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */
0c2021c0
RM
508#define ACPI_IORT_SMMU_CORELINK_MMU401 0x00000004 /* ARM Corelink MMU-401 */
509#define ACPI_IORT_SMMU_CAVIUM_THUNDERX 0x00000005 /* Cavium thunder_x SMMUv2 */
874f6a72
LZ
510
511/* Masks for Flags field above */
512
513#define ACPI_IORT_SMMU_DVM_SUPPORTED (1)
514#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)
515
bb1e23e6
LZ
516/* Global interrupt format */
517
518struct acpi_iort_smmu_gsi {
519 u32 nsg_irpt;
520 u32 nsg_irpt_flags;
521 u32 nsg_cfg_irpt;
522 u32 nsg_cfg_irpt_flags;
523};
524
4ac78baf
AS
525struct acpi_iort_smmu_v3 {
526 u64 base_address; /* SMMUv3 base address */
527 u32 flags;
528 u32 reserved;
529 u64 vatos_address;
0c2021c0 530 u32 model;
4ac78baf
AS
531 u32 event_gsiv;
532 u32 pri_gsiv;
533 u32 gerr_gsiv;
534 u32 sync_gsiv;
d87be043 535 u32 pxm;
4c106aa4 536 u32 id_mapping_index;
4ac78baf
AS
537};
538
0c2021c0
RM
539/* Values for Model field above */
540
541#define ACPI_IORT_SMMU_V3_GENERIC 0x00000000 /* Generic SMMUv3 */
542#define ACPI_IORT_SMMU_V3_HISILICON_HI161X 0x00000001 /* hi_silicon Hi161x SMMUv3 */
543#define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX 0x00000002 /* Cavium CN99xx SMMUv3 */
544
4ac78baf
AS
545/* Masks for Flags field above */
546
547#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
d87be043 548#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (3<<1)
c9442300 549#define ACPI_IORT_SMMU_V3_PXM_VALID (1<<3)
3f062a51 550#define ACPI_IORT_SMMU_V3_DEVICEID_VALID (1<<4)
4ac78baf 551
a53eaef6
RM
552struct acpi_iort_pmcg {
553 u64 page0_base_address;
554 u32 overflow_gsiv;
555 u32 node_reference;
556 u64 page1_base_address;
557};
558
8e1fdd7f
SK
559struct acpi_iort_rmr {
560 u32 flags;
561 u32 rmr_count;
562 u32 rmr_offset;
563};
564
4fd14753
SK
565/* Masks for Flags field above */
566#define ACPI_IORT_RMR_REMAP_PERMITTED (1)
567#define ACPI_IORT_RMR_ACCESS_PRIVILEGE (1<<1)
568
569/*
570 * Macro to access the Access Attributes in flags field above:
571 * Access Attributes is encoded in bits 9:2
572 */
573#define ACPI_IORT_RMR_ACCESS_ATTRIBUTES(flags) (((flags) >> 2) & 0xFF)
574
575/* Values for above Access Attributes */
576
577#define ACPI_IORT_RMR_ATTR_DEVICE_NGNRNE 0x00
578#define ACPI_IORT_RMR_ATTR_DEVICE_NGNRE 0x01
579#define ACPI_IORT_RMR_ATTR_DEVICE_NGRE 0x02
580#define ACPI_IORT_RMR_ATTR_DEVICE_GRE 0x03
581#define ACPI_IORT_RMR_ATTR_NORMAL_NC 0x04
582#define ACPI_IORT_RMR_ATTR_NORMAL_IWB_OWB 0x05
583
8e1fdd7f
SK
584struct acpi_iort_rmr_desc {
585 u64 base_address;
586 u64 length;
587 u32 reserved;
588};
589
6e2d5ebd
BM
590/*******************************************************************************
591 *
592 * IVRS - I/O Virtualization Reporting Structure
593 * Version 1
594 *
595 * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
596 * Revision 1.26, February 2009.
597 *
598 ******************************************************************************/
599
600struct acpi_table_ivrs {
601 struct acpi_table_header header; /* Common ACPI table header */
602 u32 info; /* Common virtualization info */
603 u64 reserved;
604};
605
606/* Values for Info field above */
607
608#define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */
609#define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */
610#define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */
611
612/* IVRS subtable header */
613
614struct acpi_ivrs_header {
615 u8 type; /* Subtable type */
616 u8 flags;
617 u16 length; /* Subtable length */
618 u16 device_id; /* ID of IOMMU */
619};
620
621/* Values for subtable Type above */
622
623enum acpi_ivrs_type {
1f6239ca
MÅ»
624 ACPI_IVRS_TYPE_HARDWARE1 = 0x10,
625 ACPI_IVRS_TYPE_HARDWARE2 = 0x11,
7ce7a445 626 ACPI_IVRS_TYPE_HARDWARE3 = 0x40,
6e2d5ebd
BM
627 ACPI_IVRS_TYPE_MEMORY1 = 0x20,
628 ACPI_IVRS_TYPE_MEMORY2 = 0x21,
629 ACPI_IVRS_TYPE_MEMORY3 = 0x22
630};
631
632/* Masks for Flags field above for IVHD subtable */
633
634#define ACPI_IVHD_TT_ENABLE (1)
635#define ACPI_IVHD_PASS_PW (1<<1)
636#define ACPI_IVHD_RES_PASS_PW (1<<2)
637#define ACPI_IVHD_ISOC (1<<3)
638#define ACPI_IVHD_IOTLB (1<<4)
639
640/* Masks for Flags field above for IVMD subtable */
641
642#define ACPI_IVMD_UNITY (1)
643#define ACPI_IVMD_READ (1<<1)
644#define ACPI_IVMD_WRITE (1<<2)
645#define ACPI_IVMD_EXCLUSION_RANGE (1<<3)
646
647/*
648 * IVRS subtables, correspond to Type in struct acpi_ivrs_header
649 */
650
651/* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
652
1f6239ca 653struct acpi_ivrs_hardware_10 {
6e2d5ebd
BM
654 struct acpi_ivrs_header header;
655 u16 capability_offset; /* Offset for IOMMU control fields */
656 u64 base_address; /* IOMMU control registers */
657 u16 pci_segment_group;
658 u16 info; /* MSI number and unit ID */
0dc7e795 659 u32 feature_reporting;
6e2d5ebd
BM
660};
661
1f6239ca
MÅ»
662/* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */
663
664struct acpi_ivrs_hardware_11 {
665 struct acpi_ivrs_header header;
666 u16 capability_offset; /* Offset for IOMMU control fields */
667 u64 base_address; /* IOMMU control registers */
668 u16 pci_segment_group;
669 u16 info; /* MSI number and unit ID */
670 u32 attributes;
671 u64 efr_register_image;
672 u64 reserved;
673};
674
6e2d5ebd
BM
675/* Masks for Info field above */
676
677#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */
ba494bee 678#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_ID */
6e2d5ebd
BM
679
680/*
681 * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
682 * Upper two bits of the Type field are the (encoded) length of the structure.
683 * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
684 * are reserved for future use but not defined.
685 */
686struct acpi_ivrs_de_header {
687 u8 type;
688 u16 id;
689 u8 data_setting;
690};
691
692/* Length of device entry is in the top two bits of Type field above */
693
694#define ACPI_IVHD_ENTRY_LENGTH 0xC0
695
696/* Values for device entry Type field above */
697
698enum acpi_ivrs_device_entry_type {
699 /* 4-byte device entries, all use struct acpi_ivrs_device4 */
700
701 ACPI_IVRS_TYPE_PAD4 = 0,
702 ACPI_IVRS_TYPE_ALL = 1,
703 ACPI_IVRS_TYPE_SELECT = 2,
704 ACPI_IVRS_TYPE_START = 3,
705 ACPI_IVRS_TYPE_END = 4,
706
707 /* 8-byte device entries */
708
709 ACPI_IVRS_TYPE_PAD8 = 64,
710 ACPI_IVRS_TYPE_NOT_USED = 65,
711 ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses struct acpi_ivrs_device8a */
712 ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses struct acpi_ivrs_device8a */
713 ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses struct acpi_ivrs_device8b */
714 ACPI_IVRS_TYPE_EXT_START = 71, /* Uses struct acpi_ivrs_device8b */
7ce7a445
AM
715 ACPI_IVRS_TYPE_SPECIAL = 72, /* Uses struct acpi_ivrs_device8c */
716
717 /* Variable-length device entries */
718
719 ACPI_IVRS_TYPE_HID = 240 /* Uses ACPI_IVRS_DEVICE_HID */
6e2d5ebd
BM
720};
721
722/* Values for Data field above */
723
724#define ACPI_IVHD_INIT_PASS (1)
725#define ACPI_IVHD_EINT_PASS (1<<1)
726#define ACPI_IVHD_NMI_PASS (1<<2)
727#define ACPI_IVHD_SYSTEM_MGMT (3<<4)
728#define ACPI_IVHD_LINT0_PASS (1<<6)
729#define ACPI_IVHD_LINT1_PASS (1<<7)
730
731/* Types 0-4: 4-byte device entry */
732
733struct acpi_ivrs_device4 {
734 struct acpi_ivrs_de_header header;
735};
736
737/* Types 66-67: 8-byte device entry */
738
739struct acpi_ivrs_device8a {
740 struct acpi_ivrs_de_header header;
741 u8 reserved1;
742 u16 used_id;
743 u8 reserved2;
744};
745
746/* Types 70-71: 8-byte device entry */
747
748struct acpi_ivrs_device8b {
749 struct acpi_ivrs_de_header header;
750 u32 extended_data;
751};
752
753/* Values for extended_data above */
754
755#define ACPI_IVHD_ATS_DISABLED (1<<31)
756
757/* Type 72: 8-byte device entry */
758
759struct acpi_ivrs_device8c {
760 struct acpi_ivrs_de_header header;
761 u8 handle;
762 u16 used_id;
763 u8 variety;
764};
765
766/* Values for Variety field above */
767
768#define ACPI_IVHD_IOAPIC 1
769#define ACPI_IVHD_HPET 2
770
7ce7a445
AM
771/* Type 240: variable-length device entry */
772
773struct acpi_ivrs_device_hid {
774 struct acpi_ivrs_de_header header;
775 u64 acpi_hid;
776 u64 acpi_cid;
777 u8 uid_type;
778 u8 uid_length;
779};
780
c160b7d2
BM
781/* Values for uid_type above */
782
783#define ACPI_IVRS_UID_NOT_PRESENT 0
784#define ACPI_IVRS_UID_IS_INTEGER 1
785#define ACPI_IVRS_UID_IS_STRING 2
786
6e2d5ebd
BM
787/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
788
789struct acpi_ivrs_memory {
790 struct acpi_ivrs_header header;
791 u16 aux_data;
792 u64 reserved;
793 u64 start_address;
794 u64 memory_length;
795};
796
d36d4e30
BM
797/*******************************************************************************
798 *
799 * LPIT - Low Power Idle Table
800 *
9ab8cf1b 801 * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
d36d4e30
BM
802 *
803 ******************************************************************************/
804
805struct acpi_table_lpit {
806 struct acpi_table_header header; /* Common ACPI table header */
807};
808
809/* LPIT subtable header */
810
811struct acpi_lpit_header {
812 u32 type; /* Subtable type */
813 u32 length; /* Subtable length */
814 u16 unique_id;
815 u16 reserved;
816 u32 flags;
817};
818
819/* Values for subtable Type above */
820
821enum acpi_lpit_type {
822 ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
9ab8cf1b 823 ACPI_LPIT_TYPE_RESERVED = 0x01 /* 1 and above are reserved */
d36d4e30
BM
824};
825
826/* Masks for Flags field above */
827
828#define ACPI_LPIT_STATE_DISABLED (1)
829#define ACPI_LPIT_NO_COUNTER (1<<1)
830
831/*
832 * LPIT subtables, correspond to Type in struct acpi_lpit_header
833 */
834
835/* 0x00: Native C-state instruction based LPI structure */
836
837struct acpi_lpit_native {
838 struct acpi_lpit_header header;
839 struct acpi_generic_address entry_trigger;
840 u32 residency;
841 u32 latency;
842 struct acpi_generic_address residency_counter;
843 u64 counter_frequency;
844};
845
b24aad44
BM
846/*******************************************************************************
847 *
e62f8227
ES
848 * MADT - Multiple APIC Description Table
849 * Version 3
b24aad44
BM
850 *
851 ******************************************************************************/
852
e62f8227 853struct acpi_table_madt {
b24aad44 854 struct acpi_table_header header; /* Common ACPI table header */
e62f8227
ES
855 u32 address; /* Physical address of local APIC */
856 u32 flags;
b24aad44
BM
857};
858
e62f8227 859/* Masks for Flags field above */
b24aad44 860
e62f8227
ES
861#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
862
863/* Values for PCATCompat flag */
864
865#define ACPI_MADT_DUAL_PIC 1
866#define ACPI_MADT_MULTIPLE_APIC 0
867
868/* Values for MADT subtable type in struct acpi_subtable_header */
869
870enum acpi_madt_type {
871 ACPI_MADT_TYPE_LOCAL_APIC = 0,
872 ACPI_MADT_TYPE_IO_APIC = 1,
873 ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
874 ACPI_MADT_TYPE_NMI_SOURCE = 3,
875 ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
876 ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
877 ACPI_MADT_TYPE_IO_SAPIC = 6,
878 ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
879 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
880 ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
881 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
882 ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
883 ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
884 ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
885 ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
886 ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
9557cb8c 887 ACPI_MADT_TYPE_MULTIPROC_WAKEUP = 16,
60f2096b
HC
888 ACPI_MADT_TYPE_CORE_PIC = 17,
889 ACPI_MADT_TYPE_LIO_PIC = 18,
890 ACPI_MADT_TYPE_HT_PIC = 19,
891 ACPI_MADT_TYPE_EIO_PIC = 20,
892 ACPI_MADT_TYPE_MSI_PIC = 21,
893 ACPI_MADT_TYPE_BIO_PIC = 22,
894 ACPI_MADT_TYPE_LPC_PIC = 23,
f2ca92d0
S
895 ACPI_MADT_TYPE_RINTC = 24,
896 ACPI_MADT_TYPE_RESERVED = 25, /* 25 to 0x7F are reserved */
da6a9bbe 897 ACPI_MADT_TYPE_OEM_RESERVED = 0x80 /* 0x80 to 0xFF are reserved for OEM use */
e62f8227
ES
898};
899
900/*
901 * MADT Subtables, correspond to Type in struct acpi_subtable_header
902 */
903
904/* 0: Processor Local APIC */
905
906struct acpi_madt_local_apic {
907 struct acpi_subtable_header header;
908 u8 processor_id; /* ACPI processor id */
909 u8 id; /* Processor's local APIC id */
910 u32 lapic_flags;
911};
912
913/* 1: IO APIC */
914
915struct acpi_madt_io_apic {
916 struct acpi_subtable_header header;
917 u8 id; /* I/O APIC ID */
918 u8 reserved; /* reserved - must be zero */
919 u32 address; /* APIC physical address */
920 u32 global_irq_base; /* Global system interrupt where INTI lines start */
921};
922
923/* 2: Interrupt Override */
924
925struct acpi_madt_interrupt_override {
926 struct acpi_subtable_header header;
927 u8 bus; /* 0 - ISA */
928 u8 source_irq; /* Interrupt source (IRQ) */
929 u32 global_irq; /* Global system interrupt */
930 u16 inti_flags;
931};
932
933/* 3: NMI Source */
934
935struct acpi_madt_nmi_source {
936 struct acpi_subtable_header header;
937 u16 inti_flags;
938 u32 global_irq; /* Global system interrupt */
939};
940
941/* 4: Local APIC NMI */
942
943struct acpi_madt_local_apic_nmi {
944 struct acpi_subtable_header header;
945 u8 processor_id; /* ACPI processor id */
946 u16 inti_flags;
947 u8 lint; /* LINTn to which NMI is connected */
948};
949
950/* 5: Address Override */
951
952struct acpi_madt_local_apic_override {
953 struct acpi_subtable_header header;
954 u16 reserved; /* Reserved, must be zero */
955 u64 address; /* APIC physical address */
956};
957
958/* 6: I/O Sapic */
959
960struct acpi_madt_io_sapic {
961 struct acpi_subtable_header header;
962 u8 id; /* I/O SAPIC ID */
963 u8 reserved; /* Reserved, must be zero */
964 u32 global_irq_base; /* Global interrupt for SAPIC start */
965 u64 address; /* SAPIC physical address */
966};
967
968/* 7: Local Sapic */
969
970struct acpi_madt_local_sapic {
971 struct acpi_subtable_header header;
972 u8 processor_id; /* ACPI processor id */
973 u8 id; /* SAPIC ID */
974 u8 eid; /* SAPIC EID */
975 u8 reserved[3]; /* Reserved, must be zero */
976 u32 lapic_flags;
977 u32 uid; /* Numeric UID - ACPI 3.0 */
74522fea 978 char uid_string[]; /* String UID - ACPI 3.0 */
e62f8227
ES
979};
980
981/* 8: Platform Interrupt Source */
982
983struct acpi_madt_interrupt_source {
984 struct acpi_subtable_header header;
985 u16 inti_flags;
986 u8 type; /* 1=PMI, 2=INIT, 3=corrected */
987 u8 id; /* Processor ID */
988 u8 eid; /* Processor EID */
989 u8 io_sapic_vector; /* Vector value for PMI interrupts */
990 u32 global_irq; /* Global system interrupt */
991 u32 flags; /* Interrupt Source Flags */
992};
993
994/* Masks for Flags field above */
995
996#define ACPI_MADT_CPEI_OVERRIDE (1)
997
998/* 9: Processor Local X2APIC (ACPI 4.0) */
999
1000struct acpi_madt_local_x2apic {
1001 struct acpi_subtable_header header;
1002 u16 reserved; /* reserved - must be zero */
1003 u32 local_apic_id; /* Processor x2APIC ID */
1004 u32 lapic_flags;
1005 u32 uid; /* ACPI processor UID */
1006};
1007
1008/* 10: Local X2APIC NMI (ACPI 4.0) */
1009
1010struct acpi_madt_local_x2apic_nmi {
1011 struct acpi_subtable_header header;
1012 u16 inti_flags;
1013 u32 uid; /* ACPI processor UID */
1014 u8 lint; /* LINTn to which NMI is connected */
1015 u8 reserved[3]; /* reserved - must be zero */
1016};
1017
377421fc 1018/* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 + ACPI 6.5 changes) */
e62f8227
ES
1019
1020struct acpi_madt_generic_interrupt {
1021 struct acpi_subtable_header header;
1022 u16 reserved; /* reserved - must be zero */
1023 u32 cpu_interface_number;
1024 u32 uid;
1025 u32 flags;
1026 u32 parking_version;
1027 u32 performance_interrupt;
1028 u64 parked_address;
1029 u64 base_address;
1030 u64 gicv_base_address;
1031 u64 gich_base_address;
1032 u32 vgic_interrupt;
1033 u64 gicr_base_address;
1034 u64 arm_mpidr;
1035 u8 efficiency_class;
e646e0a5
ES
1036 u8 reserved2[1];
1037 u16 spe_interrupt; /* ACPI 6.3 */
377421fc 1038 u16 trbe_interrupt; /* ACPI 6.5 */
e62f8227
ES
1039};
1040
1041/* Masks for Flags field above */
1042
1043/* ACPI_MADT_ENABLED (1) Processor is usable if set */
1044#define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */
1045#define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */
1046
1047/* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
1048
1049struct acpi_madt_generic_distributor {
1050 struct acpi_subtable_header header;
1051 u16 reserved; /* reserved - must be zero */
1052 u32 gic_id;
1053 u64 base_address;
1054 u32 global_irq_base;
1055 u8 version;
1056 u8 reserved2[3]; /* reserved - must be zero */
1057};
1058
1059/* Values for Version field above */
1060
1061enum acpi_madt_gic_version {
1062 ACPI_MADT_GIC_VERSION_NONE = 0,
1063 ACPI_MADT_GIC_VERSION_V1 = 1,
1064 ACPI_MADT_GIC_VERSION_V2 = 2,
1065 ACPI_MADT_GIC_VERSION_V3 = 3,
1066 ACPI_MADT_GIC_VERSION_V4 = 4,
1067 ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */
1068};
1069
1070/* 13: Generic MSI Frame (ACPI 5.1) */
1071
1072struct acpi_madt_generic_msi_frame {
1073 struct acpi_subtable_header header;
1074 u16 reserved; /* reserved - must be zero */
1075 u32 msi_frame_id;
1076 u64 base_address;
1077 u32 flags;
1078 u16 spi_count;
1079 u16 spi_base;
1080};
1081
1082/* Masks for Flags field above */
1083
1084#define ACPI_MADT_OVERRIDE_SPI_VALUES (1)
1085
1086/* 14: Generic Redistributor (ACPI 5.1) */
1087
1088struct acpi_madt_generic_redistributor {
1089 struct acpi_subtable_header header;
1090 u16 reserved; /* reserved - must be zero */
1091 u64 base_address;
1092 u32 length;
1093};
1094
1095/* 15: Generic Translator (ACPI 6.0) */
1096
1097struct acpi_madt_generic_translator {
1098 struct acpi_subtable_header header;
1099 u16 reserved; /* reserved - must be zero */
1100 u32 translation_id;
1101 u64 base_address;
1102 u32 reserved2;
1103};
1104
9557cb8c
EK
1105/* 16: Multiprocessor wakeup (ACPI 6.4) */
1106
1107struct acpi_madt_multiproc_wakeup {
1108 struct acpi_subtable_header header;
1109 u16 mailbox_version;
1110 u32 reserved; /* reserved - must be zero */
1111 u64 base_address;
1112};
1113
45882a81
BM
1114#define ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE 2032
1115#define ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE 2048
42d96e16
KS
1116
1117struct acpi_madt_multiproc_wakeup_mailbox {
1118 u16 command;
1119 u16 reserved; /* reserved - must be zero */
1120 u32 apic_id;
1121 u64 wakeup_vector;
1122 u8 reserved_os[ACPI_MULTIPROC_WAKEUP_MB_OS_SIZE]; /* reserved for OS use */
1123 u8 reserved_firmware[ACPI_MULTIPROC_WAKEUP_MB_FIRMWARE_SIZE]; /* reserved for firmware use */
1124};
1125
1126#define ACPI_MP_WAKE_COMMAND_WAKEUP 1
1127
60f2096b
HC
1128/* 17: CPU Core Interrupt Controller (ACPI 6.5) */
1129
1130struct acpi_madt_core_pic {
1131 struct acpi_subtable_header header;
1132 u8 version;
1133 u32 processor_id;
1134 u32 core_id;
1135 u32 flags;
1136};
1137
1138/* Values for Version field above */
1139
1140enum acpi_madt_core_pic_version {
1141 ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
1142 ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
1143 ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1144};
1145
1146/* 18: Legacy I/O Interrupt Controller (ACPI 6.5) */
1147
1148struct acpi_madt_lio_pic {
1149 struct acpi_subtable_header header;
1150 u8 version;
1151 u64 address;
1152 u16 size;
1153 u8 cascade[2];
1154 u32 cascade_map[2];
1155};
1156
1157/* Values for Version field above */
1158
1159enum acpi_madt_lio_pic_version {
1160 ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
1161 ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
1162 ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1163};
1164
1165/* 19: HT Interrupt Controller (ACPI 6.5) */
1166
1167struct acpi_madt_ht_pic {
1168 struct acpi_subtable_header header;
1169 u8 version;
1170 u64 address;
1171 u16 size;
1172 u8 cascade[8];
1173};
1174
1175/* Values for Version field above */
1176
1177enum acpi_madt_ht_pic_version {
1178 ACPI_MADT_HT_PIC_VERSION_NONE = 0,
1179 ACPI_MADT_HT_PIC_VERSION_V1 = 1,
1180 ACPI_MADT_HT_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1181};
1182
1183/* 20: Extend I/O Interrupt Controller (ACPI 6.5) */
1184
1185struct acpi_madt_eio_pic {
1186 struct acpi_subtable_header header;
1187 u8 version;
1188 u8 cascade;
1189 u8 node;
1190 u64 node_map;
1191};
1192
1193/* Values for Version field above */
1194
1195enum acpi_madt_eio_pic_version {
1196 ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
1197 ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
1198 ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1199};
1200
1201/* 21: MSI Interrupt Controller (ACPI 6.5) */
1202
1203struct acpi_madt_msi_pic {
1204 struct acpi_subtable_header header;
1205 u8 version;
1206 u64 msg_address;
1207 u32 start;
1208 u32 count;
1209};
1210
1211/* Values for Version field above */
1212
1213enum acpi_madt_msi_pic_version {
1214 ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
1215 ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
1216 ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1217};
1218
1219/* 22: Bridge I/O Interrupt Controller (ACPI 6.5) */
1220
1221struct acpi_madt_bio_pic {
1222 struct acpi_subtable_header header;
1223 u8 version;
1224 u64 address;
1225 u16 size;
1226 u16 id;
1227 u16 gsi_base;
1228};
1229
1230/* Values for Version field above */
1231
1232enum acpi_madt_bio_pic_version {
1233 ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
1234 ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
1235 ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1236};
1237
1238/* 23: LPC Interrupt Controller (ACPI 6.5) */
1239
1240struct acpi_madt_lpc_pic {
1241 struct acpi_subtable_header header;
1242 u8 version;
1243 u64 address;
1244 u16 size;
1245 u8 cascade;
1246};
1247
1248/* Values for Version field above */
1249
1250enum acpi_madt_lpc_pic_version {
1251 ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
1252 ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
1253 ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1254};
1255
f2ca92d0
S
1256/* 24: RISC-V INTC */
1257struct acpi_madt_rintc {
1258 struct acpi_subtable_header header;
1259 u8 version;
1260 u8 reserved;
1261 u32 flags;
1262 u64 hart_id;
1263 u32 uid; /* ACPI processor UID */
1264};
1265
1266/* Values for RISC-V INTC Version field above */
1267
1268enum acpi_madt_rintc_version {
1269 ACPI_MADT_RINTC_VERSION_NONE = 0,
1270 ACPI_MADT_RINTC_VERSION_V1 = 1,
1271 ACPI_MADT_RINTC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
1272};
1273
60f2096b 1274/* 80: OEM data */
da6a9bbe
BM
1275
1276struct acpi_madt_oem_data {
2a85fc56 1277 ACPI_FLEX_ARRAY(u8, oem_data);
da6a9bbe
BM
1278};
1279
e62f8227
ES
1280/*
1281 * Common flags fields for MADT subtables
1282 */
1283
1284/* MADT Local APIC flags */
1285
1286#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
435a8dc8 1287#define ACPI_MADT_ONLINE_CAPABLE (2) /* 01: System HW supports enabling processor at runtime */
e62f8227
ES
1288
1289/* MADT MPS INTI flags (inti_flags) */
1290
1291#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
1292#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
1293
1294/* Values for MPS INTI flags */
1295
1296#define ACPI_MADT_POLARITY_CONFORMS 0
1297#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
1298#define ACPI_MADT_POLARITY_RESERVED 2
1299#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
1300
1301#define ACPI_MADT_TRIGGER_CONFORMS (0)
1302#define ACPI_MADT_TRIGGER_EDGE (1<<2)
1303#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
1304#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
1305
1306/*******************************************************************************
1307 *
1308 * MCFG - PCI Memory Mapped Configuration table and subtable
1309 * Version 1
1310 *
1311 * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
1312 *
1313 ******************************************************************************/
1314
1315struct acpi_table_mcfg {
1316 struct acpi_table_header header; /* Common ACPI table header */
1317 u8 reserved[8];
1318};
1319
1320/* Subtable */
1321
1322struct acpi_mcfg_allocation {
1323 u64 address; /* Base address, processor-relative */
1324 u16 pci_segment; /* PCI segment group number */
1325 u8 start_bus_number; /* Starting PCI Bus number */
1326 u8 end_bus_number; /* Final PCI Bus number */
b24aad44
BM
1327 u32 reserved;
1328};
1329
0e264f0b
BM
1330/*******************************************************************************
1331 *
1332 * MCHI - Management Controller Host Interface Table
1333 * Version 1
1334 *
1335 * Conforms to "Management Component Transport Protocol (MCTP) Host
1336 * Interface Specification", Revision 1.0.0a, October 13, 2009
1337 *
1338 ******************************************************************************/
1339
1340struct acpi_table_mchi {
1341 struct acpi_table_header header; /* Common ACPI table header */
1342 u8 interface_type;
1343 u8 protocol;
1344 u64 protocol_data;
1345 u8 interrupt_type;
1346 u8 gpe;
1347 u8 pci_device_flag;
1348 u32 global_interrupt;
1349 struct acpi_generic_address control_register;
1350 u8 pci_segment;
1351 u8 pci_bus;
1352 u8 pci_device;
1353 u8 pci_function;
1354};
1355
47920aae
HA
1356/*******************************************************************************
1357 *
1358 * MPAM - Memory System Resource Partitioning and Monitoring
1359 *
1360 * Conforms to "ACPI for Memory System Resource Partitioning and Monitoring 2.0"
1361 * Document number: ARM DEN 0065, December, 2022.
1362 *
1363 ******************************************************************************/
1364
1365/* MPAM RIS locator types. Table 11, Location types */
1366enum acpi_mpam_locator_type {
1367 ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE = 0,
1368 ACPI_MPAM_LOCATION_TYPE_MEMORY = 1,
1369 ACPI_MPAM_LOCATION_TYPE_SMMU = 2,
1370 ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE = 3,
1371 ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE = 4,
1372 ACPI_MPAM_LOCATION_TYPE_INTERCONNECT = 5,
1373 ACPI_MPAM_LOCATION_TYPE_UNKNOWN = 0xFF
1374};
1375
1376/* MPAM Functional dependency descriptor. Table 10 */
1377struct acpi_mpam_func_deps {
1378 u32 producer;
1379 u32 reserved;
1380};
1381
1382/* MPAM Processor cache locator descriptor. Table 13 */
1383struct acpi_mpam_resource_cache_locator {
1384 u64 cache_reference;
1385 u32 reserved;
1386};
1387
1388/* MPAM Memory locator descriptor. Table 14 */
1389struct acpi_mpam_resource_memory_locator {
1390 u64 proximity_domain;
1391 u32 reserved;
1392};
1393
1394/* MPAM SMMU locator descriptor. Table 15 */
1395struct acpi_mpam_resource_smmu_locator {
1396 u64 smmu_interface;
1397 u32 reserved;
1398};
1399
1400/* MPAM Memory-side cache locator descriptor. Table 16 */
1401struct acpi_mpam_resource_memcache_locator {
1402 u8 reserved[7];
1403 u8 level;
1404 u32 reference;
1405};
1406
1407/* MPAM ACPI device locator descriptor. Table 17 */
1408struct acpi_mpam_resource_acpi_locator {
1409 u64 acpi_hw_id;
1410 u32 acpi_unique_id;
1411};
1412
1413/* MPAM Interconnect locator descriptor. Table 18 */
1414struct acpi_mpam_resource_interconnect_locator {
1415 u64 inter_connect_desc_tbl_off;
1416 u32 reserved;
1417};
1418
1419/* MPAM Locator structure. Table 12 */
1420struct acpi_mpam_resource_generic_locator {
1421 u64 descriptor1;
1422 u32 descriptor2;
1423};
1424
1425union acpi_mpam_resource_locator {
1426 struct acpi_mpam_resource_cache_locator cache_locator;
1427 struct acpi_mpam_resource_memory_locator memory_locator;
1428 struct acpi_mpam_resource_smmu_locator smmu_locator;
1429 struct acpi_mpam_resource_memcache_locator mem_cache_locator;
1430 struct acpi_mpam_resource_acpi_locator acpi_locator;
1431 struct acpi_mpam_resource_interconnect_locator interconnect_ifc_locator;
1432 struct acpi_mpam_resource_generic_locator generic_locator;
1433};
1434
1435/* Memory System Component Resource Node Structure Table 9 */
1436struct acpi_mpam_resource_node {
1437 u32 identifier;
1438 u8 ris_index;
1439 u16 reserved1;
1440 u8 locator_type;
1441 union acpi_mpam_resource_locator locator;
1442 u32 num_functional_deps;
1443};
1444
1445/* Memory System Component (MSC) Node Structure. Table 4 */
1446struct acpi_mpam_msc_node {
1447 u16 length;
1448 u8 interface_type;
1449 u8 reserved;
1450 u32 identifier;
1451 u64 base_address;
1452 u32 mmio_size;
1453 u32 overflow_interrupt;
1454 u32 overflow_interrupt_flags;
1455 u32 reserved1;
1456 u32 overflow_interrupt_affinity;
1457 u32 error_interrupt;
1458 u32 error_interrupt_flags;
1459 u32 reserved2;
1460 u32 error_interrupt_affinity;
1461 u32 max_nrdy_usec;
1462 u64 hardware_id_linked_device;
1463 u32 instance_id_linked_device;
1464 u32 num_resouce_nodes;
1465};
1466
1467struct acpi_table_mpam {
1468 struct acpi_table_header header; /* Common ACPI table header */
1469};
1470
e62f8227
ES
1471/*******************************************************************************
1472 *
1473 * MPST - Memory Power State Table (ACPI 5.0)
1474 * Version 1
1475 *
1476 ******************************************************************************/
1477
1478#define ACPI_MPST_CHANNEL_INFO \
1479 u8 channel_id; \
1480 u8 reserved1[3]; \
1481 u16 power_node_count; \
1482 u16 reserved2;
1483
1484/* Main table */
1485
1486struct acpi_table_mpst {
1487 struct acpi_table_header header; /* Common ACPI table header */
1488 ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
1489};
1490
1491/* Memory Platform Communication Channel Info */
1492
1493struct acpi_mpst_channel {
1494 ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
1495};
1496
1497/* Memory Power Node Structure */
1498
1499struct acpi_mpst_power_node {
1500 u8 flags;
1501 u8 reserved1;
1502 u16 node_id;
1503 u32 length;
1504 u64 range_address;
1505 u64 range_length;
1506 u32 num_power_states;
1507 u32 num_physical_components;
1508};
1509
1510/* Values for Flags field above */
1511
1512#define ACPI_MPST_ENABLED 1
1513#define ACPI_MPST_POWER_MANAGED 2
1514#define ACPI_MPST_HOT_PLUG_CAPABLE 4
1515
1516/* Memory Power State Structure (follows POWER_NODE above) */
1517
1518struct acpi_mpst_power_state {
1519 u8 power_state;
1520 u8 info_index;
1521};
1522
1523/* Physical Component ID Structure (follows POWER_STATE above) */
1524
1525struct acpi_mpst_component {
1526 u16 component_id;
1527};
1528
1529/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
1530
1531struct acpi_mpst_data_hdr {
1532 u16 characteristics_count;
1533 u16 reserved;
1534};
1535
1536struct acpi_mpst_power_data {
1537 u8 structure_id;
1538 u8 flags;
1539 u16 reserved1;
1540 u32 average_power;
1541 u32 power_saving;
1542 u64 exit_latency;
1543 u64 reserved2;
1544};
1545
1546/* Values for Flags field above */
1547
1548#define ACPI_MPST_PRESERVE 1
1549#define ACPI_MPST_AUTOENTRY 2
1550#define ACPI_MPST_AUTOEXIT 4
1551
1552/* Shared Memory Region (not part of an ACPI table) */
1553
1554struct acpi_mpst_shared {
1555 u32 signature;
1556 u16 pcc_command;
1557 u16 pcc_status;
1558 u32 command_register;
1559 u32 status_register;
1560 u32 power_state_id;
1561 u32 power_node_id;
1562 u64 energy_consumed;
1563 u64 average_power;
1564};
1565
1566/*******************************************************************************
1567 *
1568 * MSCT - Maximum System Characteristics Table (ACPI 4.0)
1569 * Version 1
1570 *
1571 ******************************************************************************/
1572
1573struct acpi_table_msct {
1574 struct acpi_table_header header; /* Common ACPI table header */
1575 u32 proximity_offset; /* Location of proximity info struct(s) */
1576 u32 max_proximity_domains; /* Max number of proximity domains */
1577 u32 max_clock_domains; /* Max number of clock domains */
1578 u64 max_address; /* Max physical address in system */
1579};
1580
1581/* subtable - Maximum Proximity Domain Information. Version 1 */
1582
1583struct acpi_msct_proximity {
1584 u8 revision;
1585 u8 length;
1586 u32 range_start; /* Start of domain range */
1587 u32 range_end; /* End of domain range */
1588 u32 processor_capacity;
1589 u64 memory_capacity; /* In bytes */
1590};
1591
5132f2fa
BM
1592/*******************************************************************************
1593 *
1594 * MSDM - Microsoft Data Management table
1595 *
1596 * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
1597 * November 29, 2011. Copyright 2011 Microsoft
1598 *
1599 ******************************************************************************/
1600
1601/* Basic MSDM table is only the common ACPI header */
1602
1603struct acpi_table_msdm {
1604 struct acpi_table_header header; /* Common ACPI table header */
1605};
1606
3bd38469
JM
1607/*******************************************************************************
1608 *
e62f8227
ES
1609 * NFIT - NVDIMM Interface Table (ACPI 6.0+)
1610 * Version 1
3bd38469
JM
1611 *
1612 ******************************************************************************/
1613
e62f8227 1614struct acpi_table_nfit {
3bd38469 1615 struct acpi_table_header header; /* Common ACPI table header */
e62f8227 1616 u32 reserved; /* Reserved, must be zero */
3bd38469
JM
1617};
1618
e62f8227 1619/* Subtable header for NFIT */
5cf4d733 1620
e62f8227
ES
1621struct acpi_nfit_header {
1622 u16 type;
1623 u16 length;
1624};
5cf4d733 1625
e62f8227
ES
1626/* Values for subtable type in struct acpi_nfit_header */
1627
1628enum acpi_nfit_type {
1629 ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
1630 ACPI_NFIT_TYPE_MEMORY_MAP = 1,
1631 ACPI_NFIT_TYPE_INTERLEAVE = 2,
1632 ACPI_NFIT_TYPE_SMBIOS = 3,
1633 ACPI_NFIT_TYPE_CONTROL_REGION = 4,
1634 ACPI_NFIT_TYPE_DATA_REGION = 5,
1635 ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
1636 ACPI_NFIT_TYPE_CAPABILITIES = 7,
1637 ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */
5cf4d733
BM
1638};
1639
e62f8227
ES
1640/*
1641 * NFIT Subtables
1642 */
b24aad44 1643
e62f8227
ES
1644/* 0: System Physical Address Range Structure */
1645
1646struct acpi_nfit_system_address {
1647 struct acpi_nfit_header header;
1648 u16 range_index;
1649 u16 flags;
1650 u32 reserved; /* Reserved, must be zero */
1651 u32 proximity_domain;
1652 u8 range_guid[16];
1653 u64 address;
1654 u64 length;
1655 u64 memory_mapping;
cf16b05c 1656 u64 location_cookie; /* ACPI 6.4 */
b24aad44
BM
1657};
1658
e62f8227 1659/* Flags */
6e2d5ebd 1660
e62f8227
ES
1661#define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */
1662#define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */
cf16b05c 1663#define ACPI_NFIT_LOCATION_COOKIE_VALID (1<<2) /* 02: SPA location cookie valid (ACPI 6.4) */
6e2d5ebd 1664
e62f8227 1665/* Range Type GUIDs appear in the include/acuuid.h file */
29a3f38e 1666
e62f8227 1667/* 1: Memory Device to System Address Range Map Structure */
b24aad44 1668
e62f8227
ES
1669struct acpi_nfit_memory_map {
1670 struct acpi_nfit_header header;
1671 u32 device_handle;
1672 u16 physical_id;
1673 u16 region_id;
1674 u16 range_index;
1675 u16 region_index;
1676 u64 region_size;
1677 u64 region_offset;
1678 u64 address;
1679 u16 interleave_index;
1680 u16 interleave_ways;
1681 u16 flags;
1682 u16 reserved; /* Reserved, must be zero */
6e2d5ebd
BM
1683};
1684
e62f8227
ES
1685/* Flags */
1686
1687#define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */
1688#define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */
1689#define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */
1690#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */
1691#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */
1692#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */
1693#define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */
6e2d5ebd 1694
e62f8227
ES
1695/* 2: Interleave Structure */
1696
1697struct acpi_nfit_interleave {
1698 struct acpi_nfit_header header;
1699 u16 interleave_index;
1700 u16 reserved; /* Reserved, must be zero */
1701 u32 line_count;
1702 u32 line_size;
2a5ab998 1703 u32 line_offset[]; /* Variable length */
b24aad44
BM
1704};
1705
e62f8227 1706/* 3: SMBIOS Management Information Structure */
b24aad44 1707
e62f8227
ES
1708struct acpi_nfit_smbios {
1709 struct acpi_nfit_header header;
1710 u32 reserved; /* Reserved, must be zero */
74522fea 1711 u8 data[]; /* Variable length */
15a61aa1
BM
1712};
1713
e62f8227 1714/* 4: NVDIMM Control Region Structure */
15a61aa1 1715
e62f8227
ES
1716struct acpi_nfit_control_region {
1717 struct acpi_nfit_header header;
1718 u16 region_index;
1719 u16 vendor_id;
1720 u16 device_id;
1721 u16 revision_id;
1722 u16 subsystem_vendor_id;
1723 u16 subsystem_device_id;
1724 u16 subsystem_revision_id;
1725 u8 valid_fields;
1726 u8 manufacturing_location;
1727 u16 manufacturing_date;
1728 u8 reserved[2]; /* Reserved, must be zero */
1729 u32 serial_number;
1730 u16 code;
1731 u16 windows;
1732 u64 window_size;
1733 u64 command_offset;
1734 u64 command_size;
1735 u64 status_offset;
1736 u64 status_size;
1737 u16 flags;
1738 u8 reserved1[6]; /* Reserved, must be zero */
1739};
1740
1741/* Flags */
1742
1743#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
1744
1745/* valid_fields bits */
1746
1747#define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */
1748
1749/* 5: NVDIMM Block Data Window Region Structure */
1750
1751struct acpi_nfit_data_region {
1752 struct acpi_nfit_header header;
1753 u16 region_index;
1754 u16 windows;
1755 u64 offset;
1756 u64 size;
1757 u64 capacity;
1758 u64 start_address;
9005694e
BM
1759};
1760
e62f8227
ES
1761/* 6: Flush Hint Address Structure */
1762
1763struct acpi_nfit_flush_address {
1764 struct acpi_nfit_header header;
1765 u32 device_handle;
1766 u16 hint_count;
1767 u8 reserved[6]; /* Reserved, must be zero */
74522fea 1768 u64 hint_address[]; /* Variable length */
e62f8227
ES
1769};
1770
1771/* 7: Platform Capabilities Structure */
1772
1773struct acpi_nfit_capabilities {
1774 struct acpi_nfit_header header;
1775 u8 highest_capability;
1776 u8 reserved[3]; /* Reserved, must be zero */
1777 u32 capabilities;
1778 u32 reserved2;
9005694e
BM
1779};
1780
e62f8227
ES
1781/* Capabilities Flags */
1782
1783#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */
1784#define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */
1785#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */
1786
1787/*
1788 * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1789 */
1790struct nfit_device_handle {
1791 u32 handle;
1792};
9005694e 1793
e62f8227 1794/* Device handle construction and extraction macros */
9005694e 1795
e62f8227
ES
1796#define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F
1797#define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0
1798#define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00
1799#define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000
1800#define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000
9005694e 1801
e62f8227
ES
1802#define ACPI_NFIT_DIMM_NUMBER_OFFSET 0
1803#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4
1804#define ACPI_NFIT_MEMORY_ID_OFFSET 8
1805#define ACPI_NFIT_SOCKET_ID_OFFSET 12
1806#define ACPI_NFIT_NODE_ID_OFFSET 16
1807
1808/* Macro to construct a NFIT/NVDIMM device handle */
1809
1810#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1811 ((dimm) | \
1812 ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \
1813 ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \
1814 ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \
1815 ((node) << ACPI_NFIT_NODE_ID_OFFSET))
1816
1817/* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1818
1819#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1820 ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1821
1822#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1823 (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1824
1825#define ACPI_NFIT_GET_MEMORY_ID(handle) \
1826 (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET)
1827
1828#define ACPI_NFIT_GET_SOCKET_ID(handle) \
1829 (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET)
1830
1831#define ACPI_NFIT_GET_NODE_ID(handle) \
1832 (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET)
9005694e 1833
a805aab8
BM
1834/*******************************************************************************
1835 *
1836 * NHLT - Non HD Audio Link Table
1837 *
1838 * Conforms to: Intel Smart Sound Technology NHLT Specification
1839 * Version 0.8.1, January 2020.
1840 *
1841 ******************************************************************************/
1842
1843/* Main table */
1844
1845struct acpi_table_nhlt {
1846 struct acpi_table_header header; /* Common ACPI table header */
1847 u8 endpoint_count;
1848};
1849
1850struct acpi_nhlt_endpoint {
1851 u32 descriptor_length;
1852 u8 link_type;
1853 u8 instance_id;
1854 u16 vendor_id;
1855 u16 device_id;
1856 u16 revision_id;
1857 u32 subsystem_id;
1858 u8 device_type;
1859 u8 direction;
1860 u8 virtual_bus_id;
1861};
1862
1863/* Types for link_type field above */
1864
1865#define ACPI_NHLT_RESERVED_HD_AUDIO 0
1866#define ACPI_NHLT_RESERVED_DSP 1
1867#define ACPI_NHLT_PDM 2
1868#define ACPI_NHLT_SSP 3
1869#define ACPI_NHLT_RESERVED_SLIMBUS 4
1870#define ACPI_NHLT_RESERVED_SOUNDWIRE 5
1871#define ACPI_NHLT_TYPE_RESERVED 6 /* 6 and above are reserved */
1872
1873/* All other values above are reserved */
1874
1875/* Values for device_id field above */
1876
1877#define ACPI_NHLT_PDM_DMIC 0xAE20
1878#define ACPI_NHLT_BT_SIDEBAND 0xAE30
1879#define ACPI_NHLT_I2S_TDM_CODECS 0xAE23
1880
1881/* Values for device_type field above */
1882
1883/* SSP Link */
1884
1885#define ACPI_NHLT_LINK_BT_SIDEBAND 0
1886#define ACPI_NHLT_LINK_FM 1
1887#define ACPI_NHLT_LINK_MODEM 2
1888/* 3 is reserved */
1889#define ACPI_NHLT_LINK_SSP_ANALOG_CODEC 4
1890
1891/* PDM Link */
1892
1893#define ACPI_NHLT_PDM_ON_CAVS_1P8 0
1894#define ACPI_NHLT_PDM_ON_CAVS_1P5 1
1895
1896/* Values for Direction field above */
1897
1898#define ACPI_NHLT_DIR_RENDER 0
1899#define ACPI_NHLT_DIR_CAPTURE 1
1900#define ACPI_NHLT_DIR_RENDER_LOOPBACK 2
1901#define ACPI_NHLT_DIR_RENDER_FEEDBACK 3
1902#define ACPI_NHLT_DIR_RESERVED 4 /* 4 and above are reserved */
1903
1904struct acpi_nhlt_device_specific_config {
1905 u32 capabilities_size;
1906 u8 virtual_slot;
1907 u8 config_type;
1908};
1909
1910struct acpi_nhlt_device_specific_config_a {
1911 u32 capabilities_size;
1912 u8 virtual_slot;
1913 u8 config_type;
1914 u8 array_type;
1915};
1916
1917/* Values for Config Type above */
1918
e4a07f5a
BM
1919#define ACPI_NHLT_CONFIG_TYPE_GENERIC 0x00
1920#define ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY 0x01
1921#define ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK 0x03
1922#define ACPI_NHLT_CONFIG_TYPE_RESERVED 0x04 /* 4 and above are reserved */
a805aab8
BM
1923
1924struct acpi_nhlt_device_specific_config_b {
1925 u32 capabilities_size;
1926};
1927
1928struct acpi_nhlt_device_specific_config_c {
1929 u32 capabilities_size;
1930 u8 virtual_slot;
1931};
1932
e4a07f5a
BM
1933struct acpi_nhlt_render_device_specific_config {
1934 u32 capabilities_size;
1935 u8 virtual_slot;
1936};
1937
a805aab8
BM
1938struct acpi_nhlt_wave_extensible {
1939 u16 format_tag;
1940 u16 channel_count;
1941 u32 samples_per_sec;
1942 u32 avg_bytes_per_sec;
1943 u16 block_align;
1944 u16 bits_per_sample;
1945 u16 extra_format_size;
1946 u16 valid_bits_per_sample;
1947 u32 channel_mask;
1948 u8 sub_format_guid[16];
1949};
1950
1951/* Values for channel_mask above */
1952
1953#define ACPI_NHLT_SPKR_FRONT_LEFT 0x1
1954#define ACPI_NHLT_SPKR_FRONT_RIGHT 0x2
1955#define ACPI_NHLT_SPKR_FRONT_CENTER 0x4
1956#define ACPI_NHLT_SPKR_LOW_FREQ 0x8
1957#define ACPI_NHLT_SPKR_BACK_LEFT 0x10
1958#define ACPI_NHLT_SPKR_BACK_RIGHT 0x20
1959#define ACPI_NHLT_SPKR_FRONT_LEFT_OF_CENTER 0x40
1960#define ACPI_NHLT_SPKR_FRONT_RIGHT_OF_CENTER 0x80
1961#define ACPI_NHLT_SPKR_BACK_CENTER 0x100
1962#define ACPI_NHLT_SPKR_SIDE_LEFT 0x200
1963#define ACPI_NHLT_SPKR_SIDE_RIGHT 0x400
1964#define ACPI_NHLT_SPKR_TOP_CENTER 0x800
1965#define ACPI_NHLT_SPKR_TOP_FRONT_LEFT 0x1000
1966#define ACPI_NHLT_SPKR_TOP_FRONT_CENTER 0x2000
1967#define ACPI_NHLT_SPKR_TOP_FRONT_RIGHT 0x4000
1968#define ACPI_NHLT_SPKR_TOP_BACK_LEFT 0x8000
1969#define ACPI_NHLT_SPKR_TOP_BACK_CENTER 0x10000
1970#define ACPI_NHLT_SPKR_TOP_BACK_RIGHT 0x20000
1971
1972struct acpi_nhlt_format_config {
1973 struct acpi_nhlt_wave_extensible format;
1974 u32 capability_size;
1975 u8 capabilities[];
1976};
1977
1978struct acpi_nhlt_formats_config {
1979 u8 formats_count;
1980};
1981
1982struct acpi_nhlt_device_specific_hdr {
1983 u8 virtual_slot;
1984 u8 config_type;
1985};
1986
1987/* Types for config_type above */
1988
1989#define ACPI_NHLT_GENERIC 0
1990#define ACPI_NHLT_MIC 1
1991#define ACPI_NHLT_RENDER 3
1992
1993struct acpi_nhlt_mic_device_specific_config {
1994 struct acpi_nhlt_device_specific_hdr device_config;
1995 u8 array_type_ext;
1996};
1997
1998/* Values for array_type_ext above */
1999
45882a81 2000#define ACPI_NHLT_ARRAY_TYPE_RESERVED 0x09 /* 9 and below are reserved */
e4a07f5a
BM
2001#define ACPI_NHLT_SMALL_LINEAR_2ELEMENT 0x0A
2002#define ACPI_NHLT_BIG_LINEAR_2ELEMENT 0x0B
2003#define ACPI_NHLT_FIRST_GEOMETRY_LINEAR_4ELEMENT 0x0C
2004#define ACPI_NHLT_PLANAR_LSHAPED_4ELEMENT 0x0D
2005#define ACPI_NHLT_SECOND_GEOMETRY_LINEAR_4ELEMENT 0x0E
2006#define ACPI_NHLT_VENDOR_DEFINED 0x0F
2007#define ACPI_NHLT_ARRAY_TYPE_MASK 0x0F
2008#define ACPI_NHLT_ARRAY_TYPE_EXT_MASK 0x10
2009
2010#define ACPI_NHLT_NO_EXTENSION 0x0
2011#define ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT (1<<4)
a805aab8 2012
e4a07f5a
BM
2013struct acpi_nhlt_vendor_mic_count {
2014 u8 microphone_count;
2015};
a805aab8
BM
2016
2017struct acpi_nhlt_vendor_mic_config {
2018 u8 type;
2019 u8 panel;
45882a81
BM
2020 u16 speaker_position_distance; /* mm */
2021 u16 horizontal_offset; /* mm */
2022 u16 vertical_offset; /* mm */
2023 u8 frequency_low_band; /* 5*Hz */
2024 u8 frequency_high_band; /* 500*Hz */
2025 u16 direction_angle; /* -180 - + 180 */
2026 u16 elevation_angle; /* -180 - + 180 */
2027 u16 work_vertical_angle_begin; /* -180 - + 180 with 2 deg step */
2028 u16 work_vertical_angle_end; /* -180 - + 180 with 2 deg step */
2029 u16 work_horizontal_angle_begin; /* -180 - + 180 with 2 deg step */
2030 u16 work_horizontal_angle_end; /* -180 - + 180 with 2 deg step */
a805aab8
BM
2031};
2032
2033/* Values for Type field above */
2034
e4a07f5a
BM
2035#define ACPI_NHLT_MIC_OMNIDIRECTIONAL 0
2036#define ACPI_NHLT_MIC_SUBCARDIOID 1
2037#define ACPI_NHLT_MIC_CARDIOID 2
2038#define ACPI_NHLT_MIC_SUPER_CARDIOID 3
2039#define ACPI_NHLT_MIC_HYPER_CARDIOID 4
2040#define ACPI_NHLT_MIC_8_SHAPED 5
45882a81 2041#define ACPI_NHLT_MIC_RESERVED6 6 /* 6 is reserved */
e4a07f5a 2042#define ACPI_NHLT_MIC_VENDOR_DEFINED 7
45882a81 2043#define ACPI_NHLT_MIC_RESERVED 8 /* 8 and above are reserved */
a805aab8
BM
2044
2045/* Values for Panel field above */
2046
e4a07f5a
BM
2047#define ACPI_NHLT_MIC_POSITION_TOP 0
2048#define ACPI_NHLT_MIC_POSITION_BOTTOM 1
2049#define ACPI_NHLT_MIC_POSITION_LEFT 2
2050#define ACPI_NHLT_MIC_POSITION_RIGHT 3
2051#define ACPI_NHLT_MIC_POSITION_FRONT 4
2052#define ACPI_NHLT_MIC_POSITION_BACK 5
45882a81 2053#define ACPI_NHLT_MIC_POSITION_RESERVED 6 /* 6 and above are reserved */
a805aab8
BM
2054
2055struct acpi_nhlt_vendor_mic_device_specific_config {
2056 struct acpi_nhlt_mic_device_specific_config mic_array_device_config;
2057 u8 number_of_microphones;
45882a81 2058 struct acpi_nhlt_vendor_mic_config mic_config[]; /* Indexed by number_of_microphones */
a805aab8
BM
2059};
2060
2061/* Microphone SNR and Sensitivity extension */
2062
2063struct acpi_nhlt_mic_snr_sensitivity_extension {
2064 u32 SNR;
2065 u32 sensitivity;
2066};
2067
e4a07f5a
BM
2068/* Render device with feedback */
2069
a805aab8 2070struct acpi_nhlt_render_feedback_device_specific_config {
45882a81
BM
2071 u8 feedback_virtual_slot; /* Render slot in case of capture */
2072 u16 feedback_channels; /* Informative only */
a805aab8
BM
2073 u16 feedback_valid_bits_per_sample;
2074};
2075
8bd24835 2076/* Non documented structures */
a805aab8 2077
8bd24835 2078struct acpi_nhlt_device_info_count {
a805aab8
BM
2079 u8 structure_count;
2080};
2081
8bd24835 2082struct acpi_nhlt_device_info {
a805aab8
BM
2083 u8 device_id[16];
2084 u8 device_instance_id;
2085 u8 device_port_id;
0c9a6727
BM
2086};
2087
9005694e
BM
2088/*******************************************************************************
2089 *
e62f8227
ES
2090 * PCCT - Platform Communications Channel Table (ACPI 5.0)
2091 * Version 2 (ACPI 6.2)
9005694e
BM
2092 *
2093 ******************************************************************************/
2094
e62f8227 2095struct acpi_table_pcct {
9005694e 2096 struct acpi_table_header header; /* Common ACPI table header */
e62f8227
ES
2097 u32 flags;
2098 u64 reserved;
9005694e
BM
2099};
2100
e62f8227 2101/* Values for Flags field above */
9005694e 2102
e62f8227 2103#define ACPI_PCCT_DOORBELL 1
bff7f90b 2104
e62f8227 2105/* Values for subtable type in struct acpi_subtable_header */
bff7f90b 2106
e62f8227
ES
2107enum acpi_pcct_type {
2108 ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
2109 ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
2110 ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */
2111 ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3, /* ACPI 6.2 */
2112 ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4, /* ACPI 6.2 */
71f79a3f
EK
2113 ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE = 5, /* ACPI 6.4 */
2114 ACPI_PCCT_TYPE_RESERVED = 6 /* 6 and greater are reserved */
bff7f90b
BM
2115};
2116
2117/*
e62f8227 2118 * PCCT Subtables, correspond to Type in struct acpi_subtable_header
bff7f90b
BM
2119 */
2120
e62f8227 2121/* 0: Generic Communications Subspace */
bff7f90b 2122
e62f8227
ES
2123struct acpi_pcct_subspace {
2124 struct acpi_subtable_header header;
2125 u8 reserved[6];
2126 u64 base_address;
2127 u64 length;
2128 struct acpi_generic_address doorbell_register;
2129 u64 preserve_mask;
2130 u64 write_mask;
2131 u32 latency;
2132 u32 max_access_rate;
2133 u16 min_turnaround_time;
bff7f90b
BM
2134};
2135
e62f8227 2136/* 1: HW-reduced Communications Subspace (ACPI 5.1) */
bff7f90b 2137
e62f8227
ES
2138struct acpi_pcct_hw_reduced {
2139 struct acpi_subtable_header header;
2140 u32 platform_interrupt;
2141 u8 flags;
2142 u8 reserved;
2143 u64 base_address;
2144 u64 length;
2145 struct acpi_generic_address doorbell_register;
2146 u64 preserve_mask;
2147 u64 write_mask;
2148 u32 latency;
2149 u32 max_access_rate;
2150 u16 min_turnaround_time;
2151};
bff7f90b 2152
e62f8227 2153/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
bff7f90b 2154
e62f8227
ES
2155struct acpi_pcct_hw_reduced_type2 {
2156 struct acpi_subtable_header header;
2157 u32 platform_interrupt;
2158 u8 flags;
2159 u8 reserved;
2160 u64 base_address;
2161 u64 length;
2162 struct acpi_generic_address doorbell_register;
2163 u64 preserve_mask;
2164 u64 write_mask;
2165 u32 latency;
2166 u32 max_access_rate;
2167 u16 min_turnaround_time;
2168 struct acpi_generic_address platform_ack_register;
2169 u64 ack_preserve_mask;
2170 u64 ack_write_mask;
2171};
2172
2173/* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
2174
2175struct acpi_pcct_ext_pcc_master {
2176 struct acpi_subtable_header header;
2177 u32 platform_interrupt;
2178 u8 flags;
2179 u8 reserved1;
2180 u64 base_address;
2181 u32 length;
2182 struct acpi_generic_address doorbell_register;
2183 u64 preserve_mask;
2184 u64 write_mask;
2185 u32 latency;
2186 u32 max_access_rate;
2187 u32 min_turnaround_time;
2188 struct acpi_generic_address platform_ack_register;
2189 u64 ack_preserve_mask;
2190 u64 ack_set_mask;
2191 u64 reserved2;
2192 struct acpi_generic_address cmd_complete_register;
2193 u64 cmd_complete_mask;
2194 struct acpi_generic_address cmd_update_register;
2195 u64 cmd_update_preserve_mask;
2196 u64 cmd_update_set_mask;
2197 struct acpi_generic_address error_status_register;
2198 u64 error_status_mask;
2199};
2200
2201/* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
2202
2203struct acpi_pcct_ext_pcc_slave {
2204 struct acpi_subtable_header header;
2205 u32 platform_interrupt;
2206 u8 flags;
2207 u8 reserved1;
2208 u64 base_address;
2209 u32 length;
2210 struct acpi_generic_address doorbell_register;
2211 u64 preserve_mask;
2212 u64 write_mask;
2213 u32 latency;
2214 u32 max_access_rate;
2215 u32 min_turnaround_time;
2216 struct acpi_generic_address platform_ack_register;
2217 u64 ack_preserve_mask;
2218 u64 ack_set_mask;
2219 u64 reserved2;
2220 struct acpi_generic_address cmd_complete_register;
2221 u64 cmd_complete_mask;
2222 struct acpi_generic_address cmd_update_register;
2223 u64 cmd_update_preserve_mask;
2224 u64 cmd_update_set_mask;
2225 struct acpi_generic_address error_status_register;
2226 u64 error_status_mask;
2227};
2228
71f79a3f
EK
2229/* 5: HW Registers based Communications Subspace */
2230
2231struct acpi_pcct_hw_reg {
2232 struct acpi_subtable_header header;
2233 u16 version;
2234 u64 base_address;
2235 u64 length;
2236 struct acpi_generic_address doorbell_register;
2237 u64 doorbell_preserve;
2238 u64 doorbell_write;
2239 struct acpi_generic_address cmd_complete_register;
2240 u64 cmd_complete_mask;
2241 struct acpi_generic_address error_status_register;
2242 u64 error_status_mask;
2243 u32 nominal_latency;
2244 u32 min_turnaround_time;
2245};
2246
e62f8227
ES
2247/* Values for doorbell flags above */
2248
2249#define ACPI_PCCT_INTERRUPT_POLARITY (1)
2250#define ACPI_PCCT_INTERRUPT_MODE (1<<1)
2251
2252/*
2253 * PCC memory structures (not part of the ACPI table)
2254 */
2255
2256/* Shared Memory Region */
2257
2258struct acpi_pcct_shared_memory {
2259 u32 signature;
2260 u16 command;
2261 u16 status;
2262};
2263
2264/* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
2265
2266struct acpi_pcct_ext_pcc_shared_memory {
2267 u32 signature;
2268 u32 flags;
2269 u32 length;
2270 u32 command;
2271};
cf8252ca 2272
b24aad44
BM
2273/*******************************************************************************
2274 *
e62f8227
ES
2275 * PDTT - Platform Debug Trigger Table (ACPI 6.2)
2276 * Version 0
b24aad44
BM
2277 *
2278 ******************************************************************************/
2279
e62f8227 2280struct acpi_table_pdtt {
b24aad44 2281 struct acpi_table_header header; /* Common ACPI table header */
e62f8227
ES
2282 u8 trigger_count;
2283 u8 reserved[3];
2284 u32 array_offset;
2285};
2286
2287/*
2288 * PDTT Communication Channel Identifier Structure.
2289 * The number of these structures is defined by trigger_count above,
2290 * starting at array_offset.
2291 */
2292struct acpi_pdtt_channel {
2293 u8 subchannel_id;
2294 u8 flags;
b24aad44
BM
2295};
2296
e62f8227
ES
2297/* Flags for above */
2298
2299#define ACPI_PDTT_RUNTIME_TRIGGER (1)
2300#define ACPI_PDTT_WAIT_COMPLETION (1<<1)
f00175d0 2301#define ACPI_PDTT_TRIGGER_ORDER (1<<2)
e62f8227 2302
9f400337
EK
2303/*******************************************************************************
2304 *
2305 * PHAT - Platform Health Assessment Table (ACPI 6.4)
2306 * Version 1
2307 *
2308 ******************************************************************************/
2309
2310struct acpi_table_phat {
2311 struct acpi_table_header header; /* Common ACPI table header */
2312};
2313
2314/* Common header for PHAT subtables that follow main table */
2315
2316struct acpi_phat_header {
2317 u16 type;
2318 u16 length;
2319 u8 revision;
2320};
2321
2322/* Values for Type field above */
2323
2324#define ACPI_PHAT_TYPE_FW_VERSION_DATA 0
2325#define ACPI_PHAT_TYPE_FW_HEALTH_DATA 1
2326#define ACPI_PHAT_TYPE_RESERVED 2 /* 0x02-0xFFFF are reserved */
2327
2328/*
2329 * PHAT subtables, correspond to Type in struct acpi_phat_header
2330 */
2331
2332/* 0: Firmware Version Data Record */
2333
2334struct acpi_phat_version_data {
2335 struct acpi_phat_header header;
2336 u8 reserved[3];
2337 u32 element_count;
2338};
2339
2340struct acpi_phat_version_element {
2341 u8 guid[16];
2342 u64 version_value;
2343 u32 producer_id;
2344};
2345
2346/* 1: Firmware Health Data Record */
2347
2348struct acpi_phat_health_data {
2349 struct acpi_phat_header header;
2350 u8 reserved[2];
2351 u8 health;
2352 u8 device_guid[16];
2353 u32 device_specific_offset; /* Zero if no Device-specific data */
2354};
2355
2356/* Values for Health field above */
2357
2358#define ACPI_PHAT_ERRORS_FOUND 0
2359#define ACPI_PHAT_NO_ERRORS 1
2360#define ACPI_PHAT_UNKNOWN_ERRORS 2
2361#define ACPI_PHAT_ADVISORY 3
2362
25c0330a
LZ
2363/*******************************************************************************
2364 *
e62f8227 2365 * PMTT - Platform Memory Topology Table (ACPI 5.0)
25c0330a
LZ
2366 * Version 1
2367 *
25c0330a
LZ
2368 ******************************************************************************/
2369
e62f8227 2370struct acpi_table_pmtt {
25c0330a 2371 struct acpi_table_header header; /* Common ACPI table header */
cca97d42
BM
2372 u32 memory_device_count;
2373 /*
2374 * Immediately followed by:
2375 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2376 */
25c0330a
LZ
2377};
2378
e62f8227 2379/* Common header for PMTT subtables that follow main table */
25c0330a 2380
e62f8227
ES
2381struct acpi_pmtt_header {
2382 u8 type;
2383 u8 reserved1;
2384 u16 length;
2385 u16 flags;
2386 u16 reserved2;
cca97d42
BM
2387 u32 memory_device_count; /* Zero means no memory device structs follow */
2388 /*
2389 * Immediately followed by:
2390 * u8 type_specific_data[]
2391 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2392 */
e62f8227
ES
2393};
2394
2395/* Values for Type field above */
2396
2397#define ACPI_PMTT_TYPE_SOCKET 0
2398#define ACPI_PMTT_TYPE_CONTROLLER 1
2399#define ACPI_PMTT_TYPE_DIMM 2
cca97d42
BM
2400#define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFE are reserved */
2401#define ACPI_PMTT_TYPE_VENDOR 0xFF
e62f8227
ES
2402
2403/* Values for Flags field above */
2404
2405#define ACPI_PMTT_TOP_LEVEL 0x0001
2406#define ACPI_PMTT_PHYSICAL 0x0002
2407#define ACPI_PMTT_MEMORY_TYPE 0x000C
2408
2409/*
2410 * PMTT subtables, correspond to Type in struct acpi_pmtt_header
2411 */
2412
2413/* 0: Socket Structure */
2414
2415struct acpi_pmtt_socket {
2416 struct acpi_pmtt_header header;
2417 u16 socket_id;
2418 u16 reserved;
2419};
cca97d42
BM
2420 /*
2421 * Immediately followed by:
2422 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2423 */
e62f8227
ES
2424
2425/* 1: Memory Controller subtable */
2426
2427struct acpi_pmtt_controller {
2428 struct acpi_pmtt_header header;
cca97d42 2429 u16 controller_id;
e62f8227 2430 u16 reserved;
e62f8227 2431};
cca97d42
BM
2432 /*
2433 * Immediately followed by:
2434 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2435 */
e62f8227
ES
2436
2437/* 2: Physical Component Identifier (DIMM) */
2438
2439struct acpi_pmtt_physical_component {
2440 struct acpi_pmtt_header header;
e62f8227 2441 u32 bios_handle;
25c0330a
LZ
2442};
2443
cca97d42
BM
2444/* 0xFF: Vendor Specific Data */
2445
2446struct acpi_pmtt_vendor_specific {
2447 struct acpi_pmtt_header header;
2448 u8 type_uuid[16];
2449 u8 specific[];
2450 /*
2451 * Immediately followed by:
2452 * u8 vendor_specific_data[];
2453 * MEMORY_DEVICE memory_device_struct[memory_device_count];
2454 */
2455};
2456
6e2d5ebd
BM
2457/*******************************************************************************
2458 *
e62f8227 2459 * PPTT - Processor Properties Topology Table (ACPI 6.2)
6e2d5ebd
BM
2460 * Version 1
2461 *
6e2d5ebd
BM
2462 ******************************************************************************/
2463
e62f8227 2464struct acpi_table_pptt {
6e2d5ebd 2465 struct acpi_table_header header; /* Common ACPI table header */
e62f8227
ES
2466};
2467
2468/* Values for Type field above */
2469
2470enum acpi_pptt_type {
2471 ACPI_PPTT_TYPE_PROCESSOR = 0,
2472 ACPI_PPTT_TYPE_CACHE = 1,
2473 ACPI_PPTT_TYPE_ID = 2,
2474 ACPI_PPTT_TYPE_RESERVED = 3
2475};
2476
2477/* 0: Processor Hierarchy Node Structure */
2478
2479struct acpi_pptt_processor {
2480 struct acpi_subtable_header header;
2481 u16 reserved;
6e2d5ebd 2482 u32 flags;
e62f8227
ES
2483 u32 parent;
2484 u32 acpi_processor_id;
2485 u32 number_of_priv_resources;
6e2d5ebd
BM
2486};
2487
e62f8227 2488/* Flags */
6e2d5ebd 2489
b5eab512
ES
2490#define ACPI_PPTT_PHYSICAL_PACKAGE (1)
2491#define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (1<<1)
2492#define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD (1<<2) /* ACPI 6.3 */
2493#define ACPI_PPTT_ACPI_LEAF_NODE (1<<3) /* ACPI 6.3 */
2494#define ACPI_PPTT_ACPI_IDENTICAL (1<<4) /* ACPI 6.3 */
6e2d5ebd 2495
e62f8227 2496/* 1: Cache Type Structure */
b24aad44 2497
e62f8227
ES
2498struct acpi_pptt_cache {
2499 struct acpi_subtable_header header;
2500 u16 reserved;
2501 u32 flags;
2502 u32 next_level_of_cache;
2503 u32 size;
2504 u32 number_of_sets;
2505 u8 associativity;
2506 u8 attributes;
2507 u16 line_size;
b24aad44
BM
2508};
2509
5e2e86c0
EK
2510/* 1: Cache Type Structure for PPTT version 3 */
2511
2512struct acpi_pptt_cache_v1 {
2513 u32 cache_id;
2514};
2515
e62f8227
ES
2516/* Flags */
2517
2518#define ACPI_PPTT_SIZE_PROPERTY_VALID (1) /* Physical property valid */
2519#define ACPI_PPTT_NUMBER_OF_SETS_VALID (1<<1) /* Number of sets valid */
2520#define ACPI_PPTT_ASSOCIATIVITY_VALID (1<<2) /* Associativity valid */
2521#define ACPI_PPTT_ALLOCATION_TYPE_VALID (1<<3) /* Allocation type valid */
2522#define ACPI_PPTT_CACHE_TYPE_VALID (1<<4) /* Cache type valid */
2523#define ACPI_PPTT_WRITE_POLICY_VALID (1<<5) /* Write policy valid */
2524#define ACPI_PPTT_LINE_SIZE_VALID (1<<6) /* Line size valid */
5e2e86c0 2525#define ACPI_PPTT_CACHE_ID_VALID (1<<7) /* Cache ID valid */
e62f8227
ES
2526
2527/* Masks for Attributes */
6e2d5ebd 2528
e62f8227
ES
2529#define ACPI_PPTT_MASK_ALLOCATION_TYPE (0x03) /* Allocation type */
2530#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */
2531#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */
6e2d5ebd 2532
e62f8227
ES
2533/* Attributes describing cache */
2534#define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */
2535#define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */
2536#define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */
2537#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */
b24aad44 2538
e62f8227
ES
2539#define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */
2540#define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */
2541#define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */
2542#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */
2543
2544#define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */
2545#define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */
2546
2547/* 2: ID Structure */
2548
2549struct acpi_pptt_id {
2550 struct acpi_subtable_header header;
6e2d5ebd 2551 u16 reserved;
e62f8227
ES
2552 u32 vendor_id;
2553 u64 level1_id;
2554 u64 level2_id;
2555 u16 major_rev;
2556 u16 minor_rev;
2557 u16 spin_rev;
b24aad44
BM
2558};
2559
d71df85a
EK
2560/*******************************************************************************
2561 *
2562 * PRMT - Platform Runtime Mechanism Table
2563 * Version 1
2564 *
2565 ******************************************************************************/
2566
2567struct acpi_table_prmt {
2568 struct acpi_table_header header; /* Common ACPI table header */
2569};
2570
2571struct acpi_table_prmt_header {
2572 u8 platform_guid[16];
2573 u32 module_info_offset;
2574 u32 module_info_count;
2575};
2576
9f8c7bae
EK
2577struct acpi_prmt_module_header {
2578 u16 revision;
2579 u16 length;
2580};
2581
d71df85a
EK
2582struct acpi_prmt_module_info {
2583 u16 revision;
2584 u16 length;
2585 u8 module_guid[16];
2586 u16 major_rev;
2587 u16 minor_rev;
2588 u16 handler_info_count;
2589 u32 handler_info_offset;
2590 u64 mmio_list_pointer;
2591};
2592
2593struct acpi_prmt_handler_info {
2594 u16 revision;
2595 u16 length;
2596 u8 handler_guid[16];
2597 u64 handler_address;
2598 u64 static_data_buffer_address;
2599 u64 acpi_param_buffer_address;
2600};
2601
9d8b5e7b
BM
2602/*******************************************************************************
2603 *
e62f8227 2604 * RASF - RAS Feature Table (ACPI 5.0)
9d8b5e7b
BM
2605 * Version 1
2606 *
9d8b5e7b
BM
2607 ******************************************************************************/
2608
e62f8227 2609struct acpi_table_rasf {
9d8b5e7b 2610 struct acpi_table_header header; /* Common ACPI table header */
e62f8227
ES
2611 u8 channel_id[12];
2612};
2613
2614/* RASF Platform Communication Channel Shared Memory Region */
2615
2616struct acpi_rasf_shared_memory {
2617 u32 signature;
2618 u16 command;
9d8b5e7b 2619 u16 status;
e62f8227
ES
2620 u16 version;
2621 u8 capabilities[16];
2622 u8 set_capabilities[16];
2623 u16 num_parameter_blocks;
2624 u32 set_capabilities_status;
2625};
2626
2627/* RASF Parameter Block Structure Header */
2628
2629struct acpi_rasf_parameter_block {
2630 u16 type;
2631 u16 version;
2632 u16 length;
9d8b5e7b
BM
2633};
2634
e62f8227 2635/* RASF Parameter Block Structure for PATROL_SCRUB */
9d8b5e7b 2636
e62f8227
ES
2637struct acpi_rasf_patrol_scrub_parameter {
2638 struct acpi_rasf_parameter_block header;
2639 u16 patrol_scrub_command;
2640 u64 requested_address_range[2];
2641 u64 actual_address_range[2];
2642 u16 flags;
2643 u8 requested_speed;
2644};
2645
2646/* Masks for Flags and Speed fields above */
2647
2648#define ACPI_RASF_SCRUBBER_RUNNING 1
2649#define ACPI_RASF_SPEED (7<<1)
2650#define ACPI_RASF_SPEED_SLOW (0<<1)
2651#define ACPI_RASF_SPEED_MEDIUM (4<<1)
2652#define ACPI_RASF_SPEED_FAST (7<<1)
2653
2654/* Channel Commands */
2655
2656enum acpi_rasf_commands {
2657 ACPI_RASF_EXECUTE_RASF_COMMAND = 1
2658};
2659
2660/* Platform RAS Capabilities */
9d8b5e7b 2661
e62f8227
ES
2662enum acpi_rasf_capabiliities {
2663 ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
2664 ACPI_SW_PATROL_SCRUB_EXPOSED = 1
2665};
2666
2667/* Patrol Scrub Commands */
2668
2669enum acpi_rasf_patrol_scrub_commands {
2670 ACPI_RASF_GET_PATROL_PARAMETERS = 1,
2671 ACPI_RASF_START_PATROL_SCRUBBER = 2,
2672 ACPI_RASF_STOP_PATROL_SCRUBBER = 3
2673};
9d8b5e7b 2674
e62f8227
ES
2675/* Channel Command flags */
2676
2677#define ACPI_RASF_GENERATE_SCI (1<<15)
2678
2679/* Status values */
2680
2681enum acpi_rasf_status {
2682 ACPI_RASF_SUCCESS = 0,
2683 ACPI_RASF_NOT_VALID = 1,
2684 ACPI_RASF_NOT_SUPPORTED = 2,
2685 ACPI_RASF_BUSY = 3,
2686 ACPI_RASF_FAILED = 4,
2687 ACPI_RASF_ABORTED = 5,
2688 ACPI_RASF_INVALID_DATA = 6
2689};
2690
2691/* Status flags */
2692
2693#define ACPI_RASF_COMMAND_COMPLETE (1)
2694#define ACPI_RASF_SCI_DOORBELL (1<<1)
2695#define ACPI_RASF_ERROR (1<<2)
2696#define ACPI_RASF_STATUS (0x1F<<3)
9d8b5e7b 2697
536e35c9
BM
2698/*******************************************************************************
2699 *
2700 * RGRT - Regulatory Graphics Resource Table
2701 * Version 1
2702 *
2703 * Conforms to "ACPI RGRT" available at:
2704 * https://microsoft.github.io/mu/dyn/mu_plus/ms_core_pkg/acpi_RGRT/feature_acpi_rgrt/
2705 *
2706 ******************************************************************************/
2707
2708struct acpi_table_rgrt {
2709 struct acpi_table_header header; /* Common ACPI table header */
2710 u16 version;
2711 u8 image_type;
2712 u8 reserved;
aa29b208 2713 u8 image[];
536e35c9
BM
2714};
2715
2716/* image_type values */
2717
2718enum acpi_rgrt_image_type {
2719 ACPI_RGRT_TYPE_RESERVED0 = 0,
2720 ACPI_RGRT_IMAGE_TYPE_PNG = 1,
2721 ACPI_RGRT_TYPE_RESERVED = 2 /* 2 and greater are reserved */
2722};
2723
003567a3
S
2724/*******************************************************************************
2725 *
2726 * RHCT - RISC-V Hart Capabilities Table
2727 * Version 1
2728 *
2729 ******************************************************************************/
2730
2731struct acpi_table_rhct {
2732 struct acpi_table_header header; /* Common ACPI table header */
2733 u32 reserved;
2734 u64 time_base_freq;
2735 u32 node_count;
2736 u32 node_offset;
2737};
2738
2739/*
2740 * RHCT subtables
2741 */
2742struct acpi_rhct_node_header {
2743 u16 type;
2744 u16 length;
2745 u16 revision;
2746};
2747
2748/* Values for RHCT subtable Type above */
2749
2750enum acpi_rhct_node_type {
2751 ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000,
2752 ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF,
2753};
2754
2755/*
2756 * RHCT node specific subtables
2757 */
2758
2759/* ISA string node structure */
2760struct acpi_rhct_isa_string {
2761 u16 isa_length;
2762 char isa[];
2763};
2764
2765/* Hart Info node structure */
2766struct acpi_rhct_hart_info {
2767 u16 num_offsets;
2768 u32 uid; /* ACPI processor UID */
2769};
2770
b24aad44
BM
2771/*******************************************************************************
2772 *
e62f8227 2773 * SBST - Smart Battery Specification Table
6e2d5ebd
BM
2774 * Version 1
2775 *
e62f8227
ES
2776 ******************************************************************************/
2777
2778struct acpi_table_sbst {
2779 struct acpi_table_header header; /* Common ACPI table header */
2780 u32 warning_level;
2781 u32 low_level;
2782 u32 critical_level;
2783};
2784
2785/*******************************************************************************
2786 *
2787 * SDEI - Software Delegated Exception Interface Descriptor Table
2788 *
2789 * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
2790 * May 8th, 2017. Copyright 2017 ARM Ltd.
b24aad44
BM
2791 *
2792 ******************************************************************************/
2793
e62f8227 2794struct acpi_table_sdei {
b24aad44 2795 struct acpi_table_header header; /* Common ACPI table header */
b24aad44
BM
2796};
2797
e6ab3b77
LZ
2798/*******************************************************************************
2799 *
e62f8227 2800 * SDEV - Secure Devices Table (ACPI 6.2)
e6ab3b77
LZ
2801 * Version 1
2802 *
e6ab3b77
LZ
2803 ******************************************************************************/
2804
e62f8227 2805struct acpi_table_sdev {
e6ab3b77 2806 struct acpi_table_header header; /* Common ACPI table header */
e6ab3b77
LZ
2807};
2808
e62f8227
ES
2809struct acpi_sdev_header {
2810 u8 type;
2811 u8 flags;
2812 u16 length;
2813};
2814
2815/* Values for subtable type above */
2816
2817enum acpi_sdev_type {
2818 ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
2819 ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
2820 ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */
2821};
e6ab3b77 2822
e62f8227
ES
2823/* Values for flags above */
2824
2825#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1)
14012d2f 2826#define ACPI_SDEV_SECURE_COMPONENTS_PRESENT (1<<1)
e62f8227
ES
2827
2828/*
2829 * SDEV subtables
2830 */
2831
2832/* 0: Namespace Device Based Secure Device Structure */
2833
2834struct acpi_sdev_namespace {
2835 struct acpi_sdev_header header;
2836 u16 device_id_offset;
2837 u16 device_id_length;
2838 u16 vendor_data_offset;
2839 u16 vendor_data_length;
2840};
2841
14012d2f
EK
2842struct acpi_sdev_secure_component {
2843 u16 secure_component_offset;
2844 u16 secure_component_length;
2845};
2846
2847/*
2848 * SDEV sub-subtables ("Components") for above
2849 */
2850struct acpi_sdev_component {
2851 struct acpi_sdev_header header;
2852};
2853
2854/* Values for sub-subtable type above */
2855
2856enum acpi_sac_type {
2857 ACPI_SDEV_TYPE_ID_COMPONENT = 0,
2858 ACPI_SDEV_TYPE_MEM_COMPONENT = 1
2859};
2860
2861struct acpi_sdev_id_component {
2862 struct acpi_sdev_header header;
2863 u16 hardware_id_offset;
2864 u16 hardware_id_length;
2865 u16 subsystem_id_offset;
2866 u16 subsystem_id_length;
2867 u16 hardware_revision;
2868 u8 hardware_rev_present;
2869 u8 class_code_present;
2870 u8 pci_base_class;
2871 u8 pci_sub_class;
2872 u8 pci_programming_xface;
2873};
2874
2875struct acpi_sdev_mem_component {
2876 struct acpi_sdev_header header;
2877 u32 reserved;
2878 u64 memory_base_address;
2879 u64 memory_length;
2880};
2881
e62f8227
ES
2882/* 1: PCIe Endpoint Device Based Device Structure */
2883
2884struct acpi_sdev_pcie {
2885 struct acpi_sdev_header header;
2886 u16 segment;
2887 u16 start_bus;
2888 u16 path_offset;
2889 u16 path_length;
2890 u16 vendor_data_offset;
2891 u16 vendor_data_length;
2892};
2893
2894/* 1a: PCIe Endpoint path entry */
2895
2896struct acpi_sdev_pcie_path {
2897 u8 device;
2898 u8 function;
2899};
e6ab3b77 2900
8288f69e
KS
2901/*******************************************************************************
2902 *
2903 * SVKL - Storage Volume Key Location Table (ACPI 6.4)
6496f03e
BM
2904 * From: "Guest-Host-Communication Interface (GHCI) for Intel
2905 * Trust Domain Extensions (Intel TDX)".
8288f69e
KS
2906 * Version 1
2907 *
2908 ******************************************************************************/
2909
2910struct acpi_table_svkl {
2911 struct acpi_table_header header; /* Common ACPI table header */
2912 u32 count;
2913};
2914
6496f03e 2915struct acpi_svkl_key {
8288f69e
KS
2916 u16 type;
2917 u16 format;
2918 u32 size;
2919 u64 address;
2920};
2921
2922enum acpi_svkl_type {
2923 ACPI_SVKL_TYPE_MAIN_STORAGE = 0,
2924 ACPI_SVKL_TYPE_RESERVED = 1 /* 1 and greater are reserved */
2925};
2926
2927enum acpi_svkl_format {
2928 ACPI_SVKL_FORMAT_RAW_BINARY = 0,
2929 ACPI_SVKL_FORMAT_RESERVED = 1 /* 1 and greater are reserved */
2930};
2931
2de6bb92
BM
2932/*******************************************************************************
2933 *
2934 * TDEL - TD-Event Log
2935 * From: "Guest-Host-Communication Interface (GHCI) for Intel
2936 * Trust Domain Extensions (Intel TDX)".
2937 * September 2020
2938 *
2939 ******************************************************************************/
2940
2941struct acpi_table_tdel {
2942 struct acpi_table_header header; /* Common ACPI table header */
2943 u32 reserved;
2944 u64 log_area_minimum_length;
2945 u64 log_area_start_address;
2946};
2947
6e596084
RM
2948/* Reset to default packing */
2949
2950#pragma pack()
b24aad44
BM
2951
2952#endif /* __ACTBL2_H__ */