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