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