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 - 2023, 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 "acpi.h"
153 #include "accommon.h"
154 #include "acdisasm.h"
155 #include "actables.h"
156 #include "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           *AcpiDmAsptSubnames[] =
238 {
239     "ASPT Global Registers",
240     "ASPT SEV Mailbox Registers",
241     "ASPT ACPI Mailbox Registers",
242     "Unknown Subtable Type"         /* Reserved */
243 };
244 
245 static const char           *AcpiDmCdatSubnames[] =
246 {
247     "Device Scoped Memory Affinity Structure (DSMAS)",
248     "Device scoped Latency and Bandwidth Information Structure (DSLBIS)",
249     "Device Scoped Memory Side Cache Information Structure (DSMSCIS)",
250     "Device Scoped Initiator Structure (DSIS)",
251     "Device Scoped EFI Memory Type Structure (DSEMTS)",
252     "Switch Scoped Latency and Bandwidth Information Structure (SSLBIS)",
253     "Unknown Subtable Type"         /* Reserved */
254 };
255 
256 static const char           *AcpiDmCedtSubnames[] =
257 {
258     "CXL Host Bridge Structure",
259     "CXL Fixed Memory Window Structure",
260     "Unknown Subtable Type"         /* Reserved */
261 };
262 
263 static const char           *AcpiDmDmarSubnames[] =
264 {
265     "Hardware Unit Definition",
266     "Reserved Memory Region",
267     "Root Port ATS Capability",
268     "Remapping Hardware Static Affinity",
269     "ACPI Namespace Device Declaration",
270     "SoC Integrated Address Translation Cache",
271     "Unknown Subtable Type"         /* Reserved */
272 };
273 
274 static const char           *AcpiDmDmarScope[] =
275 {
276     "Reserved value",
277     "PCI Endpoint Device",
278     "PCI Bridge Device",
279     "IOAPIC Device",
280     "Message-capable HPET Device",
281     "Namespace Device",
282     "Unknown Scope Type"            /* Reserved */
283 };
284 
285 static const char           *AcpiDmEinjActions[] =
286 {
287     "Begin Operation",
288     "Get Trigger Table",
289     "Set Error Type",
290     "Get Error Type",
291     "End Operation",
292     "Execute Operation",
293     "Check Busy Status",
294     "Get Command Status",
295     "Set Error Type With Address",
296     "Get Execute Timings",
297     "Unknown Action"
298 };
299 
300 static const char           *AcpiDmEinjInstructions[] =
301 {
302     "Read Register",
303     "Read Register Value",
304     "Write Register",
305     "Write Register Value",
306     "Noop",
307     "Flush Cacheline",
308     "Unknown Instruction"
309 };
310 
311 static const char           *AcpiDmErstActions[] =
312 {
313     "Begin Write Operation",
314     "Begin Read Operation",
315     "Begin Clear Operation",
316     "End Operation",
317     "Set Record Offset",
318     "Execute Operation",
319     "Check Busy Status",
320     "Get Command Status",
321     "Get Record Identifier",
322     "Set Record Identifier",
323     "Get Record Count",
324     "Begin Dummy Write",
325     "Unused/Unknown Action",
326     "Get Error Address Range",
327     "Get Error Address Length",
328     "Get Error Attributes",
329     "Execute Timings",
330     "Unknown Action"
331 };
332 
333 static const char           *AcpiDmErstInstructions[] =
334 {
335     "Read Register",
336     "Read Register Value",
337     "Write Register",
338     "Write Register Value",
339     "Noop",
340     "Load Var1",
341     "Load Var2",
342     "Store Var1",
343     "Add",
344     "Subtract",
345     "Add Value",
346     "Subtract Value",
347     "Stall",
348     "Stall While True",
349     "Skip Next If True",
350     "GoTo",
351     "Set Source Address",
352     "Set Destination Address",
353     "Move Data",
354     "Unknown Instruction"
355 };
356 
357 static const char           *AcpiDmGtdtSubnames[] =
358 {
359     "Generic Timer Block",
360     "Generic Watchdog Timer",
361     "Unknown Subtable Type"         /* Reserved */
362 };
363 
364 static const char           *AcpiDmHestSubnames[] =
365 {
366     "IA-32 Machine Check Exception",
367     "IA-32 Corrected Machine Check",
368     "IA-32 Non-Maskable Interrupt",
369     "Unknown Subtable Type",        /* 3 - Reserved */
370     "Unknown Subtable Type",        /* 4 - Reserved */
371     "Unknown Subtable Type",        /* 5 - Reserved */
372     "PCI Express Root Port AER",
373     "PCI Express AER (AER Endpoint)",
374     "PCI Express/PCI-X Bridge AER",
375     "Generic Hardware Error Source",
376     "Generic Hardware Error Source V2",
377     "IA-32 Deferred Machine Check",
378     "Unknown Subtable Type"         /* Reserved */
379 };
380 
381 static const char           *AcpiDmHestNotifySubnames[] =
382 {
383     "Polled",
384     "External Interrupt",
385     "Local Interrupt",
386     "SCI",
387     "NMI",
388     "CMCI",                         /* ACPI 5.0 */
389     "MCE",                          /* ACPI 5.0 */
390     "GPIO",                         /* ACPI 6.0 */
391     "SEA",                          /* ACPI 6.1 */
392     "SEI",                          /* ACPI 6.1 */
393     "GSIV",                         /* ACPI 6.1 */
394     "Software Delegated Exception", /* ACPI 6.2 */
395     "Unknown Notify Type"           /* Reserved */
396 };
397 
398 static const char           *AcpiDmHmatSubnames[] =
399 {
400     "Memory Proximity Domain Attributes",
401     "System Locality Latency and Bandwidth Information",
402     "Memory Side Cache Information",
403     "Unknown Structure Type"         /* Reserved */
404 };
405 
406 static const char           *AcpiDmMadtSubnames[] =
407 {
408     "Processor Local APIC",             /* ACPI_MADT_TYPE_LOCAL_APIC */
409     "I/O APIC",                         /* ACPI_MADT_TYPE_IO_APIC */
410     "Interrupt Source Override",        /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
411     "NMI Source",                       /* ACPI_MADT_TYPE_NMI_SOURCE */
412     "Local APIC NMI",                   /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
413     "Local APIC Address Override",      /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
414     "I/O SAPIC",                        /* ACPI_MADT_TYPE_IO_SAPIC */
415     "Local SAPIC",                      /* ACPI_MADT_TYPE_LOCAL_SAPIC */
416     "Platform Interrupt Sources",       /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
417     "Processor Local x2APIC",           /* ACPI_MADT_TYPE_LOCAL_X2APIC */
418     "Local x2APIC NMI",                 /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
419     "Generic Interrupt Controller",     /* ACPI_MADT_GENERIC_INTERRUPT */
420     "Generic Interrupt Distributor",    /* ACPI_MADT_GENERIC_DISTRIBUTOR */
421     "Generic MSI Frame",                /* ACPI_MADT_GENERIC_MSI_FRAME */
422     "Generic Interrupt Redistributor",  /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
423     "Generic Interrupt Translator",     /* ACPI_MADT_GENERIC_TRANSLATOR */
424     "Mutiprocessor Wakeup",             /* ACPI_MADT_TYPE_MULTIPROC_WAKEUP */
425     "CPU Core Interrupt Controller",    /* ACPI_MADT_TYPE_CORE_PIC */
426     "Legacy I/O Interrupt Controller",  /* ACPI_MADT_TYPE_LIO_PIC */
427     "HT Interrupt Controller",          /* ACPI_MADT_TYPE_HT_PIC */
428     "Extend I/O Interrupt Controller",  /* ACPI_MADT_TYPE_EIO_PIC */
429     "MSI Interrupt Controller",         /* ACPI_MADT_TYPE_MSI_PIC */
430     "Bridge I/O Interrupt Controller",  /* ACPI_MADT_TYPE_BIO_PIC */
431     "LPC Interrupt Controller",         /* ACPI_MADT_TYPE_LPC_PIC */
432     "RISC-V Interrupt Controller",      /* ACPI_MADT_TYPE_RINTC */
433     "RISC-V Incoming MSI Controller",   /* ACPI_MADT_TYPE_IMSIC */
434     "RISC-V APLIC Controller",          /* ACPI_MADT_TYPE_APLIC */
435     "RISC-V PLIC Controller",           /* ACPI_MADT_TYPE_PLIC */
436     "Unknown Subtable Type",            /* Reserved */
437     "Types 80-FF are used for OEM data" /* Reserved for OEM data */
438 };
439 
440 static const char           *AcpiDmMpamSubnames[] =
441 {
442     "Processor cache",      /* ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE */
443     "Memory",               /* ACPI_MPAM_LOCATION_TYPE_MEMORY */
444     "SMMU",                 /* ACPI_MPAM_LOCATION_TYPE_SMMU */
445     "Memory-side cache",    /* ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE */
446     "ACPI device",          /* ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE */
447     "Interconnect",         /* ACPI_MPAM_LOCATION_TYPE_INTERCONNECT */
448     "Unknown"               /* ACPI_MPAM_LOCATION_TYPE_UNKNOWN */
449 };
450 
451 static const char           *AcpiDmNfitSubnames[] =
452 {
453     "System Physical Address Range",    /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
454     "Memory Range Map",                 /* ACPI_NFIT_TYPE_MEMORY_MAP */
455     "Interleave Info",                  /* ACPI_NFIT_TYPE_INTERLEAVE */
456     "SMBIOS Information",               /* ACPI_NFIT_TYPE_SMBIOS */
457     "NVDIMM Control Region",            /* ACPI_NFIT_TYPE_CONTROL_REGION */
458     "NVDIMM Block Data Window Region",  /* ACPI_NFIT_TYPE_DATA_REGION */
459     "Flush Hint Address",               /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
460     "Platform Capabilities",            /* ACPI_NFIT_TYPE_CAPABILITIES */
461     "Unknown Subtable Type"             /* Reserved */
462 };
463 
464 static const char           *AcpiDmPcctSubnames[] =
465 {
466     "Generic Communications Subspace",  /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
467     "HW-Reduced Comm Subspace",         /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
468     "HW-Reduced Comm Subspace Type2",   /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
469     "Extended PCC Master Subspace",     /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */
470     "Extended PCC Slave Subspace",      /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */
471     "HW Registers based Comm Subspace", /* ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE */
472     "Unknown Subtable Type"             /* Reserved */
473 };
474 
475 static const char           *AcpiDmPhatSubnames[] =
476 {
477     "Firmware Version Data",        /* ACPI_PHAT_TYPE_FW_VERSION_DATA */
478     "Firmware Health Data",         /* ACPI_PHAT_TYPE_FW_HEALTH_DATA */
479     "Unknown Subtable Type"         /* Reserved */
480 };
481 
482 static const char           *AcpiDmPmttSubnames[] =
483 {
484     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
485     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
486     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM */
487     "Unknown Subtable Type",        /* Reserved */
488     "Vendor Specific"               /* ACPI_PMTT_TYPE_VENDOR */
489 };
490 
491 static const char           *AcpiDmPpttSubnames[] =
492 {
493     "Processor Hierarchy Node",     /* ACPI_PPTT_TYPE_PROCESSOR */
494     "Cache Type",                   /* ACPI_PPTT_TYPE_CACHE */
495     "ID",                           /* ACPI_PPTT_TYPE_ID */
496     "Unknown Subtable Type"         /* Reserved */
497 };
498 
499 static const char           *AcpiDmRgrtSubnames[] =
500 {
501     "Unknown/Reserved Image Type",  /* ACPI_RGRT_TYPE_RESERVED0 */
502     "Type PNG"                      /* ACPI_RGRT_IMAGE_TYPE_PNG */
503 };
504 
505 static const char           *AcpiDmSdevSubnames[] =
506 {
507     "Namespace Device",             /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */
508     "PCIe Endpoint Device",         /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */
509     "Unknown Subtable Type"         /* Reserved */
510 };
511 
512 static const char           *AcpiDmSratSubnames[] =
513 {
514     "Processor Local APIC/SAPIC Affinity",
515     "Memory Affinity",
516     "Processor Local x2APIC Affinity",
517     "GICC Affinity",
518     "GIC ITS Affinity",             /* Acpi 6.2 */
519     "Generic Initiator Affinity",   /* Acpi 6.3 */
520     "Generic Port Affinity",        /* Acpi 6.4 */
521     "Unknown Subtable Type"         /* Reserved */
522 };
523 
524 static const char           *AcpiDmTpm2Subnames[] =
525 {
526     "Illegal Start Method value",
527     "Reserved",
528     "ACPI Start Method",
529     "Reserved",
530     "Reserved",
531     "Reserved",
532     "Memory Mapped I/O",
533     "Command Response Buffer",
534     "Command Response Buffer with ACPI Start Method",
535     "Reserved",
536     "Reserved",
537     "Command Response Buffer with ARM SMC",
538     "Unknown Subtable Type"         /* Reserved */
539 };
540 
541 static const char           *AcpiDmIvrsSubnames[] =
542 {
543     "Hardware Definition Block (IVHD)",
544     "Hardware Definition Block - Mixed Format (IVHD)",
545     "Memory Definition Block (IVMD)",
546     "Unknown/Reserved Subtable Type"            /* Reserved */
547 };
548 
549 static const char           *AcpiDmIvrsDevEntryNames[] =
550 {
551     "Unknown/Reserved Device Entry Type",       /* 0- Reserved */
552     "Device Entry: Select All Devices",         /* 1 */
553     "Device Entry: Select One Device",          /* 2 */
554     "Device Entry: Start of Range",             /* 3 */
555     "Device Entry: End of Range",               /* 4 */
556     "Device Entry: Alias Select",               /* 66 */
557     "Device Entry: Alias Start of Range",       /* 67 */
558     "Unknown/Reserved Device Entry Type",       /* 68- Reserved */
559     "Unknown/Reserved Device Entry Type",       /* 69- Reserved */
560     "Device Entry: Extended Select",            /* 70 */
561     "Device Entry: Extended Start of Range",    /* 71 */
562     "Device Entry: Special Device",             /* 72 */
563     "Device Entry: ACPI HID Named Device",      /* 240 */
564     "Unknown/Reserved Device Entry Type"        /* Reserved */
565 };
566 
567 static const char           *AcpiDmLpitSubnames[] =
568 {
569     "Native C-state Idle Structure",
570     "Unknown Subtable Type"         /* Reserved */
571 };
572 
573 static const char           *AcpiDmViotSubnames[] =
574 {
575     "Unknown Subtable Type",        /* 0 -Reserved */
576     "PCI Range",
577     "MMIO Endpoint",
578     "VirtIO-PCI IOMMU",
579     "VirtIO-MMIO IOMMU",
580     "Unknown Subtable Type"         /* Reserved */
581 };
582 
583 #define ACPI_FADT_PM_RESERVED       9
584 
585 static const char           *AcpiDmFadtProfiles[] =
586 {
587     "Unspecified",
588     "Desktop",
589     "Mobile",
590     "Workstation",
591     "Enterprise Server",
592     "SOHO Server",
593     "Appliance PC",
594     "Performance Server",
595     "Tablet",
596     "Unknown Profile Type"
597 };
598 
599 #define ACPI_GAS_WIDTH_RESERVED     5
600 
601 static const char           *AcpiDmGasAccessWidth[] =
602 {
603     "Undefined/Legacy",
604     "Byte Access:8",
605     "Word Access:16",
606     "DWord Access:32",
607     "QWord Access:64",
608     "Unknown Width Encoding"
609 };
610 
611 static const char           *AcpiDmRhctSubnames[] =
612 {
613     "RISC-V ISA string structure",  /* ACPI_RHCT_ISA_STRING */
614     "RISC-V CMO node structure",    /* ACPI_RHCT_CMO_NODE */
615     "RISC-V MMU node structure",    /* ACPI_RHCT_MMU_NODE */
616     "RISC-V Hart Info structure",   /* ACPI_RHCT_HART_INFO */
617 };
618 
619 
620 /*******************************************************************************
621  *
622  * ACPI Table Data, indexed by signature.
623  *
624  * Each entry contains: Signature, Table Info, Handler, DtHandler,
625  *  Template, Description
626  *
627  * Simple tables have only a TableInfo structure, complex tables have a
628  * handler. This table must be NULL terminated. RSDP and FACS are
629  * special-cased elsewhere.
630  *
631  * Note: Any tables added here should be duplicated within
632  * AcpiGbl_SupportedTables in the file common/ahtable.c
633  *
634  ******************************************************************************/
635 
636 const ACPI_DMTABLE_DATA     AcpiDmTableData[] =
637 {
638     {ACPI_SIG_AEST, NULL,                   AcpiDmDumpAest, DtCompileAest,  TemplateAest},
639     {ACPI_SIG_AGDI, AcpiDmTableInfoAgdi,    NULL,           NULL,           TemplateAgdi},
640     {ACPI_SIG_APMT, NULL,                   AcpiDmDumpApmt, DtCompileApmt,  TemplateApmt},
641     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf},
642     {ACPI_SIG_ASPT, NULL,                   AcpiDmDumpAspt, DtCompileAspt,  TemplateAspt},
643     {ACPI_SIG_BDAT, AcpiDmTableInfoBdat,    NULL,           NULL,           TemplateBdat},
644     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert},
645     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt},
646     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot},
647     {ACPI_SIG_CCEL, AcpiDmTableInfoCcel,    NULL,           NULL,           TemplateCcel},
648     {ACPI_SIG_CDAT, NULL,                   AcpiDmDumpCdat, NULL,           TemplateCdat},
649     {ACPI_SIG_CEDT, NULL,                   AcpiDmDumpCedt, DtCompileCedt,  TemplateCedt},
650     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep},
651     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt},
652     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2},
653     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp},
654     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar},
655     {ACPI_SIG_DRTM, NULL,                   AcpiDmDumpDrtm, DtCompileDrtm,  TemplateDrtm},
656     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt},
657     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj},
658     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst},
659     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt},
660     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt},
661     {ACPI_SIG_GTDT, NULL,                   AcpiDmDumpGtdt, DtCompileGtdt,  TemplateGtdt},
662     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest},
663     {ACPI_SIG_HMAT, NULL,                   AcpiDmDumpHmat, DtCompileHmat,  TemplateHmat},
664     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet},
665     {ACPI_SIG_IORT, NULL,                   AcpiDmDumpIort, DtCompileIort,  TemplateIort},
666     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs},
667     {ACPI_SIG_LPIT, NULL,                   AcpiDmDumpLpit, DtCompileLpit,  TemplateLpit},
668     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt},
669     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg},
670     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi},
671     {ACPI_SIG_MPAM, NULL,                   AcpiDmDumpMpam, DtCompileMpam,  TemplateMpam},
672     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst},
673     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct},
674     {ACPI_SIG_MSDM, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateMsdm},
675     {ACPI_SIG_NFIT, AcpiDmTableInfoNfit,    AcpiDmDumpNfit, DtCompileNfit,  TemplateNfit},
676     {ACPI_SIG_NHLT, NULL,                   NULL,           NULL,           NULL},
677     {ACPI_SIG_PCCT, AcpiDmTableInfoPcct,    AcpiDmDumpPcct, DtCompilePcct,  TemplatePcct},
678     {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt,    AcpiDmDumpPdtt, DtCompilePdtt,  TemplatePdtt},
679     {ACPI_SIG_PHAT, NULL,                   AcpiDmDumpPhat, DtCompilePhat,  TemplatePhat},
680     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt},
681     {ACPI_SIG_PPTT, NULL,                   AcpiDmDumpPptt, DtCompilePptt,  TemplatePptt},
682     {ACPI_SIG_PRMT, NULL,                   AcpiDmDumpPrmt, DtCompilePrmt,  TemplatePrmt},
683     {ACPI_SIG_RASF, AcpiDmTableInfoRasf,    NULL,           NULL,           TemplateRasf},
684     {ACPI_SIG_RAS2, AcpiDmTableInfoRas2,    AcpiDmDumpRas2, DtCompileRas2,  TemplateRas2},
685     {ACPI_SIG_RGRT, NULL,                   AcpiDmDumpRgrt, DtCompileRgrt,  TemplateRgrt},
686     {ACPI_SIG_RHCT, NULL,                   AcpiDmDumpRhct, DtCompileRhct,  TemplateRhct},
687     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt},
688     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt},
689     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst},
690     {ACPI_SIG_SDEI, AcpiDmTableInfoSdei,    NULL,           NULL,           TemplateSdei},
691     {ACPI_SIG_SDEV, AcpiDmTableInfoSdev,    AcpiDmDumpSdev, DtCompileSdev,  TemplateSdev},
692     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic},
693     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit},
694     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr},
695     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi},
696     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat},
697     {ACPI_SIG_STAO, NULL,                   AcpiDmDumpStao, DtCompileStao,  TemplateStao},
698     {ACPI_SIG_SVKL, AcpiDmTableInfoSvkl,    AcpiDmDumpSvkl, DtCompileSvkl,  TemplateSvkl},
699     {ACPI_SIG_TCPA, NULL,                   AcpiDmDumpTcpa, DtCompileTcpa,  TemplateTcpa},
700     {ACPI_SIG_TDEL, AcpiDmTableInfoTdel,    NULL,           NULL,           TemplateTdel},
701     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    AcpiDmDumpTpm2, DtCompileTpm2,  TemplateTpm2},
702     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi},
703     {ACPI_SIG_VIOT, AcpiDmTableInfoViot,    AcpiDmDumpViot, DtCompileViot,  TemplateViot},
704     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet},
705     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat},
706     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt},
707     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt},
708     {ACPI_SIG_WPBT, NULL,                   AcpiDmDumpWpbt, DtCompileWpbt,  TemplateWpbt},
709     {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt,    NULL,           NULL,           TemplateWsmt},
710     {ACPI_SIG_XENV, AcpiDmTableInfoXenv,    NULL,           NULL,           TemplateXenv},
711     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt},
712     {NULL,          NULL,                   NULL,           NULL,           NULL}
713 };
714 
715 
716 /*******************************************************************************
717  *
718  * FUNCTION:    AcpiDmGetTableData
719  *
720  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
721  *
722  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
723  *
724  * DESCRIPTION: Find a match in the global table of supported ACPI tables
725  *
726  ******************************************************************************/
727 
728 const ACPI_DMTABLE_DATA *
AcpiDmGetTableData(char * Signature)729 AcpiDmGetTableData (
730     char                    *Signature)
731 {
732     const ACPI_DMTABLE_DATA *Info;
733 
734 
735     for (Info = AcpiDmTableData; Info->Signature; Info++)
736     {
737         if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature))
738         {
739             return (Info);
740         }
741     }
742 
743     return (NULL);
744 }
745 
746 
747 /*******************************************************************************
748  *
749  * FUNCTION:    AcpiDmDumpDataTable
750  *
751  * PARAMETERS:  Table               - An ACPI table
752  *
753  * RETURN:      None.
754  *
755  * DESCRIPTION: Format the contents of an ACPI data table (any table other
756  *              than an SSDT or DSDT that does not contain executable AML code)
757  *
758  ******************************************************************************/
759 
760 void
AcpiDmDumpDataTable(ACPI_TABLE_HEADER * Table)761 AcpiDmDumpDataTable (
762     ACPI_TABLE_HEADER       *Table)
763 {
764     ACPI_STATUS             Status;
765     const ACPI_DMTABLE_DATA *TableData;
766     UINT32                  Length;
767 
768 
769     /* Ignore tables that contain AML */
770 
771     if (AcpiUtIsAmlTable (Table))
772     {
773         if (AslGbl_VerboseTemplates)
774         {
775             /* Dump the raw table data */
776 
777             Length = Table->Length;
778 
779             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
780                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
781             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
782                 Length, DB_BYTE_DISPLAY, 0);
783             AcpiOsPrintf (" */\n");
784         }
785         return;
786     }
787 
788     /*
789      * Handle tables that don't use the common ACPI table header structure.
790      * Currently, these are the FACS, RSDP, S3PT and CDAT.
791      */
792     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
793     {
794         Length = Table->Length;
795         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
796         if (ACPI_FAILURE (Status))
797         {
798             return;
799         }
800     }
801     else if (ACPI_VALIDATE_RSDP_SIG (ACPI_CAST_PTR (ACPI_TABLE_RSDP,
802         Table)->Signature))
803     {
804         Length = AcpiDmDumpRsdp (Table);
805     }
806     else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT))
807     {
808         Length = AcpiDmDumpS3pt (Table);
809     }
810     else if (!AcpiUtValidNameseg (Table->Signature))
811     {
812         /*
813          * For CDAT we are assuming that there should be at least one non-ASCII
814          * byte in the (normally) 4-character Signature field (at least the
815          * high-order byte should be zero).
816          */
817         if (AcpiGbl_CDAT)
818         {
819             /*
820              * Invalid signature and <-ds CDAT> was specified on the command line.
821              * Therefore, we have a CDAT table.
822              */
823             AcpiDmDumpCdat (Table);
824         }
825         else
826         {
827             fprintf (stderr, "Table has an invalid signature\n");
828         }
829 
830         return;
831     }
832     else
833     {
834         /*
835          * All other tables must use the common ACPI table header, dump it now
836          */
837         Length = Table->Length;
838         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
839         if (ACPI_FAILURE (Status))
840         {
841             return;
842         }
843         AcpiOsPrintf ("\n");
844 
845         /* Match signature and dispatch appropriately */
846 
847         TableData = AcpiDmGetTableData (Table->Signature);
848         if (!TableData)
849         {
850             if (!strncmp (Table->Signature, "OEM", 3))
851             {
852                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
853                     Table->Signature);
854             }
855             else
856             {
857                 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
858                     Table->Signature);
859 
860                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
861                     Table->Signature);
862 
863                 if (!AcpiGbl_ForceAmlDisassembly)
864                 {
865                     fprintf (stderr, "decoding ACPI table header only\n");
866                 }
867                 else
868                 {
869                     fprintf (stderr, "assuming table contains valid AML code\n");
870                 }
871             }
872         }
873         else if (TableData->TableHandler)
874         {
875             /* Complex table, has a handler */
876 
877             TableData->TableHandler (Table);
878         }
879         else if (TableData->TableInfo)
880         {
881             /* Simple table, just walk the info table */
882 
883             Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
884             if (ACPI_FAILURE (Status))
885             {
886                 return;
887             }
888         }
889     }
890 
891     if (!AslGbl_DoTemplates || AslGbl_VerboseTemplates)
892     {
893         /* Dump the raw table data */
894 
895         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
896             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
897         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
898             Length, DB_BYTE_DISPLAY, 0);
899     }
900 }
901 
902 
903 /*******************************************************************************
904  *
905  * FUNCTION:    AcpiDmLineHeader
906  *
907  * PARAMETERS:  Offset              - Current byte offset, from table start
908  *              ByteLength          - Length of the field in bytes, 0 for flags
909  *              Name                - Name of this field
910  *
911  * RETURN:      None
912  *
913  * DESCRIPTION: Utility routines for formatting output lines. Displays the
914  *              current table offset in hex and decimal, the field length,
915  *              and the field name.
916  *
917  ******************************************************************************/
918 
919 void
AcpiDmLineHeader(UINT32 Offset,UINT32 ByteLength,char * Name)920 AcpiDmLineHeader (
921     UINT32                  Offset,
922     UINT32                  ByteLength,
923     char                    *Name)
924 {
925 
926     /* Allow a null name for fields that span multiple lines (large buffers) */
927 
928     if (!Name)
929     {
930         Name = "";
931     }
932 
933     if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */
934     {
935         if (ByteLength)
936         {
937             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
938         }
939         else
940         {
941             if (*Name)
942             {
943                 AcpiOsPrintf ("%41s : ", Name);
944             }
945             else
946             {
947                 AcpiOsPrintf ("%41s   ", Name);
948             }
949         }
950     }
951     else /* Normal disassembler or verbose template */
952     {
953         if (ByteLength)
954         {
955             AcpiOsPrintf ("[%3.3Xh %4.4u %3.3Xh] %27s : ",
956                 Offset, Offset, ByteLength, Name);
957         }
958         else
959         {
960             if (*Name)
961             {
962                 AcpiOsPrintf ("%44s : ", Name);
963             }
964             else
965             {
966                 AcpiOsPrintf ("%44s   ", Name);
967             }
968         }
969     }
970 }
971 
972 void
AcpiDmLineHeader2(UINT32 Offset,UINT32 ByteLength,char * Name,UINT32 Value)973 AcpiDmLineHeader2 (
974     UINT32                  Offset,
975     UINT32                  ByteLength,
976     char                    *Name,
977     UINT32                  Value)
978 {
979 
980     if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */
981     {
982         if (ByteLength)
983         {
984             AcpiOsPrintf ("[%.4d] %30s %3d : ",
985                 ByteLength, Name, Value);
986         }
987         else
988         {
989             AcpiOsPrintf ("%36s % 3d : ",
990                 Name, Value);
991         }
992     }
993     else /* Normal disassembler or verbose template */
994     {
995         if (ByteLength)
996         {
997             AcpiOsPrintf ("[%3.3Xh %4.4u %3.3Xh] %24s %3d : ",
998                 Offset, Offset, ByteLength, Name, Value);
999         }
1000         else
1001         {
1002             AcpiOsPrintf ("[%3.3Xh %4.4u   ] %24s %3d : ",
1003                 Offset, Offset, Name, Value);
1004         }
1005     }
1006 }
1007 
1008 
1009 /*******************************************************************************
1010  *
1011  * FUNCTION:    AcpiDmDumpTable
1012  *
1013  * PARAMETERS:  TableLength         - Length of the entire ACPI table
1014  *              TableOffset         - Starting offset within the table for this
1015  *                                    sub-descriptor (0 if main table)
1016  *              Table               - The ACPI table
1017  *              SubtableLength      - Length of this sub-descriptor
1018  *              Info                - Info table for this ACPI table
1019  *
1020  * RETURN:      Status
1021  *
1022  * DESCRIPTION: Display ACPI table contents by walking the Info table.
1023  *
1024  * Note: This function must remain in sync with DtGetFieldLength.
1025  *
1026  ******************************************************************************/
1027 
1028 ACPI_STATUS
AcpiDmDumpTable(UINT32 TableLength,UINT32 TableOffset,void * Table,UINT32 SubtableLength,ACPI_DMTABLE_INFO * Info)1029 AcpiDmDumpTable (
1030     UINT32                  TableLength,
1031     UINT32                  TableOffset,
1032     void                    *Table,
1033     UINT32                  SubtableLength,
1034     ACPI_DMTABLE_INFO       *Info)
1035 {
1036     UINT8                   *Target;
1037     UINT32                  CurrentOffset;
1038     UINT32                  ByteLength;
1039     UINT8                   Temp8;
1040     UINT16                  Temp16;
1041     UINT32                  Temp32;
1042     UINT64                  Value;
1043     const AH_TABLE          *TableData;
1044     const char              *Name;
1045     BOOLEAN                 LastOutputBlankLine = FALSE;
1046     ACPI_STATUS             Status;
1047     char                    RepairedName[8];
1048 
1049 
1050     if (!Info)
1051     {
1052         AcpiOsPrintf ("Display not implemented\n");
1053         return (AE_NOT_IMPLEMENTED);
1054     }
1055 
1056     /* Walk entire Info table; Null name terminates */
1057 
1058     for (; Info->Name; Info++)
1059     {
1060         /*
1061          * Target points to the field within the ACPI Table. CurrentOffset is
1062          * the offset of the field from the start of the main table.
1063          */
1064         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
1065         CurrentOffset = TableOffset + Info->Offset;
1066 
1067         /* Check for beyond subtable end or (worse) beyond EOT */
1068 
1069         if (SubtableLength && (Info->Offset > SubtableLength))
1070         {
1071             AcpiOsPrintf (
1072                 "/**** ACPI subtable terminates early (Len %u) - "
1073                 "may be older version (dump table) */\n", SubtableLength);
1074 
1075             /* Move on to next subtable */
1076 
1077             return (AE_OK);
1078         }
1079 
1080         if (CurrentOffset >= TableLength)
1081         {
1082             AcpiOsPrintf (
1083                 "/**** ACPI table terminates "
1084                 "in the middle of a data structure! (dump table) \n"
1085                 "CurrentOffset: %X, TableLength: %X ***/", CurrentOffset, TableLength);
1086             return (AE_BAD_DATA);
1087         }
1088 
1089         /* Generate the byte length for this field */
1090 
1091         switch (Info->Opcode)
1092         {
1093         case ACPI_DMT_UINT8:
1094         case ACPI_DMT_CHKSUM:
1095         case ACPI_DMT_SPACEID:
1096         case ACPI_DMT_ACCWIDTH:
1097         case ACPI_DMT_CEDT:
1098         case ACPI_DMT_IVRS:
1099         case ACPI_DMT_IVRS_DE:
1100         case ACPI_DMT_GTDT:
1101         case ACPI_DMT_MADT:
1102         case ACPI_DMT_MPAM_LOCATOR:
1103         case ACPI_DMT_PCCT:
1104         case ACPI_DMT_PMTT:
1105         case ACPI_DMT_PPTT:
1106         case ACPI_DMT_RGRT:
1107         case ACPI_DMT_SDEV:
1108         case ACPI_DMT_SRAT:
1109         case ACPI_DMT_AEST:
1110         case ACPI_DMT_AEST_RES:
1111         case ACPI_DMT_AEST_XFACE:
1112         case ACPI_DMT_AEST_XRUPT:
1113         case ACPI_DMT_ASF:
1114         case ACPI_DMT_CDAT:
1115         case ACPI_DMT_HESTNTYP:
1116         case ACPI_DMT_FADTPM:
1117         case ACPI_DMT_EINJACT:
1118         case ACPI_DMT_EINJINST:
1119         case ACPI_DMT_ERSTACT:
1120         case ACPI_DMT_ERSTINST:
1121         case ACPI_DMT_DMAR_SCOPE:
1122         case ACPI_DMT_VIOT:
1123 
1124             ByteLength = 1;
1125             break;
1126 
1127         case ACPI_DMT_ASPT:
1128         case ACPI_DMT_UINT16:
1129         case ACPI_DMT_DMAR:
1130         case ACPI_DMT_HEST:
1131         case ACPI_DMT_HMAT:
1132         case ACPI_DMT_NFIT:
1133         case ACPI_DMT_PHAT:
1134         case ACPI_DMT_RHCT:
1135 
1136             ByteLength = 2;
1137             break;
1138 
1139         case ACPI_DMT_UINT24:
1140 
1141             ByteLength = 3;
1142             break;
1143 
1144         case ACPI_DMT_UINT32:
1145         case ACPI_DMT_AEST_CACHE:
1146         case ACPI_DMT_AEST_GIC:
1147         case ACPI_DMT_NAME4:
1148         case ACPI_DMT_SIG:
1149         case ACPI_DMT_LPIT:
1150         case ACPI_DMT_TPM2:
1151 
1152             ByteLength = 4;
1153             break;
1154 
1155         case ACPI_DMT_UINT40:
1156 
1157             ByteLength = 5;
1158             break;
1159 
1160         case ACPI_DMT_UINT48:
1161         case ACPI_DMT_NAME6:
1162 
1163             ByteLength = 6;
1164             break;
1165 
1166         case ACPI_DMT_UINT56:
1167         case ACPI_DMT_BUF7:
1168 
1169             ByteLength = 7;
1170             break;
1171 
1172         case ACPI_DMT_UINT64:
1173         case ACPI_DMT_NAME8:
1174 
1175             ByteLength = 8;
1176             break;
1177 
1178         case ACPI_DMT_BUF10:
1179 
1180             ByteLength = 10;
1181             break;
1182 
1183         case ACPI_DMT_BUF12:
1184 
1185             ByteLength = 12;
1186             break;
1187 
1188         case ACPI_DMT_BUF16:
1189         case ACPI_DMT_UUID:
1190 
1191             ByteLength = 16;
1192             break;
1193 
1194         case ACPI_DMT_BUF18:
1195 
1196             ByteLength = 18;
1197             break;
1198 
1199         case ACPI_DMT_BUF128:
1200 
1201             ByteLength = 128;
1202             break;
1203 
1204         case ACPI_DMT_WPBT_UNICODE:
1205 
1206             ByteLength = SubtableLength;
1207             CurrentOffset = sizeof (ACPI_TABLE_WPBT);
1208             break;
1209 
1210         case ACPI_DMT_UNICODE:
1211         case ACPI_DMT_BUFFER:
1212         case ACPI_DMT_RAW_BUFFER:
1213 
1214             ByteLength = SubtableLength;
1215             break;
1216 
1217         case ACPI_DMT_PMTT_VENDOR:
1218             /*
1219              * Calculate the length of the vendor data for the PMTT table:
1220              * Length = (Current Subtable ptr + Subtable length) -
1221              *          Start of the vendor data (Target)
1222              */
1223             ByteLength = ((ACPI_CAST_PTR (char, Table) +
1224                             (ACPI_CAST_PTR (ACPI_PMTT_HEADER, Table)->Length)) -
1225                             ACPI_CAST_PTR (char, Target));
1226             break;
1227 
1228         case ACPI_DMT_STRING:
1229 
1230             ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
1231             break;
1232 
1233         case ACPI_DMT_IVRS_UNTERMINATED_STRING:
1234 
1235             ByteLength = ((ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, Target) -1)->UidLength);
1236             break;
1237 
1238         case ACPI_DMT_GAS:
1239 
1240             if (!LastOutputBlankLine)
1241             {
1242                 AcpiOsPrintf ("\n");
1243                 LastOutputBlankLine = TRUE;
1244             }
1245 
1246             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
1247             break;
1248 
1249         case ACPI_DMT_HESTNTFY:
1250 
1251             if (!LastOutputBlankLine)
1252             {
1253                 AcpiOsPrintf ("\n");
1254                 LastOutputBlankLine = TRUE;
1255             }
1256 
1257             ByteLength = sizeof (ACPI_HEST_NOTIFY);
1258             break;
1259 
1260         case ACPI_DMT_IORTMEM:
1261 
1262             if (!LastOutputBlankLine)
1263             {
1264                 LastOutputBlankLine = FALSE;
1265             }
1266 
1267             ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
1268             break;
1269 
1270         default:
1271 
1272             ByteLength = 0;
1273             break;
1274         }
1275 
1276         /* Check if we are beyond a subtable, or (worse) beyond EOT */
1277 
1278         if (CurrentOffset + ByteLength > TableLength)
1279         {
1280             if (SubtableLength)
1281             {
1282                 AcpiOsPrintf (
1283                     "/**** ACPI subtable terminates early - "
1284                     "may be older version (dump table) */\n");
1285 
1286                 /* Move on to next subtable */
1287 
1288                 return (AE_OK);
1289             }
1290 
1291             AcpiOsPrintf (
1292                 "/**** ACPI table terminates "
1293                 "in the middle of a data structure! */\n");
1294             return (AE_BAD_DATA);
1295         }
1296 
1297         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
1298         {
1299             AcpiOsPrintf ("%s", Info->Name);
1300             continue;
1301         }
1302 
1303         /* Start a new line and decode the opcode */
1304 
1305         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
1306 
1307         switch (Info->Opcode)
1308         {
1309         /* Single-bit Flag fields. Note: Opcode is the bit position */
1310 
1311         case ACPI_DMT_FLAG0:
1312         case ACPI_DMT_FLAG1:
1313         case ACPI_DMT_FLAG2:
1314         case ACPI_DMT_FLAG3:
1315         case ACPI_DMT_FLAG4:
1316         case ACPI_DMT_FLAG5:
1317         case ACPI_DMT_FLAG6:
1318         case ACPI_DMT_FLAG7:
1319 
1320             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
1321             break;
1322 
1323         /* 2-bit Flag fields */
1324 
1325         case ACPI_DMT_FLAGS0:
1326 
1327             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
1328             break;
1329 
1330         case ACPI_DMT_FLAGS1:
1331 
1332             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
1333             break;
1334 
1335         case ACPI_DMT_FLAGS2:
1336 
1337             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
1338             break;
1339 
1340         case ACPI_DMT_FLAGS8_2:
1341 
1342             AcpiOsPrintf ("%2.2X\n", (*Target >> 2) & 0xFF);
1343             break;
1344 
1345         case ACPI_DMT_FLAGS4:
1346 
1347             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
1348             break;
1349 
1350         case ACPI_DMT_FLAGS4_0:
1351 
1352             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target) & 0x0F);
1353             break;
1354 
1355         case ACPI_DMT_FLAGS4_4:
1356 
1357             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 4) & 0x0F);
1358             break;
1359 
1360         case ACPI_DMT_FLAGS4_8:
1361 
1362             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 8) & 0x0F);
1363             break;
1364 
1365         case ACPI_DMT_FLAGS4_12:
1366 
1367             AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 12) & 0x0F);
1368             break;
1369 
1370         case ACPI_DMT_FLAGS16_16:
1371 
1372             AcpiOsPrintf ("%4.4X\n", (*(UINT32 *)Target >> 16) & 0xFFFF);
1373             break;
1374 
1375         /* Integer Data Types */
1376 
1377         case ACPI_DMT_UINT8:
1378         case ACPI_DMT_UINT16:
1379         case ACPI_DMT_UINT24:
1380         case ACPI_DMT_UINT32:
1381         case ACPI_DMT_UINT40:
1382         case ACPI_DMT_UINT48:
1383         case ACPI_DMT_UINT56:
1384         case ACPI_DMT_UINT64:
1385             /*
1386              * Dump bytes - high byte first, low byte last.
1387              * Note: All ACPI tables are little-endian.
1388              */
1389             Value = 0;
1390             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1391             {
1392                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1393                 Value |= Target[Temp8 - 1];
1394                 Value <<= 8;
1395             }
1396 
1397             if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1398             {
1399                 AcpiOsPrintf (" [Optional field not present]");
1400             }
1401 
1402             AcpiOsPrintf ("\n");
1403             break;
1404 
1405         case ACPI_DMT_BUF7:
1406         case ACPI_DMT_BUF10:
1407         case ACPI_DMT_BUF12:
1408         case ACPI_DMT_BUF16:
1409         case ACPI_DMT_BUF18:
1410         case ACPI_DMT_BUF128:
1411             /*
1412              * Buffer: Size depends on the opcode and was set above.
1413              * Each hex byte is separated with a space.
1414              * Multiple lines are separated by line continuation char.
1415              */
1416             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1417             {
1418                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1419                 if ((UINT32) (Temp16 + 1) < ByteLength)
1420                 {
1421                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1422                     {
1423                         AcpiOsPrintf (" \\\n"); /* Line continuation */
1424                         AcpiDmLineHeader (0, 0, NULL);
1425                     }
1426                     else
1427                     {
1428                         AcpiOsPrintf (" ");
1429                     }
1430                 }
1431             }
1432 
1433             AcpiOsPrintf ("\n");
1434             break;
1435 
1436         case ACPI_DMT_UUID:
1437 
1438             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1439 
1440             (void) AcpiUtConvertUuidToString ((char *) Target, AslGbl_MsgBuffer);
1441 
1442             AcpiOsPrintf ("%s\n", AslGbl_MsgBuffer);
1443             break;
1444 
1445         case ACPI_DMT_STRING:
1446 
1447             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1448             break;
1449 
1450         case ACPI_DMT_IVRS_UNTERMINATED_STRING:
1451 
1452             AcpiOsPrintf ("\"%.*s\"\n", ByteLength, ACPI_CAST_PTR (char, Target));
1453             break;
1454 
1455         /* Fixed length ASCII name fields */
1456 
1457         case ACPI_DMT_SIG:
1458 
1459             AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1460             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
1461 
1462             TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1463             if (TableData)
1464             {
1465                 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1466             }
1467             else
1468             {
1469                 AcpiOsPrintf ("\n");
1470             }
1471             break;
1472 
1473         case ACPI_DMT_NAME4:
1474 
1475             AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1476             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1477             break;
1478 
1479         case ACPI_DMT_NAME6:
1480 
1481             AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
1482             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1483             break;
1484 
1485         case ACPI_DMT_NAME8:
1486 
1487             AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
1488             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1489             break;
1490 
1491         /* Special Data Types */
1492 
1493         case ACPI_DMT_CHKSUM:
1494 
1495             /* Checksum, display and validate */
1496 
1497             AcpiOsPrintf ("%2.2X", *Target);
1498             Temp8 = AcpiUtGenerateChecksum (Table,
1499                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1500                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1501 
1502             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1503             {
1504                 AcpiOsPrintf (
1505                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
1506             }
1507 
1508             AcpiOsPrintf ("\n");
1509             break;
1510 
1511         case ACPI_DMT_SPACEID:
1512 
1513             /* Address Space ID */
1514 
1515             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1516             break;
1517 
1518         case ACPI_DMT_ACCWIDTH:
1519 
1520             /* Encoded Access Width */
1521 
1522             Temp8 = *Target;
1523             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1524             {
1525                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1526             }
1527 
1528             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1529             break;
1530 
1531         case ACPI_DMT_GAS:
1532 
1533             /* Generic Address Structure */
1534 
1535             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1536             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1537                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1538             if (ACPI_FAILURE (Status))
1539             {
1540                 return (Status);
1541             }
1542 
1543             AcpiOsPrintf ("\n");
1544             LastOutputBlankLine = TRUE;
1545             break;
1546 
1547         case ACPI_DMT_AEST:
1548 
1549             /* AEST subtable types */
1550 
1551             Temp8 = *Target;
1552             if (Temp8 > ACPI_AEST_NODE_TYPE_RESERVED)
1553             {
1554                 Temp8 = ACPI_AEST_NODE_TYPE_RESERVED;
1555             }
1556 
1557             AcpiOsPrintf (UINT8_FORMAT, *Target,
1558                 AcpiDmAestSubnames[Temp8]);
1559             break;
1560 
1561         case ACPI_DMT_AEST_CACHE:
1562 
1563             /* AEST cache resource subtable */
1564 
1565             Temp32 = *Target;
1566             if (Temp32 > ACPI_AEST_CACHE_RESERVED)
1567             {
1568                 Temp32 = ACPI_AEST_CACHE_RESERVED;
1569             }
1570 
1571             AcpiOsPrintf (UINT32_FORMAT, *Target,
1572                 AcpiDmAestCacheNames[Temp32]);
1573             break;
1574 
1575         case ACPI_DMT_AEST_GIC:
1576 
1577             /* AEST GIC error subtable */
1578 
1579             Temp32 = *Target;
1580             if (Temp32 > ACPI_AEST_GIC_RESERVED)
1581             {
1582                 Temp32 = ACPI_AEST_GIC_RESERVED;
1583             }
1584 
1585             AcpiOsPrintf (UINT32_FORMAT, *Target,
1586                 AcpiDmAestGicNames[Temp32]);
1587             break;
1588 
1589         case ACPI_DMT_AEST_RES:
1590 
1591             /* AEST resource type subtable */
1592 
1593             Temp8 = *Target;
1594             if (Temp8 > ACPI_AEST_RESOURCE_RESERVED)
1595             {
1596                 Temp8 = ACPI_AEST_RESOURCE_RESERVED;
1597             }
1598 
1599             AcpiOsPrintf (UINT8_FORMAT, *Target,
1600                 AcpiDmAestResourceNames[Temp8]);
1601             break;
1602 
1603         case ACPI_DMT_AEST_XFACE:
1604 
1605             /* AEST interface structure types */
1606 
1607             Temp8 = *Target;
1608             if (Temp8 > ACPI_AEST_XFACE_RESERVED)
1609             {
1610                 Temp8 = ACPI_AEST_XFACE_RESERVED;
1611             }
1612 
1613             AcpiOsPrintf (UINT8_FORMAT, *Target,
1614                 AcpiDmAestXfaceNames[Temp8]);
1615             break;
1616 
1617         case ACPI_DMT_AEST_XRUPT:
1618 
1619             /* AEST interrupt structure types */
1620 
1621             Temp8 = *Target;
1622             if (Temp8 > ACPI_AEST_XRUPT_RESERVED)
1623             {
1624                 Temp8 = ACPI_AEST_XRUPT_RESERVED;
1625             }
1626 
1627             AcpiOsPrintf (UINT8_FORMAT, *Target,
1628                 AcpiDmAestXruptNames[Temp8]);
1629             break;
1630 
1631         case ACPI_DMT_ASPT:
1632             /* ASPT subtable types */
1633             Temp16 = ACPI_GET16(Target);
1634             if (Temp16 > ACPI_ASPT_TYPE_UNKNOWN)
1635             {
1636                 Temp16 = ACPI_ASPT_TYPE_UNKNOWN;
1637             }
1638 
1639             AcpiOsPrintf(UINT16_FORMAT, Temp16, AcpiDmAsptSubnames[Temp16]);
1640             break;
1641 
1642         case ACPI_DMT_ASF:
1643 
1644             /* ASF subtable types */
1645 
1646             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
1647             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1648             {
1649                 Temp16 = ACPI_ASF_TYPE_RESERVED;
1650             }
1651 
1652             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1653             break;
1654 
1655         case ACPI_DMT_CDAT:
1656 
1657             /* CDAT subtable types */
1658 
1659             Temp8 = *Target;
1660             if (Temp8 > ACPI_CDAT_TYPE_RESERVED)
1661             {
1662                 Temp8 = ACPI_CDAT_TYPE_RESERVED;
1663             }
1664 
1665             AcpiOsPrintf (UINT8_FORMAT, *Target,
1666                 AcpiDmCdatSubnames[Temp8]);
1667             break;
1668 
1669         case ACPI_DMT_CEDT:
1670 
1671             /* CEDT subtable types */
1672 
1673             Temp8 = *Target;
1674             if (Temp8 > ACPI_CEDT_TYPE_RESERVED)
1675             {
1676                 Temp8 = ACPI_CEDT_TYPE_RESERVED;
1677             }
1678 
1679             AcpiOsPrintf (UINT8_FORMAT, *Target,
1680                 AcpiDmCedtSubnames[Temp8]);
1681             break;
1682 
1683         case ACPI_DMT_DMAR:
1684 
1685             /* DMAR subtable types */
1686 
1687             Temp16 = ACPI_GET16 (Target);
1688             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1689             {
1690                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1691             }
1692 
1693             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1694                 AcpiDmDmarSubnames[Temp16]);
1695             break;
1696 
1697         case ACPI_DMT_DMAR_SCOPE:
1698 
1699             /* DMAR device scope types */
1700 
1701             Temp8 = *Target;
1702             if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1703             {
1704                 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1705             }
1706 
1707             AcpiOsPrintf (UINT8_FORMAT, *Target,
1708                 AcpiDmDmarScope[Temp8]);
1709             break;
1710 
1711         case ACPI_DMT_EINJACT:
1712 
1713             /* EINJ Action types */
1714 
1715             Temp8 = *Target;
1716             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1717             {
1718                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1719             }
1720 
1721             AcpiOsPrintf (UINT8_FORMAT, *Target,
1722                 AcpiDmEinjActions[Temp8]);
1723             break;
1724 
1725         case ACPI_DMT_EINJINST:
1726 
1727             /* EINJ Instruction types */
1728 
1729             Temp8 = *Target;
1730             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1731             {
1732                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1733             }
1734 
1735             AcpiOsPrintf (UINT8_FORMAT, *Target,
1736                 AcpiDmEinjInstructions[Temp8]);
1737             break;
1738 
1739         case ACPI_DMT_ERSTACT:
1740 
1741             /* ERST Action types */
1742 
1743             Temp8 = *Target;
1744             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1745             {
1746                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1747             }
1748 
1749             AcpiOsPrintf (UINT8_FORMAT, *Target,
1750                 AcpiDmErstActions[Temp8]);
1751             break;
1752 
1753         case ACPI_DMT_ERSTINST:
1754 
1755             /* ERST Instruction types */
1756 
1757             Temp8 = *Target;
1758             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1759             {
1760                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1761             }
1762 
1763             AcpiOsPrintf (UINT8_FORMAT, *Target,
1764                 AcpiDmErstInstructions[Temp8]);
1765             break;
1766 
1767         case ACPI_DMT_GTDT:
1768 
1769             /* GTDT subtable types */
1770 
1771             Temp8 = *Target;
1772             if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1773             {
1774                 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1775             }
1776 
1777             AcpiOsPrintf (UINT8_FORMAT, *Target,
1778                 AcpiDmGtdtSubnames[Temp8]);
1779             break;
1780 
1781         case ACPI_DMT_HEST:
1782 
1783             /* HEST subtable types */
1784 
1785             Temp16 = ACPI_GET16 (Target);
1786             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1787             {
1788                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1789             }
1790 
1791             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1792                 AcpiDmHestSubnames[Temp16]);
1793             break;
1794 
1795         case ACPI_DMT_HESTNTFY:
1796 
1797             AcpiOsPrintf (STRING_FORMAT,
1798                 "Hardware Error Notification Structure");
1799 
1800             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1801                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1802             if (ACPI_FAILURE (Status))
1803             {
1804                 return (Status);
1805             }
1806 
1807             AcpiOsPrintf ("\n");
1808             LastOutputBlankLine = TRUE;
1809             break;
1810 
1811         case ACPI_DMT_HESTNTYP:
1812 
1813             /* HEST Notify types */
1814 
1815             Temp8 = *Target;
1816             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1817             {
1818                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1819             }
1820 
1821             AcpiOsPrintf (UINT8_FORMAT, *Target,
1822                 AcpiDmHestNotifySubnames[Temp8]);
1823             break;
1824 
1825         case ACPI_DMT_HMAT:
1826 
1827             /* HMAT subtable types */
1828 
1829             Temp16 = *Target;
1830             if (Temp16 > ACPI_HMAT_TYPE_RESERVED)
1831             {
1832                 Temp16 = ACPI_HMAT_TYPE_RESERVED;
1833             }
1834 
1835             AcpiOsPrintf (UINT16_FORMAT, *Target,
1836                 AcpiDmHmatSubnames[Temp16]);
1837             break;
1838 
1839         case ACPI_DMT_IORTMEM:
1840 
1841             AcpiOsPrintf (STRING_FORMAT,
1842                 "IORT Memory Access Properties");
1843 
1844             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1845                 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1846             if (ACPI_FAILURE (Status))
1847             {
1848                 return (Status);
1849             }
1850 
1851             LastOutputBlankLine = TRUE;
1852             break;
1853 
1854         case ACPI_DMT_MADT:
1855 
1856             /* MADT subtable types */
1857 
1858             Temp8 = *Target;
1859             if ((Temp8 >= ACPI_MADT_TYPE_RESERVED) && (Temp8 < ACPI_MADT_TYPE_OEM_RESERVED))
1860             {
1861                 Temp8 = ACPI_MADT_TYPE_RESERVED;
1862             }
1863             else if (Temp8 >= ACPI_MADT_TYPE_OEM_RESERVED)
1864             {
1865                 Temp8 = ACPI_MADT_TYPE_RESERVED + 1;
1866             }
1867             AcpiOsPrintf (UINT8_FORMAT, *Target,
1868                 AcpiDmMadtSubnames[Temp8]);
1869             break;
1870 
1871         case ACPI_DMT_MPAM_LOCATOR:
1872 
1873             /* MPAM subtable locator types */
1874 
1875             Temp8 = *Target;
1876             if (Temp8 > ACPI_MPAM_LOCATION_TYPE_INTERCONNECT)
1877             {
1878                 Temp8 = ACPI_MPAM_LOCATION_TYPE_INTERCONNECT + 1;
1879             }
1880 
1881             AcpiOsPrintf (UINT8_FORMAT, *Target,
1882                 AcpiDmMpamSubnames[Temp8]);
1883             break;
1884 
1885         case ACPI_DMT_NFIT:
1886 
1887             /* NFIT subtable types */
1888 
1889             Temp16 = ACPI_GET16 (Target);
1890             if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1891             {
1892                 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1893             }
1894 
1895             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1896                 AcpiDmNfitSubnames[Temp16]);
1897             break;
1898 
1899         case ACPI_DMT_PCCT:
1900 
1901             /* PCCT subtable types */
1902 
1903             Temp8 = *Target;
1904             if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1905             {
1906                 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1907             }
1908 
1909             AcpiOsPrintf (UINT8_FORMAT, *Target,
1910                 AcpiDmPcctSubnames[Temp8]);
1911             break;
1912 
1913         case ACPI_DMT_PHAT:
1914 
1915             /* PHAT subtable types */
1916 
1917             Temp16 = ACPI_GET16 (Target);
1918             if (Temp16 > ACPI_PHAT_TYPE_RESERVED)
1919             {
1920                 Temp16 = ACPI_PHAT_TYPE_RESERVED;
1921             }
1922 
1923             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1924                 AcpiDmPhatSubnames[Temp16]);
1925             break;
1926 
1927         case ACPI_DMT_PMTT:
1928 
1929             /* PMTT subtable types */
1930 
1931             Temp8 = *Target;
1932             if (Temp8 == ACPI_PMTT_TYPE_VENDOR)
1933             {
1934                 Temp8 = ACPI_PMTT_TYPE_RESERVED + 1;
1935             }
1936             else if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1937             {
1938                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1939             }
1940             AcpiOsPrintf (UINT8_FORMAT, *Target,
1941                 AcpiDmPmttSubnames[Temp8]);
1942             break;
1943 
1944         case ACPI_DMT_PPTT:
1945 
1946             /* PPTT subtable types */
1947 
1948             Temp8 = *Target;
1949             if (Temp8 > ACPI_PPTT_TYPE_RESERVED)
1950             {
1951                 Temp8 = ACPI_PPTT_TYPE_RESERVED;
1952             }
1953 
1954             AcpiOsPrintf (UINT8_FORMAT, *Target,
1955                 AcpiDmPpttSubnames[Temp8]);
1956             break;
1957 
1958         case ACPI_DMT_UNICODE:
1959         case ACPI_DMT_WPBT_UNICODE:
1960 
1961             if (ByteLength == 0)
1962             {
1963                 AcpiOsPrintf ("/* Zero-length Data */\n");
1964                 break;
1965             }
1966 
1967             AcpiDmDumpUnicode (Table, 0, ByteLength);
1968             break;
1969 
1970         case ACPI_DMT_RAW_BUFFER:
1971         case ACPI_DMT_BUFFER:
1972         case ACPI_DMT_PMTT_VENDOR:
1973 
1974             if (ByteLength == 0)
1975             {
1976                 AcpiOsPrintf ("/* Zero-length Data */\n");
1977                 break;
1978             }
1979 
1980             AcpiDmDumpBuffer (Target, 0, ByteLength, CurrentOffset, NULL);
1981             break;
1982 
1983         case ACPI_DMT_RGRT:
1984 
1985             /* RGRT subtable types */
1986 
1987             Temp8 = *Target;
1988             if (Temp8 >= ACPI_RGRT_TYPE_RESERVED)
1989             {
1990                 Temp8 = ACPI_RGRT_TYPE_RESERVED0;
1991             }
1992 
1993             AcpiOsPrintf (UINT8_FORMAT, *Target,
1994                 AcpiDmRgrtSubnames[Temp8]);
1995             break;
1996 
1997         case ACPI_DMT_RHCT:
1998 
1999             /* RHCT subtable types */
2000 
2001             Temp16 = ACPI_GET16 (Target);
2002             if (Temp16 == ACPI_RHCT_NODE_TYPE_HART_INFO)
2003             {
2004                 Temp16 = ACPI_RHCT_NODE_TYPE_RESERVED;
2005             }
2006 
2007             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2008                 AcpiDmRhctSubnames[Temp16]);
2009             break;
2010 
2011         case ACPI_DMT_SDEV:
2012 
2013             /* SDEV subtable types */
2014 
2015             Temp8 = *Target;
2016             if (Temp8 > ACPI_SDEV_TYPE_RESERVED)
2017             {
2018                 Temp8 = ACPI_SDEV_TYPE_RESERVED;
2019             }
2020 
2021             AcpiOsPrintf (UINT8_FORMAT, *Target,
2022                 AcpiDmSdevSubnames[Temp8]);
2023             break;
2024 
2025         case ACPI_DMT_SRAT:
2026 
2027             /* SRAT subtable types */
2028 
2029             Temp8 = *Target;
2030             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
2031             {
2032                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
2033             }
2034 
2035             AcpiOsPrintf (UINT8_FORMAT, *Target,
2036                 AcpiDmSratSubnames[Temp8]);
2037             break;
2038 
2039         case ACPI_DMT_TPM2:
2040 
2041             /* TPM2 Start Method types */
2042 
2043             Temp8 = *Target;
2044             if (Temp8 > ACPI_TPM2_RESERVED)
2045             {
2046                 Temp8 = ACPI_TPM2_RESERVED;
2047             }
2048 
2049             AcpiOsPrintf (UINT8_FORMAT, *Target,
2050                 AcpiDmTpm2Subnames[Temp8]);
2051             break;
2052 
2053 
2054         case ACPI_DMT_FADTPM:
2055 
2056             /* FADT Preferred PM Profile names */
2057 
2058             Temp8 = *Target;
2059             if (Temp8 > ACPI_FADT_PM_RESERVED)
2060             {
2061                 Temp8 = ACPI_FADT_PM_RESERVED;
2062             }
2063 
2064             AcpiOsPrintf (UINT8_FORMAT, *Target,
2065                 AcpiDmFadtProfiles[Temp8]);
2066             break;
2067 
2068         case ACPI_DMT_IVRS:
2069 
2070             /* IVRS subtable types */
2071 
2072             Temp8 = *Target;
2073             switch (Temp8)
2074             {
2075             case ACPI_IVRS_TYPE_HARDWARE1:
2076             case ACPI_IVRS_TYPE_HARDWARE2:
2077 
2078                 Name = AcpiDmIvrsSubnames[0];
2079                 break;
2080 
2081             case ACPI_IVRS_TYPE_HARDWARE3:
2082 
2083                 Name = AcpiDmIvrsSubnames[1];
2084                 break;
2085 
2086             case ACPI_IVRS_TYPE_MEMORY1:
2087             case ACPI_IVRS_TYPE_MEMORY2:
2088             case ACPI_IVRS_TYPE_MEMORY3:
2089 
2090                 Name = AcpiDmIvrsSubnames[2];
2091                 break;
2092 
2093             default:
2094 
2095                 Name = AcpiDmIvrsSubnames[3];
2096                 break;
2097             }
2098 
2099             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
2100             break;
2101 
2102         case ACPI_DMT_IVRS_DE:
2103 
2104             /* IVRS device entry types */
2105 
2106             Temp8 = *Target;
2107             switch (Temp8)
2108             {
2109             case ACPI_IVRS_TYPE_ALL:
2110             case ACPI_IVRS_TYPE_SELECT:
2111             case ACPI_IVRS_TYPE_START:
2112             case ACPI_IVRS_TYPE_END:
2113 
2114                 Name = AcpiDmIvrsDevEntryNames[Temp8];
2115                 break;
2116 
2117             case ACPI_IVRS_TYPE_ALIAS_SELECT:
2118             case ACPI_IVRS_TYPE_ALIAS_START:
2119             case ACPI_IVRS_TYPE_EXT_SELECT:
2120             case ACPI_IVRS_TYPE_EXT_START:
2121             case ACPI_IVRS_TYPE_SPECIAL:
2122 
2123                 Name = AcpiDmIvrsDevEntryNames[Temp8 - 61];
2124                 break;
2125 
2126             case ACPI_IVRS_TYPE_HID:
2127 
2128                 Name = AcpiDmIvrsDevEntryNames[Temp8 - 228];
2129                 break;
2130 
2131             default:
2132                 Name = AcpiDmIvrsDevEntryNames[0];  /* Unknown/Reserved */
2133                 break;
2134             }
2135 
2136             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
2137             break;
2138 
2139         case ACPI_DMT_LPIT:
2140 
2141             /* LPIT subtable types */
2142 
2143             Temp32 = ACPI_GET32 (Target);
2144             if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
2145             {
2146                 Temp32 = ACPI_LPIT_TYPE_RESERVED;
2147             }
2148 
2149             AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
2150                 AcpiDmLpitSubnames[Temp32]);
2151             break;
2152 
2153         case ACPI_DMT_VIOT:
2154 
2155             /* VIOT subtable types */
2156 
2157             Temp8 = *Target;
2158             if (Temp8 > ACPI_VIOT_RESERVED)
2159             {
2160                 Temp8 = ACPI_VIOT_RESERVED;
2161             }
2162 
2163             AcpiOsPrintf (UINT8_FORMAT, *Target,
2164                 AcpiDmViotSubnames[Temp8]);
2165             break;
2166 
2167         case ACPI_DMT_EXIT:
2168 
2169             return (AE_OK);
2170 
2171         default:
2172 
2173             ACPI_ERROR ((AE_INFO,
2174                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
2175             return (AE_SUPPORT);
2176         }
2177     }
2178 
2179     if (TableOffset && !SubtableLength)
2180     {
2181         /*
2182          * If this table is not the main table, the subtable must have a
2183          * valid length
2184          */
2185         AcpiOsPrintf ("Invalid zero length subtable\n");
2186         return (AE_BAD_DATA);
2187     }
2188 
2189     return (AE_OK);
2190 }
2191