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 - 2017, 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 #include "dtcompiler.h"
158 
159 /* This module used for application-level code only */
160 
161 #define _COMPONENT          ACPI_CA_DISASSEMBLER
162         ACPI_MODULE_NAME    ("dmtable")
163 
164 const AH_TABLE *
165 AcpiAhGetTableInfo (
166     char                    *Signature);
167 
168 
169 /* Common format strings for commented values */
170 
171 #define UINT8_FORMAT        "%2.2X [%s]\n"
172 #define UINT16_FORMAT       "%4.4X [%s]\n"
173 #define UINT32_FORMAT       "%8.8X [%s]\n"
174 #define STRING_FORMAT       "[%s]\n"
175 
176 /* These tables map a subtable type to a description string */
177 
178 static const char           *AcpiDmAsfSubnames[] =
179 {
180     "ASF Information",
181     "ASF Alerts",
182     "ASF Remote Control",
183     "ASF RMCP Boot Options",
184     "ASF Address",
185     "Unknown Subtable Type"         /* Reserved */
186 };
187 
188 static const char           *AcpiDmDmarSubnames[] =
189 {
190     "Hardware Unit Definition",
191     "Reserved Memory Region",
192     "Root Port ATS Capability",
193     "Remapping Hardware Static Affinity",
194     "ACPI Namespace Device Declaration",
195     "Unknown Subtable Type"         /* Reserved */
196 };
197 
198 static const char           *AcpiDmDmarScope[] =
199 {
200     "Reserved value",
201     "PCI Endpoint Device",
202     "PCI Bridge Device",
203     "IOAPIC Device",
204     "Message-capable HPET Device",
205     "Namespace Device",
206     "Unknown Scope Type"            /* Reserved */
207 };
208 
209 static const char           *AcpiDmEinjActions[] =
210 {
211     "Begin Operation",
212     "Get Trigger Table",
213     "Set Error Type",
214     "Get Error Type",
215     "End Operation",
216     "Execute Operation",
217     "Check Busy Status",
218     "Get Command Status",
219     "Set Error Type With Address",
220     "Get Execute Timings",
221     "Unknown Action"
222 };
223 
224 static const char           *AcpiDmEinjInstructions[] =
225 {
226     "Read Register",
227     "Read Register Value",
228     "Write Register",
229     "Write Register Value",
230     "Noop",
231     "Flush Cacheline",
232     "Unknown Instruction"
233 };
234 
235 static const char           *AcpiDmErstActions[] =
236 {
237     "Begin Write Operation",
238     "Begin Read Operation",
239     "Begin Clear Operation",
240     "End Operation",
241     "Set Record Offset",
242     "Execute Operation",
243     "Check Busy Status",
244     "Get Command Status",
245     "Get Record Identifier",
246     "Set Record Identifier",
247     "Get Record Count",
248     "Begin Dummy Write",
249     "Unused/Unknown Action",
250     "Get Error Address Range",
251     "Get Error Address Length",
252     "Get Error Attributes",
253     "Execute Timings",
254     "Unknown Action"
255 };
256 
257 static const char           *AcpiDmErstInstructions[] =
258 {
259     "Read Register",
260     "Read Register Value",
261     "Write Register",
262     "Write Register Value",
263     "Noop",
264     "Load Var1",
265     "Load Var2",
266     "Store Var1",
267     "Add",
268     "Subtract",
269     "Add Value",
270     "Subtract Value",
271     "Stall",
272     "Stall While True",
273     "Skip Next If True",
274     "GoTo",
275     "Set Source Address",
276     "Set Destination Address",
277     "Move Data",
278     "Unknown Instruction"
279 };
280 
281 static const char           *AcpiDmGtdtSubnames[] =
282 {
283     "Generic Timer Block",
284     "Generic Watchdog Timer",
285     "Unknown Subtable Type"         /* Reserved */
286 };
287 
288 static const char           *AcpiDmHestSubnames[] =
289 {
290     "IA-32 Machine Check Exception",
291     "IA-32 Corrected Machine Check",
292     "IA-32 Non-Maskable Interrupt",
293     "Unknown SubTable Type",        /* 3 - Reserved */
294     "Unknown SubTable Type",        /* 4 - Reserved */
295     "Unknown SubTable Type",        /* 5 - Reserved */
296     "PCI Express Root Port AER",
297     "PCI Express AER (AER Endpoint)",
298     "PCI Express/PCI-X Bridge AER",
299     "Generic Hardware Error Source",
300     "Generic Hardware Error Source V2",
301     "Unknown Subtable Type"         /* Reserved */
302 };
303 
304 static const char           *AcpiDmHestNotifySubnames[] =
305 {
306     "Polled",
307     "External Interrupt",
308     "Local Interrupt",
309     "SCI",
310     "NMI",
311     "CMCI",                         /* ACPI 5.0 */
312     "MCE",                          /* ACPI 5.0 */
313     "GPIO",                         /* ACPI 6.0 */
314     "SEA",                          /* ACPI 6.1 */
315     "SEI",                          /* ACPI 6.1 */
316     "GSIV",                         /* ACPI 6.1 */
317     "Unknown Notify Type"           /* Reserved */
318 };
319 
320 static const char           *AcpiDmMadtSubnames[] =
321 {
322     "Processor Local APIC",             /* ACPI_MADT_TYPE_LOCAL_APIC */
323     "I/O APIC",                         /* ACPI_MADT_TYPE_IO_APIC */
324     "Interrupt Source Override",        /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
325     "NMI Source",                       /* ACPI_MADT_TYPE_NMI_SOURCE */
326     "Local APIC NMI",                   /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
327     "Local APIC Address Override",      /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
328     "I/O SAPIC",                        /* ACPI_MADT_TYPE_IO_SAPIC */
329     "Local SAPIC",                      /* ACPI_MADT_TYPE_LOCAL_SAPIC */
330     "Platform Interrupt Sources",       /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
331     "Processor Local x2APIC",           /* ACPI_MADT_TYPE_LOCAL_X2APIC */
332     "Local x2APIC NMI",                 /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
333     "Generic Interrupt Controller",     /* ACPI_MADT_GENERIC_INTERRUPT */
334     "Generic Interrupt Distributor",    /* ACPI_MADT_GENERIC_DISTRIBUTOR */
335     "Generic MSI Frame",                /* ACPI_MADT_GENERIC_MSI_FRAME */
336     "Generic Interrupt Redistributor",  /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
337     "Generic Interrupt Translator",     /* ACPI_MADT_GENERIC_TRANSLATOR */
338     "Unknown Subtable Type"             /* Reserved */
339 };
340 
341 static const char           *AcpiDmNfitSubnames[] =
342 {
343     "System Physical Address Range",    /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */
344     "Memory Range Map",                 /* ACPI_NFIT_TYPE_MEMORY_MAP */
345     "Interleave Info",                  /* ACPI_NFIT_TYPE_INTERLEAVE */
346     "SMBIOS Information",               /* ACPI_NFIT_TYPE_SMBIOS */
347     "NVDIMM Control Region",            /* ACPI_NFIT_TYPE_CONTROL_REGION */
348     "NVDIMM Block Data Window Region",  /* ACPI_NFIT_TYPE_DATA_REGION */
349     "Flush Hint Address",               /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
350     "Unknown Subtable Type"             /* Reserved */
351 };
352 
353 static const char           *AcpiDmPcctSubnames[] =
354 {
355     "Generic Communications Subspace",  /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
356     "HW-Reduced Comm Subspace",         /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
357     "HW-Reduced Comm Subspace Type2",   /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
358     "Unknown Subtable Type"             /* Reserved */
359 };
360 
361 static const char           *AcpiDmPmttSubnames[] =
362 {
363     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
364     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
365     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM  */
366     "Unknown Subtable Type"         /* Reserved */
367 };
368 
369 static const char           *AcpiDmSratSubnames[] =
370 {
371     "Processor Local APIC/SAPIC Affinity",
372     "Memory Affinity",
373     "Processor Local x2APIC Affinity",
374     "GICC Affinity",
375     "Unknown Subtable Type"         /* Reserved */
376 };
377 
378 static const char           *AcpiDmIvrsSubnames[] =
379 {
380     "Hardware Definition Block",
381     "Memory Definition Block",
382     "Unknown Subtable Type"         /* Reserved */
383 };
384 
385 static const char           *AcpiDmLpitSubnames[] =
386 {
387     "Native C-state Idle Structure",
388     "Unknown Subtable Type"         /* Reserved */
389 };
390 
391 #define ACPI_FADT_PM_RESERVED       9
392 
393 static const char           *AcpiDmFadtProfiles[] =
394 {
395     "Unspecified",
396     "Desktop",
397     "Mobile",
398     "Workstation",
399     "Enterprise Server",
400     "SOHO Server",
401     "Appliance PC",
402     "Performance Server",
403     "Tablet",
404     "Unknown Profile Type"
405 };
406 
407 #define ACPI_GAS_WIDTH_RESERVED     5
408 
409 static const char           *AcpiDmGasAccessWidth[] =
410 {
411     "Undefined/Legacy",
412     "Byte Access:8",
413     "Word Access:16",
414     "DWord Access:32",
415     "QWord Access:64",
416     "Unknown Width Encoding"
417 };
418 
419 
420 /*******************************************************************************
421  *
422  * ACPI Table Data, indexed by signature.
423  *
424  * Each entry contains: Signature, Table Info, Handler, DtHandler,
425  *  Template, Description
426  *
427  * Simple tables have only a TableInfo structure, complex tables have a
428  * handler. This table must be NULL terminated. RSDP and FACS are
429  * special-cased elsewhere.
430  *
431  * Note: Any tables added here should be duplicated within AcpiSupportedTables
432  * in the file common/ahtable.c
433  *
434  ******************************************************************************/
435 
436 const ACPI_DMTABLE_DATA     AcpiDmTableData[] =
437 {
438     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf},
439     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert},
440     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt},
441     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot},
442     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep},
443     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt},
444     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2},
445     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp},
446     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar},
447     {ACPI_SIG_DRTM, NULL,                   AcpiDmDumpDrtm, DtCompileDrtm,  TemplateDrtm},
448     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt},
449     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj},
450     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst},
451     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt},
452     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt},
453     {ACPI_SIG_GTDT, NULL,                   AcpiDmDumpGtdt, DtCompileGtdt,  TemplateGtdt},
454     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest},
455     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet},
456     {ACPI_SIG_IORT, NULL,                   AcpiDmDumpIort, DtCompileIort,  TemplateIort},
457     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs},
458     {ACPI_SIG_LPIT, NULL,                   AcpiDmDumpLpit, DtCompileLpit,  TemplateLpit},
459     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt},
460     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg},
461     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi},
462     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst},
463     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct},
464     {ACPI_SIG_MSDM, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateMsdm},
465     {ACPI_SIG_MTMR, NULL,                   AcpiDmDumpMtmr, DtCompileMtmr,  TemplateMtmr},
466     {ACPI_SIG_NFIT, AcpiDmTableInfoNfit,    AcpiDmDumpNfit, DtCompileNfit,  TemplateNfit},
467     {ACPI_SIG_PCCT, AcpiDmTableInfoPcct,    AcpiDmDumpPcct, DtCompilePcct,  TemplatePcct},
468     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt},
469     {ACPI_SIG_RASF, AcpiDmTableInfoRasf,    NULL,           NULL,           TemplateRasf},
470     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt},
471     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt},
472     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst},
473     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic},
474     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit},
475     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr},
476     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi},
477     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat},
478     {ACPI_SIG_STAO, NULL,                   AcpiDmDumpStao, DtCompileStao,  TemplateStao},
479     {ACPI_SIG_TCPA, NULL,                   AcpiDmDumpTcpa, DtCompileTcpa,  TemplateTcpa},
480     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    NULL,           NULL,           TemplateTpm2},
481     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi},
482     {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc,    AcpiDmDumpVrtc, DtCompileVrtc,  TemplateVrtc},
483     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet},
484     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat},
485     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt},
486     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt},
487     {ACPI_SIG_WPBT, NULL,                   AcpiDmDumpWpbt, DtCompileWpbt,  TemplateWpbt},
488     {ACPI_SIG_XENV, AcpiDmTableInfoXenv,    NULL,           NULL,           TemplateXenv},
489     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt},
490     {NULL,          NULL,                   NULL,           NULL,           NULL}
491 };
492 
493 
494 /*******************************************************************************
495  *
496  * FUNCTION:    AcpiDmGenerateChecksum
497  *
498  * PARAMETERS:  Table               - Pointer to table to be checksummed
499  *              Length              - Length of the table
500  *              OriginalChecksum    - Value of the checksum field
501  *
502  * RETURN:      8 bit checksum of buffer
503  *
504  * DESCRIPTION: Computes an 8 bit checksum of the table.
505  *
506  ******************************************************************************/
507 
508 UINT8
509 AcpiDmGenerateChecksum (
510     void                    *Table,
511     UINT32                  Length,
512     UINT8                   OriginalChecksum)
513 {
514     UINT8                   Checksum;
515 
516 
517     /* Sum the entire table as-is */
518 
519     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
520 
521     /* Subtract off the existing checksum value in the table */
522 
523     Checksum = (UINT8) (Checksum - OriginalChecksum);
524 
525     /* Compute the final checksum */
526 
527     Checksum = (UINT8) (0 - Checksum);
528     return (Checksum);
529 }
530 
531 
532 /*******************************************************************************
533  *
534  * FUNCTION:    AcpiDmGetTableData
535  *
536  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
537  *
538  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
539  *
540  * DESCRIPTION: Find a match in the global table of supported ACPI tables
541  *
542  ******************************************************************************/
543 
544 const ACPI_DMTABLE_DATA *
545 AcpiDmGetTableData (
546     char                    *Signature)
547 {
548     const ACPI_DMTABLE_DATA *Info;
549 
550 
551     for (Info = AcpiDmTableData; Info->Signature; Info++)
552     {
553         if (ACPI_COMPARE_NAME (Signature, Info->Signature))
554         {
555             return (Info);
556         }
557     }
558 
559     return (NULL);
560 }
561 
562 
563 /*******************************************************************************
564  *
565  * FUNCTION:    AcpiDmDumpDataTable
566  *
567  * PARAMETERS:  Table               - An ACPI table
568  *
569  * RETURN:      None.
570  *
571  * DESCRIPTION: Format the contents of an ACPI data table (any table other
572  *              than an SSDT or DSDT that does not contain executable AML code)
573  *
574  ******************************************************************************/
575 
576 void
577 AcpiDmDumpDataTable (
578     ACPI_TABLE_HEADER       *Table)
579 {
580     ACPI_STATUS             Status;
581     const ACPI_DMTABLE_DATA *TableData;
582     UINT32                  Length;
583 
584 
585     /* Ignore tables that contain AML */
586 
587     if (AcpiUtIsAmlTable (Table))
588     {
589         if (Gbl_VerboseTemplates)
590         {
591             /* Dump the raw table data */
592 
593             Length = Table->Length;
594 
595             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
596                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
597             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
598                 Length, DB_BYTE_DISPLAY, 0);
599             AcpiOsPrintf (" */\n");
600         }
601         return;
602     }
603 
604     /*
605      * Handle tables that don't use the common ACPI table header structure.
606      * Currently, these are the FACS, RSDP, and S3PT.
607      */
608     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
609     {
610         Length = Table->Length;
611         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
612         if (ACPI_FAILURE (Status))
613         {
614             return;
615         }
616     }
617     else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
618     {
619         Length = AcpiDmDumpRsdp (Table);
620     }
621     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
622     {
623         Length = AcpiDmDumpS3pt (Table);
624     }
625     else
626     {
627         /*
628          * All other tables must use the common ACPI table header, dump it now
629          */
630         Length = Table->Length;
631         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
632         if (ACPI_FAILURE (Status))
633         {
634             return;
635         }
636         AcpiOsPrintf ("\n");
637 
638         /* Match signature and dispatch appropriately */
639 
640         TableData = AcpiDmGetTableData (Table->Signature);
641         if (!TableData)
642         {
643             if (!strncmp (Table->Signature, "OEM", 3))
644             {
645                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
646                     Table->Signature);
647             }
648             else
649             {
650                 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
651                     Table->Signature);
652 
653                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
654                     Table->Signature);
655 
656                 if (!AcpiGbl_ForceAmlDisassembly)
657                 {
658                     fprintf (stderr, "decoding ACPI table header only\n");
659                 }
660                 else
661                 {
662                     fprintf (stderr, "assuming table contains valid AML code\n");
663                 }
664             }
665         }
666         else if (TableData->TableHandler)
667         {
668             /* Complex table, has a handler */
669 
670             TableData->TableHandler (Table);
671         }
672         else if (TableData->TableInfo)
673         {
674             /* Simple table, just walk the info table */
675 
676             Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
677             if (ACPI_FAILURE (Status))
678             {
679                 return;
680             }
681         }
682     }
683 
684     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
685     {
686         /* Dump the raw table data */
687 
688         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
689             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
690         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
691             Length, DB_BYTE_DISPLAY, 0);
692     }
693 }
694 
695 
696 /*******************************************************************************
697  *
698  * FUNCTION:    AcpiDmLineHeader
699  *
700  * PARAMETERS:  Offset              - Current byte offset, from table start
701  *              ByteLength          - Length of the field in bytes, 0 for flags
702  *              Name                - Name of this field
703  *
704  * RETURN:      None
705  *
706  * DESCRIPTION: Utility routines for formatting output lines. Displays the
707  *              current table offset in hex and decimal, the field length,
708  *              and the field name.
709  *
710  ******************************************************************************/
711 
712 void
713 AcpiDmLineHeader (
714     UINT32                  Offset,
715     UINT32                  ByteLength,
716     char                    *Name)
717 {
718 
719     /* Allow a null name for fields that span multiple lines (large buffers) */
720 
721     if (!Name)
722     {
723         Name = "";
724     }
725 
726     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
727     {
728         if (ByteLength)
729         {
730             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
731         }
732         else
733         {
734             if (*Name)
735             {
736                 AcpiOsPrintf ("%41s : ", Name);
737             }
738             else
739             {
740                 AcpiOsPrintf ("%41s   ", Name);
741             }
742         }
743     }
744     else /* Normal disassembler or verbose template */
745     {
746         if (ByteLength)
747         {
748             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
749                 Offset, Offset, ByteLength, Name);
750         }
751         else
752         {
753             if (*Name)
754             {
755                 AcpiOsPrintf ("%44s : ", Name);
756             }
757             else
758             {
759                 AcpiOsPrintf ("%44s   ", Name);
760             }
761         }
762     }
763 }
764 
765 void
766 AcpiDmLineHeader2 (
767     UINT32                  Offset,
768     UINT32                  ByteLength,
769     char                    *Name,
770     UINT32                  Value)
771 {
772 
773     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
774     {
775         if (ByteLength)
776         {
777             AcpiOsPrintf ("[%.4d] %30s %3d : ",
778                 ByteLength, Name, Value);
779         }
780         else
781         {
782             AcpiOsPrintf ("%36s % 3d : ",
783                 Name, Value);
784         }
785     }
786     else /* Normal disassembler or verbose template */
787     {
788         if (ByteLength)
789         {
790             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
791                 Offset, Offset, ByteLength, Name, Value);
792         }
793         else
794         {
795             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
796                 Offset, Offset, Name, Value);
797         }
798     }
799 }
800 
801 
802 /*******************************************************************************
803  *
804  * FUNCTION:    AcpiDmDumpTable
805  *
806  * PARAMETERS:  TableLength         - Length of the entire ACPI table
807  *              TableOffset         - Starting offset within the table for this
808  *                                    sub-descriptor (0 if main table)
809  *              Table               - The ACPI table
810  *              SubtableLength      - Length of this sub-descriptor
811  *              Info                - Info table for this ACPI table
812  *
813  * RETURN:      Status
814  *
815  * DESCRIPTION: Display ACPI table contents by walking the Info table.
816  *
817  * Note: This function must remain in sync with DtGetFieldLength.
818  *
819  ******************************************************************************/
820 
821 ACPI_STATUS
822 AcpiDmDumpTable (
823     UINT32                  TableLength,
824     UINT32                  TableOffset,
825     void                    *Table,
826     UINT32                  SubtableLength,
827     ACPI_DMTABLE_INFO       *Info)
828 {
829     UINT8                   *Target;
830     UINT32                  CurrentOffset;
831     UINT32                  ByteLength;
832     UINT8                   Temp8;
833     UINT16                  Temp16;
834     UINT32                  Temp32;
835     UINT64                  Value;
836     const AH_TABLE          *TableData;
837     const char              *Name;
838     BOOLEAN                 LastOutputBlankLine = FALSE;
839     ACPI_STATUS             Status;
840     char                    RepairedName[8];
841 
842 
843     if (!Info)
844     {
845         AcpiOsPrintf ("Display not implemented\n");
846         return (AE_NOT_IMPLEMENTED);
847     }
848 
849     /* Walk entire Info table; Null name terminates */
850 
851     for (; Info->Name; Info++)
852     {
853         /*
854          * Target points to the field within the ACPI Table. CurrentOffset is
855          * the offset of the field from the start of the main table.
856          */
857         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
858         CurrentOffset = TableOffset + Info->Offset;
859 
860         /* Check for beyond subtable end or (worse) beyond EOT */
861 
862         if (SubtableLength && (Info->Offset >= SubtableLength))
863         {
864             AcpiOsPrintf (
865                 "/**** ACPI subtable terminates early - "
866                 "may be older version (dump table) */\n");
867 
868             /* Move on to next subtable */
869 
870             return (AE_OK);
871         }
872 
873         if (CurrentOffset >= TableLength)
874         {
875             AcpiOsPrintf (
876                 "/**** ACPI table terminates "
877                 "in the middle of a data structure! (dump table) */\n");
878             return (AE_BAD_DATA);
879         }
880 
881         /* Generate the byte length for this field */
882 
883         switch (Info->Opcode)
884         {
885         case ACPI_DMT_UINT8:
886         case ACPI_DMT_CHKSUM:
887         case ACPI_DMT_SPACEID:
888         case ACPI_DMT_ACCWIDTH:
889         case ACPI_DMT_IVRS:
890         case ACPI_DMT_GTDT:
891         case ACPI_DMT_MADT:
892         case ACPI_DMT_PCCT:
893         case ACPI_DMT_PMTT:
894         case ACPI_DMT_SRAT:
895         case ACPI_DMT_ASF:
896         case ACPI_DMT_HESTNTYP:
897         case ACPI_DMT_FADTPM:
898         case ACPI_DMT_EINJACT:
899         case ACPI_DMT_EINJINST:
900         case ACPI_DMT_ERSTACT:
901         case ACPI_DMT_ERSTINST:
902         case ACPI_DMT_DMAR_SCOPE:
903 
904             ByteLength = 1;
905             break;
906 
907         case ACPI_DMT_UINT16:
908         case ACPI_DMT_DMAR:
909         case ACPI_DMT_HEST:
910         case ACPI_DMT_NFIT:
911 
912             ByteLength = 2;
913             break;
914 
915         case ACPI_DMT_UINT24:
916 
917             ByteLength = 3;
918             break;
919 
920         case ACPI_DMT_UINT32:
921         case ACPI_DMT_NAME4:
922         case ACPI_DMT_SIG:
923         case ACPI_DMT_LPIT:
924 
925             ByteLength = 4;
926             break;
927 
928         case ACPI_DMT_UINT40:
929 
930             ByteLength = 5;
931             break;
932 
933         case ACPI_DMT_UINT48:
934         case ACPI_DMT_NAME6:
935 
936             ByteLength = 6;
937             break;
938 
939         case ACPI_DMT_UINT56:
940         case ACPI_DMT_BUF7:
941 
942             ByteLength = 7;
943             break;
944 
945         case ACPI_DMT_UINT64:
946         case ACPI_DMT_NAME8:
947 
948             ByteLength = 8;
949             break;
950 
951         case ACPI_DMT_BUF10:
952 
953             ByteLength = 10;
954             break;
955 
956         case ACPI_DMT_BUF12:
957 
958             ByteLength = 12;
959             break;
960 
961         case ACPI_DMT_BUF16:
962         case ACPI_DMT_UUID:
963 
964             ByteLength = 16;
965             break;
966 
967         case ACPI_DMT_BUF128:
968 
969             ByteLength = 128;
970             break;
971 
972         case ACPI_DMT_UNICODE:
973         case ACPI_DMT_BUFFER:
974         case ACPI_DMT_RAW_BUFFER:
975 
976             ByteLength = SubtableLength;
977             break;
978 
979         case ACPI_DMT_STRING:
980 
981             ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
982             break;
983 
984         case ACPI_DMT_GAS:
985 
986             if (!LastOutputBlankLine)
987             {
988                 AcpiOsPrintf ("\n");
989                 LastOutputBlankLine = TRUE;
990             }
991 
992             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
993             break;
994 
995         case ACPI_DMT_HESTNTFY:
996 
997             if (!LastOutputBlankLine)
998             {
999                 AcpiOsPrintf ("\n");
1000                 LastOutputBlankLine = TRUE;
1001             }
1002 
1003             ByteLength = sizeof (ACPI_HEST_NOTIFY);
1004             break;
1005 
1006         case ACPI_DMT_IORTMEM:
1007 
1008             if (!LastOutputBlankLine)
1009             {
1010                 LastOutputBlankLine = FALSE;
1011             }
1012 
1013             ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
1014             break;
1015 
1016         default:
1017 
1018             ByteLength = 0;
1019             break;
1020         }
1021 
1022         /* Check if we are beyond a subtable, or (worse) beyond EOT */
1023 
1024         if (CurrentOffset + ByteLength > TableLength)
1025         {
1026             if (SubtableLength)
1027             {
1028                 AcpiOsPrintf (
1029                     "/**** ACPI subtable terminates early - "
1030                     "may be older version (dump table) */\n");
1031 
1032                 /* Move on to next subtable */
1033 
1034                 return (AE_OK);
1035             }
1036 
1037             AcpiOsPrintf (
1038                 "/**** ACPI table terminates "
1039                 "in the middle of a data structure! */\n");
1040             return (AE_BAD_DATA);
1041         }
1042 
1043         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
1044         {
1045             AcpiOsPrintf ("%s", Info->Name);
1046             continue;
1047         }
1048 
1049         /* Start a new line and decode the opcode */
1050 
1051         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
1052 
1053         switch (Info->Opcode)
1054         {
1055         /* Single-bit Flag fields. Note: Opcode is the bit position */
1056 
1057         case ACPI_DMT_FLAG0:
1058         case ACPI_DMT_FLAG1:
1059         case ACPI_DMT_FLAG2:
1060         case ACPI_DMT_FLAG3:
1061         case ACPI_DMT_FLAG4:
1062         case ACPI_DMT_FLAG5:
1063         case ACPI_DMT_FLAG6:
1064         case ACPI_DMT_FLAG7:
1065 
1066             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
1067             break;
1068 
1069         /* 2-bit Flag fields */
1070 
1071         case ACPI_DMT_FLAGS0:
1072 
1073             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
1074             break;
1075 
1076         case ACPI_DMT_FLAGS1:
1077 
1078             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
1079             break;
1080 
1081         case ACPI_DMT_FLAGS2:
1082 
1083             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
1084             break;
1085 
1086         case ACPI_DMT_FLAGS4:
1087 
1088             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
1089             break;
1090 
1091         /* Integer Data Types */
1092 
1093         case ACPI_DMT_UINT8:
1094         case ACPI_DMT_UINT16:
1095         case ACPI_DMT_UINT24:
1096         case ACPI_DMT_UINT32:
1097         case ACPI_DMT_UINT40:
1098         case ACPI_DMT_UINT48:
1099         case ACPI_DMT_UINT56:
1100         case ACPI_DMT_UINT64:
1101             /*
1102              * Dump bytes - high byte first, low byte last.
1103              * Note: All ACPI tables are little-endian.
1104              */
1105             Value = 0;
1106             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
1107             {
1108                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
1109                 Value |= Target[Temp8 - 1];
1110                 Value <<= 8;
1111             }
1112 
1113             if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
1114             {
1115                 AcpiOsPrintf (" [Optional field not present]");
1116             }
1117 
1118             AcpiOsPrintf ("\n");
1119             break;
1120 
1121         case ACPI_DMT_BUF7:
1122         case ACPI_DMT_BUF10:
1123         case ACPI_DMT_BUF12:
1124         case ACPI_DMT_BUF16:
1125         case ACPI_DMT_BUF128:
1126             /*
1127              * Buffer: Size depends on the opcode and was set above.
1128              * Each hex byte is separated with a space.
1129              * Multiple lines are separated by line continuation char.
1130              */
1131             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
1132             {
1133                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
1134                 if ((UINT32) (Temp16 + 1) < ByteLength)
1135                 {
1136                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
1137                     {
1138                         AcpiOsPrintf (" \\\n"); /* Line continuation */
1139                         AcpiDmLineHeader (0, 0, NULL);
1140                     }
1141                     else
1142                     {
1143                         AcpiOsPrintf (" ");
1144                     }
1145                 }
1146             }
1147 
1148             AcpiOsPrintf ("\n");
1149             break;
1150 
1151         case ACPI_DMT_UUID:
1152 
1153             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
1154 
1155             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
1156 
1157             AcpiOsPrintf ("%s\n", MsgBuffer);
1158             break;
1159 
1160         case ACPI_DMT_STRING:
1161 
1162             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
1163             break;
1164 
1165         /* Fixed length ASCII name fields */
1166 
1167         case ACPI_DMT_SIG:
1168 
1169             AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1170             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
1171 
1172             TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
1173             if (TableData)
1174             {
1175                 AcpiOsPrintf (STRING_FORMAT, TableData->Description);
1176             }
1177             else
1178             {
1179                 AcpiOsPrintf ("\n");
1180             }
1181             break;
1182 
1183         case ACPI_DMT_NAME4:
1184 
1185             AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
1186             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
1187             break;
1188 
1189         case ACPI_DMT_NAME6:
1190 
1191             AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
1192             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
1193             break;
1194 
1195         case ACPI_DMT_NAME8:
1196 
1197             AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
1198             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
1199             break;
1200 
1201         /* Special Data Types */
1202 
1203         case ACPI_DMT_CHKSUM:
1204 
1205             /* Checksum, display and validate */
1206 
1207             AcpiOsPrintf ("%2.2X", *Target);
1208             Temp8 = AcpiDmGenerateChecksum (Table,
1209                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
1210                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
1211 
1212             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
1213             {
1214                 AcpiOsPrintf (
1215                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
1216             }
1217 
1218             AcpiOsPrintf ("\n");
1219             break;
1220 
1221         case ACPI_DMT_SPACEID:
1222 
1223             /* Address Space ID */
1224 
1225             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
1226             break;
1227 
1228         case ACPI_DMT_ACCWIDTH:
1229 
1230             /* Encoded Access Width */
1231 
1232             Temp8 = *Target;
1233             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
1234             {
1235                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
1236             }
1237 
1238             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]);
1239             break;
1240 
1241         case ACPI_DMT_GAS:
1242 
1243             /* Generic Address Structure */
1244 
1245             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
1246             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1247                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
1248             if (ACPI_FAILURE (Status))
1249             {
1250                 return (Status);
1251             }
1252 
1253             AcpiOsPrintf ("\n");
1254             LastOutputBlankLine = TRUE;
1255             break;
1256 
1257         case ACPI_DMT_ASF:
1258 
1259             /* ASF subtable types */
1260 
1261             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
1262             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
1263             {
1264                 Temp16 = ACPI_ASF_TYPE_RESERVED;
1265             }
1266 
1267             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
1268             break;
1269 
1270         case ACPI_DMT_DMAR:
1271 
1272             /* DMAR subtable types */
1273 
1274             Temp16 = ACPI_GET16 (Target);
1275             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
1276             {
1277                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
1278             }
1279 
1280             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1281                 AcpiDmDmarSubnames[Temp16]);
1282             break;
1283 
1284         case ACPI_DMT_DMAR_SCOPE:
1285 
1286             /* DMAR device scope types */
1287 
1288             Temp8 = *Target;
1289             if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
1290             {
1291                 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
1292             }
1293 
1294             AcpiOsPrintf (UINT8_FORMAT, *Target,
1295                 AcpiDmDmarScope[Temp8]);
1296             break;
1297 
1298         case ACPI_DMT_EINJACT:
1299 
1300             /* EINJ Action types */
1301 
1302             Temp8 = *Target;
1303             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
1304             {
1305                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
1306             }
1307 
1308             AcpiOsPrintf (UINT8_FORMAT, *Target,
1309                 AcpiDmEinjActions[Temp8]);
1310             break;
1311 
1312         case ACPI_DMT_EINJINST:
1313 
1314             /* EINJ Instruction types */
1315 
1316             Temp8 = *Target;
1317             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
1318             {
1319                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
1320             }
1321 
1322             AcpiOsPrintf (UINT8_FORMAT, *Target,
1323                 AcpiDmEinjInstructions[Temp8]);
1324             break;
1325 
1326         case ACPI_DMT_ERSTACT:
1327 
1328             /* ERST Action types */
1329 
1330             Temp8 = *Target;
1331             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
1332             {
1333                 Temp8 = ACPI_ERST_ACTION_RESERVED;
1334             }
1335 
1336             AcpiOsPrintf (UINT8_FORMAT, *Target,
1337                 AcpiDmErstActions[Temp8]);
1338             break;
1339 
1340         case ACPI_DMT_ERSTINST:
1341 
1342             /* ERST Instruction types */
1343 
1344             Temp8 = *Target;
1345             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
1346             {
1347                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
1348             }
1349 
1350             AcpiOsPrintf (UINT8_FORMAT, *Target,
1351                 AcpiDmErstInstructions[Temp8]);
1352             break;
1353 
1354         case ACPI_DMT_GTDT:
1355 
1356             /* GTDT subtable types */
1357 
1358             Temp8 = *Target;
1359             if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
1360             {
1361                 Temp8 = ACPI_GTDT_TYPE_RESERVED;
1362             }
1363 
1364             AcpiOsPrintf (UINT8_FORMAT, *Target,
1365                 AcpiDmGtdtSubnames[Temp8]);
1366             break;
1367 
1368         case ACPI_DMT_HEST:
1369 
1370             /* HEST subtable types */
1371 
1372             Temp16 = ACPI_GET16 (Target);
1373             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
1374             {
1375                 Temp16 = ACPI_HEST_TYPE_RESERVED;
1376             }
1377 
1378             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1379                 AcpiDmHestSubnames[Temp16]);
1380             break;
1381 
1382         case ACPI_DMT_HESTNTFY:
1383 
1384             AcpiOsPrintf (STRING_FORMAT,
1385                 "Hardware Error Notification Structure");
1386 
1387             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1388                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
1389             if (ACPI_FAILURE (Status))
1390             {
1391                 return (Status);
1392             }
1393 
1394             AcpiOsPrintf ("\n");
1395             LastOutputBlankLine = TRUE;
1396             break;
1397 
1398         case ACPI_DMT_HESTNTYP:
1399 
1400             /* HEST Notify types */
1401 
1402             Temp8 = *Target;
1403             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
1404             {
1405                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
1406             }
1407 
1408             AcpiOsPrintf (UINT8_FORMAT, *Target,
1409                 AcpiDmHestNotifySubnames[Temp8]);
1410             break;
1411 
1412         case ACPI_DMT_IORTMEM:
1413 
1414             AcpiOsPrintf (STRING_FORMAT,
1415                 "IORT Memory Access Properties");
1416 
1417             Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target,
1418                 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc);
1419             if (ACPI_FAILURE (Status))
1420             {
1421                 return (Status);
1422             }
1423 
1424             LastOutputBlankLine = TRUE;
1425             break;
1426 
1427         case ACPI_DMT_MADT:
1428 
1429             /* MADT subtable types */
1430 
1431             Temp8 = *Target;
1432             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
1433             {
1434                 Temp8 = ACPI_MADT_TYPE_RESERVED;
1435             }
1436 
1437             AcpiOsPrintf (UINT8_FORMAT, *Target,
1438                 AcpiDmMadtSubnames[Temp8]);
1439             break;
1440 
1441         case ACPI_DMT_NFIT:
1442 
1443             /* NFIT subtable types */
1444 
1445             Temp16 = ACPI_GET16 (Target);
1446             if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
1447             {
1448                 Temp16 = ACPI_NFIT_TYPE_RESERVED;
1449             }
1450 
1451             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
1452                 AcpiDmNfitSubnames[Temp16]);
1453             break;
1454 
1455         case ACPI_DMT_PCCT:
1456 
1457             /* PCCT subtable types */
1458 
1459             Temp8 = *Target;
1460             if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
1461             {
1462                 Temp8 = ACPI_PCCT_TYPE_RESERVED;
1463             }
1464 
1465             AcpiOsPrintf (UINT8_FORMAT, *Target,
1466                 AcpiDmPcctSubnames[Temp8]);
1467             break;
1468 
1469         case ACPI_DMT_PMTT:
1470 
1471             /* PMTT subtable types */
1472 
1473             Temp8 = *Target;
1474             if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
1475             {
1476                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
1477             }
1478 
1479             AcpiOsPrintf (UINT8_FORMAT, *Target,
1480                 AcpiDmPmttSubnames[Temp8]);
1481             break;
1482 
1483         case ACPI_DMT_UNICODE:
1484 
1485             if (ByteLength == 0)
1486             {
1487                 AcpiOsPrintf ("/* Zero-length Data */\n");
1488                 break;
1489             }
1490 
1491             AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
1492             break;
1493 
1494         case ACPI_DMT_RAW_BUFFER:
1495 
1496             if (ByteLength == 0)
1497             {
1498                 AcpiOsPrintf ("/* Zero-length Data */\n");
1499                 break;
1500             }
1501 
1502             AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength,
1503                 CurrentOffset, NULL);
1504             break;
1505 
1506         case ACPI_DMT_SRAT:
1507 
1508             /* SRAT subtable types */
1509 
1510             Temp8 = *Target;
1511             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
1512             {
1513                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
1514             }
1515 
1516             AcpiOsPrintf (UINT8_FORMAT, *Target,
1517                 AcpiDmSratSubnames[Temp8]);
1518             break;
1519 
1520         case ACPI_DMT_FADTPM:
1521 
1522             /* FADT Preferred PM Profile names */
1523 
1524             Temp8 = *Target;
1525             if (Temp8 > ACPI_FADT_PM_RESERVED)
1526             {
1527                 Temp8 = ACPI_FADT_PM_RESERVED;
1528             }
1529 
1530             AcpiOsPrintf (UINT8_FORMAT, *Target,
1531                 AcpiDmFadtProfiles[Temp8]);
1532             break;
1533 
1534         case ACPI_DMT_IVRS:
1535 
1536             /* IVRS subtable types */
1537 
1538             Temp8 = *Target;
1539             switch (Temp8)
1540             {
1541             case ACPI_IVRS_TYPE_HARDWARE:
1542 
1543                 Name = AcpiDmIvrsSubnames[0];
1544                 break;
1545 
1546             case ACPI_IVRS_TYPE_MEMORY1:
1547             case ACPI_IVRS_TYPE_MEMORY2:
1548             case ACPI_IVRS_TYPE_MEMORY3:
1549 
1550                 Name = AcpiDmIvrsSubnames[1];
1551                 break;
1552 
1553             default:
1554 
1555                 Name = AcpiDmIvrsSubnames[2];
1556                 break;
1557             }
1558 
1559             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
1560             break;
1561 
1562         case ACPI_DMT_LPIT:
1563 
1564             /* LPIT subtable types */
1565 
1566             Temp32 = ACPI_GET32 (Target);
1567             if (Temp32 > ACPI_LPIT_TYPE_RESERVED)
1568             {
1569                 Temp32 = ACPI_LPIT_TYPE_RESERVED;
1570             }
1571 
1572             AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target),
1573                 AcpiDmLpitSubnames[Temp32]);
1574             break;
1575 
1576         case ACPI_DMT_EXIT:
1577 
1578             return (AE_OK);
1579 
1580         default:
1581 
1582             ACPI_ERROR ((AE_INFO,
1583                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
1584             return (AE_SUPPORT);
1585         }
1586     }
1587 
1588     if (TableOffset && !SubtableLength)
1589     {
1590         /*
1591          * If this table is not the main table, the subtable must have a
1592          * valid length
1593          */
1594         AcpiOsPrintf ("Invalid zero length subtable\n");
1595         return (AE_BAD_DATA);
1596     }
1597 
1598     return (AE_OK);
1599 }
1600