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