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