1 /****************************************************************************** 2 * 3 * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2013, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #include <contrib/dev/acpica/include/acpi.h> 45 #include <contrib/dev/acpica/include/accommon.h> 46 #include <contrib/dev/acpica/include/acdisasm.h> 47 #include <contrib/dev/acpica/include/actables.h> 48 49 /* This module used for application-level code only */ 50 51 #define _COMPONENT ACPI_CA_DISASSEMBLER 52 ACPI_MODULE_NAME ("dmtbdump") 53 54 55 /* Local prototypes */ 56 57 static void 58 AcpiDmValidateFadtLength ( 59 UINT32 Revision, 60 UINT32 Length); 61 62 static void 63 AcpiDmDumpBuffer ( 64 void *Table, 65 UINT32 BufferOffset, 66 UINT32 Length, 67 UINT32 AbsoluteOffset, 68 char *Header); 69 70 71 /******************************************************************************* 72 * 73 * FUNCTION: AcpiDmDumpBuffer 74 * 75 * PARAMETERS: Table - ACPI Table or subtable 76 * BufferOffset - Offset of buffer from Table above 77 * Length - Length of the buffer 78 * AbsoluteOffset - Offset of buffer in the main ACPI table 79 * Header - Name of the buffer field (printed on the 80 * first line only.) 81 * 82 * RETURN: None 83 * 84 * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the 85 * disassembler output format.) 86 * 87 ******************************************************************************/ 88 89 static void 90 AcpiDmDumpBuffer ( 91 void *Table, 92 UINT32 BufferOffset, 93 UINT32 Length, 94 UINT32 AbsoluteOffset, 95 char *Header) 96 { 97 UINT8 *Buffer; 98 UINT32 i; 99 100 101 if (!Length) 102 { 103 return; 104 } 105 106 Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset; 107 i = 0; 108 109 while (i < Length) 110 { 111 if (!(i % 16)) 112 { 113 AcpiOsPrintf ("\n"); 114 AcpiDmLineHeader (AbsoluteOffset, 115 ((Length - i) > 16) ? 16 : (Length - i), Header); 116 Header = NULL; 117 } 118 119 AcpiOsPrintf ("%.02X ", *Buffer); 120 i++; 121 Buffer++; 122 AbsoluteOffset++; 123 } 124 125 AcpiOsPrintf ("\n"); 126 } 127 128 129 /******************************************************************************* 130 * 131 * FUNCTION: AcpiDmDumpRsdp 132 * 133 * PARAMETERS: Table - A RSDP 134 * 135 * RETURN: Length of the table (there is not always a length field, 136 * use revision or length if available (ACPI 2.0+)) 137 * 138 * DESCRIPTION: Format the contents of a RSDP 139 * 140 ******************************************************************************/ 141 142 UINT32 143 AcpiDmDumpRsdp ( 144 ACPI_TABLE_HEADER *Table) 145 { 146 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table); 147 UINT32 Length = sizeof (ACPI_RSDP_COMMON); 148 UINT8 Checksum; 149 150 151 /* Dump the common ACPI 1.0 portion */ 152 153 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); 154 155 /* Validate the first checksum */ 156 157 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON), 158 Rsdp->Checksum); 159 if (Checksum != Rsdp->Checksum) 160 { 161 AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n", 162 Checksum); 163 } 164 165 /* The RSDP for ACPI 2.0+ contains more data and has a Length field */ 166 167 if (Rsdp->Revision > 0) 168 { 169 Length = Rsdp->Length; 170 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); 171 172 /* Validate the extended checksum over entire RSDP */ 173 174 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP), 175 Rsdp->ExtendedChecksum); 176 if (Checksum != Rsdp->ExtendedChecksum) 177 { 178 AcpiOsPrintf ( 179 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n", 180 Checksum); 181 } 182 } 183 184 return (Length); 185 } 186 187 188 /******************************************************************************* 189 * 190 * FUNCTION: AcpiDmDumpRsdt 191 * 192 * PARAMETERS: Table - A RSDT 193 * 194 * RETURN: None 195 * 196 * DESCRIPTION: Format the contents of a RSDT 197 * 198 ******************************************************************************/ 199 200 void 201 AcpiDmDumpRsdt ( 202 ACPI_TABLE_HEADER *Table) 203 { 204 UINT32 *Array; 205 UINT32 Entries; 206 UINT32 Offset; 207 UINT32 i; 208 209 210 /* Point to start of table pointer array */ 211 212 Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry; 213 Offset = sizeof (ACPI_TABLE_HEADER); 214 215 /* RSDT uses 32-bit pointers */ 216 217 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32); 218 219 for (i = 0; i < Entries; i++) 220 { 221 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i); 222 AcpiOsPrintf ("%8.8X\n", Array[i]); 223 Offset += sizeof (UINT32); 224 } 225 } 226 227 228 /******************************************************************************* 229 * 230 * FUNCTION: AcpiDmDumpXsdt 231 * 232 * PARAMETERS: Table - A XSDT 233 * 234 * RETURN: None 235 * 236 * DESCRIPTION: Format the contents of a XSDT 237 * 238 ******************************************************************************/ 239 240 void 241 AcpiDmDumpXsdt ( 242 ACPI_TABLE_HEADER *Table) 243 { 244 UINT64 *Array; 245 UINT32 Entries; 246 UINT32 Offset; 247 UINT32 i; 248 249 250 /* Point to start of table pointer array */ 251 252 Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry; 253 Offset = sizeof (ACPI_TABLE_HEADER); 254 255 /* XSDT uses 64-bit pointers */ 256 257 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64); 258 259 for (i = 0; i < Entries; i++) 260 { 261 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i); 262 AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i])); 263 Offset += sizeof (UINT64); 264 } 265 } 266 267 268 /******************************************************************************* 269 * 270 * FUNCTION: AcpiDmDumpFadt 271 * 272 * PARAMETERS: Table - A FADT 273 * 274 * RETURN: None 275 * 276 * DESCRIPTION: Format the contents of a FADT 277 * 278 * NOTE: We cannot depend on the FADT version to indicate the actual 279 * contents of the FADT because of BIOS bugs. The table length 280 * is the only reliable indicator. 281 * 282 ******************************************************************************/ 283 284 void 285 AcpiDmDumpFadt ( 286 ACPI_TABLE_HEADER *Table) 287 { 288 289 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ 290 291 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); 292 293 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ 294 295 if ((Table->Length > ACPI_FADT_V1_SIZE) && 296 (Table->Length <= ACPI_FADT_V2_SIZE)) 297 { 298 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); 299 } 300 301 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */ 302 303 else if (Table->Length > ACPI_FADT_V2_SIZE) 304 { 305 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); 306 307 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */ 308 309 if (Table->Length > ACPI_FADT_V3_SIZE) 310 { 311 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); 312 } 313 } 314 315 /* Validate various fields in the FADT, including length */ 316 317 AcpiTbCreateLocalFadt (Table, Table->Length); 318 319 /* Validate FADT length against the revision */ 320 321 AcpiDmValidateFadtLength (Table->Revision, Table->Length); 322 } 323 324 325 /******************************************************************************* 326 * 327 * FUNCTION: AcpiDmValidateFadtLength 328 * 329 * PARAMETERS: Revision - FADT revision (Header->Revision) 330 * Length - FADT length (Header->Length 331 * 332 * RETURN: None 333 * 334 * DESCRIPTION: Check the FADT revision against the expected table length for 335 * that revision. Issue a warning if the length is not what was 336 * expected. This seems to be such a common BIOS bug that the 337 * FADT revision has been rendered virtually meaningless. 338 * 339 ******************************************************************************/ 340 341 static void 342 AcpiDmValidateFadtLength ( 343 UINT32 Revision, 344 UINT32 Length) 345 { 346 UINT32 ExpectedLength; 347 348 349 switch (Revision) 350 { 351 case 0: 352 353 AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n"); 354 return; 355 356 case 1: 357 358 ExpectedLength = ACPI_FADT_V1_SIZE; 359 break; 360 361 case 2: 362 363 ExpectedLength = ACPI_FADT_V2_SIZE; 364 break; 365 366 case 3: 367 case 4: 368 369 ExpectedLength = ACPI_FADT_V3_SIZE; 370 break; 371 372 case 5: 373 374 ExpectedLength = ACPI_FADT_V5_SIZE; 375 break; 376 377 default: 378 379 return; 380 } 381 382 if (Length == ExpectedLength) 383 { 384 return; 385 } 386 387 AcpiOsPrintf ( 388 "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n", 389 Revision, Length, ExpectedLength); 390 } 391 392 393 /******************************************************************************* 394 * 395 * FUNCTION: AcpiDmDumpAsf 396 * 397 * PARAMETERS: Table - A ASF table 398 * 399 * RETURN: None 400 * 401 * DESCRIPTION: Format the contents of a ASF table 402 * 403 ******************************************************************************/ 404 405 void 406 AcpiDmDumpAsf ( 407 ACPI_TABLE_HEADER *Table) 408 { 409 ACPI_STATUS Status; 410 UINT32 Offset = sizeof (ACPI_TABLE_HEADER); 411 ACPI_ASF_INFO *SubTable; 412 ACPI_DMTABLE_INFO *InfoTable; 413 ACPI_DMTABLE_INFO *DataInfoTable = NULL; 414 UINT8 *DataTable = NULL; 415 UINT32 DataCount = 0; 416 UINT32 DataLength = 0; 417 UINT32 DataOffset = 0; 418 UINT32 i; 419 UINT8 Type; 420 421 422 /* No main table, only sub-tables */ 423 424 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); 425 while (Offset < Table->Length) 426 { 427 /* Common sub-table header */ 428 429 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 430 SubTable->Header.Length, AcpiDmTableInfoAsfHdr); 431 if (ACPI_FAILURE (Status)) 432 { 433 return; 434 } 435 436 /* The actual type is the lower 7 bits of Type */ 437 438 Type = (UINT8) (SubTable->Header.Type & 0x7F); 439 440 switch (Type) 441 { 442 case ACPI_ASF_TYPE_INFO: 443 444 InfoTable = AcpiDmTableInfoAsf0; 445 break; 446 447 case ACPI_ASF_TYPE_ALERT: 448 449 InfoTable = AcpiDmTableInfoAsf1; 450 DataInfoTable = AcpiDmTableInfoAsf1a; 451 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT)); 452 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts; 453 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength; 454 DataOffset = Offset + sizeof (ACPI_ASF_ALERT); 455 break; 456 457 case ACPI_ASF_TYPE_CONTROL: 458 459 InfoTable = AcpiDmTableInfoAsf2; 460 DataInfoTable = AcpiDmTableInfoAsf2a; 461 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE)); 462 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls; 463 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength; 464 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); 465 break; 466 467 case ACPI_ASF_TYPE_BOOT: 468 469 InfoTable = AcpiDmTableInfoAsf3; 470 break; 471 472 case ACPI_ASF_TYPE_ADDRESS: 473 474 InfoTable = AcpiDmTableInfoAsf4; 475 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS)); 476 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices; 477 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); 478 break; 479 480 default: 481 482 AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type); 483 return; 484 } 485 486 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 487 SubTable->Header.Length, InfoTable); 488 if (ACPI_FAILURE (Status)) 489 { 490 return; 491 } 492 493 /* Dump variable-length extra data */ 494 495 switch (Type) 496 { 497 case ACPI_ASF_TYPE_ALERT: 498 case ACPI_ASF_TYPE_CONTROL: 499 500 for (i = 0; i < DataCount; i++) 501 { 502 AcpiOsPrintf ("\n"); 503 Status = AcpiDmDumpTable (Table->Length, DataOffset, 504 DataTable, DataLength, DataInfoTable); 505 if (ACPI_FAILURE (Status)) 506 { 507 return; 508 } 509 510 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); 511 DataOffset += DataLength; 512 } 513 break; 514 515 case ACPI_ASF_TYPE_ADDRESS: 516 517 for (i = 0; i < DataLength; i++) 518 { 519 if (!(i % 16)) 520 { 521 AcpiDmLineHeader (DataOffset, 1, "Addresses"); 522 } 523 524 AcpiOsPrintf ("%2.2X ", *DataTable); 525 DataTable++; 526 DataOffset++; 527 if (DataOffset > Table->Length) 528 { 529 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); 530 return; 531 } 532 } 533 534 AcpiOsPrintf ("\n"); 535 break; 536 537 default: 538 539 break; 540 } 541 542 AcpiOsPrintf ("\n"); 543 544 /* Point to next sub-table */ 545 546 if (!SubTable->Header.Length) 547 { 548 AcpiOsPrintf ("Invalid zero subtable header length\n"); 549 return; 550 } 551 552 Offset += SubTable->Header.Length; 553 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); 554 } 555 } 556 557 558 /******************************************************************************* 559 * 560 * FUNCTION: AcpiDmDumpCpep 561 * 562 * PARAMETERS: Table - A CPEP table 563 * 564 * RETURN: None 565 * 566 * DESCRIPTION: Format the contents of a CPEP. This table type consists 567 * of an open-ended number of subtables. 568 * 569 ******************************************************************************/ 570 571 void 572 AcpiDmDumpCpep ( 573 ACPI_TABLE_HEADER *Table) 574 { 575 ACPI_STATUS Status; 576 ACPI_CPEP_POLLING *SubTable; 577 UINT32 Length = Table->Length; 578 UINT32 Offset = sizeof (ACPI_TABLE_CPEP); 579 580 581 /* Main table */ 582 583 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); 584 if (ACPI_FAILURE (Status)) 585 { 586 return; 587 } 588 589 /* Sub-tables */ 590 591 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); 592 while (Offset < Table->Length) 593 { 594 AcpiOsPrintf ("\n"); 595 Status = AcpiDmDumpTable (Length, Offset, SubTable, 596 SubTable->Header.Length, AcpiDmTableInfoCpep0); 597 if (ACPI_FAILURE (Status)) 598 { 599 return; 600 } 601 602 /* Point to next sub-table */ 603 604 Offset += SubTable->Header.Length; 605 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, 606 SubTable->Header.Length); 607 } 608 } 609 610 611 /******************************************************************************* 612 * 613 * FUNCTION: AcpiDmDumpCsrt 614 * 615 * PARAMETERS: Table - A CSRT table 616 * 617 * RETURN: None 618 * 619 * DESCRIPTION: Format the contents of a CSRT. This table type consists 620 * of an open-ended number of subtables. 621 * 622 ******************************************************************************/ 623 624 void 625 AcpiDmDumpCsrt ( 626 ACPI_TABLE_HEADER *Table) 627 { 628 ACPI_STATUS Status; 629 ACPI_CSRT_GROUP *SubTable; 630 ACPI_CSRT_SHARED_INFO *SharedInfoTable; 631 ACPI_CSRT_DESCRIPTOR *SubSubTable; 632 UINT32 Length = Table->Length; 633 UINT32 Offset = sizeof (ACPI_TABLE_CSRT); 634 UINT32 SubOffset; 635 UINT32 SubSubOffset; 636 UINT32 InfoLength; 637 638 639 /* The main table only contains the ACPI header, thus already handled */ 640 641 /* Sub-tables (Resource Groups) */ 642 643 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); 644 while (Offset < Table->Length) 645 { 646 /* Resource group subtable */ 647 648 AcpiOsPrintf ("\n"); 649 Status = AcpiDmDumpTable (Length, Offset, SubTable, 650 SubTable->Length, AcpiDmTableInfoCsrt0); 651 if (ACPI_FAILURE (Status)) 652 { 653 return; 654 } 655 656 /* Shared info subtable (One per resource group) */ 657 658 SubOffset = sizeof (ACPI_CSRT_GROUP); 659 SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table, 660 Offset + SubOffset); 661 662 AcpiOsPrintf ("\n"); 663 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable, 664 sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1); 665 if (ACPI_FAILURE (Status)) 666 { 667 return; 668 } 669 670 SubOffset += SubTable->SharedInfoLength; 671 672 /* Sub-Subtables (Resource Descriptors) */ 673 674 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, 675 Offset + SubOffset); 676 677 while ((SubOffset < SubTable->Length) && 678 ((Offset + SubOffset) < Table->Length)) 679 { 680 AcpiOsPrintf ("\n"); 681 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable, 682 SubSubTable->Length, AcpiDmTableInfoCsrt2); 683 if (ACPI_FAILURE (Status)) 684 { 685 return; 686 } 687 688 SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR); 689 690 /* Resource-specific info buffer */ 691 692 InfoLength = SubSubTable->Length - SubSubOffset; 693 694 AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength, 695 Offset + SubOffset + SubSubOffset, "ResourceInfo"); 696 SubSubOffset += InfoLength; 697 698 /* Point to next sub-subtable */ 699 700 SubOffset += SubSubTable->Length; 701 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable, 702 SubSubTable->Length); 703 } 704 705 /* Point to next sub-table */ 706 707 Offset += SubTable->Length; 708 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, 709 SubTable->Length); 710 } 711 } 712 713 714 /******************************************************************************* 715 * 716 * FUNCTION: AcpiDmDumpDbg2 717 * 718 * PARAMETERS: Table - A DBG2 table 719 * 720 * RETURN: None 721 * 722 * DESCRIPTION: Format the contents of a DBG2. This table type consists 723 * of an open-ended number of subtables. 724 * 725 ******************************************************************************/ 726 727 void 728 AcpiDmDumpDbg2 ( 729 ACPI_TABLE_HEADER *Table) 730 { 731 ACPI_STATUS Status; 732 ACPI_DBG2_DEVICE *SubTable; 733 UINT32 Length = Table->Length; 734 UINT32 Offset = sizeof (ACPI_TABLE_DBG2); 735 UINT32 i; 736 UINT32 ArrayOffset; 737 UINT32 AbsoluteOffset; 738 UINT8 *Array; 739 740 741 /* Main table */ 742 743 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2); 744 if (ACPI_FAILURE (Status)) 745 { 746 return; 747 } 748 749 /* Sub-tables */ 750 751 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); 752 while (Offset < Table->Length) 753 { 754 AcpiOsPrintf ("\n"); 755 Status = AcpiDmDumpTable (Length, Offset, SubTable, 756 SubTable->Length, AcpiDmTableInfoDbg2Device); 757 if (ACPI_FAILURE (Status)) 758 { 759 return; 760 } 761 762 /* Dump the BaseAddress array */ 763 764 for (i = 0; i < SubTable->RegisterCount; i++) 765 { 766 ArrayOffset = SubTable->BaseAddressOffset + 767 (sizeof (ACPI_GENERIC_ADDRESS) * i); 768 AbsoluteOffset = Offset + ArrayOffset; 769 Array = (UINT8 *) SubTable + ArrayOffset; 770 771 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, 772 SubTable->Length, AcpiDmTableInfoDbg2Addr); 773 if (ACPI_FAILURE (Status)) 774 { 775 return; 776 } 777 } 778 779 /* Dump the AddressSize array */ 780 781 for (i = 0; i < SubTable->RegisterCount; i++) 782 { 783 ArrayOffset = SubTable->AddressSizeOffset + 784 (sizeof (UINT32) * i); 785 AbsoluteOffset = Offset + ArrayOffset; 786 Array = (UINT8 *) SubTable + ArrayOffset; 787 788 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, 789 SubTable->Length, AcpiDmTableInfoDbg2Size); 790 if (ACPI_FAILURE (Status)) 791 { 792 return; 793 } 794 } 795 796 /* Dump the Namestring (required) */ 797 798 AcpiOsPrintf ("\n"); 799 ArrayOffset = SubTable->NamepathOffset; 800 AbsoluteOffset = Offset + ArrayOffset; 801 Array = (UINT8 *) SubTable + ArrayOffset; 802 803 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, 804 SubTable->Length, AcpiDmTableInfoDbg2Name); 805 if (ACPI_FAILURE (Status)) 806 { 807 return; 808 } 809 810 /* Dump the OemData (optional) */ 811 812 AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, 813 Offset + SubTable->OemDataOffset, "OEM Data"); 814 815 /* Point to next sub-table */ 816 817 Offset += SubTable->Length; 818 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, 819 SubTable->Length); 820 } 821 } 822 823 824 /******************************************************************************* 825 * 826 * FUNCTION: AcpiDmDumpDmar 827 * 828 * PARAMETERS: Table - A DMAR table 829 * 830 * RETURN: None 831 * 832 * DESCRIPTION: Format the contents of a DMAR. This table type consists 833 * of an open-ended number of subtables. 834 * 835 ******************************************************************************/ 836 837 838 void 839 AcpiDmDumpDmar ( 840 ACPI_TABLE_HEADER *Table) 841 { 842 ACPI_STATUS Status; 843 ACPI_DMAR_HEADER *SubTable; 844 UINT32 Length = Table->Length; 845 UINT32 Offset = sizeof (ACPI_TABLE_DMAR); 846 ACPI_DMTABLE_INFO *InfoTable; 847 ACPI_DMAR_DEVICE_SCOPE *ScopeTable; 848 UINT32 ScopeOffset; 849 UINT8 *PciPath; 850 UINT32 PathOffset; 851 852 853 /* Main table */ 854 855 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); 856 if (ACPI_FAILURE (Status)) 857 { 858 return; 859 } 860 861 /* Sub-tables */ 862 863 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); 864 while (Offset < Table->Length) 865 { 866 /* Common sub-table header */ 867 868 AcpiOsPrintf ("\n"); 869 Status = AcpiDmDumpTable (Length, Offset, SubTable, 870 SubTable->Length, AcpiDmTableInfoDmarHdr); 871 if (ACPI_FAILURE (Status)) 872 { 873 return; 874 } 875 AcpiOsPrintf ("\n"); 876 877 switch (SubTable->Type) 878 { 879 case ACPI_DMAR_TYPE_HARDWARE_UNIT: 880 881 InfoTable = AcpiDmTableInfoDmar0; 882 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT); 883 break; 884 885 case ACPI_DMAR_TYPE_RESERVED_MEMORY: 886 887 InfoTable = AcpiDmTableInfoDmar1; 888 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY); 889 break; 890 891 case ACPI_DMAR_TYPE_ATSR: 892 893 InfoTable = AcpiDmTableInfoDmar2; 894 ScopeOffset = sizeof (ACPI_DMAR_ATSR); 895 break; 896 897 case ACPI_DMAR_HARDWARE_AFFINITY: 898 899 InfoTable = AcpiDmTableInfoDmar3; 900 ScopeOffset = sizeof (ACPI_DMAR_RHSA); 901 break; 902 903 default: 904 905 AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type); 906 return; 907 } 908 909 Status = AcpiDmDumpTable (Length, Offset, SubTable, 910 SubTable->Length, InfoTable); 911 if (ACPI_FAILURE (Status)) 912 { 913 return; 914 } 915 916 /* Dump the device scope entries (if any) */ 917 918 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); 919 while (ScopeOffset < SubTable->Length) 920 { 921 AcpiOsPrintf ("\n"); 922 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, 923 ScopeTable->Length, AcpiDmTableInfoDmarScope); 924 if (ACPI_FAILURE (Status)) 925 { 926 return; 927 } 928 AcpiOsPrintf ("\n"); 929 930 /* Dump the PCI Path entries for this device scope */ 931 932 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */ 933 934 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable, 935 sizeof (ACPI_DMAR_DEVICE_SCOPE)); 936 937 while (PathOffset < ScopeTable->Length) 938 { 939 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path"); 940 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]); 941 942 /* Point to next PCI Path entry */ 943 944 PathOffset += 2; 945 PciPath += 2; 946 AcpiOsPrintf ("\n"); 947 } 948 949 /* Point to next device scope entry */ 950 951 ScopeOffset += ScopeTable->Length; 952 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, 953 ScopeTable, ScopeTable->Length); 954 } 955 956 /* Point to next sub-table */ 957 958 Offset += SubTable->Length; 959 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length); 960 } 961 } 962 963 964 /******************************************************************************* 965 * 966 * FUNCTION: AcpiDmDumpEinj 967 * 968 * PARAMETERS: Table - A EINJ table 969 * 970 * RETURN: None 971 * 972 * DESCRIPTION: Format the contents of a EINJ. This table type consists 973 * of an open-ended number of subtables. 974 * 975 ******************************************************************************/ 976 977 void 978 AcpiDmDumpEinj ( 979 ACPI_TABLE_HEADER *Table) 980 { 981 ACPI_STATUS Status; 982 ACPI_WHEA_HEADER *SubTable; 983 UINT32 Length = Table->Length; 984 UINT32 Offset = sizeof (ACPI_TABLE_EINJ); 985 986 987 /* Main table */ 988 989 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); 990 if (ACPI_FAILURE (Status)) 991 { 992 return; 993 } 994 995 /* Sub-tables */ 996 997 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); 998 while (Offset < Table->Length) 999 { 1000 AcpiOsPrintf ("\n"); 1001 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1002 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); 1003 if (ACPI_FAILURE (Status)) 1004 { 1005 return; 1006 } 1007 1008 /* Point to next sub-table (each subtable is of fixed length) */ 1009 1010 Offset += sizeof (ACPI_WHEA_HEADER); 1011 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, 1012 sizeof (ACPI_WHEA_HEADER)); 1013 } 1014 } 1015 1016 1017 /******************************************************************************* 1018 * 1019 * FUNCTION: AcpiDmDumpErst 1020 * 1021 * PARAMETERS: Table - A ERST table 1022 * 1023 * RETURN: None 1024 * 1025 * DESCRIPTION: Format the contents of a ERST. This table type consists 1026 * of an open-ended number of subtables. 1027 * 1028 ******************************************************************************/ 1029 1030 void 1031 AcpiDmDumpErst ( 1032 ACPI_TABLE_HEADER *Table) 1033 { 1034 ACPI_STATUS Status; 1035 ACPI_WHEA_HEADER *SubTable; 1036 UINT32 Length = Table->Length; 1037 UINT32 Offset = sizeof (ACPI_TABLE_ERST); 1038 1039 1040 /* Main table */ 1041 1042 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); 1043 if (ACPI_FAILURE (Status)) 1044 { 1045 return; 1046 } 1047 1048 /* Sub-tables */ 1049 1050 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); 1051 while (Offset < Table->Length) 1052 { 1053 AcpiOsPrintf ("\n"); 1054 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1055 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); 1056 if (ACPI_FAILURE (Status)) 1057 { 1058 return; 1059 } 1060 1061 /* Point to next sub-table (each subtable is of fixed length) */ 1062 1063 Offset += sizeof (ACPI_WHEA_HEADER); 1064 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, 1065 sizeof (ACPI_WHEA_HEADER)); 1066 } 1067 } 1068 1069 1070 /******************************************************************************* 1071 * 1072 * FUNCTION: AcpiDmDumpFpdt 1073 * 1074 * PARAMETERS: Table - A FPDT table 1075 * 1076 * RETURN: None 1077 * 1078 * DESCRIPTION: Format the contents of a FPDT. This table type consists 1079 * of an open-ended number of subtables. 1080 * 1081 ******************************************************************************/ 1082 1083 void 1084 AcpiDmDumpFpdt ( 1085 ACPI_TABLE_HEADER *Table) 1086 { 1087 ACPI_STATUS Status; 1088 ACPI_FPDT_HEADER *SubTable; 1089 UINT32 Length = Table->Length; 1090 UINT32 Offset = sizeof (ACPI_TABLE_FPDT); 1091 ACPI_DMTABLE_INFO *InfoTable; 1092 1093 1094 /* There is no main table (other than the standard ACPI header) */ 1095 1096 /* Sub-tables */ 1097 1098 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); 1099 while (Offset < Table->Length) 1100 { 1101 /* Common sub-table header */ 1102 1103 AcpiOsPrintf ("\n"); 1104 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1105 SubTable->Length, AcpiDmTableInfoFpdtHdr); 1106 if (ACPI_FAILURE (Status)) 1107 { 1108 return; 1109 } 1110 1111 switch (SubTable->Type) 1112 { 1113 case ACPI_FPDT_TYPE_BOOT: 1114 1115 InfoTable = AcpiDmTableInfoFpdt0; 1116 break; 1117 1118 case ACPI_FPDT_TYPE_S3PERF: 1119 1120 InfoTable = AcpiDmTableInfoFpdt1; 1121 break; 1122 1123 default: 1124 1125 AcpiOsPrintf ("\n**** Unknown FPDT sub-table type 0x%X\n\n", SubTable->Type); 1126 1127 /* Attempt to continue */ 1128 1129 if (!SubTable->Length) 1130 { 1131 AcpiOsPrintf ("Invalid zero length subtable\n"); 1132 return; 1133 } 1134 goto NextSubTable; 1135 } 1136 1137 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1138 SubTable->Length, InfoTable); 1139 if (ACPI_FAILURE (Status)) 1140 { 1141 return; 1142 } 1143 1144 NextSubTable: 1145 /* Point to next sub-table */ 1146 1147 Offset += SubTable->Length; 1148 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length); 1149 } 1150 } 1151 1152 1153 /******************************************************************************* 1154 * 1155 * FUNCTION: AcpiDmDumpHest 1156 * 1157 * PARAMETERS: Table - A HEST table 1158 * 1159 * RETURN: None 1160 * 1161 * DESCRIPTION: Format the contents of a HEST. This table type consists 1162 * of an open-ended number of subtables. 1163 * 1164 ******************************************************************************/ 1165 1166 void 1167 AcpiDmDumpHest ( 1168 ACPI_TABLE_HEADER *Table) 1169 { 1170 ACPI_STATUS Status; 1171 ACPI_HEST_HEADER *SubTable; 1172 UINT32 Length = Table->Length; 1173 UINT32 Offset = sizeof (ACPI_TABLE_HEST); 1174 ACPI_DMTABLE_INFO *InfoTable; 1175 UINT32 SubTableLength; 1176 UINT32 BankCount; 1177 ACPI_HEST_IA_ERROR_BANK *BankTable; 1178 1179 1180 /* Main table */ 1181 1182 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); 1183 if (ACPI_FAILURE (Status)) 1184 { 1185 return; 1186 } 1187 1188 /* Sub-tables */ 1189 1190 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); 1191 while (Offset < Table->Length) 1192 { 1193 BankCount = 0; 1194 switch (SubTable->Type) 1195 { 1196 case ACPI_HEST_TYPE_IA32_CHECK: 1197 1198 InfoTable = AcpiDmTableInfoHest0; 1199 SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); 1200 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, 1201 SubTable))->NumHardwareBanks; 1202 break; 1203 1204 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: 1205 1206 InfoTable = AcpiDmTableInfoHest1; 1207 SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); 1208 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, 1209 SubTable))->NumHardwareBanks; 1210 break; 1211 1212 case ACPI_HEST_TYPE_IA32_NMI: 1213 1214 InfoTable = AcpiDmTableInfoHest2; 1215 SubTableLength = sizeof (ACPI_HEST_IA_NMI); 1216 break; 1217 1218 case ACPI_HEST_TYPE_AER_ROOT_PORT: 1219 1220 InfoTable = AcpiDmTableInfoHest6; 1221 SubTableLength = sizeof (ACPI_HEST_AER_ROOT); 1222 break; 1223 1224 case ACPI_HEST_TYPE_AER_ENDPOINT: 1225 1226 InfoTable = AcpiDmTableInfoHest7; 1227 SubTableLength = sizeof (ACPI_HEST_AER); 1228 break; 1229 1230 case ACPI_HEST_TYPE_AER_BRIDGE: 1231 1232 InfoTable = AcpiDmTableInfoHest8; 1233 SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE); 1234 break; 1235 1236 case ACPI_HEST_TYPE_GENERIC_ERROR: 1237 1238 InfoTable = AcpiDmTableInfoHest9; 1239 SubTableLength = sizeof (ACPI_HEST_GENERIC); 1240 break; 1241 1242 default: 1243 1244 /* Cannot continue on unknown type - no length */ 1245 1246 AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type); 1247 return; 1248 } 1249 1250 AcpiOsPrintf ("\n"); 1251 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1252 SubTableLength, InfoTable); 1253 if (ACPI_FAILURE (Status)) 1254 { 1255 return; 1256 } 1257 1258 /* Point to end of current subtable (each subtable above is of fixed length) */ 1259 1260 Offset += SubTableLength; 1261 1262 /* If there are any (fixed-length) Error Banks from above, dump them now */ 1263 1264 if (BankCount) 1265 { 1266 BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength); 1267 SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); 1268 1269 while (BankCount) 1270 { 1271 AcpiOsPrintf ("\n"); 1272 Status = AcpiDmDumpTable (Length, Offset, BankTable, 1273 sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); 1274 if (ACPI_FAILURE (Status)) 1275 { 1276 return; 1277 } 1278 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); 1279 BankTable++; 1280 BankCount--; 1281 } 1282 } 1283 1284 /* Point to next sub-table */ 1285 1286 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); 1287 } 1288 } 1289 1290 1291 /******************************************************************************* 1292 * 1293 * FUNCTION: AcpiDmDumpIvrs 1294 * 1295 * PARAMETERS: Table - A IVRS table 1296 * 1297 * RETURN: None 1298 * 1299 * DESCRIPTION: Format the contents of a IVRS 1300 * 1301 ******************************************************************************/ 1302 1303 static UINT8 EntrySizes[] = {4,8,16,32}; 1304 1305 void 1306 AcpiDmDumpIvrs ( 1307 ACPI_TABLE_HEADER *Table) 1308 { 1309 ACPI_STATUS Status; 1310 UINT32 Offset = sizeof (ACPI_TABLE_IVRS); 1311 UINT32 EntryOffset; 1312 UINT32 EntryLength; 1313 UINT32 EntryType; 1314 ACPI_IVRS_DE_HEADER *DeviceEntry; 1315 ACPI_IVRS_HEADER *SubTable; 1316 ACPI_DMTABLE_INFO *InfoTable; 1317 1318 1319 /* Main table */ 1320 1321 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs); 1322 if (ACPI_FAILURE (Status)) 1323 { 1324 return; 1325 } 1326 1327 /* Sub-tables */ 1328 1329 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); 1330 while (Offset < Table->Length) 1331 { 1332 /* Common sub-table header */ 1333 1334 AcpiOsPrintf ("\n"); 1335 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 1336 SubTable->Length, AcpiDmTableInfoIvrsHdr); 1337 if (ACPI_FAILURE (Status)) 1338 { 1339 return; 1340 } 1341 1342 switch (SubTable->Type) 1343 { 1344 case ACPI_IVRS_TYPE_HARDWARE: 1345 1346 InfoTable = AcpiDmTableInfoIvrs0; 1347 break; 1348 1349 case ACPI_IVRS_TYPE_MEMORY1: 1350 case ACPI_IVRS_TYPE_MEMORY2: 1351 case ACPI_IVRS_TYPE_MEMORY3: 1352 1353 InfoTable = AcpiDmTableInfoIvrs1; 1354 break; 1355 1356 default: 1357 1358 AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n", 1359 SubTable->Type); 1360 1361 /* Attempt to continue */ 1362 1363 if (!SubTable->Length) 1364 { 1365 AcpiOsPrintf ("Invalid zero length subtable\n"); 1366 return; 1367 } 1368 goto NextSubTable; 1369 } 1370 1371 /* Dump the subtable */ 1372 1373 AcpiOsPrintf ("\n"); 1374 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 1375 SubTable->Length, InfoTable); 1376 if (ACPI_FAILURE (Status)) 1377 { 1378 return; 1379 } 1380 1381 /* The hardware subtable can contain multiple device entries */ 1382 1383 if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE) 1384 { 1385 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); 1386 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable, 1387 sizeof (ACPI_IVRS_HARDWARE)); 1388 1389 while (EntryOffset < (Offset + SubTable->Length)) 1390 { 1391 AcpiOsPrintf ("\n"); 1392 /* 1393 * Upper 2 bits of Type encode the length of the device entry 1394 * 1395 * 00 = 4 byte 1396 * 01 = 8 byte 1397 * 10 = 16 byte - currently no entries defined 1398 * 11 = 32 byte - currently no entries defined 1399 */ 1400 EntryType = DeviceEntry->Type; 1401 EntryLength = EntrySizes [EntryType >> 6]; 1402 1403 switch (EntryType) 1404 { 1405 /* 4-byte device entries */ 1406 1407 case ACPI_IVRS_TYPE_PAD4: 1408 case ACPI_IVRS_TYPE_ALL: 1409 case ACPI_IVRS_TYPE_SELECT: 1410 case ACPI_IVRS_TYPE_START: 1411 case ACPI_IVRS_TYPE_END: 1412 1413 InfoTable = AcpiDmTableInfoIvrs4; 1414 break; 1415 1416 /* 8-byte entries, type A */ 1417 1418 case ACPI_IVRS_TYPE_ALIAS_SELECT: 1419 case ACPI_IVRS_TYPE_ALIAS_START: 1420 1421 InfoTable = AcpiDmTableInfoIvrs8a; 1422 break; 1423 1424 /* 8-byte entries, type B */ 1425 1426 case ACPI_IVRS_TYPE_PAD8: 1427 case ACPI_IVRS_TYPE_EXT_SELECT: 1428 case ACPI_IVRS_TYPE_EXT_START: 1429 1430 InfoTable = AcpiDmTableInfoIvrs8b; 1431 break; 1432 1433 /* 8-byte entries, type C */ 1434 1435 case ACPI_IVRS_TYPE_SPECIAL: 1436 1437 InfoTable = AcpiDmTableInfoIvrs8c; 1438 break; 1439 1440 default: 1441 InfoTable = AcpiDmTableInfoIvrs4; 1442 AcpiOsPrintf ( 1443 "\n**** Unknown IVRS device entry type/length: " 1444 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n", 1445 EntryType, EntryLength, EntryOffset); 1446 break; 1447 } 1448 1449 /* Dump the Device Entry */ 1450 1451 Status = AcpiDmDumpTable (Table->Length, EntryOffset, 1452 DeviceEntry, EntryLength, InfoTable); 1453 1454 EntryOffset += EntryLength; 1455 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, 1456 EntryLength); 1457 } 1458 } 1459 1460 NextSubTable: 1461 /* Point to next sub-table */ 1462 1463 Offset += SubTable->Length; 1464 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length); 1465 } 1466 } 1467 1468 1469 /******************************************************************************* 1470 * 1471 * FUNCTION: AcpiDmDumpMadt 1472 * 1473 * PARAMETERS: Table - A MADT table 1474 * 1475 * RETURN: None 1476 * 1477 * DESCRIPTION: Format the contents of a MADT. This table type consists 1478 * of an open-ended number of subtables. 1479 * 1480 ******************************************************************************/ 1481 1482 void 1483 AcpiDmDumpMadt ( 1484 ACPI_TABLE_HEADER *Table) 1485 { 1486 ACPI_STATUS Status; 1487 ACPI_SUBTABLE_HEADER *SubTable; 1488 UINT32 Length = Table->Length; 1489 UINT32 Offset = sizeof (ACPI_TABLE_MADT); 1490 ACPI_DMTABLE_INFO *InfoTable; 1491 1492 1493 /* Main table */ 1494 1495 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); 1496 if (ACPI_FAILURE (Status)) 1497 { 1498 return; 1499 } 1500 1501 /* Sub-tables */ 1502 1503 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); 1504 while (Offset < Table->Length) 1505 { 1506 /* Common sub-table header */ 1507 1508 AcpiOsPrintf ("\n"); 1509 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1510 SubTable->Length, AcpiDmTableInfoMadtHdr); 1511 if (ACPI_FAILURE (Status)) 1512 { 1513 return; 1514 } 1515 1516 switch (SubTable->Type) 1517 { 1518 case ACPI_MADT_TYPE_LOCAL_APIC: 1519 1520 InfoTable = AcpiDmTableInfoMadt0; 1521 break; 1522 1523 case ACPI_MADT_TYPE_IO_APIC: 1524 1525 InfoTable = AcpiDmTableInfoMadt1; 1526 break; 1527 1528 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: 1529 1530 InfoTable = AcpiDmTableInfoMadt2; 1531 break; 1532 1533 case ACPI_MADT_TYPE_NMI_SOURCE: 1534 1535 InfoTable = AcpiDmTableInfoMadt3; 1536 break; 1537 1538 case ACPI_MADT_TYPE_LOCAL_APIC_NMI: 1539 1540 InfoTable = AcpiDmTableInfoMadt4; 1541 break; 1542 1543 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: 1544 1545 InfoTable = AcpiDmTableInfoMadt5; 1546 break; 1547 1548 case ACPI_MADT_TYPE_IO_SAPIC: 1549 1550 InfoTable = AcpiDmTableInfoMadt6; 1551 break; 1552 1553 case ACPI_MADT_TYPE_LOCAL_SAPIC: 1554 1555 InfoTable = AcpiDmTableInfoMadt7; 1556 break; 1557 1558 case ACPI_MADT_TYPE_INTERRUPT_SOURCE: 1559 1560 InfoTable = AcpiDmTableInfoMadt8; 1561 break; 1562 1563 case ACPI_MADT_TYPE_LOCAL_X2APIC: 1564 1565 InfoTable = AcpiDmTableInfoMadt9; 1566 break; 1567 1568 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: 1569 1570 InfoTable = AcpiDmTableInfoMadt10; 1571 break; 1572 1573 case ACPI_MADT_TYPE_GENERIC_INTERRUPT: 1574 1575 InfoTable = AcpiDmTableInfoMadt11; 1576 break; 1577 1578 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: 1579 1580 InfoTable = AcpiDmTableInfoMadt12; 1581 break; 1582 1583 default: 1584 1585 AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type); 1586 1587 /* Attempt to continue */ 1588 1589 if (!SubTable->Length) 1590 { 1591 AcpiOsPrintf ("Invalid zero length subtable\n"); 1592 return; 1593 } 1594 goto NextSubTable; 1595 } 1596 1597 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1598 SubTable->Length, InfoTable); 1599 if (ACPI_FAILURE (Status)) 1600 { 1601 return; 1602 } 1603 1604 NextSubTable: 1605 /* Point to next sub-table */ 1606 1607 Offset += SubTable->Length; 1608 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); 1609 } 1610 } 1611 1612 1613 /******************************************************************************* 1614 * 1615 * FUNCTION: AcpiDmDumpMcfg 1616 * 1617 * PARAMETERS: Table - A MCFG Table 1618 * 1619 * RETURN: None 1620 * 1621 * DESCRIPTION: Format the contents of a MCFG table 1622 * 1623 ******************************************************************************/ 1624 1625 void 1626 AcpiDmDumpMcfg ( 1627 ACPI_TABLE_HEADER *Table) 1628 { 1629 ACPI_STATUS Status; 1630 UINT32 Offset = sizeof (ACPI_TABLE_MCFG); 1631 ACPI_MCFG_ALLOCATION *SubTable; 1632 1633 1634 /* Main table */ 1635 1636 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); 1637 if (ACPI_FAILURE (Status)) 1638 { 1639 return; 1640 } 1641 1642 /* Sub-tables */ 1643 1644 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); 1645 while (Offset < Table->Length) 1646 { 1647 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) 1648 { 1649 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", 1650 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); 1651 return; 1652 } 1653 1654 AcpiOsPrintf ("\n"); 1655 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 1656 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); 1657 if (ACPI_FAILURE (Status)) 1658 { 1659 return; 1660 } 1661 1662 /* Point to next sub-table (each subtable is of fixed length) */ 1663 1664 Offset += sizeof (ACPI_MCFG_ALLOCATION); 1665 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable, 1666 sizeof (ACPI_MCFG_ALLOCATION)); 1667 } 1668 } 1669 1670 1671 /******************************************************************************* 1672 * 1673 * FUNCTION: AcpiDmDumpMpst 1674 * 1675 * PARAMETERS: Table - A MPST Table 1676 * 1677 * RETURN: None 1678 * 1679 * DESCRIPTION: Format the contents of a MPST table 1680 * 1681 ******************************************************************************/ 1682 1683 void 1684 AcpiDmDumpMpst ( 1685 ACPI_TABLE_HEADER *Table) 1686 { 1687 ACPI_STATUS Status; 1688 UINT32 Offset = sizeof (ACPI_TABLE_MPST); 1689 ACPI_MPST_POWER_NODE *SubTable0; 1690 ACPI_MPST_POWER_STATE *SubTable0A; 1691 ACPI_MPST_COMPONENT *SubTable0B; 1692 ACPI_MPST_DATA_HDR *SubTable1; 1693 ACPI_MPST_POWER_DATA *SubTable2; 1694 UINT16 SubtableCount; 1695 UINT32 PowerStateCount; 1696 UINT32 ComponentCount; 1697 1698 1699 /* Main table */ 1700 1701 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst); 1702 if (ACPI_FAILURE (Status)) 1703 { 1704 return; 1705 } 1706 1707 /* Subtable: Memory Power Node(s) */ 1708 1709 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount; 1710 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); 1711 1712 while ((Offset < Table->Length) && SubtableCount) 1713 { 1714 AcpiOsPrintf ("\n"); 1715 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0, 1716 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); 1717 if (ACPI_FAILURE (Status)) 1718 { 1719 return; 1720 } 1721 1722 /* Extract the sub-subtable counts */ 1723 1724 PowerStateCount = SubTable0->NumPowerStates; 1725 ComponentCount = SubTable0->NumPhysicalComponents; 1726 Offset += sizeof (ACPI_MPST_POWER_NODE); 1727 1728 /* Sub-subtables - Memory Power State Structure(s) */ 1729 1730 SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0, 1731 sizeof (ACPI_MPST_POWER_NODE)); 1732 1733 while (PowerStateCount) 1734 { 1735 AcpiOsPrintf ("\n"); 1736 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A, 1737 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); 1738 if (ACPI_FAILURE (Status)) 1739 { 1740 return; 1741 } 1742 1743 SubTable0A++; 1744 PowerStateCount--; 1745 Offset += sizeof (ACPI_MPST_POWER_STATE); 1746 } 1747 1748 /* Sub-subtables - Physical Component ID Structure(s) */ 1749 1750 SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A); 1751 1752 if (ComponentCount) 1753 { 1754 AcpiOsPrintf ("\n"); 1755 } 1756 1757 while (ComponentCount) 1758 { 1759 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B, 1760 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); 1761 if (ACPI_FAILURE (Status)) 1762 { 1763 return; 1764 } 1765 1766 SubTable0B++; 1767 ComponentCount--; 1768 Offset += sizeof (ACPI_MPST_COMPONENT); 1769 } 1770 1771 /* Point to next Memory Power Node subtable */ 1772 1773 SubtableCount--; 1774 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0, 1775 sizeof (ACPI_MPST_POWER_NODE) + 1776 (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) + 1777 (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents)); 1778 } 1779 1780 /* Subtable: Count of Memory Power State Characteristic structures */ 1781 1782 AcpiOsPrintf ("\n"); 1783 SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0); 1784 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1, 1785 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); 1786 if (ACPI_FAILURE (Status)) 1787 { 1788 return; 1789 } 1790 1791 SubtableCount = SubTable1->CharacteristicsCount; 1792 Offset += sizeof (ACPI_MPST_DATA_HDR); 1793 1794 /* Subtable: Memory Power State Characteristics structure(s) */ 1795 1796 SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR)); 1797 1798 while ((Offset < Table->Length) && SubtableCount) 1799 { 1800 AcpiOsPrintf ("\n"); 1801 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2, 1802 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); 1803 if (ACPI_FAILURE (Status)) 1804 { 1805 return; 1806 } 1807 1808 SubTable2++; 1809 SubtableCount--; 1810 Offset += sizeof (ACPI_MPST_POWER_DATA); 1811 } 1812 } 1813 1814 1815 /******************************************************************************* 1816 * 1817 * FUNCTION: AcpiDmDumpMsct 1818 * 1819 * PARAMETERS: Table - A MSCT table 1820 * 1821 * RETURN: None 1822 * 1823 * DESCRIPTION: Format the contents of a MSCT 1824 * 1825 ******************************************************************************/ 1826 1827 void 1828 AcpiDmDumpMsct ( 1829 ACPI_TABLE_HEADER *Table) 1830 { 1831 ACPI_STATUS Status; 1832 UINT32 Offset = sizeof (ACPI_TABLE_MSCT); 1833 ACPI_MSCT_PROXIMITY *SubTable; 1834 1835 1836 /* Main table */ 1837 1838 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct); 1839 if (ACPI_FAILURE (Status)) 1840 { 1841 return; 1842 } 1843 1844 /* Sub-tables */ 1845 1846 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); 1847 while (Offset < Table->Length) 1848 { 1849 /* Common sub-table header */ 1850 1851 AcpiOsPrintf ("\n"); 1852 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 1853 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); 1854 if (ACPI_FAILURE (Status)) 1855 { 1856 return; 1857 } 1858 1859 /* Point to next sub-table */ 1860 1861 Offset += sizeof (ACPI_MSCT_PROXIMITY); 1862 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY)); 1863 } 1864 } 1865 1866 1867 /******************************************************************************* 1868 * 1869 * FUNCTION: AcpiDmDumpMtmr 1870 * 1871 * PARAMETERS: Table - A MTMR table 1872 * 1873 * RETURN: None 1874 * 1875 * DESCRIPTION: Format the contents of a MTMR 1876 * 1877 ******************************************************************************/ 1878 1879 void 1880 AcpiDmDumpMtmr ( 1881 ACPI_TABLE_HEADER *Table) 1882 { 1883 ACPI_STATUS Status; 1884 UINT32 Offset = sizeof (ACPI_TABLE_MTMR); 1885 ACPI_MTMR_ENTRY *SubTable; 1886 1887 1888 /* Main table */ 1889 1890 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr); 1891 if (ACPI_FAILURE (Status)) 1892 { 1893 return; 1894 } 1895 1896 /* Sub-tables */ 1897 1898 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); 1899 while (Offset < Table->Length) 1900 { 1901 /* Common sub-table header */ 1902 1903 AcpiOsPrintf ("\n"); 1904 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 1905 sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); 1906 if (ACPI_FAILURE (Status)) 1907 { 1908 return; 1909 } 1910 1911 /* Point to next sub-table */ 1912 1913 Offset += sizeof (ACPI_MTMR_ENTRY); 1914 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY)); 1915 } 1916 } 1917 1918 1919 /******************************************************************************* 1920 * 1921 * FUNCTION: AcpiDmDumpPcct 1922 * 1923 * PARAMETERS: Table - A PCCT table 1924 * 1925 * RETURN: None 1926 * 1927 * DESCRIPTION: Format the contents of a PCCT. This table type consists 1928 * of an open-ended number of subtables. 1929 * 1930 ******************************************************************************/ 1931 1932 void 1933 AcpiDmDumpPcct ( 1934 ACPI_TABLE_HEADER *Table) 1935 { 1936 ACPI_STATUS Status; 1937 ACPI_PCCT_SUBSPACE *SubTable; 1938 UINT32 Length = Table->Length; 1939 UINT32 Offset = sizeof (ACPI_TABLE_PCCT); 1940 1941 1942 /* Main table */ 1943 1944 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct); 1945 if (ACPI_FAILURE (Status)) 1946 { 1947 return; 1948 } 1949 1950 /* Sub-tables */ 1951 1952 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); 1953 while (Offset < Table->Length) 1954 { 1955 AcpiOsPrintf ("\n"); 1956 Status = AcpiDmDumpTable (Length, Offset, SubTable, 1957 SubTable->Header.Length, AcpiDmTableInfoPcct0); 1958 if (ACPI_FAILURE (Status)) 1959 { 1960 return; 1961 } 1962 1963 /* Point to next sub-table */ 1964 1965 Offset += SubTable->Header.Length; 1966 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable, 1967 SubTable->Header.Length); 1968 } 1969 } 1970 1971 1972 /******************************************************************************* 1973 * 1974 * FUNCTION: AcpiDmDumpPmtt 1975 * 1976 * PARAMETERS: Table - A PMTT table 1977 * 1978 * RETURN: None 1979 * 1980 * DESCRIPTION: Format the contents of a PMTT. This table type consists 1981 * of an open-ended number of subtables. 1982 * 1983 ******************************************************************************/ 1984 1985 void 1986 AcpiDmDumpPmtt ( 1987 ACPI_TABLE_HEADER *Table) 1988 { 1989 ACPI_STATUS Status; 1990 ACPI_PMTT_HEADER *SubTable; 1991 ACPI_PMTT_HEADER *MemSubTable; 1992 ACPI_PMTT_HEADER *DimmSubTable; 1993 ACPI_PMTT_DOMAIN *DomainArray; 1994 UINT32 Length = Table->Length; 1995 UINT32 Offset = sizeof (ACPI_TABLE_PMTT); 1996 UINT32 MemOffset; 1997 UINT32 DimmOffset; 1998 UINT32 DomainOffset; 1999 UINT32 DomainCount; 2000 2001 2002 /* Main table */ 2003 2004 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt); 2005 if (ACPI_FAILURE (Status)) 2006 { 2007 return; 2008 } 2009 2010 /* Subtables */ 2011 2012 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); 2013 while (Offset < Table->Length) 2014 { 2015 /* Common subtable header */ 2016 2017 AcpiOsPrintf ("\n"); 2018 Status = AcpiDmDumpTable (Length, Offset, SubTable, 2019 SubTable->Length, AcpiDmTableInfoPmttHdr); 2020 if (ACPI_FAILURE (Status)) 2021 { 2022 return; 2023 } 2024 2025 /* Only Socket subtables are expected at this level */ 2026 2027 if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET) 2028 { 2029 AcpiOsPrintf ( 2030 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 2031 SubTable->Type); 2032 return; 2033 } 2034 2035 /* Dump the fixed-length portion of the subtable */ 2036 2037 Status = AcpiDmDumpTable (Length, Offset, SubTable, 2038 SubTable->Length, AcpiDmTableInfoPmtt0); 2039 if (ACPI_FAILURE (Status)) 2040 { 2041 return; 2042 } 2043 2044 /* Walk the memory controller subtables */ 2045 2046 MemOffset = sizeof (ACPI_PMTT_SOCKET); 2047 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable, 2048 sizeof (ACPI_PMTT_SOCKET)); 2049 2050 while (((Offset + MemOffset) < Table->Length) && 2051 (MemOffset < SubTable->Length)) 2052 { 2053 /* Common subtable header */ 2054 2055 AcpiOsPrintf ("\n"); 2056 Status = AcpiDmDumpTable (Length, 2057 Offset + MemOffset, MemSubTable, 2058 MemSubTable->Length, AcpiDmTableInfoPmttHdr); 2059 if (ACPI_FAILURE (Status)) 2060 { 2061 return; 2062 } 2063 2064 /* Only memory controller subtables are expected at this level */ 2065 2066 if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER) 2067 { 2068 AcpiOsPrintf ( 2069 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 2070 MemSubTable->Type); 2071 return; 2072 } 2073 2074 /* Dump the fixed-length portion of the controller subtable */ 2075 2076 Status = AcpiDmDumpTable (Length, 2077 Offset + MemOffset, MemSubTable, 2078 MemSubTable->Length, AcpiDmTableInfoPmtt1); 2079 if (ACPI_FAILURE (Status)) 2080 { 2081 return; 2082 } 2083 2084 /* Walk the variable count of proximity domains */ 2085 2086 DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount; 2087 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER); 2088 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable, 2089 sizeof (ACPI_PMTT_CONTROLLER)); 2090 2091 while (((Offset + MemOffset + DomainOffset) < Table->Length) && 2092 ((MemOffset + DomainOffset) < SubTable->Length) && 2093 DomainCount) 2094 { 2095 Status = AcpiDmDumpTable (Length, 2096 Offset + MemOffset + DomainOffset, DomainArray, 2097 sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a); 2098 if (ACPI_FAILURE (Status)) 2099 { 2100 return; 2101 } 2102 2103 DomainOffset += sizeof (ACPI_PMTT_DOMAIN); 2104 DomainArray++; 2105 DomainCount--; 2106 } 2107 2108 if (DomainCount) 2109 { 2110 AcpiOsPrintf ( 2111 "\n**** DomainCount exceeds subtable length\n\n", 2112 MemSubTable->Type); 2113 } 2114 2115 /* Walk the physical component (DIMM) subtables */ 2116 2117 DimmOffset = DomainOffset; 2118 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable, 2119 DomainOffset); 2120 2121 while (((Offset + MemOffset + DimmOffset) < Table->Length) && 2122 (DimmOffset < MemSubTable->Length)) 2123 { 2124 /* Common subtable header */ 2125 2126 AcpiOsPrintf ("\n"); 2127 Status = AcpiDmDumpTable (Length, 2128 Offset + MemOffset + DimmOffset, DimmSubTable, 2129 DimmSubTable->Length, AcpiDmTableInfoPmttHdr); 2130 if (ACPI_FAILURE (Status)) 2131 { 2132 return; 2133 } 2134 2135 /* Only DIMM subtables are expected at this level */ 2136 2137 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM) 2138 { 2139 AcpiOsPrintf ( 2140 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 2141 DimmSubTable->Type); 2142 return; 2143 } 2144 2145 /* Dump the fixed-length DIMM subtable */ 2146 2147 Status = AcpiDmDumpTable (Length, 2148 Offset + MemOffset + DimmOffset, DimmSubTable, 2149 DimmSubTable->Length, AcpiDmTableInfoPmtt2); 2150 if (ACPI_FAILURE (Status)) 2151 { 2152 return; 2153 } 2154 2155 /* Point to next DIMM subtable */ 2156 2157 DimmOffset += DimmSubTable->Length; 2158 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 2159 DimmSubTable, DimmSubTable->Length); 2160 } 2161 2162 /* Point to next Controller subtable */ 2163 2164 MemOffset += MemSubTable->Length; 2165 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 2166 MemSubTable, MemSubTable->Length); 2167 } 2168 2169 /* Point to next Socket subtable */ 2170 2171 Offset += SubTable->Length; 2172 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 2173 SubTable, SubTable->Length); 2174 } 2175 } 2176 2177 2178 /******************************************************************************* 2179 * 2180 * FUNCTION: AcpiDmDumpS3pt 2181 * 2182 * PARAMETERS: Table - A S3PT table 2183 * 2184 * RETURN: Length of the table 2185 * 2186 * DESCRIPTION: Format the contents of a S3PT 2187 * 2188 ******************************************************************************/ 2189 2190 UINT32 2191 AcpiDmDumpS3pt ( 2192 ACPI_TABLE_HEADER *Tables) 2193 { 2194 ACPI_STATUS Status; 2195 UINT32 Offset = sizeof (ACPI_TABLE_S3PT); 2196 ACPI_S3PT_HEADER *SubTable; 2197 ACPI_DMTABLE_INFO *InfoTable; 2198 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); 2199 2200 2201 /* Main table */ 2202 2203 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt); 2204 if (ACPI_FAILURE (Status)) 2205 { 2206 return 0; 2207 } 2208 2209 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset); 2210 while (Offset < S3ptTable->Length) 2211 { 2212 /* Common sub-table header */ 2213 2214 AcpiOsPrintf ("\n"); 2215 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, 2216 SubTable->Length, AcpiDmTableInfoS3ptHdr); 2217 if (ACPI_FAILURE (Status)) 2218 { 2219 return 0; 2220 } 2221 2222 switch (SubTable->Type) 2223 { 2224 case ACPI_S3PT_TYPE_RESUME: 2225 2226 InfoTable = AcpiDmTableInfoS3pt0; 2227 break; 2228 2229 case ACPI_S3PT_TYPE_SUSPEND: 2230 2231 InfoTable = AcpiDmTableInfoS3pt1; 2232 break; 2233 2234 default: 2235 2236 AcpiOsPrintf ("\n**** Unknown S3PT sub-table type 0x%X\n", SubTable->Type); 2237 2238 /* Attempt to continue */ 2239 2240 if (!SubTable->Length) 2241 { 2242 AcpiOsPrintf ("Invalid zero length subtable\n"); 2243 return 0; 2244 } 2245 goto NextSubTable; 2246 } 2247 2248 AcpiOsPrintf ("\n"); 2249 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, 2250 SubTable->Length, InfoTable); 2251 if (ACPI_FAILURE (Status)) 2252 { 2253 return 0; 2254 } 2255 2256 NextSubTable: 2257 /* Point to next sub-table */ 2258 2259 Offset += SubTable->Length; 2260 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length); 2261 } 2262 2263 return (S3ptTable->Length); 2264 } 2265 2266 2267 /******************************************************************************* 2268 * 2269 * FUNCTION: AcpiDmDumpSlic 2270 * 2271 * PARAMETERS: Table - A SLIC table 2272 * 2273 * RETURN: None 2274 * 2275 * DESCRIPTION: Format the contents of a SLIC 2276 * 2277 ******************************************************************************/ 2278 2279 void 2280 AcpiDmDumpSlic ( 2281 ACPI_TABLE_HEADER *Table) 2282 { 2283 ACPI_STATUS Status; 2284 UINT32 Offset = sizeof (ACPI_TABLE_SLIC); 2285 ACPI_SLIC_HEADER *SubTable; 2286 ACPI_DMTABLE_INFO *InfoTable; 2287 2288 2289 /* There is no main SLIC table, only subtables */ 2290 2291 SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset); 2292 while (Offset < Table->Length) 2293 { 2294 /* Common sub-table header */ 2295 2296 AcpiOsPrintf ("\n"); 2297 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 2298 SubTable->Length, AcpiDmTableInfoSlicHdr); 2299 if (ACPI_FAILURE (Status)) 2300 { 2301 return; 2302 } 2303 2304 switch (SubTable->Type) 2305 { 2306 case ACPI_SLIC_TYPE_PUBLIC_KEY: 2307 2308 InfoTable = AcpiDmTableInfoSlic0; 2309 break; 2310 2311 case ACPI_SLIC_TYPE_WINDOWS_MARKER: 2312 2313 InfoTable = AcpiDmTableInfoSlic1; 2314 break; 2315 2316 default: 2317 2318 AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type); 2319 2320 /* Attempt to continue */ 2321 2322 if (!SubTable->Length) 2323 { 2324 AcpiOsPrintf ("Invalid zero length subtable\n"); 2325 return; 2326 } 2327 goto NextSubTable; 2328 } 2329 2330 AcpiOsPrintf ("\n"); 2331 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 2332 SubTable->Length, InfoTable); 2333 if (ACPI_FAILURE (Status)) 2334 { 2335 return; 2336 } 2337 2338 NextSubTable: 2339 /* Point to next sub-table */ 2340 2341 Offset += SubTable->Length; 2342 SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length); 2343 } 2344 } 2345 2346 2347 /******************************************************************************* 2348 * 2349 * FUNCTION: AcpiDmDumpSlit 2350 * 2351 * PARAMETERS: Table - An SLIT 2352 * 2353 * RETURN: None 2354 * 2355 * DESCRIPTION: Format the contents of a SLIT 2356 * 2357 ******************************************************************************/ 2358 2359 void 2360 AcpiDmDumpSlit ( 2361 ACPI_TABLE_HEADER *Table) 2362 { 2363 ACPI_STATUS Status; 2364 UINT32 Offset; 2365 UINT8 *Row; 2366 UINT32 Localities; 2367 UINT32 i; 2368 UINT32 j; 2369 2370 2371 /* Main table */ 2372 2373 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); 2374 if (ACPI_FAILURE (Status)) 2375 { 2376 return; 2377 } 2378 2379 /* Display the Locality NxN Matrix */ 2380 2381 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount; 2382 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]); 2383 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry; 2384 2385 for (i = 0; i < Localities; i++) 2386 { 2387 /* Display one row of the matrix */ 2388 2389 AcpiDmLineHeader2 (Offset, Localities, "Locality", i); 2390 for (j = 0; j < Localities; j++) 2391 { 2392 /* Check for beyond EOT */ 2393 2394 if (Offset >= Table->Length) 2395 { 2396 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n"); 2397 return; 2398 } 2399 2400 AcpiOsPrintf ("%2.2X", Row[j]); 2401 Offset++; 2402 2403 /* Display up to 16 bytes per output row */ 2404 2405 if ((j+1) < Localities) 2406 { 2407 AcpiOsPrintf (" "); 2408 2409 if (j && (((j+1) % 16) == 0)) 2410 { 2411 AcpiOsPrintf ("\\\n"); /* With line continuation char */ 2412 AcpiDmLineHeader (Offset, 0, NULL); 2413 } 2414 } 2415 } 2416 2417 /* Point to next row */ 2418 2419 AcpiOsPrintf ("\n"); 2420 Row += Localities; 2421 } 2422 } 2423 2424 2425 /******************************************************************************* 2426 * 2427 * FUNCTION: AcpiDmDumpSrat 2428 * 2429 * PARAMETERS: Table - A SRAT table 2430 * 2431 * RETURN: None 2432 * 2433 * DESCRIPTION: Format the contents of a SRAT 2434 * 2435 ******************************************************************************/ 2436 2437 void 2438 AcpiDmDumpSrat ( 2439 ACPI_TABLE_HEADER *Table) 2440 { 2441 ACPI_STATUS Status; 2442 UINT32 Offset = sizeof (ACPI_TABLE_SRAT); 2443 ACPI_SUBTABLE_HEADER *SubTable; 2444 ACPI_DMTABLE_INFO *InfoTable; 2445 2446 2447 /* Main table */ 2448 2449 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat); 2450 if (ACPI_FAILURE (Status)) 2451 { 2452 return; 2453 } 2454 2455 /* Sub-tables */ 2456 2457 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); 2458 while (Offset < Table->Length) 2459 { 2460 /* Common sub-table header */ 2461 2462 AcpiOsPrintf ("\n"); 2463 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 2464 SubTable->Length, AcpiDmTableInfoSratHdr); 2465 if (ACPI_FAILURE (Status)) 2466 { 2467 return; 2468 } 2469 2470 switch (SubTable->Type) 2471 { 2472 case ACPI_SRAT_TYPE_CPU_AFFINITY: 2473 2474 InfoTable = AcpiDmTableInfoSrat0; 2475 break; 2476 2477 case ACPI_SRAT_TYPE_MEMORY_AFFINITY: 2478 2479 InfoTable = AcpiDmTableInfoSrat1; 2480 break; 2481 2482 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: 2483 2484 InfoTable = AcpiDmTableInfoSrat2; 2485 break; 2486 2487 default: 2488 AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type); 2489 2490 /* Attempt to continue */ 2491 2492 if (!SubTable->Length) 2493 { 2494 AcpiOsPrintf ("Invalid zero length subtable\n"); 2495 return; 2496 } 2497 goto NextSubTable; 2498 } 2499 2500 AcpiOsPrintf ("\n"); 2501 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 2502 SubTable->Length, InfoTable); 2503 if (ACPI_FAILURE (Status)) 2504 { 2505 return; 2506 } 2507 2508 NextSubTable: 2509 /* Point to next sub-table */ 2510 2511 Offset += SubTable->Length; 2512 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); 2513 } 2514 } 2515 2516 2517 /******************************************************************************* 2518 * 2519 * FUNCTION: AcpiDmDumpVrtc 2520 * 2521 * PARAMETERS: Table - A VRTC table 2522 * 2523 * RETURN: None 2524 * 2525 * DESCRIPTION: Format the contents of a VRTC 2526 * 2527 ******************************************************************************/ 2528 2529 void 2530 AcpiDmDumpVrtc ( 2531 ACPI_TABLE_HEADER *Table) 2532 { 2533 ACPI_STATUS Status; 2534 UINT32 Offset = sizeof (ACPI_TABLE_VRTC); 2535 ACPI_VRTC_ENTRY *SubTable; 2536 2537 2538 /* Main table */ 2539 2540 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc); 2541 if (ACPI_FAILURE (Status)) 2542 { 2543 return; 2544 } 2545 2546 /* Sub-tables */ 2547 2548 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); 2549 while (Offset < Table->Length) 2550 { 2551 /* Common sub-table header */ 2552 2553 AcpiOsPrintf ("\n"); 2554 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 2555 sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); 2556 if (ACPI_FAILURE (Status)) 2557 { 2558 return; 2559 } 2560 2561 /* Point to next sub-table */ 2562 2563 Offset += sizeof (ACPI_VRTC_ENTRY); 2564 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY)); 2565 } 2566 } 2567 2568 2569 /******************************************************************************* 2570 * 2571 * FUNCTION: AcpiDmDumpWdat 2572 * 2573 * PARAMETERS: Table - A WDAT table 2574 * 2575 * RETURN: None 2576 * 2577 * DESCRIPTION: Format the contents of a WDAT 2578 * 2579 ******************************************************************************/ 2580 2581 void 2582 AcpiDmDumpWdat ( 2583 ACPI_TABLE_HEADER *Table) 2584 { 2585 ACPI_STATUS Status; 2586 UINT32 Offset = sizeof (ACPI_TABLE_WDAT); 2587 ACPI_WDAT_ENTRY *SubTable; 2588 2589 2590 /* Main table */ 2591 2592 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat); 2593 if (ACPI_FAILURE (Status)) 2594 { 2595 return; 2596 } 2597 2598 /* Sub-tables */ 2599 2600 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); 2601 while (Offset < Table->Length) 2602 { 2603 /* Common sub-table header */ 2604 2605 AcpiOsPrintf ("\n"); 2606 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, 2607 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0); 2608 if (ACPI_FAILURE (Status)) 2609 { 2610 return; 2611 } 2612 2613 /* Point to next sub-table */ 2614 2615 Offset += sizeof (ACPI_WDAT_ENTRY); 2616 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); 2617 } 2618 } 2619