Home | History | Annotate | Line # | Download | only in common
dmtable.c revision 1.1.1.5
      1 /******************************************************************************
      2  *
      3  * Module Name: dmtable - Support for ACPI tables that contain no AML code
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2014, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #include "acpi.h"
     45 #include "accommon.h"
     46 #include "acdisasm.h"
     47 #include "actables.h"
     48 #include "aslcompiler.h"
     49 #include "dtcompiler.h"
     50 
     51 /* This module used for application-level code only */
     52 
     53 #define _COMPONENT          ACPI_CA_DISASSEMBLER
     54         ACPI_MODULE_NAME    ("dmtable")
     55 
     56 /* Local Prototypes */
     57 
     58 static void
     59 AcpiDmCheckAscii (
     60     UINT8                   *Target,
     61     char                    *RepairedName,
     62     UINT32                  Count);
     63 
     64 
     65 /* Common format strings for commented values */
     66 
     67 #define UINT8_FORMAT        "%2.2X [%s]\n"
     68 #define UINT16_FORMAT       "%4.4X [%s]\n"
     69 #define UINT32_FORMAT       "%8.8X [%s]\n"
     70 #define STRING_FORMAT       "[%s]\n"
     71 
     72 /* These tables map a subtable type to a description string */
     73 
     74 static const char           *AcpiDmAsfSubnames[] =
     75 {
     76     "ASF Information",
     77     "ASF Alerts",
     78     "ASF Remote Control",
     79     "ASF RMCP Boot Options",
     80     "ASF Address",
     81     "Unknown SubTable Type"         /* Reserved */
     82 };
     83 
     84 static const char           *AcpiDmDmarSubnames[] =
     85 {
     86     "Hardware Unit Definition",
     87     "Reserved Memory Region",
     88     "Root Port ATS Capability",
     89     "Remapping Hardware Static Affinity",
     90     "ACPI Namespace Device Declaration",
     91     "Unknown SubTable Type"         /* Reserved */
     92 };
     93 
     94 static const char           *AcpiDmDmarScope[] =
     95 {
     96     "Reserved value",
     97     "PCI Endpoint Device",
     98     "PCI Bridge Device",
     99     "IOAPIC Device",
    100     "Message-capable HPET Device",
    101     "Namespace Device",
    102     "Unknown Scope Type"            /* Reserved */
    103 };
    104 
    105 static const char           *AcpiDmEinjActions[] =
    106 {
    107     "Begin Operation",
    108     "Get Trigger Table",
    109     "Set Error Type",
    110     "Get Error Type",
    111     "End Operation",
    112     "Execute Operation",
    113     "Check Busy Status",
    114     "Get Command Status",
    115     "Set Error Type With Address",
    116     "Unknown Action"
    117 };
    118 
    119 static const char           *AcpiDmEinjInstructions[] =
    120 {
    121     "Read Register",
    122     "Read Register Value",
    123     "Write Register",
    124     "Write Register Value",
    125     "Noop",
    126     "Flush Cacheline",
    127     "Unknown Instruction"
    128 };
    129 
    130 static const char           *AcpiDmErstActions[] =
    131 {
    132     "Begin Write Operation",
    133     "Begin Read Operation",
    134     "Begin Clear Operation",
    135     "End Operation",
    136     "Set Record Offset",
    137     "Execute Operation",
    138     "Check Busy Status",
    139     "Get Command Status",
    140     "Get Record Identifier",
    141     "Set Record Identifier",
    142     "Get Record Count",
    143     "Begin Dummy Write",
    144     "Unused/Unknown Action",
    145     "Get Error Address Range",
    146     "Get Error Address Length",
    147     "Get Error Attributes",
    148     "Unknown Action"
    149 };
    150 
    151 static const char           *AcpiDmErstInstructions[] =
    152 {
    153     "Read Register",
    154     "Read Register Value",
    155     "Write Register",
    156     "Write Register Value",
    157     "Noop",
    158     "Load Var1",
    159     "Load Var2",
    160     "Store Var1",
    161     "Add",
    162     "Subtract",
    163     "Add Value",
    164     "Subtract Value",
    165     "Stall",
    166     "Stall While True",
    167     "Skip Next If True",
    168     "GoTo",
    169     "Set Source Address",
    170     "Set Destination Address",
    171     "Move Data",
    172     "Unknown Instruction"
    173 };
    174 
    175 static const char           *AcpiDmGtdtSubnames[] =
    176 {
    177     "Generic Timer Block",
    178     "Generic Watchdog Timer",
    179     "Unknown SubTable Type"         /* Reserved */
    180 };
    181 
    182 static const char           *AcpiDmHestSubnames[] =
    183 {
    184     "IA-32 Machine Check Exception",
    185     "IA-32 Corrected Machine Check",
    186     "IA-32 Non-Maskable Interrupt",
    187     "Unknown SubTable Type",        /* 3 - Reserved */
    188     "Unknown SubTable Type",        /* 4 - Reserved */
    189     "Unknown SubTable Type",        /* 5 - Reserved */
    190     "PCI Express Root Port AER",
    191     "PCI Express AER (AER Endpoint)",
    192     "PCI Express/PCI-X Bridge AER",
    193     "Generic Hardware Error Source",
    194     "Unknown SubTable Type"         /* Reserved */
    195 };
    196 
    197 static const char           *AcpiDmHestNotifySubnames[] =
    198 {
    199     "Polled",
    200     "External Interrupt",
    201     "Local Interrupt",
    202     "SCI",
    203     "NMI",
    204     "CMCI",                         /* ACPI 5.0 */
    205     "MCE",                          /* ACPI 5.0 */
    206     "Unknown Notify Type"           /* Reserved */
    207 };
    208 
    209 static const char           *AcpiDmMadtSubnames[] =
    210 {
    211     "Processor Local APIC",             /* ACPI_MADT_TYPE_LOCAL_APIC */
    212     "I/O APIC",                         /* ACPI_MADT_TYPE_IO_APIC */
    213     "Interrupt Source Override",        /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
    214     "NMI Source",                       /* ACPI_MADT_TYPE_NMI_SOURCE */
    215     "Local APIC NMI",                   /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
    216     "Local APIC Address Override",      /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
    217     "I/O SAPIC",                        /* ACPI_MADT_TYPE_IO_SAPIC */
    218     "Local SAPIC",                      /* ACPI_MADT_TYPE_LOCAL_SAPIC */
    219     "Platform Interrupt Sources",       /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
    220     "Processor Local x2APIC",           /* ACPI_MADT_TYPE_LOCAL_X2APIC */
    221     "Local x2APIC NMI",                 /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
    222     "Generic Interrupt Controller",     /* ACPI_MADT_GENERIC_INTERRUPT */
    223     "Generic Interrupt Distributor",    /* ACPI_MADT_GENERIC_DISTRIBUTOR */
    224     "Generic MSI Frame",                /* ACPI_MADT_GENERIC_MSI_FRAME */
    225     "Generic Interrupt Redistributor",  /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
    226     "Unknown SubTable Type"             /* Reserved */
    227 };
    228 
    229 static const char           *AcpiDmPcctSubnames[] =
    230 {
    231     "Generic Communications Subspace",  /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
    232     "HW-Reduced Communications Subspace",
    233     "Unknown SubTable Type"             /* Reserved */
    234 };
    235 
    236 static const char           *AcpiDmPmttSubnames[] =
    237 {
    238     "Socket",                       /* ACPI_PMTT_TYPE_SOCKET */
    239     "Memory Controller",            /* ACPI_PMTT_TYPE_CONTROLLER */
    240     "Physical Component (DIMM)",    /* ACPI_PMTT_TYPE_DIMM  */
    241     "Unknown SubTable Type"         /* Reserved */
    242 };
    243 
    244 static const char           *AcpiDmSlicSubnames[] =
    245 {
    246     "Public Key Structure",
    247     "Windows Marker Structure",
    248     "Unknown SubTable Type"         /* Reserved */
    249 };
    250 
    251 static const char           *AcpiDmSratSubnames[] =
    252 {
    253     "Processor Local APIC/SAPIC Affinity",
    254     "Memory Affinity",
    255     "Processor Local x2APIC Affinity",
    256     "GICC Affinity",
    257     "Unknown SubTable Type"         /* Reserved */
    258 };
    259 
    260 static const char           *AcpiDmIvrsSubnames[] =
    261 {
    262     "Hardware Definition Block",
    263     "Memory Definition Block",
    264     "Unknown SubTable Type"         /* Reserved */
    265 };
    266 
    267 static const char           *AcpiDmLpitSubnames[] =
    268 {
    269     "Native C-state Idle Structure",
    270     "Simple I/O Idle Structure",
    271     "Unknown SubTable Type"         /* Reserved */
    272 };
    273 
    274 #define ACPI_FADT_PM_RESERVED       9
    275 
    276 static const char           *AcpiDmFadtProfiles[] =
    277 {
    278     "Unspecified",
    279     "Desktop",
    280     "Mobile",
    281     "Workstation",
    282     "Enterprise Server",
    283     "SOHO Server",
    284     "Appliance PC",
    285     "Performance Server",
    286     "Tablet",
    287     "Unknown Profile Type"
    288 };
    289 
    290 #define ACPI_GAS_WIDTH_RESERVED     5
    291 
    292 static const char           *AcpiDmGasAccessWidth[] =
    293 {
    294     "Undefined/Legacy",
    295     "Byte Access:8",
    296     "Word Access:16",
    297     "DWord Access:32",
    298     "QWord Access:64",
    299     "Unknown Width Encoding"
    300 };
    301 
    302 
    303 /*******************************************************************************
    304  *
    305  * ACPI Table Data, indexed by signature.
    306  *
    307  * Each entry contains: Signature, Table Info, Handler, DtHandler,
    308  *  Template, Description
    309  *
    310  * Simple tables have only a TableInfo structure, complex tables have a
    311  * handler. This table must be NULL terminated. RSDP and FACS are
    312  * special-cased elsewhere.
    313  *
    314  ******************************************************************************/
    315 
    316 ACPI_DMTABLE_DATA    AcpiDmTableData[] =
    317 {
    318     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf,    "Alert Standard Format table"},
    319     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert,   "Boot Error Record Table"},
    320     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt,   "Boot Graphics Resource Table"},
    321     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot,   "Simple Boot Flag Table"},
    322     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep,   "Corrected Platform Error Polling table"},
    323     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt,   "Core System Resource Table"},
    324     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2,   "Debug Port table type 2"},
    325     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp,   "Debug Port table"},
    326     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar,   "DMA Remapping table"},
    327     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt,   "Embedded Controller Boot Resources Table"},
    328     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj,   "Error Injection table"},
    329     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst,   "Error Record Serialization Table"},
    330     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt,   "Fixed ACPI Description Table (FADT)"},
    331     {ACPI_SIG_FPDT, NULL,                   AcpiDmDumpFpdt, DtCompileFpdt,  TemplateFpdt,   "Firmware Performance Data Table"},
    332     {ACPI_SIG_GTDT, NULL,                   AcpiDmDumpGtdt, DtCompileGtdt,  TemplateGtdt,   "Generic Timer Description Table"},
    333     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest,   "Hardware Error Source Table"},
    334     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet,   "High Precision Event Timer table"},
    335     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs,   "I/O Virtualization Reporting Structure"},
    336     {ACPI_SIG_LPIT, NULL,                   AcpiDmDumpLpit, DtCompileLpit,  TemplateLpit,   "Low Power Idle Table"},
    337     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt,   "Multiple APIC Description Table (MADT)"},
    338     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg,   "Memory Mapped Configuration table"},
    339     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi,   "Management Controller Host Interface table"},
    340     {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst,   "Memory Power State Table"},
    341     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct,   "Maximum System Characteristics Table"},
    342     {ACPI_SIG_MTMR, NULL,                   AcpiDmDumpMtmr, DtCompileMtmr,  TemplateMtmr,   "MID Timer Table"},
    343     {ACPI_SIG_PCCT, AcpiDmTableInfoPcct,    AcpiDmDumpPcct, DtCompilePcct,  TemplatePcct,   "Platform Communications Channel Table"},
    344     {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt,   "Platform Memory Topology Table"},
    345     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt,   "Root System Description Table"},
    346     {ACPI_SIG_S3PT, NULL,                   NULL,           NULL,           TemplateS3pt,   "S3 Performance Table"},
    347     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst,   "Smart Battery Specification Table"},
    348     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic,   "Software Licensing Description Table"},
    349     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit,   "System Locality Information Table"},
    350     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr,   "Serial Port Console Redirection table"},
    351     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi,   "Server Platform Management Interface table"},
    352     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat,   "System Resource Affinity Table"},
    353     {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           NULL,           TemplateTcpa,   "Trusted Computing Platform Alliance table"},
    354     {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    NULL,           NULL,           TemplateTpm2,   "Trusted Platform Module hardware interface table"},
    355     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"},
    356     {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc,    AcpiDmDumpVrtc, DtCompileVrtc,  TemplateVrtc,   "Virtual Real-Time Clock Table"},
    357     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},
    358     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},
    359     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"},
    360     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt,   "Watchdog Resource Table"},
    361     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt,   "Extended System Description Table"},
    362     {NULL,          NULL,                   NULL,           NULL,           NULL,           NULL}
    363 };
    364 
    365 
    366 /*******************************************************************************
    367  *
    368  * FUNCTION:    AcpiDmGenerateChecksum
    369  *
    370  * PARAMETERS:  Table               - Pointer to table to be checksummed
    371  *              Length              - Length of the table
    372  *              OriginalChecksum    - Value of the checksum field
    373  *
    374  * RETURN:      8 bit checksum of buffer
    375  *
    376  * DESCRIPTION: Computes an 8 bit checksum of the table.
    377  *
    378  ******************************************************************************/
    379 
    380 UINT8
    381 AcpiDmGenerateChecksum (
    382     void                    *Table,
    383     UINT32                  Length,
    384     UINT8                   OriginalChecksum)
    385 {
    386     UINT8                   Checksum;
    387 
    388 
    389     /* Sum the entire table as-is */
    390 
    391     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
    392 
    393     /* Subtract off the existing checksum value in the table */
    394 
    395     Checksum = (UINT8) (Checksum - OriginalChecksum);
    396 
    397     /* Compute the final checksum */
    398 
    399     Checksum = (UINT8) (0 - Checksum);
    400     return (Checksum);
    401 }
    402 
    403 
    404 /*******************************************************************************
    405  *
    406  * FUNCTION:    AcpiDmGetTableData
    407  *
    408  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
    409  *
    410  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
    411  *
    412  * DESCRIPTION: Find a match in the global table of supported ACPI tables
    413  *
    414  ******************************************************************************/
    415 
    416 ACPI_DMTABLE_DATA *
    417 AcpiDmGetTableData (
    418     char                    *Signature)
    419 {
    420     ACPI_DMTABLE_DATA       *TableData;
    421 
    422 
    423     for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
    424     {
    425         if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
    426         {
    427             return (TableData);
    428         }
    429     }
    430 
    431     return (NULL);
    432 }
    433 
    434 
    435 /*******************************************************************************
    436  *
    437  * FUNCTION:    AcpiDmDumpDataTable
    438  *
    439  * PARAMETERS:  Table               - An ACPI table
    440  *
    441  * RETURN:      None.
    442  *
    443  * DESCRIPTION: Format the contents of an ACPI data table (any table other
    444  *              than an SSDT or DSDT that does not contain executable AML code)
    445  *
    446  ******************************************************************************/
    447 
    448 void
    449 AcpiDmDumpDataTable (
    450     ACPI_TABLE_HEADER       *Table)
    451 {
    452     ACPI_STATUS             Status;
    453     ACPI_DMTABLE_DATA       *TableData;
    454     UINT32                  Length;
    455 
    456 
    457     /* Ignore tables that contain AML */
    458 
    459     if (AcpiUtIsAmlTable (Table))
    460     {
    461         if (Gbl_VerboseTemplates)
    462         {
    463             /* Dump the raw table data */
    464 
    465             Length = Table->Length;
    466 
    467             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
    468                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
    469             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
    470                 Length, DB_BYTE_DISPLAY, 0);
    471             AcpiOsPrintf (" */\n");
    472         }
    473         return;
    474     }
    475 
    476     /*
    477      * Handle tables that don't use the common ACPI table header structure.
    478      * Currently, these are the FACS, RSDP, and S3PT.
    479      */
    480     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
    481     {
    482         Length = Table->Length;
    483         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
    484     }
    485     else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
    486     {
    487         Length = AcpiDmDumpRsdp (Table);
    488     }
    489     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
    490     {
    491         Length = AcpiDmDumpS3pt (Table);
    492     }
    493     else
    494     {
    495         /*
    496          * All other tables must use the common ACPI table header, dump it now
    497          */
    498         Length = Table->Length;
    499         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
    500         if (ACPI_FAILURE (Status))
    501         {
    502             return;
    503         }
    504         AcpiOsPrintf ("\n");
    505 
    506         /* Match signature and dispatch appropriately */
    507 
    508         TableData = AcpiDmGetTableData (Table->Signature);
    509         if (!TableData)
    510         {
    511             if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
    512             {
    513                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
    514                     Table->Signature);
    515             }
    516             else
    517             {
    518                 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
    519                     Table->Signature);
    520                 fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",
    521                     Table->Signature);
    522             }
    523         }
    524         else if (TableData->TableHandler)
    525         {
    526             /* Complex table, has a handler */
    527 
    528             TableData->TableHandler (Table);
    529         }
    530         else if (TableData->TableInfo)
    531         {
    532             /* Simple table, just walk the info table */
    533 
    534             AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
    535         }
    536     }
    537 
    538     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
    539     {
    540         /* Dump the raw table data */
    541 
    542         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
    543             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
    544         AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table),
    545             Length, DB_BYTE_DISPLAY, 0);
    546     }
    547 }
    548 
    549 
    550 /*******************************************************************************
    551  *
    552  * FUNCTION:    AcpiDmLineHeader
    553  *
    554  * PARAMETERS:  Offset              - Current byte offset, from table start
    555  *              ByteLength          - Length of the field in bytes, 0 for flags
    556  *              Name                - Name of this field
    557  *              Value               - Optional value, displayed on left of ':'
    558  *
    559  * RETURN:      None
    560  *
    561  * DESCRIPTION: Utility routines for formatting output lines. Displays the
    562  *              current table offset in hex and decimal, the field length,
    563  *              and the field name.
    564  *
    565  ******************************************************************************/
    566 
    567 void
    568 AcpiDmLineHeader (
    569     UINT32                  Offset,
    570     UINT32                  ByteLength,
    571     char                    *Name)
    572 {
    573 
    574     /* Allow a null name for fields that span multiple lines (large buffers) */
    575 
    576     if (!Name)
    577     {
    578         Name = "";
    579     }
    580 
    581     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
    582     {
    583         if (ByteLength)
    584         {
    585             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
    586         }
    587         else
    588         {
    589             if (*Name)
    590             {
    591                 AcpiOsPrintf ("%41s : ", Name);
    592             }
    593             else
    594             {
    595                 AcpiOsPrintf ("%41s   ", Name);
    596             }
    597         }
    598     }
    599     else /* Normal disassembler or verbose template */
    600     {
    601         if (ByteLength)
    602         {
    603             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
    604                 Offset, Offset, ByteLength, Name);
    605         }
    606         else
    607         {
    608             if (*Name)
    609             {
    610                 AcpiOsPrintf ("%44s : ", Name);
    611             }
    612             else
    613             {
    614                 AcpiOsPrintf ("%44s   ", Name);
    615             }
    616         }
    617     }
    618 }
    619 
    620 void
    621 AcpiDmLineHeader2 (
    622     UINT32                  Offset,
    623     UINT32                  ByteLength,
    624     char                    *Name,
    625     UINT32                  Value)
    626 {
    627 
    628     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
    629     {
    630         if (ByteLength)
    631         {
    632             AcpiOsPrintf ("[%.4d] %30s %3d : ",
    633                 ByteLength, Name, Value);
    634         }
    635         else
    636         {
    637             AcpiOsPrintf ("%36s % 3d : ",
    638                 Name, Value);
    639         }
    640     }
    641     else /* Normal disassembler or verbose template */
    642     {
    643         if (ByteLength)
    644         {
    645             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
    646                 Offset, Offset, ByteLength, Name, Value);
    647         }
    648         else
    649         {
    650             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
    651                 Offset, Offset, Name, Value);
    652         }
    653     }
    654 }
    655 
    656 
    657 /*******************************************************************************
    658  *
    659  * FUNCTION:    AcpiDmDumpTable
    660  *
    661  * PARAMETERS:  TableLength         - Length of the entire ACPI table
    662  *              TableOffset         - Starting offset within the table for this
    663  *                                    sub-descriptor (0 if main table)
    664  *              Table               - The ACPI table
    665  *              SubtableLength      - Length of this sub-descriptor
    666  *              Info                - Info table for this ACPI table
    667  *
    668  * RETURN:      None
    669  *
    670  * DESCRIPTION: Display ACPI table contents by walking the Info table.
    671  *
    672  * Note: This function must remain in sync with DtGetFieldLength.
    673  *
    674  ******************************************************************************/
    675 
    676 ACPI_STATUS
    677 AcpiDmDumpTable (
    678     UINT32                  TableLength,
    679     UINT32                  TableOffset,
    680     void                    *Table,
    681     UINT32                  SubtableLength,
    682     ACPI_DMTABLE_INFO       *Info)
    683 {
    684     UINT8                   *Target;
    685     UINT32                  CurrentOffset;
    686     UINT32                  ByteLength;
    687     UINT8                   Temp8;
    688     UINT16                  Temp16;
    689     UINT64                  Value;
    690     ACPI_DMTABLE_DATA       *TableData;
    691     const char              *Name;
    692     BOOLEAN                 LastOutputBlankLine = FALSE;
    693     char                    RepairedName[8];
    694 
    695 
    696     if (!Info)
    697     {
    698         AcpiOsPrintf ("Display not implemented\n");
    699         return (AE_NOT_IMPLEMENTED);
    700     }
    701 
    702     /* Walk entire Info table; Null name terminates */
    703 
    704     for (; Info->Name; Info++)
    705     {
    706         /*
    707          * Target points to the field within the ACPI Table. CurrentOffset is
    708          * the offset of the field from the start of the main table.
    709          */
    710         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
    711         CurrentOffset = TableOffset + Info->Offset;
    712 
    713         /* Check for beyond EOT or beyond subtable end */
    714 
    715         if ((CurrentOffset >= TableLength) ||
    716             (SubtableLength && (Info->Offset >= SubtableLength)))
    717         {
    718             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
    719             return (AE_BAD_DATA);
    720         }
    721 
    722         /* Generate the byte length for this field */
    723 
    724         switch (Info->Opcode)
    725         {
    726         case ACPI_DMT_UINT8:
    727         case ACPI_DMT_CHKSUM:
    728         case ACPI_DMT_SPACEID:
    729         case ACPI_DMT_ACCWIDTH:
    730         case ACPI_DMT_IVRS:
    731         case ACPI_DMT_GTDT:
    732         case ACPI_DMT_MADT:
    733         case ACPI_DMT_PCCT:
    734         case ACPI_DMT_PMTT:
    735         case ACPI_DMT_SRAT:
    736         case ACPI_DMT_ASF:
    737         case ACPI_DMT_HESTNTYP:
    738         case ACPI_DMT_FADTPM:
    739         case ACPI_DMT_EINJACT:
    740         case ACPI_DMT_EINJINST:
    741         case ACPI_DMT_ERSTACT:
    742         case ACPI_DMT_ERSTINST:
    743         case ACPI_DMT_DMAR_SCOPE:
    744 
    745             ByteLength = 1;
    746             break;
    747 
    748         case ACPI_DMT_UINT16:
    749         case ACPI_DMT_DMAR:
    750         case ACPI_DMT_HEST:
    751 
    752             ByteLength = 2;
    753             break;
    754 
    755         case ACPI_DMT_UINT24:
    756 
    757             ByteLength = 3;
    758             break;
    759 
    760         case ACPI_DMT_UINT32:
    761         case ACPI_DMT_NAME4:
    762         case ACPI_DMT_SIG:
    763         case ACPI_DMT_SLIC:
    764         case ACPI_DMT_LPIT:
    765 
    766             ByteLength = 4;
    767             break;
    768 
    769         case ACPI_DMT_UINT40:
    770 
    771             ByteLength = 5;
    772             break;
    773 
    774         case ACPI_DMT_UINT48:
    775         case ACPI_DMT_NAME6:
    776 
    777             ByteLength = 6;
    778             break;
    779 
    780         case ACPI_DMT_UINT56:
    781         case ACPI_DMT_BUF7:
    782 
    783             ByteLength = 7;
    784             break;
    785 
    786         case ACPI_DMT_UINT64:
    787         case ACPI_DMT_NAME8:
    788 
    789             ByteLength = 8;
    790             break;
    791 
    792         case ACPI_DMT_BUF10:
    793 
    794             ByteLength = 10;
    795             break;
    796 
    797         case ACPI_DMT_BUF16:
    798         case ACPI_DMT_UUID:
    799 
    800             ByteLength = 16;
    801             break;
    802 
    803         case ACPI_DMT_BUF128:
    804 
    805             ByteLength = 128;
    806             break;
    807 
    808         case ACPI_DMT_STRING:
    809 
    810             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
    811             break;
    812 
    813         case ACPI_DMT_GAS:
    814 
    815             if (!LastOutputBlankLine)
    816             {
    817                 AcpiOsPrintf ("\n");
    818                 LastOutputBlankLine = TRUE;
    819             }
    820             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
    821             break;
    822 
    823         case ACPI_DMT_HESTNTFY:
    824 
    825             if (!LastOutputBlankLine)
    826             {
    827                 AcpiOsPrintf ("\n");
    828                 LastOutputBlankLine = TRUE;
    829             }
    830             ByteLength = sizeof (ACPI_HEST_NOTIFY);
    831             break;
    832 
    833         default:
    834 
    835             ByteLength = 0;
    836             break;
    837         }
    838 
    839         if (CurrentOffset + ByteLength > TableLength)
    840         {
    841             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
    842             return (AE_BAD_DATA);
    843         }
    844 
    845         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
    846         {
    847             AcpiOsPrintf ("%s", Info->Name);
    848             continue;
    849         }
    850 
    851         /* Start a new line and decode the opcode */
    852 
    853         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
    854 
    855         switch (Info->Opcode)
    856         {
    857         /* Single-bit Flag fields. Note: Opcode is the bit position */
    858 
    859         case ACPI_DMT_FLAG0:
    860         case ACPI_DMT_FLAG1:
    861         case ACPI_DMT_FLAG2:
    862         case ACPI_DMT_FLAG3:
    863         case ACPI_DMT_FLAG4:
    864         case ACPI_DMT_FLAG5:
    865         case ACPI_DMT_FLAG6:
    866         case ACPI_DMT_FLAG7:
    867 
    868             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
    869             break;
    870 
    871         /* 2-bit Flag fields */
    872 
    873         case ACPI_DMT_FLAGS0:
    874 
    875             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
    876             break;
    877 
    878         case ACPI_DMT_FLAGS1:
    879 
    880             AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03);
    881             break;
    882 
    883         case ACPI_DMT_FLAGS2:
    884 
    885             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
    886             break;
    887 
    888         case ACPI_DMT_FLAGS4:
    889 
    890             AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03);
    891             break;
    892 
    893         /* Integer Data Types */
    894 
    895         case ACPI_DMT_UINT8:
    896         case ACPI_DMT_UINT16:
    897         case ACPI_DMT_UINT24:
    898         case ACPI_DMT_UINT32:
    899         case ACPI_DMT_UINT40:
    900         case ACPI_DMT_UINT48:
    901         case ACPI_DMT_UINT56:
    902         case ACPI_DMT_UINT64:
    903             /*
    904              * Dump bytes - high byte first, low byte last.
    905              * Note: All ACPI tables are little-endian.
    906              */
    907             Value = 0;
    908             for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--)
    909             {
    910                 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]);
    911                 Value |= Target[Temp8 - 1];
    912                 Value <<= 8;
    913             }
    914 
    915             if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL))
    916             {
    917                 AcpiOsPrintf (" [Optional field not present]");
    918             }
    919 
    920             AcpiOsPrintf ("\n");
    921             break;
    922 
    923         case ACPI_DMT_BUF7:
    924         case ACPI_DMT_BUF10:
    925         case ACPI_DMT_BUF16:
    926         case ACPI_DMT_BUF128:
    927             /*
    928              * Buffer: Size depends on the opcode and was set above.
    929              * Each hex byte is separated with a space.
    930              * Multiple lines are separated by line continuation char.
    931              */
    932             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
    933             {
    934                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
    935                 if ((UINT32) (Temp16 + 1) < ByteLength)
    936                 {
    937                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
    938                     {
    939                         AcpiOsPrintf (" \\\n"); /* Line continuation */
    940                         AcpiDmLineHeader (0, 0, NULL);
    941                     }
    942                     else
    943                     {
    944                         AcpiOsPrintf (" ");
    945                     }
    946                 }
    947             }
    948             AcpiOsPrintf ("\n");
    949             break;
    950 
    951         case ACPI_DMT_UUID:
    952 
    953             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
    954 
    955             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
    956 
    957             AcpiOsPrintf ("%s\n", MsgBuffer);
    958             break;
    959 
    960         case ACPI_DMT_STRING:
    961 
    962             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
    963             break;
    964 
    965         /* Fixed length ASCII name fields */
    966 
    967         case ACPI_DMT_SIG:
    968 
    969             AcpiDmCheckAscii (Target, RepairedName, 4);
    970             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
    971             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
    972             if (TableData)
    973             {
    974                 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
    975             }
    976             else
    977             {
    978                 AcpiOsPrintf ("\n");
    979             }
    980             break;
    981 
    982         case ACPI_DMT_NAME4:
    983 
    984             AcpiDmCheckAscii (Target, RepairedName, 4);
    985             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
    986             break;
    987 
    988         case ACPI_DMT_NAME6:
    989 
    990             AcpiDmCheckAscii (Target, RepairedName, 6);
    991             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
    992             break;
    993 
    994         case ACPI_DMT_NAME8:
    995 
    996             AcpiDmCheckAscii (Target, RepairedName, 8);
    997             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
    998             break;
    999 
   1000         /* Special Data Types */
   1001 
   1002         case ACPI_DMT_CHKSUM:
   1003 
   1004             /* Checksum, display and validate */
   1005 
   1006             AcpiOsPrintf ("%2.2X", *Target);
   1007             Temp8 = AcpiDmGenerateChecksum (Table,
   1008                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
   1009                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
   1010             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
   1011             {
   1012                 AcpiOsPrintf (
   1013                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
   1014             }
   1015             AcpiOsPrintf ("\n");
   1016             break;
   1017 
   1018         case ACPI_DMT_SPACEID:
   1019 
   1020             /* Address Space ID */
   1021 
   1022             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
   1023             break;
   1024 
   1025         case ACPI_DMT_ACCWIDTH:
   1026 
   1027             /* Encoded Access Width */
   1028 
   1029             Temp8 = *Target;
   1030             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
   1031             {
   1032                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
   1033             }
   1034 
   1035             AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
   1036             break;
   1037 
   1038         case ACPI_DMT_GAS:
   1039 
   1040             /* Generic Address Structure */
   1041 
   1042             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
   1043             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
   1044                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
   1045             AcpiOsPrintf ("\n");
   1046             LastOutputBlankLine = TRUE;
   1047             break;
   1048 
   1049         case ACPI_DMT_ASF:
   1050 
   1051             /* ASF subtable types */
   1052 
   1053             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
   1054             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
   1055             {
   1056                 Temp16 = ACPI_ASF_TYPE_RESERVED;
   1057             }
   1058 
   1059             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
   1060             break;
   1061 
   1062         case ACPI_DMT_DMAR:
   1063 
   1064             /* DMAR subtable types */
   1065 
   1066             Temp16 = ACPI_GET16 (Target);
   1067             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
   1068             {
   1069                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
   1070             }
   1071 
   1072             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
   1073             break;
   1074 
   1075         case ACPI_DMT_DMAR_SCOPE:
   1076 
   1077             /* DMAR device scope types */
   1078 
   1079             Temp8 = *Target;
   1080             if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED)
   1081             {
   1082                 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED;
   1083             }
   1084 
   1085             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmDmarScope[Temp8]);
   1086             break;
   1087 
   1088         case ACPI_DMT_EINJACT:
   1089 
   1090             /* EINJ Action types */
   1091 
   1092             Temp8 = *Target;
   1093             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
   1094             {
   1095                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
   1096             }
   1097 
   1098             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
   1099             break;
   1100 
   1101         case ACPI_DMT_EINJINST:
   1102 
   1103             /* EINJ Instruction types */
   1104 
   1105             Temp8 = *Target;
   1106             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
   1107             {
   1108                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
   1109             }
   1110 
   1111             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
   1112             break;
   1113 
   1114         case ACPI_DMT_ERSTACT:
   1115 
   1116             /* ERST Action types */
   1117 
   1118             Temp8 = *Target;
   1119             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
   1120             {
   1121                 Temp8 = ACPI_ERST_ACTION_RESERVED;
   1122             }
   1123 
   1124             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
   1125             break;
   1126 
   1127         case ACPI_DMT_ERSTINST:
   1128 
   1129             /* ERST Instruction types */
   1130 
   1131             Temp8 = *Target;
   1132             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
   1133             {
   1134                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
   1135             }
   1136 
   1137             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
   1138             break;
   1139 
   1140         case ACPI_DMT_GTDT:
   1141 
   1142             /* GTDT subtable types */
   1143 
   1144             Temp8 = *Target;
   1145             if (Temp8 > ACPI_GTDT_TYPE_RESERVED)
   1146             {
   1147                 Temp8 = ACPI_GTDT_TYPE_RESERVED;
   1148             }
   1149 
   1150             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGtdtSubnames[Temp8]);
   1151             break;
   1152 
   1153         case ACPI_DMT_HEST:
   1154 
   1155             /* HEST subtable types */
   1156 
   1157             Temp16 = ACPI_GET16 (Target);
   1158             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
   1159             {
   1160                 Temp16 = ACPI_HEST_TYPE_RESERVED;
   1161             }
   1162 
   1163             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
   1164             break;
   1165 
   1166         case ACPI_DMT_HESTNTFY:
   1167 
   1168             AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
   1169             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
   1170                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
   1171             AcpiOsPrintf ("\n");
   1172             LastOutputBlankLine = TRUE;
   1173             break;
   1174 
   1175         case ACPI_DMT_HESTNTYP:
   1176 
   1177             /* HEST Notify types */
   1178 
   1179             Temp8 = *Target;
   1180             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
   1181             {
   1182                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
   1183             }
   1184 
   1185             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
   1186             break;
   1187 
   1188         case ACPI_DMT_MADT:
   1189 
   1190             /* MADT subtable types */
   1191 
   1192             Temp8 = *Target;
   1193             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
   1194             {
   1195                 Temp8 = ACPI_MADT_TYPE_RESERVED;
   1196             }
   1197 
   1198             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
   1199             break;
   1200 
   1201         case ACPI_DMT_PCCT:
   1202 
   1203             /* PCCT subtable types */
   1204 
   1205             Temp8 = *Target;
   1206             if (Temp8 > ACPI_PCCT_TYPE_RESERVED)
   1207             {
   1208                 Temp8 = ACPI_PCCT_TYPE_RESERVED;
   1209             }
   1210 
   1211             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPcctSubnames[Temp8]);
   1212             break;
   1213 
   1214         case ACPI_DMT_PMTT:
   1215 
   1216             /* PMTT subtable types */
   1217 
   1218             Temp8 = *Target;
   1219             if (Temp8 > ACPI_PMTT_TYPE_RESERVED)
   1220             {
   1221                 Temp8 = ACPI_PMTT_TYPE_RESERVED;
   1222             }
   1223 
   1224             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]);
   1225             break;
   1226 
   1227         case ACPI_DMT_SLIC:
   1228 
   1229             /* SLIC subtable types */
   1230 
   1231             Temp8 = *Target;
   1232             if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
   1233             {
   1234                 Temp8 = ACPI_SLIC_TYPE_RESERVED;
   1235             }
   1236 
   1237             AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
   1238             break;
   1239 
   1240         case ACPI_DMT_SRAT:
   1241 
   1242             /* SRAT subtable types */
   1243 
   1244             Temp8 = *Target;
   1245             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
   1246             {
   1247                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
   1248             }
   1249 
   1250             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
   1251             break;
   1252 
   1253         case ACPI_DMT_FADTPM:
   1254 
   1255             /* FADT Preferred PM Profile names */
   1256 
   1257             Temp8 = *Target;
   1258             if (Temp8 > ACPI_FADT_PM_RESERVED)
   1259             {
   1260                 Temp8 = ACPI_FADT_PM_RESERVED;
   1261             }
   1262 
   1263             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
   1264             break;
   1265 
   1266         case ACPI_DMT_IVRS:
   1267 
   1268             /* IVRS subtable types */
   1269 
   1270             Temp8 = *Target;
   1271             switch (Temp8)
   1272             {
   1273             case ACPI_IVRS_TYPE_HARDWARE:
   1274 
   1275                 Name = AcpiDmIvrsSubnames[0];
   1276                 break;
   1277 
   1278             case ACPI_IVRS_TYPE_MEMORY1:
   1279             case ACPI_IVRS_TYPE_MEMORY2:
   1280             case ACPI_IVRS_TYPE_MEMORY3:
   1281 
   1282                 Name = AcpiDmIvrsSubnames[1];
   1283                 break;
   1284 
   1285             default:
   1286 
   1287                 Name = AcpiDmIvrsSubnames[2];
   1288                 break;
   1289             }
   1290 
   1291             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
   1292             break;
   1293 
   1294         case ACPI_DMT_LPIT:
   1295 
   1296             /* LPIT subtable types */
   1297 
   1298             Temp8 = *Target;
   1299             switch (Temp8)
   1300             {
   1301             case ACPI_LPIT_TYPE_NATIVE_CSTATE:
   1302 
   1303                 Name = AcpiDmLpitSubnames[0];
   1304                 break;
   1305 
   1306             case ACPI_LPIT_TYPE_SIMPLE_IO:
   1307 
   1308                 Name = AcpiDmLpitSubnames[1];
   1309                 break;
   1310 
   1311             default:
   1312 
   1313                 Name = AcpiDmLpitSubnames[2];
   1314                 break;
   1315             }
   1316 
   1317             AcpiOsPrintf (UINT32_FORMAT, *Target, Name);
   1318             break;
   1319 
   1320         case ACPI_DMT_EXIT:
   1321 
   1322             return (AE_OK);
   1323 
   1324         default:
   1325 
   1326             ACPI_ERROR ((AE_INFO,
   1327                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
   1328             return (AE_SUPPORT);
   1329         }
   1330     }
   1331 
   1332     if (TableOffset && !SubtableLength)
   1333     {
   1334         /* If this table is not the main table, subtable must have valid length */
   1335 
   1336         AcpiOsPrintf ("Invalid zero length subtable\n");
   1337         return (AE_BAD_DATA);
   1338     }
   1339 
   1340     return (AE_OK);
   1341 }
   1342 
   1343 
   1344 /*******************************************************************************
   1345  *
   1346  * FUNCTION:    AcpiDmCheckAscii
   1347  *
   1348  * PARAMETERS:  Name                - Ascii string
   1349  *              Count               - Number of characters to check
   1350  *
   1351  * RETURN:      None
   1352  *
   1353  * DESCRIPTION: Ensure that the requested number of characters are printable
   1354  *              Ascii characters. Sets non-printable and null chars to <space>.
   1355  *
   1356  ******************************************************************************/
   1357 
   1358 static void
   1359 AcpiDmCheckAscii (
   1360     UINT8                   *Name,
   1361     char                    *RepairedName,
   1362     UINT32                  Count)
   1363 {
   1364     UINT32                  i;
   1365 
   1366 
   1367     for (i = 0; i < Count; i++)
   1368     {
   1369         RepairedName[i] = (char) Name[i];
   1370 
   1371         if (!Name[i])
   1372         {
   1373             return;
   1374         }
   1375         if (!isprint (Name[i]))
   1376         {
   1377             RepairedName[i] = ' ';
   1378         }
   1379     }
   1380 }
   1381