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