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