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