Home | History | Annotate | Line # | Download | only in common
dmtbdump3.c revision 1.1.1.5.4.1
      1          1.1  christos /******************************************************************************
      2          1.1  christos  *
      3          1.1  christos  * Module Name: dmtbdump3 - Dump ACPI data tables that contain no AML code
      4          1.1  christos  *
      5          1.1  christos  *****************************************************************************/
      6          1.1  christos 
      7          1.1  christos /*
      8  1.1.1.5.4.1   thorpej  * Copyright (C) 2000 - 2021, Intel Corp.
      9          1.1  christos  * All rights reserved.
     10          1.1  christos  *
     11          1.1  christos  * Redistribution and use in source and binary forms, with or without
     12          1.1  christos  * modification, are permitted provided that the following conditions
     13          1.1  christos  * are met:
     14          1.1  christos  * 1. Redistributions of source code must retain the above copyright
     15          1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     16          1.1  christos  *    without modification.
     17          1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18          1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19          1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20          1.1  christos  *    including a substantially similar Disclaimer requirement for further
     21          1.1  christos  *    binary redistribution.
     22          1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23          1.1  christos  *    of any contributors may be used to endorse or promote products derived
     24          1.1  christos  *    from this software without specific prior written permission.
     25          1.1  christos  *
     26          1.1  christos  * Alternatively, this software may be distributed under the terms of the
     27          1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28          1.1  christos  * Software Foundation.
     29          1.1  christos  *
     30          1.1  christos  * NO WARRANTY
     31          1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32          1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.5.4.1   thorpej  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     34          1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35          1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36          1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37          1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38          1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39          1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40          1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41          1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     42          1.1  christos  */
     43          1.1  christos 
     44          1.1  christos #include "acpi.h"
     45          1.1  christos #include "accommon.h"
     46          1.1  christos #include "acdisasm.h"
     47          1.1  christos #include "actables.h"
     48          1.1  christos 
     49          1.1  christos /* This module used for application-level code only */
     50          1.1  christos 
     51          1.1  christos #define _COMPONENT          ACPI_CA_DISASSEMBLER
     52          1.1  christos         ACPI_MODULE_NAME    ("dmtbdump3")
     53          1.1  christos 
     54          1.1  christos 
     55          1.1  christos /*******************************************************************************
     56          1.1  christos  *
     57          1.1  christos  * FUNCTION:    AcpiDmDumpSlic
     58          1.1  christos  *
     59          1.1  christos  * PARAMETERS:  Table               - A SLIC table
     60          1.1  christos  *
     61          1.1  christos  * RETURN:      None
     62          1.1  christos  *
     63          1.1  christos  * DESCRIPTION: Format the contents of a SLIC
     64          1.1  christos  *
     65          1.1  christos  ******************************************************************************/
     66          1.1  christos 
     67          1.1  christos void
     68          1.1  christos AcpiDmDumpSlic (
     69          1.1  christos     ACPI_TABLE_HEADER       *Table)
     70          1.1  christos {
     71          1.1  christos 
     72          1.1  christos     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
     73          1.1  christos         Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
     74          1.1  christos }
     75          1.1  christos 
     76          1.1  christos 
     77          1.1  christos /*******************************************************************************
     78          1.1  christos  *
     79          1.1  christos  * FUNCTION:    AcpiDmDumpSlit
     80          1.1  christos  *
     81          1.1  christos  * PARAMETERS:  Table               - An SLIT
     82          1.1  christos  *
     83          1.1  christos  * RETURN:      None
     84          1.1  christos  *
     85          1.1  christos  * DESCRIPTION: Format the contents of a SLIT
     86          1.1  christos  *
     87          1.1  christos  ******************************************************************************/
     88          1.1  christos 
     89          1.1  christos void
     90          1.1  christos AcpiDmDumpSlit (
     91          1.1  christos     ACPI_TABLE_HEADER       *Table)
     92          1.1  christos {
     93          1.1  christos     ACPI_STATUS             Status;
     94          1.1  christos     UINT32                  Offset;
     95          1.1  christos     UINT8                   *Row;
     96          1.1  christos     UINT32                  Localities;
     97          1.1  christos     UINT32                  i;
     98          1.1  christos     UINT32                  j;
     99          1.1  christos 
    100          1.1  christos 
    101          1.1  christos     /* Main table */
    102          1.1  christos 
    103          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
    104          1.1  christos     if (ACPI_FAILURE (Status))
    105          1.1  christos     {
    106          1.1  christos         return;
    107          1.1  christos     }
    108          1.1  christos 
    109          1.1  christos     /* Display the Locality NxN Matrix */
    110          1.1  christos 
    111          1.1  christos     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
    112          1.1  christos     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
    113          1.1  christos     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
    114          1.1  christos 
    115          1.1  christos     for (i = 0; i < Localities; i++)
    116          1.1  christos     {
    117          1.1  christos         /* Display one row of the matrix */
    118          1.1  christos 
    119          1.1  christos         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
    120          1.1  christos         for  (j = 0; j < Localities; j++)
    121          1.1  christos         {
    122          1.1  christos             /* Check for beyond EOT */
    123          1.1  christos 
    124          1.1  christos             if (Offset >= Table->Length)
    125          1.1  christos             {
    126          1.1  christos                 AcpiOsPrintf (
    127          1.1  christos                     "\n**** Not enough room in table for all localities\n");
    128          1.1  christos                 return;
    129          1.1  christos             }
    130          1.1  christos 
    131          1.1  christos             AcpiOsPrintf ("%2.2X", Row[j]);
    132          1.1  christos             Offset++;
    133          1.1  christos 
    134          1.1  christos             /* Display up to 16 bytes per output row */
    135          1.1  christos 
    136          1.1  christos             if ((j+1) < Localities)
    137          1.1  christos             {
    138          1.1  christos                 AcpiOsPrintf (" ");
    139          1.1  christos 
    140          1.1  christos                 if (j && (((j+1) % 16) == 0))
    141          1.1  christos                 {
    142          1.1  christos                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
    143          1.1  christos                     AcpiDmLineHeader (Offset, 0, NULL);
    144          1.1  christos                 }
    145          1.1  christos             }
    146          1.1  christos         }
    147          1.1  christos 
    148          1.1  christos         /* Point to next row */
    149          1.1  christos 
    150          1.1  christos         AcpiOsPrintf ("\n");
    151          1.1  christos         Row += Localities;
    152          1.1  christos     }
    153          1.1  christos }
    154          1.1  christos 
    155          1.1  christos 
    156          1.1  christos /*******************************************************************************
    157          1.1  christos  *
    158          1.1  christos  * FUNCTION:    AcpiDmDumpSrat
    159          1.1  christos  *
    160          1.1  christos  * PARAMETERS:  Table               - A SRAT table
    161          1.1  christos  *
    162          1.1  christos  * RETURN:      None
    163          1.1  christos  *
    164          1.1  christos  * DESCRIPTION: Format the contents of a SRAT
    165          1.1  christos  *
    166          1.1  christos  ******************************************************************************/
    167          1.1  christos 
    168          1.1  christos void
    169          1.1  christos AcpiDmDumpSrat (
    170          1.1  christos     ACPI_TABLE_HEADER       *Table)
    171          1.1  christos {
    172          1.1  christos     ACPI_STATUS             Status;
    173          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
    174          1.1  christos     ACPI_SUBTABLE_HEADER    *Subtable;
    175          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    176          1.1  christos 
    177          1.1  christos 
    178          1.1  christos     /* Main table */
    179          1.1  christos 
    180          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
    181          1.1  christos     if (ACPI_FAILURE (Status))
    182          1.1  christos     {
    183          1.1  christos         return;
    184          1.1  christos     }
    185          1.1  christos 
    186          1.1  christos     /* Subtables */
    187          1.1  christos 
    188          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
    189          1.1  christos     while (Offset < Table->Length)
    190          1.1  christos     {
    191          1.1  christos         /* Common subtable header */
    192          1.1  christos 
    193          1.1  christos         AcpiOsPrintf ("\n");
    194          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    195          1.1  christos             Subtable->Length, AcpiDmTableInfoSratHdr);
    196          1.1  christos         if (ACPI_FAILURE (Status))
    197          1.1  christos         {
    198          1.1  christos             return;
    199          1.1  christos         }
    200          1.1  christos 
    201          1.1  christos         switch (Subtable->Type)
    202          1.1  christos         {
    203          1.1  christos         case ACPI_SRAT_TYPE_CPU_AFFINITY:
    204          1.1  christos 
    205          1.1  christos             InfoTable = AcpiDmTableInfoSrat0;
    206          1.1  christos             break;
    207          1.1  christos 
    208          1.1  christos         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
    209          1.1  christos 
    210          1.1  christos             InfoTable = AcpiDmTableInfoSrat1;
    211          1.1  christos             break;
    212          1.1  christos 
    213          1.1  christos         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
    214          1.1  christos 
    215          1.1  christos             InfoTable = AcpiDmTableInfoSrat2;
    216          1.1  christos             break;
    217          1.1  christos 
    218          1.1  christos         case ACPI_SRAT_TYPE_GICC_AFFINITY:
    219          1.1  christos 
    220          1.1  christos             InfoTable = AcpiDmTableInfoSrat3;
    221          1.1  christos             break;
    222          1.1  christos 
    223          1.1  christos         case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
    224          1.1  christos 
    225          1.1  christos             InfoTable = AcpiDmTableInfoSrat4;
    226          1.1  christos             break;
    227          1.1  christos 
    228      1.1.1.3  christos         case ACPI_SRAT_TYPE_GENERIC_AFFINITY:
    229      1.1.1.3  christos 
    230      1.1.1.3  christos             InfoTable = AcpiDmTableInfoSrat5;
    231      1.1.1.3  christos             break;
    232      1.1.1.3  christos 
    233          1.1  christos         default:
    234          1.1  christos             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
    235          1.1  christos                 Subtable->Type);
    236          1.1  christos 
    237          1.1  christos             /* Attempt to continue */
    238          1.1  christos 
    239          1.1  christos             if (!Subtable->Length)
    240          1.1  christos             {
    241          1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
    242          1.1  christos                 return;
    243          1.1  christos             }
    244          1.1  christos             goto NextSubtable;
    245          1.1  christos         }
    246          1.1  christos 
    247          1.1  christos         AcpiOsPrintf ("\n");
    248          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    249          1.1  christos             Subtable->Length, InfoTable);
    250          1.1  christos         if (ACPI_FAILURE (Status))
    251          1.1  christos         {
    252          1.1  christos             return;
    253          1.1  christos         }
    254          1.1  christos 
    255          1.1  christos NextSubtable:
    256          1.1  christos         /* Point to next subtable */
    257          1.1  christos 
    258          1.1  christos         Offset += Subtable->Length;
    259          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
    260          1.1  christos             Subtable->Length);
    261          1.1  christos     }
    262          1.1  christos }
    263          1.1  christos 
    264          1.1  christos 
    265          1.1  christos /*******************************************************************************
    266          1.1  christos  *
    267          1.1  christos  * FUNCTION:    AcpiDmDumpStao
    268          1.1  christos  *
    269          1.1  christos  * PARAMETERS:  Table               - A STAO table
    270          1.1  christos  *
    271          1.1  christos  * RETURN:      None
    272          1.1  christos  *
    273          1.1  christos  * DESCRIPTION: Format the contents of a STAO. This is a variable-length
    274          1.1  christos  *              table that contains an open-ended number of ASCII strings
    275          1.1  christos  *              at the end of the table.
    276          1.1  christos  *
    277          1.1  christos  ******************************************************************************/
    278          1.1  christos 
    279          1.1  christos void
    280          1.1  christos AcpiDmDumpStao (
    281          1.1  christos     ACPI_TABLE_HEADER       *Table)
    282          1.1  christos {
    283          1.1  christos     ACPI_STATUS             Status;
    284          1.1  christos     char                    *Namepath;
    285          1.1  christos     UINT32                  Length = Table->Length;
    286          1.1  christos     UINT32                  StringLength;
    287          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
    288          1.1  christos 
    289          1.1  christos 
    290          1.1  christos     /* Main table */
    291          1.1  christos 
    292          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
    293          1.1  christos     if (ACPI_FAILURE (Status))
    294          1.1  christos     {
    295          1.1  christos         return;
    296          1.1  christos     }
    297          1.1  christos 
    298          1.1  christos     /* The rest of the table consists of Namepath strings */
    299          1.1  christos 
    300          1.1  christos     while (Offset < Table->Length)
    301          1.1  christos     {
    302          1.1  christos         Namepath = ACPI_ADD_PTR (char, Table, Offset);
    303          1.1  christos         StringLength = strlen (Namepath) + 1;
    304          1.1  christos 
    305      1.1.1.4  christos         AcpiDmLineHeader (Offset, StringLength, "Namepath");
    306          1.1  christos         AcpiOsPrintf ("\"%s\"\n", Namepath);
    307          1.1  christos 
    308          1.1  christos         /* Point to next namepath */
    309          1.1  christos 
    310          1.1  christos         Offset += StringLength;
    311          1.1  christos     }
    312          1.1  christos }
    313          1.1  christos 
    314          1.1  christos 
    315          1.1  christos /*******************************************************************************
    316          1.1  christos  *
    317          1.1  christos  * FUNCTION:    AcpiDmDumpTcpa
    318          1.1  christos  *
    319          1.1  christos  * PARAMETERS:  Table               - A TCPA table
    320          1.1  christos  *
    321          1.1  christos  * RETURN:      None
    322          1.1  christos  *
    323          1.1  christos  * DESCRIPTION: Format the contents of a TCPA.
    324          1.1  christos  *
    325          1.1  christos  * NOTE:        There are two versions of the table with the same signature:
    326          1.1  christos  *              the client version and the server version. The common
    327          1.1  christos  *              PlatformClass field is used to differentiate the two types of
    328          1.1  christos  *              tables.
    329          1.1  christos  *
    330          1.1  christos  ******************************************************************************/
    331          1.1  christos 
    332          1.1  christos void
    333          1.1  christos AcpiDmDumpTcpa (
    334          1.1  christos     ACPI_TABLE_HEADER       *Table)
    335          1.1  christos {
    336          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);
    337          1.1  christos     ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (
    338          1.1  christos                                 ACPI_TABLE_TCPA_HDR, Table);
    339          1.1  christos     ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (
    340          1.1  christos                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
    341          1.1  christos     ACPI_STATUS             Status;
    342          1.1  christos 
    343          1.1  christos 
    344          1.1  christos     /* Main table */
    345          1.1  christos 
    346          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table,
    347          1.1  christos         0, AcpiDmTableInfoTcpaHdr);
    348          1.1  christos     if (ACPI_FAILURE (Status))
    349          1.1  christos     {
    350          1.1  christos         return;
    351          1.1  christos     }
    352          1.1  christos 
    353          1.1  christos     /*
    354          1.1  christos      * Examine the PlatformClass field to determine the table type.
    355          1.1  christos      * Either a client or server table. Only one.
    356          1.1  christos      */
    357          1.1  christos     switch (CommonHeader->PlatformClass)
    358          1.1  christos     {
    359          1.1  christos     case ACPI_TCPA_CLIENT_TABLE:
    360          1.1  christos 
    361          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    362          1.1  christos             Table->Length - Offset, AcpiDmTableInfoTcpaClient);
    363          1.1  christos         break;
    364          1.1  christos 
    365          1.1  christos     case ACPI_TCPA_SERVER_TABLE:
    366          1.1  christos 
    367          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    368          1.1  christos             Table->Length - Offset, AcpiDmTableInfoTcpaServer);
    369          1.1  christos         break;
    370          1.1  christos 
    371          1.1  christos     default:
    372          1.1  christos 
    373          1.1  christos         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
    374          1.1  christos             CommonHeader->PlatformClass);
    375          1.1  christos         Status = AE_ERROR;
    376          1.1  christos         break;
    377          1.1  christos     }
    378          1.1  christos 
    379          1.1  christos     if (ACPI_FAILURE (Status))
    380          1.1  christos     {
    381          1.1  christos         AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
    382          1.1  christos     }
    383          1.1  christos }
    384          1.1  christos 
    385          1.1  christos 
    386          1.1  christos /*******************************************************************************
    387          1.1  christos  *
    388          1.1  christos  * FUNCTION:    AcpiDmDumpTpm2
    389          1.1  christos  *
    390          1.1  christos  * PARAMETERS:  Table               - A TPM2 table
    391          1.1  christos  *
    392          1.1  christos  * RETURN:      None
    393          1.1  christos  *
    394          1.1  christos  * DESCRIPTION: Format the contents of a TPM2.
    395          1.1  christos  *
    396          1.1  christos  ******************************************************************************/
    397      1.1.1.2  christos static void
    398      1.1.1.2  christos AcpiDmDumpTpm2Rev3 (
    399      1.1.1.2  christos     ACPI_TABLE_HEADER       *Table)
    400      1.1.1.2  christos {
    401      1.1.1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_TPM23);
    402      1.1.1.2  christos     ACPI_TABLE_TPM23        *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
    403      1.1.1.2  christos     ACPI_TPM23_TRAILER      *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
    404      1.1.1.2  christos     ACPI_STATUS             Status;
    405      1.1.1.2  christos 
    406      1.1.1.2  christos 
    407      1.1.1.2  christos     /* Main table */
    408      1.1.1.2  christos 
    409      1.1.1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
    410      1.1.1.2  christos     if (ACPI_FAILURE (Status))
    411      1.1.1.2  christos     {
    412      1.1.1.2  christos         return;
    413      1.1.1.2  christos     }
    414      1.1.1.2  christos 
    415      1.1.1.2  christos     /* Optional subtable if start method is ACPI start method */
    416      1.1.1.2  christos 
    417      1.1.1.2  christos     switch (CommonHeader->StartMethod)
    418      1.1.1.2  christos     {
    419      1.1.1.2  christos     case ACPI_TPM23_ACPI_START_METHOD:
    420      1.1.1.2  christos 
    421      1.1.1.4  christos         (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
    422      1.1.1.2  christos             Table->Length - Offset, AcpiDmTableInfoTpm23a);
    423      1.1.1.2  christos         break;
    424      1.1.1.2  christos 
    425      1.1.1.2  christos     default:
    426      1.1.1.2  christos         break;
    427      1.1.1.2  christos     }
    428      1.1.1.2  christos }
    429      1.1.1.2  christos 
    430      1.1.1.2  christos 
    431      1.1.1.2  christos /*******************************************************************************
    432      1.1.1.2  christos  *
    433      1.1.1.2  christos  * FUNCTION:    AcpiDmDumpTpm2
    434      1.1.1.2  christos  *
    435      1.1.1.2  christos  * PARAMETERS:  Table               - A TPM2 table
    436      1.1.1.2  christos  *
    437      1.1.1.2  christos  * RETURN:      None
    438      1.1.1.2  christos  *
    439      1.1.1.2  christos  * DESCRIPTION: Format the contents of a TPM2.
    440      1.1.1.2  christos  *
    441      1.1.1.2  christos  ******************************************************************************/
    442          1.1  christos 
    443          1.1  christos void
    444          1.1  christos AcpiDmDumpTpm2 (
    445          1.1  christos     ACPI_TABLE_HEADER       *Table)
    446          1.1  christos {
    447          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_TPM2);
    448          1.1  christos     ACPI_TABLE_TPM2         *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);
    449          1.1  christos     ACPI_TPM2_TRAILER       *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
    450          1.1  christos     ACPI_TPM2_ARM_SMC       *ArmSubtable;
    451          1.1  christos     ACPI_STATUS             Status;
    452          1.1  christos 
    453          1.1  christos 
    454      1.1.1.2  christos     if (Table->Revision == 3)
    455      1.1.1.2  christos     {
    456      1.1.1.2  christos         AcpiDmDumpTpm2Rev3(Table);
    457      1.1.1.2  christos         return;
    458      1.1.1.2  christos     }
    459      1.1.1.2  christos 
    460          1.1  christos     /* Main table */
    461          1.1  christos 
    462          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
    463      1.1.1.2  christos 
    464          1.1  christos     if (ACPI_FAILURE (Status))
    465          1.1  christos     {
    466          1.1  christos         return;
    467          1.1  christos     }
    468          1.1  christos 
    469          1.1  christos     AcpiOsPrintf ("\n");
    470          1.1  christos     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    471          1.1  christos         Table->Length - Offset, AcpiDmTableInfoTpm2a);
    472          1.1  christos     if (ACPI_FAILURE (Status))
    473          1.1  christos     {
    474          1.1  christos         return;
    475          1.1  christos     }
    476          1.1  christos 
    477          1.1  christos     switch (CommonHeader->StartMethod)
    478          1.1  christos     {
    479          1.1  christos     case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
    480          1.1  christos 
    481          1.1  christos         ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,
    482          1.1  christos             sizeof (ACPI_TPM2_TRAILER));
    483          1.1  christos         Offset += sizeof (ACPI_TPM2_TRAILER);
    484          1.1  christos 
    485          1.1  christos         AcpiOsPrintf ("\n");
    486      1.1.1.4  christos         (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
    487          1.1  christos             Table->Length - Offset, AcpiDmTableInfoTpm211);
    488          1.1  christos         break;
    489          1.1  christos 
    490          1.1  christos     default:
    491          1.1  christos         break;
    492          1.1  christos     }
    493          1.1  christos }
    494          1.1  christos 
    495          1.1  christos 
    496          1.1  christos /*******************************************************************************
    497          1.1  christos  *
    498  1.1.1.5.4.1   thorpej  * FUNCTION:    AcpiDmDumpViot
    499          1.1  christos  *
    500  1.1.1.5.4.1   thorpej  * PARAMETERS:  Table               - A VIOT table
    501          1.1  christos  *
    502          1.1  christos  * RETURN:      None
    503          1.1  christos  *
    504  1.1.1.5.4.1   thorpej  * DESCRIPTION: Format the contents of a VIOT
    505          1.1  christos  *
    506          1.1  christos  ******************************************************************************/
    507          1.1  christos 
    508          1.1  christos void
    509  1.1.1.5.4.1   thorpej AcpiDmDumpViot (
    510          1.1  christos     ACPI_TABLE_HEADER       *Table)
    511          1.1  christos {
    512          1.1  christos     ACPI_STATUS             Status;
    513  1.1.1.5.4.1   thorpej     ACPI_TABLE_VIOT         *Viot;
    514  1.1.1.5.4.1   thorpej     ACPI_VIOT_HEADER        *ViotHeader;
    515  1.1.1.5.4.1   thorpej     UINT16                  Length;
    516  1.1.1.5.4.1   thorpej     UINT16                  Offset;
    517  1.1.1.5.4.1   thorpej     ACPI_DMTABLE_INFO       *InfoTable;
    518          1.1  christos 
    519          1.1  christos     /* Main table */
    520          1.1  christos 
    521  1.1.1.5.4.1   thorpej     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoViot);
    522          1.1  christos     if (ACPI_FAILURE (Status))
    523          1.1  christos     {
    524          1.1  christos         return;
    525          1.1  christos     }
    526          1.1  christos 
    527  1.1.1.5.4.1   thorpej     Viot = ACPI_CAST_PTR (ACPI_TABLE_VIOT, Table);
    528          1.1  christos 
    529  1.1.1.5.4.1   thorpej     Offset = Viot->NodeOffset;
    530          1.1  christos     while (Offset < Table->Length)
    531          1.1  christos     {
    532          1.1  christos         /* Common subtable header */
    533  1.1.1.5.4.1   thorpej         ViotHeader = ACPI_ADD_PTR (ACPI_VIOT_HEADER, Table, Offset);
    534          1.1  christos         AcpiOsPrintf ("\n");
    535  1.1.1.5.4.1   thorpej 
    536  1.1.1.5.4.1   thorpej         Length = sizeof (ACPI_VIOT_HEADER);
    537  1.1.1.5.4.1   thorpej         Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
    538  1.1.1.5.4.1   thorpej             AcpiDmTableInfoViotHeader);
    539          1.1  christos         if (ACPI_FAILURE (Status))
    540          1.1  christos         {
    541          1.1  christos             return;
    542          1.1  christos         }
    543          1.1  christos 
    544  1.1.1.5.4.1   thorpej         Length = ViotHeader->Length;
    545  1.1.1.5.4.1   thorpej         switch (ViotHeader->Type)
    546  1.1.1.5.4.1   thorpej         {
    547  1.1.1.5.4.1   thorpej         case ACPI_VIOT_NODE_PCI_RANGE:
    548  1.1.1.5.4.1   thorpej 
    549  1.1.1.5.4.1   thorpej             InfoTable = AcpiDmTableInfoViot1;
    550  1.1.1.5.4.1   thorpej             break;
    551  1.1.1.5.4.1   thorpej 
    552  1.1.1.5.4.1   thorpej         case ACPI_VIOT_NODE_MMIO:
    553  1.1.1.5.4.1   thorpej 
    554  1.1.1.5.4.1   thorpej             InfoTable = AcpiDmTableInfoViot2;
    555  1.1.1.5.4.1   thorpej             break;
    556  1.1.1.5.4.1   thorpej 
    557  1.1.1.5.4.1   thorpej         case ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI:
    558  1.1.1.5.4.1   thorpej 
    559  1.1.1.5.4.1   thorpej             InfoTable = AcpiDmTableInfoViot3;
    560  1.1.1.5.4.1   thorpej             break;
    561  1.1.1.5.4.1   thorpej 
    562  1.1.1.5.4.1   thorpej         case ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO:
    563  1.1.1.5.4.1   thorpej 
    564  1.1.1.5.4.1   thorpej             InfoTable = AcpiDmTableInfoViot4;
    565  1.1.1.5.4.1   thorpej             break;
    566          1.1  christos 
    567  1.1.1.5.4.1   thorpej         default:
    568  1.1.1.5.4.1   thorpej 
    569  1.1.1.5.4.1   thorpej             AcpiOsPrintf ("\n*** Unknown VIOT node type 0x%X\n",
    570  1.1.1.5.4.1   thorpej                 ViotHeader->Type);
    571  1.1.1.5.4.1   thorpej 
    572  1.1.1.5.4.1   thorpej             /* Attempt to continue */
    573  1.1.1.5.4.1   thorpej 
    574  1.1.1.5.4.1   thorpej             if (!Length)
    575  1.1.1.5.4.1   thorpej             {
    576  1.1.1.5.4.1   thorpej                 AcpiOsPrintf ("Invalid zero length VIOT node\n");
    577  1.1.1.5.4.1   thorpej                 return;
    578  1.1.1.5.4.1   thorpej             }
    579  1.1.1.5.4.1   thorpej             goto NextSubtable;
    580  1.1.1.5.4.1   thorpej         }
    581  1.1.1.5.4.1   thorpej 
    582  1.1.1.5.4.1   thorpej         AcpiOsPrintf ("\n");
    583  1.1.1.5.4.1   thorpej         Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
    584  1.1.1.5.4.1   thorpej             InfoTable);
    585  1.1.1.5.4.1   thorpej         if (ACPI_FAILURE (Status))
    586  1.1.1.5.4.1   thorpej         {
    587  1.1.1.5.4.1   thorpej             return;
    588  1.1.1.5.4.1   thorpej         }
    589  1.1.1.5.4.1   thorpej 
    590  1.1.1.5.4.1   thorpej NextSubtable:
    591  1.1.1.5.4.1   thorpej         Offset += Length;
    592          1.1  christos     }
    593          1.1  christos }
    594          1.1  christos 
    595          1.1  christos 
    596          1.1  christos /*******************************************************************************
    597          1.1  christos  *
    598          1.1  christos  * FUNCTION:    AcpiDmDumpWdat
    599          1.1  christos  *
    600          1.1  christos  * PARAMETERS:  Table               - A WDAT table
    601          1.1  christos  *
    602          1.1  christos  * RETURN:      None
    603          1.1  christos  *
    604          1.1  christos  * DESCRIPTION: Format the contents of a WDAT
    605          1.1  christos  *
    606          1.1  christos  ******************************************************************************/
    607          1.1  christos 
    608          1.1  christos void
    609          1.1  christos AcpiDmDumpWdat (
    610          1.1  christos     ACPI_TABLE_HEADER       *Table)
    611          1.1  christos {
    612          1.1  christos     ACPI_STATUS             Status;
    613          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
    614          1.1  christos     ACPI_WDAT_ENTRY         *Subtable;
    615          1.1  christos 
    616          1.1  christos 
    617          1.1  christos     /* Main table */
    618          1.1  christos 
    619          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
    620          1.1  christos     if (ACPI_FAILURE (Status))
    621          1.1  christos     {
    622          1.1  christos         return;
    623          1.1  christos     }
    624          1.1  christos 
    625          1.1  christos     /* Subtables */
    626          1.1  christos 
    627          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
    628          1.1  christos     while (Offset < Table->Length)
    629          1.1  christos     {
    630          1.1  christos         /* Common subtable header */
    631          1.1  christos 
    632          1.1  christos         AcpiOsPrintf ("\n");
    633          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    634          1.1  christos             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
    635          1.1  christos         if (ACPI_FAILURE (Status))
    636          1.1  christos         {
    637          1.1  christos             return;
    638          1.1  christos         }
    639          1.1  christos 
    640          1.1  christos         /* Point to next subtable */
    641          1.1  christos 
    642          1.1  christos         Offset += sizeof (ACPI_WDAT_ENTRY);
    643          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,
    644          1.1  christos             sizeof (ACPI_WDAT_ENTRY));
    645          1.1  christos     }
    646          1.1  christos }
    647          1.1  christos 
    648          1.1  christos 
    649          1.1  christos /*******************************************************************************
    650          1.1  christos  *
    651          1.1  christos  * FUNCTION:    AcpiDmDumpWpbt
    652          1.1  christos  *
    653          1.1  christos  * PARAMETERS:  Table               - A WPBT table
    654          1.1  christos  *
    655          1.1  christos  * RETURN:      None
    656          1.1  christos  *
    657          1.1  christos  * DESCRIPTION: Format the contents of a WPBT. This table type consists
    658          1.1  christos  *              of an open-ended arguments buffer at the end of the table.
    659          1.1  christos  *
    660          1.1  christos  ******************************************************************************/
    661          1.1  christos 
    662          1.1  christos void
    663          1.1  christos AcpiDmDumpWpbt (
    664          1.1  christos     ACPI_TABLE_HEADER       *Table)
    665          1.1  christos {
    666          1.1  christos     ACPI_STATUS             Status;
    667          1.1  christos     ACPI_TABLE_WPBT         *Subtable;
    668          1.1  christos     UINT32                  Length = Table->Length;
    669          1.1  christos     UINT16                  ArgumentsLength;
    670          1.1  christos 
    671          1.1  christos 
    672          1.1  christos     /* Dump the main table */
    673          1.1  christos 
    674          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
    675          1.1  christos     if (ACPI_FAILURE (Status))
    676          1.1  christos     {
    677          1.1  christos         return;
    678          1.1  christos     }
    679          1.1  christos 
    680          1.1  christos     /* Extract the arguments buffer length from the main table */
    681          1.1  christos 
    682          1.1  christos     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
    683          1.1  christos     ArgumentsLength = Subtable->ArgumentsLength;
    684          1.1  christos 
    685          1.1  christos     /* Dump the arguments buffer */
    686          1.1  christos 
    687          1.1  christos     (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
    688          1.1  christos         AcpiDmTableInfoWpbt0);
    689          1.1  christos }
    690