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