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 - 2021, 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 158 /* This module used for application-level code only */ 159 160 #define _COMPONENT ACPI_CA_DISASSEMBLER 161 ACPI_MODULE_NAME ("dmtable") 162 163 const AH_TABLE * 164 AcpiAhGetTableInfo ( 165 char *Signature); 166 167 168 /* Common format strings for commented values */ 169 170 #define UINT8_FORMAT "%2.2X [%s]\n" 171 #define UINT16_FORMAT "%4.4X [%s]\n" 172 #define UINT32_FORMAT "%8.8X [%s]\n" 173 #define STRING_FORMAT "[%s]\n" 174 175 /* These tables map a subtable type to a description string */ 176 177 static const char *AcpiDmAsfSubnames[] = 178 { 179 "ASF Information", 180 "ASF Alerts", 181 "ASF Remote Control", 182 "ASF RMCP Boot Options", 183 "ASF Address", 184 "Unknown Subtable Type" /* Reserved */ 185 }; 186 187 static const char *AcpiDmDmarSubnames[] = 188 { 189 "Hardware Unit Definition", 190 "Reserved Memory Region", 191 "Root Port ATS Capability", 192 "Remapping Hardware Static Affinity", 193 "ACPI Namespace Device Declaration", 194 "Unknown Subtable Type" /* Reserved */ 195 }; 196 197 static const char *AcpiDmDmarScope[] = 198 { 199 "Reserved value", 200 "PCI Endpoint Device", 201 "PCI Bridge Device", 202 "IOAPIC Device", 203 "Message-capable HPET Device", 204 "Namespace Device", 205 "Unknown Scope Type" /* Reserved */ 206 }; 207 208 static const char *AcpiDmEinjActions[] = 209 { 210 "Begin Operation", 211 "Get Trigger Table", 212 "Set Error Type", 213 "Get Error Type", 214 "End Operation", 215 "Execute Operation", 216 "Check Busy Status", 217 "Get Command Status", 218 "Set Error Type With Address", 219 "Get Execute Timings", 220 "Unknown Action" 221 }; 222 223 static const char *AcpiDmEinjInstructions[] = 224 { 225 "Read Register", 226 "Read Register Value", 227 "Write Register", 228 "Write Register Value", 229 "Noop", 230 "Flush Cacheline", 231 "Unknown Instruction" 232 }; 233 234 static const char *AcpiDmErstActions[] = 235 { 236 "Begin Write Operation", 237 "Begin Read Operation", 238 "Begin Clear Operation", 239 "End Operation", 240 "Set Record Offset", 241 "Execute Operation", 242 "Check Busy Status", 243 "Get Command Status", 244 "Get Record Identifier", 245 "Set Record Identifier", 246 "Get Record Count", 247 "Begin Dummy Write", 248 "Unused/Unknown Action", 249 "Get Error Address Range", 250 "Get Error Address Length", 251 "Get Error Attributes", 252 "Execute Timings", 253 "Unknown Action" 254 }; 255 256 static const char *AcpiDmErstInstructions[] = 257 { 258 "Read Register", 259 "Read Register Value", 260 "Write Register", 261 "Write Register Value", 262 "Noop", 263 "Load Var1", 264 "Load Var2", 265 "Store Var1", 266 "Add", 267 "Subtract", 268 "Add Value", 269 "Subtract Value", 270 "Stall", 271 "Stall While True", 272 "Skip Next If True", 273 "GoTo", 274 "Set Source Address", 275 "Set Destination Address", 276 "Move Data", 277 "Unknown Instruction" 278 }; 279 280 static const char *AcpiDmGtdtSubnames[] = 281 { 282 "Generic Timer Block", 283 "Generic Watchdog Timer", 284 "Unknown Subtable Type" /* Reserved */ 285 }; 286 287 static const char *AcpiDmHestSubnames[] = 288 { 289 "IA-32 Machine Check Exception", 290 "IA-32 Corrected Machine Check", 291 "IA-32 Non-Maskable Interrupt", 292 "Unknown Subtable Type", /* 3 - Reserved */ 293 "Unknown Subtable Type", /* 4 - Reserved */ 294 "Unknown Subtable Type", /* 5 - Reserved */ 295 "PCI Express Root Port AER", 296 "PCI Express AER (AER Endpoint)", 297 "PCI Express/PCI-X Bridge AER", 298 "Generic Hardware Error Source", 299 "Generic Hardware Error Source V2", 300 "IA-32 Deferred Machine Check", 301 "Unknown Subtable Type" /* Reserved */ 302 }; 303 304 static const char *AcpiDmHestNotifySubnames[] = 305 { 306 "Polled", 307 "External Interrupt", 308 "Local Interrupt", 309 "SCI", 310 "NMI", 311 "CMCI", /* ACPI 5.0 */ 312 "MCE", /* ACPI 5.0 */ 313 "GPIO", /* ACPI 6.0 */ 314 "SEA", /* ACPI 6.1 */ 315 "SEI", /* ACPI 6.1 */ 316 "GSIV", /* ACPI 6.1 */ 317 "Software Delegated Exception", /* ACPI 6.2 */ 318 "Unknown Notify Type" /* Reserved */ 319 }; 320 321 static const char *AcpiDmHmatSubnames[] = 322 { 323 "Memory Proximity Domain Attributes", 324 "System Locality Latency and Bandwidth Information", 325 "Memory Side Cache Information", 326 "Unknown Structure Type" /* Reserved */ 327 }; 328 329 static const char *AcpiDmMadtSubnames[] = 330 { 331 "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ 332 "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */ 333 "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */ 334 "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */ 335 "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */ 336 "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */ 337 "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */ 338 "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */ 339 "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ 340 "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ 341 "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ 342 "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */ 343 "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */ 344 "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */ 345 "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */ 346 "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */ 347 "Unknown Subtable Type" /* Reserved */ 348 }; 349 350 static const char *AcpiDmNfitSubnames[] = 351 { 352 "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */ 353 "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */ 354 "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */ 355 "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */ 356 "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */ 357 "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */ 358 "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */ 359 "Platform Capabilities", /* ACPI_NFIT_TYPE_CAPABILITIES */ 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_PPTT_TYPE_ID */ 386 "Unknown Subtable Type" /* Reserved */ 387 }; 388 389 static const char *AcpiDmSdevSubnames[] = 390 { 391 "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */ 392 "PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */ 393 "Unknown Subtable Type" /* Reserved */ 394 }; 395 396 static const char *AcpiDmSratSubnames[] = 397 { 398 "Processor Local APIC/SAPIC Affinity", 399 "Memory Affinity", 400 "Processor Local x2APIC Affinity", 401 "GICC Affinity", 402 "GIC ITS Affinity", /* Acpi 6.2 */ 403 "Generic Initiator Affinity", /* Acpi 6.3 */ 404 "Unknown Subtable Type" /* Reserved */ 405 }; 406 407 static const char *AcpiDmTpm2Subnames[] = 408 { 409 "Illegal Start Method value", 410 "Reserved", 411 "ACPI Start Method", 412 "Reserved", 413 "Reserved", 414 "Reserved", 415 "Memory Mapped I/O", 416 "Command Response Buffer", 417 "Command Response Buffer with ACPI Start Method", 418 "Reserved", 419 "Reserved", 420 "Command Response Buffer with ARM SMC", 421 "Unknown Subtable Type" /* Reserved */ 422 }; 423 424 static const char *AcpiDmIvrsSubnames[] = 425 { 426 "Hardware Definition Block", 427 "Memory Definition Block", 428 "Unknown Subtable Type" /* Reserved */ 429 }; 430 431 static const char *AcpiDmLpitSubnames[] = 432 { 433 "Native C-state Idle Structure", 434 "Unknown Subtable Type" /* Reserved */ 435 }; 436 437 #define ACPI_FADT_PM_RESERVED 9 438 439 static const char *AcpiDmFadtProfiles[] = 440 { 441 "Unspecified", 442 "Desktop", 443 "Mobile", 444 "Workstation", 445 "Enterprise Server", 446 "SOHO Server", 447 "Appliance PC", 448 "Performance Server", 449 "Tablet", 450 "Unknown Profile Type" 451 }; 452 453 #define ACPI_GAS_WIDTH_RESERVED 5 454 455 static const char *AcpiDmGasAccessWidth[] = 456 { 457 "Undefined/Legacy", 458 "Byte Access:8", 459 "Word Access:16", 460 "DWord Access:32", 461 "QWord Access:64", 462 "Unknown Width Encoding" 463 }; 464 465 466 /******************************************************************************* 467 * 468 * ACPI Table Data, indexed by signature. 469 * 470 * Each entry contains: Signature, Table Info, Handler, DtHandler, 471 * Template, Description 472 * 473 * Simple tables have only a TableInfo structure, complex tables have a 474 * handler. This table must be NULL terminated. RSDP and FACS are 475 * special-cased elsewhere. 476 * 477 * Note: Any tables added here should be duplicated within AcpiSupportedTables 478 * in the file common/ahtable.c 479 * 480 ******************************************************************************/ 481 482 const ACPI_DMTABLE_DATA AcpiDmTableData[] = 483 { 484 {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf}, 485 {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, 486 {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, 487 {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, 488 {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep}, 489 {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt}, 490 {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2}, 491 {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp}, 492 {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar}, 493 {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm}, 494 {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt}, 495 {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj}, 496 {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst}, 497 {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt}, 498 {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt}, 499 {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt}, 500 {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest}, 501 {ACPI_SIG_HMAT, NULL, AcpiDmDumpHmat, DtCompileHmat, TemplateHmat}, 502 {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet}, 503 {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort}, 504 {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs}, 505 {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit}, 506 {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt}, 507 {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg}, 508 {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi}, 509 {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst}, 510 {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct}, 511 {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm}, 512 {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, 513 {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, 514 {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, 515 {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, 516 {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, 517 {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, 518 {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, 519 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, 520 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, 521 {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei}, 522 {ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev}, 523 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, 524 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, 525 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, 526 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, 527 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, 528 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, 529 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, 530 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, 531 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, 532 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, 533 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, 534 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, 535 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt}, 536 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt}, 537 {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt, NULL, NULL, TemplateWsmt}, 538 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv}, 539 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt}, 540 {NULL, NULL, NULL, NULL, NULL} 541 }; 542 543 544 /******************************************************************************* 545 * 546 * FUNCTION: AcpiDmGenerateChecksum 547 * 548 * PARAMETERS: Table - Pointer to table to be checksummed 549 * Length - Length of the table 550 * OriginalChecksum - Value of the checksum field 551 * 552 * RETURN: 8 bit checksum of buffer 553 * 554 * DESCRIPTION: Computes an 8 bit checksum of the table. 555 * 556 ******************************************************************************/ 557 558 UINT8 559 AcpiDmGenerateChecksum ( 560 void *Table, 561 UINT32 Length, 562 UINT8 OriginalChecksum) 563 { 564 UINT8 Checksum; 565 566 567 /* Sum the entire table as-is */ 568 569 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length); 570 571 /* Subtract off the existing checksum value in the table */ 572 573 Checksum = (UINT8) (Checksum - OriginalChecksum); 574 575 /* Compute the final checksum */ 576 577 Checksum = (UINT8) (0 - Checksum); 578 return (Checksum); 579 } 580 581 582 /******************************************************************************* 583 * 584 * FUNCTION: AcpiDmGetTableData 585 * 586 * PARAMETERS: Signature - ACPI signature (4 chars) to match 587 * 588 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found. 589 * 590 * DESCRIPTION: Find a match in the global table of supported ACPI tables 591 * 592 ******************************************************************************/ 593 594 const ACPI_DMTABLE_DATA * 595 AcpiDmGetTableData ( 596 char *Signature) 597 { 598 const ACPI_DMTABLE_DATA *Info; 599 600 601 for (Info = AcpiDmTableData; Info->Signature; Info++) 602 { 603 if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature)) 604 { 605 return (Info); 606 } 607 } 608 609 return (NULL); 610 } 611 612 613 /******************************************************************************* 614 * 615 * FUNCTION: AcpiDmDumpDataTable 616 * 617 * PARAMETERS: Table - An ACPI table 618 * 619 * RETURN: None. 620 * 621 * DESCRIPTION: Format the contents of an ACPI data table (any table other 622 * than an SSDT or DSDT that does not contain executable AML code) 623 * 624 ******************************************************************************/ 625 626 void 627 AcpiDmDumpDataTable ( 628 ACPI_TABLE_HEADER *Table) 629 { 630 ACPI_STATUS Status; 631 const ACPI_DMTABLE_DATA *TableData; 632 UINT32 Length; 633 634 635 /* Ignore tables that contain AML */ 636 637 if (AcpiUtIsAmlTable (Table)) 638 { 639 if (AslGbl_VerboseTemplates) 640 { 641 /* Dump the raw table data */ 642 643 Length = Table->Length; 644 645 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n", 646 ACPI_RAW_TABLE_DATA_HEADER, Length, Length); 647 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), 648 Length, DB_BYTE_DISPLAY, 0); 649 AcpiOsPrintf (" */\n"); 650 } 651 return; 652 } 653 654 /* 655 * Handle tables that don't use the common ACPI table header structure. 656 * Currently, these are the FACS, RSDP, and S3PT. 657 */ 658 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS)) 659 { 660 Length = Table->Length; 661 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); 662 if (ACPI_FAILURE (Status)) 663 { 664 return; 665 } 666 } 667 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) 668 { 669 Length = AcpiDmDumpRsdp (Table); 670 } 671 else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT)) 672 { 673 Length = AcpiDmDumpS3pt (Table); 674 } 675 else 676 { 677 /* 678 * All other tables must use the common ACPI table header, dump it now 679 */ 680 Length = Table->Length; 681 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); 682 if (ACPI_FAILURE (Status)) 683 { 684 return; 685 } 686 AcpiOsPrintf ("\n"); 687 688 /* Match signature and dispatch appropriately */ 689 690 TableData = AcpiDmGetTableData (Table->Signature); 691 if (!TableData) 692 { 693 if (!strncmp (Table->Signature, "OEM", 3)) 694 { 695 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n", 696 Table->Signature); 697 } 698 else 699 { 700 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n", 701 Table->Signature); 702 703 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ", 704 Table->Signature); 705 706 if (!AcpiGbl_ForceAmlDisassembly) 707 { 708 fprintf (stderr, "decoding ACPI table header only\n"); 709 } 710 else 711 { 712 fprintf (stderr, "assuming table contains valid AML code\n"); 713 } 714 } 715 } 716 else if (TableData->TableHandler) 717 { 718 /* Complex table, has a handler */ 719 720 TableData->TableHandler (Table); 721 } 722 else if (TableData->TableInfo) 723 { 724 /* Simple table, just walk the info table */ 725 726 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); 727 if (ACPI_FAILURE (Status)) 728 { 729 return; 730 } 731 } 732 } 733 734 if (!AslGbl_DoTemplates || AslGbl_VerboseTemplates) 735 { 736 /* Dump the raw table data */ 737 738 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n", 739 ACPI_RAW_TABLE_DATA_HEADER, Length, Length); 740 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), 741 Length, DB_BYTE_DISPLAY, 0); 742 } 743 } 744 745 746 /******************************************************************************* 747 * 748 * FUNCTION: AcpiDmLineHeader 749 * 750 * PARAMETERS: Offset - Current byte offset, from table start 751 * ByteLength - Length of the field in bytes, 0 for flags 752 * Name - Name of this field 753 * 754 * RETURN: None 755 * 756 * DESCRIPTION: Utility routines for formatting output lines. Displays the 757 * current table offset in hex and decimal, the field length, 758 * and the field name. 759 * 760 ******************************************************************************/ 761 762 void 763 AcpiDmLineHeader ( 764 UINT32 Offset, 765 UINT32 ByteLength, 766 char *Name) 767 { 768 769 /* Allow a null name for fields that span multiple lines (large buffers) */ 770 771 if (!Name) 772 { 773 Name = ""; 774 } 775 776 if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */ 777 { 778 if (ByteLength) 779 { 780 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name); 781 } 782 else 783 { 784 if (*Name) 785 { 786 AcpiOsPrintf ("%41s : ", Name); 787 } 788 else 789 { 790 AcpiOsPrintf ("%41s ", Name); 791 } 792 } 793 } 794 else /* Normal disassembler or verbose template */ 795 { 796 if (ByteLength) 797 { 798 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ", 799 Offset, Offset, ByteLength, Name); 800 } 801 else 802 { 803 if (*Name) 804 { 805 AcpiOsPrintf ("%44s : ", Name); 806 } 807 else 808 { 809 AcpiOsPrintf ("%44s ", Name); 810 } 811 } 812 } 813 } 814 815 void 816 AcpiDmLineHeader2 ( 817 UINT32 Offset, 818 UINT32 ByteLength, 819 char *Name, 820 UINT32 Value) 821 { 822 823 if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */ 824 { 825 if (ByteLength) 826 { 827 AcpiOsPrintf ("[%.4d] %30s %3d : ", 828 ByteLength, Name, Value); 829 } 830 else 831 { 832 AcpiOsPrintf ("%36s % 3d : ", 833 Name, Value); 834 } 835 } 836 else /* Normal disassembler or verbose template */ 837 { 838 if (ByteLength) 839 { 840 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ", 841 Offset, Offset, ByteLength, Name, Value); 842 } 843 else 844 { 845 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ", 846 Offset, Offset, Name, Value); 847 } 848 } 849 } 850 851 852 /******************************************************************************* 853 * 854 * FUNCTION: AcpiDmDumpTable 855 * 856 * PARAMETERS: TableLength - Length of the entire ACPI table 857 * TableOffset - Starting offset within the table for this 858 * sub-descriptor (0 if main table) 859 * Table - The ACPI table 860 * SubtableLength - Length of this sub-descriptor 861 * Info - Info table for this ACPI table 862 * 863 * RETURN: Status 864 * 865 * DESCRIPTION: Display ACPI table contents by walking the Info table. 866 * 867 * Note: This function must remain in sync with DtGetFieldLength. 868 * 869 ******************************************************************************/ 870 871 ACPI_STATUS 872 AcpiDmDumpTable ( 873 UINT32 TableLength, 874 UINT32 TableOffset, 875 void *Table, 876 UINT32 SubtableLength, 877 ACPI_DMTABLE_INFO *Info) 878 { 879 UINT8 *Target; 880 UINT32 CurrentOffset; 881 UINT32 ByteLength; 882 UINT8 Temp8; 883 UINT16 Temp16; 884 UINT32 Temp32; 885 UINT64 Value; 886 const AH_TABLE *TableData; 887 const char *Name; 888 BOOLEAN LastOutputBlankLine = FALSE; 889 ACPI_STATUS Status; 890 char RepairedName[8]; 891 892 893 if (!Info) 894 { 895 AcpiOsPrintf ("Display not implemented\n"); 896 return (AE_NOT_IMPLEMENTED); 897 } 898 899 /* Walk entire Info table; Null name terminates */ 900 901 for (; Info->Name; Info++) 902 { 903 /* 904 * Target points to the field within the ACPI Table. CurrentOffset is 905 * the offset of the field from the start of the main table. 906 */ 907 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); 908 CurrentOffset = TableOffset + Info->Offset; 909 910 /* Check for beyond subtable end or (worse) beyond EOT */ 911 912 if (SubtableLength && (Info->Offset >= SubtableLength)) 913 { 914 AcpiOsPrintf ( 915 "/**** ACPI subtable terminates early - " 916 "may be older version (dump table) */\n"); 917 918 /* Move on to next subtable */ 919 920 return (AE_OK); 921 } 922 923 if (CurrentOffset >= TableLength) 924 { 925 AcpiOsPrintf ( 926 "/**** ACPI table terminates " 927 "in the middle of a data structure! (dump table) */\n"); 928 return (AE_BAD_DATA); 929 } 930 931 /* Generate the byte length for this field */ 932 933 switch (Info->Opcode) 934 { 935 case ACPI_DMT_UINT8: 936 case ACPI_DMT_CHKSUM: 937 case ACPI_DMT_SPACEID: 938 case ACPI_DMT_ACCWIDTH: 939 case ACPI_DMT_IVRS: 940 case ACPI_DMT_GTDT: 941 case ACPI_DMT_MADT: 942 case ACPI_DMT_PCCT: 943 case ACPI_DMT_PMTT: 944 case ACPI_DMT_PPTT: 945 case ACPI_DMT_SDEV: 946 case ACPI_DMT_SRAT: 947 case ACPI_DMT_ASF: 948 case ACPI_DMT_HESTNTYP: 949 case ACPI_DMT_FADTPM: 950 case ACPI_DMT_EINJACT: 951 case ACPI_DMT_EINJINST: 952 case ACPI_DMT_ERSTACT: 953 case ACPI_DMT_ERSTINST: 954 case ACPI_DMT_DMAR_SCOPE: 955 956 ByteLength = 1; 957 break; 958 959 case ACPI_DMT_UINT16: 960 case ACPI_DMT_DMAR: 961 case ACPI_DMT_HEST: 962 case ACPI_DMT_HMAT: 963 case ACPI_DMT_NFIT: 964 965 ByteLength = 2; 966 break; 967 968 case ACPI_DMT_UINT24: 969 970 ByteLength = 3; 971 break; 972 973 case ACPI_DMT_UINT32: 974 case ACPI_DMT_NAME4: 975 case ACPI_DMT_SIG: 976 case ACPI_DMT_LPIT: 977 case ACPI_DMT_TPM2: 978 979 ByteLength = 4; 980 break; 981 982 case ACPI_DMT_UINT40: 983 984 ByteLength = 5; 985 break; 986 987 case ACPI_DMT_UINT48: 988 case ACPI_DMT_NAME6: 989 990 ByteLength = 6; 991 break; 992 993 case ACPI_DMT_UINT56: 994 case ACPI_DMT_BUF7: 995 996 ByteLength = 7; 997 break; 998 999 case ACPI_DMT_UINT64: 1000 case ACPI_DMT_NAME8: 1001 1002 ByteLength = 8; 1003 break; 1004 1005 case ACPI_DMT_BUF10: 1006 1007 ByteLength = 10; 1008 break; 1009 1010 case ACPI_DMT_BUF12: 1011 1012 ByteLength = 12; 1013 break; 1014 1015 case ACPI_DMT_BUF16: 1016 case ACPI_DMT_UUID: 1017 1018 ByteLength = 16; 1019 break; 1020 1021 case ACPI_DMT_BUF128: 1022 1023 ByteLength = 128; 1024 break; 1025 1026 case ACPI_DMT_UNICODE: 1027 case ACPI_DMT_BUFFER: 1028 case ACPI_DMT_RAW_BUFFER: 1029 1030 ByteLength = SubtableLength; 1031 break; 1032 1033 case ACPI_DMT_STRING: 1034 1035 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1; 1036 break; 1037 1038 case ACPI_DMT_GAS: 1039 1040 if (!LastOutputBlankLine) 1041 { 1042 AcpiOsPrintf ("\n"); 1043 LastOutputBlankLine = TRUE; 1044 } 1045 1046 ByteLength = sizeof (ACPI_GENERIC_ADDRESS); 1047 break; 1048 1049 case ACPI_DMT_HESTNTFY: 1050 1051 if (!LastOutputBlankLine) 1052 { 1053 AcpiOsPrintf ("\n"); 1054 LastOutputBlankLine = TRUE; 1055 } 1056 1057 ByteLength = sizeof (ACPI_HEST_NOTIFY); 1058 break; 1059 1060 case ACPI_DMT_IORTMEM: 1061 1062 if (!LastOutputBlankLine) 1063 { 1064 LastOutputBlankLine = FALSE; 1065 } 1066 1067 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); 1068 break; 1069 1070 default: 1071 1072 ByteLength = 0; 1073 break; 1074 } 1075 1076 /* Check if we are beyond a subtable, or (worse) beyond EOT */ 1077 1078 if (CurrentOffset + ByteLength > TableLength) 1079 { 1080 if (SubtableLength) 1081 { 1082 AcpiOsPrintf ( 1083 "/**** ACPI subtable terminates early - " 1084 "may be older version (dump table) */\n"); 1085 1086 /* Move on to next subtable */ 1087 1088 return (AE_OK); 1089 } 1090 1091 AcpiOsPrintf ( 1092 "/**** ACPI table terminates " 1093 "in the middle of a data structure! */\n"); 1094 return (AE_BAD_DATA); 1095 } 1096 1097 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT) 1098 { 1099 AcpiOsPrintf ("%s", Info->Name); 1100 continue; 1101 } 1102 1103 /* Start a new line and decode the opcode */ 1104 1105 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); 1106 1107 switch (Info->Opcode) 1108 { 1109 /* Single-bit Flag fields. Note: Opcode is the bit position */ 1110 1111 case ACPI_DMT_FLAG0: 1112 case ACPI_DMT_FLAG1: 1113 case ACPI_DMT_FLAG2: 1114 case ACPI_DMT_FLAG3: 1115 case ACPI_DMT_FLAG4: 1116 case ACPI_DMT_FLAG5: 1117 case ACPI_DMT_FLAG6: 1118 case ACPI_DMT_FLAG7: 1119 1120 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01); 1121 break; 1122 1123 /* 2-bit Flag fields */ 1124 1125 case ACPI_DMT_FLAGS0: 1126 1127 AcpiOsPrintf ("%1.1X\n", *Target & 0x03); 1128 break; 1129 1130 case ACPI_DMT_FLAGS1: 1131 1132 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03); 1133 break; 1134 1135 case ACPI_DMT_FLAGS2: 1136 1137 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03); 1138 break; 1139 1140 case ACPI_DMT_FLAGS4: 1141 1142 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03); 1143 break; 1144 1145 case ACPI_DMT_FLAGS4_0: 1146 1147 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target) & 0x0F); 1148 break; 1149 1150 case ACPI_DMT_FLAGS4_4: 1151 1152 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 4) & 0x0F); 1153 break; 1154 1155 case ACPI_DMT_FLAGS4_8: 1156 1157 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 8) & 0x0F); 1158 break; 1159 1160 case ACPI_DMT_FLAGS4_12: 1161 1162 AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 12) & 0x0F); 1163 break; 1164 1165 case ACPI_DMT_FLAGS16_16: 1166 1167 AcpiOsPrintf ("%4.4X\n", (*(UINT32 *)Target >> 16) & 0xFFFF); 1168 break; 1169 1170 /* Integer Data Types */ 1171 1172 case ACPI_DMT_UINT8: 1173 case ACPI_DMT_UINT16: 1174 case ACPI_DMT_UINT24: 1175 case ACPI_DMT_UINT32: 1176 case ACPI_DMT_UINT40: 1177 case ACPI_DMT_UINT48: 1178 case ACPI_DMT_UINT56: 1179 case ACPI_DMT_UINT64: 1180 /* 1181 * Dump bytes - high byte first, low byte last. 1182 * Note: All ACPI tables are little-endian. 1183 */ 1184 Value = 0; 1185 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--) 1186 { 1187 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]); 1188 Value |= Target[Temp8 - 1]; 1189 Value <<= 8; 1190 } 1191 1192 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL)) 1193 { 1194 AcpiOsPrintf (" [Optional field not present]"); 1195 } 1196 1197 AcpiOsPrintf ("\n"); 1198 break; 1199 1200 case ACPI_DMT_BUF7: 1201 case ACPI_DMT_BUF10: 1202 case ACPI_DMT_BUF12: 1203 case ACPI_DMT_BUF16: 1204 case ACPI_DMT_BUF128: 1205 /* 1206 * Buffer: Size depends on the opcode and was set above. 1207 * Each hex byte is separated with a space. 1208 * Multiple lines are separated by line continuation char. 1209 */ 1210 for (Temp16 = 0; Temp16 < ByteLength; Temp16++) 1211 { 1212 AcpiOsPrintf ("%2.2X", Target[Temp16]); 1213 if ((UINT32) (Temp16 + 1) < ByteLength) 1214 { 1215 if ((Temp16 > 0) && (!((Temp16+1) % 16))) 1216 { 1217 AcpiOsPrintf (" \\\n"); /* Line continuation */ 1218 AcpiDmLineHeader (0, 0, NULL); 1219 } 1220 else 1221 { 1222 AcpiOsPrintf (" "); 1223 } 1224 } 1225 } 1226 1227 AcpiOsPrintf ("\n"); 1228 break; 1229 1230 case ACPI_DMT_UUID: 1231 1232 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */ 1233 1234 (void) AuConvertUuidToString ((char *) Target, AslGbl_MsgBuffer); 1235 1236 AcpiOsPrintf ("%s\n", AslGbl_MsgBuffer); 1237 break; 1238 1239 case ACPI_DMT_STRING: 1240 1241 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); 1242 break; 1243 1244 /* Fixed length ASCII name fields */ 1245 1246 case ACPI_DMT_SIG: 1247 1248 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4); 1249 AcpiOsPrintf ("\"%.4s\" ", RepairedName); 1250 1251 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target)); 1252 if (TableData) 1253 { 1254 AcpiOsPrintf (STRING_FORMAT, TableData->Description); 1255 } 1256 else 1257 { 1258 AcpiOsPrintf ("\n"); 1259 } 1260 break; 1261 1262 case ACPI_DMT_NAME4: 1263 1264 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4); 1265 AcpiOsPrintf ("\"%.4s\"\n", RepairedName); 1266 break; 1267 1268 case ACPI_DMT_NAME6: 1269 1270 AcpiUtCheckAndRepairAscii (Target, RepairedName, 6); 1271 AcpiOsPrintf ("\"%.6s\"\n", RepairedName); 1272 break; 1273 1274 case ACPI_DMT_NAME8: 1275 1276 AcpiUtCheckAndRepairAscii (Target, RepairedName, 8); 1277 AcpiOsPrintf ("\"%.8s\"\n", RepairedName); 1278 break; 1279 1280 /* Special Data Types */ 1281 1282 case ACPI_DMT_CHKSUM: 1283 1284 /* Checksum, display and validate */ 1285 1286 AcpiOsPrintf ("%2.2X", *Target); 1287 Temp8 = AcpiDmGenerateChecksum (Table, 1288 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, 1289 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum); 1290 1291 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum) 1292 { 1293 AcpiOsPrintf ( 1294 " /* Incorrect checksum, should be %2.2X */", Temp8); 1295 } 1296 1297 AcpiOsPrintf ("\n"); 1298 break; 1299 1300 case ACPI_DMT_SPACEID: 1301 1302 /* Address Space ID */ 1303 1304 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target)); 1305 break; 1306 1307 case ACPI_DMT_ACCWIDTH: 1308 1309 /* Encoded Access Width */ 1310 1311 Temp8 = *Target; 1312 if (Temp8 > ACPI_GAS_WIDTH_RESERVED) 1313 { 1314 Temp8 = ACPI_GAS_WIDTH_RESERVED; 1315 } 1316 1317 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]); 1318 break; 1319 1320 case ACPI_DMT_GAS: 1321 1322 /* Generic Address Structure */ 1323 1324 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); 1325 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, 1326 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); 1327 if (ACPI_FAILURE (Status)) 1328 { 1329 return (Status); 1330 } 1331 1332 AcpiOsPrintf ("\n"); 1333 LastOutputBlankLine = TRUE; 1334 break; 1335 1336 case ACPI_DMT_ASF: 1337 1338 /* ASF subtable types */ 1339 1340 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ 1341 if (Temp16 > ACPI_ASF_TYPE_RESERVED) 1342 { 1343 Temp16 = ACPI_ASF_TYPE_RESERVED; 1344 } 1345 1346 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); 1347 break; 1348 1349 case ACPI_DMT_DMAR: 1350 1351 /* DMAR subtable types */ 1352 1353 Temp16 = ACPI_GET16 (Target); 1354 if (Temp16 > ACPI_DMAR_TYPE_RESERVED) 1355 { 1356 Temp16 = ACPI_DMAR_TYPE_RESERVED; 1357 } 1358 1359 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), 1360 AcpiDmDmarSubnames[Temp16]); 1361 break; 1362 1363 case ACPI_DMT_DMAR_SCOPE: 1364 1365 /* DMAR device scope types */ 1366 1367 Temp8 = *Target; 1368 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED) 1369 { 1370 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED; 1371 } 1372 1373 AcpiOsPrintf (UINT8_FORMAT, *Target, 1374 AcpiDmDmarScope[Temp8]); 1375 break; 1376 1377 case ACPI_DMT_EINJACT: 1378 1379 /* EINJ Action types */ 1380 1381 Temp8 = *Target; 1382 if (Temp8 > ACPI_EINJ_ACTION_RESERVED) 1383 { 1384 Temp8 = ACPI_EINJ_ACTION_RESERVED; 1385 } 1386 1387 AcpiOsPrintf (UINT8_FORMAT, *Target, 1388 AcpiDmEinjActions[Temp8]); 1389 break; 1390 1391 case ACPI_DMT_EINJINST: 1392 1393 /* EINJ Instruction types */ 1394 1395 Temp8 = *Target; 1396 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED) 1397 { 1398 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; 1399 } 1400 1401 AcpiOsPrintf (UINT8_FORMAT, *Target, 1402 AcpiDmEinjInstructions[Temp8]); 1403 break; 1404 1405 case ACPI_DMT_ERSTACT: 1406 1407 /* ERST Action types */ 1408 1409 Temp8 = *Target; 1410 if (Temp8 > ACPI_ERST_ACTION_RESERVED) 1411 { 1412 Temp8 = ACPI_ERST_ACTION_RESERVED; 1413 } 1414 1415 AcpiOsPrintf (UINT8_FORMAT, *Target, 1416 AcpiDmErstActions[Temp8]); 1417 break; 1418 1419 case ACPI_DMT_ERSTINST: 1420 1421 /* ERST Instruction types */ 1422 1423 Temp8 = *Target; 1424 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED) 1425 { 1426 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; 1427 } 1428 1429 AcpiOsPrintf (UINT8_FORMAT, *Target, 1430 AcpiDmErstInstructions[Temp8]); 1431 break; 1432 1433 case ACPI_DMT_GTDT: 1434 1435 /* GTDT subtable types */ 1436 1437 Temp8 = *Target; 1438 if (Temp8 > ACPI_GTDT_TYPE_RESERVED) 1439 { 1440 Temp8 = ACPI_GTDT_TYPE_RESERVED; 1441 } 1442 1443 AcpiOsPrintf (UINT8_FORMAT, *Target, 1444 AcpiDmGtdtSubnames[Temp8]); 1445 break; 1446 1447 case ACPI_DMT_HEST: 1448 1449 /* HEST subtable types */ 1450 1451 Temp16 = ACPI_GET16 (Target); 1452 if (Temp16 > ACPI_HEST_TYPE_RESERVED) 1453 { 1454 Temp16 = ACPI_HEST_TYPE_RESERVED; 1455 } 1456 1457 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), 1458 AcpiDmHestSubnames[Temp16]); 1459 break; 1460 1461 case ACPI_DMT_HESTNTFY: 1462 1463 AcpiOsPrintf (STRING_FORMAT, 1464 "Hardware Error Notification Structure"); 1465 1466 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, 1467 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); 1468 if (ACPI_FAILURE (Status)) 1469 { 1470 return (Status); 1471 } 1472 1473 AcpiOsPrintf ("\n"); 1474 LastOutputBlankLine = TRUE; 1475 break; 1476 1477 case ACPI_DMT_HESTNTYP: 1478 1479 /* HEST Notify types */ 1480 1481 Temp8 = *Target; 1482 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) 1483 { 1484 Temp8 = ACPI_HEST_NOTIFY_RESERVED; 1485 } 1486 1487 AcpiOsPrintf (UINT8_FORMAT, *Target, 1488 AcpiDmHestNotifySubnames[Temp8]); 1489 break; 1490 1491 case ACPI_DMT_HMAT: 1492 1493 /* HMAT subtable types */ 1494 1495 Temp16 = *Target; 1496 if (Temp16 > ACPI_HMAT_TYPE_RESERVED) 1497 { 1498 Temp16 = ACPI_HMAT_TYPE_RESERVED; 1499 } 1500 1501 AcpiOsPrintf (UINT16_FORMAT, *Target, 1502 AcpiDmHmatSubnames[Temp16]); 1503 break; 1504 1505 case ACPI_DMT_IORTMEM: 1506 1507 AcpiOsPrintf (STRING_FORMAT, 1508 "IORT Memory Access Properties"); 1509 1510 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, 1511 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); 1512 if (ACPI_FAILURE (Status)) 1513 { 1514 return (Status); 1515 } 1516 1517 LastOutputBlankLine = TRUE; 1518 break; 1519 1520 case ACPI_DMT_MADT: 1521 1522 /* MADT subtable types */ 1523 1524 Temp8 = *Target; 1525 if (Temp8 > ACPI_MADT_TYPE_RESERVED) 1526 { 1527 Temp8 = ACPI_MADT_TYPE_RESERVED; 1528 } 1529 1530 AcpiOsPrintf (UINT8_FORMAT, *Target, 1531 AcpiDmMadtSubnames[Temp8]); 1532 break; 1533 1534 case ACPI_DMT_NFIT: 1535 1536 /* NFIT subtable types */ 1537 1538 Temp16 = ACPI_GET16 (Target); 1539 if (Temp16 > ACPI_NFIT_TYPE_RESERVED) 1540 { 1541 Temp16 = ACPI_NFIT_TYPE_RESERVED; 1542 } 1543 1544 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), 1545 AcpiDmNfitSubnames[Temp16]); 1546 break; 1547 1548 case ACPI_DMT_PCCT: 1549 1550 /* PCCT subtable types */ 1551 1552 Temp8 = *Target; 1553 if (Temp8 > ACPI_PCCT_TYPE_RESERVED) 1554 { 1555 Temp8 = ACPI_PCCT_TYPE_RESERVED; 1556 } 1557 1558 AcpiOsPrintf (UINT8_FORMAT, *Target, 1559 AcpiDmPcctSubnames[Temp8]); 1560 break; 1561 1562 case ACPI_DMT_PMTT: 1563 1564 /* PMTT subtable types */ 1565 1566 Temp8 = *Target; 1567 if (Temp8 > ACPI_PMTT_TYPE_RESERVED) 1568 { 1569 Temp8 = ACPI_PMTT_TYPE_RESERVED; 1570 } 1571 1572 AcpiOsPrintf (UINT8_FORMAT, *Target, 1573 AcpiDmPmttSubnames[Temp8]); 1574 break; 1575 1576 case ACPI_DMT_PPTT: 1577 1578 /* PPTT subtable types */ 1579 1580 Temp8 = *Target; 1581 if (Temp8 > ACPI_PPTT_TYPE_RESERVED) 1582 { 1583 Temp8 = ACPI_PPTT_TYPE_RESERVED; 1584 } 1585 1586 AcpiOsPrintf (UINT8_FORMAT, *Target, 1587 AcpiDmPpttSubnames[Temp8]); 1588 break; 1589 1590 case ACPI_DMT_UNICODE: 1591 1592 if (ByteLength == 0) 1593 { 1594 AcpiOsPrintf ("/* Zero-length Data */\n"); 1595 break; 1596 } 1597 1598 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength); 1599 break; 1600 1601 case ACPI_DMT_RAW_BUFFER: 1602 1603 if (ByteLength == 0) 1604 { 1605 AcpiOsPrintf ("/* Zero-length Data */\n"); 1606 break; 1607 } 1608 1609 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, 1610 CurrentOffset, NULL); 1611 break; 1612 1613 case ACPI_DMT_SDEV: 1614 1615 /* SDEV subtable types */ 1616 1617 Temp8 = *Target; 1618 if (Temp8 > ACPI_SDEV_TYPE_RESERVED) 1619 { 1620 Temp8 = ACPI_SDEV_TYPE_RESERVED; 1621 } 1622 1623 AcpiOsPrintf (UINT8_FORMAT, *Target, 1624 AcpiDmSdevSubnames[Temp8]); 1625 break; 1626 1627 case ACPI_DMT_SRAT: 1628 1629 /* SRAT subtable types */ 1630 1631 Temp8 = *Target; 1632 if (Temp8 > ACPI_SRAT_TYPE_RESERVED) 1633 { 1634 Temp8 = ACPI_SRAT_TYPE_RESERVED; 1635 } 1636 1637 AcpiOsPrintf (UINT8_FORMAT, *Target, 1638 AcpiDmSratSubnames[Temp8]); 1639 break; 1640 1641 case ACPI_DMT_TPM2: 1642 1643 /* TPM2 Start Method types */ 1644 1645 Temp8 = *Target; 1646 if (Temp8 > ACPI_TPM2_RESERVED) 1647 { 1648 Temp8 = ACPI_TPM2_RESERVED; 1649 } 1650 1651 AcpiOsPrintf (UINT8_FORMAT, *Target, 1652 AcpiDmTpm2Subnames[Temp8]); 1653 break; 1654 1655 1656 case ACPI_DMT_FADTPM: 1657 1658 /* FADT Preferred PM Profile names */ 1659 1660 Temp8 = *Target; 1661 if (Temp8 > ACPI_FADT_PM_RESERVED) 1662 { 1663 Temp8 = ACPI_FADT_PM_RESERVED; 1664 } 1665 1666 AcpiOsPrintf (UINT8_FORMAT, *Target, 1667 AcpiDmFadtProfiles[Temp8]); 1668 break; 1669 1670 case ACPI_DMT_IVRS: 1671 1672 /* IVRS subtable types */ 1673 1674 Temp8 = *Target; 1675 switch (Temp8) 1676 { 1677 case ACPI_IVRS_TYPE_HARDWARE1: 1678 case ACPI_IVRS_TYPE_HARDWARE2: 1679 1680 Name = AcpiDmIvrsSubnames[0]; 1681 break; 1682 1683 case ACPI_IVRS_TYPE_MEMORY1: 1684 case ACPI_IVRS_TYPE_MEMORY2: 1685 case ACPI_IVRS_TYPE_MEMORY3: 1686 1687 Name = AcpiDmIvrsSubnames[1]; 1688 break; 1689 1690 default: 1691 1692 Name = AcpiDmIvrsSubnames[2]; 1693 break; 1694 } 1695 1696 AcpiOsPrintf (UINT8_FORMAT, *Target, Name); 1697 break; 1698 1699 case ACPI_DMT_LPIT: 1700 1701 /* LPIT subtable types */ 1702 1703 Temp32 = ACPI_GET32 (Target); 1704 if (Temp32 > ACPI_LPIT_TYPE_RESERVED) 1705 { 1706 Temp32 = ACPI_LPIT_TYPE_RESERVED; 1707 } 1708 1709 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target), 1710 AcpiDmLpitSubnames[Temp32]); 1711 break; 1712 1713 case ACPI_DMT_EXIT: 1714 1715 return (AE_OK); 1716 1717 default: 1718 1719 ACPI_ERROR ((AE_INFO, 1720 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode)); 1721 return (AE_SUPPORT); 1722 } 1723 } 1724 1725 if (TableOffset && !SubtableLength) 1726 { 1727 /* 1728 * If this table is not the main table, the subtable must have a 1729 * valid length 1730 */ 1731 AcpiOsPrintf ("Invalid zero length subtable\n"); 1732 return (AE_BAD_DATA); 1733 } 1734 1735 return (AE_OK); 1736 } 1737