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