Home | History | Annotate | Line # | Download | only in common
dmtbdump2.c revision 1.1.1.1.4.3
      1          1.1  christos /******************************************************************************
      2          1.1  christos  *
      3          1.1  christos  * Module Name: dmtbdump2 - 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.1.4.2    martin  * Copyright (C) 2000 - 2020, 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  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY 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    ("dmtbdump2")
     53          1.1  christos 
     54          1.1  christos 
     55          1.1  christos /*******************************************************************************
     56          1.1  christos  *
     57          1.1  christos  * FUNCTION:    AcpiDmDumpIort
     58          1.1  christos  *
     59          1.1  christos  * PARAMETERS:  Table               - A IORT 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 IORT
     64          1.1  christos  *
     65          1.1  christos  ******************************************************************************/
     66          1.1  christos 
     67          1.1  christos void
     68          1.1  christos AcpiDmDumpIort (
     69          1.1  christos     ACPI_TABLE_HEADER       *Table)
     70          1.1  christos {
     71          1.1  christos     ACPI_STATUS             Status;
     72          1.1  christos     ACPI_TABLE_IORT         *Iort;
     73          1.1  christos     ACPI_IORT_NODE          *IortNode;
     74          1.1  christos     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
     75          1.1  christos     ACPI_IORT_SMMU          *IortSmmu = NULL;
     76          1.1  christos     UINT32                  Offset;
     77          1.1  christos     UINT32                  NodeOffset;
     78          1.1  christos     UINT32                  Length;
     79          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
     80          1.1  christos     char                    *String;
     81          1.1  christos     UINT32                  i;
     82  1.1.1.1.4.2    martin     UINT32                  MappingByteLength;
     83          1.1  christos 
     84          1.1  christos 
     85          1.1  christos     /* Main table */
     86          1.1  christos 
     87          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
     88          1.1  christos     if (ACPI_FAILURE (Status))
     89          1.1  christos     {
     90          1.1  christos         return;
     91          1.1  christos     }
     92          1.1  christos 
     93          1.1  christos     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
     94          1.1  christos     Offset = sizeof (ACPI_TABLE_IORT);
     95          1.1  christos 
     96          1.1  christos     /* Dump the OptionalPadding (optional) */
     97          1.1  christos 
     98          1.1  christos     if (Iort->NodeOffset > Offset)
     99          1.1  christos     {
    100          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
    101          1.1  christos             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
    102          1.1  christos         if (ACPI_FAILURE (Status))
    103          1.1  christos         {
    104          1.1  christos             return;
    105          1.1  christos         }
    106          1.1  christos     }
    107          1.1  christos 
    108          1.1  christos     Offset = Iort->NodeOffset;
    109          1.1  christos     while (Offset < Table->Length)
    110          1.1  christos     {
    111          1.1  christos         /* Common subtable header */
    112          1.1  christos 
    113          1.1  christos         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
    114          1.1  christos         AcpiOsPrintf ("\n");
    115          1.1  christos         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
    116          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset,
    117          1.1  christos             IortNode, Length, AcpiDmTableInfoIortHdr);
    118          1.1  christos         if (ACPI_FAILURE (Status))
    119          1.1  christos         {
    120          1.1  christos             return;
    121          1.1  christos         }
    122          1.1  christos 
    123          1.1  christos         NodeOffset = Length;
    124          1.1  christos 
    125          1.1  christos         switch (IortNode->Type)
    126          1.1  christos         {
    127          1.1  christos         case ACPI_IORT_NODE_ITS_GROUP:
    128          1.1  christos 
    129          1.1  christos             InfoTable = AcpiDmTableInfoIort0;
    130          1.1  christos             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
    131          1.1  christos             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
    132          1.1  christos             break;
    133          1.1  christos 
    134          1.1  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
    135          1.1  christos 
    136          1.1  christos             InfoTable = AcpiDmTableInfoIort1;
    137          1.1  christos             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
    138          1.1  christos             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
    139          1.1  christos             Length += strlen (String) + 1;
    140          1.1  christos             break;
    141          1.1  christos 
    142          1.1  christos         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
    143          1.1  christos 
    144          1.1  christos             InfoTable = AcpiDmTableInfoIort2;
    145          1.1  christos             Length = IortNode->Length - NodeOffset;
    146          1.1  christos             break;
    147          1.1  christos 
    148          1.1  christos         case ACPI_IORT_NODE_SMMU:
    149          1.1  christos 
    150          1.1  christos             InfoTable = AcpiDmTableInfoIort3;
    151          1.1  christos             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
    152          1.1  christos             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
    153          1.1  christos             break;
    154          1.1  christos 
    155          1.1  christos         case ACPI_IORT_NODE_SMMU_V3:
    156          1.1  christos 
    157          1.1  christos             InfoTable = AcpiDmTableInfoIort4;
    158          1.1  christos             Length = IortNode->Length - NodeOffset;
    159          1.1  christos             break;
    160          1.1  christos 
    161  1.1.1.1.4.1  christos         case ACPI_IORT_NODE_PMCG:
    162  1.1.1.1.4.1  christos 
    163  1.1.1.1.4.1  christos             InfoTable = AcpiDmTableInfoIort5;
    164  1.1.1.1.4.1  christos             Length = IortNode->Length - NodeOffset;
    165  1.1.1.1.4.1  christos             break;
    166  1.1.1.1.4.1  christos 
    167          1.1  christos         default:
    168          1.1  christos 
    169          1.1  christos             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
    170          1.1  christos                 IortNode->Type);
    171          1.1  christos 
    172          1.1  christos             /* Attempt to continue */
    173          1.1  christos 
    174          1.1  christos             if (!IortNode->Length)
    175          1.1  christos             {
    176          1.1  christos                 AcpiOsPrintf ("Invalid zero length IORT node\n");
    177          1.1  christos                 return;
    178          1.1  christos             }
    179          1.1  christos             goto NextSubtable;
    180          1.1  christos         }
    181          1.1  christos 
    182          1.1  christos         /* Dump the node subtable header */
    183          1.1  christos 
    184          1.1  christos         AcpiOsPrintf ("\n");
    185          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    186          1.1  christos             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    187          1.1  christos             Length, InfoTable);
    188          1.1  christos         if (ACPI_FAILURE (Status))
    189          1.1  christos         {
    190          1.1  christos             return;
    191          1.1  christos         }
    192          1.1  christos 
    193          1.1  christos         NodeOffset += Length;
    194          1.1  christos 
    195          1.1  christos         /* Dump the node specific data */
    196          1.1  christos 
    197          1.1  christos         switch (IortNode->Type)
    198          1.1  christos         {
    199          1.1  christos         case ACPI_IORT_NODE_ITS_GROUP:
    200          1.1  christos 
    201          1.1  christos             /* Validate IortItsGroup to avoid compiler warnings */
    202          1.1  christos 
    203          1.1  christos             if (IortItsGroup)
    204          1.1  christos             {
    205          1.1  christos                 for (i = 0; i < IortItsGroup->ItsCount; i++)
    206          1.1  christos                 {
    207          1.1  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    208          1.1  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    209          1.1  christos                         4, AcpiDmTableInfoIort0a);
    210  1.1.1.1.4.2    martin                     if (ACPI_FAILURE (Status))
    211  1.1.1.1.4.2    martin                     {
    212  1.1.1.1.4.2    martin                         return;
    213  1.1.1.1.4.2    martin                     }
    214  1.1.1.1.4.2    martin 
    215          1.1  christos                     NodeOffset += 4;
    216          1.1  christos                 }
    217          1.1  christos             }
    218          1.1  christos             break;
    219          1.1  christos 
    220          1.1  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
    221          1.1  christos 
    222          1.1  christos             /* Dump the Padding (optional) */
    223          1.1  christos 
    224          1.1  christos             if (IortNode->Length > NodeOffset)
    225          1.1  christos             {
    226  1.1.1.1.4.2    martin                 MappingByteLength =
    227  1.1.1.1.4.2    martin                     IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
    228          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    229  1.1.1.1.4.2    martin                     Table, IortNode->Length - NodeOffset - MappingByteLength,
    230          1.1  christos                     AcpiDmTableInfoIort1a);
    231          1.1  christos                 if (ACPI_FAILURE (Status))
    232          1.1  christos                 {
    233          1.1  christos                     return;
    234          1.1  christos                 }
    235          1.1  christos             }
    236          1.1  christos             break;
    237          1.1  christos 
    238          1.1  christos         case ACPI_IORT_NODE_SMMU:
    239          1.1  christos 
    240          1.1  christos             AcpiOsPrintf ("\n");
    241          1.1  christos 
    242          1.1  christos             /* Validate IortSmmu to avoid compiler warnings */
    243          1.1  christos 
    244          1.1  christos             if (IortSmmu)
    245          1.1  christos             {
    246          1.1  christos                 Length = 2 * sizeof (UINT64);
    247          1.1  christos                 NodeOffset = IortSmmu->GlobalInterruptOffset;
    248          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    249          1.1  christos                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    250          1.1  christos                     Length, AcpiDmTableInfoIort3a);
    251          1.1  christos                 if (ACPI_FAILURE (Status))
    252          1.1  christos                 {
    253          1.1  christos                     return;
    254          1.1  christos                 }
    255          1.1  christos 
    256          1.1  christos                 NodeOffset = IortSmmu->ContextInterruptOffset;
    257          1.1  christos                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
    258          1.1  christos                 {
    259          1.1  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    260          1.1  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    261          1.1  christos                         8, AcpiDmTableInfoIort3b);
    262          1.1  christos                     if (ACPI_FAILURE (Status))
    263          1.1  christos                     {
    264          1.1  christos                         return;
    265          1.1  christos                     }
    266          1.1  christos 
    267          1.1  christos                     NodeOffset += 8;
    268          1.1  christos                 }
    269          1.1  christos 
    270          1.1  christos                 NodeOffset = IortSmmu->PmuInterruptOffset;
    271          1.1  christos                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
    272          1.1  christos                 {
    273          1.1  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    274          1.1  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    275          1.1  christos                         8, AcpiDmTableInfoIort3c);
    276          1.1  christos                     if (ACPI_FAILURE (Status))
    277          1.1  christos                     {
    278          1.1  christos                         return;
    279          1.1  christos                     }
    280          1.1  christos 
    281          1.1  christos                     NodeOffset += 8;
    282          1.1  christos                 }
    283          1.1  christos             }
    284          1.1  christos             break;
    285          1.1  christos 
    286          1.1  christos         default:
    287          1.1  christos 
    288          1.1  christos             break;
    289          1.1  christos         }
    290          1.1  christos 
    291          1.1  christos         /* Dump the ID mappings */
    292          1.1  christos 
    293          1.1  christos         NodeOffset = IortNode->MappingOffset;
    294          1.1  christos         for (i = 0; i < IortNode->MappingCount; i++)
    295          1.1  christos         {
    296          1.1  christos             AcpiOsPrintf ("\n");
    297          1.1  christos             Length = sizeof (ACPI_IORT_ID_MAPPING);
    298          1.1  christos             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    299          1.1  christos                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    300          1.1  christos                 Length, AcpiDmTableInfoIortMap);
    301          1.1  christos             if (ACPI_FAILURE (Status))
    302          1.1  christos             {
    303          1.1  christos                 return;
    304          1.1  christos             }
    305          1.1  christos 
    306          1.1  christos             NodeOffset += Length;
    307          1.1  christos         }
    308          1.1  christos 
    309          1.1  christos NextSubtable:
    310          1.1  christos         /* Point to next node subtable */
    311          1.1  christos 
    312          1.1  christos         Offset += IortNode->Length;
    313          1.1  christos     }
    314          1.1  christos }
    315          1.1  christos 
    316          1.1  christos 
    317          1.1  christos /*******************************************************************************
    318          1.1  christos  *
    319          1.1  christos  * FUNCTION:    AcpiDmDumpIvrs
    320          1.1  christos  *
    321          1.1  christos  * PARAMETERS:  Table               - A IVRS table
    322          1.1  christos  *
    323          1.1  christos  * RETURN:      None
    324          1.1  christos  *
    325          1.1  christos  * DESCRIPTION: Format the contents of a IVRS
    326          1.1  christos  *
    327          1.1  christos  ******************************************************************************/
    328          1.1  christos 
    329          1.1  christos static UINT8 EntrySizes[] = {4,8,16,32};
    330          1.1  christos 
    331          1.1  christos void
    332          1.1  christos AcpiDmDumpIvrs (
    333          1.1  christos     ACPI_TABLE_HEADER       *Table)
    334          1.1  christos {
    335          1.1  christos     ACPI_STATUS             Status;
    336          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
    337          1.1  christos     UINT32                  EntryOffset;
    338          1.1  christos     UINT32                  EntryLength;
    339          1.1  christos     UINT32                  EntryType;
    340          1.1  christos     ACPI_IVRS_DE_HEADER     *DeviceEntry;
    341          1.1  christos     ACPI_IVRS_HEADER        *Subtable;
    342          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    343          1.1  christos 
    344          1.1  christos 
    345          1.1  christos     /* Main table */
    346          1.1  christos 
    347          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
    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     /* Subtables */
    354          1.1  christos 
    355          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
    356          1.1  christos     while (Offset < Table->Length)
    357          1.1  christos     {
    358          1.1  christos         /* Common subtable header */
    359          1.1  christos 
    360          1.1  christos         AcpiOsPrintf ("\n");
    361          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    362          1.1  christos             Subtable->Length, AcpiDmTableInfoIvrsHdr);
    363          1.1  christos         if (ACPI_FAILURE (Status))
    364          1.1  christos         {
    365          1.1  christos             return;
    366          1.1  christos         }
    367          1.1  christos 
    368          1.1  christos         switch (Subtable->Type)
    369          1.1  christos         {
    370  1.1.1.1.4.2    martin         case ACPI_IVRS_TYPE_HARDWARE1:
    371          1.1  christos 
    372          1.1  christos             InfoTable = AcpiDmTableInfoIvrs0;
    373          1.1  christos             break;
    374          1.1  christos 
    375  1.1.1.1.4.2    martin         case ACPI_IVRS_TYPE_HARDWARE2:
    376  1.1.1.1.4.2    martin 
    377  1.1.1.1.4.2    martin             InfoTable = AcpiDmTableInfoIvrs01;
    378  1.1.1.1.4.2    martin             break;
    379  1.1.1.1.4.2    martin 
    380          1.1  christos         case ACPI_IVRS_TYPE_MEMORY1:
    381          1.1  christos         case ACPI_IVRS_TYPE_MEMORY2:
    382          1.1  christos         case ACPI_IVRS_TYPE_MEMORY3:
    383          1.1  christos 
    384          1.1  christos             InfoTable = AcpiDmTableInfoIvrs1;
    385          1.1  christos             break;
    386          1.1  christos 
    387          1.1  christos         default:
    388          1.1  christos 
    389          1.1  christos             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
    390          1.1  christos                 Subtable->Type);
    391          1.1  christos 
    392          1.1  christos             /* Attempt to continue */
    393          1.1  christos 
    394          1.1  christos             if (!Subtable->Length)
    395          1.1  christos             {
    396          1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
    397          1.1  christos                 return;
    398          1.1  christos             }
    399          1.1  christos             goto NextSubtable;
    400          1.1  christos         }
    401          1.1  christos 
    402          1.1  christos         /* Dump the subtable */
    403          1.1  christos 
    404          1.1  christos         AcpiOsPrintf ("\n");
    405          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    406          1.1  christos             Subtable->Length, InfoTable);
    407          1.1  christos         if (ACPI_FAILURE (Status))
    408          1.1  christos         {
    409          1.1  christos             return;
    410          1.1  christos         }
    411          1.1  christos 
    412          1.1  christos         /* The hardware subtable can contain multiple device entries */
    413          1.1  christos 
    414  1.1.1.1.4.2    martin         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
    415  1.1.1.1.4.2    martin             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2)
    416          1.1  christos         {
    417  1.1.1.1.4.2    martin             if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
    418  1.1.1.1.4.2    martin             {
    419  1.1.1.1.4.2    martin                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
    420  1.1.1.1.4.2    martin                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
    421  1.1.1.1.4.2    martin                     sizeof (ACPI_IVRS_HARDWARE1));
    422  1.1.1.1.4.2    martin             }
    423  1.1.1.1.4.2    martin             else if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2)
    424  1.1.1.1.4.2    martin             {
    425  1.1.1.1.4.2    martin                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
    426  1.1.1.1.4.2    martin                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
    427  1.1.1.1.4.2    martin                     sizeof (ACPI_IVRS_HARDWARE2));
    428  1.1.1.1.4.2    martin             }
    429          1.1  christos 
    430          1.1  christos             while (EntryOffset < (Offset + Subtable->Length))
    431          1.1  christos             {
    432          1.1  christos                 AcpiOsPrintf ("\n");
    433          1.1  christos                 /*
    434          1.1  christos                  * Upper 2 bits of Type encode the length of the device entry
    435          1.1  christos                  *
    436          1.1  christos                  * 00 = 4 byte
    437          1.1  christos                  * 01 = 8 byte
    438          1.1  christos                  * 10 = 16 byte - currently no entries defined
    439          1.1  christos                  * 11 = 32 byte - currently no entries defined
    440          1.1  christos                  */
    441          1.1  christos                 EntryType = DeviceEntry->Type;
    442          1.1  christos                 EntryLength = EntrySizes [EntryType >> 6];
    443          1.1  christos 
    444          1.1  christos                 switch (EntryType)
    445          1.1  christos                 {
    446          1.1  christos                 /* 4-byte device entries */
    447          1.1  christos 
    448          1.1  christos                 case ACPI_IVRS_TYPE_PAD4:
    449          1.1  christos                 case ACPI_IVRS_TYPE_ALL:
    450          1.1  christos                 case ACPI_IVRS_TYPE_SELECT:
    451          1.1  christos                 case ACPI_IVRS_TYPE_START:
    452          1.1  christos                 case ACPI_IVRS_TYPE_END:
    453          1.1  christos 
    454          1.1  christos                     InfoTable = AcpiDmTableInfoIvrs4;
    455          1.1  christos                     break;
    456          1.1  christos 
    457          1.1  christos                 /* 8-byte entries, type A */
    458          1.1  christos 
    459          1.1  christos                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
    460          1.1  christos                 case ACPI_IVRS_TYPE_ALIAS_START:
    461          1.1  christos 
    462          1.1  christos                     InfoTable = AcpiDmTableInfoIvrs8a;
    463          1.1  christos                     break;
    464          1.1  christos 
    465          1.1  christos                 /* 8-byte entries, type B */
    466          1.1  christos 
    467          1.1  christos                 case ACPI_IVRS_TYPE_PAD8:
    468          1.1  christos                 case ACPI_IVRS_TYPE_EXT_SELECT:
    469          1.1  christos                 case ACPI_IVRS_TYPE_EXT_START:
    470          1.1  christos 
    471          1.1  christos                     InfoTable = AcpiDmTableInfoIvrs8b;
    472          1.1  christos                     break;
    473          1.1  christos 
    474          1.1  christos                 /* 8-byte entries, type C */
    475          1.1  christos 
    476          1.1  christos                 case ACPI_IVRS_TYPE_SPECIAL:
    477          1.1  christos 
    478          1.1  christos                     InfoTable = AcpiDmTableInfoIvrs8c;
    479          1.1  christos                     break;
    480          1.1  christos 
    481          1.1  christos                 default:
    482          1.1  christos                     InfoTable = AcpiDmTableInfoIvrs4;
    483          1.1  christos                     AcpiOsPrintf (
    484          1.1  christos                         "\n**** Unknown IVRS device entry type/length: "
    485          1.1  christos                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
    486          1.1  christos                         EntryType, EntryLength, EntryOffset);
    487          1.1  christos                     break;
    488          1.1  christos                 }
    489          1.1  christos 
    490          1.1  christos                 /* Dump the Device Entry */
    491          1.1  christos 
    492          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    493          1.1  christos                     DeviceEntry, EntryLength, InfoTable);
    494          1.1  christos                 if (ACPI_FAILURE (Status))
    495          1.1  christos                 {
    496          1.1  christos                     return;
    497          1.1  christos                 }
    498          1.1  christos 
    499          1.1  christos                 EntryOffset += EntryLength;
    500          1.1  christos                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
    501          1.1  christos                     EntryLength);
    502          1.1  christos             }
    503          1.1  christos         }
    504          1.1  christos 
    505          1.1  christos NextSubtable:
    506          1.1  christos         /* Point to next subtable */
    507          1.1  christos 
    508          1.1  christos         Offset += Subtable->Length;
    509          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
    510          1.1  christos     }
    511          1.1  christos }
    512          1.1  christos 
    513          1.1  christos 
    514          1.1  christos /*******************************************************************************
    515          1.1  christos  *
    516          1.1  christos  * FUNCTION:    AcpiDmDumpLpit
    517          1.1  christos  *
    518          1.1  christos  * PARAMETERS:  Table               - A LPIT table
    519          1.1  christos  *
    520          1.1  christos  * RETURN:      None
    521          1.1  christos  *
    522          1.1  christos  * DESCRIPTION: Format the contents of a LPIT. This table type consists
    523          1.1  christos  *              of an open-ended number of subtables. Note: There are no
    524          1.1  christos  *              entries in the main table. An LPIT consists of the table
    525          1.1  christos  *              header and then subtables only.
    526          1.1  christos  *
    527          1.1  christos  ******************************************************************************/
    528          1.1  christos 
    529          1.1  christos void
    530          1.1  christos AcpiDmDumpLpit (
    531          1.1  christos     ACPI_TABLE_HEADER       *Table)
    532          1.1  christos {
    533          1.1  christos     ACPI_STATUS             Status;
    534          1.1  christos     ACPI_LPIT_HEADER        *Subtable;
    535          1.1  christos     UINT32                  Length = Table->Length;
    536          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
    537          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    538          1.1  christos     UINT32                  SubtableLength;
    539          1.1  christos 
    540          1.1  christos 
    541          1.1  christos     /* Subtables */
    542          1.1  christos 
    543          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
    544          1.1  christos     while (Offset < Table->Length)
    545          1.1  christos     {
    546          1.1  christos         /* Common subtable header */
    547          1.1  christos 
    548          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    549          1.1  christos             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
    550          1.1  christos         if (ACPI_FAILURE (Status))
    551          1.1  christos         {
    552          1.1  christos             return;
    553          1.1  christos         }
    554          1.1  christos 
    555          1.1  christos         switch (Subtable->Type)
    556          1.1  christos         {
    557          1.1  christos         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
    558          1.1  christos 
    559          1.1  christos             InfoTable = AcpiDmTableInfoLpit0;
    560          1.1  christos             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
    561          1.1  christos             break;
    562          1.1  christos 
    563          1.1  christos         default:
    564          1.1  christos 
    565          1.1  christos             /* Cannot continue on unknown type - no length */
    566          1.1  christos 
    567          1.1  christos             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
    568          1.1  christos                 Subtable->Type);
    569          1.1  christos             return;
    570          1.1  christos         }
    571          1.1  christos 
    572          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    573          1.1  christos             SubtableLength, InfoTable);
    574          1.1  christos         if (ACPI_FAILURE (Status))
    575          1.1  christos         {
    576          1.1  christos             return;
    577          1.1  christos         }
    578          1.1  christos 
    579          1.1  christos         AcpiOsPrintf ("\n");
    580          1.1  christos 
    581          1.1  christos         /* Point to next subtable */
    582          1.1  christos 
    583          1.1  christos         Offset += SubtableLength;
    584          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
    585          1.1  christos     }
    586          1.1  christos }
    587          1.1  christos 
    588          1.1  christos 
    589          1.1  christos /*******************************************************************************
    590          1.1  christos  *
    591          1.1  christos  * FUNCTION:    AcpiDmDumpMadt
    592          1.1  christos  *
    593          1.1  christos  * PARAMETERS:  Table               - A MADT table
    594          1.1  christos  *
    595          1.1  christos  * RETURN:      None
    596          1.1  christos  *
    597          1.1  christos  * DESCRIPTION: Format the contents of a MADT. This table type consists
    598          1.1  christos  *              of an open-ended number of subtables.
    599          1.1  christos  *
    600          1.1  christos  ******************************************************************************/
    601          1.1  christos 
    602          1.1  christos void
    603          1.1  christos AcpiDmDumpMadt (
    604          1.1  christos     ACPI_TABLE_HEADER       *Table)
    605          1.1  christos {
    606          1.1  christos     ACPI_STATUS             Status;
    607          1.1  christos     ACPI_SUBTABLE_HEADER    *Subtable;
    608          1.1  christos     UINT32                  Length = Table->Length;
    609          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
    610          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    611          1.1  christos 
    612          1.1  christos 
    613          1.1  christos     /* Main table */
    614          1.1  christos 
    615          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
    616          1.1  christos     if (ACPI_FAILURE (Status))
    617          1.1  christos     {
    618          1.1  christos         return;
    619          1.1  christos     }
    620          1.1  christos 
    621          1.1  christos     /* Subtables */
    622          1.1  christos 
    623          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
    624          1.1  christos     while (Offset < Table->Length)
    625          1.1  christos     {
    626          1.1  christos         /* Common subtable header */
    627          1.1  christos 
    628          1.1  christos         AcpiOsPrintf ("\n");
    629          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    630          1.1  christos             Subtable->Length, AcpiDmTableInfoMadtHdr);
    631          1.1  christos         if (ACPI_FAILURE (Status))
    632          1.1  christos         {
    633          1.1  christos             return;
    634          1.1  christos         }
    635          1.1  christos 
    636          1.1  christos         switch (Subtable->Type)
    637          1.1  christos         {
    638          1.1  christos         case ACPI_MADT_TYPE_LOCAL_APIC:
    639          1.1  christos 
    640          1.1  christos             InfoTable = AcpiDmTableInfoMadt0;
    641          1.1  christos             break;
    642          1.1  christos 
    643          1.1  christos         case ACPI_MADT_TYPE_IO_APIC:
    644          1.1  christos 
    645          1.1  christos             InfoTable = AcpiDmTableInfoMadt1;
    646          1.1  christos             break;
    647          1.1  christos 
    648          1.1  christos         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
    649          1.1  christos 
    650          1.1  christos             InfoTable = AcpiDmTableInfoMadt2;
    651          1.1  christos             break;
    652          1.1  christos 
    653          1.1  christos         case ACPI_MADT_TYPE_NMI_SOURCE:
    654          1.1  christos 
    655          1.1  christos             InfoTable = AcpiDmTableInfoMadt3;
    656          1.1  christos             break;
    657          1.1  christos 
    658          1.1  christos         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
    659          1.1  christos 
    660          1.1  christos             InfoTable = AcpiDmTableInfoMadt4;
    661          1.1  christos             break;
    662          1.1  christos 
    663          1.1  christos         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
    664          1.1  christos 
    665          1.1  christos             InfoTable = AcpiDmTableInfoMadt5;
    666          1.1  christos             break;
    667          1.1  christos 
    668          1.1  christos         case ACPI_MADT_TYPE_IO_SAPIC:
    669          1.1  christos 
    670          1.1  christos             InfoTable = AcpiDmTableInfoMadt6;
    671          1.1  christos             break;
    672          1.1  christos 
    673          1.1  christos         case ACPI_MADT_TYPE_LOCAL_SAPIC:
    674          1.1  christos 
    675          1.1  christos             InfoTable = AcpiDmTableInfoMadt7;
    676          1.1  christos             break;
    677          1.1  christos 
    678          1.1  christos         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
    679          1.1  christos 
    680          1.1  christos             InfoTable = AcpiDmTableInfoMadt8;
    681          1.1  christos             break;
    682          1.1  christos 
    683          1.1  christos         case ACPI_MADT_TYPE_LOCAL_X2APIC:
    684          1.1  christos 
    685          1.1  christos             InfoTable = AcpiDmTableInfoMadt9;
    686          1.1  christos             break;
    687          1.1  christos 
    688          1.1  christos         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
    689          1.1  christos 
    690          1.1  christos             InfoTable = AcpiDmTableInfoMadt10;
    691          1.1  christos             break;
    692          1.1  christos 
    693          1.1  christos         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
    694          1.1  christos 
    695          1.1  christos             InfoTable = AcpiDmTableInfoMadt11;
    696          1.1  christos             break;
    697          1.1  christos 
    698          1.1  christos         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
    699          1.1  christos 
    700          1.1  christos             InfoTable = AcpiDmTableInfoMadt12;
    701          1.1  christos             break;
    702          1.1  christos 
    703          1.1  christos         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
    704          1.1  christos 
    705          1.1  christos             InfoTable = AcpiDmTableInfoMadt13;
    706          1.1  christos             break;
    707          1.1  christos 
    708          1.1  christos         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
    709          1.1  christos 
    710          1.1  christos             InfoTable = AcpiDmTableInfoMadt14;
    711          1.1  christos             break;
    712          1.1  christos 
    713          1.1  christos         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
    714          1.1  christos 
    715          1.1  christos             InfoTable = AcpiDmTableInfoMadt15;
    716          1.1  christos             break;
    717          1.1  christos 
    718          1.1  christos         default:
    719          1.1  christos 
    720          1.1  christos             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
    721          1.1  christos                 Subtable->Type);
    722          1.1  christos 
    723          1.1  christos             /* Attempt to continue */
    724          1.1  christos 
    725          1.1  christos             if (!Subtable->Length)
    726          1.1  christos             {
    727          1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
    728          1.1  christos                 return;
    729          1.1  christos             }
    730          1.1  christos 
    731          1.1  christos             goto NextSubtable;
    732          1.1  christos         }
    733          1.1  christos 
    734          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    735          1.1  christos             Subtable->Length, InfoTable);
    736          1.1  christos         if (ACPI_FAILURE (Status))
    737          1.1  christos         {
    738          1.1  christos             return;
    739          1.1  christos         }
    740          1.1  christos 
    741          1.1  christos NextSubtable:
    742          1.1  christos         /* Point to next subtable */
    743          1.1  christos 
    744          1.1  christos         Offset += Subtable->Length;
    745          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
    746          1.1  christos             Subtable->Length);
    747          1.1  christos     }
    748          1.1  christos }
    749          1.1  christos 
    750          1.1  christos 
    751          1.1  christos /*******************************************************************************
    752          1.1  christos  *
    753          1.1  christos  * FUNCTION:    AcpiDmDumpMcfg
    754          1.1  christos  *
    755          1.1  christos  * PARAMETERS:  Table               - A MCFG Table
    756          1.1  christos  *
    757          1.1  christos  * RETURN:      None
    758          1.1  christos  *
    759          1.1  christos  * DESCRIPTION: Format the contents of a MCFG table
    760          1.1  christos  *
    761          1.1  christos  ******************************************************************************/
    762          1.1  christos 
    763          1.1  christos void
    764          1.1  christos AcpiDmDumpMcfg (
    765          1.1  christos     ACPI_TABLE_HEADER       *Table)
    766          1.1  christos {
    767          1.1  christos     ACPI_STATUS             Status;
    768          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
    769          1.1  christos     ACPI_MCFG_ALLOCATION    *Subtable;
    770          1.1  christos 
    771          1.1  christos 
    772          1.1  christos     /* Main table */
    773          1.1  christos 
    774          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
    775          1.1  christos     if (ACPI_FAILURE (Status))
    776          1.1  christos     {
    777          1.1  christos         return;
    778          1.1  christos     }
    779          1.1  christos 
    780          1.1  christos     /* Subtables */
    781          1.1  christos 
    782          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
    783          1.1  christos     while (Offset < Table->Length)
    784          1.1  christos     {
    785          1.1  christos         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
    786          1.1  christos         {
    787          1.1  christos             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
    788  1.1.1.1.4.3    martin                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
    789          1.1  christos             return;
    790          1.1  christos         }
    791          1.1  christos 
    792          1.1  christos         AcpiOsPrintf ("\n");
    793          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    794          1.1  christos             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
    795          1.1  christos         if (ACPI_FAILURE (Status))
    796          1.1  christos         {
    797          1.1  christos             return;
    798          1.1  christos         }
    799          1.1  christos 
    800          1.1  christos         /* Point to next subtable (each subtable is of fixed length) */
    801          1.1  christos 
    802          1.1  christos         Offset += sizeof (ACPI_MCFG_ALLOCATION);
    803          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
    804          1.1  christos             sizeof (ACPI_MCFG_ALLOCATION));
    805          1.1  christos     }
    806          1.1  christos }
    807          1.1  christos 
    808          1.1  christos 
    809          1.1  christos /*******************************************************************************
    810          1.1  christos  *
    811          1.1  christos  * FUNCTION:    AcpiDmDumpMpst
    812          1.1  christos  *
    813          1.1  christos  * PARAMETERS:  Table               - A MPST Table
    814          1.1  christos  *
    815          1.1  christos  * RETURN:      None
    816          1.1  christos  *
    817          1.1  christos  * DESCRIPTION: Format the contents of a MPST table
    818          1.1  christos  *
    819          1.1  christos  ******************************************************************************/
    820          1.1  christos 
    821          1.1  christos void
    822          1.1  christos AcpiDmDumpMpst (
    823          1.1  christos     ACPI_TABLE_HEADER       *Table)
    824          1.1  christos {
    825          1.1  christos     ACPI_STATUS             Status;
    826          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
    827          1.1  christos     ACPI_MPST_POWER_NODE    *Subtable0;
    828          1.1  christos     ACPI_MPST_POWER_STATE   *Subtable0A;
    829          1.1  christos     ACPI_MPST_COMPONENT     *Subtable0B;
    830          1.1  christos     ACPI_MPST_DATA_HDR      *Subtable1;
    831          1.1  christos     ACPI_MPST_POWER_DATA    *Subtable2;
    832          1.1  christos     UINT16                  SubtableCount;
    833          1.1  christos     UINT32                  PowerStateCount;
    834          1.1  christos     UINT32                  ComponentCount;
    835          1.1  christos 
    836          1.1  christos 
    837          1.1  christos     /* Main table */
    838          1.1  christos 
    839          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
    840          1.1  christos     if (ACPI_FAILURE (Status))
    841          1.1  christos     {
    842          1.1  christos         return;
    843          1.1  christos     }
    844          1.1  christos 
    845          1.1  christos     /* Subtable: Memory Power Node(s) */
    846          1.1  christos 
    847          1.1  christos     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
    848          1.1  christos     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
    849          1.1  christos 
    850          1.1  christos     while ((Offset < Table->Length) && SubtableCount)
    851          1.1  christos     {
    852          1.1  christos         AcpiOsPrintf ("\n");
    853          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
    854          1.1  christos             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
    855          1.1  christos         if (ACPI_FAILURE (Status))
    856          1.1  christos         {
    857          1.1  christos             return;
    858          1.1  christos         }
    859          1.1  christos 
    860          1.1  christos         /* Extract the sub-subtable counts */
    861          1.1  christos 
    862          1.1  christos         PowerStateCount = Subtable0->NumPowerStates;
    863          1.1  christos         ComponentCount = Subtable0->NumPhysicalComponents;
    864          1.1  christos         Offset += sizeof (ACPI_MPST_POWER_NODE);
    865          1.1  christos 
    866          1.1  christos         /* Sub-subtables - Memory Power State Structure(s) */
    867          1.1  christos 
    868          1.1  christos         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
    869          1.1  christos             sizeof (ACPI_MPST_POWER_NODE));
    870          1.1  christos 
    871          1.1  christos         while (PowerStateCount)
    872          1.1  christos         {
    873          1.1  christos             AcpiOsPrintf ("\n");
    874          1.1  christos             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
    875          1.1  christos                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
    876          1.1  christos             if (ACPI_FAILURE (Status))
    877          1.1  christos             {
    878          1.1  christos                 return;
    879          1.1  christos             }
    880          1.1  christos 
    881          1.1  christos             Subtable0A++;
    882          1.1  christos             PowerStateCount--;
    883          1.1  christos             Offset += sizeof (ACPI_MPST_POWER_STATE);
    884          1.1  christos        }
    885          1.1  christos 
    886          1.1  christos         /* Sub-subtables - Physical Component ID Structure(s) */
    887          1.1  christos 
    888          1.1  christos         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
    889          1.1  christos 
    890          1.1  christos         if (ComponentCount)
    891          1.1  christos         {
    892          1.1  christos             AcpiOsPrintf ("\n");
    893          1.1  christos         }
    894          1.1  christos 
    895          1.1  christos         while (ComponentCount)
    896          1.1  christos         {
    897          1.1  christos             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
    898          1.1  christos                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
    899          1.1  christos             if (ACPI_FAILURE (Status))
    900          1.1  christos             {
    901          1.1  christos                 return;
    902          1.1  christos             }
    903          1.1  christos 
    904          1.1  christos             Subtable0B++;
    905          1.1  christos             ComponentCount--;
    906          1.1  christos             Offset += sizeof (ACPI_MPST_COMPONENT);
    907          1.1  christos         }
    908          1.1  christos 
    909          1.1  christos         /* Point to next Memory Power Node subtable */
    910          1.1  christos 
    911          1.1  christos         SubtableCount--;
    912          1.1  christos         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
    913          1.1  christos             sizeof (ACPI_MPST_POWER_NODE) +
    914          1.1  christos             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
    915          1.1  christos             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
    916          1.1  christos     }
    917          1.1  christos 
    918          1.1  christos     /* Subtable: Count of Memory Power State Characteristic structures */
    919          1.1  christos 
    920          1.1  christos     AcpiOsPrintf ("\n");
    921          1.1  christos     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
    922          1.1  christos     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
    923          1.1  christos         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
    924          1.1  christos     if (ACPI_FAILURE (Status))
    925          1.1  christos     {
    926          1.1  christos         return;
    927          1.1  christos     }
    928          1.1  christos 
    929          1.1  christos     SubtableCount = Subtable1->CharacteristicsCount;
    930          1.1  christos     Offset += sizeof (ACPI_MPST_DATA_HDR);
    931          1.1  christos 
    932          1.1  christos     /* Subtable: Memory Power State Characteristics structure(s) */
    933          1.1  christos 
    934          1.1  christos     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
    935          1.1  christos         sizeof (ACPI_MPST_DATA_HDR));
    936          1.1  christos 
    937          1.1  christos     while ((Offset < Table->Length) && SubtableCount)
    938          1.1  christos     {
    939          1.1  christos         AcpiOsPrintf ("\n");
    940          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
    941          1.1  christos             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
    942          1.1  christos         if (ACPI_FAILURE (Status))
    943          1.1  christos         {
    944          1.1  christos             return;
    945          1.1  christos         }
    946          1.1  christos 
    947          1.1  christos         Subtable2++;
    948          1.1  christos         SubtableCount--;
    949          1.1  christos         Offset += sizeof (ACPI_MPST_POWER_DATA);
    950          1.1  christos     }
    951          1.1  christos }
    952          1.1  christos 
    953          1.1  christos 
    954          1.1  christos /*******************************************************************************
    955          1.1  christos  *
    956          1.1  christos  * FUNCTION:    AcpiDmDumpMsct
    957          1.1  christos  *
    958          1.1  christos  * PARAMETERS:  Table               - A MSCT table
    959          1.1  christos  *
    960          1.1  christos  * RETURN:      None
    961          1.1  christos  *
    962          1.1  christos  * DESCRIPTION: Format the contents of a MSCT
    963          1.1  christos  *
    964          1.1  christos  ******************************************************************************/
    965          1.1  christos 
    966          1.1  christos void
    967          1.1  christos AcpiDmDumpMsct (
    968          1.1  christos     ACPI_TABLE_HEADER       *Table)
    969          1.1  christos {
    970          1.1  christos     ACPI_STATUS             Status;
    971          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
    972          1.1  christos     ACPI_MSCT_PROXIMITY     *Subtable;
    973          1.1  christos 
    974          1.1  christos 
    975          1.1  christos     /* Main table */
    976          1.1  christos 
    977          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
    978          1.1  christos     if (ACPI_FAILURE (Status))
    979          1.1  christos     {
    980          1.1  christos         return;
    981          1.1  christos     }
    982          1.1  christos 
    983          1.1  christos     /* Subtables */
    984          1.1  christos 
    985          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
    986          1.1  christos     while (Offset < Table->Length)
    987          1.1  christos     {
    988          1.1  christos         /* Common subtable header */
    989          1.1  christos 
    990          1.1  christos         AcpiOsPrintf ("\n");
    991          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    992          1.1  christos             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
    993          1.1  christos         if (ACPI_FAILURE (Status))
    994          1.1  christos         {
    995          1.1  christos             return;
    996          1.1  christos         }
    997          1.1  christos 
    998          1.1  christos         /* Point to next subtable */
    999          1.1  christos 
   1000          1.1  christos         Offset += sizeof (ACPI_MSCT_PROXIMITY);
   1001          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
   1002          1.1  christos             sizeof (ACPI_MSCT_PROXIMITY));
   1003          1.1  christos     }
   1004          1.1  christos }
   1005          1.1  christos 
   1006          1.1  christos 
   1007          1.1  christos /*******************************************************************************
   1008          1.1  christos  *
   1009          1.1  christos  * FUNCTION:    AcpiDmDumpMtmr
   1010          1.1  christos  *
   1011          1.1  christos  * PARAMETERS:  Table               - A MTMR table
   1012          1.1  christos  *
   1013          1.1  christos  * RETURN:      None
   1014          1.1  christos  *
   1015          1.1  christos  * DESCRIPTION: Format the contents of a MTMR
   1016          1.1  christos  *
   1017          1.1  christos  ******************************************************************************/
   1018          1.1  christos 
   1019          1.1  christos void
   1020          1.1  christos AcpiDmDumpMtmr (
   1021          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1022          1.1  christos {
   1023          1.1  christos     ACPI_STATUS             Status;
   1024          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
   1025          1.1  christos     ACPI_MTMR_ENTRY         *Subtable;
   1026          1.1  christos 
   1027          1.1  christos 
   1028          1.1  christos     /* Main table */
   1029          1.1  christos 
   1030          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
   1031          1.1  christos     if (ACPI_FAILURE (Status))
   1032          1.1  christos     {
   1033          1.1  christos         return;
   1034          1.1  christos     }
   1035          1.1  christos 
   1036          1.1  christos     /* Subtables */
   1037          1.1  christos 
   1038          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
   1039          1.1  christos     while (Offset < Table->Length)
   1040          1.1  christos     {
   1041          1.1  christos         /* Common subtable header */
   1042          1.1  christos 
   1043          1.1  christos         AcpiOsPrintf ("\n");
   1044          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1045          1.1  christos             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
   1046          1.1  christos         if (ACPI_FAILURE (Status))
   1047          1.1  christos         {
   1048          1.1  christos             return;
   1049          1.1  christos         }
   1050          1.1  christos 
   1051          1.1  christos         /* Point to next subtable */
   1052          1.1  christos 
   1053          1.1  christos         Offset += sizeof (ACPI_MTMR_ENTRY);
   1054          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable,
   1055          1.1  christos             sizeof (ACPI_MTMR_ENTRY));
   1056          1.1  christos     }
   1057          1.1  christos }
   1058          1.1  christos 
   1059          1.1  christos 
   1060          1.1  christos /*******************************************************************************
   1061          1.1  christos  *
   1062          1.1  christos  * FUNCTION:    AcpiDmDumpNfit
   1063          1.1  christos  *
   1064          1.1  christos  * PARAMETERS:  Table               - A NFIT table
   1065          1.1  christos  *
   1066          1.1  christos  * RETURN:      None
   1067          1.1  christos  *
   1068          1.1  christos  * DESCRIPTION: Format the contents of an NFIT.
   1069          1.1  christos  *
   1070          1.1  christos  ******************************************************************************/
   1071          1.1  christos 
   1072          1.1  christos void
   1073          1.1  christos AcpiDmDumpNfit (
   1074          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1075          1.1  christos {
   1076          1.1  christos     ACPI_STATUS             Status;
   1077          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
   1078          1.1  christos     UINT32                  FieldOffset = 0;
   1079          1.1  christos     UINT32                  Length;
   1080          1.1  christos     ACPI_NFIT_HEADER        *Subtable;
   1081          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1082          1.1  christos     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
   1083          1.1  christos     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
   1084          1.1  christos     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
   1085          1.1  christos     UINT32                  i;
   1086          1.1  christos 
   1087          1.1  christos 
   1088          1.1  christos     /* Main table */
   1089          1.1  christos 
   1090          1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
   1091          1.1  christos     if (ACPI_FAILURE (Status))
   1092          1.1  christos     {
   1093          1.1  christos         return;
   1094          1.1  christos     }
   1095          1.1  christos 
   1096          1.1  christos     /* Subtables */
   1097          1.1  christos 
   1098          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
   1099          1.1  christos     while (Offset < Table->Length)
   1100          1.1  christos     {
   1101          1.1  christos         /* NFIT subtable header */
   1102          1.1  christos 
   1103          1.1  christos         AcpiOsPrintf ("\n");
   1104          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1105          1.1  christos             Subtable->Length, AcpiDmTableInfoNfitHdr);
   1106          1.1  christos         if (ACPI_FAILURE (Status))
   1107          1.1  christos         {
   1108          1.1  christos             return;
   1109          1.1  christos         }
   1110          1.1  christos 
   1111          1.1  christos         switch (Subtable->Type)
   1112          1.1  christos         {
   1113          1.1  christos         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
   1114          1.1  christos 
   1115          1.1  christos             InfoTable = AcpiDmTableInfoNfit0;
   1116          1.1  christos             break;
   1117          1.1  christos 
   1118          1.1  christos         case ACPI_NFIT_TYPE_MEMORY_MAP:
   1119          1.1  christos 
   1120          1.1  christos             InfoTable = AcpiDmTableInfoNfit1;
   1121          1.1  christos             break;
   1122          1.1  christos 
   1123          1.1  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   1124          1.1  christos 
   1125          1.1  christos             /* Has a variable number of 32-bit values at the end */
   1126          1.1  christos 
   1127          1.1  christos             InfoTable = AcpiDmTableInfoNfit2;
   1128          1.1  christos             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
   1129          1.1  christos             break;
   1130          1.1  christos 
   1131          1.1  christos         case ACPI_NFIT_TYPE_SMBIOS:
   1132          1.1  christos 
   1133          1.1  christos             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
   1134          1.1  christos             InfoTable = AcpiDmTableInfoNfit3;
   1135          1.1  christos             break;
   1136          1.1  christos 
   1137          1.1  christos         case ACPI_NFIT_TYPE_CONTROL_REGION:
   1138          1.1  christos 
   1139          1.1  christos             InfoTable = AcpiDmTableInfoNfit4;
   1140          1.1  christos             break;
   1141          1.1  christos 
   1142          1.1  christos         case ACPI_NFIT_TYPE_DATA_REGION:
   1143          1.1  christos 
   1144          1.1  christos             InfoTable = AcpiDmTableInfoNfit5;
   1145          1.1  christos             break;
   1146          1.1  christos 
   1147          1.1  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   1148          1.1  christos 
   1149          1.1  christos             /* Has a variable number of 64-bit addresses at the end */
   1150          1.1  christos 
   1151          1.1  christos             InfoTable = AcpiDmTableInfoNfit6;
   1152          1.1  christos             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
   1153          1.1  christos             break;
   1154          1.1  christos 
   1155          1.1  christos         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
   1156          1.1  christos 
   1157          1.1  christos             InfoTable = AcpiDmTableInfoNfit7;
   1158          1.1  christos             break;
   1159          1.1  christos 
   1160          1.1  christos         default:
   1161          1.1  christos             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
   1162          1.1  christos                 Subtable->Type);
   1163          1.1  christos 
   1164          1.1  christos             /* Attempt to continue */
   1165          1.1  christos 
   1166          1.1  christos             if (!Subtable->Length)
   1167          1.1  christos             {
   1168          1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   1169          1.1  christos                 return;
   1170          1.1  christos             }
   1171          1.1  christos             goto NextSubtable;
   1172          1.1  christos         }
   1173          1.1  christos 
   1174          1.1  christos         AcpiOsPrintf ("\n");
   1175          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1176          1.1  christos             Subtable->Length, InfoTable);
   1177          1.1  christos         if (ACPI_FAILURE (Status))
   1178          1.1  christos         {
   1179          1.1  christos             return;
   1180          1.1  christos         }
   1181          1.1  christos 
   1182          1.1  christos         /* Per-subtable variable-length fields */
   1183          1.1  christos 
   1184          1.1  christos         switch (Subtable->Type)
   1185          1.1  christos         {
   1186          1.1  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   1187          1.1  christos 
   1188  1.1.1.1.4.2    martin             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
   1189          1.1  christos             for (i = 0; i < Interleave->LineCount; i++)
   1190          1.1  christos             {
   1191          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   1192          1.1  christos                     &Interleave->LineOffset[i],
   1193          1.1  christos                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
   1194          1.1  christos                 if (ACPI_FAILURE (Status))
   1195          1.1  christos                 {
   1196          1.1  christos                     return;
   1197          1.1  christos                 }
   1198          1.1  christos 
   1199          1.1  christos                 FieldOffset += sizeof (UINT32);
   1200          1.1  christos             }
   1201          1.1  christos             break;
   1202          1.1  christos 
   1203          1.1  christos         case ACPI_NFIT_TYPE_SMBIOS:
   1204          1.1  christos 
   1205          1.1  christos             Length = Subtable->Length -
   1206          1.1  christos                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
   1207          1.1  christos 
   1208          1.1  christos             if (Length)
   1209          1.1  christos             {
   1210          1.1  christos                 Status = AcpiDmDumpTable (Table->Length,
   1211          1.1  christos                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
   1212          1.1  christos                     SmbiosInfo,
   1213          1.1  christos                     Length, AcpiDmTableInfoNfit3a);
   1214          1.1  christos                 if (ACPI_FAILURE (Status))
   1215          1.1  christos                 {
   1216          1.1  christos                     return;
   1217          1.1  christos                 }
   1218          1.1  christos             }
   1219          1.1  christos 
   1220          1.1  christos             break;
   1221          1.1  christos 
   1222          1.1  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   1223          1.1  christos 
   1224  1.1.1.1.4.2    martin             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
   1225          1.1  christos             for (i = 0; i < Hint->HintCount; i++)
   1226          1.1  christos             {
   1227          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   1228          1.1  christos                     &Hint->HintAddress[i],
   1229          1.1  christos                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
   1230          1.1  christos                 if (ACPI_FAILURE (Status))
   1231          1.1  christos                 {
   1232          1.1  christos                     return;
   1233          1.1  christos                 }
   1234          1.1  christos 
   1235          1.1  christos                 FieldOffset += sizeof (UINT64);
   1236          1.1  christos             }
   1237          1.1  christos             break;
   1238          1.1  christos 
   1239          1.1  christos         default:
   1240          1.1  christos             break;
   1241          1.1  christos         }
   1242          1.1  christos 
   1243          1.1  christos NextSubtable:
   1244          1.1  christos         /* Point to next subtable */
   1245          1.1  christos 
   1246          1.1  christos         Offset += Subtable->Length;
   1247          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
   1248          1.1  christos     }
   1249          1.1  christos }
   1250          1.1  christos 
   1251          1.1  christos 
   1252          1.1  christos /*******************************************************************************
   1253          1.1  christos  *
   1254          1.1  christos  * FUNCTION:    AcpiDmDumpPcct
   1255          1.1  christos  *
   1256          1.1  christos  * PARAMETERS:  Table               - A PCCT table
   1257          1.1  christos  *
   1258          1.1  christos  * RETURN:      None
   1259          1.1  christos  *
   1260          1.1  christos  * DESCRIPTION: Format the contents of a PCCT. This table type consists
   1261          1.1  christos  *              of an open-ended number of subtables.
   1262          1.1  christos  *
   1263          1.1  christos  ******************************************************************************/
   1264          1.1  christos 
   1265          1.1  christos void
   1266          1.1  christos AcpiDmDumpPcct (
   1267          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1268          1.1  christos {
   1269          1.1  christos     ACPI_STATUS             Status;
   1270          1.1  christos     ACPI_PCCT_SUBSPACE      *Subtable;
   1271          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1272          1.1  christos     UINT32                  Length = Table->Length;
   1273          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
   1274          1.1  christos 
   1275          1.1  christos 
   1276          1.1  christos     /* Main table */
   1277          1.1  christos 
   1278          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
   1279          1.1  christos     if (ACPI_FAILURE (Status))
   1280          1.1  christos     {
   1281          1.1  christos         return;
   1282          1.1  christos     }
   1283          1.1  christos 
   1284          1.1  christos     /* Subtables */
   1285          1.1  christos 
   1286          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
   1287          1.1  christos     while (Offset < Table->Length)
   1288          1.1  christos     {
   1289          1.1  christos         /* Common subtable header */
   1290          1.1  christos 
   1291          1.1  christos         AcpiOsPrintf ("\n");
   1292          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1293          1.1  christos             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
   1294          1.1  christos         if (ACPI_FAILURE (Status))
   1295          1.1  christos         {
   1296          1.1  christos             return;
   1297          1.1  christos         }
   1298          1.1  christos 
   1299          1.1  christos         switch (Subtable->Header.Type)
   1300          1.1  christos         {
   1301          1.1  christos         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
   1302          1.1  christos 
   1303          1.1  christos             InfoTable = AcpiDmTableInfoPcct0;
   1304          1.1  christos             break;
   1305          1.1  christos 
   1306          1.1  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
   1307          1.1  christos 
   1308          1.1  christos             InfoTable = AcpiDmTableInfoPcct1;
   1309          1.1  christos             break;
   1310          1.1  christos 
   1311          1.1  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
   1312          1.1  christos 
   1313          1.1  christos             InfoTable = AcpiDmTableInfoPcct2;
   1314          1.1  christos             break;
   1315          1.1  christos 
   1316          1.1  christos         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
   1317          1.1  christos 
   1318          1.1  christos             InfoTable = AcpiDmTableInfoPcct3;
   1319          1.1  christos             break;
   1320          1.1  christos 
   1321          1.1  christos         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
   1322          1.1  christos 
   1323          1.1  christos             InfoTable = AcpiDmTableInfoPcct4;
   1324          1.1  christos             break;
   1325          1.1  christos 
   1326          1.1  christos         default:
   1327          1.1  christos 
   1328          1.1  christos             AcpiOsPrintf (
   1329          1.1  christos                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
   1330          1.1  christos                 Subtable->Header.Type);
   1331          1.1  christos             return;
   1332          1.1  christos         }
   1333          1.1  christos 
   1334          1.1  christos         AcpiOsPrintf ("\n");
   1335          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1336          1.1  christos             Subtable->Header.Length, InfoTable);
   1337          1.1  christos         if (ACPI_FAILURE (Status))
   1338          1.1  christos         {
   1339          1.1  christos             return;
   1340          1.1  christos         }
   1341          1.1  christos 
   1342          1.1  christos         /* Point to next subtable */
   1343          1.1  christos 
   1344          1.1  christos         Offset += Subtable->Header.Length;
   1345          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
   1346          1.1  christos             Subtable->Header.Length);
   1347          1.1  christos     }
   1348          1.1  christos }
   1349          1.1  christos 
   1350          1.1  christos 
   1351          1.1  christos /*******************************************************************************
   1352          1.1  christos  *
   1353          1.1  christos  * FUNCTION:    AcpiDmDumpPdtt
   1354          1.1  christos  *
   1355          1.1  christos  * PARAMETERS:  Table               - A PDTT table
   1356          1.1  christos  *
   1357          1.1  christos  * RETURN:      None
   1358          1.1  christos  *
   1359          1.1  christos  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
   1360          1.1  christos  *              table that contains an open-ended number of IDs
   1361          1.1  christos  *              at the end of the table.
   1362          1.1  christos  *
   1363          1.1  christos  ******************************************************************************/
   1364          1.1  christos 
   1365          1.1  christos void
   1366          1.1  christos AcpiDmDumpPdtt (
   1367          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1368          1.1  christos {
   1369          1.1  christos     ACPI_STATUS             Status;
   1370          1.1  christos     ACPI_PDTT_CHANNEL       *Subtable;
   1371          1.1  christos     UINT32                  Length = Table->Length;
   1372          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
   1373          1.1  christos 
   1374          1.1  christos 
   1375          1.1  christos     /* Main table */
   1376          1.1  christos 
   1377          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
   1378          1.1  christos     if (ACPI_FAILURE (Status))
   1379          1.1  christos     {
   1380          1.1  christos         return;
   1381          1.1  christos     }
   1382          1.1  christos 
   1383          1.1  christos     /* Subtables. Currently there is only one type, but can be multiples */
   1384          1.1  christos 
   1385          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
   1386          1.1  christos     while (Offset < Table->Length)
   1387          1.1  christos     {
   1388          1.1  christos         AcpiOsPrintf ("\n");
   1389          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1390          1.1  christos             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
   1391          1.1  christos         if (ACPI_FAILURE (Status))
   1392          1.1  christos         {
   1393          1.1  christos             return;
   1394          1.1  christos         }
   1395          1.1  christos 
   1396          1.1  christos         /* Point to next subtable */
   1397          1.1  christos 
   1398          1.1  christos         Offset += sizeof (ACPI_PDTT_CHANNEL);
   1399          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
   1400          1.1  christos             sizeof (ACPI_PDTT_CHANNEL));
   1401          1.1  christos     }
   1402          1.1  christos }
   1403          1.1  christos 
   1404          1.1  christos 
   1405          1.1  christos /*******************************************************************************
   1406          1.1  christos  *
   1407          1.1  christos  * FUNCTION:    AcpiDmDumpPmtt
   1408          1.1  christos  *
   1409          1.1  christos  * PARAMETERS:  Table               - A PMTT table
   1410          1.1  christos  *
   1411          1.1  christos  * RETURN:      None
   1412          1.1  christos  *
   1413          1.1  christos  * DESCRIPTION: Format the contents of a PMTT. This table type consists
   1414          1.1  christos  *              of an open-ended number of subtables.
   1415          1.1  christos  *
   1416          1.1  christos  ******************************************************************************/
   1417          1.1  christos 
   1418          1.1  christos void
   1419          1.1  christos AcpiDmDumpPmtt (
   1420          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1421          1.1  christos {
   1422          1.1  christos     ACPI_STATUS             Status;
   1423          1.1  christos     ACPI_PMTT_HEADER        *Subtable;
   1424          1.1  christos     ACPI_PMTT_HEADER        *MemSubtable;
   1425          1.1  christos     ACPI_PMTT_HEADER        *DimmSubtable;
   1426          1.1  christos     ACPI_PMTT_DOMAIN        *DomainArray;
   1427          1.1  christos     UINT32                  Length = Table->Length;
   1428          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
   1429          1.1  christos     UINT32                  MemOffset;
   1430          1.1  christos     UINT32                  DimmOffset;
   1431          1.1  christos     UINT32                  DomainOffset;
   1432          1.1  christos     UINT32                  DomainCount;
   1433          1.1  christos 
   1434          1.1  christos 
   1435          1.1  christos     /* Main table */
   1436          1.1  christos 
   1437          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
   1438          1.1  christos     if (ACPI_FAILURE (Status))
   1439          1.1  christos     {
   1440          1.1  christos         return;
   1441          1.1  christos     }
   1442          1.1  christos 
   1443          1.1  christos     /* Subtables */
   1444          1.1  christos 
   1445          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
   1446          1.1  christos     while (Offset < Table->Length)
   1447          1.1  christos     {
   1448          1.1  christos         /* Common subtable header */
   1449          1.1  christos 
   1450          1.1  christos         AcpiOsPrintf ("\n");
   1451          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1452          1.1  christos             Subtable->Length, AcpiDmTableInfoPmttHdr);
   1453          1.1  christos         if (ACPI_FAILURE (Status))
   1454          1.1  christos         {
   1455          1.1  christos             return;
   1456          1.1  christos         }
   1457          1.1  christos 
   1458          1.1  christos         /* Only Socket subtables are expected at this level */
   1459          1.1  christos 
   1460          1.1  christos         if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET)
   1461          1.1  christos         {
   1462          1.1  christos             AcpiOsPrintf (
   1463          1.1  christos                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   1464          1.1  christos                 Subtable->Type);
   1465          1.1  christos             return;
   1466          1.1  christos         }
   1467          1.1  christos 
   1468          1.1  christos         /* Dump the fixed-length portion of the subtable */
   1469          1.1  christos 
   1470          1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1471          1.1  christos             Subtable->Length, AcpiDmTableInfoPmtt0);
   1472          1.1  christos         if (ACPI_FAILURE (Status))
   1473          1.1  christos         {
   1474          1.1  christos             return;
   1475          1.1  christos         }
   1476          1.1  christos 
   1477          1.1  christos         /* Walk the memory controller subtables */
   1478          1.1  christos 
   1479          1.1  christos         MemOffset = sizeof (ACPI_PMTT_SOCKET);
   1480          1.1  christos         MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
   1481          1.1  christos             sizeof (ACPI_PMTT_SOCKET));
   1482          1.1  christos 
   1483          1.1  christos         while (((Offset + MemOffset) < Table->Length) &&
   1484          1.1  christos             (MemOffset < Subtable->Length))
   1485          1.1  christos         {
   1486          1.1  christos             /* Common subtable header */
   1487          1.1  christos 
   1488          1.1  christos             AcpiOsPrintf ("\n");
   1489          1.1  christos             Status = AcpiDmDumpTable (Length,
   1490          1.1  christos                 Offset + MemOffset, MemSubtable,
   1491          1.1  christos                 MemSubtable->Length, AcpiDmTableInfoPmttHdr);
   1492          1.1  christos             if (ACPI_FAILURE (Status))
   1493          1.1  christos             {
   1494          1.1  christos                 return;
   1495          1.1  christos             }
   1496          1.1  christos 
   1497          1.1  christos             /* Only memory controller subtables are expected at this level */
   1498          1.1  christos 
   1499          1.1  christos             if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER)
   1500          1.1  christos             {
   1501          1.1  christos                 AcpiOsPrintf (
   1502          1.1  christos                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   1503          1.1  christos                     MemSubtable->Type);
   1504          1.1  christos                 return;
   1505          1.1  christos             }
   1506          1.1  christos 
   1507          1.1  christos             /* Dump the fixed-length portion of the controller subtable */
   1508          1.1  christos 
   1509          1.1  christos             Status = AcpiDmDumpTable (Length,
   1510          1.1  christos                 Offset + MemOffset, MemSubtable,
   1511          1.1  christos                 MemSubtable->Length, AcpiDmTableInfoPmtt1);
   1512          1.1  christos             if (ACPI_FAILURE (Status))
   1513          1.1  christos             {
   1514          1.1  christos                 return;
   1515          1.1  christos             }
   1516          1.1  christos 
   1517          1.1  christos             /* Walk the variable count of proximity domains */
   1518          1.1  christos 
   1519          1.1  christos             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
   1520          1.1  christos             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
   1521          1.1  christos             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
   1522          1.1  christos                 sizeof (ACPI_PMTT_CONTROLLER));
   1523          1.1  christos 
   1524          1.1  christos             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
   1525          1.1  christos                 ((MemOffset + DomainOffset) < Subtable->Length) &&
   1526          1.1  christos                 DomainCount)
   1527          1.1  christos             {
   1528          1.1  christos                 Status = AcpiDmDumpTable (Length,
   1529          1.1  christos                     Offset + MemOffset + DomainOffset, DomainArray,
   1530          1.1  christos                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
   1531          1.1  christos                 if (ACPI_FAILURE (Status))
   1532          1.1  christos                 {
   1533          1.1  christos                     return;
   1534          1.1  christos                 }
   1535          1.1  christos 
   1536          1.1  christos                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
   1537          1.1  christos                 DomainArray++;
   1538          1.1  christos                 DomainCount--;
   1539          1.1  christos             }
   1540          1.1  christos 
   1541          1.1  christos             if (DomainCount)
   1542          1.1  christos             {
   1543          1.1  christos                 AcpiOsPrintf (
   1544          1.1  christos                     "\n**** DomainCount exceeds subtable length\n\n");
   1545          1.1  christos             }
   1546          1.1  christos 
   1547          1.1  christos             /* Walk the physical component (DIMM) subtables */
   1548          1.1  christos 
   1549          1.1  christos             DimmOffset = DomainOffset;
   1550          1.1  christos             DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
   1551          1.1  christos                 DomainOffset);
   1552          1.1  christos 
   1553          1.1  christos             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
   1554          1.1  christos                 (DimmOffset < MemSubtable->Length))
   1555          1.1  christos             {
   1556          1.1  christos                 /* Common subtable header */
   1557          1.1  christos 
   1558          1.1  christos                 AcpiOsPrintf ("\n");
   1559          1.1  christos                 Status = AcpiDmDumpTable (Length,
   1560          1.1  christos                     Offset + MemOffset + DimmOffset, DimmSubtable,
   1561          1.1  christos                     DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
   1562          1.1  christos                 if (ACPI_FAILURE (Status))
   1563          1.1  christos                 {
   1564          1.1  christos                     return;
   1565          1.1  christos                 }
   1566          1.1  christos 
   1567          1.1  christos                 /* Only DIMM subtables are expected at this level */
   1568          1.1  christos 
   1569          1.1  christos                 if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM)
   1570          1.1  christos                 {
   1571          1.1  christos                     AcpiOsPrintf (
   1572          1.1  christos                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   1573          1.1  christos                         DimmSubtable->Type);
   1574          1.1  christos                     return;
   1575          1.1  christos                 }
   1576          1.1  christos 
   1577          1.1  christos                 /* Dump the fixed-length DIMM subtable */
   1578          1.1  christos 
   1579          1.1  christos                 Status = AcpiDmDumpTable (Length,
   1580          1.1  christos                     Offset + MemOffset + DimmOffset, DimmSubtable,
   1581          1.1  christos                     DimmSubtable->Length, AcpiDmTableInfoPmtt2);
   1582          1.1  christos                 if (ACPI_FAILURE (Status))
   1583          1.1  christos                 {
   1584          1.1  christos                     return;
   1585          1.1  christos                 }
   1586          1.1  christos 
   1587          1.1  christos                 /* Point to next DIMM subtable */
   1588          1.1  christos 
   1589          1.1  christos                 DimmOffset += DimmSubtable->Length;
   1590          1.1  christos                 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   1591          1.1  christos                     DimmSubtable, DimmSubtable->Length);
   1592          1.1  christos             }
   1593          1.1  christos 
   1594          1.1  christos             /* Point to next Controller subtable */
   1595          1.1  christos 
   1596          1.1  christos             MemOffset += MemSubtable->Length;
   1597          1.1  christos             MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   1598          1.1  christos                 MemSubtable, MemSubtable->Length);
   1599          1.1  christos         }
   1600          1.1  christos 
   1601          1.1  christos         /* Point to next Socket subtable */
   1602          1.1  christos 
   1603          1.1  christos         Offset += Subtable->Length;
   1604          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   1605          1.1  christos             Subtable, Subtable->Length);
   1606          1.1  christos     }
   1607          1.1  christos }
   1608          1.1  christos 
   1609          1.1  christos 
   1610          1.1  christos /*******************************************************************************
   1611          1.1  christos  *
   1612          1.1  christos  * FUNCTION:    AcpiDmDumpPptt
   1613          1.1  christos  *
   1614          1.1  christos  * PARAMETERS:  Table               - A PMTT table
   1615          1.1  christos  *
   1616          1.1  christos  * RETURN:      None
   1617          1.1  christos  *
   1618          1.1  christos  * DESCRIPTION: Format the contents of a PPTT. This table type consists
   1619          1.1  christos  *              of an open-ended number of subtables.
   1620          1.1  christos  *
   1621          1.1  christos  ******************************************************************************/
   1622          1.1  christos 
   1623          1.1  christos void
   1624          1.1  christos AcpiDmDumpPptt (
   1625          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1626          1.1  christos {
   1627          1.1  christos     ACPI_STATUS             Status;
   1628          1.1  christos     ACPI_SUBTABLE_HEADER    *Subtable;
   1629          1.1  christos     ACPI_PPTT_PROCESSOR     *PpttProcessor;
   1630          1.1  christos     UINT8                   Length;
   1631          1.1  christos     UINT8                   SubtableOffset;
   1632          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
   1633          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1634          1.1  christos     UINT32                  i;
   1635          1.1  christos 
   1636          1.1  christos 
   1637          1.1  christos     /* There is no main table (other than the standard ACPI header) */
   1638          1.1  christos 
   1639          1.1  christos     /* Subtables */
   1640          1.1  christos 
   1641          1.1  christos     Offset = sizeof (ACPI_TABLE_HEADER);
   1642          1.1  christos     while (Offset < Table->Length)
   1643          1.1  christos     {
   1644          1.1  christos         AcpiOsPrintf ("\n");
   1645          1.1  christos 
   1646          1.1  christos         /* Common subtable header */
   1647          1.1  christos 
   1648          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   1649          1.1  christos         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
   1650          1.1  christos         {
   1651          1.1  christos             AcpiOsPrintf ("Invalid subtable length\n");
   1652          1.1  christos             return;
   1653          1.1  christos         }
   1654          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1655          1.1  christos             Subtable->Length, AcpiDmTableInfoPpttHdr);
   1656          1.1  christos         if (ACPI_FAILURE (Status))
   1657          1.1  christos         {
   1658          1.1  christos             return;
   1659          1.1  christos         }
   1660          1.1  christos 
   1661          1.1  christos         switch (Subtable->Type)
   1662          1.1  christos         {
   1663          1.1  christos         case ACPI_PPTT_TYPE_PROCESSOR:
   1664          1.1  christos 
   1665          1.1  christos             InfoTable = AcpiDmTableInfoPptt0;
   1666          1.1  christos             Length = sizeof (ACPI_PPTT_PROCESSOR);
   1667          1.1  christos             break;
   1668          1.1  christos 
   1669          1.1  christos         case ACPI_PPTT_TYPE_CACHE:
   1670          1.1  christos 
   1671          1.1  christos             InfoTable = AcpiDmTableInfoPptt1;
   1672          1.1  christos             Length = sizeof (ACPI_PPTT_CACHE);
   1673          1.1  christos             break;
   1674          1.1  christos 
   1675          1.1  christos         case ACPI_PPTT_TYPE_ID:
   1676          1.1  christos 
   1677          1.1  christos             InfoTable = AcpiDmTableInfoPptt2;
   1678          1.1  christos             Length = sizeof (ACPI_PPTT_ID);
   1679          1.1  christos             break;
   1680          1.1  christos 
   1681          1.1  christos         default:
   1682          1.1  christos 
   1683          1.1  christos             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
   1684          1.1  christos                 Subtable->Type);
   1685          1.1  christos 
   1686          1.1  christos             /* Attempt to continue */
   1687          1.1  christos 
   1688          1.1  christos             goto NextSubtable;
   1689          1.1  christos         }
   1690          1.1  christos 
   1691          1.1  christos         if (Subtable->Length < Length)
   1692          1.1  christos         {
   1693          1.1  christos             AcpiOsPrintf ("Invalid subtable length\n");
   1694          1.1  christos             return;
   1695          1.1  christos         }
   1696          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1697          1.1  christos             Subtable->Length, InfoTable);
   1698          1.1  christos         if (ACPI_FAILURE (Status))
   1699          1.1  christos         {
   1700          1.1  christos             return;
   1701          1.1  christos         }
   1702          1.1  christos         SubtableOffset = Length;
   1703          1.1  christos 
   1704          1.1  christos         switch (Subtable->Type)
   1705          1.1  christos         {
   1706          1.1  christos         case ACPI_PPTT_TYPE_PROCESSOR:
   1707          1.1  christos 
   1708          1.1  christos             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
   1709          1.1  christos 
   1710          1.1  christos             /* Dump SMBIOS handles */
   1711          1.1  christos 
   1712          1.1  christos             if ((UINT8)(Subtable->Length - SubtableOffset) <
   1713          1.1  christos                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
   1714          1.1  christos             {
   1715          1.1  christos                 AcpiOsPrintf ("Invalid private resource number\n");
   1716          1.1  christos                 return;
   1717          1.1  christos             }
   1718          1.1  christos             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
   1719          1.1  christos             {
   1720          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   1721          1.1  christos                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
   1722          1.1  christos                     4, AcpiDmTableInfoPptt0a);
   1723  1.1.1.1.4.2    martin                 if (ACPI_FAILURE (Status))
   1724  1.1.1.1.4.2    martin                 {
   1725  1.1.1.1.4.2    martin                     return;
   1726  1.1.1.1.4.2    martin                 }
   1727  1.1.1.1.4.2    martin 
   1728          1.1  christos                 SubtableOffset += 4;
   1729          1.1  christos             }
   1730          1.1  christos             break;
   1731          1.1  christos 
   1732          1.1  christos         default:
   1733          1.1  christos 
   1734          1.1  christos             break;
   1735          1.1  christos         }
   1736          1.1  christos 
   1737          1.1  christos NextSubtable:
   1738          1.1  christos         /* Point to next subtable */
   1739          1.1  christos 
   1740          1.1  christos         Offset += Subtable->Length;
   1741          1.1  christos     }
   1742          1.1  christos }
   1743          1.1  christos 
   1744          1.1  christos 
   1745          1.1  christos /*******************************************************************************
   1746          1.1  christos  *
   1747          1.1  christos  * FUNCTION:    AcpiDmDumpS3pt
   1748          1.1  christos  *
   1749          1.1  christos  * PARAMETERS:  Table               - A S3PT table
   1750          1.1  christos  *
   1751          1.1  christos  * RETURN:      Length of the table
   1752          1.1  christos  *
   1753          1.1  christos  * DESCRIPTION: Format the contents of a S3PT
   1754          1.1  christos  *
   1755          1.1  christos  ******************************************************************************/
   1756          1.1  christos 
   1757          1.1  christos UINT32
   1758          1.1  christos AcpiDmDumpS3pt (
   1759          1.1  christos     ACPI_TABLE_HEADER       *Tables)
   1760          1.1  christos {
   1761          1.1  christos     ACPI_STATUS             Status;
   1762          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
   1763          1.1  christos     ACPI_FPDT_HEADER        *Subtable;
   1764          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1765          1.1  christos     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
   1766          1.1  christos 
   1767          1.1  christos 
   1768          1.1  christos     /* Main table */
   1769          1.1  christos 
   1770          1.1  christos     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
   1771          1.1  christos     if (ACPI_FAILURE (Status))
   1772          1.1  christos     {
   1773          1.1  christos         return 0;
   1774          1.1  christos     }
   1775          1.1  christos 
   1776          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
   1777          1.1  christos     while (Offset < S3ptTable->Length)
   1778          1.1  christos     {
   1779          1.1  christos         /* Common subtable header */
   1780          1.1  christos 
   1781          1.1  christos         AcpiOsPrintf ("\n");
   1782          1.1  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
   1783          1.1  christos             Subtable->Length, AcpiDmTableInfoS3ptHdr);
   1784          1.1  christos         if (ACPI_FAILURE (Status))
   1785          1.1  christos         {
   1786          1.1  christos             return 0;
   1787          1.1  christos         }
   1788          1.1  christos 
   1789          1.1  christos         switch (Subtable->Type)
   1790          1.1  christos         {
   1791          1.1  christos         case ACPI_S3PT_TYPE_RESUME:
   1792          1.1  christos 
   1793          1.1  christos             InfoTable = AcpiDmTableInfoS3pt0;
   1794          1.1  christos             break;
   1795          1.1  christos 
   1796          1.1  christos         case ACPI_S3PT_TYPE_SUSPEND:
   1797          1.1  christos 
   1798          1.1  christos             InfoTable = AcpiDmTableInfoS3pt1;
   1799          1.1  christos             break;
   1800          1.1  christos 
   1801          1.1  christos         default:
   1802          1.1  christos 
   1803          1.1  christos             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
   1804          1.1  christos                 Subtable->Type);
   1805          1.1  christos 
   1806          1.1  christos             /* Attempt to continue */
   1807          1.1  christos 
   1808          1.1  christos             if (!Subtable->Length)
   1809          1.1  christos             {
   1810          1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   1811          1.1  christos                 return 0;
   1812          1.1  christos             }
   1813          1.1  christos             goto NextSubtable;
   1814          1.1  christos         }
   1815          1.1  christos 
   1816          1.1  christos         AcpiOsPrintf ("\n");
   1817          1.1  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
   1818          1.1  christos             Subtable->Length, InfoTable);
   1819          1.1  christos         if (ACPI_FAILURE (Status))
   1820          1.1  christos         {
   1821          1.1  christos             return 0;
   1822          1.1  christos         }
   1823          1.1  christos 
   1824          1.1  christos NextSubtable:
   1825          1.1  christos         /* Point to next subtable */
   1826          1.1  christos 
   1827          1.1  christos         Offset += Subtable->Length;
   1828          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
   1829          1.1  christos     }
   1830          1.1  christos 
   1831          1.1  christos     return (S3ptTable->Length);
   1832          1.1  christos }
   1833          1.1  christos 
   1834          1.1  christos 
   1835          1.1  christos /*******************************************************************************
   1836          1.1  christos  *
   1837          1.1  christos  * FUNCTION:    AcpiDmDumpSdev
   1838          1.1  christos  *
   1839          1.1  christos  * PARAMETERS:  Table               - A SDEV table
   1840          1.1  christos  *
   1841          1.1  christos  * RETURN:      None
   1842          1.1  christos  *
   1843          1.1  christos  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
   1844          1.1  christos  *              table that contains variable strings and vendor data.
   1845          1.1  christos  *
   1846          1.1  christos  ******************************************************************************/
   1847          1.1  christos 
   1848          1.1  christos void
   1849          1.1  christos AcpiDmDumpSdev (
   1850          1.1  christos     ACPI_TABLE_HEADER       *Table)
   1851          1.1  christos {
   1852          1.1  christos     ACPI_STATUS             Status;
   1853          1.1  christos     ACPI_SDEV_HEADER        *Subtable;
   1854          1.1  christos     ACPI_SDEV_PCIE          *Pcie;
   1855          1.1  christos     ACPI_SDEV_NAMESPACE     *Namesp;
   1856          1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1857          1.1  christos     UINT32                  Length = Table->Length;
   1858          1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_SDEV);
   1859          1.1  christos     UINT16                  PathOffset;
   1860          1.1  christos     UINT16                  PathLength;
   1861          1.1  christos     UINT16                  VendorDataOffset;
   1862          1.1  christos     UINT16                  VendorDataLength;
   1863          1.1  christos 
   1864          1.1  christos 
   1865          1.1  christos     /* Main table */
   1866          1.1  christos 
   1867          1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
   1868          1.1  christos     if (ACPI_FAILURE (Status))
   1869          1.1  christos     {
   1870          1.1  christos         return;
   1871          1.1  christos     }
   1872          1.1  christos 
   1873          1.1  christos     /* Subtables */
   1874          1.1  christos 
   1875          1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
   1876          1.1  christos     while (Offset < Table->Length)
   1877          1.1  christos     {
   1878          1.1  christos         /* Common subtable header */
   1879          1.1  christos 
   1880          1.1  christos         AcpiOsPrintf ("\n");
   1881          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1882          1.1  christos             Subtable->Length, AcpiDmTableInfoSdevHdr);
   1883          1.1  christos         if (ACPI_FAILURE (Status))
   1884          1.1  christos         {
   1885          1.1  christos             return;
   1886          1.1  christos         }
   1887          1.1  christos 
   1888          1.1  christos         switch (Subtable->Type)
   1889          1.1  christos         {
   1890          1.1  christos         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
   1891          1.1  christos 
   1892          1.1  christos             InfoTable = AcpiDmTableInfoSdev0;
   1893          1.1  christos             break;
   1894          1.1  christos 
   1895          1.1  christos         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
   1896          1.1  christos 
   1897          1.1  christos             InfoTable = AcpiDmTableInfoSdev1;
   1898          1.1  christos             break;
   1899          1.1  christos 
   1900          1.1  christos         default:
   1901          1.1  christos             goto NextSubtable;
   1902          1.1  christos         }
   1903          1.1  christos 
   1904          1.1  christos         AcpiOsPrintf ("\n");
   1905          1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1906          1.1  christos             Subtable->Length, InfoTable);
   1907          1.1  christos         if (ACPI_FAILURE (Status))
   1908          1.1  christos         {
   1909          1.1  christos             return;
   1910          1.1  christos         }
   1911          1.1  christos 
   1912          1.1  christos         switch (Subtable->Type)
   1913          1.1  christos         {
   1914          1.1  christos         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
   1915          1.1  christos 
   1916          1.1  christos             /* Dump the PCIe device ID(s) */
   1917          1.1  christos 
   1918          1.1  christos             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
   1919          1.1  christos             PathOffset = Namesp->DeviceIdOffset;
   1920          1.1  christos             PathLength = Namesp->DeviceIdLength;
   1921          1.1  christos 
   1922          1.1  christos             if (PathLength)
   1923          1.1  christos             {
   1924          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   1925          1.1  christos                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
   1926          1.1  christos                     PathLength, AcpiDmTableInfoSdev0a);
   1927          1.1  christos                 if (ACPI_FAILURE (Status))
   1928          1.1  christos                 {
   1929          1.1  christos                     return;
   1930          1.1  christos                 }
   1931          1.1  christos             }
   1932          1.1  christos 
   1933          1.1  christos             /* Dump the vendor-specific data */
   1934          1.1  christos 
   1935          1.1  christos             VendorDataLength =
   1936          1.1  christos                 Namesp->VendorDataLength;
   1937          1.1  christos             VendorDataOffset =
   1938          1.1  christos                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
   1939          1.1  christos 
   1940          1.1  christos             if (VendorDataLength)
   1941          1.1  christos             {
   1942          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   1943          1.1  christos                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
   1944          1.1  christos                     VendorDataLength, AcpiDmTableInfoSdev1b);
   1945          1.1  christos                 if (ACPI_FAILURE (Status))
   1946          1.1  christos                 {
   1947          1.1  christos                     return;
   1948          1.1  christos                 }
   1949          1.1  christos             }
   1950          1.1  christos             break;
   1951          1.1  christos 
   1952          1.1  christos         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
   1953          1.1  christos 
   1954          1.1  christos             /* PCI path substructures */
   1955          1.1  christos 
   1956          1.1  christos             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
   1957          1.1  christos             PathOffset = Pcie->PathOffset;
   1958          1.1  christos             PathLength = Pcie->PathLength;
   1959          1.1  christos 
   1960          1.1  christos             while (PathLength)
   1961          1.1  christos             {
   1962          1.1  christos                 Status = AcpiDmDumpTable (Table->Length,
   1963          1.1  christos                     PathOffset + Offset,
   1964          1.1  christos                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
   1965          1.1  christos                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
   1966          1.1  christos                 if (ACPI_FAILURE (Status))
   1967          1.1  christos                 {
   1968          1.1  christos                     return;
   1969          1.1  christos                 }
   1970          1.1  christos 
   1971          1.1  christos                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
   1972          1.1  christos                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
   1973          1.1  christos             }
   1974          1.1  christos 
   1975          1.1  christos             /* VendorData */
   1976          1.1  christos 
   1977          1.1  christos             VendorDataLength = Pcie->VendorDataLength;
   1978          1.1  christos             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
   1979          1.1  christos 
   1980          1.1  christos             if (VendorDataLength)
   1981          1.1  christos             {
   1982          1.1  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   1983          1.1  christos                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
   1984          1.1  christos                     VendorDataLength, AcpiDmTableInfoSdev1b);
   1985  1.1.1.1.4.2    martin                 if (ACPI_FAILURE (Status))
   1986  1.1.1.1.4.2    martin                 {
   1987  1.1.1.1.4.2    martin                     return;
   1988  1.1.1.1.4.2    martin                 }
   1989          1.1  christos             }
   1990          1.1  christos             break;
   1991          1.1  christos 
   1992          1.1  christos         default:
   1993          1.1  christos             goto NextSubtable;
   1994          1.1  christos         }
   1995          1.1  christos 
   1996          1.1  christos NextSubtable:
   1997          1.1  christos         /* Point to next subtable */
   1998          1.1  christos 
   1999          1.1  christos         Offset += Subtable->Length;
   2000          1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
   2001          1.1  christos             Subtable->Length);
   2002          1.1  christos     }
   2003          1.1  christos }
   2004