Subversion Repositories Kolibri OS

Rev

Rev 1498 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /******************************************************************************
  2.  *
  3.  * Module Name: dmtable - Support for ACPI tables that contain no AML code
  4.  *
  5.  *****************************************************************************/
  6.  
  7. /******************************************************************************
  8.  *
  9.  * 1. Copyright Notice
  10.  *
  11.  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
  12.  * All rights reserved.
  13.  *
  14.  * 2. License
  15.  *
  16.  * 2.1. This is your license from Intel Corp. under its intellectual property
  17.  * rights.  You may have additional license terms from the party that provided
  18.  * you this software, covering your right to use that party's intellectual
  19.  * property rights.
  20.  *
  21.  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  22.  * copy of the source code appearing in this file ("Covered Code") an
  23.  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  24.  * base code distributed originally by Intel ("Original Intel Code") to copy,
  25.  * make derivatives, distribute, use and display any portion of the Covered
  26.  * Code in any form, with the right to sublicense such rights; and
  27.  *
  28.  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  29.  * license (with the right to sublicense), under only those claims of Intel
  30.  * patents that are infringed by the Original Intel Code, to make, use, sell,
  31.  * offer to sell, and import the Covered Code and derivative works thereof
  32.  * solely to the minimum extent necessary to exercise the above copyright
  33.  * license, and in no event shall the patent license extend to any additions
  34.  * to or modifications of the Original Intel Code.  No other license or right
  35.  * is granted directly or by implication, estoppel or otherwise;
  36.  *
  37.  * The above copyright and patent license is granted only if the following
  38.  * conditions are met:
  39.  *
  40.  * 3. Conditions
  41.  *
  42.  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  43.  * Redistribution of source code of any substantial portion of the Covered
  44.  * Code or modification with rights to further distribute source must include
  45.  * the above Copyright Notice, the above License, this list of Conditions,
  46.  * and the following Disclaimer and Export Compliance provision.  In addition,
  47.  * Licensee must cause all Covered Code to which Licensee contributes to
  48.  * contain a file documenting the changes Licensee made to create that Covered
  49.  * Code and the date of any change.  Licensee must include in that file the
  50.  * documentation of any changes made by any predecessor Licensee.  Licensee
  51.  * must include a prominent statement that the modification is derived,
  52.  * directly or indirectly, from Original Intel Code.
  53.  *
  54.  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
  55.  * Redistribution of source code of any substantial portion of the Covered
  56.  * Code or modification without rights to further distribute source must
  57.  * include the following Disclaimer and Export Compliance provision in the
  58.  * documentation and/or other materials provided with distribution.  In
  59.  * addition, Licensee may not authorize further sublicense of source of any
  60.  * portion of the Covered Code, and must include terms to the effect that the
  61.  * license from Licensee to its licensee is limited to the intellectual
  62.  * property embodied in the software Licensee provides to its licensee, and
  63.  * not to intellectual property embodied in modifications its licensee may
  64.  * make.
  65.  *
  66.  * 3.3. Redistribution of Executable. Redistribution in executable form of any
  67.  * substantial portion of the Covered Code or modification must reproduce the
  68.  * above Copyright Notice, and the following Disclaimer and Export Compliance
  69.  * provision in the documentation and/or other materials provided with the
  70.  * distribution.
  71.  *
  72.  * 3.4. Intel retains all right, title, and interest in and to the Original
  73.  * Intel Code.
  74.  *
  75.  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  76.  * Intel shall be used in advertising or otherwise to promote the sale, use or
  77.  * other dealings in products derived from or relating to the Covered Code
  78.  * without prior written authorization from Intel.
  79.  *
  80.  * 4. Disclaimer and Export Compliance
  81.  *
  82.  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  83.  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  84.  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
  85.  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
  86.  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
  87.  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  88.  * PARTICULAR PURPOSE.
  89.  *
  90.  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  91.  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  92.  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  93.  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  94.  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  95.  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
  96.  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  97.  * LIMITED REMEDY.
  98.  *
  99.  * 4.3. Licensee shall not export, either directly or indirectly, any of this
  100.  * software or system incorporating such software without first obtaining any
  101.  * required license or other approval from the U. S. Department of Commerce or
  102.  * any other agency or department of the United States Government.  In the
  103.  * event Licensee exports any such software from the United States or
  104.  * re-exports any such software from a foreign destination, Licensee shall
  105.  * ensure that the distribution and export/re-export of the software is in
  106.  * compliance with all laws, regulations, orders, or other restrictions of the
  107.  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  108.  * any of its subsidiaries will export/re-export any technical data, process,
  109.  * software, or service, directly or indirectly, to any country for which the
  110.  * United States government or any agency thereof requires an export license,
  111.  * other governmental approval, or letter of assurance, without first obtaining
  112.  * such license, approval or letter.
  113.  *
  114.  *****************************************************************************/
  115.  
  116. #include "acpi.h"
  117. #include "accommon.h"
  118. #include "acdisasm.h"
  119. #include "actables.h"
  120. #include "aslcompiler.h"
  121. #include "dtcompiler.h"
  122.  
  123. /* This module used for application-level code only */
  124.  
  125. #define _COMPONENT          ACPI_CA_DISASSEMBLER
  126.         ACPI_MODULE_NAME    ("dmtable")
  127.  
  128. /* Local Prototypes */
  129.  
  130. static void
  131. AcpiDmCheckAscii (
  132.     UINT8                   *Target,
  133.     char                    *RepairedName,
  134.     UINT32                  Count);
  135.  
  136.  
  137. /* Common format strings for commented values */
  138.  
  139. #define UINT8_FORMAT        "%2.2X [%s]\n"
  140. #define UINT16_FORMAT       "%4.4X [%s]\n"
  141. #define UINT32_FORMAT       "%8.8X [%s]\n"
  142. #define STRING_FORMAT       "[%s]\n"
  143.  
  144. /* These tables map a subtable type to a description string */
  145.  
  146. static const char           *AcpiDmAsfSubnames[] =
  147. {
  148.     "ASF Information",
  149.     "ASF Alerts",
  150.     "ASF Remote Control",
  151.     "ASF RMCP Boot Options",
  152.     "ASF Address",
  153.     "Unknown SubTable Type"         /* Reserved */
  154. };
  155.  
  156. static const char           *AcpiDmDmarSubnames[] =
  157. {
  158.     "Hardware Unit Definition",
  159.     "Reserved Memory Region",
  160.     "Root Port ATS Capability",
  161.     "Remapping Hardware Static Affinity",
  162.     "Unknown SubTable Type"         /* Reserved */
  163. };
  164.  
  165. static const char           *AcpiDmEinjActions[] =
  166. {
  167.     "Begin Operation",
  168.     "Get Trigger Table",
  169.     "Set Error Type",
  170.     "Get Error Type",
  171.     "End Operation",
  172.     "Execute Operation",
  173.     "Check Busy Status",
  174.     "Get Command Status",
  175.     "Unknown Action"
  176. };
  177.  
  178. static const char           *AcpiDmEinjInstructions[] =
  179. {
  180.     "Read Register",
  181.     "Read Register Value",
  182.     "Write Register",
  183.     "Write Register Value",
  184.     "Noop",
  185.     "Unknown Instruction"
  186. };
  187.  
  188. static const char           *AcpiDmErstActions[] =
  189. {
  190.     "Begin Write Operation",
  191.     "Begin Read Operation",
  192.     "Begin Clear Operation",
  193.     "End Operation",
  194.     "Set Record Offset",
  195.     "Execute Operation",
  196.     "Check Busy Status",
  197.     "Get Command Status",
  198.     "Get Record Identifier",
  199.     "Set Record Identifier",
  200.     "Get Record Count",
  201.     "Begin Dummy Write",
  202.     "Unused/Unknown Action",
  203.     "Get Error Address Range",
  204.     "Get Error Address Length",
  205.     "Get Error Attributes",
  206.     "Unknown Action"
  207. };
  208.  
  209. static const char           *AcpiDmErstInstructions[] =
  210. {
  211.     "Read Register",
  212.     "Read Register Value",
  213.     "Write Register",
  214.     "Write Register Value",
  215.     "Noop",
  216.     "Load Var1",
  217.     "Load Var2",
  218.     "Store Var1",
  219.     "Add",
  220.     "Subtract",
  221.     "Add Value",
  222.     "Subtract Value",
  223.     "Stall",
  224.     "Stall While True",
  225.     "Skip Next If True",
  226.     "GoTo",
  227.     "Set Source Address",
  228.     "Set Destination Address",
  229.     "Move Data",
  230.     "Unknown Instruction"
  231. };
  232.  
  233. static const char           *AcpiDmHestSubnames[] =
  234. {
  235.     "IA-32 Machine Check Exception",
  236.     "IA-32 Corrected Machine Check",
  237.     "IA-32 Non-Maskable Interrupt",
  238.     "Unknown SubTable Type",        /* 3 - Reserved */
  239.     "Unknown SubTable Type",        /* 4 - Reserved */
  240.     "Unknown SubTable Type",        /* 5 - Reserved */
  241.     "PCI Express Root Port AER",
  242.     "PCI Express AER (AER Endpoint)",
  243.     "PCI Express/PCI-X Bridge AER",
  244.     "Generic Hardware Error Source",
  245.     "Unknown SubTable Type"         /* Reserved */
  246. };
  247.  
  248. static const char           *AcpiDmHestNotifySubnames[] =
  249. {
  250.     "Polled",
  251.     "External Interrupt",
  252.     "Local Interrupt",
  253.     "SCI",
  254.     "NMI",
  255.     "Unknown Notify Type"           /* Reserved */
  256. };
  257.  
  258. static const char           *AcpiDmMadtSubnames[] =
  259. {
  260.     "Processor Local APIC",         /* ACPI_MADT_TYPE_LOCAL_APIC */
  261.     "I/O APIC",                     /* ACPI_MADT_TYPE_IO_APIC */
  262.     "Interrupt Source Override",    /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
  263.     "NMI Source",                   /* ACPI_MADT_TYPE_NMI_SOURCE */
  264.     "Local APIC NMI",               /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
  265.     "Local APIC Address Override",  /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
  266.     "I/O SAPIC",                    /* ACPI_MADT_TYPE_IO_SAPIC */
  267.     "Local SAPIC",                  /* ACPI_MADT_TYPE_LOCAL_SAPIC */
  268.     "Platform Interrupt Sources",   /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
  269.     "Processor Local x2APIC",       /* ACPI_MADT_TYPE_LOCAL_X2APIC */
  270.     "Local x2APIC NMI",             /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
  271.     "Unknown SubTable Type"         /* Reserved */
  272. };
  273.  
  274. static const char           *AcpiDmSlicSubnames[] =
  275. {
  276.     "Public Key Structure",
  277.     "Windows Marker Structure",
  278.     "Unknown SubTable Type"         /* Reserved */
  279. };
  280.  
  281. static const char           *AcpiDmSratSubnames[] =
  282. {
  283.     "Processor Local APIC/SAPIC Affinity",
  284.     "Memory Affinity",
  285.     "Processor Local x2APIC Affinity",
  286.     "Unknown SubTable Type"         /* Reserved */
  287. };
  288.  
  289. static const char           *AcpiDmIvrsSubnames[] =
  290. {
  291.     "Hardware Definition Block",
  292.     "Memory Definition Block",
  293.     "Unknown SubTable Type"         /* Reserved */
  294. };
  295.  
  296.  
  297. #define ACPI_FADT_PM_RESERVED       8
  298.  
  299. static const char           *AcpiDmFadtProfiles[] =
  300. {
  301.     "Unspecified",
  302.     "Desktop",
  303.     "Mobile",
  304.     "Workstation",
  305.     "Enterprise Server",
  306.     "SOHO Server",
  307.     "Appliance PC",
  308.     "Performance Server",
  309.     "Unknown Profile Type"
  310. };
  311.  
  312. #define ACPI_GAS_WIDTH_RESERVED     5
  313.  
  314. static const char           *AcpiDmGasAccessWidth[] =
  315. {
  316.     "Undefined/Legacy",
  317.     "Byte Access:8",
  318.     "Word Access:16",
  319.     "DWord Access:32",
  320.     "QWord Access:64",
  321.     "Unknown Width Encoding"
  322. };
  323.  
  324.  
  325. /*******************************************************************************
  326.  *
  327.  * ACPI Table Data, indexed by signature.
  328.  *
  329.  * Each entry contains: Signature, Table Info, Handler, DtHandler,
  330.  *  Template, Description
  331.  *
  332.  * Simple tables have only a TableInfo structure, complex tables have a
  333.  * handler. This table must be NULL terminated. RSDP and FACS are
  334.  * special-cased elsewhere.
  335.  *
  336.  ******************************************************************************/
  337.  
  338. ACPI_DMTABLE_DATA    AcpiDmTableData[] =
  339. {
  340.     {ACPI_SIG_ASF,  NULL,                   AcpiDmDumpAsf,  DtCompileAsf,   TemplateAsf,    "Alert Standard Format table"},
  341.     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot,   "Simple Boot Flag Table"},
  342.     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert,   "Boot Error Record Table"},
  343.     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep,   "Corrected Platform Error Polling table"},
  344.     {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp,    NULL,           NULL,           TemplateDbgp,   "Debug Port table"},
  345.     {ACPI_SIG_DMAR, NULL,                   AcpiDmDumpDmar, DtCompileDmar,  TemplateDmar,   "DMA Remapping table"},
  346.     {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt,    NULL,           NULL,           TemplateEcdt,   "Embedded Controller Boot Resources Table"},
  347.     {ACPI_SIG_EINJ, NULL,                   AcpiDmDumpEinj, DtCompileEinj,  TemplateEinj,   "Error Injection table"},
  348.     {ACPI_SIG_ERST, NULL,                   AcpiDmDumpErst, DtCompileErst,  TemplateErst,   "Error Record Serialization Table"},
  349.     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, DtCompileFadt,  TemplateFadt,   "Fixed ACPI Description Table"},
  350.     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, DtCompileHest,  TemplateHest,   "Hardware Error Source Table"},
  351.     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           NULL,           TemplateHpet,   "High Precision Event Timer table"},
  352.     {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, DtCompileIvrs,  TemplateIvrs,   "I/O Virtualization Reporting Structure"},
  353.     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, DtCompileMadt,  TemplateMadt,   "Multiple APIC Description Table"},
  354.     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, DtCompileMcfg,  TemplateMcfg,   "Memory Mapped Configuration table"},
  355.     {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi,   "Management Controller Host Interface table"},
  356.     {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct,   "Maximum System Characteristics Table"},
  357.     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt,   "Root System Description Table"},
  358.     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           NULL,           TemplateSbst,   "Smart Battery Specification Table"},
  359.     {ACPI_SIG_SLIC, NULL,                   AcpiDmDumpSlic, DtCompileSlic,  TemplateSlic,   "Software Licensing Description Table"},
  360.     {ACPI_SIG_SLIT, NULL,                   AcpiDmDumpSlit, DtCompileSlit,  TemplateSlit,   "System Locality Information Table"},
  361.     {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr,    NULL,           NULL,           TemplateSpcr,   "Serial Port Console Redirection table"},
  362.     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           NULL,           TemplateSpmi,   "Server Platform Management Interface table"},
  363.     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, DtCompileSrat,  TemplateSrat,   "System Resource Affinity Table"},
  364.     {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           NULL,           TemplateTcpa,   "Trusted Computing Platform Alliance table"},
  365.     {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"},
  366.     {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},
  367.     {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},
  368.     {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"},
  369.     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           NULL,           TemplateWdrt,   "Watchdog Resource Table"},
  370.     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, DtCompileXsdt,  TemplateXsdt,   "Extended System Description Table"},
  371.     {NULL,          NULL,                   NULL,           NULL,           NULL,           NULL}
  372. };
  373.  
  374.  
  375. /*******************************************************************************
  376.  *
  377.  * FUNCTION:    AcpiDmGenerateChecksum
  378.  *
  379.  * PARAMETERS:  Table               - Pointer to table to be checksummed
  380.  *              Length              - Length of the table
  381.  *              OriginalChecksum    - Value of the checksum field
  382.  *
  383.  * RETURN:      8 bit checksum of buffer
  384.  *
  385.  * DESCRIPTION: Computes an 8 bit checksum of the table.
  386.  *
  387.  ******************************************************************************/
  388.  
  389. UINT8
  390. AcpiDmGenerateChecksum (
  391.     void                    *Table,
  392.     UINT32                  Length,
  393.     UINT8                   OriginalChecksum)
  394. {
  395.     UINT8                   Checksum;
  396.  
  397.  
  398.     /* Sum the entire table as-is */
  399.  
  400.     Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
  401.  
  402.     /* Subtract off the existing checksum value in the table */
  403.  
  404.     Checksum = (UINT8) (Checksum - OriginalChecksum);
  405.  
  406.     /* Compute the final checksum */
  407.  
  408.     Checksum = (UINT8) (0 - Checksum);
  409.     return (Checksum);
  410. }
  411.  
  412.  
  413. /*******************************************************************************
  414.  *
  415.  * FUNCTION:    AcpiDmGetTableData
  416.  *
  417.  * PARAMETERS:  Signature           - ACPI signature (4 chars) to match
  418.  *
  419.  * RETURN:      Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
  420.  *
  421.  * DESCRIPTION: Find a match in the global table of supported ACPI tables
  422.  *
  423.  ******************************************************************************/
  424.  
  425. ACPI_DMTABLE_DATA *
  426. AcpiDmGetTableData (
  427.     char                    *Signature)
  428. {
  429.     ACPI_DMTABLE_DATA       *TableData;
  430.  
  431.  
  432.     for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
  433.     {
  434.         if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
  435.         {
  436.             return (TableData);
  437.         }
  438.     }
  439.  
  440.     return (NULL);
  441. }
  442.  
  443.  
  444. /*******************************************************************************
  445.  *
  446.  * FUNCTION:    AcpiDmDumpDataTable
  447.  *
  448.  * PARAMETERS:  Table               - An ACPI table
  449.  *
  450.  * RETURN:      None.
  451.  *
  452.  * DESCRIPTION: Format the contents of an ACPI data table (any table other
  453.  *              than an SSDT or DSDT that does not contain executable AML code)
  454.  *
  455.  ******************************************************************************/
  456.  
  457. void
  458. AcpiDmDumpDataTable (
  459.     ACPI_TABLE_HEADER       *Table)
  460. {
  461.     ACPI_STATUS             Status;
  462.     ACPI_DMTABLE_DATA       *TableData;
  463.     UINT32                  Length;
  464.  
  465.  
  466.     /* Ignore tables that contain AML */
  467.  
  468.     if (AcpiUtIsAmlTable (Table))
  469.     {
  470.         return;
  471.     }
  472.  
  473.     /*
  474.      * Handle tables that don't use the common ACPI table header structure.
  475.      * Currently, these are the FACS and RSDP.
  476.      */
  477.     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
  478.     {
  479.         Length = Table->Length;
  480.         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
  481.     }
  482.     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
  483.     {
  484.         Length = AcpiDmDumpRsdp (Table);
  485.     }
  486.     else
  487.     {
  488.         /*
  489.          * All other tables must use the common ACPI table header, dump it now
  490.          */
  491.         Length = Table->Length;
  492.         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
  493.         if (ACPI_FAILURE (Status))
  494.         {
  495.             return;
  496.         }
  497.         AcpiOsPrintf ("\n");
  498.  
  499.         /* Match signature and dispatch appropriately */
  500.  
  501.         TableData = AcpiDmGetTableData (Table->Signature);
  502.         if (!TableData)
  503.         {
  504.             if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
  505.             {
  506.                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
  507.                     Table->Signature);
  508.             }
  509.             else
  510.             {
  511.                 AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
  512.                     Table->Signature);
  513.             }
  514.         }
  515.         else if (TableData->TableHandler)
  516.         {
  517.             /* Complex table, has a handler */
  518.  
  519.             TableData->TableHandler (Table);
  520.         }
  521.         else if (TableData->TableInfo)
  522.         {
  523.             /* Simple table, just walk the info table */
  524.  
  525.             AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
  526.         }
  527.     }
  528.  
  529.     if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
  530.     {
  531.         /* Dump the raw table data */
  532.  
  533.         AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
  534.             ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
  535.     AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
  536.     }
  537. }
  538.  
  539.  
  540. /*******************************************************************************
  541.  *
  542.  * FUNCTION:    AcpiDmLineHeader
  543.  *
  544.  * PARAMETERS:  Offset              - Current byte offset, from table start
  545.  *              ByteLength          - Length of the field in bytes, 0 for flags
  546.  *              Name                - Name of this field
  547.  *              Value               - Optional value, displayed on left of ':'
  548.  *
  549.  * RETURN:      None
  550.  *
  551.  * DESCRIPTION: Utility routines for formatting output lines. Displays the
  552.  *              current table offset in hex and decimal, the field length,
  553.  *              and the field name.
  554.  *
  555.  ******************************************************************************/
  556.  
  557. void
  558. AcpiDmLineHeader (
  559.     UINT32                  Offset,
  560.     UINT32                  ByteLength,
  561.     char                    *Name)
  562. {
  563.  
  564.     /* Allow a null name for fields that span multiple lines (large buffers) */
  565.  
  566.     if (!Name)
  567.     {
  568.         Name = "";
  569.     }
  570.  
  571.     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
  572.     {
  573.     if (ByteLength)
  574.     {
  575.             AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name);
  576.         }
  577.         else
  578.         {
  579.             if (*Name)
  580.             {
  581.                 AcpiOsPrintf ("%41s : ", Name);
  582.             }
  583.             else
  584.             {
  585.                 AcpiOsPrintf ("%41s   ", Name);
  586.             }
  587.         }
  588.     }
  589.     else /* Normal disassembler or verbose template */
  590.     {
  591.         if (ByteLength)
  592.         {
  593.             AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
  594.             Offset, Offset, ByteLength, Name);
  595.     }
  596.     else
  597.     {
  598.             if (*Name)
  599.             {
  600.                 AcpiOsPrintf ("%44s : ", Name);
  601.             }
  602.             else
  603.             {
  604.                 AcpiOsPrintf ("%44s   ", Name);
  605.             }
  606.         }
  607.     }
  608. }
  609.  
  610. void
  611. AcpiDmLineHeader2 (
  612.     UINT32                  Offset,
  613.     UINT32                  ByteLength,
  614.     char                    *Name,
  615.     UINT32                  Value)
  616. {
  617.  
  618.     if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
  619.     {
  620.         if (ByteLength)
  621.         {
  622.             AcpiOsPrintf ("[%.4d] %30s %3d : ",
  623.                 ByteLength, Name, Value);
  624.         }
  625.         else
  626.         {
  627.             AcpiOsPrintf ("%36s % 3d : ",
  628.                 Name, Value);
  629.         }
  630.     }
  631.     else /* Normal disassembler or verbose template */
  632.     {
  633.     if (ByteLength)
  634.     {
  635.             AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
  636.             Offset, Offset, ByteLength, Name, Value);
  637.     }
  638.     else
  639.     {
  640.             AcpiOsPrintf ("[%3.3Xh %4.4d   ] %24s %3d : ",
  641.             Offset, Offset, Name, Value);
  642.     }
  643.     }
  644. }
  645.  
  646.  
  647. /*******************************************************************************
  648.  *
  649.  * FUNCTION:    AcpiDmDumpTable
  650.  *
  651.  * PARAMETERS:  TableLength         - Length of the entire ACPI table
  652.  *              TableOffset         - Starting offset within the table for this
  653.  *                                    sub-descriptor (0 if main table)
  654.  *              Table               - The ACPI table
  655.  *              SubtableLength      - Length of this sub-descriptor
  656.  *              Info                - Info table for this ACPI table
  657.  *
  658.  * RETURN:      None
  659.  *
  660.  * DESCRIPTION: Display ACPI table contents by walking the Info table.
  661.  *
  662.  * Note: This function must remain in sync with DtGetFieldLength.
  663.  *
  664.  ******************************************************************************/
  665.  
  666. ACPI_STATUS
  667. AcpiDmDumpTable (
  668.     UINT32                  TableLength,
  669.     UINT32                  TableOffset,
  670.     void                    *Table,
  671.     UINT32                  SubtableLength,
  672.     ACPI_DMTABLE_INFO       *Info)
  673. {
  674.     UINT8                   *Target;
  675.     UINT32                  CurrentOffset;
  676.     UINT32                  ByteLength;
  677.     UINT8                   Temp8;
  678.     UINT16                  Temp16;
  679.     ACPI_DMTABLE_DATA       *TableData;
  680.     const char              *Name;
  681.     BOOLEAN                 LastOutputBlankLine = FALSE;
  682.     char                    RepairedName[8];
  683.  
  684.  
  685.     if (!Info)
  686.     {
  687.         AcpiOsPrintf ("Display not implemented\n");
  688.         return (AE_NOT_IMPLEMENTED);
  689.     }
  690.  
  691.     /* Walk entire Info table; Null name terminates */
  692.  
  693.     for (; Info->Name; Info++)
  694.     {
  695.         /*
  696.          * Target points to the field within the ACPI Table. CurrentOffset is
  697.          * the offset of the field from the start of the main table.
  698.          */
  699.         Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
  700.         CurrentOffset = TableOffset + Info->Offset;
  701.  
  702.         /* Check for beyond EOT or beyond subtable end */
  703.  
  704.         if ((CurrentOffset >= TableLength) ||
  705.             (SubtableLength && (Info->Offset >= SubtableLength)))
  706.         {
  707.             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
  708.             return (AE_BAD_DATA);
  709.         }
  710.  
  711.         /* Generate the byte length for this field */
  712.  
  713.         switch (Info->Opcode)
  714.         {
  715.         case ACPI_DMT_UINT8:
  716.         case ACPI_DMT_CHKSUM:
  717.         case ACPI_DMT_SPACEID:
  718.         case ACPI_DMT_ACCWIDTH:
  719.         case ACPI_DMT_IVRS:
  720.         case ACPI_DMT_MADT:
  721.         case ACPI_DMT_SRAT:
  722.         case ACPI_DMT_ASF:
  723.         case ACPI_DMT_HESTNTYP:
  724.         case ACPI_DMT_FADTPM:
  725.         case ACPI_DMT_EINJACT:
  726.         case ACPI_DMT_EINJINST:
  727.         case ACPI_DMT_ERSTACT:
  728.         case ACPI_DMT_ERSTINST:
  729.             ByteLength = 1;
  730.             break;
  731.         case ACPI_DMT_UINT16:
  732.         case ACPI_DMT_DMAR:
  733.         case ACPI_DMT_HEST:
  734.             ByteLength = 2;
  735.             break;
  736.         case ACPI_DMT_UINT24:
  737.             ByteLength = 3;
  738.             break;
  739.         case ACPI_DMT_UINT32:
  740.         case ACPI_DMT_NAME4:
  741.         case ACPI_DMT_SIG:
  742.         case ACPI_DMT_SLIC:
  743.             ByteLength = 4;
  744.             break;
  745.         case ACPI_DMT_NAME6:
  746.             ByteLength = 6;
  747.             break;
  748.         case ACPI_DMT_UINT56:
  749.         case ACPI_DMT_BUF7:
  750.             ByteLength = 7;
  751.             break;
  752.         case ACPI_DMT_UINT64:
  753.         case ACPI_DMT_NAME8:
  754.             ByteLength = 8;
  755.             break;
  756.         case ACPI_DMT_BUF16:
  757.         case ACPI_DMT_UUID:
  758.             ByteLength = 16;
  759.             break;
  760.         case ACPI_DMT_BUF128:
  761.             ByteLength = 128;
  762.             break;
  763.         case ACPI_DMT_STRING:
  764.             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
  765.             break;
  766.         case ACPI_DMT_GAS:
  767.             if (!LastOutputBlankLine)
  768.             {
  769.                 AcpiOsPrintf ("\n");
  770.                 LastOutputBlankLine = TRUE;
  771.             }
  772.             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
  773.             break;
  774.         case ACPI_DMT_HESTNTFY:
  775.             if (!LastOutputBlankLine)
  776.             {
  777.                 AcpiOsPrintf ("\n");
  778.                 LastOutputBlankLine = TRUE;
  779.             }
  780.             ByteLength = sizeof (ACPI_HEST_NOTIFY);
  781.             break;
  782.         default:
  783.             ByteLength = 0;
  784.             break;
  785.         }
  786.  
  787.         if (CurrentOffset + ByteLength > TableLength)
  788.         {
  789.             AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
  790.             return (AE_BAD_DATA);
  791.         }
  792.  
  793.         /* Start a new line and decode the opcode */
  794.  
  795.         AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
  796.  
  797.         switch (Info->Opcode)
  798.         {
  799.         /* Single-bit Flag fields. Note: Opcode is the bit position */
  800.  
  801.         case ACPI_DMT_FLAG0:
  802.         case ACPI_DMT_FLAG1:
  803.         case ACPI_DMT_FLAG2:
  804.         case ACPI_DMT_FLAG3:
  805.         case ACPI_DMT_FLAG4:
  806.         case ACPI_DMT_FLAG5:
  807.         case ACPI_DMT_FLAG6:
  808.         case ACPI_DMT_FLAG7:
  809.  
  810.             AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
  811.             break;
  812.  
  813.         /* 2-bit Flag fields */
  814.  
  815.         case ACPI_DMT_FLAGS0:
  816.  
  817.             AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
  818.             break;
  819.  
  820.         case ACPI_DMT_FLAGS2:
  821.  
  822.             AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
  823.             break;
  824.  
  825.         /* Standard Data Types */
  826.  
  827.         case ACPI_DMT_UINT8:
  828.  
  829.             AcpiOsPrintf ("%2.2X\n", *Target);
  830.             break;
  831.  
  832.         case ACPI_DMT_UINT16:
  833.  
  834.             AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target));
  835.             break;
  836.  
  837.         case ACPI_DMT_UINT24:
  838.  
  839.             AcpiOsPrintf ("%2.2X%2.2X%2.2X\n",
  840.                 *Target, *(Target + 1), *(Target + 2));
  841.             break;
  842.  
  843.         case ACPI_DMT_UINT32:
  844.  
  845.             AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target));
  846.             break;
  847.  
  848.         case ACPI_DMT_UINT56:
  849.  
  850.             for (Temp8 = 0; Temp8 < 7; Temp8++)
  851.             {
  852.                 AcpiOsPrintf ("%2.2X", Target[Temp8]);
  853.             }
  854.             AcpiOsPrintf ("\n");
  855.             break;
  856.  
  857.         case ACPI_DMT_UINT64:
  858.  
  859.             AcpiOsPrintf ("%8.8X%8.8X\n",
  860.                 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
  861.             break;
  862.  
  863.         case ACPI_DMT_BUF7:
  864.         case ACPI_DMT_BUF16:
  865.         case ACPI_DMT_BUF128:
  866.  
  867.             /*
  868.              * Buffer: Size depends on the opcode and was set above.
  869.              * Each hex byte is separated with a space.
  870.              * Multiple lines are separated by line continuation char.
  871.              */
  872.             for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
  873.             {
  874.                 AcpiOsPrintf ("%2.2X", Target[Temp16]);
  875.                 if ((UINT32) (Temp16 + 1) < ByteLength)
  876.                 {
  877.                     if ((Temp16 > 0) && (!((Temp16+1) % 16)))
  878.                     {
  879.                         AcpiOsPrintf (" \\\n"); /* Line continuation */
  880.                         AcpiDmLineHeader (0, 0, NULL);
  881.                     }
  882.                     else
  883.             {
  884.                         AcpiOsPrintf (" ");
  885.                     }
  886.                 }
  887.             }
  888.             AcpiOsPrintf ("\n");
  889.             break;
  890.  
  891.         case ACPI_DMT_UUID:
  892.  
  893.             /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */
  894.  
  895.             (void) AuConvertUuidToString ((char *) Target, MsgBuffer);
  896.  
  897.             AcpiOsPrintf ("%s\n", MsgBuffer);
  898.             break;
  899.  
  900.         case ACPI_DMT_STRING:
  901.  
  902.             AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
  903.             break;
  904.  
  905.         /* Fixed length ASCII name fields */
  906.  
  907.         case ACPI_DMT_SIG:
  908.  
  909.             AcpiDmCheckAscii (Target, RepairedName, 4);
  910.             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
  911.             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
  912.             if (TableData)
  913.             {
  914.                 AcpiOsPrintf (STRING_FORMAT, TableData->Name);
  915.             }
  916.             else
  917.             {
  918.             AcpiOsPrintf ("\n");
  919.             }
  920.             break;
  921.  
  922.         case ACPI_DMT_NAME4:
  923.  
  924.             AcpiDmCheckAscii (Target, RepairedName, 4);
  925.             AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
  926.             break;
  927.  
  928.         case ACPI_DMT_NAME6:
  929.  
  930.             AcpiDmCheckAscii (Target, RepairedName, 6);
  931.             AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
  932.             break;
  933.  
  934.         case ACPI_DMT_NAME8:
  935.  
  936.             AcpiDmCheckAscii (Target, RepairedName, 8);
  937.             AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
  938.             break;
  939.  
  940.         /* Special Data Types */
  941.  
  942.         case ACPI_DMT_CHKSUM:
  943.  
  944.             /* Checksum, display and validate */
  945.  
  946.             AcpiOsPrintf ("%2.2X", *Target);
  947.             Temp8 = AcpiDmGenerateChecksum (Table,
  948.                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
  949.                         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
  950.             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
  951.             {
  952.                 AcpiOsPrintf (
  953.                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
  954.             }
  955.             AcpiOsPrintf ("\n");
  956.             break;
  957.  
  958.         case ACPI_DMT_SPACEID:
  959.  
  960.             /* Address Space ID */
  961.  
  962.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
  963.             break;
  964.  
  965.         case ACPI_DMT_ACCWIDTH:
  966.  
  967.             /* Encoded Access Width */
  968.  
  969.             Temp8 = *Target;
  970.             if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
  971.             {
  972.                 Temp8 = ACPI_GAS_WIDTH_RESERVED;
  973.             }
  974.  
  975.             AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
  976.             break;
  977.  
  978.         case ACPI_DMT_GAS:
  979.  
  980.             /* Generic Address Structure */
  981.  
  982.             AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
  983.             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
  984.                 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
  985.             AcpiOsPrintf ("\n");
  986.             LastOutputBlankLine = TRUE;
  987.             break;
  988.  
  989.         case ACPI_DMT_ASF:
  990.  
  991.             /* ASF subtable types */
  992.  
  993.             Temp16 = (UINT16) ((*Target) & 0x7F);  /* Top bit can be zero or one */
  994.             if (Temp16 > ACPI_ASF_TYPE_RESERVED)
  995.             {
  996.                 Temp16 = ACPI_ASF_TYPE_RESERVED;
  997.             }
  998.  
  999.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
  1000.             break;
  1001.  
  1002.         case ACPI_DMT_DMAR:
  1003.  
  1004.             /* DMAR subtable types */
  1005.  
  1006.             Temp16 = ACPI_GET16 (Target);
  1007.             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
  1008.             {
  1009.                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
  1010.             }
  1011.  
  1012.             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
  1013.             break;
  1014.  
  1015.         case ACPI_DMT_EINJACT:
  1016.  
  1017.             /* EINJ Action types */
  1018.  
  1019.             Temp8 = *Target;
  1020.             if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
  1021.             {
  1022.                 Temp8 = ACPI_EINJ_ACTION_RESERVED;
  1023.             }
  1024.  
  1025.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
  1026.             break;
  1027.  
  1028.         case ACPI_DMT_EINJINST:
  1029.  
  1030.             /* EINJ Instruction types */
  1031.  
  1032.             Temp8 = *Target;
  1033.             if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
  1034.             {
  1035.                 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
  1036.             }
  1037.  
  1038.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
  1039.             break;
  1040.  
  1041.         case ACPI_DMT_ERSTACT:
  1042.  
  1043.             /* ERST Action types */
  1044.  
  1045.             Temp8 = *Target;
  1046.             if (Temp8 > ACPI_ERST_ACTION_RESERVED)
  1047.             {
  1048.                 Temp8 = ACPI_ERST_ACTION_RESERVED;
  1049.             }
  1050.  
  1051.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
  1052.             break;
  1053.  
  1054.         case ACPI_DMT_ERSTINST:
  1055.  
  1056.             /* ERST Instruction types */
  1057.  
  1058.             Temp8 = *Target;
  1059.             if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
  1060.             {
  1061.                 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
  1062.             }
  1063.  
  1064.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
  1065.             break;
  1066.  
  1067.         case ACPI_DMT_HEST:
  1068.  
  1069.             /* HEST subtable types */
  1070.  
  1071.             Temp16 = ACPI_GET16 (Target);
  1072.             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
  1073.             {
  1074.                 Temp16 = ACPI_HEST_TYPE_RESERVED;
  1075.             }
  1076.  
  1077.             AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
  1078.             break;
  1079.  
  1080.         case ACPI_DMT_HESTNTFY:
  1081.  
  1082.             AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
  1083.             AcpiDmDumpTable (TableLength, CurrentOffset, Target,
  1084.                 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
  1085.             AcpiOsPrintf ("\n");
  1086.             LastOutputBlankLine = TRUE;
  1087.             break;
  1088.  
  1089.         case ACPI_DMT_HESTNTYP:
  1090.  
  1091.             /* HEST Notify types */
  1092.  
  1093.             Temp8 = *Target;
  1094.             if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
  1095.             {
  1096.                 Temp8 = ACPI_HEST_NOTIFY_RESERVED;
  1097.             }
  1098.  
  1099.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
  1100.             break;
  1101.  
  1102.         case ACPI_DMT_MADT:
  1103.  
  1104.             /* MADT subtable types */
  1105.  
  1106.             Temp8 = *Target;
  1107.             if (Temp8 > ACPI_MADT_TYPE_RESERVED)
  1108.             {
  1109.                 Temp8 = ACPI_MADT_TYPE_RESERVED;
  1110.             }
  1111.  
  1112.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
  1113.             break;
  1114.  
  1115.         case ACPI_DMT_SLIC:
  1116.  
  1117.             /* SLIC subtable types */
  1118.  
  1119.             Temp8 = *Target;
  1120.             if (Temp8 > ACPI_SLIC_TYPE_RESERVED)
  1121.             {
  1122.                 Temp8 = ACPI_SLIC_TYPE_RESERVED;
  1123.             }
  1124.  
  1125.             AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
  1126.             break;
  1127.  
  1128.         case ACPI_DMT_SRAT:
  1129.  
  1130.             /* SRAT subtable types */
  1131.  
  1132.             Temp8 = *Target;
  1133.             if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
  1134.             {
  1135.                 Temp8 = ACPI_SRAT_TYPE_RESERVED;
  1136.             }
  1137.  
  1138.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
  1139.             break;
  1140.  
  1141.         case ACPI_DMT_FADTPM:
  1142.  
  1143.             /* FADT Preferred PM Profile names */
  1144.  
  1145.             Temp8 = *Target;
  1146.             if (Temp8 > ACPI_FADT_PM_RESERVED)
  1147.             {
  1148.                 Temp8 = ACPI_FADT_PM_RESERVED;
  1149.             }
  1150.  
  1151.             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
  1152.             break;
  1153.  
  1154.         case ACPI_DMT_IVRS:
  1155.  
  1156.             /* IVRS subtable types */
  1157.  
  1158.             Temp8 = *Target;
  1159.             switch (Temp8)
  1160.             {
  1161.             case ACPI_IVRS_TYPE_HARDWARE:
  1162.                 Name = AcpiDmIvrsSubnames[0];
  1163.                 break;
  1164.  
  1165.             case ACPI_IVRS_TYPE_MEMORY1:
  1166.             case ACPI_IVRS_TYPE_MEMORY2:
  1167.             case ACPI_IVRS_TYPE_MEMORY3:
  1168.                 Name = AcpiDmIvrsSubnames[1];
  1169.                 break;
  1170.  
  1171.             default:
  1172.                 Name = AcpiDmIvrsSubnames[2];
  1173.                 break;
  1174.             }
  1175.  
  1176.             AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
  1177.             break;
  1178.  
  1179.         case ACPI_DMT_EXIT:
  1180.             return (AE_OK);
  1181.  
  1182.         default:
  1183.             ACPI_ERROR ((AE_INFO,
  1184.                 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
  1185.             return (AE_SUPPORT);
  1186.         }
  1187.     }
  1188.  
  1189.     if (TableOffset && !SubtableLength)
  1190.     {
  1191.         /* If this table is not the main table, subtable must have valid length */
  1192.  
  1193.         AcpiOsPrintf ("Invalid zero length subtable\n");
  1194.         return (AE_BAD_DATA);
  1195.     }
  1196.  
  1197.     return (AE_OK);
  1198. }
  1199.  
  1200.  
  1201. /*******************************************************************************
  1202.  *
  1203.  * FUNCTION:    AcpiDmCheckAscii
  1204.  *
  1205.  * PARAMETERS:  Name                - Ascii string
  1206.  *              Count               - Number of characters to check
  1207.  *
  1208.  * RETURN:      None
  1209.  *
  1210.  * DESCRIPTION: Ensure that the requested number of characters are printable
  1211.  *              Ascii characters. Sets non-printable and null chars to <space>.
  1212.  *
  1213.  ******************************************************************************/
  1214.  
  1215. static void
  1216. AcpiDmCheckAscii (
  1217.     UINT8                   *Name,
  1218.     char                    *RepairedName,
  1219.     UINT32                  Count)
  1220. {
  1221.     UINT32                  i;
  1222.  
  1223.  
  1224.     for (i = 0; i < Count; i++)
  1225.     {
  1226.         RepairedName[i] = (char) Name[i];
  1227.  
  1228.         if (!Name[i])
  1229.         {
  1230.             return;
  1231.         }
  1232.         if (!isprint (Name[i]))
  1233.         {
  1234.             RepairedName[i] = ' ';
  1235.         }
  1236.     }
  1237. }
  1238.