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