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