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