xref: /freebsd/sys/contrib/dev/acpica/common/dmtable.c (revision 942815c54820783d3d4f7f6faa71ab7919b5f0e5)
1 /******************************************************************************
2  *
3  * Module Name: dmtable - Support for ACPI tables that contain no AML code
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2022, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acdisasm.h>
155 #include <contrib/dev/acpica/include/actables.h>
156 #include <contrib/dev/acpica/compiler/aslcompiler.h>
157 
158 /* This module used for application-level code only */
159 
160 #define _COMPONENT          ACPI_CA_DISASSEMBLER
161         ACPI_MODULE_NAME    ("dmtable")
162 
163 const AH_TABLE *
164 AcpiAhGetTableInfo (
165     char                    *Signature);
166 
167 
168 /* Common format strings for commented values */
169 
170 #define UINT8_FORMAT            "%2.2X [%s]\n"
171 #define UINT8_FORMAT_NO_NEWLINE "%2.2X [%s]"
172 #define UINT16_FORMAT           "%4.4X [%s]\n"
173 #define UINT32_FORMAT           "%8.8X [%s]\n"
174 #define STRING_FORMAT           "[%s]\n"
175 
176 /* These tables map a subtable type to a description string */
177 
178 static const char           *AcpiDmAestResourceNames[] =
179 {
180     "Cache Resource",
181     "TLB Resource",
182     "Generic Resource",
183     "Unknown Resource Type"         /* Reserved */
184 };
185 
186 static const char           *AcpiDmAestSubnames[] =
187 {
188     "Processor Error Node",
189     "Memory Error Node",
190     "SMMU Error Node",
191     "Vendor-defined Error Node",
192     "GIC Error Node",
193     "Unknown Subtable Type"         /* Reserved */
194 };
195 
196 static const char           *AcpiDmAestCacheNames[] =
197 {
198     "Data Cache",
199     "Instruction Cache",
200     "Unified Cache",
201     "Unknown Cache Type"            /* Reserved */
202 };
203 
204 static const char           *AcpiDmAestGicNames[] =
205 {
206     "GIC CPU",
207     "GIC Distributor",
208     "GIC Redistributor",
209     "GIC ITS",
210     "Unknown GIC Interface Type"    /* Reserved */
211 };
212 
213 static const char           *AcpiDmAestXfaceNames[] =
214 {
215     "System Register Interface",
216     "Memory Mapped Interface",
217     "Unknown Interface Type"        /* Reserved */
218 };
219 
220 static const char           *AcpiDmAestXruptNames[] =
221 {
222     "Fault Handling Interrupt",
223     "Error Recovery Interrupt",
224     "Unknown Interrupt Type"        /* Reserved */
225 };
226 
227 static const char           *AcpiDmAsfSubnames[] =
228 {
229     "ASF Information",
230     "ASF Alerts",
231     "ASF Remote Control",
232     "ASF RMCP Boot Options",
233     "ASF Address",
234     "Unknown Subtable Type"         /* Reserved */
235 };
236 
237 static const char           *AcpiDmCdatSubnames[] =
238 {
239     "Device Scoped Memory Affinity Structure (DSMAS)",
240     "Device scoped Latency and Bandwidth Information Structure (DSLBIS)",
241     "Device Scoped Memory Side Cache Information Structure (DSMSCIS)",
242     "Device Scoped Initiator Structure (DSIS)",
243     "Device Scoped EFI Memory Type Structure (DSEMTS)",
244     "Switch Scoped Latency and Bandwidth Information Structure (SSLBIS)",
245     "Unknown Subtable Type"         /* Reserved */
246 };
247 
248 static const char           *AcpiDmCedtSubnames[] =
249 {
250     "CXL Host Bridge Structure",
251     "CXL Fixed Memory Window Structure",
252     "Unknown Subtable Type"         /* Reserved */
253 };
254 
255 static const char           *AcpiDmDmarSubnames[] =
256 {
257     "Hardware Unit Definition",
258     "Reserved Memory Region",
259     "Root Port ATS Capability",
260     "Remapping Hardware Static Affinity",
261     "ACPI Namespace Device Declaration",
262     "SoC Integrated Address Translation Cache",
263     "Unknown Subtable Type"         /* Reserved */
264 };
265 
266 static const char           *AcpiDmDmarScope[] =
267 {
268     "Reserved value",
269     "PCI Endpoint Device",
270     "PCI Bridge Device",
271     "IOAPIC Device",
272     "Message-capable HPET Device",
273     "Namespace Device",
274     "Unknown Scope Type"            /* Reserved */
275 };
276 
277 static const char           *AcpiDmEinjActions[] =
278 {
279     "Begin Operation",
280     "Get Trigger Table",
281     "Set Error Type",
282     "Get Error Type",
283     "End Operation",
284     "Execute Operation",
285     "Check Busy Status",
286     "Get Command Status",
287     "Set Error Type With Address",
288     "Get Execute Timings",
289     "Unknown Action"
290 };
291 
292 static const char           *AcpiDmEinjInstructions[] =
293 {
294     "Read Register",
295     "Read Register Value",
296     "Write Register",
297     "Write Register Value",
298     "Noop",
299     "Flush Cacheline",
300     "Unknown Instruction"
301 };
302 
303 static const char           *AcpiDmErstActions[] =
304 {
305     "Begin Write Operation",
306     "Begin Read Operation",
307     "Begin Clear Operation",
308     "End Operation",
309     "Set Record Offset",
310     "Execute Operation",
311     "Check Busy Status",
312     "Get Command Status",
313     "Get Record Identifier",
314     "Set Record Identifier",
315     "Get Record Count",
316     "Begin Dummy Write",
317     "Unused/Unknown Action",
318     "Get Error Address Range",
319     "Get Error Address Length",
320     "Get Error Attributes",
321     "Execute Timings",
322     "Unknown Action"
323 };
324 
325 static const char           *AcpiDmErstInstructions[] =
326 {
327     "Read Register",
328     "Read Register Value",
329     "Write Register",
330     "Write Register Value",
331     "Noop",
332     "Load Var1",
333     "Load Var2",
334     "Store Var1",
335     "Add",
336     "Subtract",
337     "Add Value",
338     "Subtract Value",
339     "Stall",
340     "Stall While True",
341     "Skip Next If True",
342     "GoTo",
343     "Set Source Address",
344     "Set Destination Address",
345     "Move Data",
346     "Unknown Instruction"
347 };
348 
349 static const char           *AcpiDmGtdtSubnames[] =
350 {
351     "Generic Timer Block",
352     "Generic Watchdog Timer",
353     "Unknown Subtable Type"         /* Reserved */
354 };
355 
356 static const char           *AcpiDmHestSubnames[] =
357 {
358     "IA-32 Machine Check Exception",
359     "IA-32 Corrected Machine Check",
360     "IA-32 Non-Maskable Interrupt",
361     "Unknown Subtable Type",        /* 3 - Reserved */
362     "Unknown Subtable Type",        /* 4 - Reserved */
363     "Unknown Subtable Type",        /* 5 - Reserved */
364     "PCI Express Root Port AER",
365     "PCI Express AER (AER Endpoint)",
366     "PCI Express/PCI-X Bridge AER",
367     "Generic Hardware Error Source",
368     "Generic Hardware Error Source V2",
369     "IA-32 Deferred Machine Check",
370     "Unknown Subtable Type"         /* Reserved */
371 };
372 
373 static const char           *AcpiDmHestNotifySubnames[] =
374 {
375     "Polled",
376     "External Interrupt",
377     "Local Interrupt",
378     "SCI",
379     "NMI",
380     "CMCI",                         /* ACPI 5.0 */
381     "MCE",                          /* ACPI 5.0 */
382     "GPIO",                         /* ACPI 6.0 */
383     "SEA",                          /* ACPI 6.1 */
384     "SEI",                          /* ACPI 6.1 */
385     "GSIV",                         /* ACPI 6.1 */
386     "Software Delegated Exception", /* ACPI 6.2 */
387     "Unknown Notify Type"           /* Reserved */
388 };
389 
390 static const char           *AcpiDmHmatSubnames[] =
391 {
392     "Memory Proximity Domain Attributes",
393     "System Locality Latency and Bandwidth Information",
394     "Memory Side Cache Information",
395     "Unknown Structure Type"         /* Reserved */
396 };
397 
398 static const char           *AcpiDmMadtSubnames[] =
399 {
400     "Processor Local APIC",             /* ACPI_MADT_TYPE_LOCAL_APIC */
401     "I/O APIC",                         /* ACPI_MADT_TYPE_IO_APIC */
402     "Interrupt Source Override",        /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
403     "NMI Source",                       /* ACPI_MADT_TYPE_NMI_SOURCE */
404     "Local APIC NMI",                   /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
405     "Local APIC Address Override",      /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
406     "I/O SAPIC",                        /* ACPI_MADT_TYPE_IO_SAPIC */
407     "Local SAPIC",                      /* ACPI_MADT_TYPE_LOCAL_SAPIC */
408     "Platform Interrupt Sources",       /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
409     "Processor Local x2APIC",           /* ACPI_MADT_TYPE_LOCAL_X2APIC */
410     "Local x2APIC NMI",                 /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
411     "Generic Interrupt Controller",     /* ACPI_MADT_GENERIC_INTERRUPT */
412     "Generic Interrupt Distributor",    /* ACPI_MADT_GENERIC_DISTRIBUTOR */
413     "Generic MSI Frame",                /* ACPI_MADT_GENERIC_MSI_FRAME */
414     "Generic Interrupt Redistributor",  /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
415     "Generic Interrupt Translator",     /* ACPI_MADT_GENERIC_TRANSLATOR */
416     "Mutiprocessor Wakeup",             /* ACPI_MADT_TYPE_MULTIPROC_WAKEUP */
417     "CPU Core Interrupt Controller",    /* ACPI_MADT_TYPE_CORE_PIC */
418     "Legacy I/O Interrupt Controller",  /* ACPI_MADT_TYPE_LIO_PIC */
419     "HT Interrupt Controller",          /* ACPI_MADT_TYPE_HT_PIC */
420     "Extend I/O Interrupt Controller",  /* ACPI_MADT_TYPE_EIO_PIC */
421     "MSI Interrupt Controller",         /* ACPI_MADT_TYPE_MSI_PIC */
422     "Bridge I/O Interrupt Controller",  /* ACPI_MADT_TYPE_BIO_PIC */
423     "LPC Interrupt Controller",         /* ACPI_MADT_TYPE_LPC_PIC */
424     "Unknown Subtable Type",            /* Reserved */
425     "Types 80-FF are used for OEM data" /* Reserved for OEM data */
426 };
427 
428 static const char           *AcpiDmNfitSubnames[] =
429 {
430     "System Physical Address Range",    /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
431     "Memory Range Map",                 /* ACPI_NFIT_TYPE_MEMORY_MAP */
432     "Interleave Info",                  /* ACPI_NFIT_TYPE_INTERLEAVE */
433     "SMBIOS Information",               /* ACPI_NFIT_TYPE_SMBIOS */
434     "NVDIMM Control Region",            /* ACPI_NFIT_TYPE_CONTROL_REGION */
435     "NVDIMM Block Data Window Region",  /* ACPI_NFIT_TYPE_DATA_REGION */
436     "Flush Hint Address",               /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
437     "Platform Capabilities",            /* ACPI_NFIT_TYPE_CAPABILITIES */
438     "Unknown Subtable Type"             /* Reserved */
439 };
440 
441 static const char           *AcpiDmNhltLinkTypeNames[] =
442 {
443     "Reserved for HD-Audio",            /* ACPI_NHLT_RESERVED_HD_AUDIO */
444     "Reserved for DSP",                 /* ACPI_NHLT_RESERVED_DSP */
445     "Type PDM",                         /* ACPI_NHLT_PDM */
446     "Type SSP",                         /* ACPI_NHLT_SSP */
447     "Reserved for SlimBus",             /* ACPI_NHLT_RESERVED_SLIMBUS */
448     "Reserved for SoundWire",           /* ACPI_NHLT_RESERVED_SOUNDWIRE */
449     "Unknown Link Type"                 /* Reserved */
450 };
451 
452 static const char           *AcpiDmNhltDirectionNames[] =
453 {
454     "Render",                           /* ACPI_NHLT_DIR_RENDER */
455     "Capture",                          /* ACPI_NHLT_DIR_CAPTURE */
456     "Render with Loopback",             /* ACPI_NHLT_DIR_RENDER_LOOPBACK */
457     "Feedback for Render",              /* ACPI_NHLT_DIR_RENDER_FEEDBACK */
458     "Unknown Direction"                 /* Reserved */
459 };
460 
461 static const char           *AcpiDmNhltMicTypeNames[] =
462 {
463     "Omnidirectional",                  /* ACPI_NHLT_MIC_OMNIDIRECTIONAL */
464     "Subcardioid",                      /* ACPI_NHLT_MIC_SUBCARDIOID */
465     "Cardioid",                         /* ACPI_NHLT_MIC_CARDIOID */
466     "SuperCardioid",                    /* ACPI_NHLT_MIC_SUPER_CARDIOID */
467     "HyperCardioid",                    /* ACPI_NHLT_MIC_HYPER_CARDIOID */
468     "8 Shaped",                         /* ACPI_NHLT_MIC_8_SHAPED */
469     "Reserved Mic Type",                /* Reserved */
470     "Vendor Defined",                   /* ACPI_NHLT_MIC_VENDOR_DEFINED */
471     "Unknown Mic Type"                  /* ACPI_NHLT_MIC_RESERVED */
472 };
473 
474 static const char           *AcpiDmNhltMicPositionNames[] =
475 {
476     "Top",                              /* ACPI_NHLT_MIC_POSITION_TOP */
477     "Bottom",                           /* ACPI_NHLT_MIC_POSITION_BOTTOM */
478     "Left",                             /* ACPI_NHLT_MIC_POSITION_LEFT */
479     "Right",                            /* ACPI_NHLT_MIC_POSITION_RIGHT */
480     "Front",                            /* ACPI_NHLT_MIC_POSITION_FRONT */
481     "Back",                             /* ACPI_NHLT_MIC_POSITION_BACK */
482     "Unknown Mic Position"              /* 6 and above are reserved */
483 };
484 
485 static const char           *AcpiDmNhltMicArrayTypeNames[] =
486 {
487     "Unknown Array Type",               /* ACPI_NHLT_ARRAY_TYPE_RESERVED */
488     "Small Linear 2-element",           /* ACPI_NHLT_SMALL_LINEAR_2ELEMENT */
489     "Big Linear 2-element",             /* ACPI_NHLT_BIG_LINEAR_2ELEMENT */
490     "Linear 4-element 1st Geometry",    /* ACPI_NHLT_FIRST_GEOMETRY_LINEAR_4ELEMENT */
491     "Planar L-shaped 4-element",        /* ACPI_NHLT_PLANAR_LSHAPED_4ELEMENT */
492     "Linear 4-element 2nd Geometry",    /* ACPI_NHLT_SECOND_GEOMETRY_LINEAR_4ELEMENT */
493     "Vendor Defined"                    /* ACPI_NHLT_VENDOR_DEFINED */
494 };
495 
496 static const char           *AcpiDmNhltConfigTypeNames[] =
497 {
498     "Generic Type",                     /* ACPI_NHLT_CONFIG_TYPE_GENERIC */
499     "Microphone Array",                 /* ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY */
500     "Reserved",                         /* ACPI_NHLT_CONFIG_TYPE_RESERVED */
501     "Render Feedback",                  /* ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK */
502     "Unknown Config Type"               /* ACPI_NHLT_CONFIG_TYPE_RESERVED */
503 };
504 
505 static const char           *AcpiDmPcctSubnames[] =
506 {
507     "Generic Communications Subspace",  /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
508     "HW-Reduced Comm Subspace",         /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
509     "HW-Reduced Comm Subspace Type2",   /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
510     "Extended PCC Master Subspace",     /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */
511     "Extended PCC Slave Subspace",      /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */
512     "HW Registers based Comm Subspace", /* ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE */
513     "Unknown Subtable Type"             /* Reserved */
514 };
515 
516 static const char           *AcpiDmPhatSubnames[] =
517 {
518     "Firmware Version Data",        /* ACPI_PHAT_TYPE_FW_VERSION_DATA */
519     "Firmware Health Data",         /* ACPI_PHAT_TYPE_FW_HEALTH_DATA */
520     "Unknown Subtable Type"         /* Reserved */
521 };
522 
523 static const char           *AcpiDmPmttSubnames[] =
524 {
525     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
526     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
527     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM */
528     "Unknown Subtable Type",        /* Reserved */
529     "Vendor Specific"               /* ACPI_PMTT_TYPE_VENDOR */
530 };
531 
532 static const char           *AcpiDmPpttSubnames[] =
533 {
534     "Processor Hierarchy Node",     /* ACPI_PPTT_TYPE_PROCESSOR */
535     "Cache Type",                   /* ACPI_PPTT_TYPE_CACHE */
536     "ID",                           /* ACPI_PPTT_TYPE_ID */
537     "Unknown Subtable Type"         /* Reserved */
538 };
539 
540 static const char           *AcpiDmRgrtSubnames[] =
541 {
542     "Unknown/Reserved Image Type",  /* ACPI_RGRT_TYPE_RESERVED0 */
543     "Type PNG"                      /* ACPI_RGRT_IMAGE_TYPE_PNG */
544 };
545 
546 static const char           *AcpiDmSdevSubnames[] =
547 {
548     "Namespace Device",             /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */
549     "PCIe Endpoint Device",         /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */
550     "Unknown Subtable Type"         /* Reserved */
551 };
552 
553 static const char           *AcpiDmSratSubnames[] =
554 {
555     "Processor Local APIC/SAPIC Affinity",
556     "Memory Affinity",
557     "Processor Local x2APIC Affinity",
558     "GICC Affinity",
559     "GIC ITS Affinity",             /* Acpi 6.2 */
560     "Generic Initiator Affinity",   /* Acpi 6.3 */
561     "Generic Port Affinity",        /* Acpi 6.4 */
562     "Unknown Subtable Type"         /* Reserved */
563 };
564 
565 static const char           *AcpiDmTpm2Subnames[] =
566 {
567     "Illegal Start Method value",
568     "Reserved",
569     "ACPI Start Method",
570     "Reserved",
571     "Reserved",
572     "Reserved",
573     "Memory Mapped I/O",
574     "Command Response Buffer",
575     "Command Response Buffer with ACPI Start Method",
576     "Reserved",
577     "Reserved",
578     "Command Response Buffer with ARM SMC",
579     "Unknown Subtable Type"         /* Reserved */
580 };
581 
582 static const char           *AcpiDmIvrsSubnames[] =
583 {
584     "Hardware Definition Block (IVHD)",
585     "Hardware Definition Block - Mixed Format (IVHD)",
586     "Memory Definition Block (IVMD)",
587     "Unknown/Reserved Subtable Type"            /* Reserved */
588 };
589 
590 static const char           *AcpiDmIvrsDevEntryNames[] =
591 {
592     "Unknown/Reserved Device Entry Type",       /* 0- Reserved */
593     "Device Entry: Select All Devices",         /* 1 */
594     "Device Entry: Select One Device",          /* 2 */
595     "Device Entry: Start of Range",             /* 3 */
596     "Device Entry: End of Range",               /* 4 */
597     "Device Entry: Alias Select",               /* 66 */
598     "Device Entry: Alias Start of Range",       /* 67 */
599     "Unknown/Reserved Device Entry Type",       /* 68- Reserved */
600     "Unknown/Reserved Device Entry Type",       /* 69- Reserved */
601     "Device Entry: Extended Select",            /* 70 */
602     "Device Entry: Extended Start of Range",    /* 71 */
603     "Device Entry: Special Device",             /* 72 */
604     "Device Entry: ACPI HID Named Device",      /* 240 */
605     "Unknown/Reserved Device Entry Type"        /* Reserved */
606 };
607 
608 static const char           *AcpiDmLpitSubnames[] =
609 {
610     "Native C-state Idle Structure",
611     "Unknown Subtable Type"         /* Reserved */
612 };
613 
614 static const char           *AcpiDmViotSubnames[] =
615 {
616     "Unknown Subtable Type",        /* 0 -Reserved */
617     "PCI Range",
618     "MMIO Endpoint",
619     "VirtIO-PCI IOMMU",
620     "VirtIO-MMIO IOMMU",
621     "Unknown Subtable Type"         /* Reserved */
622 };
623 
624 #define ACPI_FADT_PM_RESERVED       9
625 
626 static const char           *AcpiDmFadtProfiles[] =
627 {
628     "Unspecified",
629     "Desktop",
630     "Mobile",
631     "Workstation",
632     "Enterprise Server",
633     "SOHO Server",
634     "Appliance PC",
635     "Performance Server",
636     "Tablet",
637     "Unknown Profile Type"
638 };
639 
640 #define ACPI_GAS_WIDTH_RESERVED     5
641 
642 static const char           *AcpiDmGasAccessWidth[] =
643 {
644     "Undefined/Legacy",
645     "Byte Access:8",
646     "Word Access:16",
647     "DWord Access:32",
648     "QWord Access:64",
649     "Unknown Width Encoding"
650 };
651 
652 
653 /*******************************************************************************
654  *
655  * ACPI Table Data, indexed by signature.
656  *
657  * Each entry contains: Signature, Table Info, Handler, DtHandler,
658  *  Template, Description
659  *
660  * Simple tables have only a TableInfo structure, complex tables have a
661  * handler. This table must be NULL terminated. RSDP and FACS are
662  * special-cased elsewhere.
663  *
664  * Note: Any tables added here should be duplicated within
665  * AcpiGbl_SupportedTables in the file common/ahtable.c
666  *
667  ******************************************************************************/
668 
669 const ACPI_DMTABLE_DATA     AcpiDmTableData[] =
670 {
671     {ACPI_SIG_AEST, NULL,                   AcpiDmDumpAest, DtCompileAest,  TemplateAest},
672     {ACPI_SIG_AGDI, AcpiDmTableInfoAgdi,    NULL,           NULL,           TemplateAgdi},
673     {ACPI_SIG_APMT, NULL,                   AcpiDmDumpApmt, DtCompileApmt,  TemplateApmt},
674     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf},
675     {ACPI_SIG_BDAT, AcpiDmTableInfoBdat,    NULL,           NULL,           TemplateBdat},
676     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert},
677     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt},
678     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot},
679     {ACPI_SIG_CCEL, AcpiDmTableInfoCcel,    NULL,           NULL,           TemplateCcel},
680     {ACPI_SIG_CDAT, NULL,                   AcpiDmDumpCdat, NULL,           TemplateCdat},
681     {ACPI_SIG_CEDT, NULL,                   AcpiDmDumpCedt, DtCompileCedt,  TemplateCedt},
682     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep},
683     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt},
684     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2},
685     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp},
686     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar},
687     {ACPI_SIG_DRTM, NULL,                   AcpiDmDumpDrtm, DtCompileDrtm,  TemplateDrtm},
688     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt},
689     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj},
690     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst},
691     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt},
692     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt},
693     {ACPI_SIG_GTDT, NULL,                   AcpiDmDumpGtdt, DtCompileGtdt,  TemplateGtdt},
694     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest},
695     {ACPI_SIG_HMAT, NULL,                   AcpiDmDumpHmat, DtCompileHmat,  TemplateHmat},
696     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet},
697     {ACPI_SIG_IORT, NULL,                   AcpiDmDumpIort, DtCompileIort,  TemplateIort},
698     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs},
699     {ACPI_SIG_LPIT, NULL,                   AcpiDmDumpLpit, DtCompileLpit,  TemplateLpit},
700     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt},
701     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg},
702     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi},
703     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst},
704     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct},
705     {ACPI_SIG_MSDM, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateMsdm},
706     {ACPI_SIG_NFIT, AcpiDmTableInfoNfit,    AcpiDmDumpNfit, DtCompileNfit,  TemplateNfit},
707     {ACPI_SIG_NHLT, AcpiDmTableInfoNhlt,    AcpiDmDumpNhlt, DtCompileNhlt,  TemplateNhlt},
708     {ACPI_SIG_PCCT, AcpiDmTableInfoPcct,    AcpiDmDumpPcct, DtCompilePcct,  TemplatePcct},
709     {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt,    AcpiDmDumpPdtt, DtCompilePdtt,  TemplatePdtt},
710     {ACPI_SIG_PHAT, NULL,                   AcpiDmDumpPhat, DtCompilePhat,  TemplatePhat},
711     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt},
712     {ACPI_SIG_PPTT, NULL,                   AcpiDmDumpPptt, DtCompilePptt,  TemplatePptt},
713     {ACPI_SIG_PRMT, NULL,                   AcpiDmDumpPrmt, DtCompilePrmt,  TemplatePrmt},
714     {ACPI_SIG_RASF, AcpiDmTableInfoRasf,    NULL,           NULL,           TemplateRasf},
715     {ACPI_SIG_RGRT, NULL,                   AcpiDmDumpRgrt, DtCompileRgrt,  TemplateRgrt},
716     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt},
717     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt},
718     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst},
719     {ACPI_SIG_SDEI, AcpiDmTableInfoSdei,    NULL,           NULL,           TemplateSdei},
720     {ACPI_SIG_SDEV, AcpiDmTableInfoSdev,    AcpiDmDumpSdev, DtCompileSdev,  TemplateSdev},
721     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic},
722     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit},
723     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr},
724     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi},
725     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat},
726     {ACPI_SIG_STAO, NULL,                   AcpiDmDumpStao, DtCompileStao,  TemplateStao},
727     {ACPI_SIG_SVKL, AcpiDmTableInfoSvkl,    AcpiDmDumpSvkl, DtCompileSvkl,  TemplateSvkl},
728     {ACPI_SIG_TCPA, NULL,                   AcpiDmDumpTcpa, DtCompileTcpa,  TemplateTcpa},
729     {ACPI_SIG_TDEL, AcpiDmTableInfoTdel,    NULL,           NULL,           TemplateTdel},
730     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    AcpiDmDumpTpm2, DtCompileTpm2,  TemplateTpm2},
731     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi},
732     {ACPI_SIG_VIOT, AcpiDmTableInfoViot,    AcpiDmDumpViot, DtCompileViot,  TemplateViot},
733     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet},
734     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat},
735     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt},
736     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt},
737     {ACPI_SIG_WPBT, NULL,                   AcpiDmDumpWpbt, DtCompileWpbt,  TemplateWpbt},
738     {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt,    NULL,           NULL,           TemplateWsmt},
739     {ACPI_SIG_XENV, AcpiDmTableInfoXenv,    NULL,           NULL,           TemplateXenv},
740     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt},
741     {NULL,          NULL,                   NULL,           NULL,           NULL}
742 };
743 
744 
745 /*******************************************************************************
746  *
747  * FUNCTION:    AcpiDmGetTableData
748  *
749  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
750  *
751  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
752  *
753  * DESCRIPTION: Find a match in the global table of supported ACPI tables
754  *
755  ******************************************************************************/
756 
757 const ACPI_DMTABLE_DATA *
758 AcpiDmGetTableData (
759     char                    *Signature)
760 {
761     const ACPI_DMTABLE_DATA *Info;
762 
763 
764     for (Info = AcpiDmTableData; Info->Signature; Info++)
765     {
766         if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature))
767         {
768             return (Info);
769         }
770     }
771 
772     return (NULL);
773 }
774 
775 
776 /*******************************************************************************
777  *
778  * FUNCTION:    AcpiDmDumpDataTable
779  *
780  * PARAMETERS:  Table               - An ACPI table
781  *
782  * RETURN:      None.
783  *
784  * DESCRIPTION: Format the contents of an ACPI data table (any table other
785  *              than an SSDT or DSDT that does not contain executable AML code)
786  *
787  ******************************************************************************/
788 
789 void
790 AcpiDmDumpDataTable (
791     ACPI_TABLE_HEADER       *Table)
792 {
793     ACPI_STATUS             Status;
794     const ACPI_DMTABLE_DATA *TableData;
795     UINT32                  Length;
796 
797 
798     /* Ignore tables that contain AML */
799 
800     if (AcpiUtIsAmlTable (Table))
801     {
802         if (AslGbl_VerboseTemplates)
803         {
804             /* Dump the raw table data */
805 
806             Length = Table->Length;
807 
808             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
809                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
810             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
811                 Length, DB_BYTE_DISPLAY, 0);
812             AcpiOsPrintf (" */\n");
813         }
814         return;
815     }
816 
817     /*
818      * Handle tables that don't use the common ACPI table header structure.
819      * Currently, these are the FACS, RSDP, S3PT and CDAT.
820      */
821     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
822     {
823         Length = Table->Length;
824         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
825         if (ACPI_FAILURE (Status))
826         {
827             return;
828         }
829     }
830     else if (ACPI_VALIDATE_RSDP_SIG (ACPI_CAST_PTR (ACPI_TABLE_RSDP,
831         Table)->Signature))
832     {
833         Length = AcpiDmDumpRsdp (Table);
834     }
835     else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT))
836     {
837         Length = AcpiDmDumpS3pt (Table);
838     }
839     else if (!AcpiUtValidNameseg (Table->Signature))
840     {
841         /*
842          * For CDAT we are assuming that there should be at least one non-ASCII
843          * byte in the (normally) 4-character Signature field (at least the
844          * high-order byte should be zero).
845          */
846         if (AcpiGbl_CDAT)
847         {
848             /*
849              * Invalid signature and <-ds CDAT> was specified on the command line.
850              * Therefore, we have a CDAT table.
851              */
852             AcpiDmDumpCdat (Table);
853         }
854         else
855         {
856             fprintf (stderr, "Table has an invalid signature\n");
857         }
858 
859         return;
860     }
861     else
862     {
863         /*
864          * All other tables must use the common ACPI table header, dump it now
865          */
866         Length = Table->Length;
867         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
868         if (ACPI_FAILURE (Status))
869         {
870             return;
871         }
872         AcpiOsPrintf ("\n");
873 
874         /* Match signature and dispatch appropriately */
875 
876         TableData = AcpiDmGetTableData (Table->Signature);
877         if (!TableData)
878         {
879             if (!strncmp (Table->Signature, "OEM", 3))
880             {
881                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
882                     Table->Signature);
883             }
884             else
885             {
886                 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
887                     Table->Signature);
888 
889                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
890                     Table->Signature);
891 
892                 if (!AcpiGbl_ForceAmlDisassembly)
893                 {
894                     fprintf (stderr, "decoding ACPI table header only\n");
895                 }
896                 else
897                 {
898                     fprintf (stderr, "assuming table contains valid AML code\n");
899                 }
900             }
901         }
902         else if (TableData->TableHandler)
903         {
904             /* Complex table, has a handler */
905 
906             TableData->TableHandler (Table);
907         }
908         else if (TableData->TableInfo)
909         {
910             /* Simple table, just walk the info table */
911 
912             Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
913             if (ACPI_FAILURE (Status))
914             {
915                 return;
916             }
917         }
918     }
919 
920     if (!AslGbl_DoTemplates || AslGbl_VerboseTemplates)
921     {
922         /* Dump the raw table data */
923 
924         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
925             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
926         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
927             Length, DB_BYTE_DISPLAY, 0);
928     }
929 }
930 
931 
932 /*******************************************************************************
933  *
934  * FUNCTION:    AcpiDmLineHeader
935  *
936  * PARAMETERS:  Offset              - Current byte offset, from table start
937  *              ByteLength          - Length of the field in bytes, 0 for flags
938  *              Name                - Name of this field
939  *
940  * RETURN:      None
941  *
942  * DESCRIPTION: Utility routines for formatting output lines. Displays the
943  *              current table offset in hex and decimal, the field length,
944  *              and the field name.
945  *
946  ******************************************************************************/
947 
948 void
949 AcpiDmLineHeader (
950     UINT32                  Offset,
951     UINT32                  ByteLength,
952     char                    *Name)
953 {
954 
955     /* Allow a null name for fields that span multiple lines (large buffers) */
956 
957     if (!Name)
958     {
959         Name = "";
960     }
961 
962     if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */
963     {
964         if (ByteLength)
965         {
966             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
967         }
968         else
969         {
970             if (*Name)
971             {
972                 AcpiOsPrintf ("%41s : ", Name);
973             }
974             else
975             {
976                 AcpiOsPrintf ("%41s   ", Name);
977             }
978         }
979     }
980     else /* Normal disassembler or verbose template */
981     {
982         if (ByteLength)
983         {
984             AcpiOsPrintf ("[%3.3Xh %4.4u %3.3Xh] %27s : ",
985                 Offset, Offset, ByteLength, Name);
986         }
987         else
988         {
989             if (*Name)
990             {
991                 AcpiOsPrintf ("%44s : ", Name);
992             }
993             else
994             {
995                 AcpiOsPrintf ("%44s   ", Name);
996             }
997         }
998     }
999 }
1000 
1001 void
1002 AcpiDmLineHeader2 (
1003     UINT32                  Offset,
1004     UINT32                  ByteLength,
1005     char                    *Name,
1006     UINT32                  Value)
1007 {
1008 
1009     if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */
1010     {
1011         if (ByteLength)
1012         {
1013             AcpiOsPrintf ("[%.4d] %30s %3d : ",
1014                 ByteLength, Name, Value);
1015         }
1016         else
1017         {
1018             AcpiOsPrintf ("%36s % 3d : ",
1019                 Name, Value);
1020         }
1021     }
1022     else /* Normal disassembler or verbose template */
1023     {
1024         if (ByteLength)
1025         {
1026             AcpiOsPrintf ("[%3.3Xh %4.4u %3.3Xh] %24s %3d : ",
1027                 Offset, Offset, ByteLength, Name, Value);
1028         }
1029         else
1030         {
1031             AcpiOsPrintf ("[%3.3Xh %4.4u   ] %24s %3d : ",
1032                 Offset, Offset, Name, Value);
1033         }
1034     }
1035 }
1036 
1037 
1038 /*******************************************************************************
1039  *
1040  * FUNCTION:    AcpiDmDumpTable
1041  *
1042  * PARAMETERS:  TableLength         - Length of the entire ACPI table
1043  *              TableOffset         - Starting offset within the table for this
1044  *                                    sub-descriptor (0 if main table)
1045  *              Table               - The ACPI table
1046  *              SubtableLength      - Length of this sub-descriptor
1047  *              Info                - Info table for this ACPI table
1048  *
1049  * RETURN:      Status
1050  *
1051  * DESCRIPTION: Display ACPI table contents by walking the Info table.
1052  *
1053  * Note: This function must remain in sync with DtGetFieldLength.
1054  *
1055  ******************************************************************************/
1056 
1057 ACPI_STATUS
1058 AcpiDmDumpTable (
1059     UINT32                  TableLength,
1060     UINT32                  TableOffset,
1061     void                    *Table,
1062     UINT32                  SubtableLength,
1063     ACPI_DMTABLE_INFO       *Info)
1064 {
1065     UINT8                   *Target;
1066     UINT32                  CurrentOffset;
1067     UINT32                  ByteLength;
1068     UINT8                   Temp8;
1069     UINT16                  Temp16;
1070     UINT32                  Temp32;
1071     UINT64                  Value;
1072     const AH_TABLE          *TableData;
1073     const char              *Name;
1074     BOOLEAN                 LastOutputBlankLine = FALSE;
1075     ACPI_STATUS             Status;
1076     char                    RepairedName[8];
1077 
1078 
1079     if (!Info)
1080     {
1081         AcpiOsPrintf ("Display not implemented\n");
1082         return (AE_NOT_IMPLEMENTED);
1083     }
1084 
1085     /* Walk entire Info table; Null name terminates */
1086 
1087     for (; Info->Name; Info++)
1088     {
1089         /*
1090          * Target points to the field within the ACPI Table. CurrentOffset is
1091          * the offset of the field from the start of the main table.
1092          */
1093         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
1094         CurrentOffset = TableOffset + Info->Offset;
1095 
1096         /* Check for beyond subtable end or (worse) beyond EOT */
1097 
1098         if (SubtableLength && (Info->Offset > SubtableLength))
1099         {
1100             AcpiOsPrintf (
1101                 "/**** ACPI subtable terminates early (Len %u) - "
1102                 "may be older version (dump table) */\n", SubtableLength);
1103 
1104             /* Move on to next subtable */
1105 
1106             return (AE_OK);
1107         }
1108 
1109         if (CurrentOffset >= TableLength)
1110         {
1111             AcpiOsPrintf (
1112                 "/**** ACPI table terminates "
1113                 "in the middle of a data structure! (dump table) \n"
1114                 "CurrentOffset: %X, TableLength: %X ***/", CurrentOffset, TableLength);
1115             return (AE_BAD_DATA);
1116         }
1117 
1118         /* Generate the byte length for this field */
1119 
1120         switch (Info->Opcode)
1121         {
1122         case ACPI_DMT_UINT8:
1123         case ACPI_DMT_CHKSUM:
1124         case ACPI_DMT_SPACEID:
1125         case ACPI_DMT_ACCWIDTH:
1126         case ACPI_DMT_CEDT:
1127         case ACPI_DMT_IVRS:
1128         case ACPI_DMT_IVRS_DE:
1129         case ACPI_DMT_GTDT:
1130         case ACPI_DMT_MADT:
1131         case ACPI_DMT_NHLT1:
1132         case ACPI_DMT_NHLT1a:
1133         case ACPI_DMT_NHLT1b:
1134         case ACPI_DMT_NHLT1c:
1135         case ACPI_DMT_NHLT1d:
1136         case ACPI_DMT_NHLT1f:
1137         case ACPI_DMT_PCCT:
1138         case ACPI_DMT_PMTT:
1139         case ACPI_DMT_PPTT:
1140         case ACPI_DMT_RGRT:
1141         case ACPI_DMT_SDEV:
1142         case ACPI_DMT_SRAT:
1143         case ACPI_DMT_AEST:
1144         case ACPI_DMT_AEST_RES:
1145         case ACPI_DMT_AEST_XFACE:
1146         case ACPI_DMT_AEST_XRUPT:
1147         case ACPI_DMT_ASF:
1148         case ACPI_DMT_CDAT:
1149         case ACPI_DMT_HESTNTYP:
1150         case ACPI_DMT_FADTPM:
1151         case ACPI_DMT_EINJACT:
1152         case ACPI_DMT_EINJINST:
1153         case ACPI_DMT_ERSTACT:
1154         case ACPI_DMT_ERSTINST:
1155         case ACPI_DMT_DMAR_SCOPE:
1156         case ACPI_DMT_VIOT:
1157 
1158             ByteLength = 1;
1159             break;
1160 
1161         case ACPI_DMT_UINT16:
1162         case ACPI_DMT_DMAR:
1163         case ACPI_DMT_HEST:
1164         case ACPI_DMT_HMAT:
1165         case ACPI_DMT_NFIT:
1166         case ACPI_DMT_NHLT1e:
1167         case ACPI_DMT_PHAT:
1168 
1169             ByteLength = 2;
1170             break;
1171 
1172         case ACPI_DMT_UINT24:
1173 
1174             ByteLength = 3;
1175             break;
1176 
1177         case ACPI_DMT_UINT32:
1178         case ACPI_DMT_AEST_CACHE:
1179         case ACPI_DMT_AEST_GIC:
1180         case ACPI_DMT_NAME4:
1181         case ACPI_DMT_SIG:
1182         case ACPI_DMT_LPIT:
1183         case ACPI_DMT_TPM2:
1184 
1185             ByteLength = 4;
1186             break;
1187 
1188         case ACPI_DMT_UINT40:
1189 
1190             ByteLength = 5;
1191             break;
1192 
1193         case ACPI_DMT_UINT48:
1194         case ACPI_DMT_NAME6:
1195 
1196             ByteLength = 6;
1197             break;
1198 
1199         case ACPI_DMT_UINT56:
1200         case ACPI_DMT_BUF7:
1201 
1202             ByteLength = 7;
1203             break;
1204 
1205         case ACPI_DMT_UINT64:
1206         case ACPI_DMT_NAME8:
1207 
1208             ByteLength = 8;
1209             break;
1210 
1211         case ACPI_DMT_BUF10:
1212 
1213             ByteLength = 10;
1214             break;
1215 
1216         case ACPI_DMT_BUF12:
1217 
1218             ByteLength = 12;
1219             break;
1220 
1221         case ACPI_DMT_BUF16:
1222         case ACPI_DMT_UUID:
1223 
1224             ByteLength = 16;
1225             break;
1226 
1227         case ACPI_DMT_BUF18:
1228 
1229             ByteLength = 18;
1230             break;
1231 
1232         case ACPI_DMT_BUF128:
1233 
1234             ByteLength = 128;
1235             break;
1236 
1237         case ACPI_DMT_WPBT_UNICODE:
1238 
1239             ByteLength = SubtableLength;
1240             CurrentOffset = sizeof (ACPI_TABLE_WPBT);
1241             break;
1242 
1243         case ACPI_DMT_UNICODE:
1244         case ACPI_DMT_BUFFER:
1245         case ACPI_DMT_RAW_BUFFER:
1246 
1247             ByteLength = SubtableLength;
1248             break;
1249 
1250         case ACPI_DMT_PMTT_VENDOR:
1251             /*
1252              * Calculate the length of the vendor data for the PMTT table:
1253              * Length = (Current Subtable ptr + Subtable length) -
1254              *          Start of the vendor data (Target)
1255              */
1256             ByteLength = ((ACPI_CAST_PTR (char, Table) +
1257                             (ACPI_CAST_PTR (ACPI_PMTT_HEADER, Table)->Length)) -
1258                             ACPI_CAST_PTR (char, Target));
1259             break;
1260 
1261         case ACPI_DMT_STRING:
1262 
1263             ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
1264             break;
1265 
1266         case ACPI_DMT_IVRS_UNTERMINATED_STRING:
1267 
1268             ByteLength = ((ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, Target) -1)->UidLength);
1269             break;
1270 
1271         case ACPI_DMT_GAS:
1272 
1273             if (!LastOutputBlankLine)
1274             {
1275                 AcpiOsPrintf ("\n");
1276                 LastOutputBlankLine = TRUE;
1277             }
1278 
1279             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
1280             break;
1281 
1282         case ACPI_DMT_HESTNTFY:
1283 
1284             if (!LastOutputBlankLine)
1285             {
1286                 AcpiOsPrintf ("\n");
1287                 LastOutputBlankLine = TRUE;
1288             }
1289 
1290             ByteLength = sizeof (ACPI_HEST_NOTIFY);
1291             break;
1292 
1293         case ACPI_DMT_IORTMEM:
1294 
1295             if (!LastOutputBlankLine)
1296             {
1297                 LastOutputBlankLine = FALSE;
1298             }
1299 
1300             ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
1301             break;
1302 
1303         default:
1304 
1305             ByteLength = 0;
1306             break;
1307         }
1308 
1309         /* Check if we are beyond a subtable, or (worse) beyond EOT */
1310 
1311         if (CurrentOffset + ByteLength > TableLength)
1312         {
1313             if (SubtableLength)
1314             {
1315                 AcpiOsPrintf (
1316                     "/**** ACPI subtable terminates early - "
1317                     "may be older version (dump table) */\n");
1318 
1319                 /* Move on to next subtable */
1320 
1321                 return (AE_OK);
1322             }
1323 
1324             AcpiOsPrintf (
1325                 "/**** ACPI table terminates "
1326                 "in the middle of a data structure! */\n");
1327             return (AE_BAD_DATA);
1328         }
1329 
1330         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
1331         {
1332             AcpiOsPrintf ("%s", Info->Name);
1333             continue;
1334         }
1335 
1336         /* Start a new line and decode the opcode */
1337 
1338         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
1339 
1340         switch (Info->Opcode)
1341         {
1342         /* Single-bit Flag fields. Note: Opcode is the bit position */
1343 
1344         case ACPI_DMT_FLAG0:
1345         case ACPI_DMT_FLAG1:
1346         case ACPI_DMT_FLAG2:
1347         case ACPI_DMT_FLAG3:
1348         case ACPI_DMT_FLAG4:
1349         case ACPI_DMT_FLAG5:
1350         case ACPI_DMT_FLAG6:
1351         case ACPI_DMT_FLAG7:
1352 
1353             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
1354             break;
1355 
1356         /* 2-bit Flag fields */
1357 
1358         case ACPI_DMT_FLAGS0:
1359 
1360             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
1361             break;
1362 
1363         case ACPI_DMT_FLAGS1:
1364 
1365             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
1366             break;
1367 
1368         case ACPI_DMT_FLAGS2:
1369 
1370             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
1371             break;
1372 
1373         case ACPI_DMT_FLAGS8_2:
1374 
1375             AcpiOsPrintf ("%2.2X\n", (*Target >> 2) & 0xFF);
1376             break;
1377 
1378 	case ACPI_DMT_FLAGS4:
1379 
1380             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
1381             break;
1382 
1383         case ACPI_DMT_FLAGS4_0:
1384 
1385             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target) & 0x0F);
1386             break;
1387 
1388         case ACPI_DMT_FLAGS4_4:
1389 
1390             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 4) & 0x0F);
1391             break;
1392 
1393         case ACPI_DMT_FLAGS4_8:
1394 
1395             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 8) & 0x0F);
1396             break;
1397 
1398         case ACPI_DMT_FLAGS4_12:
1399 
1400             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 12) & 0x0F);
1401             break;
1402 
1403         case ACPI_DMT_FLAGS16_16:
1404 
1405             AcpiOsPrintf ("%4.4X\n", (*(UINT32 *)Target >> 16) & 0xFFFF);
1406             break;
1407 
1408         /* Integer Data Types */
1409 
1410         case ACPI_DMT_UINT8:
1411         case ACPI_DMT_UINT16:
1412         case ACPI_DMT_UINT24:
1413         case ACPI_DMT_UINT32:
1414         case ACPI_DMT_UINT40:
1415         case ACPI_DMT_UINT48:
1416         case ACPI_DMT_UINT56:
1417         case ACPI_DMT_UINT64:
1418             /*
1419              * Dump bytes - high byte first, low byte last.
1420              * Note: All ACPI tables are little-endian.
1421              */
1422             Value = 0;
1423             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1424             {
1425                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1426                 Value |= Target[Temp8 - 1];
1427                 Value <<= 8;
1428             }
1429 
1430             if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1431             {
1432                 AcpiOsPrintf (" [Optional field not present]");
1433             }
1434 
1435             AcpiOsPrintf ("\n");
1436             break;
1437 
1438         case ACPI_DMT_BUF7:
1439         case ACPI_DMT_BUF10:
1440         case ACPI_DMT_BUF12:
1441         case ACPI_DMT_BUF16:
1442         case ACPI_DMT_BUF18:
1443         case ACPI_DMT_BUF128:
1444             /*
1445              * Buffer: Size depends on the opcode and was set above.
1446              * Each hex byte is separated with a space.
1447              * Multiple lines are separated by line continuation char.
1448              */
1449             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1450             {
1451                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1452                 if ((UINT32) (Temp16 + 1) < ByteLength)
1453                 {
1454                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1455                     {
1456                         AcpiOsPrintf (" \\\n"); /* Line continuation */
1457                         AcpiDmLineHeader (0, 0, NULL);
1458                     }
1459                     else
1460                     {
1461                         AcpiOsPrintf (" ");
1462                     }
1463                 }
1464             }
1465 
1466             AcpiOsPrintf ("\n");
1467             break;
1468 
1469         case ACPI_DMT_UUID:
1470 
1471             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1472 
1473             (void) AcpiUtConvertUuidToString ((char *) Target, AslGbl_MsgBuffer);
1474 
1475             AcpiOsPrintf ("%s\n", AslGbl_MsgBuffer);
1476             break;
1477 
1478         case ACPI_DMT_STRING:
1479 
1480             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1481             break;
1482 
1483         case ACPI_DMT_IVRS_UNTERMINATED_STRING:
1484 
1485             AcpiOsPrintf ("\"%.*s\"\n", ByteLength, ACPI_CAST_PTR (char, Target));
1486             break;
1487 
1488         /* Fixed length ASCII name fields */
1489 
1490         case ACPI_DMT_SIG:
1491 
1492             AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1493             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
1494 
1495             TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1496             if (TableData)
1497             {
1498                 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1499             }
1500             else
1501             {
1502                 AcpiOsPrintf ("\n");
1503             }
1504             break;
1505 
1506         case ACPI_DMT_NAME4:
1507 
1508             AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1509             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1510             break;
1511 
1512         case ACPI_DMT_NAME6:
1513 
1514             AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
1515             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1516             break;
1517 
1518         case ACPI_DMT_NAME8:
1519 
1520             AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
1521             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1522             break;
1523 
1524         /* Special Data Types */
1525 
1526         case ACPI_DMT_CHKSUM:
1527 
1528             /* Checksum, display and validate */
1529 
1530             AcpiOsPrintf ("%2.2X", *Target);
1531             Temp8 = AcpiUtGenerateChecksum (Table,
1532                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1533                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1534 
1535             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1536             {
1537                 AcpiOsPrintf (
1538                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
1539             }
1540 
1541             AcpiOsPrintf ("\n");
1542             break;
1543 
1544         case ACPI_DMT_SPACEID:
1545 
1546             /* Address Space ID */
1547 
1548             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1549             break;
1550 
1551         case ACPI_DMT_ACCWIDTH:
1552 
1553             /* Encoded Access Width */
1554 
1555             Temp8 = *Target;
1556             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1557             {
1558                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1559             }
1560 
1561             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1562             break;
1563 
1564         case ACPI_DMT_GAS:
1565 
1566             /* Generic Address Structure */
1567 
1568             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1569             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1570                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1571             if (ACPI_FAILURE (Status))
1572             {
1573                 return (Status);
1574             }
1575 
1576             AcpiOsPrintf ("\n");
1577             LastOutputBlankLine = TRUE;
1578             break;
1579 
1580         case ACPI_DMT_AEST:
1581 
1582             /* AEST subtable types */
1583 
1584             Temp8 = *Target;
1585             if (Temp8 > ACPI_AEST_NODE_TYPE_RESERVED)
1586             {
1587                 Temp8 = ACPI_AEST_NODE_TYPE_RESERVED;
1588             }
1589 
1590             AcpiOsPrintf (UINT8_FORMAT, *Target,
1591                 AcpiDmAestSubnames[Temp8]);
1592             break;
1593 
1594         case ACPI_DMT_AEST_CACHE:
1595 
1596             /* AEST cache resource subtable */
1597 
1598             Temp32 = *Target;
1599             if (Temp32 > ACPI_AEST_CACHE_RESERVED)
1600             {
1601                 Temp32 = ACPI_AEST_CACHE_RESERVED;
1602             }
1603 
1604             AcpiOsPrintf (UINT32_FORMAT, *Target,
1605                 AcpiDmAestCacheNames[Temp32]);
1606             break;
1607 
1608         case ACPI_DMT_AEST_GIC:
1609 
1610             /* AEST GIC error subtable */
1611 
1612             Temp32 = *Target;
1613             if (Temp32 > ACPI_AEST_GIC_RESERVED)
1614             {
1615                 Temp32 = ACPI_AEST_GIC_RESERVED;
1616             }
1617 
1618             AcpiOsPrintf (UINT32_FORMAT, *Target,
1619                 AcpiDmAestGicNames[Temp32]);
1620             break;
1621 
1622         case ACPI_DMT_AEST_RES:
1623 
1624             /* AEST resource type subtable */
1625 
1626             Temp8 = *Target;
1627             if (Temp8 > ACPI_AEST_RESOURCE_RESERVED)
1628             {
1629                 Temp8 = ACPI_AEST_RESOURCE_RESERVED;
1630             }
1631 
1632             AcpiOsPrintf (UINT8_FORMAT, *Target,
1633                 AcpiDmAestResourceNames[Temp8]);
1634             break;
1635 
1636         case ACPI_DMT_AEST_XFACE:
1637 
1638             /* AEST interface structure types */
1639 
1640             Temp8 = *Target;
1641             if (Temp8 > ACPI_AEST_XFACE_RESERVED)
1642             {
1643                 Temp8 = ACPI_AEST_XFACE_RESERVED;
1644             }
1645 
1646             AcpiOsPrintf (UINT8_FORMAT, *Target,
1647                 AcpiDmAestXfaceNames[Temp8]);
1648             break;
1649 
1650         case ACPI_DMT_AEST_XRUPT:
1651 
1652             /* AEST interrupt structure types */
1653 
1654             Temp8 = *Target;
1655             if (Temp8 > ACPI_AEST_XRUPT_RESERVED)
1656             {
1657                 Temp8 = ACPI_AEST_XRUPT_RESERVED;
1658             }
1659 
1660             AcpiOsPrintf (UINT8_FORMAT, *Target,
1661                 AcpiDmAestXruptNames[Temp8]);
1662             break;
1663 
1664         case ACPI_DMT_ASF:
1665 
1666             /* ASF subtable types */
1667 
1668             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
1669             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1670             {
1671                 Temp16 = ACPI_ASF_TYPE_RESERVED;
1672             }
1673 
1674             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1675             break;
1676 
1677         case ACPI_DMT_CDAT:
1678 
1679             /* CDAT subtable types */
1680 
1681             Temp8 = *Target;
1682             if (Temp8 > ACPI_CDAT_TYPE_RESERVED)
1683             {
1684                 Temp8 = ACPI_CDAT_TYPE_RESERVED;
1685             }
1686 
1687             AcpiOsPrintf (UINT8_FORMAT, *Target,
1688                 AcpiDmCdatSubnames[Temp8]);
1689             break;
1690 
1691         case ACPI_DMT_CEDT:
1692 
1693             /* CEDT subtable types */
1694 
1695             Temp8 = *Target;
1696             if (Temp8 > ACPI_CEDT_TYPE_RESERVED)
1697             {
1698                 Temp8 = ACPI_CEDT_TYPE_RESERVED;
1699             }
1700 
1701             AcpiOsPrintf (UINT8_FORMAT, *Target,
1702                 AcpiDmCedtSubnames[Temp8]);
1703             break;
1704 
1705         case ACPI_DMT_DMAR:
1706 
1707             /* DMAR subtable types */
1708 
1709             Temp16 = ACPI_GET16 (Target);
1710             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1711             {
1712                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1713             }
1714 
1715             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1716                 AcpiDmDmarSubnames[Temp16]);
1717             break;
1718 
1719         case ACPI_DMT_DMAR_SCOPE:
1720 
1721             /* DMAR device scope types */
1722 
1723             Temp8 = *Target;
1724             if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1725             {
1726                 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1727             }
1728 
1729             AcpiOsPrintf (UINT8_FORMAT, *Target,
1730                 AcpiDmDmarScope[Temp8]);
1731             break;
1732 
1733         case ACPI_DMT_EINJACT:
1734 
1735             /* EINJ Action types */
1736 
1737             Temp8 = *Target;
1738             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1739             {
1740                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1741             }
1742 
1743             AcpiOsPrintf (UINT8_FORMAT, *Target,
1744                 AcpiDmEinjActions[Temp8]);
1745             break;
1746 
1747         case ACPI_DMT_EINJINST:
1748 
1749             /* EINJ Instruction types */
1750 
1751             Temp8 = *Target;
1752             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1753             {
1754                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1755             }
1756 
1757             AcpiOsPrintf (UINT8_FORMAT, *Target,
1758                 AcpiDmEinjInstructions[Temp8]);
1759             break;
1760 
1761         case ACPI_DMT_ERSTACT:
1762 
1763             /* ERST Action types */
1764 
1765             Temp8 = *Target;
1766             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1767             {
1768                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1769             }
1770 
1771             AcpiOsPrintf (UINT8_FORMAT, *Target,
1772                 AcpiDmErstActions[Temp8]);
1773             break;
1774 
1775         case ACPI_DMT_ERSTINST:
1776 
1777             /* ERST Instruction types */
1778 
1779             Temp8 = *Target;
1780             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1781             {
1782                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1783             }
1784 
1785             AcpiOsPrintf (UINT8_FORMAT, *Target,
1786                 AcpiDmErstInstructions[Temp8]);
1787             break;
1788 
1789         case ACPI_DMT_GTDT:
1790 
1791             /* GTDT subtable types */
1792 
1793             Temp8 = *Target;
1794             if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1795             {
1796                 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1797             }
1798 
1799             AcpiOsPrintf (UINT8_FORMAT, *Target,
1800                 AcpiDmGtdtSubnames[Temp8]);
1801             break;
1802 
1803         case ACPI_DMT_HEST:
1804 
1805             /* HEST subtable types */
1806 
1807             Temp16 = ACPI_GET16 (Target);
1808             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1809             {
1810                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1811             }
1812 
1813             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1814                 AcpiDmHestSubnames[Temp16]);
1815             break;
1816 
1817         case ACPI_DMT_HESTNTFY:
1818 
1819             AcpiOsPrintf (STRING_FORMAT,
1820                 "Hardware Error Notification Structure");
1821 
1822             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1823                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1824             if (ACPI_FAILURE (Status))
1825             {
1826                 return (Status);
1827             }
1828 
1829             AcpiOsPrintf ("\n");
1830             LastOutputBlankLine = TRUE;
1831             break;
1832 
1833         case ACPI_DMT_HESTNTYP:
1834 
1835             /* HEST Notify types */
1836 
1837             Temp8 = *Target;
1838             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1839             {
1840                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1841             }
1842 
1843             AcpiOsPrintf (UINT8_FORMAT, *Target,
1844                 AcpiDmHestNotifySubnames[Temp8]);
1845             break;
1846 
1847         case ACPI_DMT_HMAT:
1848 
1849             /* HMAT subtable types */
1850 
1851             Temp16 = *Target;
1852             if (Temp16 > ACPI_HMAT_TYPE_RESERVED)
1853             {
1854                 Temp16 = ACPI_HMAT_TYPE_RESERVED;
1855             }
1856 
1857             AcpiOsPrintf (UINT16_FORMAT, *Target,
1858                 AcpiDmHmatSubnames[Temp16]);
1859             break;
1860 
1861         case ACPI_DMT_IORTMEM:
1862 
1863             AcpiOsPrintf (STRING_FORMAT,
1864                 "IORT Memory Access Properties");
1865 
1866             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1867                 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1868             if (ACPI_FAILURE (Status))
1869             {
1870                 return (Status);
1871             }
1872 
1873             LastOutputBlankLine = TRUE;
1874             break;
1875 
1876         case ACPI_DMT_MADT:
1877 
1878             /* MADT subtable types */
1879 
1880             Temp8 = *Target;
1881             if ((Temp8 >= ACPI_MADT_TYPE_RESERVED) && (Temp8 < ACPI_MADT_TYPE_OEM_RESERVED))
1882             {
1883                 Temp8 = ACPI_MADT_TYPE_RESERVED;
1884             }
1885             else if (Temp8 >= ACPI_MADT_TYPE_OEM_RESERVED)
1886             {
1887                 Temp8 = ACPI_MADT_TYPE_RESERVED + 1;
1888             }
1889             AcpiOsPrintf (UINT8_FORMAT, *Target,
1890                 AcpiDmMadtSubnames[Temp8]);
1891             break;
1892 
1893         case ACPI_DMT_NFIT:
1894 
1895             /* NFIT subtable types */
1896 
1897             Temp16 = ACPI_GET16 (Target);
1898             if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1899             {
1900                 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1901             }
1902 
1903             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1904                 AcpiDmNfitSubnames[Temp16]);
1905             break;
1906 
1907         case ACPI_DMT_NHLT1:
1908 
1909             /* NHLT link types */
1910 
1911             Temp8 = *Target;
1912             if (Temp8 > ACPI_NHLT_TYPE_RESERVED)
1913             {
1914                 Temp8 = ACPI_NHLT_TYPE_RESERVED;
1915             }
1916 
1917             AcpiOsPrintf (UINT8_FORMAT, *Target,
1918                 AcpiDmNhltLinkTypeNames[Temp8]);
1919             break;
1920 
1921         case ACPI_DMT_NHLT1a:
1922 
1923             /* NHLT direction */
1924 
1925             Temp8 = *Target;
1926             if (Temp8 > ACPI_NHLT_DIR_RESERVED)
1927             {
1928                 Temp8 = ACPI_NHLT_DIR_RESERVED;
1929             }
1930 
1931             AcpiOsPrintf (UINT8_FORMAT, *Target,
1932                 AcpiDmNhltDirectionNames[Temp8]);
1933             break;
1934 
1935         case ACPI_DMT_NHLT1b:
1936 
1937             /* NHLT microphone type */
1938 
1939             Temp8 = *Target;
1940             if (Temp8 > ACPI_NHLT_MIC_RESERVED)
1941             {
1942                 Temp8 = ACPI_NHLT_MIC_RESERVED;
1943             }
1944 
1945             AcpiOsPrintf (UINT8_FORMAT, *Target,
1946                 AcpiDmNhltMicTypeNames[Temp8]);
1947             break;
1948 
1949         case ACPI_DMT_NHLT1c:
1950 
1951             /* NHLT microphone position */
1952 
1953             Temp8 = *Target;
1954             if (Temp8 > ACPI_NHLT_MIC_POSITION_RESERVED)
1955             {
1956                 Temp8 = ACPI_NHLT_MIC_POSITION_RESERVED;
1957             }
1958 
1959             AcpiOsPrintf (UINT8_FORMAT, *Target,
1960                 AcpiDmNhltMicPositionNames[Temp8]);
1961             break;
1962 
1963         case ACPI_DMT_NHLT1d:
1964 
1965             /* NHLT microphone array type */
1966 
1967             Temp8 = *Target & ACPI_NHLT_ARRAY_TYPE_MASK;
1968             if (Temp8 < ACPI_NHLT_ARRAY_TYPE_RESERVED)
1969             {
1970                 Temp8 = ACPI_NHLT_ARRAY_TYPE_RESERVED;
1971             }
1972 
1973             AcpiOsPrintf (UINT8_FORMAT_NO_NEWLINE, *Target,
1974                 AcpiDmNhltMicArrayTypeNames[Temp8 - ACPI_NHLT_ARRAY_TYPE_RESERVED]);
1975 
1976             Temp8 = *Target;
1977             if (Temp8 & ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT)
1978             {
1979                 AcpiOsPrintf (" [%s]", "SNR and Sensitivity");
1980             }
1981 
1982             AcpiOsPrintf ("\n");
1983             break;
1984 
1985         case ACPI_DMT_NHLT1e:
1986 
1987             /* NHLT Endpoint Device ID */
1988 
1989             Temp16 = ACPI_GET16 (Target);
1990             if (Temp16 == 0xAE20)
1991             {
1992                 Name = "PDM DMIC";
1993             }
1994             else if (Temp16 == 0xAE30)
1995             {
1996                 Name = "BT Sideband";
1997             }
1998             else if (Temp16 == 0xAE34)
1999             {
2000                 Name = "I2S/TDM Codecs";
2001             }
2002             else
2003             {
2004                 Name = "Unknown Device ID";
2005             }
2006 
2007             AcpiOsPrintf (UINT16_FORMAT, Temp16, Name);
2008             break;
2009 
2010         case ACPI_DMT_NHLT1f:
2011 
2012             /* NHLT ConfigType field */
2013 
2014             Temp8 = *Target;
2015             if (Temp8 > ACPI_NHLT_CONFIG_TYPE_RESERVED)
2016             {
2017                 Temp8 = ACPI_NHLT_CONFIG_TYPE_RESERVED;
2018             }
2019 
2020             AcpiOsPrintf (UINT8_FORMAT, *Target,
2021                 AcpiDmNhltConfigTypeNames[Temp8]);
2022             break;
2023 
2024         case ACPI_DMT_PCCT:
2025 
2026             /* PCCT subtable types */
2027 
2028             Temp8 = *Target;
2029             if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
2030             {
2031                 Temp8 = ACPI_PCCT_TYPE_RESERVED;
2032             }
2033 
2034             AcpiOsPrintf (UINT8_FORMAT, *Target,
2035                 AcpiDmPcctSubnames[Temp8]);
2036             break;
2037 
2038         case ACPI_DMT_PHAT:
2039 
2040             /* PHAT subtable types */
2041 
2042             Temp16 = ACPI_GET16 (Target);
2043             if (Temp16 > ACPI_PHAT_TYPE_RESERVED)
2044             {
2045                 Temp16 = ACPI_PHAT_TYPE_RESERVED;
2046             }
2047 
2048             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2049                 AcpiDmPhatSubnames[Temp16]);
2050             break;
2051 
2052         case ACPI_DMT_PMTT:
2053 
2054             /* PMTT subtable types */
2055 
2056             Temp8 = *Target;
2057             if (Temp8 == ACPI_PMTT_TYPE_VENDOR)
2058             {
2059                 Temp8 = ACPI_PMTT_TYPE_RESERVED + 1;
2060             }
2061             else if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
2062             {
2063                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
2064             }
2065             AcpiOsPrintf (UINT8_FORMAT, *Target,
2066                 AcpiDmPmttSubnames[Temp8]);
2067             break;
2068 
2069         case ACPI_DMT_PPTT:
2070 
2071             /* PPTT subtable types */
2072 
2073             Temp8 = *Target;
2074             if (Temp8 > ACPI_PPTT_TYPE_RESERVED)
2075             {
2076                 Temp8 = ACPI_PPTT_TYPE_RESERVED;
2077             }
2078 
2079             AcpiOsPrintf (UINT8_FORMAT, *Target,
2080                 AcpiDmPpttSubnames[Temp8]);
2081             break;
2082 
2083         case ACPI_DMT_UNICODE:
2084         case ACPI_DMT_WPBT_UNICODE:
2085 
2086             if (ByteLength == 0)
2087             {
2088                 AcpiOsPrintf ("/* Zero-length Data */\n");
2089                 break;
2090             }
2091 
2092             AcpiDmDumpUnicode (Table, 0, ByteLength);
2093             break;
2094 
2095         case ACPI_DMT_RAW_BUFFER:
2096         case ACPI_DMT_BUFFER:
2097         case ACPI_DMT_PMTT_VENDOR:
2098 
2099             if (ByteLength == 0)
2100             {
2101                 AcpiOsPrintf ("/* Zero-length Data */\n");
2102                 break;
2103             }
2104 
2105             AcpiDmDumpBuffer (Target, 0, ByteLength, CurrentOffset, NULL);
2106             break;
2107 
2108         case ACPI_DMT_RGRT:
2109 
2110             /* RGRT subtable types */
2111 
2112             Temp8 = *Target;
2113             if (Temp8 >= ACPI_RGRT_TYPE_RESERVED)
2114             {
2115                 Temp8 = ACPI_RGRT_TYPE_RESERVED0;
2116             }
2117 
2118             AcpiOsPrintf (UINT8_FORMAT, *Target,
2119                 AcpiDmRgrtSubnames[Temp8]);
2120             break;
2121 
2122         case ACPI_DMT_SDEV:
2123 
2124             /* SDEV subtable types */
2125 
2126             Temp8 = *Target;
2127             if (Temp8 > ACPI_SDEV_TYPE_RESERVED)
2128             {
2129                 Temp8 = ACPI_SDEV_TYPE_RESERVED;
2130             }
2131 
2132             AcpiOsPrintf (UINT8_FORMAT, *Target,
2133                 AcpiDmSdevSubnames[Temp8]);
2134             break;
2135 
2136         case ACPI_DMT_SRAT:
2137 
2138             /* SRAT subtable types */
2139 
2140             Temp8 = *Target;
2141             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
2142             {
2143                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
2144             }
2145 
2146             AcpiOsPrintf (UINT8_FORMAT, *Target,
2147                 AcpiDmSratSubnames[Temp8]);
2148             break;
2149 
2150         case ACPI_DMT_TPM2:
2151 
2152             /* TPM2 Start Method types */
2153 
2154             Temp8 = *Target;
2155             if (Temp8 > ACPI_TPM2_RESERVED)
2156             {
2157                 Temp8 = ACPI_TPM2_RESERVED;
2158             }
2159 
2160             AcpiOsPrintf (UINT8_FORMAT, *Target,
2161                 AcpiDmTpm2Subnames[Temp8]);
2162             break;
2163 
2164 
2165         case ACPI_DMT_FADTPM:
2166 
2167             /* FADT Preferred PM Profile names */
2168 
2169             Temp8 = *Target;
2170             if (Temp8 > ACPI_FADT_PM_RESERVED)
2171             {
2172                 Temp8 = ACPI_FADT_PM_RESERVED;
2173             }
2174 
2175             AcpiOsPrintf (UINT8_FORMAT, *Target,
2176                 AcpiDmFadtProfiles[Temp8]);
2177             break;
2178 
2179         case ACPI_DMT_IVRS:
2180 
2181             /* IVRS subtable types */
2182 
2183             Temp8 = *Target;
2184             switch (Temp8)
2185             {
2186             case ACPI_IVRS_TYPE_HARDWARE1:
2187             case ACPI_IVRS_TYPE_HARDWARE2:
2188 
2189                 Name = AcpiDmIvrsSubnames[0];
2190                 break;
2191 
2192             case ACPI_IVRS_TYPE_HARDWARE3:
2193 
2194                 Name = AcpiDmIvrsSubnames[1];
2195                 break;
2196 
2197             case ACPI_IVRS_TYPE_MEMORY1:
2198             case ACPI_IVRS_TYPE_MEMORY2:
2199             case ACPI_IVRS_TYPE_MEMORY3:
2200 
2201                 Name = AcpiDmIvrsSubnames[2];
2202                 break;
2203 
2204             default:
2205 
2206                 Name = AcpiDmIvrsSubnames[3];
2207                 break;
2208             }
2209 
2210             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
2211             break;
2212 
2213         case ACPI_DMT_IVRS_DE:
2214 
2215             /* IVRS device entry types */
2216 
2217             Temp8 = *Target;
2218             switch (Temp8)
2219             {
2220             case ACPI_IVRS_TYPE_ALL:
2221             case ACPI_IVRS_TYPE_SELECT:
2222             case ACPI_IVRS_TYPE_START:
2223             case ACPI_IVRS_TYPE_END:
2224 
2225                 Name = AcpiDmIvrsDevEntryNames[Temp8];
2226                 break;
2227 
2228             case ACPI_IVRS_TYPE_ALIAS_SELECT:
2229             case ACPI_IVRS_TYPE_ALIAS_START:
2230             case ACPI_IVRS_TYPE_EXT_SELECT:
2231             case ACPI_IVRS_TYPE_EXT_START:
2232             case ACPI_IVRS_TYPE_SPECIAL:
2233 
2234                 Name = AcpiDmIvrsDevEntryNames[Temp8 - 61];
2235                 break;
2236 
2237             case ACPI_IVRS_TYPE_HID:
2238 
2239                 Name = AcpiDmIvrsDevEntryNames[Temp8 - 228];
2240                 break;
2241 
2242             default:
2243                 Name = AcpiDmIvrsDevEntryNames[0];  /* Unknown/Reserved */
2244                 break;
2245             }
2246 
2247             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
2248             break;
2249 
2250         case ACPI_DMT_LPIT:
2251 
2252             /* LPIT subtable types */
2253 
2254             Temp32 = ACPI_GET32 (Target);
2255             if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
2256             {
2257                 Temp32 = ACPI_LPIT_TYPE_RESERVED;
2258             }
2259 
2260             AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
2261                 AcpiDmLpitSubnames[Temp32]);
2262             break;
2263 
2264         case ACPI_DMT_VIOT:
2265 
2266             /* VIOT subtable types */
2267 
2268             Temp8 = *Target;
2269             if (Temp8 > ACPI_VIOT_RESERVED)
2270             {
2271                 Temp8 = ACPI_VIOT_RESERVED;
2272             }
2273 
2274             AcpiOsPrintf (UINT8_FORMAT, *Target,
2275                 AcpiDmViotSubnames[Temp8]);
2276             break;
2277 
2278         case ACPI_DMT_EXIT:
2279 
2280             return (AE_OK);
2281 
2282         default:
2283 
2284             ACPI_ERROR ((AE_INFO,
2285                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
2286             return (AE_SUPPORT);
2287         }
2288     }
2289 
2290     if (TableOffset && !SubtableLength)
2291     {
2292         /*
2293          * If this table is not the main table, the subtable must have a
2294          * valid length
2295          */
2296         AcpiOsPrintf ("Invalid zero length subtable\n");
2297         return (AE_BAD_DATA);
2298     }
2299 
2300     return (AE_OK);
2301 }
2302