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