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 "acpi.h"
  45 #include "accommon.h"
  46 #include "acdisasm.h"
  47 #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         if (SubTable->OemDataOffset)
 813         {
 814             AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength,
 815                 Offset + SubTable->OemDataOffset, "OEM Data");
 816         }
 817 
 818         /* Point to next sub-table */
 819 
 820         Offset += SubTable->Length;
 821         SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
 822                     SubTable->Length);
 823     }
 824 }
 825 
 826 
 827 /*******************************************************************************
 828  *
 829  * FUNCTION:    AcpiDmDumpDmar
 830  *
 831  * PARAMETERS:  Table               - A DMAR table
 832  *
 833  * RETURN:      None
 834  *
 835  * DESCRIPTION: Format the contents of a DMAR. This table type consists
 836  *              of an open-ended number of subtables.
 837  *
 838  ******************************************************************************/
 839 
 840 
 841 void
 842 AcpiDmDumpDmar (
 843     ACPI_TABLE_HEADER       *Table)
 844 {
 845     ACPI_STATUS             Status;
 846     ACPI_DMAR_HEADER        *SubTable;
 847     UINT32                  Length = Table->Length;
 848     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
 849     ACPI_DMTABLE_INFO       *InfoTable;
 850     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
 851     UINT32                  ScopeOffset;
 852     UINT8                   *PciPath;
 853     UINT32                  PathOffset;
 854 
 855 
 856     /* Main table */
 857 
 858     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
 859     if (ACPI_FAILURE (Status))
 860     {
 861         return;
 862     }
 863 
 864     /* Sub-tables */
 865 
 866     SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
 867     while (Offset < Table->Length)
 868     {
 869         /* Common sub-table header */
 870 
 871         AcpiOsPrintf ("\n");
 872         Status = AcpiDmDumpTable (Length, Offset, SubTable,
 873                     SubTable->Length, AcpiDmTableInfoDmarHdr);
 874         if (ACPI_FAILURE (Status))
 875         {
 876             return;
 877         }
 878         AcpiOsPrintf ("\n");
 879 
 880         switch (SubTable->Type)
 881         {
 882         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
 883 
 884             InfoTable = AcpiDmTableInfoDmar0;
 885             ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
 886             break;
 887 
 888         case ACPI_DMAR_TYPE_RESERVED_MEMORY:
 889 
 890             InfoTable = AcpiDmTableInfoDmar1;
 891             ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
 892             break;
 893 
 894         case ACPI_DMAR_TYPE_ATSR:
 895 
 896             InfoTable = AcpiDmTableInfoDmar2;
 897             ScopeOffset = sizeof (ACPI_DMAR_ATSR);
 898             break;
 899 
 900         case ACPI_DMAR_HARDWARE_AFFINITY:
 901 
 902             InfoTable = AcpiDmTableInfoDmar3;
 903             ScopeOffset = sizeof (ACPI_DMAR_RHSA);
 904             break;
 905 
 906         default:
 907 
 908             AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type);
 909             return;
 910         }
 911 
 912         Status = AcpiDmDumpTable (Length, Offset, SubTable,
 913                     SubTable->Length, InfoTable);
 914         if (ACPI_FAILURE (Status))
 915         {
 916             return;
 917         }
 918 
 919         /* Dump the device scope entries (if any) */
 920 
 921         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
 922         while (ScopeOffset < SubTable->Length)
 923         {
 924             AcpiOsPrintf ("\n");
 925             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
 926                         ScopeTable->Length, AcpiDmTableInfoDmarScope);
 927             if (ACPI_FAILURE (Status))
 928             {
 929                 return;
 930             }
 931             AcpiOsPrintf ("\n");
 932 
 933             /* Dump the PCI Path entries for this device scope */
 934 
 935             PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
 936 
 937             PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
 938                 sizeof (ACPI_DMAR_DEVICE_SCOPE));
 939 
 940             while (PathOffset < ScopeTable->Length)
 941             {
 942                 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
 943                 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
 944 
 945                 /* Point to next PCI Path entry */
 946 
 947                 PathOffset += 2;
 948                 PciPath += 2;
 949                 AcpiOsPrintf ("\n");
 950             }
 951 
 952             /* Point to next device scope entry */
 953 
 954             ScopeOffset += ScopeTable->Length;
 955             ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
 956                 ScopeTable, ScopeTable->Length);
 957         }
 958 
 959         /* Point to next sub-table */
 960 
 961         Offset += SubTable->Length;
 962         SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
 963     }
 964 }
 965 
 966 
 967 /*******************************************************************************
 968  *
 969  * FUNCTION:    AcpiDmDumpEinj
 970  *
 971  * PARAMETERS:  Table               - A EINJ table
 972  *
 973  * RETURN:      None
 974  *
 975  * DESCRIPTION: Format the contents of a EINJ. This table type consists
 976  *              of an open-ended number of subtables.
 977  *
 978  ******************************************************************************/
 979 
 980 void
 981 AcpiDmDumpEinj (
 982     ACPI_TABLE_HEADER       *Table)
 983 {
 984     ACPI_STATUS             Status;
 985     ACPI_WHEA_HEADER        *SubTable;
 986     UINT32                  Length = Table->Length;
 987     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
 988 
 989 
 990     /* Main table */
 991 
 992     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
 993     if (ACPI_FAILURE (Status))
 994     {
 995         return;
 996     }
 997 
 998     /* Sub-tables */
 999 
1000     SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1001     while (Offset < Table->Length)
1002     {
1003         AcpiOsPrintf ("\n");
1004         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1005                     sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1006         if (ACPI_FAILURE (Status))
1007         {
1008             return;
1009         }
1010 
1011         /* Point to next sub-table (each subtable is of fixed length) */
1012 
1013         Offset += sizeof (ACPI_WHEA_HEADER);
1014         SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1015                         sizeof (ACPI_WHEA_HEADER));
1016     }
1017 }
1018 
1019 
1020 /*******************************************************************************
1021  *
1022  * FUNCTION:    AcpiDmDumpErst
1023  *
1024  * PARAMETERS:  Table               - A ERST table
1025  *
1026  * RETURN:      None
1027  *
1028  * DESCRIPTION: Format the contents of a ERST. This table type consists
1029  *              of an open-ended number of subtables.
1030  *
1031  ******************************************************************************/
1032 
1033 void
1034 AcpiDmDumpErst (
1035     ACPI_TABLE_HEADER       *Table)
1036 {
1037     ACPI_STATUS             Status;
1038     ACPI_WHEA_HEADER        *SubTable;
1039     UINT32                  Length = Table->Length;
1040     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
1041 
1042 
1043     /* Main table */
1044 
1045     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1046     if (ACPI_FAILURE (Status))
1047     {
1048         return;
1049     }
1050 
1051     /* Sub-tables */
1052 
1053     SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1054     while (Offset < Table->Length)
1055     {
1056         AcpiOsPrintf ("\n");
1057         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1058                     sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1059         if (ACPI_FAILURE (Status))
1060         {
1061             return;
1062         }
1063 
1064         /* Point to next sub-table (each subtable is of fixed length) */
1065 
1066         Offset += sizeof (ACPI_WHEA_HEADER);
1067         SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1068                         sizeof (ACPI_WHEA_HEADER));
1069     }
1070 }
1071 
1072 
1073 /*******************************************************************************
1074  *
1075  * FUNCTION:    AcpiDmDumpFpdt
1076  *
1077  * PARAMETERS:  Table               - A FPDT table
1078  *
1079  * RETURN:      None
1080  *
1081  * DESCRIPTION: Format the contents of a FPDT. This table type consists
1082  *              of an open-ended number of subtables.
1083  *
1084  ******************************************************************************/
1085 
1086 void
1087 AcpiDmDumpFpdt (
1088     ACPI_TABLE_HEADER       *Table)
1089 {
1090     ACPI_STATUS             Status;
1091     ACPI_FPDT_HEADER        *SubTable;
1092     UINT32                  Length = Table->Length;
1093     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
1094     ACPI_DMTABLE_INFO       *InfoTable;
1095 
1096 
1097     /* There is no main table (other than the standard ACPI header) */
1098 
1099     /* Sub-tables */
1100 
1101     SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1102     while (Offset < Table->Length)
1103     {
1104         /* Common sub-table header */
1105 
1106         AcpiOsPrintf ("\n");
1107         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1108                     SubTable->Length, AcpiDmTableInfoFpdtHdr);
1109         if (ACPI_FAILURE (Status))
1110         {
1111             return;
1112         }
1113 
1114         switch (SubTable->Type)
1115         {
1116         case ACPI_FPDT_TYPE_BOOT:
1117 
1118             InfoTable = AcpiDmTableInfoFpdt0;
1119             break;
1120 
1121         case ACPI_FPDT_TYPE_S3PERF:
1122 
1123             InfoTable = AcpiDmTableInfoFpdt1;
1124             break;
1125 
1126         default:
1127 
1128             AcpiOsPrintf ("\n**** Unknown FPDT sub-table type 0x%X\n\n", SubTable->Type);
1129 
1130             /* Attempt to continue */
1131 
1132             if (!SubTable->Length)
1133             {
1134                 AcpiOsPrintf ("Invalid zero length subtable\n");
1135                 return;
1136             }
1137             goto NextSubTable;
1138         }
1139 
1140         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1141                     SubTable->Length, InfoTable);
1142         if (ACPI_FAILURE (Status))
1143         {
1144             return;
1145         }
1146 
1147 NextSubTable:
1148         /* Point to next sub-table */
1149 
1150         Offset += SubTable->Length;
1151         SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
1152     }
1153 }
1154 
1155 
1156 /*******************************************************************************
1157  *
1158  * FUNCTION:    AcpiDmDumpHest
1159  *
1160  * PARAMETERS:  Table               - A HEST table
1161  *
1162  * RETURN:      None
1163  *
1164  * DESCRIPTION: Format the contents of a HEST. This table type consists
1165  *              of an open-ended number of subtables.
1166  *
1167  ******************************************************************************/
1168 
1169 void
1170 AcpiDmDumpHest (
1171     ACPI_TABLE_HEADER       *Table)
1172 {
1173     ACPI_STATUS             Status;
1174     ACPI_HEST_HEADER        *SubTable;
1175     UINT32                  Length = Table->Length;
1176     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
1177     ACPI_DMTABLE_INFO       *InfoTable;
1178     UINT32                  SubTableLength;
1179     UINT32                  BankCount;
1180     ACPI_HEST_IA_ERROR_BANK *BankTable;
1181 
1182 
1183     /* Main table */
1184 
1185     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1186     if (ACPI_FAILURE (Status))
1187     {
1188         return;
1189     }
1190 
1191     /* Sub-tables */
1192 
1193     SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1194     while (Offset < Table->Length)
1195     {
1196         BankCount = 0;
1197         switch (SubTable->Type)
1198         {
1199         case ACPI_HEST_TYPE_IA32_CHECK:
1200 
1201             InfoTable = AcpiDmTableInfoHest0;
1202             SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1203             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1204                             SubTable))->NumHardwareBanks;
1205             break;
1206 
1207         case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1208 
1209             InfoTable = AcpiDmTableInfoHest1;
1210             SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1211             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1212                             SubTable))->NumHardwareBanks;
1213             break;
1214 
1215         case ACPI_HEST_TYPE_IA32_NMI:
1216 
1217             InfoTable = AcpiDmTableInfoHest2;
1218             SubTableLength = sizeof (ACPI_HEST_IA_NMI);
1219             break;
1220 
1221         case ACPI_HEST_TYPE_AER_ROOT_PORT:
1222 
1223             InfoTable = AcpiDmTableInfoHest6;
1224             SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
1225             break;
1226 
1227         case ACPI_HEST_TYPE_AER_ENDPOINT:
1228 
1229             InfoTable = AcpiDmTableInfoHest7;
1230             SubTableLength = sizeof (ACPI_HEST_AER);
1231             break;
1232 
1233         case ACPI_HEST_TYPE_AER_BRIDGE:
1234 
1235             InfoTable = AcpiDmTableInfoHest8;
1236             SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1237             break;
1238 
1239         case ACPI_HEST_TYPE_GENERIC_ERROR:
1240 
1241             InfoTable = AcpiDmTableInfoHest9;
1242             SubTableLength = sizeof (ACPI_HEST_GENERIC);
1243             break;
1244 
1245         default:
1246 
1247             /* Cannot continue on unknown type - no length */
1248 
1249             AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type);
1250             return;
1251         }
1252 
1253         AcpiOsPrintf ("\n");
1254         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1255                     SubTableLength, InfoTable);
1256         if (ACPI_FAILURE (Status))
1257         {
1258             return;
1259         }
1260 
1261         /* Point to end of current subtable (each subtable above is of fixed length) */
1262 
1263         Offset += SubTableLength;
1264 
1265         /* If there are any (fixed-length) Error Banks from above, dump them now */
1266 
1267         if (BankCount)
1268         {
1269             BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
1270             SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1271 
1272             while (BankCount)
1273             {
1274                 AcpiOsPrintf ("\n");
1275                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1276                             sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1277                 if (ACPI_FAILURE (Status))
1278                 {
1279                     return;
1280                 }
1281                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1282                 BankTable++;
1283                 BankCount--;
1284             }
1285         }
1286 
1287         /* Point to next sub-table */
1288 
1289         SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
1290     }
1291 }
1292 
1293 
1294 /*******************************************************************************
1295  *
1296  * FUNCTION:    AcpiDmDumpIvrs
1297  *
1298  * PARAMETERS:  Table               - A IVRS table
1299  *
1300  * RETURN:      None
1301  *
1302  * DESCRIPTION: Format the contents of a IVRS
1303  *
1304  ******************************************************************************/
1305 
1306 static UINT8 EntrySizes[] = {4,8,16,32};
1307 
1308 void
1309 AcpiDmDumpIvrs (
1310     ACPI_TABLE_HEADER       *Table)
1311 {
1312     ACPI_STATUS             Status;
1313     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
1314     UINT32                  EntryOffset;
1315     UINT32                  EntryLength;
1316     UINT32                  EntryType;
1317     ACPI_IVRS_DE_HEADER     *DeviceEntry;
1318     ACPI_IVRS_HEADER        *SubTable;
1319     ACPI_DMTABLE_INFO       *InfoTable;
1320 
1321 
1322     /* Main table */
1323 
1324     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
1325     if (ACPI_FAILURE (Status))
1326     {
1327         return;
1328     }
1329 
1330     /* Sub-tables */
1331 
1332     SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
1333     while (Offset < Table->Length)
1334     {
1335         /* Common sub-table header */
1336 
1337         AcpiOsPrintf ("\n");
1338         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1339                     SubTable->Length, AcpiDmTableInfoIvrsHdr);
1340         if (ACPI_FAILURE (Status))
1341         {
1342             return;
1343         }
1344 
1345         switch (SubTable->Type)
1346         {
1347         case ACPI_IVRS_TYPE_HARDWARE:
1348 
1349             InfoTable = AcpiDmTableInfoIvrs0;
1350             break;
1351 
1352         case ACPI_IVRS_TYPE_MEMORY1:
1353         case ACPI_IVRS_TYPE_MEMORY2:
1354         case ACPI_IVRS_TYPE_MEMORY3:
1355 
1356             InfoTable = AcpiDmTableInfoIvrs1;
1357             break;
1358 
1359         default:
1360 
1361             AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n",
1362                 SubTable->Type);
1363 
1364             /* Attempt to continue */
1365 
1366             if (!SubTable->Length)
1367             {
1368                 AcpiOsPrintf ("Invalid zero length subtable\n");
1369                 return;
1370             }
1371             goto NextSubTable;
1372         }
1373 
1374         /* Dump the subtable */
1375 
1376         AcpiOsPrintf ("\n");
1377         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1378                     SubTable->Length, InfoTable);
1379         if (ACPI_FAILURE (Status))
1380         {
1381             return;
1382         }
1383 
1384         /* The hardware subtable can contain multiple device entries */
1385 
1386         if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
1387         {
1388             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
1389             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
1390                             sizeof (ACPI_IVRS_HARDWARE));
1391 
1392             while (EntryOffset < (Offset + SubTable->Length))
1393             {
1394                 AcpiOsPrintf ("\n");
1395                 /*
1396                  * Upper 2 bits of Type encode the length of the device entry
1397                  *
1398                  * 00 = 4 byte
1399                  * 01 = 8 byte
1400                  * 10 = 16 byte - currently no entries defined
1401                  * 11 = 32 byte - currently no entries defined
1402                  */
1403                 EntryType = DeviceEntry->Type;
1404                 EntryLength = EntrySizes [EntryType >> 6];
1405 
1406                 switch (EntryType)
1407                 {
1408                 /* 4-byte device entries */
1409 
1410                 case ACPI_IVRS_TYPE_PAD4:
1411                 case ACPI_IVRS_TYPE_ALL:
1412                 case ACPI_IVRS_TYPE_SELECT:
1413                 case ACPI_IVRS_TYPE_START:
1414                 case ACPI_IVRS_TYPE_END:
1415 
1416                     InfoTable = AcpiDmTableInfoIvrs4;
1417                     break;
1418 
1419                 /* 8-byte entries, type A */
1420 
1421                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
1422                 case ACPI_IVRS_TYPE_ALIAS_START:
1423 
1424                     InfoTable = AcpiDmTableInfoIvrs8a;
1425                     break;
1426 
1427                 /* 8-byte entries, type B */
1428 
1429                 case ACPI_IVRS_TYPE_PAD8:
1430                 case ACPI_IVRS_TYPE_EXT_SELECT:
1431                 case ACPI_IVRS_TYPE_EXT_START:
1432 
1433                     InfoTable = AcpiDmTableInfoIvrs8b;
1434                     break;
1435 
1436                 /* 8-byte entries, type C */
1437 
1438                 case ACPI_IVRS_TYPE_SPECIAL:
1439 
1440                     InfoTable = AcpiDmTableInfoIvrs8c;
1441                     break;
1442 
1443                 default:
1444                     InfoTable = AcpiDmTableInfoIvrs4;
1445                     AcpiOsPrintf (
1446                         "\n**** Unknown IVRS device entry type/length: "
1447                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
1448                         EntryType, EntryLength, EntryOffset);
1449                     break;
1450                 }
1451 
1452                 /* Dump the Device Entry */
1453 
1454                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
1455                             DeviceEntry, EntryLength, InfoTable);
1456 
1457                 EntryOffset += EntryLength;
1458                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
1459                                 EntryLength);
1460             }
1461         }
1462 
1463 NextSubTable:
1464         /* Point to next sub-table */
1465 
1466         Offset += SubTable->Length;
1467         SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
1468     }
1469 }
1470 
1471 
1472 /*******************************************************************************
1473  *
1474  * FUNCTION:    AcpiDmDumpMadt
1475  *
1476  * PARAMETERS:  Table               - A MADT table
1477  *
1478  * RETURN:      None
1479  *
1480  * DESCRIPTION: Format the contents of a MADT. This table type consists
1481  *              of an open-ended number of subtables.
1482  *
1483  ******************************************************************************/
1484 
1485 void
1486 AcpiDmDumpMadt (
1487     ACPI_TABLE_HEADER       *Table)
1488 {
1489     ACPI_STATUS             Status;
1490     ACPI_SUBTABLE_HEADER    *SubTable;
1491     UINT32                  Length = Table->Length;
1492     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
1493     ACPI_DMTABLE_INFO       *InfoTable;
1494 
1495 
1496     /* Main table */
1497 
1498     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
1499     if (ACPI_FAILURE (Status))
1500     {
1501         return;
1502     }
1503 
1504     /* Sub-tables */
1505 
1506     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1507     while (Offset < Table->Length)
1508     {
1509         /* Common sub-table header */
1510 
1511         AcpiOsPrintf ("\n");
1512         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1513                     SubTable->Length, AcpiDmTableInfoMadtHdr);
1514         if (ACPI_FAILURE (Status))
1515         {
1516             return;
1517         }
1518 
1519         switch (SubTable->Type)
1520         {
1521         case ACPI_MADT_TYPE_LOCAL_APIC:
1522 
1523             InfoTable = AcpiDmTableInfoMadt0;
1524             break;
1525 
1526         case ACPI_MADT_TYPE_IO_APIC:
1527 
1528             InfoTable = AcpiDmTableInfoMadt1;
1529             break;
1530 
1531         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
1532 
1533             InfoTable = AcpiDmTableInfoMadt2;
1534             break;
1535 
1536         case ACPI_MADT_TYPE_NMI_SOURCE:
1537 
1538             InfoTable = AcpiDmTableInfoMadt3;
1539             break;
1540 
1541         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
1542 
1543             InfoTable = AcpiDmTableInfoMadt4;
1544             break;
1545 
1546         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
1547 
1548             InfoTable = AcpiDmTableInfoMadt5;
1549             break;
1550 
1551         case ACPI_MADT_TYPE_IO_SAPIC:
1552 
1553             InfoTable = AcpiDmTableInfoMadt6;
1554             break;
1555 
1556         case ACPI_MADT_TYPE_LOCAL_SAPIC:
1557 
1558             InfoTable = AcpiDmTableInfoMadt7;
1559             break;
1560 
1561         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
1562 
1563             InfoTable = AcpiDmTableInfoMadt8;
1564             break;
1565 
1566         case ACPI_MADT_TYPE_LOCAL_X2APIC:
1567 
1568             InfoTable = AcpiDmTableInfoMadt9;
1569             break;
1570 
1571         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
1572 
1573             InfoTable = AcpiDmTableInfoMadt10;
1574             break;
1575 
1576         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
1577 
1578             InfoTable = AcpiDmTableInfoMadt11;
1579             break;
1580 
1581         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
1582 
1583             InfoTable = AcpiDmTableInfoMadt12;
1584             break;
1585 
1586         default:
1587 
1588             AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type);
1589 
1590             /* Attempt to continue */
1591 
1592             if (!SubTable->Length)
1593             {
1594                 AcpiOsPrintf ("Invalid zero length subtable\n");
1595                 return;
1596             }
1597             goto NextSubTable;
1598         }
1599 
1600         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1601                     SubTable->Length, InfoTable);
1602         if (ACPI_FAILURE (Status))
1603         {
1604             return;
1605         }
1606 
1607 NextSubTable:
1608         /* Point to next sub-table */
1609 
1610         Offset += SubTable->Length;
1611         SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1612     }
1613 }
1614 
1615 
1616 /*******************************************************************************
1617  *
1618  * FUNCTION:    AcpiDmDumpMcfg
1619  *
1620  * PARAMETERS:  Table               - A MCFG Table
1621  *
1622  * RETURN:      None
1623  *
1624  * DESCRIPTION: Format the contents of a MCFG table
1625  *
1626  ******************************************************************************/
1627 
1628 void
1629 AcpiDmDumpMcfg (
1630     ACPI_TABLE_HEADER       *Table)
1631 {
1632     ACPI_STATUS             Status;
1633     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
1634     ACPI_MCFG_ALLOCATION    *SubTable;
1635 
1636 
1637     /* Main table */
1638 
1639     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1640     if (ACPI_FAILURE (Status))
1641     {
1642         return;
1643     }
1644 
1645     /* Sub-tables */
1646 
1647     SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1648     while (Offset < Table->Length)
1649     {
1650         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1651         {
1652             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1653                 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1654             return;
1655         }
1656 
1657         AcpiOsPrintf ("\n");
1658         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1659                     sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1660         if (ACPI_FAILURE (Status))
1661         {
1662             return;
1663         }
1664 
1665         /* Point to next sub-table (each subtable is of fixed length) */
1666 
1667         Offset += sizeof (ACPI_MCFG_ALLOCATION);
1668         SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
1669                         sizeof (ACPI_MCFG_ALLOCATION));
1670     }
1671 }
1672 
1673 
1674 /*******************************************************************************
1675  *
1676  * FUNCTION:    AcpiDmDumpMpst
1677  *
1678  * PARAMETERS:  Table               - A MPST Table
1679  *
1680  * RETURN:      None
1681  *
1682  * DESCRIPTION: Format the contents of a MPST table
1683  *
1684  ******************************************************************************/
1685 
1686 void
1687 AcpiDmDumpMpst (
1688     ACPI_TABLE_HEADER       *Table)
1689 {
1690     ACPI_STATUS             Status;
1691     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
1692     ACPI_MPST_POWER_NODE    *SubTable0;
1693     ACPI_MPST_POWER_STATE   *SubTable0A;
1694     ACPI_MPST_COMPONENT     *SubTable0B;
1695     ACPI_MPST_DATA_HDR      *SubTable1;
1696     ACPI_MPST_POWER_DATA    *SubTable2;
1697     UINT16                  SubtableCount;
1698     UINT32                  PowerStateCount;
1699     UINT32                  ComponentCount;
1700 
1701 
1702     /* Main table */
1703 
1704     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1705     if (ACPI_FAILURE (Status))
1706     {
1707         return;
1708     }
1709 
1710     /* Subtable: Memory Power Node(s) */
1711 
1712     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1713     SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1714 
1715     while ((Offset < Table->Length) && SubtableCount)
1716     {
1717         AcpiOsPrintf ("\n");
1718         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
1719                     sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1720         if (ACPI_FAILURE (Status))
1721         {
1722             return;
1723         }
1724 
1725         /* Extract the sub-subtable counts */
1726 
1727         PowerStateCount = SubTable0->NumPowerStates;
1728         ComponentCount = SubTable0->NumPhysicalComponents;
1729         Offset += sizeof (ACPI_MPST_POWER_NODE);
1730 
1731         /* Sub-subtables - Memory Power State Structure(s) */
1732 
1733         SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
1734             sizeof (ACPI_MPST_POWER_NODE));
1735 
1736         while (PowerStateCount)
1737         {
1738             AcpiOsPrintf ("\n");
1739             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
1740                         sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1741             if (ACPI_FAILURE (Status))
1742             {
1743                 return;
1744             }
1745 
1746             SubTable0A++;
1747             PowerStateCount--;
1748             Offset += sizeof (ACPI_MPST_POWER_STATE);
1749        }
1750 
1751         /* Sub-subtables - Physical Component ID Structure(s) */
1752 
1753         SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
1754 
1755         if (ComponentCount)
1756         {
1757             AcpiOsPrintf ("\n");
1758         }
1759 
1760         while (ComponentCount)
1761         {
1762             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
1763                         sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1764             if (ACPI_FAILURE (Status))
1765             {
1766                 return;
1767             }
1768 
1769             SubTable0B++;
1770             ComponentCount--;
1771             Offset += sizeof (ACPI_MPST_COMPONENT);
1772         }
1773 
1774         /* Point to next Memory Power Node subtable */
1775 
1776         SubtableCount--;
1777         SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
1778             sizeof (ACPI_MPST_POWER_NODE) +
1779             (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
1780             (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
1781     }
1782 
1783     /* Subtable: Count of Memory Power State Characteristic structures */
1784 
1785     AcpiOsPrintf ("\n");
1786     SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
1787     Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
1788                 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1789     if (ACPI_FAILURE (Status))
1790     {
1791         return;
1792     }
1793 
1794     SubtableCount = SubTable1->CharacteristicsCount;
1795     Offset += sizeof (ACPI_MPST_DATA_HDR);
1796 
1797     /* Subtable: Memory Power State Characteristics structure(s) */
1798 
1799     SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR));
1800 
1801     while ((Offset < Table->Length) && SubtableCount)
1802     {
1803         AcpiOsPrintf ("\n");
1804         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
1805                     sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1806         if (ACPI_FAILURE (Status))
1807         {
1808             return;
1809         }
1810 
1811         SubTable2++;
1812         SubtableCount--;
1813         Offset += sizeof (ACPI_MPST_POWER_DATA);
1814     }
1815 }
1816 
1817 
1818 /*******************************************************************************
1819  *
1820  * FUNCTION:    AcpiDmDumpMsct
1821  *
1822  * PARAMETERS:  Table               - A MSCT table
1823  *
1824  * RETURN:      None
1825  *
1826  * DESCRIPTION: Format the contents of a MSCT
1827  *
1828  ******************************************************************************/
1829 
1830 void
1831 AcpiDmDumpMsct (
1832     ACPI_TABLE_HEADER       *Table)
1833 {
1834     ACPI_STATUS             Status;
1835     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1836     ACPI_MSCT_PROXIMITY     *SubTable;
1837 
1838 
1839     /* Main table */
1840 
1841     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1842     if (ACPI_FAILURE (Status))
1843     {
1844         return;
1845     }
1846 
1847     /* Sub-tables */
1848 
1849     SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1850     while (Offset < Table->Length)
1851     {
1852         /* Common sub-table header */
1853 
1854         AcpiOsPrintf ("\n");
1855         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1856                     sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1857         if (ACPI_FAILURE (Status))
1858         {
1859             return;
1860         }
1861 
1862         /* Point to next sub-table */
1863 
1864         Offset += sizeof (ACPI_MSCT_PROXIMITY);
1865         SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
1866     }
1867 }
1868 
1869 
1870 /*******************************************************************************
1871  *
1872  * FUNCTION:    AcpiDmDumpMtmr
1873  *
1874  * PARAMETERS:  Table               - A MTMR table
1875  *
1876  * RETURN:      None
1877  *
1878  * DESCRIPTION: Format the contents of a MTMR
1879  *
1880  ******************************************************************************/
1881 
1882 void
1883 AcpiDmDumpMtmr (
1884     ACPI_TABLE_HEADER       *Table)
1885 {
1886     ACPI_STATUS             Status;
1887     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
1888     ACPI_MTMR_ENTRY         *SubTable;
1889 
1890 
1891     /* Main table */
1892 
1893     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
1894     if (ACPI_FAILURE (Status))
1895     {
1896         return;
1897     }
1898 
1899     /* Sub-tables */
1900 
1901     SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
1902     while (Offset < Table->Length)
1903     {
1904         /* Common sub-table header */
1905 
1906         AcpiOsPrintf ("\n");
1907         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1908                     sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
1909         if (ACPI_FAILURE (Status))
1910         {
1911             return;
1912         }
1913 
1914         /* Point to next sub-table */
1915 
1916         Offset += sizeof (ACPI_MTMR_ENTRY);
1917         SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
1918     }
1919 }
1920 
1921 
1922 /*******************************************************************************
1923  *
1924  * FUNCTION:    AcpiDmDumpPcct
1925  *
1926  * PARAMETERS:  Table               - A PCCT table
1927  *
1928  * RETURN:      None
1929  *
1930  * DESCRIPTION: Format the contents of a PCCT. This table type consists
1931  *              of an open-ended number of subtables.
1932  *
1933  ******************************************************************************/
1934 
1935 void
1936 AcpiDmDumpPcct (
1937     ACPI_TABLE_HEADER       *Table)
1938 {
1939     ACPI_STATUS             Status;
1940     ACPI_PCCT_SUBSPACE      *SubTable;
1941     UINT32                  Length = Table->Length;
1942     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
1943 
1944 
1945     /* Main table */
1946 
1947     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1948     if (ACPI_FAILURE (Status))
1949     {
1950         return;
1951     }
1952 
1953     /* Subtables */
1954 
1955     SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1956     while (Offset < Table->Length)
1957     {
1958         /* Common subtable header */
1959 
1960         AcpiOsPrintf ("\n");
1961         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1962                     SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
1963         if (ACPI_FAILURE (Status))
1964         {
1965             return;
1966         }
1967 
1968         /* ACPI 5.0: Only one type of PCCT subtable is supported */
1969 
1970         if (SubTable->Header.Type != ACPI_PCCT_TYPE_GENERIC_SUBSPACE)
1971         {
1972             AcpiOsPrintf (
1973                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
1974                 SubTable->Header.Type);
1975             return;
1976         }
1977 
1978         AcpiOsPrintf ("\n");
1979         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1980                     SubTable->Header.Length, AcpiDmTableInfoPcct0);
1981         if (ACPI_FAILURE (Status))
1982         {
1983             return;
1984         }
1985 
1986         /* Point to next subtable */
1987 
1988         Offset += SubTable->Header.Length;
1989         SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
1990                     SubTable->Header.Length);
1991     }
1992 }
1993 
1994 
1995 /*******************************************************************************
1996  *
1997  * FUNCTION:    AcpiDmDumpPmtt
1998  *
1999  * PARAMETERS:  Table               - A PMTT table
2000  *
2001  * RETURN:      None
2002  *
2003  * DESCRIPTION: Format the contents of a PMTT. This table type consists
2004  *              of an open-ended number of subtables.
2005  *
2006  ******************************************************************************/
2007 
2008 void
2009 AcpiDmDumpPmtt (
2010     ACPI_TABLE_HEADER       *Table)
2011 {
2012     ACPI_STATUS             Status;
2013     ACPI_PMTT_HEADER        *SubTable;
2014     ACPI_PMTT_HEADER        *MemSubTable;
2015     ACPI_PMTT_HEADER        *DimmSubTable;
2016     ACPI_PMTT_DOMAIN        *DomainArray;
2017     UINT32                  Length = Table->Length;
2018     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
2019     UINT32                  MemOffset;
2020     UINT32                  DimmOffset;
2021     UINT32                  DomainOffset;
2022     UINT32                  DomainCount;
2023 
2024 
2025     /* Main table */
2026 
2027     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2028     if (ACPI_FAILURE (Status))
2029     {
2030         return;
2031     }
2032 
2033     /* Subtables */
2034 
2035     SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2036     while (Offset < Table->Length)
2037     {
2038         /* Common subtable header */
2039 
2040         AcpiOsPrintf ("\n");
2041         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2042                     SubTable->Length, AcpiDmTableInfoPmttHdr);
2043         if (ACPI_FAILURE (Status))
2044         {
2045             return;
2046         }
2047 
2048         /* Only Socket subtables are expected at this level */
2049 
2050         if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
2051         {
2052             AcpiOsPrintf (
2053                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2054                 SubTable->Type);
2055             return;
2056         }
2057 
2058         /* Dump the fixed-length portion of the subtable */
2059 
2060         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2061                     SubTable->Length, AcpiDmTableInfoPmtt0);
2062         if (ACPI_FAILURE (Status))
2063         {
2064             return;
2065         }
2066 
2067         /* Walk the memory controller subtables */
2068 
2069         MemOffset = sizeof (ACPI_PMTT_SOCKET);
2070         MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
2071             sizeof (ACPI_PMTT_SOCKET));
2072 
2073         while (((Offset + MemOffset) < Table->Length) &&
2074             (MemOffset < SubTable->Length))
2075         {
2076             /* Common subtable header */
2077 
2078             AcpiOsPrintf ("\n");
2079             Status = AcpiDmDumpTable (Length,
2080                         Offset + MemOffset, MemSubTable,
2081                         MemSubTable->Length, AcpiDmTableInfoPmttHdr);
2082             if (ACPI_FAILURE (Status))
2083             {
2084                 return;
2085             }
2086 
2087             /* Only memory controller subtables are expected at this level */
2088 
2089             if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
2090             {
2091                 AcpiOsPrintf (
2092                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2093                     MemSubTable->Type);
2094                 return;
2095             }
2096 
2097             /* Dump the fixed-length portion of the controller subtable */
2098 
2099             Status = AcpiDmDumpTable (Length,
2100                         Offset + MemOffset, MemSubTable,
2101                         MemSubTable->Length, AcpiDmTableInfoPmtt1);
2102             if (ACPI_FAILURE (Status))
2103             {
2104                 return;
2105             }
2106 
2107             /* Walk the variable count of proximity domains */
2108 
2109             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
2110             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
2111             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
2112                 sizeof (ACPI_PMTT_CONTROLLER));
2113 
2114             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
2115                 ((MemOffset + DomainOffset) < SubTable->Length) &&
2116                 DomainCount)
2117             {
2118                 Status = AcpiDmDumpTable (Length,
2119                             Offset + MemOffset + DomainOffset, DomainArray,
2120                             sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
2121                 if (ACPI_FAILURE (Status))
2122                 {
2123                     return;
2124                 }
2125 
2126                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
2127                 DomainArray++;
2128                 DomainCount--;
2129             }
2130 
2131             if (DomainCount)
2132             {
2133                 AcpiOsPrintf (
2134                     "\n**** DomainCount exceeds subtable length\n\n",
2135                     MemSubTable->Type);
2136             }
2137 
2138             /* Walk the physical component (DIMM) subtables */
2139 
2140             DimmOffset = DomainOffset;
2141             DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
2142                 DomainOffset);
2143 
2144             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
2145                 (DimmOffset < MemSubTable->Length))
2146             {
2147                 /* Common subtable header */
2148 
2149                 AcpiOsPrintf ("\n");
2150                 Status = AcpiDmDumpTable (Length,
2151                             Offset + MemOffset + DimmOffset, DimmSubTable,
2152                             DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
2153                 if (ACPI_FAILURE (Status))
2154                 {
2155                     return;
2156                 }
2157 
2158                 /* Only DIMM subtables are expected at this level */
2159 
2160                 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
2161                 {
2162                     AcpiOsPrintf (
2163                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2164                         DimmSubTable->Type);
2165                     return;
2166                 }
2167 
2168                 /* Dump the fixed-length DIMM subtable */
2169 
2170                 Status = AcpiDmDumpTable (Length,
2171                             Offset + MemOffset + DimmOffset, DimmSubTable,
2172                             DimmSubTable->Length, AcpiDmTableInfoPmtt2);
2173                 if (ACPI_FAILURE (Status))
2174                 {
2175                     return;
2176                 }
2177 
2178                 /* Point to next DIMM subtable */
2179 
2180                 DimmOffset += DimmSubTable->Length;
2181                 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2182                     DimmSubTable, DimmSubTable->Length);
2183             }
2184 
2185             /* Point to next Controller subtable */
2186 
2187             MemOffset += MemSubTable->Length;
2188             MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2189                 MemSubTable, MemSubTable->Length);
2190         }
2191 
2192         /* Point to next Socket subtable */
2193 
2194         Offset += SubTable->Length;
2195         SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2196             SubTable, SubTable->Length);
2197     }
2198 }
2199 
2200 
2201 /*******************************************************************************
2202  *
2203  * FUNCTION:    AcpiDmDumpS3pt
2204  *
2205  * PARAMETERS:  Table               - A S3PT table
2206  *
2207  * RETURN:      Length of the table
2208  *
2209  * DESCRIPTION: Format the contents of a S3PT
2210  *
2211  ******************************************************************************/
2212 
2213 UINT32
2214 AcpiDmDumpS3pt (
2215     ACPI_TABLE_HEADER       *Tables)
2216 {
2217     ACPI_STATUS             Status;
2218     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
2219     ACPI_S3PT_HEADER        *SubTable;
2220     ACPI_DMTABLE_INFO       *InfoTable;
2221     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2222 
2223 
2224     /* Main table */
2225 
2226     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2227     if (ACPI_FAILURE (Status))
2228     {
2229         return 0;
2230     }
2231 
2232     SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset);
2233     while (Offset < S3ptTable->Length)
2234     {
2235         /* Common sub-table header */
2236 
2237         AcpiOsPrintf ("\n");
2238         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
2239                     SubTable->Length, AcpiDmTableInfoS3ptHdr);
2240         if (ACPI_FAILURE (Status))
2241         {
2242             return 0;
2243         }
2244 
2245         switch (SubTable->Type)
2246         {
2247         case ACPI_S3PT_TYPE_RESUME:
2248 
2249             InfoTable = AcpiDmTableInfoS3pt0;
2250             break;
2251 
2252         case ACPI_S3PT_TYPE_SUSPEND:
2253 
2254             InfoTable = AcpiDmTableInfoS3pt1;
2255             break;
2256 
2257         default:
2258 
2259             AcpiOsPrintf ("\n**** Unknown S3PT sub-table type 0x%X\n", SubTable->Type);
2260 
2261             /* Attempt to continue */
2262 
2263             if (!SubTable->Length)
2264             {
2265                 AcpiOsPrintf ("Invalid zero length subtable\n");
2266                 return 0;
2267             }
2268             goto NextSubTable;
2269         }
2270 
2271         AcpiOsPrintf ("\n");
2272         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
2273                     SubTable->Length, InfoTable);
2274         if (ACPI_FAILURE (Status))
2275         {
2276             return 0;
2277         }
2278 
2279 NextSubTable:
2280         /* Point to next sub-table */
2281 
2282         Offset += SubTable->Length;
2283         SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length);
2284     }
2285 
2286     return (S3ptTable->Length);
2287 }
2288 
2289 
2290 /*******************************************************************************
2291  *
2292  * FUNCTION:    AcpiDmDumpSlic
2293  *
2294  * PARAMETERS:  Table               - A SLIC table
2295  *
2296  * RETURN:      None
2297  *
2298  * DESCRIPTION: Format the contents of a SLIC
2299  *
2300  ******************************************************************************/
2301 
2302 void
2303 AcpiDmDumpSlic (
2304     ACPI_TABLE_HEADER       *Table)
2305 {
2306     ACPI_STATUS             Status;
2307     UINT32                  Offset = sizeof (ACPI_TABLE_SLIC);
2308     ACPI_SLIC_HEADER        *SubTable;
2309     ACPI_DMTABLE_INFO       *InfoTable;
2310 
2311 
2312     /* There is no main SLIC table, only subtables */
2313 
2314     SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset);
2315     while (Offset < Table->Length)
2316     {
2317         /* Common sub-table header */
2318 
2319         AcpiOsPrintf ("\n");
2320         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2321                     SubTable->Length, AcpiDmTableInfoSlicHdr);
2322         if (ACPI_FAILURE (Status))
2323         {
2324             return;
2325         }
2326 
2327         switch (SubTable->Type)
2328         {
2329         case ACPI_SLIC_TYPE_PUBLIC_KEY:
2330 
2331             InfoTable = AcpiDmTableInfoSlic0;
2332             break;
2333 
2334         case ACPI_SLIC_TYPE_WINDOWS_MARKER:
2335 
2336             InfoTable = AcpiDmTableInfoSlic1;
2337             break;
2338 
2339         default:
2340 
2341             AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type);
2342 
2343             /* Attempt to continue */
2344 
2345             if (!SubTable->Length)
2346             {
2347                 AcpiOsPrintf ("Invalid zero length subtable\n");
2348                 return;
2349             }
2350             goto NextSubTable;
2351         }
2352 
2353         AcpiOsPrintf ("\n");
2354         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2355                     SubTable->Length, InfoTable);
2356         if (ACPI_FAILURE (Status))
2357         {
2358             return;
2359         }
2360 
2361 NextSubTable:
2362         /* Point to next sub-table */
2363 
2364         Offset += SubTable->Length;
2365         SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length);
2366     }
2367 }
2368 
2369 
2370 /*******************************************************************************
2371  *
2372  * FUNCTION:    AcpiDmDumpSlit
2373  *
2374  * PARAMETERS:  Table               - An SLIT
2375  *
2376  * RETURN:      None
2377  *
2378  * DESCRIPTION: Format the contents of a SLIT
2379  *
2380  ******************************************************************************/
2381 
2382 void
2383 AcpiDmDumpSlit (
2384     ACPI_TABLE_HEADER       *Table)
2385 {
2386     ACPI_STATUS             Status;
2387     UINT32                  Offset;
2388     UINT8                   *Row;
2389     UINT32                  Localities;
2390     UINT32                  i;
2391     UINT32                  j;
2392 
2393 
2394     /* Main table */
2395 
2396     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
2397     if (ACPI_FAILURE (Status))
2398     {
2399         return;
2400     }
2401 
2402     /* Display the Locality NxN Matrix */
2403 
2404     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
2405     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
2406     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
2407 
2408     for (i = 0; i < Localities; i++)
2409     {
2410         /* Display one row of the matrix */
2411 
2412         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
2413         for  (j = 0; j < Localities; j++)
2414         {
2415             /* Check for beyond EOT */
2416 
2417             if (Offset >= Table->Length)
2418             {
2419                 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
2420                 return;
2421             }
2422 
2423             AcpiOsPrintf ("%2.2X", Row[j]);
2424             Offset++;
2425 
2426             /* Display up to 16 bytes per output row */
2427 
2428             if ((j+1) < Localities)
2429             {
2430                 AcpiOsPrintf (" ");
2431 
2432                 if (j && (((j+1) % 16) == 0))
2433                 {
2434                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
2435                     AcpiDmLineHeader (Offset, 0, NULL);
2436                 }
2437             }
2438         }
2439 
2440         /* Point to next row */
2441 
2442         AcpiOsPrintf ("\n");
2443         Row += Localities;
2444     }
2445 }
2446 
2447 
2448 /*******************************************************************************
2449  *
2450  * FUNCTION:    AcpiDmDumpSrat
2451  *
2452  * PARAMETERS:  Table               - A SRAT table
2453  *
2454  * RETURN:      None
2455  *
2456  * DESCRIPTION: Format the contents of a SRAT
2457  *
2458  ******************************************************************************/
2459 
2460 void
2461 AcpiDmDumpSrat (
2462     ACPI_TABLE_HEADER       *Table)
2463 {
2464     ACPI_STATUS             Status;
2465     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
2466     ACPI_SUBTABLE_HEADER    *SubTable;
2467     ACPI_DMTABLE_INFO       *InfoTable;
2468 
2469 
2470     /* Main table */
2471 
2472     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
2473     if (ACPI_FAILURE (Status))
2474     {
2475         return;
2476     }
2477 
2478     /* Sub-tables */
2479 
2480     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2481     while (Offset < Table->Length)
2482     {
2483         /* Common sub-table header */
2484 
2485         AcpiOsPrintf ("\n");
2486         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2487                     SubTable->Length, AcpiDmTableInfoSratHdr);
2488         if (ACPI_FAILURE (Status))
2489         {
2490             return;
2491         }
2492 
2493         switch (SubTable->Type)
2494         {
2495         case ACPI_SRAT_TYPE_CPU_AFFINITY:
2496 
2497             InfoTable = AcpiDmTableInfoSrat0;
2498             break;
2499 
2500         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
2501 
2502             InfoTable = AcpiDmTableInfoSrat1;
2503             break;
2504 
2505         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
2506 
2507             InfoTable = AcpiDmTableInfoSrat2;
2508             break;
2509 
2510         default:
2511             AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type);
2512 
2513             /* Attempt to continue */
2514 
2515             if (!SubTable->Length)
2516             {
2517                 AcpiOsPrintf ("Invalid zero length subtable\n");
2518                 return;
2519             }
2520             goto NextSubTable;
2521         }
2522 
2523         AcpiOsPrintf ("\n");
2524         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2525                     SubTable->Length, InfoTable);
2526         if (ACPI_FAILURE (Status))
2527         {
2528             return;
2529         }
2530 
2531 NextSubTable:
2532         /* Point to next sub-table */
2533 
2534         Offset += SubTable->Length;
2535         SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
2536     }
2537 }
2538 
2539 
2540 /*******************************************************************************
2541  *
2542  * FUNCTION:    AcpiDmDumpVrtc
2543  *
2544  * PARAMETERS:  Table               - A VRTC table
2545  *
2546  * RETURN:      None
2547  *
2548  * DESCRIPTION: Format the contents of a VRTC
2549  *
2550  ******************************************************************************/
2551 
2552 void
2553 AcpiDmDumpVrtc (
2554     ACPI_TABLE_HEADER       *Table)
2555 {
2556     ACPI_STATUS             Status;
2557     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
2558     ACPI_VRTC_ENTRY         *SubTable;
2559 
2560 
2561     /* Main table */
2562 
2563     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
2564     if (ACPI_FAILURE (Status))
2565     {
2566         return;
2567     }
2568 
2569     /* Sub-tables */
2570 
2571     SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
2572     while (Offset < Table->Length)
2573     {
2574         /* Common sub-table header */
2575 
2576         AcpiOsPrintf ("\n");
2577         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2578                     sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
2579         if (ACPI_FAILURE (Status))
2580         {
2581             return;
2582         }
2583 
2584         /* Point to next sub-table */
2585 
2586         Offset += sizeof (ACPI_VRTC_ENTRY);
2587         SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
2588     }
2589 }
2590 
2591 
2592 /*******************************************************************************
2593  *
2594  * FUNCTION:    AcpiDmDumpWdat
2595  *
2596  * PARAMETERS:  Table               - A WDAT table
2597  *
2598  * RETURN:      None
2599  *
2600  * DESCRIPTION: Format the contents of a WDAT
2601  *
2602  ******************************************************************************/
2603 
2604 void
2605 AcpiDmDumpWdat (
2606     ACPI_TABLE_HEADER       *Table)
2607 {
2608     ACPI_STATUS             Status;
2609     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
2610     ACPI_WDAT_ENTRY         *SubTable;
2611 
2612 
2613     /* Main table */
2614 
2615     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
2616     if (ACPI_FAILURE (Status))
2617     {
2618         return;
2619     }
2620 
2621     /* Sub-tables */
2622 
2623     SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
2624     while (Offset < Table->Length)
2625     {
2626         /* Common sub-table header */
2627 
2628         AcpiOsPrintf ("\n");
2629         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2630                     sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
2631         if (ACPI_FAILURE (Status))
2632         {
2633             return;
2634         }
2635 
2636         /* Point to next sub-table */
2637 
2638         Offset += sizeof (ACPI_WDAT_ENTRY);
2639         SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));
2640     }
2641 }