dmtable.c revision 209746
1167802Sjkim/****************************************************************************** 2167802Sjkim * 3167802Sjkim * Module Name: dmtable - Support for ACPI tables that contain no AML code 4167802Sjkim * 5167802Sjkim *****************************************************************************/ 6167802Sjkim 7167802Sjkim/****************************************************************************** 8167802Sjkim * 9167802Sjkim * 1. Copyright Notice 10167802Sjkim * 11202771Sjkim * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. 12167802Sjkim * All rights reserved. 13167802Sjkim * 14167802Sjkim * 2. License 15167802Sjkim * 16167802Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property 17167802Sjkim * rights. You may have additional license terms from the party that provided 18167802Sjkim * you this software, covering your right to use that party's intellectual 19167802Sjkim * property rights. 20167802Sjkim * 21167802Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22167802Sjkim * copy of the source code appearing in this file ("Covered Code") an 23167802Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24167802Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy, 25167802Sjkim * make derivatives, distribute, use and display any portion of the Covered 26167802Sjkim * Code in any form, with the right to sublicense such rights; and 27167802Sjkim * 28167802Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29167802Sjkim * license (with the right to sublicense), under only those claims of Intel 30167802Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell, 31167802Sjkim * offer to sell, and import the Covered Code and derivative works thereof 32167802Sjkim * solely to the minimum extent necessary to exercise the above copyright 33167802Sjkim * license, and in no event shall the patent license extend to any additions 34167802Sjkim * to or modifications of the Original Intel Code. No other license or right 35167802Sjkim * is granted directly or by implication, estoppel or otherwise; 36167802Sjkim * 37167802Sjkim * The above copyright and patent license is granted only if the following 38167802Sjkim * conditions are met: 39167802Sjkim * 40167802Sjkim * 3. Conditions 41167802Sjkim * 42167802Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43167802Sjkim * Redistribution of source code of any substantial portion of the Covered 44167802Sjkim * Code or modification with rights to further distribute source must include 45167802Sjkim * the above Copyright Notice, the above License, this list of Conditions, 46167802Sjkim * and the following Disclaimer and Export Compliance provision. In addition, 47167802Sjkim * Licensee must cause all Covered Code to which Licensee contributes to 48167802Sjkim * contain a file documenting the changes Licensee made to create that Covered 49167802Sjkim * Code and the date of any change. Licensee must include in that file the 50167802Sjkim * documentation of any changes made by any predecessor Licensee. Licensee 51167802Sjkim * must include a prominent statement that the modification is derived, 52167802Sjkim * directly or indirectly, from Original Intel Code. 53167802Sjkim * 54167802Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55167802Sjkim * Redistribution of source code of any substantial portion of the Covered 56167802Sjkim * Code or modification without rights to further distribute source must 57167802Sjkim * include the following Disclaimer and Export Compliance provision in the 58167802Sjkim * documentation and/or other materials provided with distribution. In 59167802Sjkim * addition, Licensee may not authorize further sublicense of source of any 60167802Sjkim * portion of the Covered Code, and must include terms to the effect that the 61167802Sjkim * license from Licensee to its licensee is limited to the intellectual 62167802Sjkim * property embodied in the software Licensee provides to its licensee, and 63167802Sjkim * not to intellectual property embodied in modifications its licensee may 64167802Sjkim * make. 65167802Sjkim * 66167802Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any 67167802Sjkim * substantial portion of the Covered Code or modification must reproduce the 68167802Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance 69167802Sjkim * provision in the documentation and/or other materials provided with the 70167802Sjkim * distribution. 71167802Sjkim * 72167802Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original 73167802Sjkim * Intel Code. 74167802Sjkim * 75167802Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76167802Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or 77167802Sjkim * other dealings in products derived from or relating to the Covered Code 78167802Sjkim * without prior written authorization from Intel. 79167802Sjkim * 80167802Sjkim * 4. Disclaimer and Export Compliance 81167802Sjkim * 82167802Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83167802Sjkim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84167802Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85167802Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86167802Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87167802Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88167802Sjkim * PARTICULAR PURPOSE. 89167802Sjkim * 90167802Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91167802Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92167802Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93167802Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94167802Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95167802Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96167802Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97167802Sjkim * LIMITED REMEDY. 98167802Sjkim * 99167802Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this 100167802Sjkim * software or system incorporating such software without first obtaining any 101167802Sjkim * required license or other approval from the U. S. Department of Commerce or 102167802Sjkim * any other agency or department of the United States Government. In the 103167802Sjkim * event Licensee exports any such software from the United States or 104167802Sjkim * re-exports any such software from a foreign destination, Licensee shall 105167802Sjkim * ensure that the distribution and export/re-export of the software is in 106167802Sjkim * compliance with all laws, regulations, orders, or other restrictions of the 107167802Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108167802Sjkim * any of its subsidiaries will export/re-export any technical data, process, 109167802Sjkim * software, or service, directly or indirectly, to any country for which the 110167802Sjkim * United States government or any agency thereof requires an export license, 111167802Sjkim * other governmental approval, or letter of assurance, without first obtaining 112167802Sjkim * such license, approval or letter. 113167802Sjkim * 114167802Sjkim *****************************************************************************/ 115167802Sjkim 116193529Sjkim#include <contrib/dev/acpica/include/acpi.h> 117193529Sjkim#include <contrib/dev/acpica/include/accommon.h> 118193529Sjkim#include <contrib/dev/acpica/include/acdisasm.h> 119193529Sjkim#include <contrib/dev/acpica/include/actables.h> 120209746Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 121209746Sjkim#include <contrib/dev/acpica/compiler/dtcompiler.h> 122167802Sjkim 123167802Sjkim/* This module used for application-level code only */ 124167802Sjkim 125167802Sjkim#define _COMPONENT ACPI_CA_DISASSEMBLER 126167802Sjkim ACPI_MODULE_NAME ("dmtable") 127167802Sjkim 128167802Sjkim/* Local Prototypes */ 129167802Sjkim 130167802Sjkimstatic void 131167802SjkimAcpiDmCheckAscii ( 132167802Sjkim UINT8 *Target, 133197104Sjkim char *RepairedName, 134167802Sjkim UINT32 Count); 135167802Sjkim 136167802Sjkim 137167802Sjkim/* These tables map a subtable type to a description string */ 138167802Sjkim 139193529Sjkimstatic const char *AcpiDmAsfSubnames[] = 140193529Sjkim{ 141193529Sjkim "ASF Information", 142193529Sjkim "ASF Alerts", 143193529Sjkim "ASF Remote Control", 144193529Sjkim "ASF RMCP Boot Options", 145193529Sjkim "ASF Address", 146193529Sjkim "Unknown SubTable Type" /* Reserved */ 147193529Sjkim}; 148193529Sjkim 149167802Sjkimstatic const char *AcpiDmDmarSubnames[] = 150167802Sjkim{ 151167802Sjkim "Hardware Unit Definition", 152167802Sjkim "Reserved Memory Region", 153193529Sjkim "Root Port ATS Capability", 154197104Sjkim "Remapping Hardware Static Affinity", 155167802Sjkim "Unknown SubTable Type" /* Reserved */ 156167802Sjkim}; 157167802Sjkim 158209746Sjkimstatic const char *AcpiDmEinjActions[] = 159209746Sjkim{ 160209746Sjkim "Begin Operation", 161209746Sjkim "Get Trigger Table", 162209746Sjkim "Set Error Type", 163209746Sjkim "Get Error Type", 164209746Sjkim "End Operation", 165209746Sjkim "Execute Operation", 166209746Sjkim "Check Busy Status", 167209746Sjkim "Get Command Status", 168209746Sjkim "Unknown Action" 169209746Sjkim}; 170209746Sjkim 171209746Sjkimstatic const char *AcpiDmEinjInstructions[] = 172209746Sjkim{ 173209746Sjkim "Read Register", 174209746Sjkim "Read Register Value", 175209746Sjkim "Write Register", 176209746Sjkim "Write Register Value", 177209746Sjkim "Noop", 178209746Sjkim "Unknown Instruction" 179209746Sjkim}; 180209746Sjkim 181209746Sjkimstatic const char *AcpiDmErstActions[] = 182209746Sjkim{ 183209746Sjkim "Begin Write Operation", 184209746Sjkim "Begin Read Operation", 185209746Sjkim "Begin Clear Operation", 186209746Sjkim "End Operation", 187209746Sjkim "Set Record Offset", 188209746Sjkim "Execute Operation", 189209746Sjkim "Check Busy Status", 190209746Sjkim "Get Command Status", 191209746Sjkim "Get Record Identifier", 192209746Sjkim "Set Record Identifier", 193209746Sjkim "Get Record Count", 194209746Sjkim "Begin Dummy Write", 195209746Sjkim "Unused/Unknown Action", 196209746Sjkim "Get Error Address Range", 197209746Sjkim "Get Error Address Length", 198209746Sjkim "Get Error Attributes", 199209746Sjkim "Unknown Action" 200209746Sjkim}; 201209746Sjkim 202209746Sjkimstatic const char *AcpiDmErstInstructions[] = 203209746Sjkim{ 204209746Sjkim "Read Register", 205209746Sjkim "Read Register Value", 206209746Sjkim "Write Register", 207209746Sjkim "Write Register Value", 208209746Sjkim "Noop", 209209746Sjkim "Load Var1", 210209746Sjkim "Load Var2", 211209746Sjkim "Store Var1", 212209746Sjkim "Add", 213209746Sjkim "Subtract", 214209746Sjkim "Add Value", 215209746Sjkim "Subtract Value", 216209746Sjkim "Stall", 217209746Sjkim "Stall While True", 218209746Sjkim "Skip Next If True", 219209746Sjkim "GoTo", 220209746Sjkim "Set Source Address", 221209746Sjkim "Set Destination Address", 222209746Sjkim "Move Data", 223209746Sjkim "Unknown Instruction" 224209746Sjkim}; 225209746Sjkim 226193529Sjkimstatic const char *AcpiDmHestSubnames[] = 227193529Sjkim{ 228197104Sjkim "IA-32 Machine Check Exception", 229197104Sjkim "IA-32 Corrected Machine Check", 230197104Sjkim "IA-32 Non-Maskable Interrupt", 231197104Sjkim "Unknown SubTable Type", /* 3 - Reserved */ 232197104Sjkim "Unknown SubTable Type", /* 4 - Reserved */ 233197104Sjkim "Unknown SubTable Type", /* 5 - Reserved */ 234193529Sjkim "PCI Express Root Port AER", 235193529Sjkim "PCI Express AER (AER Endpoint)", 236193529Sjkim "PCI Express/PCI-X Bridge AER", 237193529Sjkim "Generic Hardware Error Source", 238193529Sjkim "Unknown SubTable Type" /* Reserved */ 239193529Sjkim}; 240193529Sjkim 241193529Sjkimstatic const char *AcpiDmHestNotifySubnames[] = 242193529Sjkim{ 243193529Sjkim "Polled", 244193529Sjkim "External Interrupt", 245193529Sjkim "Local Interrupt", 246193529Sjkim "SCI", 247193529Sjkim "NMI", 248193529Sjkim "Unknown Notify Type" /* Reserved */ 249193529Sjkim}; 250193529Sjkim 251167802Sjkimstatic const char *AcpiDmMadtSubnames[] = 252167802Sjkim{ 253167802Sjkim "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ 254167802Sjkim "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */ 255167802Sjkim "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */ 256167802Sjkim "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */ 257167802Sjkim "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */ 258167802Sjkim "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */ 259167802Sjkim "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */ 260167802Sjkim "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */ 261167802Sjkim "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ 262193529Sjkim "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ 263193529Sjkim "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ 264167802Sjkim "Unknown SubTable Type" /* Reserved */ 265167802Sjkim}; 266167802Sjkim 267167802Sjkimstatic const char *AcpiDmSratSubnames[] = 268167802Sjkim{ 269167802Sjkim "Processor Local APIC/SAPIC Affinity", 270167802Sjkim "Memory Affinity", 271193529Sjkim "Processor Local x2APIC Affinity", 272167802Sjkim "Unknown SubTable Type" /* Reserved */ 273167802Sjkim}; 274167802Sjkim 275197104Sjkimstatic const char *AcpiDmIvrsSubnames[] = 276197104Sjkim{ 277197104Sjkim "Hardware Definition Block", 278197104Sjkim "Memory Definition Block", 279197104Sjkim "Unknown SubTable Type" /* Reserved */ 280197104Sjkim}; 281167802Sjkim 282197104Sjkim 283193529Sjkim#define ACPI_FADT_PM_RESERVED 8 284193529Sjkim 285193529Sjkimstatic const char *AcpiDmFadtProfiles[] = 286193529Sjkim{ 287193529Sjkim "Unspecified", 288193529Sjkim "Desktop", 289193529Sjkim "Mobile", 290193529Sjkim "Workstation", 291193529Sjkim "Enterprise Server", 292193529Sjkim "SOHO Server", 293193529Sjkim "Appliance PC", 294193529Sjkim "Performance Server", 295193529Sjkim "Unknown Profile Type" 296193529Sjkim}; 297193529Sjkim 298167802Sjkim/******************************************************************************* 299167802Sjkim * 300167802Sjkim * ACPI Table Data, indexed by signature. 301167802Sjkim * 302209746Sjkim * Each entry contains: Signature, Table Info, Handler, DtHandler, 303209746Sjkim * Template, Description 304197104Sjkim * 305209746Sjkim * Simple tables have only a TableInfo structure, complex tables have a 306209746Sjkim * handler. This table must be NULL terminated. RSDP and FACS are 307209746Sjkim * special-cased elsewhere. 308167802Sjkim * 309167802Sjkim ******************************************************************************/ 310167802Sjkim 311209746SjkimACPI_DMTABLE_DATA AcpiDmTableData[] = 312167802Sjkim{ 313209746Sjkim {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"}, 314209746Sjkim {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, 315209746Sjkim {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"}, 316209746Sjkim {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, 317209746Sjkim {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, 318209746Sjkim {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, 319209746Sjkim {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"}, 320209746Sjkim {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"}, 321209746Sjkim {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, 322209746Sjkim {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table"}, 323209746Sjkim {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, 324209746Sjkim {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, 325209746Sjkim {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, 326209746Sjkim {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table"}, 327209746Sjkim {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, 328209746Sjkim {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, 329209746Sjkim {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, 330209746Sjkim {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, 331209746Sjkim {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, 332209746Sjkim {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, NULL, "Software Licensing Description Table"}, 333209746Sjkim {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, 334209746Sjkim {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, 335209746Sjkim {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, 336209746Sjkim {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, 337209746Sjkim {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, 338209746Sjkim {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, TemplateUefi, "UEFI Boot Optimization Table"}, 339209746Sjkim {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, 340209746Sjkim {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, 341209746Sjkim {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, 342209746Sjkim {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"}, 343209746Sjkim {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"}, 344209746Sjkim {NULL, NULL, NULL, NULL, NULL, NULL} 345167802Sjkim}; 346167802Sjkim 347167802Sjkim 348167802Sjkim/******************************************************************************* 349167802Sjkim * 350209746Sjkim * FUNCTION: AcpiDmGenerateChecksum 351167802Sjkim * 352209746Sjkim * PARAMETERS: Table - Pointer to table to be checksummed 353209746Sjkim * Length - Length of the table 354209746Sjkim * OriginalChecksum - Value of the checksum field 355167802Sjkim * 356167802Sjkim * RETURN: 8 bit checksum of buffer 357167802Sjkim * 358167802Sjkim * DESCRIPTION: Computes an 8 bit checksum of the table. 359167802Sjkim * 360167802Sjkim ******************************************************************************/ 361167802Sjkim 362167802SjkimUINT8 363209746SjkimAcpiDmGenerateChecksum ( 364209746Sjkim void *Table, 365209746Sjkim UINT32 Length, 366209746Sjkim UINT8 OriginalChecksum) 367167802Sjkim{ 368167802Sjkim UINT8 Checksum; 369167802Sjkim 370167802Sjkim 371167802Sjkim /* Sum the entire table as-is */ 372167802Sjkim 373209746Sjkim Checksum = AcpiTbChecksum ((UINT8 *) Table, Length); 374167802Sjkim 375167802Sjkim /* Subtract off the existing checksum value in the table */ 376167802Sjkim 377209746Sjkim Checksum = (UINT8) (Checksum - OriginalChecksum); 378167802Sjkim 379167802Sjkim /* Compute the final checksum */ 380167802Sjkim 381167802Sjkim Checksum = (UINT8) (0 - Checksum); 382167802Sjkim return (Checksum); 383167802Sjkim} 384167802Sjkim 385167802Sjkim 386167802Sjkim/******************************************************************************* 387167802Sjkim * 388167802Sjkim * FUNCTION: AcpiDmGetTableData 389167802Sjkim * 390167802Sjkim * PARAMETERS: Signature - ACPI signature (4 chars) to match 391167802Sjkim * 392167802Sjkim * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found. 393167802Sjkim * 394167802Sjkim * DESCRIPTION: Find a match in the global table of supported ACPI tables 395167802Sjkim * 396167802Sjkim ******************************************************************************/ 397167802Sjkim 398209746SjkimACPI_DMTABLE_DATA * 399167802SjkimAcpiDmGetTableData ( 400167802Sjkim char *Signature) 401167802Sjkim{ 402167802Sjkim ACPI_DMTABLE_DATA *TableData; 403167802Sjkim 404167802Sjkim 405167802Sjkim for (TableData = AcpiDmTableData; TableData->Signature; TableData++) 406167802Sjkim { 407167802Sjkim if (ACPI_COMPARE_NAME (Signature, TableData->Signature)) 408167802Sjkim { 409167802Sjkim return (TableData); 410167802Sjkim } 411167802Sjkim } 412167802Sjkim 413167802Sjkim return (NULL); 414167802Sjkim} 415167802Sjkim 416167802Sjkim 417167802Sjkim/******************************************************************************* 418167802Sjkim * 419167802Sjkim * FUNCTION: AcpiDmDumpDataTable 420167802Sjkim * 421167802Sjkim * PARAMETERS: Table - An ACPI table 422167802Sjkim * 423167802Sjkim * RETURN: None. 424167802Sjkim * 425167802Sjkim * DESCRIPTION: Format the contents of an ACPI data table (any table other 426167802Sjkim * than an SSDT or DSDT that does not contain executable AML code) 427167802Sjkim * 428167802Sjkim ******************************************************************************/ 429167802Sjkim 430167802Sjkimvoid 431167802SjkimAcpiDmDumpDataTable ( 432167802Sjkim ACPI_TABLE_HEADER *Table) 433167802Sjkim{ 434193529Sjkim ACPI_STATUS Status; 435167802Sjkim ACPI_DMTABLE_DATA *TableData; 436167802Sjkim UINT32 Length; 437167802Sjkim 438167802Sjkim 439167802Sjkim /* Ignore tables that contain AML */ 440167802Sjkim 441167802Sjkim if (AcpiUtIsAmlTable (Table)) 442167802Sjkim { 443167802Sjkim return; 444167802Sjkim } 445167802Sjkim 446167802Sjkim /* 447167802Sjkim * Handle tables that don't use the common ACPI table header structure. 448167802Sjkim * Currently, these are the FACS and RSDP. 449167802Sjkim */ 450167802Sjkim if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) 451167802Sjkim { 452167802Sjkim Length = Table->Length; 453167802Sjkim AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); 454167802Sjkim } 455167802Sjkim else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP)) 456167802Sjkim { 457167802Sjkim Length = AcpiDmDumpRsdp (Table); 458167802Sjkim } 459167802Sjkim else 460167802Sjkim { 461167802Sjkim /* 462167802Sjkim * All other tables must use the common ACPI table header, dump it now 463167802Sjkim */ 464167802Sjkim Length = Table->Length; 465193529Sjkim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); 466193529Sjkim if (ACPI_FAILURE (Status)) 467193529Sjkim { 468193529Sjkim return; 469193529Sjkim } 470167802Sjkim AcpiOsPrintf ("\n"); 471167802Sjkim 472167802Sjkim /* Match signature and dispatch appropriately */ 473167802Sjkim 474167802Sjkim TableData = AcpiDmGetTableData (Table->Signature); 475167802Sjkim if (!TableData) 476167802Sjkim { 477167802Sjkim if (!ACPI_STRNCMP (Table->Signature, "OEM", 3)) 478167802Sjkim { 479167802Sjkim AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n", 480167802Sjkim Table->Signature); 481167802Sjkim } 482167802Sjkim else 483167802Sjkim { 484167802Sjkim AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n", 485167802Sjkim Table->Signature); 486167802Sjkim } 487167802Sjkim } 488167802Sjkim else if (TableData->TableHandler) 489167802Sjkim { 490167802Sjkim /* Complex table, has a handler */ 491167802Sjkim 492167802Sjkim TableData->TableHandler (Table); 493167802Sjkim } 494167802Sjkim else if (TableData->TableInfo) 495167802Sjkim { 496167802Sjkim /* Simple table, just walk the info table */ 497167802Sjkim 498167802Sjkim AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); 499167802Sjkim } 500167802Sjkim } 501167802Sjkim 502209746Sjkim if (!Gbl_DoTemplates || Gbl_VerboseTemplates) 503209746Sjkim { 504209746Sjkim /* Dump the raw table data */ 505167802Sjkim 506209746Sjkim AcpiOsPrintf ("\nRaw Table Data\n\n"); 507209746Sjkim AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY); 508209746Sjkim } 509167802Sjkim} 510167802Sjkim 511167802Sjkim 512167802Sjkim/******************************************************************************* 513167802Sjkim * 514167802Sjkim * FUNCTION: AcpiDmLineHeader 515167802Sjkim * 516167802Sjkim * PARAMETERS: Offset - Current byte offset, from table start 517167802Sjkim * ByteLength - Length of the field in bytes, 0 for flags 518167802Sjkim * Name - Name of this field 519167802Sjkim * Value - Optional value, displayed on left of ':' 520167802Sjkim * 521167802Sjkim * RETURN: None 522167802Sjkim * 523167802Sjkim * DESCRIPTION: Utility routines for formatting output lines. Displays the 524167802Sjkim * current table offset in hex and decimal, the field length, 525167802Sjkim * and the field name. 526167802Sjkim * 527167802Sjkim ******************************************************************************/ 528167802Sjkim 529167802Sjkimvoid 530167802SjkimAcpiDmLineHeader ( 531167802Sjkim UINT32 Offset, 532167802Sjkim UINT32 ByteLength, 533167802Sjkim char *Name) 534167802Sjkim{ 535167802Sjkim 536209746Sjkim if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ 537167802Sjkim { 538209746Sjkim if (ByteLength) 539209746Sjkim { 540209746Sjkim AcpiOsPrintf ("[%.3d] %34s : ", 541209746Sjkim ByteLength, Name); 542209746Sjkim } 543209746Sjkim else 544209746Sjkim { 545209746Sjkim AcpiOsPrintf ("%40s : ", 546209746Sjkim Name); 547209746Sjkim } 548167802Sjkim } 549209746Sjkim else /* Normal disassembler or verbose template */ 550167802Sjkim { 551209746Sjkim if (ByteLength) 552209746Sjkim { 553209746Sjkim AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", 554209746Sjkim Offset, Offset, ByteLength, Name); 555209746Sjkim } 556209746Sjkim else 557209746Sjkim { 558209746Sjkim AcpiOsPrintf ("%43s : ", 559209746Sjkim Name); 560209746Sjkim } 561167802Sjkim } 562167802Sjkim} 563167802Sjkim 564167802Sjkimvoid 565167802SjkimAcpiDmLineHeader2 ( 566167802Sjkim UINT32 Offset, 567167802Sjkim UINT32 ByteLength, 568167802Sjkim char *Name, 569167802Sjkim UINT32 Value) 570167802Sjkim{ 571167802Sjkim 572209746Sjkim if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ 573167802Sjkim { 574209746Sjkim if (ByteLength) 575209746Sjkim { 576209746Sjkim AcpiOsPrintf ("[%.3d] %30s % 3d : ", 577209746Sjkim ByteLength, Name, Value); 578209746Sjkim } 579209746Sjkim else 580209746Sjkim { 581209746Sjkim AcpiOsPrintf ("%36s % 3d : ", 582209746Sjkim Name, Value); 583209746Sjkim } 584167802Sjkim } 585209746Sjkim else /* Normal disassembler or verbose template */ 586167802Sjkim { 587209746Sjkim if (ByteLength) 588209746Sjkim { 589209746Sjkim AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", 590209746Sjkim Offset, Offset, ByteLength, Name, Value); 591209746Sjkim } 592209746Sjkim else 593209746Sjkim { 594209746Sjkim AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", 595209746Sjkim Offset, Offset, Name, Value); 596209746Sjkim } 597167802Sjkim } 598167802Sjkim} 599167802Sjkim 600167802Sjkim 601167802Sjkim/******************************************************************************* 602167802Sjkim * 603167802Sjkim * FUNCTION: AcpiDmDumpTable 604167802Sjkim * 605167802Sjkim * PARAMETERS: TableLength - Length of the entire ACPI table 606167802Sjkim * TableOffset - Starting offset within the table for this 607167802Sjkim * sub-descriptor (0 if main table) 608167802Sjkim * Table - The ACPI table 609193529Sjkim * SubtableLength - Length of this sub-descriptor 610167802Sjkim * Info - Info table for this ACPI table 611167802Sjkim * 612167802Sjkim * RETURN: None 613167802Sjkim * 614167802Sjkim * DESCRIPTION: Display ACPI table contents by walking the Info table. 615167802Sjkim * 616209746Sjkim * Note: This function must remain in sync with DtGetFieldLength. 617209746Sjkim * 618167802Sjkim ******************************************************************************/ 619167802Sjkim 620193529SjkimACPI_STATUS 621167802SjkimAcpiDmDumpTable ( 622167802Sjkim UINT32 TableLength, 623167802Sjkim UINT32 TableOffset, 624167802Sjkim void *Table, 625167802Sjkim UINT32 SubtableLength, 626167802Sjkim ACPI_DMTABLE_INFO *Info) 627167802Sjkim{ 628167802Sjkim UINT8 *Target; 629167802Sjkim UINT32 CurrentOffset; 630167802Sjkim UINT32 ByteLength; 631167802Sjkim UINT8 Temp8; 632167802Sjkim UINT16 Temp16; 633167802Sjkim ACPI_DMTABLE_DATA *TableData; 634197104Sjkim const char *Name; 635193529Sjkim BOOLEAN LastOutputBlankLine = FALSE; 636197104Sjkim char RepairedName[8]; 637167802Sjkim 638167802Sjkim 639167802Sjkim if (!Info) 640167802Sjkim { 641167802Sjkim AcpiOsPrintf ("Display not implemented\n"); 642193529Sjkim return (AE_NOT_IMPLEMENTED); 643167802Sjkim } 644167802Sjkim 645167802Sjkim /* Walk entire Info table; Null name terminates */ 646167802Sjkim 647167802Sjkim for (; Info->Name; Info++) 648167802Sjkim { 649167802Sjkim /* 650167802Sjkim * Target points to the field within the ACPI Table. CurrentOffset is 651167802Sjkim * the offset of the field from the start of the main table. 652167802Sjkim */ 653167802Sjkim Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); 654167802Sjkim CurrentOffset = TableOffset + Info->Offset; 655167802Sjkim 656167802Sjkim /* Check for beyond EOT or beyond subtable end */ 657167802Sjkim 658167802Sjkim if ((CurrentOffset >= TableLength) || 659167802Sjkim (SubtableLength && (Info->Offset >= SubtableLength))) 660167802Sjkim { 661193529Sjkim AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); 662193529Sjkim return (AE_BAD_DATA); 663167802Sjkim } 664167802Sjkim 665167802Sjkim /* Generate the byte length for this field */ 666167802Sjkim 667167802Sjkim switch (Info->Opcode) 668167802Sjkim { 669167802Sjkim case ACPI_DMT_UINT8: 670167802Sjkim case ACPI_DMT_CHKSUM: 671167802Sjkim case ACPI_DMT_SPACEID: 672197104Sjkim case ACPI_DMT_IVRS: 673167802Sjkim case ACPI_DMT_MADT: 674167802Sjkim case ACPI_DMT_SRAT: 675193529Sjkim case ACPI_DMT_ASF: 676193529Sjkim case ACPI_DMT_HESTNTYP: 677193529Sjkim case ACPI_DMT_FADTPM: 678209746Sjkim case ACPI_DMT_EINJACT: 679209746Sjkim case ACPI_DMT_EINJINST: 680209746Sjkim case ACPI_DMT_ERSTACT: 681209746Sjkim case ACPI_DMT_ERSTINST: 682167802Sjkim ByteLength = 1; 683167802Sjkim break; 684167802Sjkim case ACPI_DMT_UINT16: 685167802Sjkim case ACPI_DMT_DMAR: 686193529Sjkim case ACPI_DMT_HEST: 687167802Sjkim ByteLength = 2; 688167802Sjkim break; 689167802Sjkim case ACPI_DMT_UINT24: 690167802Sjkim ByteLength = 3; 691167802Sjkim break; 692167802Sjkim case ACPI_DMT_UINT32: 693167802Sjkim case ACPI_DMT_NAME4: 694167802Sjkim case ACPI_DMT_SIG: 695167802Sjkim ByteLength = 4; 696167802Sjkim break; 697167802Sjkim case ACPI_DMT_NAME6: 698167802Sjkim ByteLength = 6; 699167802Sjkim break; 700167802Sjkim case ACPI_DMT_UINT56: 701167802Sjkim ByteLength = 7; 702167802Sjkim break; 703167802Sjkim case ACPI_DMT_UINT64: 704167802Sjkim case ACPI_DMT_NAME8: 705167802Sjkim ByteLength = 8; 706167802Sjkim break; 707197104Sjkim case ACPI_DMT_BUF16: 708197104Sjkim ByteLength = 16; 709197104Sjkim break; 710167802Sjkim case ACPI_DMT_STRING: 711167802Sjkim ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; 712167802Sjkim break; 713167802Sjkim case ACPI_DMT_GAS: 714193529Sjkim if (!LastOutputBlankLine) 715193529Sjkim { 716193529Sjkim AcpiOsPrintf ("\n"); 717193529Sjkim LastOutputBlankLine = TRUE; 718193529Sjkim } 719167802Sjkim ByteLength = sizeof (ACPI_GENERIC_ADDRESS); 720167802Sjkim break; 721193529Sjkim case ACPI_DMT_HESTNTFY: 722193529Sjkim if (!LastOutputBlankLine) 723193529Sjkim { 724193529Sjkim AcpiOsPrintf ("\n"); 725193529Sjkim LastOutputBlankLine = TRUE; 726193529Sjkim } 727193529Sjkim ByteLength = sizeof (ACPI_HEST_NOTIFY); 728193529Sjkim break; 729167802Sjkim default: 730167802Sjkim ByteLength = 0; 731167802Sjkim break; 732167802Sjkim } 733167802Sjkim 734193529Sjkim if (CurrentOffset + ByteLength > TableLength) 735193529Sjkim { 736193529Sjkim AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); 737193529Sjkim return (AE_BAD_DATA); 738193529Sjkim } 739193529Sjkim 740167802Sjkim /* Start a new line and decode the opcode */ 741167802Sjkim 742167802Sjkim AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); 743167802Sjkim 744167802Sjkim switch (Info->Opcode) 745167802Sjkim { 746167802Sjkim /* Single-bit Flag fields. Note: Opcode is the bit position */ 747167802Sjkim 748167802Sjkim case ACPI_DMT_FLAG0: 749167802Sjkim case ACPI_DMT_FLAG1: 750167802Sjkim case ACPI_DMT_FLAG2: 751167802Sjkim case ACPI_DMT_FLAG3: 752167802Sjkim case ACPI_DMT_FLAG4: 753167802Sjkim case ACPI_DMT_FLAG5: 754167802Sjkim case ACPI_DMT_FLAG6: 755167802Sjkim case ACPI_DMT_FLAG7: 756167802Sjkim 757167802Sjkim AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01); 758167802Sjkim break; 759167802Sjkim 760167802Sjkim /* 2-bit Flag fields */ 761167802Sjkim 762167802Sjkim case ACPI_DMT_FLAGS0: 763167802Sjkim 764167802Sjkim AcpiOsPrintf ("%1.1X\n", *Target & 0x03); 765167802Sjkim break; 766167802Sjkim 767167802Sjkim case ACPI_DMT_FLAGS2: 768167802Sjkim 769167802Sjkim AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03); 770167802Sjkim break; 771167802Sjkim 772167802Sjkim /* Standard Data Types */ 773167802Sjkim 774167802Sjkim case ACPI_DMT_UINT8: 775167802Sjkim 776167802Sjkim AcpiOsPrintf ("%2.2X\n", *Target); 777167802Sjkim break; 778167802Sjkim 779167802Sjkim case ACPI_DMT_UINT16: 780167802Sjkim 781167802Sjkim AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target)); 782167802Sjkim break; 783167802Sjkim 784167802Sjkim case ACPI_DMT_UINT24: 785167802Sjkim 786167802Sjkim AcpiOsPrintf ("%2.2X%2.2X%2.2X\n", 787167802Sjkim *Target, *(Target + 1), *(Target + 2)); 788167802Sjkim break; 789167802Sjkim 790167802Sjkim case ACPI_DMT_UINT32: 791167802Sjkim 792167802Sjkim AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target)); 793167802Sjkim break; 794167802Sjkim 795167802Sjkim case ACPI_DMT_UINT56: 796167802Sjkim 797193529Sjkim for (Temp8 = 0; Temp8 < 7; Temp8++) 798193529Sjkim { 799193529Sjkim AcpiOsPrintf ("%2.2X", Target[Temp8]); 800193529Sjkim } 801193529Sjkim AcpiOsPrintf ("\n"); 802167802Sjkim break; 803167802Sjkim 804167802Sjkim case ACPI_DMT_UINT64: 805167802Sjkim 806167802Sjkim AcpiOsPrintf ("%8.8X%8.8X\n", 807167802Sjkim ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); 808167802Sjkim break; 809167802Sjkim 810197104Sjkim case ACPI_DMT_BUF16: 811197104Sjkim 812197104Sjkim /* Buffer of length 16 */ 813197104Sjkim 814197104Sjkim for (Temp8 = 0; Temp8 < 16; Temp8++) 815197104Sjkim { 816209746Sjkim AcpiOsPrintf ("%2.2X", Target[Temp8]); 817209746Sjkim if ((Temp8 + 1) < 16) 818209746Sjkim { 819209746Sjkim AcpiOsPrintf (","); 820209746Sjkim } 821197104Sjkim } 822197104Sjkim AcpiOsPrintf ("\n"); 823197104Sjkim break; 824197104Sjkim 825167802Sjkim case ACPI_DMT_STRING: 826167802Sjkim 827197104Sjkim AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); 828167802Sjkim break; 829167802Sjkim 830167802Sjkim /* Fixed length ASCII name fields */ 831167802Sjkim 832167802Sjkim case ACPI_DMT_SIG: 833167802Sjkim 834197104Sjkim AcpiDmCheckAscii (Target, RepairedName, 4); 835197104Sjkim AcpiOsPrintf ("\"%.4s\" ", RepairedName); 836167802Sjkim TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); 837167802Sjkim if (TableData) 838167802Sjkim { 839167802Sjkim AcpiOsPrintf ("/* %s */", TableData->Name); 840167802Sjkim } 841167802Sjkim AcpiOsPrintf ("\n"); 842167802Sjkim break; 843167802Sjkim 844167802Sjkim case ACPI_DMT_NAME4: 845167802Sjkim 846197104Sjkim AcpiDmCheckAscii (Target, RepairedName, 4); 847197104Sjkim AcpiOsPrintf ("\"%.4s\"\n", RepairedName); 848167802Sjkim break; 849167802Sjkim 850167802Sjkim case ACPI_DMT_NAME6: 851167802Sjkim 852197104Sjkim AcpiDmCheckAscii (Target, RepairedName, 6); 853197104Sjkim AcpiOsPrintf ("\"%.6s\"\n", RepairedName); 854167802Sjkim break; 855167802Sjkim 856167802Sjkim case ACPI_DMT_NAME8: 857167802Sjkim 858197104Sjkim AcpiDmCheckAscii (Target, RepairedName, 8); 859197104Sjkim AcpiOsPrintf ("\"%.8s\"\n", RepairedName); 860167802Sjkim break; 861167802Sjkim 862167802Sjkim /* Special Data Types */ 863167802Sjkim 864167802Sjkim case ACPI_DMT_CHKSUM: 865167802Sjkim 866167802Sjkim /* Checksum, display and validate */ 867167802Sjkim 868167802Sjkim AcpiOsPrintf ("%2.2X", *Target); 869209746Sjkim Temp8 = AcpiDmGenerateChecksum (Table, 870209746Sjkim ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, 871209746Sjkim ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum); 872167802Sjkim if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum) 873167802Sjkim { 874167802Sjkim AcpiOsPrintf ( 875167802Sjkim " /* Incorrect checksum, should be %2.2X */", Temp8); 876167802Sjkim } 877167802Sjkim AcpiOsPrintf ("\n"); 878167802Sjkim break; 879167802Sjkim 880167802Sjkim case ACPI_DMT_SPACEID: 881167802Sjkim 882167802Sjkim /* Address Space ID */ 883167802Sjkim 884167802Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target)); 885167802Sjkim break; 886167802Sjkim 887167802Sjkim case ACPI_DMT_GAS: 888167802Sjkim 889167802Sjkim /* Generic Address Structure */ 890167802Sjkim 891167802Sjkim AcpiOsPrintf ("<Generic Address Structure>\n"); 892197104Sjkim AcpiDmDumpTable (TableLength, CurrentOffset, Target, 893197104Sjkim sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); 894193529Sjkim AcpiOsPrintf ("\n"); 895193529Sjkim LastOutputBlankLine = TRUE; 896167802Sjkim break; 897167802Sjkim 898193529Sjkim case ACPI_DMT_ASF: 899193529Sjkim 900193529Sjkim /* ASF subtable types */ 901193529Sjkim 902193529Sjkim Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ 903193529Sjkim if (Temp16 > ACPI_ASF_TYPE_RESERVED) 904193529Sjkim { 905193529Sjkim Temp16 = ACPI_ASF_TYPE_RESERVED; 906193529Sjkim } 907193529Sjkim 908193529Sjkim AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); 909193529Sjkim break; 910193529Sjkim 911167802Sjkim case ACPI_DMT_DMAR: 912167802Sjkim 913167802Sjkim /* DMAR subtable types */ 914167802Sjkim 915193529Sjkim Temp16 = ACPI_GET16 (Target); 916167802Sjkim if (Temp16 > ACPI_DMAR_TYPE_RESERVED) 917167802Sjkim { 918167802Sjkim Temp16 = ACPI_DMAR_TYPE_RESERVED; 919167802Sjkim } 920167802Sjkim 921193529Sjkim AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); 922167802Sjkim break; 923167802Sjkim 924209746Sjkim case ACPI_DMT_EINJACT: 925209746Sjkim 926209746Sjkim /* EINJ Action types */ 927209746Sjkim 928209746Sjkim Temp8 = *Target; 929209746Sjkim if (Temp8 > ACPI_EINJ_ACTION_RESERVED) 930209746Sjkim { 931209746Sjkim Temp8 = ACPI_EINJ_ACTION_RESERVED; 932209746Sjkim } 933209746Sjkim 934209746Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]); 935209746Sjkim break; 936209746Sjkim 937209746Sjkim case ACPI_DMT_EINJINST: 938209746Sjkim 939209746Sjkim /* EINJ Instruction types */ 940209746Sjkim 941209746Sjkim Temp8 = *Target; 942209746Sjkim if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED) 943209746Sjkim { 944209746Sjkim Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; 945209746Sjkim } 946209746Sjkim 947209746Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]); 948209746Sjkim break; 949209746Sjkim 950209746Sjkim case ACPI_DMT_ERSTACT: 951209746Sjkim 952209746Sjkim /* ERST Action types */ 953209746Sjkim 954209746Sjkim Temp8 = *Target; 955209746Sjkim if (Temp8 > ACPI_ERST_ACTION_RESERVED) 956209746Sjkim { 957209746Sjkim Temp8 = ACPI_ERST_ACTION_RESERVED; 958209746Sjkim } 959209746Sjkim 960209746Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]); 961209746Sjkim break; 962209746Sjkim 963209746Sjkim case ACPI_DMT_ERSTINST: 964209746Sjkim 965209746Sjkim /* ERST Instruction types */ 966209746Sjkim 967209746Sjkim Temp8 = *Target; 968209746Sjkim if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED) 969209746Sjkim { 970209746Sjkim Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; 971209746Sjkim } 972209746Sjkim 973209746Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]); 974209746Sjkim break; 975209746Sjkim 976193529Sjkim case ACPI_DMT_HEST: 977193529Sjkim 978193529Sjkim /* HEST subtable types */ 979193529Sjkim 980193529Sjkim Temp16 = ACPI_GET16 (Target); 981193529Sjkim if (Temp16 > ACPI_HEST_TYPE_RESERVED) 982193529Sjkim { 983193529Sjkim Temp16 = ACPI_HEST_TYPE_RESERVED; 984193529Sjkim } 985193529Sjkim 986193529Sjkim AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); 987193529Sjkim break; 988193529Sjkim 989193529Sjkim case ACPI_DMT_HESTNTFY: 990193529Sjkim 991193529Sjkim AcpiOsPrintf ("<Hardware Error Notification Structure>\n"); 992197104Sjkim AcpiDmDumpTable (TableLength, CurrentOffset, Target, 993197104Sjkim sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); 994193529Sjkim AcpiOsPrintf ("\n"); 995193529Sjkim LastOutputBlankLine = TRUE; 996193529Sjkim break; 997193529Sjkim 998193529Sjkim case ACPI_DMT_HESTNTYP: 999193529Sjkim 1000193529Sjkim /* HEST Notify types */ 1001193529Sjkim 1002193529Sjkim Temp8 = *Target; 1003193529Sjkim if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) 1004193529Sjkim { 1005193529Sjkim Temp8 = ACPI_HEST_NOTIFY_RESERVED; 1006193529Sjkim } 1007193529Sjkim 1008193529Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); 1009193529Sjkim break; 1010193529Sjkim 1011167802Sjkim case ACPI_DMT_MADT: 1012167802Sjkim 1013167802Sjkim /* MADT subtable types */ 1014167802Sjkim 1015167802Sjkim Temp8 = *Target; 1016167802Sjkim if (Temp8 > ACPI_MADT_TYPE_RESERVED) 1017167802Sjkim { 1018167802Sjkim Temp8 = ACPI_MADT_TYPE_RESERVED; 1019167802Sjkim } 1020167802Sjkim 1021167802Sjkim AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]); 1022167802Sjkim break; 1023167802Sjkim 1024167802Sjkim case ACPI_DMT_SRAT: 1025167802Sjkim 1026167802Sjkim /* SRAT subtable types */ 1027167802Sjkim 1028167802Sjkim Temp8 = *Target; 1029167802Sjkim if (Temp8 > ACPI_SRAT_TYPE_RESERVED) 1030167802Sjkim { 1031167802Sjkim Temp8 = ACPI_SRAT_TYPE_RESERVED; 1032167802Sjkim } 1033167802Sjkim 1034167802Sjkim AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]); 1035167802Sjkim break; 1036167802Sjkim 1037193529Sjkim case ACPI_DMT_FADTPM: 1038193529Sjkim 1039193529Sjkim /* FADT Preferred PM Profile names */ 1040193529Sjkim 1041193529Sjkim Temp8 = *Target; 1042193529Sjkim if (Temp8 > ACPI_FADT_PM_RESERVED) 1043193529Sjkim { 1044193529Sjkim Temp8 = ACPI_FADT_PM_RESERVED; 1045193529Sjkim } 1046193529Sjkim 1047193529Sjkim AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); 1048193529Sjkim break; 1049193529Sjkim 1050197104Sjkim case ACPI_DMT_IVRS: 1051197104Sjkim 1052197104Sjkim /* IVRS subtable types */ 1053197104Sjkim 1054197104Sjkim Temp8 = *Target; 1055197104Sjkim switch (Temp8) 1056197104Sjkim { 1057197104Sjkim case ACPI_IVRS_TYPE_HARDWARE: 1058197104Sjkim Name = AcpiDmIvrsSubnames[0]; 1059197104Sjkim break; 1060197104Sjkim 1061197104Sjkim case ACPI_IVRS_TYPE_MEMORY1: 1062197104Sjkim case ACPI_IVRS_TYPE_MEMORY2: 1063197104Sjkim case ACPI_IVRS_TYPE_MEMORY3: 1064197104Sjkim Name = AcpiDmIvrsSubnames[1]; 1065197104Sjkim break; 1066197104Sjkim 1067197104Sjkim default: 1068197104Sjkim Name = AcpiDmIvrsSubnames[2]; 1069197104Sjkim break; 1070197104Sjkim } 1071197104Sjkim 1072197104Sjkim AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name); 1073197104Sjkim break; 1074197104Sjkim 1075167802Sjkim case ACPI_DMT_EXIT: 1076193529Sjkim return (AE_OK); 1077167802Sjkim 1078167802Sjkim default: 1079167802Sjkim ACPI_ERROR ((AE_INFO, 1080204773Sjkim "**** Invalid table opcode [0x%X] ****\n", Info->Opcode)); 1081193529Sjkim return (AE_SUPPORT); 1082167802Sjkim } 1083167802Sjkim } 1084193529Sjkim 1085193529Sjkim if (TableOffset && !SubtableLength) 1086193529Sjkim { 1087193529Sjkim /* If this table is not the main table, subtable must have valid length */ 1088193529Sjkim 1089193529Sjkim AcpiOsPrintf ("Invalid zero length subtable\n"); 1090193529Sjkim return (AE_BAD_DATA); 1091193529Sjkim } 1092193529Sjkim 1093193529Sjkim return (AE_OK); 1094167802Sjkim} 1095167802Sjkim 1096167802Sjkim 1097167802Sjkim/******************************************************************************* 1098167802Sjkim * 1099167802Sjkim * FUNCTION: AcpiDmCheckAscii 1100167802Sjkim * 1101167802Sjkim * PARAMETERS: Name - Ascii string 1102167802Sjkim * Count - Number of characters to check 1103167802Sjkim * 1104167802Sjkim * RETURN: None 1105167802Sjkim * 1106167802Sjkim * DESCRIPTION: Ensure that the requested number of characters are printable 1107167802Sjkim * Ascii characters. Sets non-printable and null chars to <space>. 1108167802Sjkim * 1109167802Sjkim ******************************************************************************/ 1110167802Sjkim 1111167802Sjkimstatic void 1112167802SjkimAcpiDmCheckAscii ( 1113167802Sjkim UINT8 *Name, 1114197104Sjkim char *RepairedName, 1115167802Sjkim UINT32 Count) 1116167802Sjkim{ 1117167802Sjkim UINT32 i; 1118167802Sjkim 1119167802Sjkim 1120167802Sjkim for (i = 0; i < Count; i++) 1121167802Sjkim { 1122198237Sjkim RepairedName[i] = (char) Name[i]; 1123197104Sjkim 1124197104Sjkim if (!Name[i]) 1125167802Sjkim { 1126197104Sjkim return; 1127167802Sjkim } 1128197104Sjkim if (!isprint (Name[i])) 1129197104Sjkim { 1130197104Sjkim RepairedName[i] = ' '; 1131197104Sjkim } 1132167802Sjkim } 1133167802Sjkim} 1134