Home | History | Annotate | Line # | Download | only in common
      1 /******************************************************************************
      2  *
      3  * Module Name: dmtbdump3 - 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 - 2025, 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 "acpi.h"
    153 #include "accommon.h"
    154 #include "acdisasm.h"
    155 #include "actables.h"
    156 
    157 /* This module used for application-level code only */
    158 
    159 #define _COMPONENT          ACPI_CA_DISASSEMBLER
    160         ACPI_MODULE_NAME    ("dmtbdump3")
    161 
    162 
    163 /*******************************************************************************
    164  *
    165  * FUNCTION:    AcpiDmDumpSlic
    166  *
    167  * PARAMETERS:  Table               - A SLIC table
    168  *
    169  * RETURN:      None
    170  *
    171  * DESCRIPTION: Format the contents of a SLIC
    172  *
    173  ******************************************************************************/
    174 
    175 void
    176 AcpiDmDumpSlic (
    177     ACPI_TABLE_HEADER       *Table)
    178 {
    179 
    180     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER),
    181         (void *) ((UINT8 *)Table + sizeof (*Table)),
    182         Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
    183 }
    184 
    185 
    186 /*******************************************************************************
    187  *
    188  * FUNCTION:    AcpiDmDumpSlit
    189  *
    190  * PARAMETERS:  Table               - An SLIT
    191  *
    192  * RETURN:      None
    193  *
    194  * DESCRIPTION: Format the contents of a SLIT
    195  *
    196  ******************************************************************************/
    197 
    198 void
    199 AcpiDmDumpSlit (
    200     ACPI_TABLE_HEADER       *Table)
    201 {
    202     ACPI_STATUS             Status;
    203     UINT32                  Offset;
    204     UINT8                   *Row;
    205     UINT32                  Localities;
    206     UINT32                  i;
    207     UINT32                  j;
    208 
    209 
    210     /* Main table */
    211 
    212     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
    213     if (ACPI_FAILURE (Status))
    214     {
    215         return;
    216     }
    217 
    218     /* Display the Locality NxN Matrix */
    219 
    220     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
    221     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
    222     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
    223 
    224     for (i = 0; i < Localities; i++)
    225     {
    226         /* Display one row of the matrix */
    227 
    228         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
    229         for  (j = 0; j < Localities; j++)
    230         {
    231             /* Check for beyond EOT */
    232 
    233             if (Offset >= Table->Length)
    234             {
    235                 AcpiOsPrintf (
    236                     "\n**** Not enough room in table for all localities\n");
    237                 return;
    238             }
    239 
    240             AcpiOsPrintf ("%2.2X", Row[j]);
    241             Offset++;
    242 
    243             /* Display up to 16 bytes per output row */
    244 
    245             if ((j+1) < Localities)
    246             {
    247                 AcpiOsPrintf (" ");
    248 
    249                 if (j && (((j+1) % 16) == 0))
    250                 {
    251                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
    252                     AcpiDmLineHeader (Offset, 0, NULL);
    253                 }
    254             }
    255         }
    256 
    257         /* Point to next row */
    258 
    259         AcpiOsPrintf ("\n");
    260         Row += Localities;
    261     }
    262 }
    263 
    264 
    265 /*******************************************************************************
    266  *
    267  * FUNCTION:    AcpiDmDumpSrat
    268  *
    269  * PARAMETERS:  Table               - A SRAT table
    270  *
    271  * RETURN:      None
    272  *
    273  * DESCRIPTION: Format the contents of a SRAT
    274  *
    275  ******************************************************************************/
    276 
    277 void
    278 AcpiDmDumpSrat (
    279     ACPI_TABLE_HEADER       *Table)
    280 {
    281     ACPI_STATUS             Status;
    282     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
    283     ACPI_SUBTABLE_HEADER    *Subtable;
    284     ACPI_DMTABLE_INFO       *InfoTable;
    285 
    286 
    287     /* Main table */
    288 
    289     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
    290     if (ACPI_FAILURE (Status))
    291     {
    292         return;
    293     }
    294 
    295     /* Subtables */
    296 
    297     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
    298     while (Offset < Table->Length)
    299     {
    300         /* Common subtable header */
    301 
    302         AcpiOsPrintf ("\n");
    303         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    304             Subtable->Length, AcpiDmTableInfoSratHdr);
    305         if (ACPI_FAILURE (Status))
    306         {
    307             return;
    308         }
    309 
    310         switch (Subtable->Type)
    311         {
    312         case ACPI_SRAT_TYPE_CPU_AFFINITY:
    313 
    314             InfoTable = AcpiDmTableInfoSrat0;
    315             break;
    316 
    317         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
    318 
    319             InfoTable = AcpiDmTableInfoSrat1;
    320             break;
    321 
    322         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
    323 
    324             InfoTable = AcpiDmTableInfoSrat2;
    325             break;
    326 
    327         case ACPI_SRAT_TYPE_GICC_AFFINITY:
    328 
    329             InfoTable = AcpiDmTableInfoSrat3;
    330             break;
    331 
    332         case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
    333 
    334             InfoTable = AcpiDmTableInfoSrat4;
    335             break;
    336 
    337         case ACPI_SRAT_TYPE_GENERIC_AFFINITY:
    338 
    339             InfoTable = AcpiDmTableInfoSrat5;
    340             break;
    341 
    342         case ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY:
    343 
    344             InfoTable = AcpiDmTableInfoSrat6;
    345             break;
    346 
    347         case ACPI_SRAT_TYPE_RINTC_AFFINITY:
    348 
    349             InfoTable = AcpiDmTableInfoSrat7;
    350             break;
    351 
    352         default:
    353             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
    354                 Subtable->Type);
    355 
    356             /* Attempt to continue */
    357 
    358             if (!Subtable->Length)
    359             {
    360                 AcpiOsPrintf ("Invalid zero length subtable\n");
    361                 return;
    362             }
    363             goto NextSubtable;
    364         }
    365 
    366         AcpiOsPrintf ("\n");
    367         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    368             Subtable->Length, InfoTable);
    369         if (ACPI_FAILURE (Status))
    370         {
    371             return;
    372         }
    373 
    374 NextSubtable:
    375         /* Point to next subtable */
    376 
    377         Offset += Subtable->Length;
    378         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
    379             Subtable->Length);
    380     }
    381 }
    382 
    383 
    384 /*******************************************************************************
    385  *
    386  * FUNCTION:    AcpiDmDumpStao
    387  *
    388  * PARAMETERS:  Table               - A STAO table
    389  *
    390  * RETURN:      None
    391  *
    392  * DESCRIPTION: Format the contents of a STAO. This is a variable-length
    393  *              table that contains an open-ended number of ASCII strings
    394  *              at the end of the table.
    395  *
    396  ******************************************************************************/
    397 
    398 void
    399 AcpiDmDumpStao (
    400     ACPI_TABLE_HEADER       *Table)
    401 {
    402     ACPI_STATUS             Status;
    403     char                    *Namepath;
    404     UINT32                  Length = Table->Length;
    405     UINT32                  StringLength;
    406     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
    407 
    408 
    409     /* Main table */
    410 
    411     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
    412     if (ACPI_FAILURE (Status))
    413     {
    414         return;
    415     }
    416 
    417     /* The rest of the table consists of Namepath strings */
    418 
    419     while (Offset < Table->Length)
    420     {
    421         Namepath = ACPI_ADD_PTR (char, Table, Offset);
    422         StringLength = strlen (Namepath) + 1;
    423 
    424         AcpiDmLineHeader (Offset, StringLength, "Namepath");
    425         AcpiOsPrintf ("\"%s\"\n", Namepath);
    426 
    427         /* Point to next namepath */
    428 
    429         Offset += StringLength;
    430     }
    431 }
    432 
    433 
    434 /*******************************************************************************
    435  *
    436  * FUNCTION:    AcpiDmDumpSvkl
    437  *
    438  * PARAMETERS:  Table               - A SVKL table
    439  *
    440  * RETURN:      None
    441  *
    442  * DESCRIPTION: Format the contents of a SVKL. This is a variable-length
    443  *              table that contains an open-ended number of key subtables at
    444  *              the end of the header.
    445  *
    446  * NOTES: SVKL is essentially a flat table, with a small main table and
    447  *          a variable number of a single type of subtable.
    448  *
    449  ******************************************************************************/
    450 
    451 void
    452 AcpiDmDumpSvkl (
    453     ACPI_TABLE_HEADER       *Table)
    454 {
    455     ACPI_STATUS             Status;
    456     UINT32                  Length = Table->Length;
    457     UINT32                  Offset = sizeof (ACPI_TABLE_SVKL);
    458     ACPI_SVKL_KEY           *Subtable;
    459 
    460 
    461     /* Main table */
    462 
    463     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSvkl);
    464     if (ACPI_FAILURE (Status))
    465     {
    466         return;
    467     }
    468 
    469     /* The rest of the table consists of subtables (single type) */
    470 
    471     Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Table, Offset);
    472     while (Offset < Table->Length)
    473     {
    474         /* Dump the subtable */
    475 
    476         AcpiOsPrintf ("\n");
    477         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    478             sizeof (ACPI_SVKL_KEY), AcpiDmTableInfoSvkl0);
    479         if (ACPI_FAILURE (Status))
    480         {
    481             return;
    482         }
    483 
    484         /* Point to next subtable */
    485 
    486         Offset += sizeof (ACPI_SVKL_KEY);
    487         Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Subtable,
    488             sizeof (ACPI_SVKL_KEY));
    489     }
    490 }
    491 
    492 
    493 /*******************************************************************************
    494  *
    495  * FUNCTION:    AcpiDmDumpTcpa
    496  *
    497  * PARAMETERS:  Table               - A TCPA table
    498  *
    499  * RETURN:      None
    500  *
    501  * DESCRIPTION: Format the contents of a TCPA.
    502  *
    503  * NOTE:        There are two versions of the table with the same signature:
    504  *              the client version and the server version. The common
    505  *              PlatformClass field is used to differentiate the two types of
    506  *              tables.
    507  *
    508  ******************************************************************************/
    509 
    510 void
    511 AcpiDmDumpTcpa (
    512     ACPI_TABLE_HEADER       *Table)
    513 {
    514     UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);
    515     ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (
    516                                 ACPI_TABLE_TCPA_HDR, Table);
    517     ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (
    518                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
    519     ACPI_STATUS             Status;
    520 
    521 
    522     /* Main table */
    523 
    524     Status = AcpiDmDumpTable (Table->Length, 0, Table,
    525         0, AcpiDmTableInfoTcpaHdr);
    526     if (ACPI_FAILURE (Status))
    527     {
    528         return;
    529     }
    530 
    531     /*
    532      * Examine the PlatformClass field to determine the table type.
    533      * Either a client or server table. Only one.
    534      */
    535     switch (CommonHeader->PlatformClass)
    536     {
    537     case ACPI_TCPA_CLIENT_TABLE:
    538 
    539         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    540             Table->Length - Offset, AcpiDmTableInfoTcpaClient);
    541         break;
    542 
    543     case ACPI_TCPA_SERVER_TABLE:
    544 
    545         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    546             Table->Length - Offset, AcpiDmTableInfoTcpaServer);
    547         break;
    548 
    549     default:
    550 
    551         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
    552             CommonHeader->PlatformClass);
    553         Status = AE_ERROR;
    554         break;
    555     }
    556 
    557     if (ACPI_FAILURE (Status))
    558     {
    559         AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
    560     }
    561 }
    562 
    563 
    564 /*******************************************************************************
    565  *
    566  * FUNCTION:    AcpiDmDumpTpm2
    567  *
    568  * PARAMETERS:  Table               - A TPM2 table
    569  *
    570  * RETURN:      None
    571  *
    572  * DESCRIPTION: Format the contents of a TPM2.
    573  *
    574  ******************************************************************************/
    575 
    576 static void
    577 AcpiDmDumpTpm2Rev3 (
    578     ACPI_TABLE_HEADER       *Table)
    579 {
    580     UINT32                  Offset = sizeof (ACPI_TABLE_TPM23);
    581     ACPI_TABLE_TPM23        *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
    582     ACPI_TPM23_TRAILER      *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
    583     ACPI_STATUS             Status;
    584 
    585 
    586     /* Main table */
    587 
    588     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
    589     if (ACPI_FAILURE (Status))
    590     {
    591         return;
    592     }
    593 
    594     /* Optional subtable if start method is ACPI start method */
    595 
    596     switch (CommonHeader->StartMethod)
    597     {
    598     case ACPI_TPM23_ACPI_START_METHOD:
    599 
    600         (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
    601             Table->Length - Offset, AcpiDmTableInfoTpm23a);
    602         break;
    603 
    604     default:
    605         break;
    606     }
    607 }
    608 
    609 
    610 /*******************************************************************************
    611  *
    612  * FUNCTION:    AcpiDmDumpTpm2
    613  *
    614  * PARAMETERS:  Table               - A TPM2 table
    615  *
    616  * RETURN:      None
    617  *
    618  * DESCRIPTION: Format the contents of a TPM2.
    619  *
    620  ******************************************************************************/
    621 
    622 void
    623 AcpiDmDumpTpm2 (
    624     ACPI_TABLE_HEADER       *Table)
    625 {
    626     UINT32                  Offset = sizeof (ACPI_TABLE_TPM2);
    627     ACPI_TABLE_TPM2         *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);
    628     ACPI_TPM2_TRAILER       *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
    629     ACPI_TPM2_ARM_SMC       *ArmSubtable;
    630     ACPI_STATUS             Status;
    631 
    632 
    633     if (Table->Revision == 3)
    634     {
    635         AcpiDmDumpTpm2Rev3(Table);
    636         return;
    637     }
    638 
    639     /* Main table */
    640 
    641     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
    642 
    643     if (ACPI_FAILURE (Status))
    644     {
    645         return;
    646     }
    647 
    648     AcpiOsPrintf ("\n");
    649     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    650         Table->Length - Offset, AcpiDmTableInfoTpm2a);
    651     if (ACPI_FAILURE (Status))
    652     {
    653         return;
    654     }
    655 
    656     switch (CommonHeader->StartMethod)
    657     {
    658     case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
    659 
    660         ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,
    661             sizeof (ACPI_TPM2_TRAILER));
    662         Offset += sizeof (ACPI_TPM2_TRAILER);
    663 
    664         AcpiOsPrintf ("\n");
    665         (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
    666             Table->Length - Offset, AcpiDmTableInfoTpm211);
    667         break;
    668 
    669     default:
    670         break;
    671     }
    672 }
    673 
    674 
    675 /*******************************************************************************
    676  *
    677  * FUNCTION:    AcpiDmDumpViot
    678  *
    679  * PARAMETERS:  Table               - A VIOT table
    680  *
    681  * RETURN:      None
    682  *
    683  * DESCRIPTION: Format the contents of a VIOT
    684  *
    685  ******************************************************************************/
    686 
    687 void
    688 AcpiDmDumpViot (
    689     ACPI_TABLE_HEADER       *Table)
    690 {
    691     ACPI_STATUS             Status;
    692     ACPI_TABLE_VIOT         *Viot;
    693     ACPI_VIOT_HEADER        *ViotHeader;
    694     UINT16                  Length;
    695     UINT32                  Offset;
    696     ACPI_DMTABLE_INFO       *InfoTable;
    697 
    698     /* Main table */
    699 
    700     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoViot);
    701     if (ACPI_FAILURE (Status))
    702     {
    703         return;
    704     }
    705 
    706     Viot = ACPI_CAST_PTR (ACPI_TABLE_VIOT, Table);
    707 
    708     Offset = Viot->NodeOffset;
    709     while (Offset < Table->Length)
    710     {
    711         /* Common subtable header */
    712         ViotHeader = ACPI_ADD_PTR (ACPI_VIOT_HEADER, Table, Offset);
    713         AcpiOsPrintf ("\n");
    714 
    715         Length = sizeof (ACPI_VIOT_HEADER);
    716         Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
    717             AcpiDmTableInfoViotHeader);
    718         if (ACPI_FAILURE (Status))
    719         {
    720             return;
    721         }
    722 
    723         Length = ViotHeader->Length;
    724         switch (ViotHeader->Type)
    725         {
    726         case ACPI_VIOT_NODE_PCI_RANGE:
    727 
    728             InfoTable = AcpiDmTableInfoViot1;
    729             break;
    730 
    731         case ACPI_VIOT_NODE_MMIO:
    732 
    733             InfoTable = AcpiDmTableInfoViot2;
    734             break;
    735 
    736         case ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI:
    737 
    738             InfoTable = AcpiDmTableInfoViot3;
    739             break;
    740 
    741         case ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO:
    742 
    743             InfoTable = AcpiDmTableInfoViot4;
    744             break;
    745 
    746         default:
    747 
    748             AcpiOsPrintf ("\n*** Unknown VIOT node type 0x%X\n",
    749                 ViotHeader->Type);
    750 
    751             /* Attempt to continue */
    752 
    753             if (!Length)
    754             {
    755                 AcpiOsPrintf ("Invalid zero length VIOT node\n");
    756                 return;
    757             }
    758             goto NextSubtable;
    759         }
    760 
    761         AcpiOsPrintf ("\n");
    762         Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
    763             InfoTable);
    764         if (ACPI_FAILURE (Status))
    765         {
    766             return;
    767         }
    768 
    769 NextSubtable:
    770         Offset += Length;
    771     }
    772 }
    773 
    774 
    775 /*******************************************************************************
    776  *
    777  * FUNCTION:    AcpiDmDumpWdat
    778  *
    779  * PARAMETERS:  Table               - A WDAT table
    780  *
    781  * RETURN:      None
    782  *
    783  * DESCRIPTION: Format the contents of a WDAT
    784  *
    785  ******************************************************************************/
    786 
    787 void
    788 AcpiDmDumpWdat (
    789     ACPI_TABLE_HEADER       *Table)
    790 {
    791     ACPI_STATUS             Status;
    792     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
    793     ACPI_WDAT_ENTRY         *Subtable;
    794 
    795 
    796     /* Main table */
    797 
    798     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
    799     if (ACPI_FAILURE (Status))
    800     {
    801         return;
    802     }
    803 
    804     /* Subtables */
    805 
    806     Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
    807     while (Offset < Table->Length)
    808     {
    809         /* Common subtable header */
    810 
    811         AcpiOsPrintf ("\n");
    812         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    813             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
    814         if (ACPI_FAILURE (Status))
    815         {
    816             return;
    817         }
    818 
    819         /* Point to next subtable */
    820 
    821         Offset += sizeof (ACPI_WDAT_ENTRY);
    822         Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,
    823             sizeof (ACPI_WDAT_ENTRY));
    824     }
    825 }
    826 
    827 
    828 /*******************************************************************************
    829  *
    830  * FUNCTION:    AcpiDmDumpWpbt
    831  *
    832  * PARAMETERS:  Table               - A WPBT table
    833  *
    834  * RETURN:      None
    835  *
    836  * DESCRIPTION: Format the contents of a WPBT. This table type consists
    837  *              of an open-ended arguments buffer at the end of the table.
    838  *
    839  ******************************************************************************/
    840 
    841 void
    842 AcpiDmDumpWpbt (
    843     ACPI_TABLE_HEADER       *Table)
    844 {
    845     ACPI_STATUS             Status;
    846     ACPI_TABLE_WPBT         *Subtable;
    847     UINT16                  ArgumentsLength;
    848 
    849 
    850     /* Dump the main table */
    851 
    852     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWpbt);
    853     if (ACPI_FAILURE (Status))
    854     {
    855         return;
    856     }
    857 
    858     /* Extract the arguments buffer length from the main table */
    859 
    860     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
    861     ArgumentsLength = Subtable->ArgumentsLength;
    862 
    863     /* Dump the arguments buffer if present */
    864 
    865     if (ArgumentsLength)
    866     {
    867         (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
    868             AcpiDmTableInfoWpbt0);
    869     }
    870 }
    871