1 /****************************************************************************** 2 * 3 * Module Name: dmtbdump1 - 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 - 2020, 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 ("dmtbdump1") 161 162 163 /******************************************************************************* 164 * 165 * FUNCTION: AcpiDmDumpAsf 166 * 167 * PARAMETERS: Table - A ASF table 168 * 169 * RETURN: None 170 * 171 * DESCRIPTION: Format the contents of a ASF table 172 * 173 ******************************************************************************/ 174 175 void 176 AcpiDmDumpAsf ( 177 ACPI_TABLE_HEADER *Table) 178 { 179 ACPI_STATUS Status; 180 UINT32 Offset = sizeof (ACPI_TABLE_HEADER); 181 ACPI_ASF_INFO *Subtable; 182 ACPI_DMTABLE_INFO *InfoTable; 183 ACPI_DMTABLE_INFO *DataInfoTable = NULL; 184 UINT8 *DataTable = NULL; 185 UINT32 DataCount = 0; 186 UINT32 DataLength = 0; 187 UINT32 DataOffset = 0; 188 UINT32 i; 189 UINT8 Type; 190 191 192 /* No main table, only subtables */ 193 194 Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); 195 while (Offset < Table->Length) 196 { 197 /* Common subtable header */ 198 199 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 200 Subtable->Header.Length, AcpiDmTableInfoAsfHdr); 201 if (ACPI_FAILURE (Status)) 202 { 203 return; 204 } 205 206 /* The actual type is the lower 7 bits of Type */ 207 208 Type = (UINT8) (Subtable->Header.Type & 0x7F); 209 210 switch (Type) 211 { 212 case ACPI_ASF_TYPE_INFO: 213 214 InfoTable = AcpiDmTableInfoAsf0; 215 break; 216 217 case ACPI_ASF_TYPE_ALERT: 218 219 InfoTable = AcpiDmTableInfoAsf1; 220 DataInfoTable = AcpiDmTableInfoAsf1a; 221 DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT)); 222 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts; 223 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength; 224 DataOffset = Offset + sizeof (ACPI_ASF_ALERT); 225 break; 226 227 case ACPI_ASF_TYPE_CONTROL: 228 229 InfoTable = AcpiDmTableInfoAsf2; 230 DataInfoTable = AcpiDmTableInfoAsf2a; 231 DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE)); 232 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls; 233 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength; 234 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); 235 break; 236 237 case ACPI_ASF_TYPE_BOOT: 238 239 InfoTable = AcpiDmTableInfoAsf3; 240 break; 241 242 case ACPI_ASF_TYPE_ADDRESS: 243 244 InfoTable = AcpiDmTableInfoAsf4; 245 DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS)); 246 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices; 247 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); 248 break; 249 250 default: 251 252 AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", 253 Subtable->Header.Type); 254 return; 255 } 256 257 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 258 Subtable->Header.Length, InfoTable); 259 if (ACPI_FAILURE (Status)) 260 { 261 return; 262 } 263 264 /* Dump variable-length extra data */ 265 266 switch (Type) 267 { 268 case ACPI_ASF_TYPE_ALERT: 269 case ACPI_ASF_TYPE_CONTROL: 270 271 for (i = 0; i < DataCount; i++) 272 { 273 AcpiOsPrintf ("\n"); 274 Status = AcpiDmDumpTable (Table->Length, DataOffset, 275 DataTable, DataLength, DataInfoTable); 276 if (ACPI_FAILURE (Status)) 277 { 278 return; 279 } 280 281 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); 282 DataOffset += DataLength; 283 } 284 break; 285 286 case ACPI_ASF_TYPE_ADDRESS: 287 288 for (i = 0; i < DataLength; i++) 289 { 290 if (!(i % 16)) 291 { 292 AcpiDmLineHeader (DataOffset, 1, "Addresses"); 293 } 294 295 AcpiOsPrintf ("%2.2X ", *DataTable); 296 DataTable++; 297 DataOffset++; 298 299 if (DataOffset > Table->Length) 300 { 301 AcpiOsPrintf ( 302 "**** ACPI table terminates in the middle of a " 303 "data structure! (ASF! table)\n"); 304 return; 305 } 306 } 307 308 AcpiOsPrintf ("\n"); 309 break; 310 311 default: 312 313 break; 314 } 315 316 AcpiOsPrintf ("\n"); 317 318 /* Point to next subtable */ 319 320 if (!Subtable->Header.Length) 321 { 322 AcpiOsPrintf ("Invalid zero subtable header length\n"); 323 return; 324 } 325 326 Offset += Subtable->Header.Length; 327 Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, 328 Subtable->Header.Length); 329 } 330 } 331 332 333 /******************************************************************************* 334 * 335 * FUNCTION: AcpiDmDumpCpep 336 * 337 * PARAMETERS: Table - A CPEP table 338 * 339 * RETURN: None 340 * 341 * DESCRIPTION: Format the contents of a CPEP. This table type consists 342 * of an open-ended number of subtables. 343 * 344 ******************************************************************************/ 345 346 void 347 AcpiDmDumpCpep ( 348 ACPI_TABLE_HEADER *Table) 349 { 350 ACPI_STATUS Status; 351 ACPI_CPEP_POLLING *Subtable; 352 UINT32 Length = Table->Length; 353 UINT32 Offset = sizeof (ACPI_TABLE_CPEP); 354 355 356 /* Main table */ 357 358 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); 359 if (ACPI_FAILURE (Status)) 360 { 361 return; 362 } 363 364 /* Subtables */ 365 366 Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); 367 while (Offset < Table->Length) 368 { 369 AcpiOsPrintf ("\n"); 370 Status = AcpiDmDumpTable (Length, Offset, Subtable, 371 Subtable->Header.Length, AcpiDmTableInfoCpep0); 372 if (ACPI_FAILURE (Status)) 373 { 374 return; 375 } 376 377 /* Point to next subtable */ 378 379 Offset += Subtable->Header.Length; 380 Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable, 381 Subtable->Header.Length); 382 } 383 } 384 385 386 /******************************************************************************* 387 * 388 * FUNCTION: AcpiDmDumpCsrt 389 * 390 * PARAMETERS: Table - A CSRT table 391 * 392 * RETURN: None 393 * 394 * DESCRIPTION: Format the contents of a CSRT. This table type consists 395 * of an open-ended number of subtables. 396 * 397 ******************************************************************************/ 398 399 void 400 AcpiDmDumpCsrt ( 401 ACPI_TABLE_HEADER *Table) 402 { 403 ACPI_STATUS Status; 404 ACPI_CSRT_GROUP *Subtable; 405 ACPI_CSRT_SHARED_INFO *SharedInfoTable; 406 ACPI_CSRT_DESCRIPTOR *SubSubtable; 407 UINT32 Length = Table->Length; 408 UINT32 Offset = sizeof (ACPI_TABLE_CSRT); 409 UINT32 SubOffset; 410 UINT32 SubSubOffset; 411 UINT32 InfoLength; 412 413 414 /* The main table only contains the ACPI header, thus already handled */ 415 416 /* Subtables (Resource Groups) */ 417 418 Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); 419 while (Offset < Table->Length) 420 { 421 /* Resource group subtable */ 422 423 AcpiOsPrintf ("\n"); 424 Status = AcpiDmDumpTable (Length, Offset, Subtable, 425 Subtable->Length, AcpiDmTableInfoCsrt0); 426 if (ACPI_FAILURE (Status)) 427 { 428 return; 429 } 430 431 /* Shared info subtable (One per resource group) */ 432 433 SubOffset = sizeof (ACPI_CSRT_GROUP); 434 SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table, 435 Offset + SubOffset); 436 437 AcpiOsPrintf ("\n"); 438 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable, 439 sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1); 440 if (ACPI_FAILURE (Status)) 441 { 442 return; 443 } 444 445 SubOffset += Subtable->SharedInfoLength; 446 447 /* Sub-Subtables (Resource Descriptors) */ 448 449 SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, 450 Offset + SubOffset); 451 452 while ((SubOffset < Subtable->Length) && 453 ((Offset + SubOffset) < Table->Length)) 454 { 455 AcpiOsPrintf ("\n"); 456 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable, 457 SubSubtable->Length, AcpiDmTableInfoCsrt2); 458 if (ACPI_FAILURE (Status)) 459 { 460 return; 461 } 462 463 SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR); 464 465 /* Resource-specific info buffer */ 466 467 InfoLength = SubSubtable->Length - SubSubOffset; 468 if (InfoLength) 469 { 470 Status = AcpiDmDumpTable (Length, 471 Offset + SubOffset + SubSubOffset, Table, 472 InfoLength, AcpiDmTableInfoCsrt2a); 473 if (ACPI_FAILURE (Status)) 474 { 475 return; 476 } 477 } 478 479 /* Point to next sub-subtable */ 480 481 SubOffset += SubSubtable->Length; 482 SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable, 483 SubSubtable->Length); 484 } 485 486 /* Point to next subtable */ 487 488 Offset += Subtable->Length; 489 Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, 490 Subtable->Length); 491 } 492 } 493 494 495 /******************************************************************************* 496 * 497 * FUNCTION: AcpiDmDumpDbg2 498 * 499 * PARAMETERS: Table - A DBG2 table 500 * 501 * RETURN: None 502 * 503 * DESCRIPTION: Format the contents of a DBG2. This table type consists 504 * of an open-ended number of subtables. 505 * 506 ******************************************************************************/ 507 508 void 509 AcpiDmDumpDbg2 ( 510 ACPI_TABLE_HEADER *Table) 511 { 512 ACPI_STATUS Status; 513 ACPI_DBG2_DEVICE *Subtable; 514 UINT32 Length = Table->Length; 515 UINT32 Offset = sizeof (ACPI_TABLE_DBG2); 516 UINT32 i; 517 UINT32 ArrayOffset; 518 UINT32 AbsoluteOffset; 519 UINT8 *Array; 520 521 522 /* Main table */ 523 524 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2); 525 if (ACPI_FAILURE (Status)) 526 { 527 return; 528 } 529 530 /* Subtables */ 531 532 Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); 533 while (Offset < Table->Length) 534 { 535 AcpiOsPrintf ("\n"); 536 Status = AcpiDmDumpTable (Length, Offset, Subtable, 537 Subtable->Length, AcpiDmTableInfoDbg2Device); 538 if (ACPI_FAILURE (Status)) 539 { 540 return; 541 } 542 543 /* Dump the BaseAddress array */ 544 545 for (i = 0; i < Subtable->RegisterCount; i++) 546 { 547 ArrayOffset = Subtable->BaseAddressOffset + 548 (sizeof (ACPI_GENERIC_ADDRESS) * i); 549 AbsoluteOffset = Offset + ArrayOffset; 550 Array = (UINT8 *) Subtable + ArrayOffset; 551 552 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, 553 Subtable->Length, AcpiDmTableInfoDbg2Addr); 554 if (ACPI_FAILURE (Status)) 555 { 556 return; 557 } 558 } 559 560 /* Dump the AddressSize array */ 561 562 for (i = 0; i < Subtable->RegisterCount; i++) 563 { 564 ArrayOffset = Subtable->AddressSizeOffset + 565 (sizeof (UINT32) * i); 566 AbsoluteOffset = Offset + ArrayOffset; 567 Array = (UINT8 *) Subtable + ArrayOffset; 568 569 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, 570 Subtable->Length, AcpiDmTableInfoDbg2Size); 571 if (ACPI_FAILURE (Status)) 572 { 573 return; 574 } 575 } 576 577 /* Dump the Namestring (required) */ 578 579 AcpiOsPrintf ("\n"); 580 ArrayOffset = Subtable->NamepathOffset; 581 AbsoluteOffset = Offset + ArrayOffset; 582 Array = (UINT8 *) Subtable + ArrayOffset; 583 584 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, 585 Subtable->Length, AcpiDmTableInfoDbg2Name); 586 if (ACPI_FAILURE (Status)) 587 { 588 return; 589 } 590 591 /* Dump the OemData (optional) */ 592 593 if (Subtable->OemDataOffset) 594 { 595 Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset, 596 Table, Subtable->OemDataLength, 597 AcpiDmTableInfoDbg2OemData); 598 if (ACPI_FAILURE (Status)) 599 { 600 return; 601 } 602 } 603 604 /* Point to next subtable */ 605 606 Offset += Subtable->Length; 607 Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable, 608 Subtable->Length); 609 } 610 } 611 612 613 /******************************************************************************* 614 * 615 * FUNCTION: AcpiDmDumpDmar 616 * 617 * PARAMETERS: Table - A DMAR table 618 * 619 * RETURN: None 620 * 621 * DESCRIPTION: Format the contents of a DMAR. This table type consists 622 * of an open-ended number of subtables. 623 * 624 ******************************************************************************/ 625 626 void 627 AcpiDmDumpDmar ( 628 ACPI_TABLE_HEADER *Table) 629 { 630 ACPI_STATUS Status; 631 ACPI_DMAR_HEADER *Subtable; 632 UINT32 Length = Table->Length; 633 UINT32 Offset = sizeof (ACPI_TABLE_DMAR); 634 ACPI_DMTABLE_INFO *InfoTable; 635 ACPI_DMAR_DEVICE_SCOPE *ScopeTable; 636 UINT32 ScopeOffset; 637 UINT8 *PciPath; 638 UINT32 PathOffset; 639 640 641 /* Main table */ 642 643 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); 644 if (ACPI_FAILURE (Status)) 645 { 646 return; 647 } 648 649 /* Subtables */ 650 651 Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); 652 while (Offset < Table->Length) 653 { 654 /* Common subtable header */ 655 656 AcpiOsPrintf ("\n"); 657 Status = AcpiDmDumpTable (Length, Offset, Subtable, 658 Subtable->Length, AcpiDmTableInfoDmarHdr); 659 if (ACPI_FAILURE (Status)) 660 { 661 return; 662 } 663 664 AcpiOsPrintf ("\n"); 665 666 switch (Subtable->Type) 667 { 668 case ACPI_DMAR_TYPE_HARDWARE_UNIT: 669 670 InfoTable = AcpiDmTableInfoDmar0; 671 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT); 672 break; 673 674 case ACPI_DMAR_TYPE_RESERVED_MEMORY: 675 676 InfoTable = AcpiDmTableInfoDmar1; 677 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY); 678 break; 679 680 case ACPI_DMAR_TYPE_ROOT_ATS: 681 682 InfoTable = AcpiDmTableInfoDmar2; 683 ScopeOffset = sizeof (ACPI_DMAR_ATSR); 684 break; 685 686 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY: 687 688 InfoTable = AcpiDmTableInfoDmar3; 689 ScopeOffset = sizeof (ACPI_DMAR_RHSA); 690 break; 691 692 case ACPI_DMAR_TYPE_NAMESPACE: 693 694 InfoTable = AcpiDmTableInfoDmar4; 695 ScopeOffset = sizeof (ACPI_DMAR_ANDD); 696 break; 697 698 default: 699 700 AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", 701 Subtable->Type); 702 return; 703 } 704 705 Status = AcpiDmDumpTable (Length, Offset, Subtable, 706 Subtable->Length, InfoTable); 707 if (ACPI_FAILURE (Status)) 708 { 709 return; 710 } 711 712 /* 713 * Dump the optional device scope entries 714 */ 715 if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || 716 (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE)) 717 { 718 /* These types do not support device scopes */ 719 720 goto NextSubtable; 721 } 722 723 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset); 724 while (ScopeOffset < Subtable->Length) 725 { 726 AcpiOsPrintf ("\n"); 727 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, 728 ScopeTable->Length, AcpiDmTableInfoDmarScope); 729 if (ACPI_FAILURE (Status)) 730 { 731 return; 732 } 733 AcpiOsPrintf ("\n"); 734 735 /* Dump the PCI Path entries for this device scope */ 736 737 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */ 738 739 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable, 740 sizeof (ACPI_DMAR_DEVICE_SCOPE)); 741 742 while (PathOffset < ScopeTable->Length) 743 { 744 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, 745 "PCI Path"); 746 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]); 747 748 /* Point to next PCI Path entry */ 749 750 PathOffset += 2; 751 PciPath += 2; 752 AcpiOsPrintf ("\n"); 753 } 754 755 /* Point to next device scope entry */ 756 757 ScopeOffset += ScopeTable->Length; 758 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, 759 ScopeTable, ScopeTable->Length); 760 } 761 762 NextSubtable: 763 /* Point to next subtable */ 764 765 Offset += Subtable->Length; 766 Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, 767 Subtable->Length); 768 } 769 } 770 771 772 /******************************************************************************* 773 * 774 * FUNCTION: AcpiDmDumpDrtm 775 * 776 * PARAMETERS: Table - A DRTM table 777 * 778 * RETURN: None 779 * 780 * DESCRIPTION: Format the contents of a DRTM. 781 * 782 ******************************************************************************/ 783 784 void 785 AcpiDmDumpDrtm ( 786 ACPI_TABLE_HEADER *Table) 787 { 788 ACPI_STATUS Status; 789 UINT32 Offset; 790 ACPI_DRTM_VTABLE_LIST *DrtmVtl; 791 ACPI_DRTM_RESOURCE_LIST *DrtmRl; 792 ACPI_DRTM_DPS_ID *DrtmDps; 793 UINT32 Count; 794 795 796 /* Main table */ 797 798 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, 799 AcpiDmTableInfoDrtm); 800 if (ACPI_FAILURE (Status)) 801 { 802 return; 803 } 804 805 Offset = sizeof (ACPI_TABLE_DRTM); 806 807 /* Sub-tables */ 808 809 /* Dump ValidatedTable length */ 810 811 DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset); 812 AcpiOsPrintf ("\n"); 813 Status = AcpiDmDumpTable (Table->Length, Offset, 814 DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables), 815 AcpiDmTableInfoDrtm0); 816 if (ACPI_FAILURE (Status)) 817 { 818 return; 819 } 820 821 Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables); 822 823 /* Dump Validated table addresses */ 824 825 Count = 0; 826 while ((Offset < Table->Length) && 827 (DrtmVtl->ValidatedTableCount > Count)) 828 { 829 Status = AcpiDmDumpTable (Table->Length, Offset, 830 ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64), 831 AcpiDmTableInfoDrtm0a); 832 if (ACPI_FAILURE (Status)) 833 { 834 return; 835 } 836 837 Offset += sizeof (UINT64); 838 Count++; 839 } 840 841 /* Dump ResourceList length */ 842 843 DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset); 844 AcpiOsPrintf ("\n"); 845 Status = AcpiDmDumpTable (Table->Length, Offset, 846 DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources), 847 AcpiDmTableInfoDrtm1); 848 if (ACPI_FAILURE (Status)) 849 { 850 return; 851 } 852 853 Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources); 854 855 /* Dump the Resource List */ 856 857 Count = 0; 858 while ((Offset < Table->Length) && 859 (DrtmRl->ResourceCount > Count)) 860 { 861 Status = AcpiDmDumpTable (Table->Length, Offset, 862 ACPI_ADD_PTR (void, Table, Offset), 863 sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a); 864 if (ACPI_FAILURE (Status)) 865 { 866 return; 867 } 868 869 Offset += sizeof (ACPI_DRTM_RESOURCE); 870 Count++; 871 } 872 873 /* Dump DPS */ 874 875 DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); 876 AcpiOsPrintf ("\n"); 877 (void) AcpiDmDumpTable (Table->Length, Offset, 878 DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2); 879 } 880 881 882 /******************************************************************************* 883 * 884 * FUNCTION: AcpiDmDumpEinj 885 * 886 * PARAMETERS: Table - A EINJ table 887 * 888 * RETURN: None 889 * 890 * DESCRIPTION: Format the contents of a EINJ. This table type consists 891 * of an open-ended number of subtables. 892 * 893 ******************************************************************************/ 894 895 void 896 AcpiDmDumpEinj ( 897 ACPI_TABLE_HEADER *Table) 898 { 899 ACPI_STATUS Status; 900 ACPI_WHEA_HEADER *Subtable; 901 UINT32 Length = Table->Length; 902 UINT32 Offset = sizeof (ACPI_TABLE_EINJ); 903 904 905 /* Main table */ 906 907 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); 908 if (ACPI_FAILURE (Status)) 909 { 910 return; 911 } 912 913 /* Subtables */ 914 915 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); 916 while (Offset < Table->Length) 917 { 918 AcpiOsPrintf ("\n"); 919 Status = AcpiDmDumpTable (Length, Offset, Subtable, 920 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); 921 if (ACPI_FAILURE (Status)) 922 { 923 return; 924 } 925 926 /* Point to next subtable (each subtable is of fixed length) */ 927 928 Offset += sizeof (ACPI_WHEA_HEADER); 929 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, 930 sizeof (ACPI_WHEA_HEADER)); 931 } 932 } 933 934 935 /******************************************************************************* 936 * 937 * FUNCTION: AcpiDmDumpErst 938 * 939 * PARAMETERS: Table - A ERST table 940 * 941 * RETURN: None 942 * 943 * DESCRIPTION: Format the contents of a ERST. This table type consists 944 * of an open-ended number of subtables. 945 * 946 ******************************************************************************/ 947 948 void 949 AcpiDmDumpErst ( 950 ACPI_TABLE_HEADER *Table) 951 { 952 ACPI_STATUS Status; 953 ACPI_WHEA_HEADER *Subtable; 954 UINT32 Length = Table->Length; 955 UINT32 Offset = sizeof (ACPI_TABLE_ERST); 956 957 958 /* Main table */ 959 960 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); 961 if (ACPI_FAILURE (Status)) 962 { 963 return; 964 } 965 966 /* Subtables */ 967 968 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); 969 while (Offset < Table->Length) 970 { 971 AcpiOsPrintf ("\n"); 972 Status = AcpiDmDumpTable (Length, Offset, Subtable, 973 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); 974 if (ACPI_FAILURE (Status)) 975 { 976 return; 977 } 978 979 /* Point to next subtable (each subtable is of fixed length) */ 980 981 Offset += sizeof (ACPI_WHEA_HEADER); 982 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, 983 sizeof (ACPI_WHEA_HEADER)); 984 } 985 } 986 987 988 /******************************************************************************* 989 * 990 * FUNCTION: AcpiDmDumpFpdt 991 * 992 * PARAMETERS: Table - A FPDT table 993 * 994 * RETURN: None 995 * 996 * DESCRIPTION: Format the contents of a FPDT. This table type consists 997 * of an open-ended number of subtables. 998 * 999 ******************************************************************************/ 1000 1001 void 1002 AcpiDmDumpFpdt ( 1003 ACPI_TABLE_HEADER *Table) 1004 { 1005 ACPI_STATUS Status; 1006 ACPI_FPDT_HEADER *Subtable; 1007 UINT32 Length = Table->Length; 1008 UINT32 Offset = sizeof (ACPI_TABLE_FPDT); 1009 ACPI_DMTABLE_INFO *InfoTable; 1010 1011 1012 /* There is no main table (other than the standard ACPI header) */ 1013 1014 /* Subtables */ 1015 1016 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); 1017 while (Offset < Table->Length) 1018 { 1019 /* Common subtable header */ 1020 1021 AcpiOsPrintf ("\n"); 1022 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1023 Subtable->Length, AcpiDmTableInfoFpdtHdr); 1024 if (ACPI_FAILURE (Status)) 1025 { 1026 return; 1027 } 1028 1029 switch (Subtable->Type) 1030 { 1031 case ACPI_FPDT_TYPE_BOOT: 1032 1033 InfoTable = AcpiDmTableInfoFpdt0; 1034 break; 1035 1036 case ACPI_FPDT_TYPE_S3PERF: 1037 1038 InfoTable = AcpiDmTableInfoFpdt1; 1039 break; 1040 1041 default: 1042 1043 AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", 1044 Subtable->Type); 1045 1046 /* Attempt to continue */ 1047 1048 if (!Subtable->Length) 1049 { 1050 AcpiOsPrintf ("Invalid zero length subtable\n"); 1051 return; 1052 } 1053 goto NextSubtable; 1054 } 1055 1056 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1057 Subtable->Length, InfoTable); 1058 if (ACPI_FAILURE (Status)) 1059 { 1060 return; 1061 } 1062 1063 NextSubtable: 1064 /* Point to next subtable */ 1065 1066 Offset += Subtable->Length; 1067 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, 1068 Subtable->Length); 1069 } 1070 } 1071 1072 1073 /******************************************************************************* 1074 * 1075 * FUNCTION: AcpiDmDumpGtdt 1076 * 1077 * PARAMETERS: Table - A GTDT table 1078 * 1079 * RETURN: None 1080 * 1081 * DESCRIPTION: Format the contents of a GTDT. This table type consists 1082 * of an open-ended number of subtables. 1083 * 1084 ******************************************************************************/ 1085 1086 void 1087 AcpiDmDumpGtdt ( 1088 ACPI_TABLE_HEADER *Table) 1089 { 1090 ACPI_STATUS Status; 1091 ACPI_GTDT_HEADER *Subtable; 1092 UINT32 Length = Table->Length; 1093 UINT32 Offset = sizeof (ACPI_TABLE_GTDT); 1094 ACPI_DMTABLE_INFO *InfoTable; 1095 UINT32 SubtableLength; 1096 UINT32 GtCount; 1097 ACPI_GTDT_TIMER_ENTRY *GtxTable; 1098 1099 1100 /* Main table */ 1101 1102 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt); 1103 if (ACPI_FAILURE (Status)) 1104 { 1105 return; 1106 } 1107 1108 /* Rev 3 fields */ 1109 1110 Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); 1111 1112 if (Table->Revision > 2) 1113 { 1114 SubtableLength = sizeof (ACPI_GTDT_EL2); 1115 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1116 SubtableLength, AcpiDmTableInfoGtdtEl2); 1117 if (ACPI_FAILURE (Status)) 1118 { 1119 return; 1120 } 1121 Offset += SubtableLength; 1122 } 1123 1124 Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); 1125 1126 /* Subtables */ 1127 1128 while (Offset < Table->Length) 1129 { 1130 /* Common subtable header */ 1131 1132 AcpiOsPrintf ("\n"); 1133 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1134 Subtable->Length, AcpiDmTableInfoGtdtHdr); 1135 if (ACPI_FAILURE (Status)) 1136 { 1137 return; 1138 } 1139 1140 GtCount = 0; 1141 switch (Subtable->Type) 1142 { 1143 case ACPI_GTDT_TYPE_TIMER_BLOCK: 1144 1145 SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); 1146 GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, 1147 Subtable))->TimerCount; 1148 1149 InfoTable = AcpiDmTableInfoGtdt0; 1150 break; 1151 1152 case ACPI_GTDT_TYPE_WATCHDOG: 1153 1154 SubtableLength = sizeof (ACPI_GTDT_WATCHDOG); 1155 1156 InfoTable = AcpiDmTableInfoGtdt1; 1157 break; 1158 1159 default: 1160 1161 /* Cannot continue on unknown type - no length */ 1162 1163 AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", 1164 Subtable->Type); 1165 return; 1166 } 1167 1168 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1169 Subtable->Length, InfoTable); 1170 if (ACPI_FAILURE (Status)) 1171 { 1172 return; 1173 } 1174 1175 /* Point to end of current subtable (each subtable above is of fixed length) */ 1176 1177 Offset += SubtableLength; 1178 1179 /* If there are any Gt Timer Blocks from above, dump them now */ 1180 1181 if (GtCount) 1182 { 1183 GtxTable = ACPI_ADD_PTR ( 1184 ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength); 1185 SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); 1186 1187 while (GtCount) 1188 { 1189 AcpiOsPrintf ("\n"); 1190 Status = AcpiDmDumpTable (Length, Offset, GtxTable, 1191 sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a); 1192 if (ACPI_FAILURE (Status)) 1193 { 1194 return; 1195 } 1196 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY); 1197 GtxTable++; 1198 GtCount--; 1199 } 1200 } 1201 1202 /* Point to next subtable */ 1203 1204 Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength); 1205 } 1206 } 1207 1208 1209 /******************************************************************************* 1210 * 1211 * FUNCTION: AcpiDmDumpHest 1212 * 1213 * PARAMETERS: Table - A HEST table 1214 * 1215 * RETURN: None 1216 * 1217 * DESCRIPTION: Format the contents of a HEST. This table type consists 1218 * of an open-ended number of subtables. 1219 * 1220 ******************************************************************************/ 1221 1222 void 1223 AcpiDmDumpHest ( 1224 ACPI_TABLE_HEADER *Table) 1225 { 1226 ACPI_STATUS Status; 1227 ACPI_HEST_HEADER *Subtable; 1228 UINT32 Length = Table->Length; 1229 UINT32 Offset = sizeof (ACPI_TABLE_HEST); 1230 ACPI_DMTABLE_INFO *InfoTable; 1231 UINT32 SubtableLength; 1232 UINT32 BankCount; 1233 ACPI_HEST_IA_ERROR_BANK *BankTable; 1234 1235 1236 /* Main table */ 1237 1238 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); 1239 if (ACPI_FAILURE (Status)) 1240 { 1241 return; 1242 } 1243 1244 /* Subtables */ 1245 1246 Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); 1247 while (Offset < Table->Length) 1248 { 1249 BankCount = 0; 1250 switch (Subtable->Type) 1251 { 1252 case ACPI_HEST_TYPE_IA32_CHECK: 1253 1254 InfoTable = AcpiDmTableInfoHest0; 1255 SubtableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); 1256 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, 1257 Subtable))->NumHardwareBanks; 1258 break; 1259 1260 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: 1261 1262 InfoTable = AcpiDmTableInfoHest1; 1263 SubtableLength = sizeof (ACPI_HEST_IA_CORRECTED); 1264 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, 1265 Subtable))->NumHardwareBanks; 1266 break; 1267 1268 case ACPI_HEST_TYPE_IA32_NMI: 1269 1270 InfoTable = AcpiDmTableInfoHest2; 1271 SubtableLength = sizeof (ACPI_HEST_IA_NMI); 1272 break; 1273 1274 case ACPI_HEST_TYPE_AER_ROOT_PORT: 1275 1276 InfoTable = AcpiDmTableInfoHest6; 1277 SubtableLength = sizeof (ACPI_HEST_AER_ROOT); 1278 break; 1279 1280 case ACPI_HEST_TYPE_AER_ENDPOINT: 1281 1282 InfoTable = AcpiDmTableInfoHest7; 1283 SubtableLength = sizeof (ACPI_HEST_AER); 1284 break; 1285 1286 case ACPI_HEST_TYPE_AER_BRIDGE: 1287 1288 InfoTable = AcpiDmTableInfoHest8; 1289 SubtableLength = sizeof (ACPI_HEST_AER_BRIDGE); 1290 break; 1291 1292 case ACPI_HEST_TYPE_GENERIC_ERROR: 1293 1294 InfoTable = AcpiDmTableInfoHest9; 1295 SubtableLength = sizeof (ACPI_HEST_GENERIC); 1296 break; 1297 1298 case ACPI_HEST_TYPE_GENERIC_ERROR_V2: 1299 1300 InfoTable = AcpiDmTableInfoHest10; 1301 SubtableLength = sizeof (ACPI_HEST_GENERIC_V2); 1302 break; 1303 1304 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: 1305 1306 InfoTable = AcpiDmTableInfoHest11; 1307 SubtableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK); 1308 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK, 1309 Subtable))->NumHardwareBanks; 1310 break; 1311 1312 default: 1313 1314 /* Cannot continue on unknown type - no length */ 1315 1316 AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", 1317 Subtable->Type); 1318 return; 1319 } 1320 1321 AcpiOsPrintf ("\n"); 1322 Status = AcpiDmDumpTable (Length, Offset, Subtable, 1323 SubtableLength, InfoTable); 1324 if (ACPI_FAILURE (Status)) 1325 { 1326 return; 1327 } 1328 1329 /* Point to end of current subtable (each subtable above is of fixed length) */ 1330 1331 Offset += SubtableLength; 1332 1333 /* If there are any (fixed-length) Error Banks from above, dump them now */ 1334 1335 if (BankCount) 1336 { 1337 BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, Subtable, 1338 SubtableLength); 1339 SubtableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); 1340 1341 while (BankCount) 1342 { 1343 AcpiOsPrintf ("\n"); 1344 Status = AcpiDmDumpTable (Length, Offset, BankTable, 1345 sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); 1346 if (ACPI_FAILURE (Status)) 1347 { 1348 return; 1349 } 1350 1351 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); 1352 BankTable++; 1353 BankCount--; 1354 } 1355 } 1356 1357 /* Point to next subtable */ 1358 1359 Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Subtable, SubtableLength); 1360 } 1361 } 1362 1363 1364 /******************************************************************************* 1365 * 1366 * FUNCTION: AcpiDmDumpHmat 1367 * 1368 * PARAMETERS: Table - A HMAT table 1369 * 1370 * RETURN: None 1371 * 1372 * DESCRIPTION: Format the contents of a HMAT. 1373 * 1374 ******************************************************************************/ 1375 1376 void 1377 AcpiDmDumpHmat ( 1378 ACPI_TABLE_HEADER *Table) 1379 { 1380 ACPI_STATUS Status; 1381 ACPI_HMAT_STRUCTURE *HmatStruct; 1382 ACPI_HMAT_LOCALITY *HmatLocality; 1383 ACPI_HMAT_CACHE *HmatCache; 1384 UINT32 Offset; 1385 UINT32 SubtableOffset; 1386 UINT32 Length; 1387 ACPI_DMTABLE_INFO *InfoTable; 1388 UINT32 i, j; 1389 1390 1391 /* Main table */ 1392 1393 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat); 1394 if (ACPI_FAILURE (Status)) 1395 { 1396 return; 1397 } 1398 Offset = sizeof (ACPI_TABLE_HMAT); 1399 1400 while (Offset < Table->Length) 1401 { 1402 AcpiOsPrintf ("\n"); 1403 1404 /* Dump HMAT structure header */ 1405 1406 HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset); 1407 if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE)) 1408 { 1409 AcpiOsPrintf ("Invalid HMAT structure length\n"); 1410 return; 1411 } 1412 Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct, 1413 HmatStruct->Length, AcpiDmTableInfoHmatHdr); 1414 if (ACPI_FAILURE (Status)) 1415 { 1416 return; 1417 } 1418 1419 switch (HmatStruct->Type) 1420 { 1421 case ACPI_HMAT_TYPE_ADDRESS_RANGE: 1422 1423 InfoTable = AcpiDmTableInfoHmat0; 1424 Length = sizeof (ACPI_HMAT_PROXIMITY_DOMAIN); 1425 break; 1426 1427 case ACPI_HMAT_TYPE_LOCALITY: 1428 1429 InfoTable = AcpiDmTableInfoHmat1; 1430 Length = sizeof (ACPI_HMAT_LOCALITY); 1431 break; 1432 1433 case ACPI_HMAT_TYPE_CACHE: 1434 1435 InfoTable = AcpiDmTableInfoHmat2; 1436 Length = sizeof (ACPI_HMAT_CACHE); 1437 break; 1438 1439 default: 1440 1441 AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n", 1442 HmatStruct->Type); 1443 1444 /* Attempt to continue */ 1445 1446 goto NextSubtable; 1447 } 1448 1449 /* Dump HMAT structure body */ 1450 1451 if (HmatStruct->Length < Length) 1452 { 1453 AcpiOsPrintf ("Invalid HMAT structure length\n"); 1454 return; 1455 } 1456 Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct, 1457 HmatStruct->Length, InfoTable); 1458 if (ACPI_FAILURE (Status)) 1459 { 1460 return; 1461 } 1462 1463 /* Dump HMAT structure additionals */ 1464 1465 switch (HmatStruct->Type) 1466 { 1467 case ACPI_HMAT_TYPE_LOCALITY: 1468 1469 HmatLocality = ACPI_CAST_PTR (ACPI_HMAT_LOCALITY, HmatStruct); 1470 SubtableOffset = sizeof (ACPI_HMAT_LOCALITY); 1471 1472 /* Dump initiator proximity domains */ 1473 1474 if ((UINT32)(HmatStruct->Length - SubtableOffset) < 1475 (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4)) 1476 { 1477 AcpiOsPrintf ("Invalid initiator proximity domain number\n"); 1478 return; 1479 } 1480 for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++) 1481 { 1482 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, 1483 ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 1484 4, AcpiDmTableInfoHmat1a); 1485 if (ACPI_FAILURE (Status)) 1486 { 1487 return; 1488 } 1489 1490 SubtableOffset += 4; 1491 } 1492 1493 /* Dump target proximity domains */ 1494 1495 if ((UINT32)(HmatStruct->Length - SubtableOffset) < 1496 (UINT32)(HmatLocality->NumberOfTargetPDs * 4)) 1497 { 1498 AcpiOsPrintf ("Invalid target proximity domain number\n"); 1499 return; 1500 } 1501 for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++) 1502 { 1503 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, 1504 ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 1505 4, AcpiDmTableInfoHmat1b); 1506 if (ACPI_FAILURE (Status)) 1507 { 1508 return; 1509 } 1510 1511 SubtableOffset += 4; 1512 } 1513 1514 /* Dump latency/bandwidth entris */ 1515 1516 if ((UINT32)(HmatStruct->Length - SubtableOffset) < 1517 (UINT32)(HmatLocality->NumberOfInitiatorPDs * 1518 HmatLocality->NumberOfTargetPDs * 2)) 1519 { 1520 AcpiOsPrintf ("Invalid latency/bandwidth entry number\n"); 1521 return; 1522 } 1523 for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++) 1524 { 1525 for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++) 1526 { 1527 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, 1528 ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 1529 2, AcpiDmTableInfoHmat1c); 1530 if (ACPI_FAILURE(Status)) 1531 { 1532 return; 1533 } 1534 1535 SubtableOffset += 2; 1536 } 1537 } 1538 break; 1539 1540 case ACPI_HMAT_TYPE_CACHE: 1541 1542 HmatCache = ACPI_CAST_PTR (ACPI_HMAT_CACHE, HmatStruct); 1543 SubtableOffset = sizeof (ACPI_HMAT_CACHE); 1544 1545 /* Dump SMBIOS handles */ 1546 1547 if ((UINT32)(HmatStruct->Length - SubtableOffset) < 1548 (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2)) 1549 { 1550 AcpiOsPrintf ("Invalid SMBIOS handle number\n"); 1551 return; 1552 } 1553 for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++) 1554 { 1555 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, 1556 ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 1557 2, AcpiDmTableInfoHmat2a); 1558 if (ACPI_FAILURE (Status)) 1559 { 1560 return; 1561 } 1562 1563 SubtableOffset += 2; 1564 } 1565 break; 1566 1567 default: 1568 1569 break; 1570 } 1571 1572 NextSubtable: 1573 /* Point to next HMAT structure subtable */ 1574 1575 Offset += (HmatStruct->Length); 1576 } 1577 } 1578