1 /****************************************************************************** 2 * 3 * Module Name: dmtbdump2 - Dump ACPI data tables that contain no AML code 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 ***************************************************************************** 115 * 116 * Alternatively, you may choose to be licensed under the terms of the 117 * following license: 118 * 119 * Redistribution and use in source and binary forms, with or without 120 * modification, are permitted provided that the following conditions 121 * are met: 122 * 1. Redistributions of source code must retain the above copyright 123 * notice, this list of conditions, and the following disclaimer, 124 * without modification. 125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 * substantially similar to the "NO WARRANTY" disclaimer below 127 * ("Disclaimer") and any redistribution must be conditioned upon 128 * including a substantially similar Disclaimer requirement for further 129 * binary redistribution. 130 * 3. Neither the names of the above-listed copyright holders nor the names 131 * of any contributors may be used to endorse or promote products derived 132 * from this software without specific prior written permission. 133 * 134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 * 146 * Alternatively, you may choose to be licensed under the terms of the 147 * GNU General Public License ("GPL") version 2 as published by the Free 148 * Software Foundation. 149 * 150 *****************************************************************************/ 151 152 #include <contrib/dev/acpica/include/acpi.h> 153 #include <contrib/dev/acpica/include/accommon.h> 154 #include <contrib/dev/acpica/include/acdisasm.h> 155 #include <contrib/dev/acpica/include/actables.h> 156 157 /* This module used for application-level code only */ 158 159 #define _COMPONENT ACPI_CA_DISASSEMBLER 160 ACPI_MODULE_NAME ("dmtbdump2") 161 162 163 /******************************************************************************* 164 * 165 * FUNCTION: AcpiDmDumpIort 166 * 167 * PARAMETERS: Table - A IORT table 168 * 169 * RETURN: None 170 * 171 * DESCRIPTION: Format the contents of a IORT 172 * 173 ******************************************************************************/ 174 175 void 176 AcpiDmDumpIort ( 177 ACPI_TABLE_HEADER *Table) 178 { 179 ACPI_STATUS Status; 180 ACPI_TABLE_IORT *Iort; 181 ACPI_IORT_NODE *IortNode; 182 ACPI_IORT_ITS_GROUP *IortItsGroup = NULL; 183 ACPI_IORT_SMMU *IortSmmu = NULL; 184 UINT32 Offset; 185 UINT32 NodeOffset; 186 UINT32 Length; 187 ACPI_DMTABLE_INFO *InfoTable; 188 char *String; 189 UINT32 i; 190 UINT32 MappingByteLength; 191 192 193 /* Main table */ 194 195 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort); 196 if (ACPI_FAILURE (Status)) 197 { 198 return; 199 } 200 201 Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table); 202 Offset = sizeof (ACPI_TABLE_IORT); 203 204 /* Dump the OptionalPadding (optional) */ 205 206 if (Iort->NodeOffset > Offset) 207 { 208 Status = AcpiDmDumpTable (Table->Length, Offset, Table, 209 Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad); 210 if (ACPI_FAILURE (Status)) 211 { 212 return; 213 } 214 } 215 216 Offset = Iort->NodeOffset; 217 while (Offset < Table->Length) 218 { 219 /* Common subtable header */ 220 221 IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset); 222 AcpiOsPrintf ("\n"); 223 Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); 224 Status = AcpiDmDumpTable (Table->Length, Offset, 225 IortNode, Length, AcpiDmTableInfoIortHdr); 226 if (ACPI_FAILURE (Status)) 227 { 228 return; 229 } 230 231 NodeOffset = Length; 232 233 switch (IortNode->Type) 234 { 235 case ACPI_IORT_NODE_ITS_GROUP: 236 237 InfoTable = AcpiDmTableInfoIort0; 238 Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers); 239 IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset); 240 break; 241 242 case ACPI_IORT_NODE_NAMED_COMPONENT: 243 244 InfoTable = AcpiDmTableInfoIort1; 245 Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName); 246 String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length); 247 Length += strlen (String) + 1; 248 break; 249 250 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: 251 252 InfoTable = AcpiDmTableInfoIort2; 253 Length = IortNode->Length - NodeOffset; 254 break; 255 256 case ACPI_IORT_NODE_SMMU: 257 258 InfoTable = AcpiDmTableInfoIort3; 259 Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts); 260 IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset); 261 break; 262 263 case ACPI_IORT_NODE_SMMU_V3: 264 265 InfoTable = AcpiDmTableInfoIort4; 266 Length = IortNode->Length - NodeOffset; 267 break; 268 269 case ACPI_IORT_NODE_PMCG: 270 271 InfoTable = AcpiDmTableInfoIort5; 272 Length = IortNode->Length - NodeOffset; 273 break; 274 275 default: 276 277 AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n", 278 IortNode->Type); 279 280 /* Attempt to continue */ 281 282 if (!IortNode->Length) 283 { 284 AcpiOsPrintf ("Invalid zero length IORT node\n"); 285 return; 286 } 287 goto NextSubtable; 288 } 289 290 /* Dump the node subtable header */ 291 292 AcpiOsPrintf ("\n"); 293 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 294 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 295 Length, InfoTable); 296 if (ACPI_FAILURE (Status)) 297 { 298 return; 299 } 300 301 NodeOffset += Length; 302 303 /* Dump the node specific data */ 304 305 switch (IortNode->Type) 306 { 307 case ACPI_IORT_NODE_ITS_GROUP: 308 309 /* Validate IortItsGroup to avoid compiler warnings */ 310 311 if (IortItsGroup) 312 { 313 for (i = 0; i < IortItsGroup->ItsCount; i++) 314 { 315 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 316 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 317 4, AcpiDmTableInfoIort0a); 318 if (ACPI_FAILURE (Status)) 319 { 320 return; 321 } 322 323 NodeOffset += 4; 324 } 325 } 326 break; 327 328 case ACPI_IORT_NODE_NAMED_COMPONENT: 329 330 /* Dump the Padding (optional) */ 331 332 if (IortNode->Length > NodeOffset) 333 { 334 MappingByteLength = 335 IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING); 336 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 337 Table, IortNode->Length - NodeOffset - MappingByteLength, 338 AcpiDmTableInfoIort1a); 339 if (ACPI_FAILURE (Status)) 340 { 341 return; 342 } 343 } 344 break; 345 346 case ACPI_IORT_NODE_SMMU: 347 348 AcpiOsPrintf ("\n"); 349 350 /* Validate IortSmmu to avoid compiler warnings */ 351 352 if (IortSmmu) 353 { 354 Length = 2 * sizeof (UINT64); 355 NodeOffset = IortSmmu->GlobalInterruptOffset; 356 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 357 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 358 Length, AcpiDmTableInfoIort3a); 359 if (ACPI_FAILURE (Status)) 360 { 361 return; 362 } 363 364 NodeOffset = IortSmmu->ContextInterruptOffset; 365 for (i = 0; i < IortSmmu->ContextInterruptCount; i++) 366 { 367 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 368 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 369 8, AcpiDmTableInfoIort3b); 370 if (ACPI_FAILURE (Status)) 371 { 372 return; 373 } 374 375 NodeOffset += 8; 376 } 377 378 NodeOffset = IortSmmu->PmuInterruptOffset; 379 for (i = 0; i < IortSmmu->PmuInterruptCount; i++) 380 { 381 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 382 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 383 8, AcpiDmTableInfoIort3c); 384 if (ACPI_FAILURE (Status)) 385 { 386 return; 387 } 388 389 NodeOffset += 8; 390 } 391 } 392 break; 393 394 default: 395 396 break; 397 } 398 399 /* Dump the ID mappings */ 400 401 NodeOffset = IortNode->MappingOffset; 402 for (i = 0; i < IortNode->MappingCount; i++) 403 { 404 AcpiOsPrintf ("\n"); 405 Length = sizeof (ACPI_IORT_ID_MAPPING); 406 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 407 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 408 Length, AcpiDmTableInfoIortMap); 409 if (ACPI_FAILURE (Status)) 410 { 411 return; 412 } 413 414 NodeOffset += Length; 415 } 416 417 NextSubtable: 418 /* Point to next node subtable */ 419 420 Offset += IortNode->Length; 421 } 422 } 423 424 425 /******************************************************************************* 426 * 427 * FUNCTION: AcpiDmDumpIvrs 428 * 429 * PARAMETERS: Table - A IVRS table 430 * 431 * RETURN: None 432 * 433 * DESCRIPTION: Format the contents of a IVRS 434 * 435 ******************************************************************************/ 436 437 static UINT8 EntrySizes[] = {4,8,16,32}; 438 439 void 440 AcpiDmDumpIvrs ( 441 ACPI_TABLE_HEADER *Table) 442 { 443 ACPI_STATUS Status; 444 UINT32 Offset = sizeof (ACPI_TABLE_IVRS); 445 UINT32 EntryOffset; 446 UINT32 EntryLength; 447 UINT32 EntryType; 448 ACPI_IVRS_DE_HEADER *DeviceEntry; 449 ACPI_IVRS_HEADER *Subtable; 450 ACPI_DMTABLE_INFO *InfoTable; 451 452 453 /* Main table */ 454 455 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs); 456 if (ACPI_FAILURE (Status)) 457 { 458 return; 459 } 460 461 /* Subtables */ 462 463 Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); 464 while (Offset < Table->Length) 465 { 466 /* Common subtable header */ 467 468 AcpiOsPrintf ("\n"); 469 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 470 Subtable->Length, AcpiDmTableInfoIvrsHdr); 471 if (ACPI_FAILURE (Status)) 472 { 473 return; 474 } 475 476 switch (Subtable->Type) 477 { 478 case ACPI_IVRS_TYPE_HARDWARE1: 479 480 InfoTable = AcpiDmTableInfoIvrs0; 481 break; 482 483 case ACPI_IVRS_TYPE_HARDWARE2: 484 485 InfoTable = AcpiDmTableInfoIvrs01; 486 break; 487 488 case ACPI_IVRS_TYPE_MEMORY1: 489 case ACPI_IVRS_TYPE_MEMORY2: 490 case ACPI_IVRS_TYPE_MEMORY3: 491 492 InfoTable = AcpiDmTableInfoIvrs1; 493 break; 494 495 default: 496 497 AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n", 498 Subtable->Type); 499 500 /* Attempt to continue */ 501 502 if (!Subtable->Length) 503 { 504 AcpiOsPrintf ("Invalid zero length subtable\n"); 505 return; 506 } 507 goto NextSubtable; 508 } 509 510 /* Dump the subtable */ 511 512 AcpiOsPrintf ("\n"); 513 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 514 Subtable->Length, InfoTable); 515 if (ACPI_FAILURE (Status)) 516 { 517 return; 518 } 519 520 /* The hardware subtable can contain multiple device entries */ 521 522 if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 || 523 Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) 524 { 525 if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1) 526 { 527 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1); 528 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, 529 sizeof (ACPI_IVRS_HARDWARE1)); 530 } 531 else 532 { 533 /* ACPI_IVRS_TYPE_HARDWARE2 subtable type */ 534 535 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2); 536 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, 537 sizeof (ACPI_IVRS_HARDWARE2)); 538 } 539 540 while (EntryOffset < (Offset + Subtable->Length)) 541 { 542 AcpiOsPrintf ("\n"); 543 /* 544 * Upper 2 bits of Type encode the length of the device entry 545 * 546 * 00 = 4 byte 547 * 01 = 8 byte 548 * 10 = 16 byte - currently no entries defined 549 * 11 = 32 byte - currently no entries defined 550 */ 551 EntryType = DeviceEntry->Type; 552 EntryLength = EntrySizes [EntryType >> 6]; 553 554 switch (EntryType) 555 { 556 /* 4-byte device entries */ 557 558 case ACPI_IVRS_TYPE_PAD4: 559 case ACPI_IVRS_TYPE_ALL: 560 case ACPI_IVRS_TYPE_SELECT: 561 case ACPI_IVRS_TYPE_START: 562 case ACPI_IVRS_TYPE_END: 563 564 InfoTable = AcpiDmTableInfoIvrs4; 565 break; 566 567 /* 8-byte entries, type A */ 568 569 case ACPI_IVRS_TYPE_ALIAS_SELECT: 570 case ACPI_IVRS_TYPE_ALIAS_START: 571 572 InfoTable = AcpiDmTableInfoIvrs8a; 573 break; 574 575 /* 8-byte entries, type B */ 576 577 case ACPI_IVRS_TYPE_PAD8: 578 case ACPI_IVRS_TYPE_EXT_SELECT: 579 case ACPI_IVRS_TYPE_EXT_START: 580 581 InfoTable = AcpiDmTableInfoIvrs8b; 582 break; 583 584 /* 8-byte entries, type C */ 585 586 case ACPI_IVRS_TYPE_SPECIAL: 587 588 InfoTable = AcpiDmTableInfoIvrs8c; 589 break; 590 591 default: 592 InfoTable = AcpiDmTableInfoIvrs4; 593 AcpiOsPrintf ( 594 "\n**** Unknown IVRS device entry type/length: " 595 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n", 596 EntryType, EntryLength, EntryOffset); 597 break; 598 } 599 600 /* Dump the Device Entry */ 601 602 Status = AcpiDmDumpTable (Table->Length, EntryOffset, 603 DeviceEntry, EntryLength, InfoTable); 604 if (ACPI_FAILURE (Status)) 605 { 606 return; 607 } 608 609 EntryOffset += EntryLength; 610 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, 611 EntryLength); 612 } 613 } 614 615 NextSubtable: 616 /* Point to next subtable */ 617 618 Offset += Subtable->Length; 619 Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length); 620 } 621 } 622 623 624 /******************************************************************************* 625 * 626 * FUNCTION: AcpiDmDumpLpit 627 * 628 * PARAMETERS: Table - A LPIT table 629 * 630 * RETURN: None 631 * 632 * DESCRIPTION: Format the contents of a LPIT. This table type consists 633 * of an open-ended number of subtables. Note: There are no 634 * entries in the main table. An LPIT consists of the table 635 * header and then subtables only. 636 * 637 ******************************************************************************/ 638 639 void 640 AcpiDmDumpLpit ( 641 ACPI_TABLE_HEADER *Table) 642 { 643 ACPI_STATUS Status; 644 ACPI_LPIT_HEADER *Subtable; 645 UINT32 Length = Table->Length; 646 UINT32 Offset = sizeof (ACPI_TABLE_LPIT); 647 ACPI_DMTABLE_INFO *InfoTable; 648 UINT32 SubtableLength; 649 650 651 /* Subtables */ 652 653 Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset); 654 while (Offset < Table->Length) 655 { 656 /* Common subtable header */ 657 658 Status = AcpiDmDumpTable (Length, Offset, Subtable, 659 sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); 660 if (ACPI_FAILURE (Status)) 661 { 662 return; 663 } 664 665 switch (Subtable->Type) 666 { 667 case ACPI_LPIT_TYPE_NATIVE_CSTATE: 668 669 InfoTable = AcpiDmTableInfoLpit0; 670 SubtableLength = sizeof (ACPI_LPIT_NATIVE); 671 break; 672 673 default: 674 675 /* Cannot continue on unknown type - no length */ 676 677 AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", 678 Subtable->Type); 679 return; 680 } 681 682 Status = AcpiDmDumpTable (Length, Offset, Subtable, 683 SubtableLength, InfoTable); 684 if (ACPI_FAILURE (Status)) 685 { 686 return; 687 } 688 689 AcpiOsPrintf ("\n"); 690 691 /* Point to next subtable */ 692 693 Offset += SubtableLength; 694 Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength); 695 } 696 } 697 698 699 /******************************************************************************* 700 * 701 * FUNCTION: AcpiDmDumpMadt 702 * 703 * PARAMETERS: Table - A MADT table 704 * 705 * RETURN: None 706 * 707 * DESCRIPTION: Format the contents of a MADT. This table type consists 708 * of an open-ended number of subtables. 709 * 710 ******************************************************************************/ 711 712 void 713 AcpiDmDumpMadt ( 714 ACPI_TABLE_HEADER *Table) 715 { 716 ACPI_STATUS Status; 717 ACPI_SUBTABLE_HEADER *Subtable; 718 UINT32 Length = Table->Length; 719 UINT32 Offset = sizeof (ACPI_TABLE_MADT); 720 ACPI_DMTABLE_INFO *InfoTable; 721 722 723 /* Main table */ 724 725 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); 726 if (ACPI_FAILURE (Status)) 727 { 728 return; 729 } 730 731 /* Subtables */ 732 733 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); 734 while (Offset < Table->Length) 735 { 736 /* Common subtable header */ 737 738 AcpiOsPrintf ("\n"); 739 Status = AcpiDmDumpTable (Length, Offset, Subtable, 740 Subtable->Length, AcpiDmTableInfoMadtHdr); 741 if (ACPI_FAILURE (Status)) 742 { 743 return; 744 } 745 746 switch (Subtable->Type) 747 { 748 case ACPI_MADT_TYPE_LOCAL_APIC: 749 750 InfoTable = AcpiDmTableInfoMadt0; 751 break; 752 753 case ACPI_MADT_TYPE_IO_APIC: 754 755 InfoTable = AcpiDmTableInfoMadt1; 756 break; 757 758 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: 759 760 InfoTable = AcpiDmTableInfoMadt2; 761 break; 762 763 case ACPI_MADT_TYPE_NMI_SOURCE: 764 765 InfoTable = AcpiDmTableInfoMadt3; 766 break; 767 768 case ACPI_MADT_TYPE_LOCAL_APIC_NMI: 769 770 InfoTable = AcpiDmTableInfoMadt4; 771 break; 772 773 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: 774 775 InfoTable = AcpiDmTableInfoMadt5; 776 break; 777 778 case ACPI_MADT_TYPE_IO_SAPIC: 779 780 InfoTable = AcpiDmTableInfoMadt6; 781 break; 782 783 case ACPI_MADT_TYPE_LOCAL_SAPIC: 784 785 InfoTable = AcpiDmTableInfoMadt7; 786 break; 787 788 case ACPI_MADT_TYPE_INTERRUPT_SOURCE: 789 790 InfoTable = AcpiDmTableInfoMadt8; 791 break; 792 793 case ACPI_MADT_TYPE_LOCAL_X2APIC: 794 795 InfoTable = AcpiDmTableInfoMadt9; 796 break; 797 798 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: 799 800 InfoTable = AcpiDmTableInfoMadt10; 801 break; 802 803 case ACPI_MADT_TYPE_GENERIC_INTERRUPT: 804 805 InfoTable = AcpiDmTableInfoMadt11; 806 break; 807 808 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: 809 810 InfoTable = AcpiDmTableInfoMadt12; 811 break; 812 813 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME: 814 815 InfoTable = AcpiDmTableInfoMadt13; 816 break; 817 818 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: 819 820 InfoTable = AcpiDmTableInfoMadt14; 821 break; 822 823 case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: 824 825 InfoTable = AcpiDmTableInfoMadt15; 826 break; 827 828 default: 829 830 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", 831 Subtable->Type); 832 833 /* Attempt to continue */ 834 835 if (!Subtable->Length) 836 { 837 AcpiOsPrintf ("Invalid zero length subtable\n"); 838 return; 839 } 840 841 goto NextSubtable; 842 } 843 844 Status = AcpiDmDumpTable (Length, Offset, Subtable, 845 Subtable->Length, InfoTable); 846 if (ACPI_FAILURE (Status)) 847 { 848 return; 849 } 850 851 NextSubtable: 852 /* Point to next subtable */ 853 854 Offset += Subtable->Length; 855 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, 856 Subtable->Length); 857 } 858 } 859 860 861 /******************************************************************************* 862 * 863 * FUNCTION: AcpiDmDumpMcfg 864 * 865 * PARAMETERS: Table - A MCFG Table 866 * 867 * RETURN: None 868 * 869 * DESCRIPTION: Format the contents of a MCFG table 870 * 871 ******************************************************************************/ 872 873 void 874 AcpiDmDumpMcfg ( 875 ACPI_TABLE_HEADER *Table) 876 { 877 ACPI_STATUS Status; 878 UINT32 Offset = sizeof (ACPI_TABLE_MCFG); 879 ACPI_MCFG_ALLOCATION *Subtable; 880 881 882 /* Main table */ 883 884 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); 885 if (ACPI_FAILURE (Status)) 886 { 887 return; 888 } 889 890 /* Subtables */ 891 892 Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); 893 while (Offset < Table->Length) 894 { 895 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) 896 { 897 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", 898 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); 899 return; 900 } 901 902 AcpiOsPrintf ("\n"); 903 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 904 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); 905 if (ACPI_FAILURE (Status)) 906 { 907 return; 908 } 909 910 /* Point to next subtable (each subtable is of fixed length) */ 911 912 Offset += sizeof (ACPI_MCFG_ALLOCATION); 913 Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable, 914 sizeof (ACPI_MCFG_ALLOCATION)); 915 } 916 } 917 918 919 /******************************************************************************* 920 * 921 * FUNCTION: AcpiDmDumpMpst 922 * 923 * PARAMETERS: Table - A MPST Table 924 * 925 * RETURN: None 926 * 927 * DESCRIPTION: Format the contents of a MPST table 928 * 929 ******************************************************************************/ 930 931 void 932 AcpiDmDumpMpst ( 933 ACPI_TABLE_HEADER *Table) 934 { 935 ACPI_STATUS Status; 936 UINT32 Offset = sizeof (ACPI_TABLE_MPST); 937 ACPI_MPST_POWER_NODE *Subtable0; 938 ACPI_MPST_POWER_STATE *Subtable0A; 939 ACPI_MPST_COMPONENT *Subtable0B; 940 ACPI_MPST_DATA_HDR *Subtable1; 941 ACPI_MPST_POWER_DATA *Subtable2; 942 UINT16 SubtableCount; 943 UINT32 PowerStateCount; 944 UINT32 ComponentCount; 945 946 947 /* Main table */ 948 949 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst); 950 if (ACPI_FAILURE (Status)) 951 { 952 return; 953 } 954 955 /* Subtable: Memory Power Node(s) */ 956 957 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount; 958 Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); 959 960 while ((Offset < Table->Length) && SubtableCount) 961 { 962 AcpiOsPrintf ("\n"); 963 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0, 964 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); 965 if (ACPI_FAILURE (Status)) 966 { 967 return; 968 } 969 970 /* Extract the sub-subtable counts */ 971 972 PowerStateCount = Subtable0->NumPowerStates; 973 ComponentCount = Subtable0->NumPhysicalComponents; 974 Offset += sizeof (ACPI_MPST_POWER_NODE); 975 976 /* Sub-subtables - Memory Power State Structure(s) */ 977 978 Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0, 979 sizeof (ACPI_MPST_POWER_NODE)); 980 981 while (PowerStateCount) 982 { 983 AcpiOsPrintf ("\n"); 984 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A, 985 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); 986 if (ACPI_FAILURE (Status)) 987 { 988 return; 989 } 990 991 Subtable0A++; 992 PowerStateCount--; 993 Offset += sizeof (ACPI_MPST_POWER_STATE); 994 } 995 996 /* Sub-subtables - Physical Component ID Structure(s) */ 997 998 Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A); 999 1000 if (ComponentCount) 1001 { 1002 AcpiOsPrintf ("\n"); 1003 } 1004 1005 while (ComponentCount) 1006 { 1007 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B, 1008 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); 1009 if (ACPI_FAILURE (Status)) 1010 { 1011 return; 1012 } 1013 1014 Subtable0B++; 1015 ComponentCount--; 1016 Offset += sizeof (ACPI_MPST_COMPONENT); 1017 } 1018 1019 /* Point to next Memory Power Node subtable */ 1020 1021 SubtableCount--; 1022 Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0, 1023 sizeof (ACPI_MPST_POWER_NODE) + 1024 (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) + 1025 (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents)); 1026 } 1027 1028 /* Subtable: Count of Memory Power State Characteristic structures */ 1029 1030 AcpiOsPrintf ("\n"); 1031 Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0); 1032 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1, 1033 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); 1034 if (ACPI_FAILURE (Status)) 1035 { 1036 return; 1037 } 1038 1039 SubtableCount = Subtable1->CharacteristicsCount; 1040 Offset += sizeof (ACPI_MPST_DATA_HDR); 1041 1042 /* Subtable: Memory Power State Characteristics structure(s) */ 1043 1044 Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1, 1045 sizeof (ACPI_MPST_DATA_HDR)); 1046 1047 while ((Offset < Table->Length) && SubtableCount) 1048 { 1049 AcpiOsPrintf ("\n"); 1050 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2, 1051 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); 1052 if (ACPI_FAILURE (Status)) 1053 { 1054 return; 1055 } 1056 1057 Subtable2++; 1058 SubtableCount--; 1059 Offset += sizeof (ACPI_MPST_POWER_DATA); 1060 } 1061 } 1062 1063 1064 /******************************************************************************* 1065 * 1066 * FUNCTION: AcpiDmDumpMsct 1067 * 1068 * PARAMETERS: Table - A MSCT table 1069 * 1070 * RETURN: None 1071 * 1072 * DESCRIPTION: Format the contents of a MSCT 1073 * 1074 ******************************************************************************/ 1075 1076 void 1077 AcpiDmDumpMsct ( 1078 ACPI_TABLE_HEADER *Table) 1079 { 1080 ACPI_STATUS Status; 1081 UINT32 Offset = sizeof (ACPI_TABLE_MSCT); 1082 ACPI_MSCT_PROXIMITY *Subtable; 1083 1084 1085 /* Main table */ 1086 1087 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct); 1088 if (ACPI_FAILURE (Status)) 1089 { 1090 return; 1091 } 1092 1093 /* Subtables */ 1094 1095 Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); 1096 while (Offset < Table->Length) 1097 { 1098 /* Common subtable header */ 1099 1100 AcpiOsPrintf ("\n"); 1101 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1102 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); 1103 if (ACPI_FAILURE (Status)) 1104 { 1105 return; 1106 } 1107 1108 /* Point to next subtable */ 1109 1110 Offset += sizeof (ACPI_MSCT_PROXIMITY); 1111 Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable, 1112 sizeof (ACPI_MSCT_PROXIMITY)); 1113 } 1114 } 1115 1116 1117 /******************************************************************************* 1118 * 1119 * FUNCTION: AcpiDmDumpNfit 1120 * 1121 * PARAMETERS: Table - A NFIT table 1122 * 1123 * RETURN: None 1124 * 1125 * DESCRIPTION: Format the contents of an NFIT. 1126 * 1127 ******************************************************************************/ 1128 1129 void 1130 AcpiDmDumpNfit ( 1131 ACPI_TABLE_HEADER *Table) 1132 { 1133 ACPI_STATUS Status; 1134 UINT32 Offset = sizeof (ACPI_TABLE_NFIT); 1135 UINT32 FieldOffset = 0; 1136 UINT32 Length; 1137 ACPI_NFIT_HEADER *Subtable; 1138 ACPI_DMTABLE_INFO *InfoTable; 1139 ACPI_NFIT_INTERLEAVE *Interleave = NULL; 1140 ACPI_NFIT_SMBIOS *SmbiosInfo = NULL; 1141 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; 1142 UINT32 i; 1143 1144 1145 /* Main table */ 1146 1147 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit); 1148 if (ACPI_FAILURE (Status)) 1149 { 1150 return; 1151 } 1152 1153 /* Subtables */ 1154 1155 Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); 1156 while (Offset < Table->Length) 1157 { 1158 /* NFIT subtable header */ 1159 1160 AcpiOsPrintf ("\n"); 1161 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1162 Subtable->Length, AcpiDmTableInfoNfitHdr); 1163 if (ACPI_FAILURE (Status)) 1164 { 1165 return; 1166 } 1167 1168 switch (Subtable->Type) 1169 { 1170 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: 1171 1172 InfoTable = AcpiDmTableInfoNfit0; 1173 break; 1174 1175 case ACPI_NFIT_TYPE_MEMORY_MAP: 1176 1177 InfoTable = AcpiDmTableInfoNfit1; 1178 break; 1179 1180 case ACPI_NFIT_TYPE_INTERLEAVE: 1181 1182 /* Has a variable number of 32-bit values at the end */ 1183 1184 InfoTable = AcpiDmTableInfoNfit2; 1185 FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); 1186 break; 1187 1188 case ACPI_NFIT_TYPE_SMBIOS: 1189 1190 SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable); 1191 InfoTable = AcpiDmTableInfoNfit3; 1192 break; 1193 1194 case ACPI_NFIT_TYPE_CONTROL_REGION: 1195 1196 InfoTable = AcpiDmTableInfoNfit4; 1197 break; 1198 1199 case ACPI_NFIT_TYPE_DATA_REGION: 1200 1201 InfoTable = AcpiDmTableInfoNfit5; 1202 break; 1203 1204 case ACPI_NFIT_TYPE_FLUSH_ADDRESS: 1205 1206 /* Has a variable number of 64-bit addresses at the end */ 1207 1208 InfoTable = AcpiDmTableInfoNfit6; 1209 FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); 1210 break; 1211 1212 case ACPI_NFIT_TYPE_CAPABILITIES: /* ACPI 6.0A */ 1213 1214 InfoTable = AcpiDmTableInfoNfit7; 1215 break; 1216 1217 default: 1218 AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", 1219 Subtable->Type); 1220 1221 /* Attempt to continue */ 1222 1223 if (!Subtable->Length) 1224 { 1225 AcpiOsPrintf ("Invalid zero length subtable\n"); 1226 return; 1227 } 1228 goto NextSubtable; 1229 } 1230 1231 AcpiOsPrintf ("\n"); 1232 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1233 Subtable->Length, InfoTable); 1234 if (ACPI_FAILURE (Status)) 1235 { 1236 return; 1237 } 1238 1239 /* Per-subtable variable-length fields */ 1240 1241 switch (Subtable->Type) 1242 { 1243 case ACPI_NFIT_TYPE_INTERLEAVE: 1244 1245 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); 1246 for (i = 0; i < Interleave->LineCount; i++) 1247 { 1248 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, 1249 &Interleave->LineOffset[i], 1250 sizeof (UINT32), AcpiDmTableInfoNfit2a); 1251 if (ACPI_FAILURE (Status)) 1252 { 1253 return; 1254 } 1255 1256 FieldOffset += sizeof (UINT32); 1257 } 1258 break; 1259 1260 case ACPI_NFIT_TYPE_SMBIOS: 1261 1262 Length = Subtable->Length - 1263 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); 1264 1265 if (Length) 1266 { 1267 Status = AcpiDmDumpTable (Table->Length, 1268 sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), 1269 SmbiosInfo, 1270 Length, AcpiDmTableInfoNfit3a); 1271 if (ACPI_FAILURE (Status)) 1272 { 1273 return; 1274 } 1275 } 1276 1277 break; 1278 1279 case ACPI_NFIT_TYPE_FLUSH_ADDRESS: 1280 1281 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); 1282 for (i = 0; i < Hint->HintCount; i++) 1283 { 1284 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, 1285 &Hint->HintAddress[i], 1286 sizeof (UINT64), AcpiDmTableInfoNfit6a); 1287 if (ACPI_FAILURE (Status)) 1288 { 1289 return; 1290 } 1291 1292 FieldOffset += sizeof (UINT64); 1293 } 1294 break; 1295 1296 default: 1297 break; 1298 } 1299 1300 NextSubtable: 1301 /* Point to next subtable */ 1302 1303 Offset += Subtable->Length; 1304 Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length); 1305 } 1306 } 1307 1308 1309 /******************************************************************************* 1310 * 1311 * FUNCTION: AcpiDmDumpPcct 1312 * 1313 * PARAMETERS: Table - A PCCT table 1314 * 1315 * RETURN: None 1316 * 1317 * DESCRIPTION: Format the contents of a PCCT. This table type consists 1318 * of an open-ended number of subtables. 1319 * 1320 ******************************************************************************/ 1321 1322 void 1323 AcpiDmDumpPcct ( 1324 ACPI_TABLE_HEADER *Table) 1325 { 1326 ACPI_STATUS Status; 1327 ACPI_PCCT_SUBSPACE *Subtable; 1328 ACPI_DMTABLE_INFO *InfoTable; 1329 UINT32 Length = Table->Length; 1330 UINT32 Offset = sizeof (ACPI_TABLE_PCCT); 1331 1332 1333 /* Main table */ 1334 1335 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct); 1336 if (ACPI_FAILURE (Status)) 1337 { 1338 return; 1339 } 1340 1341 /* Subtables */ 1342 1343 Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); 1344 while (Offset < Table->Length) 1345 { 1346 /* Common subtable header */ 1347 1348 AcpiOsPrintf ("\n"); 1349 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1350 Subtable->Header.Length, AcpiDmTableInfoPcctHdr); 1351 if (ACPI_FAILURE (Status)) 1352 { 1353 return; 1354 } 1355 1356 switch (Subtable->Header.Type) 1357 { 1358 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE: 1359 1360 InfoTable = AcpiDmTableInfoPcct0; 1361 break; 1362 1363 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE: 1364 1365 InfoTable = AcpiDmTableInfoPcct1; 1366 break; 1367 1368 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2: 1369 1370 InfoTable = AcpiDmTableInfoPcct2; 1371 break; 1372 1373 case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE: 1374 1375 InfoTable = AcpiDmTableInfoPcct3; 1376 break; 1377 1378 case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE: 1379 1380 InfoTable = AcpiDmTableInfoPcct4; 1381 break; 1382 1383 default: 1384 1385 AcpiOsPrintf ( 1386 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n", 1387 Subtable->Header.Type); 1388 return; 1389 } 1390 1391 AcpiOsPrintf ("\n"); 1392 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1393 Subtable->Header.Length, InfoTable); 1394 if (ACPI_FAILURE (Status)) 1395 { 1396 return; 1397 } 1398 1399 /* Point to next subtable */ 1400 1401 Offset += Subtable->Header.Length; 1402 Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable, 1403 Subtable->Header.Length); 1404 } 1405 } 1406 1407 1408 /******************************************************************************* 1409 * 1410 * FUNCTION: AcpiDmDumpPdtt 1411 * 1412 * PARAMETERS: Table - A PDTT table 1413 * 1414 * RETURN: None 1415 * 1416 * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length 1417 * table that contains an open-ended number of IDs 1418 * at the end of the table. 1419 * 1420 ******************************************************************************/ 1421 1422 void 1423 AcpiDmDumpPdtt ( 1424 ACPI_TABLE_HEADER *Table) 1425 { 1426 ACPI_STATUS Status; 1427 ACPI_PDTT_CHANNEL *Subtable; 1428 UINT32 Length = Table->Length; 1429 UINT32 Offset = sizeof (ACPI_TABLE_PDTT); 1430 1431 1432 /* Main table */ 1433 1434 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt); 1435 if (ACPI_FAILURE (Status)) 1436 { 1437 return; 1438 } 1439 1440 /* Subtables. Currently there is only one type, but can be multiples */ 1441 1442 Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset); 1443 while (Offset < Table->Length) 1444 { 1445 AcpiOsPrintf ("\n"); 1446 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1447 sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0); 1448 if (ACPI_FAILURE (Status)) 1449 { 1450 return; 1451 } 1452 1453 /* Point to next subtable */ 1454 1455 Offset += sizeof (ACPI_PDTT_CHANNEL); 1456 Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable, 1457 sizeof (ACPI_PDTT_CHANNEL)); 1458 } 1459 } 1460 1461 1462 /******************************************************************************* 1463 * 1464 * FUNCTION: AcpiDmDumpPmtt 1465 * 1466 * PARAMETERS: Table - A PMTT table 1467 * 1468 * RETURN: None 1469 * 1470 * DESCRIPTION: Format the contents of a PMTT. This table type consists 1471 * of an open-ended number of subtables. 1472 * 1473 ******************************************************************************/ 1474 1475 void 1476 AcpiDmDumpPmtt ( 1477 ACPI_TABLE_HEADER *Table) 1478 { 1479 ACPI_STATUS Status; 1480 ACPI_PMTT_HEADER *Subtable; 1481 ACPI_PMTT_HEADER *MemSubtable; 1482 ACPI_PMTT_HEADER *DimmSubtable; 1483 ACPI_PMTT_DOMAIN *DomainArray; 1484 UINT32 Length = Table->Length; 1485 UINT32 Offset = sizeof (ACPI_TABLE_PMTT); 1486 UINT32 MemOffset; 1487 UINT32 DimmOffset; 1488 UINT32 DomainOffset; 1489 UINT32 DomainCount; 1490 1491 1492 /* Main table */ 1493 1494 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt); 1495 if (ACPI_FAILURE (Status)) 1496 { 1497 return; 1498 } 1499 1500 /* Subtables */ 1501 1502 Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); 1503 while (Offset < Table->Length) 1504 { 1505 /* Common subtable header */ 1506 1507 AcpiOsPrintf ("\n"); 1508 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1509 Subtable->Length, AcpiDmTableInfoPmttHdr); 1510 if (ACPI_FAILURE (Status)) 1511 { 1512 return; 1513 } 1514 1515 /* Only Socket subtables are expected at this level */ 1516 1517 if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET) 1518 { 1519 AcpiOsPrintf ( 1520 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 1521 Subtable->Type); 1522 return; 1523 } 1524 1525 /* Dump the fixed-length portion of the subtable */ 1526 1527 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1528 Subtable->Length, AcpiDmTableInfoPmtt0); 1529 if (ACPI_FAILURE (Status)) 1530 { 1531 return; 1532 } 1533 1534 /* Walk the memory controller subtables */ 1535 1536 MemOffset = sizeof (ACPI_PMTT_SOCKET); 1537 MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, 1538 sizeof (ACPI_PMTT_SOCKET)); 1539 1540 while (((Offset + MemOffset) < Table->Length) && 1541 (MemOffset < Subtable->Length)) 1542 { 1543 /* Common subtable header */ 1544 1545 AcpiOsPrintf ("\n"); 1546 Status = AcpiDmDumpTable (Length, 1547 Offset + MemOffset, MemSubtable, 1548 MemSubtable->Length, AcpiDmTableInfoPmttHdr); 1549 if (ACPI_FAILURE (Status)) 1550 { 1551 return; 1552 } 1553 1554 /* Only memory controller subtables are expected at this level */ 1555 1556 if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER) 1557 { 1558 AcpiOsPrintf ( 1559 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 1560 MemSubtable->Type); 1561 return; 1562 } 1563 1564 /* Dump the fixed-length portion of the controller subtable */ 1565 1566 Status = AcpiDmDumpTable (Length, 1567 Offset + MemOffset, MemSubtable, 1568 MemSubtable->Length, AcpiDmTableInfoPmtt1); 1569 if (ACPI_FAILURE (Status)) 1570 { 1571 return; 1572 } 1573 1574 /* Walk the variable count of proximity domains */ 1575 1576 DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount; 1577 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER); 1578 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable, 1579 sizeof (ACPI_PMTT_CONTROLLER)); 1580 1581 while (((Offset + MemOffset + DomainOffset) < Table->Length) && 1582 ((MemOffset + DomainOffset) < Subtable->Length) && 1583 DomainCount) 1584 { 1585 Status = AcpiDmDumpTable (Length, 1586 Offset + MemOffset + DomainOffset, DomainArray, 1587 sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a); 1588 if (ACPI_FAILURE (Status)) 1589 { 1590 return; 1591 } 1592 1593 DomainOffset += sizeof (ACPI_PMTT_DOMAIN); 1594 DomainArray++; 1595 DomainCount--; 1596 } 1597 1598 if (DomainCount) 1599 { 1600 AcpiOsPrintf ( 1601 "\n**** DomainCount exceeds subtable length\n\n"); 1602 } 1603 1604 /* Walk the physical component (DIMM) subtables */ 1605 1606 DimmOffset = DomainOffset; 1607 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable, 1608 DomainOffset); 1609 1610 while (((Offset + MemOffset + DimmOffset) < Table->Length) && 1611 (DimmOffset < MemSubtable->Length)) 1612 { 1613 /* Common subtable header */ 1614 1615 AcpiOsPrintf ("\n"); 1616 Status = AcpiDmDumpTable (Length, 1617 Offset + MemOffset + DimmOffset, DimmSubtable, 1618 DimmSubtable->Length, AcpiDmTableInfoPmttHdr); 1619 if (ACPI_FAILURE (Status)) 1620 { 1621 return; 1622 } 1623 1624 /* Only DIMM subtables are expected at this level */ 1625 1626 if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM) 1627 { 1628 AcpiOsPrintf ( 1629 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 1630 DimmSubtable->Type); 1631 return; 1632 } 1633 1634 /* Dump the fixed-length DIMM subtable */ 1635 1636 Status = AcpiDmDumpTable (Length, 1637 Offset + MemOffset + DimmOffset, DimmSubtable, 1638 DimmSubtable->Length, AcpiDmTableInfoPmtt2); 1639 if (ACPI_FAILURE (Status)) 1640 { 1641 return; 1642 } 1643 1644 /* Point to next DIMM subtable */ 1645 1646 DimmOffset += DimmSubtable->Length; 1647 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 1648 DimmSubtable, DimmSubtable->Length); 1649 } 1650 1651 /* Point to next Controller subtable */ 1652 1653 MemOffset += MemSubtable->Length; 1654 MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 1655 MemSubtable, MemSubtable->Length); 1656 } 1657 1658 /* Point to next Socket subtable */ 1659 1660 Offset += Subtable->Length; 1661 Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 1662 Subtable, Subtable->Length); 1663 } 1664 } 1665 1666 1667 /******************************************************************************* 1668 * 1669 * FUNCTION: AcpiDmDumpPptt 1670 * 1671 * PARAMETERS: Table - A PMTT table 1672 * 1673 * RETURN: None 1674 * 1675 * DESCRIPTION: Format the contents of a PPTT. This table type consists 1676 * of an open-ended number of subtables. 1677 * 1678 ******************************************************************************/ 1679 1680 void 1681 AcpiDmDumpPptt ( 1682 ACPI_TABLE_HEADER *Table) 1683 { 1684 ACPI_STATUS Status; 1685 ACPI_SUBTABLE_HEADER *Subtable; 1686 ACPI_PPTT_PROCESSOR *PpttProcessor; 1687 UINT8 Length; 1688 UINT8 SubtableOffset; 1689 UINT32 Offset = sizeof (ACPI_TABLE_FPDT); 1690 ACPI_DMTABLE_INFO *InfoTable; 1691 UINT32 i; 1692 1693 1694 /* There is no main table (other than the standard ACPI header) */ 1695 1696 /* Subtables */ 1697 1698 Offset = sizeof (ACPI_TABLE_HEADER); 1699 while (Offset < Table->Length) 1700 { 1701 AcpiOsPrintf ("\n"); 1702 1703 /* Common subtable header */ 1704 1705 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); 1706 if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER)) 1707 { 1708 AcpiOsPrintf ("Invalid subtable length\n"); 1709 return; 1710 } 1711 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1712 Subtable->Length, AcpiDmTableInfoPpttHdr); 1713 if (ACPI_FAILURE (Status)) 1714 { 1715 return; 1716 } 1717 1718 switch (Subtable->Type) 1719 { 1720 case ACPI_PPTT_TYPE_PROCESSOR: 1721 1722 InfoTable = AcpiDmTableInfoPptt0; 1723 Length = sizeof (ACPI_PPTT_PROCESSOR); 1724 break; 1725 1726 case ACPI_PPTT_TYPE_CACHE: 1727 1728 InfoTable = AcpiDmTableInfoPptt1; 1729 Length = sizeof (ACPI_PPTT_CACHE); 1730 break; 1731 1732 case ACPI_PPTT_TYPE_ID: 1733 1734 InfoTable = AcpiDmTableInfoPptt2; 1735 Length = sizeof (ACPI_PPTT_ID); 1736 break; 1737 1738 default: 1739 1740 AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n", 1741 Subtable->Type); 1742 1743 /* Attempt to continue */ 1744 1745 goto NextSubtable; 1746 } 1747 1748 if (Subtable->Length < Length) 1749 { 1750 AcpiOsPrintf ("Invalid subtable length\n"); 1751 return; 1752 } 1753 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1754 Subtable->Length, InfoTable); 1755 if (ACPI_FAILURE (Status)) 1756 { 1757 return; 1758 } 1759 SubtableOffset = Length; 1760 1761 switch (Subtable->Type) 1762 { 1763 case ACPI_PPTT_TYPE_PROCESSOR: 1764 1765 PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable); 1766 1767 /* Dump SMBIOS handles */ 1768 1769 if ((UINT8)(Subtable->Length - SubtableOffset) < 1770 (UINT8)(PpttProcessor->NumberOfPrivResources * 4)) 1771 { 1772 AcpiOsPrintf ("Invalid private resource number\n"); 1773 return; 1774 } 1775 for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++) 1776 { 1777 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, 1778 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 1779 4, AcpiDmTableInfoPptt0a); 1780 if (ACPI_FAILURE (Status)) 1781 { 1782 return; 1783 } 1784 1785 SubtableOffset += 4; 1786 } 1787 break; 1788 1789 default: 1790 1791 break; 1792 } 1793 1794 NextSubtable: 1795 /* Point to next subtable */ 1796 1797 Offset += Subtable->Length; 1798 } 1799 } 1800 1801 1802 /******************************************************************************* 1803 * 1804 * FUNCTION: AcpiDmDumpS3pt 1805 * 1806 * PARAMETERS: Table - A S3PT table 1807 * 1808 * RETURN: Length of the table 1809 * 1810 * DESCRIPTION: Format the contents of a S3PT 1811 * 1812 ******************************************************************************/ 1813 1814 UINT32 1815 AcpiDmDumpS3pt ( 1816 ACPI_TABLE_HEADER *Tables) 1817 { 1818 ACPI_STATUS Status; 1819 UINT32 Offset = sizeof (ACPI_TABLE_S3PT); 1820 ACPI_FPDT_HEADER *Subtable; 1821 ACPI_DMTABLE_INFO *InfoTable; 1822 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); 1823 1824 1825 /* Main table */ 1826 1827 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt); 1828 if (ACPI_FAILURE (Status)) 1829 { 1830 return 0; 1831 } 1832 1833 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset); 1834 while (Offset < S3ptTable->Length) 1835 { 1836 /* Common subtable header */ 1837 1838 AcpiOsPrintf ("\n"); 1839 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, 1840 Subtable->Length, AcpiDmTableInfoS3ptHdr); 1841 if (ACPI_FAILURE (Status)) 1842 { 1843 return 0; 1844 } 1845 1846 switch (Subtable->Type) 1847 { 1848 case ACPI_S3PT_TYPE_RESUME: 1849 1850 InfoTable = AcpiDmTableInfoS3pt0; 1851 break; 1852 1853 case ACPI_S3PT_TYPE_SUSPEND: 1854 1855 InfoTable = AcpiDmTableInfoS3pt1; 1856 break; 1857 1858 default: 1859 1860 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", 1861 Subtable->Type); 1862 1863 /* Attempt to continue */ 1864 1865 if (!Subtable->Length) 1866 { 1867 AcpiOsPrintf ("Invalid zero length subtable\n"); 1868 return 0; 1869 } 1870 goto NextSubtable; 1871 } 1872 1873 AcpiOsPrintf ("\n"); 1874 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, 1875 Subtable->Length, InfoTable); 1876 if (ACPI_FAILURE (Status)) 1877 { 1878 return 0; 1879 } 1880 1881 NextSubtable: 1882 /* Point to next subtable */ 1883 1884 Offset += Subtable->Length; 1885 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length); 1886 } 1887 1888 return (S3ptTable->Length); 1889 } 1890 1891 1892 /******************************************************************************* 1893 * 1894 * FUNCTION: AcpiDmDumpSdev 1895 * 1896 * PARAMETERS: Table - A SDEV table 1897 * 1898 * RETURN: None 1899 * 1900 * DESCRIPTION: Format the contents of a SDEV. This is a variable-length 1901 * table that contains variable strings and vendor data. 1902 * 1903 ******************************************************************************/ 1904 1905 void 1906 AcpiDmDumpSdev ( 1907 ACPI_TABLE_HEADER *Table) 1908 { 1909 ACPI_STATUS Status; 1910 ACPI_SDEV_HEADER *Subtable; 1911 ACPI_SDEV_PCIE *Pcie; 1912 ACPI_SDEV_NAMESPACE *Namesp; 1913 ACPI_DMTABLE_INFO *InfoTable; 1914 UINT32 Length = Table->Length; 1915 UINT32 Offset = sizeof (ACPI_TABLE_SDEV); 1916 UINT16 PathOffset; 1917 UINT16 PathLength; 1918 UINT16 VendorDataOffset; 1919 UINT16 VendorDataLength; 1920 1921 1922 /* Main table */ 1923 1924 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev); 1925 if (ACPI_FAILURE (Status)) 1926 { 1927 return; 1928 } 1929 1930 /* Subtables */ 1931 1932 Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset); 1933 while (Offset < Table->Length) 1934 { 1935 /* Common subtable header */ 1936 1937 AcpiOsPrintf ("\n"); 1938 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1939 Subtable->Length, AcpiDmTableInfoSdevHdr); 1940 if (ACPI_FAILURE (Status)) 1941 { 1942 return; 1943 } 1944 1945 switch (Subtable->Type) 1946 { 1947 case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: 1948 1949 InfoTable = AcpiDmTableInfoSdev0; 1950 break; 1951 1952 case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: 1953 1954 InfoTable = AcpiDmTableInfoSdev1; 1955 break; 1956 1957 default: 1958 goto NextSubtable; 1959 } 1960 1961 AcpiOsPrintf ("\n"); 1962 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1963 Subtable->Length, InfoTable); 1964 if (ACPI_FAILURE (Status)) 1965 { 1966 return; 1967 } 1968 1969 switch (Subtable->Type) 1970 { 1971 case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: 1972 1973 /* Dump the PCIe device ID(s) */ 1974 1975 Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable); 1976 PathOffset = Namesp->DeviceIdOffset; 1977 PathLength = Namesp->DeviceIdLength; 1978 1979 if (PathLength) 1980 { 1981 Status = AcpiDmDumpTable (Table->Length, 0, 1982 ACPI_ADD_PTR (UINT8, Namesp, PathOffset), 1983 PathLength, AcpiDmTableInfoSdev0a); 1984 if (ACPI_FAILURE (Status)) 1985 { 1986 return; 1987 } 1988 } 1989 1990 /* Dump the vendor-specific data */ 1991 1992 VendorDataLength = 1993 Namesp->VendorDataLength; 1994 VendorDataOffset = 1995 Namesp->DeviceIdOffset + Namesp->DeviceIdLength; 1996 1997 if (VendorDataLength) 1998 { 1999 Status = AcpiDmDumpTable (Table->Length, 0, 2000 ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset), 2001 VendorDataLength, AcpiDmTableInfoSdev1b); 2002 if (ACPI_FAILURE (Status)) 2003 { 2004 return; 2005 } 2006 } 2007 break; 2008 2009 case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: 2010 2011 /* PCI path substructures */ 2012 2013 Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable); 2014 PathOffset = Pcie->PathOffset; 2015 PathLength = Pcie->PathLength; 2016 2017 while (PathLength) 2018 { 2019 Status = AcpiDmDumpTable (Table->Length, 2020 PathOffset + Offset, 2021 ACPI_ADD_PTR (UINT8, Pcie, PathOffset), 2022 sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a); 2023 if (ACPI_FAILURE (Status)) 2024 { 2025 return; 2026 } 2027 2028 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH); 2029 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH); 2030 } 2031 2032 /* VendorData */ 2033 2034 VendorDataLength = Pcie->VendorDataLength; 2035 VendorDataOffset = Pcie->PathOffset + Pcie->PathLength; 2036 2037 if (VendorDataLength) 2038 { 2039 Status = AcpiDmDumpTable (Table->Length, 0, 2040 ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), 2041 VendorDataLength, AcpiDmTableInfoSdev1b); 2042 if (ACPI_FAILURE (Status)) 2043 { 2044 return; 2045 } 2046 } 2047 break; 2048 2049 default: 2050 goto NextSubtable; 2051 } 2052 2053 NextSubtable: 2054 /* Point to next subtable */ 2055 2056 Offset += Subtable->Length; 2057 Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable, 2058 Subtable->Length); 2059 } 2060 } 2061