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