1 /****************************************************************************** 2 * 3 * Module Name: dmtable - Support for ACPI tables that contain no AML code 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2016, 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_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, 362 {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, 363 {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, 364 {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, 365 {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, 366 {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, 367 {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, 368 {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, 369 {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, 370 {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, 371 {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, 372 {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, 373 {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, 374 {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, 375 {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, 376 {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, 377 {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt}, 378 {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt}, 379 {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv}, 380 {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt}, 381 {NULL, NULL, NULL, NULL, NULL} 382 }; 383 384 385 /******************************************************************************* 386 * 387 * FUNCTION: AcpiDmGenerateChecksum 388 * 389 * PARAMETERS: Table - Pointer to table to be checksummed 390 * Length - Length of the table 391 * OriginalChecksum - Value of the checksum field 392 * 393 * RETURN: 8 bit checksum of buffer 394 * 395 * DESCRIPTION: Computes an 8 bit checksum of the table. 396 * 397 ******************************************************************************/ 398 399 UINT8 400 AcpiDmGenerateChecksum ( 401 void *Table, 402 UINT32 Length, 403 UINT8 OriginalChecksum) 404 { 405 UINT8 Checksum; 406 407 408 /* Sum the entire table as-is */ 409 410 Checksum = AcpiTbChecksum ((UINT8 *) Table, Length); 411 412 /* Subtract off the existing checksum value in the table */ 413 414 Checksum = (UINT8) (Checksum - OriginalChecksum); 415 416 /* Compute the final checksum */ 417 418 Checksum = (UINT8) (0 - Checksum); 419 return (Checksum); 420 } 421 422 423 /******************************************************************************* 424 * 425 * FUNCTION: AcpiDmGetTableData 426 * 427 * PARAMETERS: Signature - ACPI signature (4 chars) to match 428 * 429 * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found. 430 * 431 * DESCRIPTION: Find a match in the global table of supported ACPI tables 432 * 433 ******************************************************************************/ 434 435 const ACPI_DMTABLE_DATA * 436 AcpiDmGetTableData ( 437 char *Signature) 438 { 439 const ACPI_DMTABLE_DATA *Info; 440 441 442 for (Info = AcpiDmTableData; Info->Signature; Info++) 443 { 444 if (ACPI_COMPARE_NAME (Signature, Info->Signature)) 445 { 446 return (Info); 447 } 448 } 449 450 return (NULL); 451 } 452 453 454 /******************************************************************************* 455 * 456 * FUNCTION: AcpiDmDumpDataTable 457 * 458 * PARAMETERS: Table - An ACPI table 459 * 460 * RETURN: None. 461 * 462 * DESCRIPTION: Format the contents of an ACPI data table (any table other 463 * than an SSDT or DSDT that does not contain executable AML code) 464 * 465 ******************************************************************************/ 466 467 void 468 AcpiDmDumpDataTable ( 469 ACPI_TABLE_HEADER *Table) 470 { 471 ACPI_STATUS Status; 472 const ACPI_DMTABLE_DATA *TableData; 473 UINT32 Length; 474 475 476 /* Ignore tables that contain AML */ 477 478 if (AcpiUtIsAmlTable (Table)) 479 { 480 if (Gbl_VerboseTemplates) 481 { 482 /* Dump the raw table data */ 483 484 Length = Table->Length; 485 486 AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n", 487 ACPI_RAW_TABLE_DATA_HEADER, Length, Length); 488 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), 489 Length, DB_BYTE_DISPLAY, 0); 490 AcpiOsPrintf (" */\n"); 491 } 492 return; 493 } 494 495 /* 496 * Handle tables that don't use the common ACPI table header structure. 497 * Currently, these are the FACS, RSDP, and S3PT. 498 */ 499 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) 500 { 501 Length = Table->Length; 502 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); 503 if (ACPI_FAILURE (Status)) 504 { 505 return; 506 } 507 } 508 else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) 509 { 510 Length = AcpiDmDumpRsdp (Table); 511 } 512 else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT)) 513 { 514 Length = AcpiDmDumpS3pt (Table); 515 } 516 else 517 { 518 /* 519 * All other tables must use the common ACPI table header, dump it now 520 */ 521 Length = Table->Length; 522 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); 523 if (ACPI_FAILURE (Status)) 524 { 525 return; 526 } 527 AcpiOsPrintf ("\n"); 528 529 /* Match signature and dispatch appropriately */ 530 531 TableData = AcpiDmGetTableData (Table->Signature); 532 if (!TableData) 533 { 534 if (!strncmp (Table->Signature, "OEM", 3)) 535 { 536 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n", 537 Table->Signature); 538 } 539 else 540 { 541 AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n", 542 Table->Signature); 543 544 fprintf (stderr, "Unknown ACPI table signature [%4.4s], ", 545 Table->Signature); 546 547 if (!AcpiGbl_ForceAmlDisassembly) 548 { 549 fprintf (stderr, "decoding ACPI table header only\n"); 550 } 551 else 552 { 553 fprintf (stderr, "assuming table contains valid AML code\n"); 554 } 555 } 556 } 557 else if (TableData->TableHandler) 558 { 559 /* Complex table, has a handler */ 560 561 TableData->TableHandler (Table); 562 } 563 else if (TableData->TableInfo) 564 { 565 /* Simple table, just walk the info table */ 566 567 Status = AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); 568 if (ACPI_FAILURE (Status)) 569 { 570 return; 571 } 572 } 573 } 574 575 if (!Gbl_DoTemplates || Gbl_VerboseTemplates) 576 { 577 /* Dump the raw table data */ 578 579 AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n", 580 ACPI_RAW_TABLE_DATA_HEADER, Length, Length); 581 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), 582 Length, DB_BYTE_DISPLAY, 0); 583 } 584 } 585 586 587 /******************************************************************************* 588 * 589 * FUNCTION: AcpiDmLineHeader 590 * 591 * PARAMETERS: Offset - Current byte offset, from table start 592 * ByteLength - Length of the field in bytes, 0 for flags 593 * Name - Name of this field 594 * 595 * RETURN: None 596 * 597 * DESCRIPTION: Utility routines for formatting output lines. Displays the 598 * current table offset in hex and decimal, the field length, 599 * and the field name. 600 * 601 ******************************************************************************/ 602 603 void 604 AcpiDmLineHeader ( 605 UINT32 Offset, 606 UINT32 ByteLength, 607 char *Name) 608 { 609 610 /* Allow a null name for fields that span multiple lines (large buffers) */ 611 612 if (!Name) 613 { 614 Name = ""; 615 } 616 617 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ 618 { 619 if (ByteLength) 620 { 621 AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name); 622 } 623 else 624 { 625 if (*Name) 626 { 627 AcpiOsPrintf ("%41s : ", Name); 628 } 629 else 630 { 631 AcpiOsPrintf ("%41s ", Name); 632 } 633 } 634 } 635 else /* Normal disassembler or verbose template */ 636 { 637 if (ByteLength) 638 { 639 AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ", 640 Offset, Offset, ByteLength, Name); 641 } 642 else 643 { 644 if (*Name) 645 { 646 AcpiOsPrintf ("%44s : ", Name); 647 } 648 else 649 { 650 AcpiOsPrintf ("%44s ", Name); 651 } 652 } 653 } 654 } 655 656 void 657 AcpiDmLineHeader2 ( 658 UINT32 Offset, 659 UINT32 ByteLength, 660 char *Name, 661 UINT32 Value) 662 { 663 664 if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ 665 { 666 if (ByteLength) 667 { 668 AcpiOsPrintf ("[%.4d] %30s %3d : ", 669 ByteLength, Name, Value); 670 } 671 else 672 { 673 AcpiOsPrintf ("%36s % 3d : ", 674 Name, Value); 675 } 676 } 677 else /* Normal disassembler or verbose template */ 678 { 679 if (ByteLength) 680 { 681 AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ", 682 Offset, Offset, ByteLength, Name, Value); 683 } 684 else 685 { 686 AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ", 687 Offset, Offset, Name, Value); 688 } 689 } 690 } 691 692 693 /******************************************************************************* 694 * 695 * FUNCTION: AcpiDmDumpTable 696 * 697 * PARAMETERS: TableLength - Length of the entire ACPI table 698 * TableOffset - Starting offset within the table for this 699 * sub-descriptor (0 if main table) 700 * Table - The ACPI table 701 * SubtableLength - Length of this sub-descriptor 702 * Info - Info table for this ACPI table 703 * 704 * RETURN: Status 705 * 706 * DESCRIPTION: Display ACPI table contents by walking the Info table. 707 * 708 * Note: This function must remain in sync with DtGetFieldLength. 709 * 710 ******************************************************************************/ 711 712 ACPI_STATUS 713 AcpiDmDumpTable ( 714 UINT32 TableLength, 715 UINT32 TableOffset, 716 void *Table, 717 UINT32 SubtableLength, 718 ACPI_DMTABLE_INFO *Info) 719 { 720 UINT8 *Target; 721 UINT32 CurrentOffset; 722 UINT32 ByteLength; 723 UINT8 Temp8; 724 UINT16 Temp16; 725 UINT32 Temp32; 726 UINT64 Value; 727 const AH_TABLE *TableData; 728 const char *Name; 729 BOOLEAN LastOutputBlankLine = FALSE; 730 ACPI_STATUS Status; 731 char RepairedName[8]; 732 733 734 if (!Info) 735 { 736 AcpiOsPrintf ("Display not implemented\n"); 737 return (AE_NOT_IMPLEMENTED); 738 } 739 740 /* Walk entire Info table; Null name terminates */ 741 742 for (; Info->Name; Info++) 743 { 744 /* 745 * Target points to the field within the ACPI Table. CurrentOffset is 746 * the offset of the field from the start of the main table. 747 */ 748 Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); 749 CurrentOffset = TableOffset + Info->Offset; 750 751 /* Check for beyond subtable end or (worse) beyond EOT */ 752 753 if (SubtableLength && (Info->Offset >= SubtableLength)) 754 { 755 AcpiOsPrintf ( 756 "/**** ACPI subtable terminates early - " 757 "may be older version (dump table) */\n"); 758 759 /* Move on to next subtable */ 760 761 return (AE_OK); 762 } 763 764 if (CurrentOffset >= TableLength) 765 { 766 AcpiOsPrintf ( 767 "/**** ACPI table terminates " 768 "in the middle of a data structure! (dump table) */\n"); 769 return (AE_BAD_DATA); 770 } 771 772 /* Generate the byte length for this field */ 773 774 switch (Info->Opcode) 775 { 776 case ACPI_DMT_UINT8: 777 case ACPI_DMT_CHKSUM: 778 case ACPI_DMT_SPACEID: 779 case ACPI_DMT_ACCWIDTH: 780 case ACPI_DMT_IVRS: 781 case ACPI_DMT_GTDT: 782 case ACPI_DMT_MADT: 783 case ACPI_DMT_PCCT: 784 case ACPI_DMT_PMTT: 785 case ACPI_DMT_SRAT: 786 case ACPI_DMT_ASF: 787 case ACPI_DMT_HESTNTYP: 788 case ACPI_DMT_FADTPM: 789 case ACPI_DMT_EINJACT: 790 case ACPI_DMT_EINJINST: 791 case ACPI_DMT_ERSTACT: 792 case ACPI_DMT_ERSTINST: 793 case ACPI_DMT_DMAR_SCOPE: 794 795 ByteLength = 1; 796 break; 797 798 case ACPI_DMT_UINT16: 799 case ACPI_DMT_DMAR: 800 case ACPI_DMT_HEST: 801 case ACPI_DMT_NFIT: 802 803 ByteLength = 2; 804 break; 805 806 case ACPI_DMT_UINT24: 807 808 ByteLength = 3; 809 break; 810 811 case ACPI_DMT_UINT32: 812 case ACPI_DMT_NAME4: 813 case ACPI_DMT_SIG: 814 case ACPI_DMT_LPIT: 815 816 ByteLength = 4; 817 break; 818 819 case ACPI_DMT_UINT40: 820 821 ByteLength = 5; 822 break; 823 824 case ACPI_DMT_UINT48: 825 case ACPI_DMT_NAME6: 826 827 ByteLength = 6; 828 break; 829 830 case ACPI_DMT_UINT56: 831 case ACPI_DMT_BUF7: 832 833 ByteLength = 7; 834 break; 835 836 case ACPI_DMT_UINT64: 837 case ACPI_DMT_NAME8: 838 839 ByteLength = 8; 840 break; 841 842 case ACPI_DMT_BUF10: 843 844 ByteLength = 10; 845 break; 846 847 case ACPI_DMT_BUF16: 848 case ACPI_DMT_UUID: 849 850 ByteLength = 16; 851 break; 852 853 case ACPI_DMT_BUF128: 854 855 ByteLength = 128; 856 break; 857 858 case ACPI_DMT_UNICODE: 859 case ACPI_DMT_BUFFER: 860 case ACPI_DMT_RAW_BUFFER: 861 862 ByteLength = SubtableLength; 863 break; 864 865 case ACPI_DMT_STRING: 866 867 ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1; 868 break; 869 870 case ACPI_DMT_GAS: 871 872 if (!LastOutputBlankLine) 873 { 874 AcpiOsPrintf ("\n"); 875 LastOutputBlankLine = TRUE; 876 } 877 878 ByteLength = sizeof (ACPI_GENERIC_ADDRESS); 879 break; 880 881 case ACPI_DMT_HESTNTFY: 882 883 if (!LastOutputBlankLine) 884 { 885 AcpiOsPrintf ("\n"); 886 LastOutputBlankLine = TRUE; 887 } 888 889 ByteLength = sizeof (ACPI_HEST_NOTIFY); 890 break; 891 892 case ACPI_DMT_IORTMEM: 893 894 if (!LastOutputBlankLine) 895 { 896 LastOutputBlankLine = FALSE; 897 } 898 899 ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); 900 break; 901 902 default: 903 904 ByteLength = 0; 905 break; 906 } 907 908 /* Check if we are beyond a subtable, or (worse) beyond EOT */ 909 910 if (CurrentOffset + ByteLength > TableLength) 911 { 912 if (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 AcpiOsPrintf ( 924 "/**** ACPI table terminates " 925 "in the middle of a data structure! */\n"); 926 return (AE_BAD_DATA); 927 } 928 929 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT) 930 { 931 AcpiOsPrintf ("%s", Info->Name); 932 continue; 933 } 934 935 /* Start a new line and decode the opcode */ 936 937 AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); 938 939 switch (Info->Opcode) 940 { 941 /* Single-bit Flag fields. Note: Opcode is the bit position */ 942 943 case ACPI_DMT_FLAG0: 944 case ACPI_DMT_FLAG1: 945 case ACPI_DMT_FLAG2: 946 case ACPI_DMT_FLAG3: 947 case ACPI_DMT_FLAG4: 948 case ACPI_DMT_FLAG5: 949 case ACPI_DMT_FLAG6: 950 case ACPI_DMT_FLAG7: 951 952 AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01); 953 break; 954 955 /* 2-bit Flag fields */ 956 957 case ACPI_DMT_FLAGS0: 958 959 AcpiOsPrintf ("%1.1X\n", *Target & 0x03); 960 break; 961 962 case ACPI_DMT_FLAGS1: 963 964 AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03); 965 break; 966 967 case ACPI_DMT_FLAGS2: 968 969 AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03); 970 break; 971 972 case ACPI_DMT_FLAGS4: 973 974 AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03); 975 break; 976 977 /* Integer Data Types */ 978 979 case ACPI_DMT_UINT8: 980 case ACPI_DMT_UINT16: 981 case ACPI_DMT_UINT24: 982 case ACPI_DMT_UINT32: 983 case ACPI_DMT_UINT40: 984 case ACPI_DMT_UINT48: 985 case ACPI_DMT_UINT56: 986 case ACPI_DMT_UINT64: 987 /* 988 * Dump bytes - high byte first, low byte last. 989 * Note: All ACPI tables are little-endian. 990 */ 991 Value = 0; 992 for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--) 993 { 994 AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]); 995 Value |= Target[Temp8 - 1]; 996 Value <<= 8; 997 } 998 999 if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL)) 1000 { 1001 AcpiOsPrintf (" [Optional field not present]"); 1002 } 1003 1004 AcpiOsPrintf ("\n"); 1005 break; 1006 1007 case ACPI_DMT_BUF7: 1008 case ACPI_DMT_BUF10: 1009 case ACPI_DMT_BUF16: 1010 case ACPI_DMT_BUF128: 1011 /* 1012 * Buffer: Size depends on the opcode and was set above. 1013 * Each hex byte is separated with a space. 1014 * Multiple lines are separated by line continuation char. 1015 */ 1016 for (Temp16 = 0; Temp16 < ByteLength; Temp16++) 1017 { 1018 AcpiOsPrintf ("%2.2X", Target[Temp16]); 1019 if ((UINT32) (Temp16 + 1) < ByteLength) 1020 { 1021 if ((Temp16 > 0) && (!((Temp16+1) % 16))) 1022 { 1023 AcpiOsPrintf (" \\\n"); /* Line continuation */ 1024 AcpiDmLineHeader (0, 0, NULL); 1025 } 1026 else 1027 { 1028 AcpiOsPrintf (" "); 1029 } 1030 } 1031 } 1032 1033 AcpiOsPrintf ("\n"); 1034 break; 1035 1036 case ACPI_DMT_UUID: 1037 1038 /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */ 1039 1040 (void) AuConvertUuidToString ((char *) Target, MsgBuffer); 1041 1042 AcpiOsPrintf ("%s\n", MsgBuffer); 1043 break; 1044 1045 case ACPI_DMT_STRING: 1046 1047 AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); 1048 break; 1049 1050 /* Fixed length ASCII name fields */ 1051 1052 case ACPI_DMT_SIG: 1053 1054 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4); 1055 AcpiOsPrintf ("\"%.4s\" ", RepairedName); 1056 1057 TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target)); 1058 if (TableData) 1059 { 1060 AcpiOsPrintf (STRING_FORMAT, TableData->Description); 1061 } 1062 else 1063 { 1064 AcpiOsPrintf ("\n"); 1065 } 1066 break; 1067 1068 case ACPI_DMT_NAME4: 1069 1070 AcpiUtCheckAndRepairAscii (Target, RepairedName, 4); 1071 AcpiOsPrintf ("\"%.4s\"\n", RepairedName); 1072 break; 1073 1074 case ACPI_DMT_NAME6: 1075 1076 AcpiUtCheckAndRepairAscii (Target, RepairedName, 6); 1077 AcpiOsPrintf ("\"%.6s\"\n", RepairedName); 1078 break; 1079 1080 case ACPI_DMT_NAME8: 1081 1082 AcpiUtCheckAndRepairAscii (Target, RepairedName, 8); 1083 AcpiOsPrintf ("\"%.8s\"\n", RepairedName); 1084 break; 1085 1086 /* Special Data Types */ 1087 1088 case ACPI_DMT_CHKSUM: 1089 1090 /* Checksum, display and validate */ 1091 1092 AcpiOsPrintf ("%2.2X", *Target); 1093 Temp8 = AcpiDmGenerateChecksum (Table, 1094 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, 1095 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum); 1096 1097 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum) 1098 { 1099 AcpiOsPrintf ( 1100 " /* Incorrect checksum, should be %2.2X */", Temp8); 1101 } 1102 1103 AcpiOsPrintf ("\n"); 1104 break; 1105 1106 case ACPI_DMT_SPACEID: 1107 1108 /* Address Space ID */ 1109 1110 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target)); 1111 break; 1112 1113 case ACPI_DMT_ACCWIDTH: 1114 1115 /* Encoded Access Width */ 1116 1117 Temp8 = *Target; 1118 if (Temp8 > ACPI_GAS_WIDTH_RESERVED) 1119 { 1120 Temp8 = ACPI_GAS_WIDTH_RESERVED; 1121 } 1122 1123 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]); 1124 break; 1125 1126 case ACPI_DMT_GAS: 1127 1128 /* Generic Address Structure */ 1129 1130 AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); 1131 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, 1132 sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); 1133 if (ACPI_FAILURE (Status)) 1134 { 1135 return (Status); 1136 } 1137 1138 AcpiOsPrintf ("\n"); 1139 LastOutputBlankLine = TRUE; 1140 break; 1141 1142 case ACPI_DMT_ASF: 1143 1144 /* ASF subtable types */ 1145 1146 Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ 1147 if (Temp16 > ACPI_ASF_TYPE_RESERVED) 1148 { 1149 Temp16 = ACPI_ASF_TYPE_RESERVED; 1150 } 1151 1152 AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); 1153 break; 1154 1155 case ACPI_DMT_DMAR: 1156 1157 /* DMAR subtable types */ 1158 1159 Temp16 = ACPI_GET16 (Target); 1160 if (Temp16 > ACPI_DMAR_TYPE_RESERVED) 1161 { 1162 Temp16 = ACPI_DMAR_TYPE_RESERVED; 1163 } 1164 1165 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), 1166 AcpiDmDmarSubnames[Temp16]); 1167 break; 1168 1169 case ACPI_DMT_DMAR_SCOPE: 1170 1171 /* DMAR device scope types */ 1172 1173 Temp8 = *Target; 1174 if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED) 1175 { 1176 Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED; 1177 } 1178 1179 AcpiOsPrintf (UINT8_FORMAT, *Target, 1180 AcpiDmDmarScope[Temp8]); 1181 break; 1182 1183 case ACPI_DMT_EINJACT: 1184 1185 /* EINJ Action types */ 1186 1187 Temp8 = *Target; 1188 if (Temp8 > ACPI_EINJ_ACTION_RESERVED) 1189 { 1190 Temp8 = ACPI_EINJ_ACTION_RESERVED; 1191 } 1192 1193 AcpiOsPrintf (UINT8_FORMAT, *Target, 1194 AcpiDmEinjActions[Temp8]); 1195 break; 1196 1197 case ACPI_DMT_EINJINST: 1198 1199 /* EINJ Instruction types */ 1200 1201 Temp8 = *Target; 1202 if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED) 1203 { 1204 Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; 1205 } 1206 1207 AcpiOsPrintf (UINT8_FORMAT, *Target, 1208 AcpiDmEinjInstructions[Temp8]); 1209 break; 1210 1211 case ACPI_DMT_ERSTACT: 1212 1213 /* ERST Action types */ 1214 1215 Temp8 = *Target; 1216 if (Temp8 > ACPI_ERST_ACTION_RESERVED) 1217 { 1218 Temp8 = ACPI_ERST_ACTION_RESERVED; 1219 } 1220 1221 AcpiOsPrintf (UINT8_FORMAT, *Target, 1222 AcpiDmErstActions[Temp8]); 1223 break; 1224 1225 case ACPI_DMT_ERSTINST: 1226 1227 /* ERST Instruction types */ 1228 1229 Temp8 = *Target; 1230 if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED) 1231 { 1232 Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; 1233 } 1234 1235 AcpiOsPrintf (UINT8_FORMAT, *Target, 1236 AcpiDmErstInstructions[Temp8]); 1237 break; 1238 1239 case ACPI_DMT_GTDT: 1240 1241 /* GTDT subtable types */ 1242 1243 Temp8 = *Target; 1244 if (Temp8 > ACPI_GTDT_TYPE_RESERVED) 1245 { 1246 Temp8 = ACPI_GTDT_TYPE_RESERVED; 1247 } 1248 1249 AcpiOsPrintf (UINT8_FORMAT, *Target, 1250 AcpiDmGtdtSubnames[Temp8]); 1251 break; 1252 1253 case ACPI_DMT_HEST: 1254 1255 /* HEST subtable types */ 1256 1257 Temp16 = ACPI_GET16 (Target); 1258 if (Temp16 > ACPI_HEST_TYPE_RESERVED) 1259 { 1260 Temp16 = ACPI_HEST_TYPE_RESERVED; 1261 } 1262 1263 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), 1264 AcpiDmHestSubnames[Temp16]); 1265 break; 1266 1267 case ACPI_DMT_HESTNTFY: 1268 1269 AcpiOsPrintf (STRING_FORMAT, 1270 "Hardware Error Notification Structure"); 1271 1272 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, 1273 sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); 1274 if (ACPI_FAILURE (Status)) 1275 { 1276 return (Status); 1277 } 1278 1279 AcpiOsPrintf ("\n"); 1280 LastOutputBlankLine = TRUE; 1281 break; 1282 1283 case ACPI_DMT_HESTNTYP: 1284 1285 /* HEST Notify types */ 1286 1287 Temp8 = *Target; 1288 if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) 1289 { 1290 Temp8 = ACPI_HEST_NOTIFY_RESERVED; 1291 } 1292 1293 AcpiOsPrintf (UINT8_FORMAT, *Target, 1294 AcpiDmHestNotifySubnames[Temp8]); 1295 break; 1296 1297 case ACPI_DMT_IORTMEM: 1298 1299 AcpiOsPrintf (STRING_FORMAT, 1300 "IORT Memory Access Properties"); 1301 1302 Status = AcpiDmDumpTable (TableLength, CurrentOffset, Target, 1303 sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); 1304 if (ACPI_FAILURE (Status)) 1305 { 1306 return (Status); 1307 } 1308 1309 LastOutputBlankLine = TRUE; 1310 break; 1311 1312 case ACPI_DMT_MADT: 1313 1314 /* MADT subtable types */ 1315 1316 Temp8 = *Target; 1317 if (Temp8 > ACPI_MADT_TYPE_RESERVED) 1318 { 1319 Temp8 = ACPI_MADT_TYPE_RESERVED; 1320 } 1321 1322 AcpiOsPrintf (UINT8_FORMAT, *Target, 1323 AcpiDmMadtSubnames[Temp8]); 1324 break; 1325 1326 case ACPI_DMT_NFIT: 1327 1328 /* NFIT subtable types */ 1329 1330 Temp16 = ACPI_GET16 (Target); 1331 if (Temp16 > ACPI_NFIT_TYPE_RESERVED) 1332 { 1333 Temp16 = ACPI_NFIT_TYPE_RESERVED; 1334 } 1335 1336 AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), 1337 AcpiDmNfitSubnames[Temp16]); 1338 break; 1339 1340 case ACPI_DMT_PCCT: 1341 1342 /* PCCT subtable types */ 1343 1344 Temp8 = *Target; 1345 if (Temp8 > ACPI_PCCT_TYPE_RESERVED) 1346 { 1347 Temp8 = ACPI_PCCT_TYPE_RESERVED; 1348 } 1349 1350 AcpiOsPrintf (UINT8_FORMAT, *Target, 1351 AcpiDmPcctSubnames[Temp8]); 1352 break; 1353 1354 case ACPI_DMT_PMTT: 1355 1356 /* PMTT subtable types */ 1357 1358 Temp8 = *Target; 1359 if (Temp8 > ACPI_PMTT_TYPE_RESERVED) 1360 { 1361 Temp8 = ACPI_PMTT_TYPE_RESERVED; 1362 } 1363 1364 AcpiOsPrintf (UINT8_FORMAT, *Target, 1365 AcpiDmPmttSubnames[Temp8]); 1366 break; 1367 1368 case ACPI_DMT_UNICODE: 1369 1370 if (ByteLength == 0) 1371 { 1372 AcpiOsPrintf ("/* Zero-length Data */\n"); 1373 break; 1374 } 1375 1376 AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength); 1377 break; 1378 1379 case ACPI_DMT_RAW_BUFFER: 1380 1381 if (ByteLength == 0) 1382 { 1383 AcpiOsPrintf ("/* Zero-length Data */\n"); 1384 break; 1385 } 1386 1387 AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, 1388 CurrentOffset, NULL); 1389 break; 1390 1391 case ACPI_DMT_SRAT: 1392 1393 /* SRAT subtable types */ 1394 1395 Temp8 = *Target; 1396 if (Temp8 > ACPI_SRAT_TYPE_RESERVED) 1397 { 1398 Temp8 = ACPI_SRAT_TYPE_RESERVED; 1399 } 1400 1401 AcpiOsPrintf (UINT8_FORMAT, *Target, 1402 AcpiDmSratSubnames[Temp8]); 1403 break; 1404 1405 case ACPI_DMT_FADTPM: 1406 1407 /* FADT Preferred PM Profile names */ 1408 1409 Temp8 = *Target; 1410 if (Temp8 > ACPI_FADT_PM_RESERVED) 1411 { 1412 Temp8 = ACPI_FADT_PM_RESERVED; 1413 } 1414 1415 AcpiOsPrintf (UINT8_FORMAT, *Target, 1416 AcpiDmFadtProfiles[Temp8]); 1417 break; 1418 1419 case ACPI_DMT_IVRS: 1420 1421 /* IVRS subtable types */ 1422 1423 Temp8 = *Target; 1424 switch (Temp8) 1425 { 1426 case ACPI_IVRS_TYPE_HARDWARE: 1427 1428 Name = AcpiDmIvrsSubnames[0]; 1429 break; 1430 1431 case ACPI_IVRS_TYPE_MEMORY1: 1432 case ACPI_IVRS_TYPE_MEMORY2: 1433 case ACPI_IVRS_TYPE_MEMORY3: 1434 1435 Name = AcpiDmIvrsSubnames[1]; 1436 break; 1437 1438 default: 1439 1440 Name = AcpiDmIvrsSubnames[2]; 1441 break; 1442 } 1443 1444 AcpiOsPrintf (UINT8_FORMAT, *Target, Name); 1445 break; 1446 1447 case ACPI_DMT_LPIT: 1448 1449 /* LPIT subtable types */ 1450 1451 Temp32 = ACPI_GET32 (Target); 1452 if (Temp32 > ACPI_LPIT_TYPE_RESERVED) 1453 { 1454 Temp32 = ACPI_LPIT_TYPE_RESERVED; 1455 } 1456 1457 AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target), 1458 AcpiDmLpitSubnames[Temp32]); 1459 break; 1460 1461 case ACPI_DMT_EXIT: 1462 1463 return (AE_OK); 1464 1465 default: 1466 1467 ACPI_ERROR ((AE_INFO, 1468 "**** Invalid table opcode [0x%X] ****\n", Info->Opcode)); 1469 return (AE_SUPPORT); 1470 } 1471 } 1472 1473 if (TableOffset && !SubtableLength) 1474 { 1475 /* 1476 * If this table is not the main table, the subtable must have a 1477 * valid length 1478 */ 1479 AcpiOsPrintf ("Invalid zero length subtable\n"); 1480 return (AE_BAD_DATA); 1481 } 1482 1483 return (AE_OK); 1484 } 1485