Home | History | Annotate | Line # | Download | only in common
dmtbdump2.c revision 1.1.1.12
      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.12  christos  * Copyright (C) 2000 - 2022, Intel Corp.
      9       1.1  christos  * All rights reserved.
     10       1.1  christos  *
     11       1.1  christos  * Redistribution and use in source and binary forms, with or without
     12       1.1  christos  * modification, are permitted provided that the following conditions
     13       1.1  christos  * are met:
     14       1.1  christos  * 1. Redistributions of source code must retain the above copyright
     15       1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     16       1.1  christos  *    without modification.
     17       1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18       1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19       1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20       1.1  christos  *    including a substantially similar Disclaimer requirement for further
     21       1.1  christos  *    binary redistribution.
     22       1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23       1.1  christos  *    of any contributors may be used to endorse or promote products derived
     24       1.1  christos  *    from this software without specific prior written permission.
     25       1.1  christos  *
     26       1.1  christos  * Alternatively, this software may be distributed under the terms of the
     27       1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28       1.1  christos  * Software Foundation.
     29       1.1  christos  *
     30       1.1  christos  * NO WARRANTY
     31       1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32       1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33   1.1.1.8  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     34       1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35       1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36       1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37       1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38       1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39       1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40       1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41       1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     42       1.1  christos  */
     43       1.1  christos 
     44       1.1  christos #include "acpi.h"
     45       1.1  christos #include "accommon.h"
     46       1.1  christos #include "acdisasm.h"
     47       1.1  christos #include "actables.h"
     48   1.1.1.9  christos #include "aslcompiler.h"
     49       1.1  christos 
     50       1.1  christos /* This module used for application-level code only */
     51       1.1  christos 
     52       1.1  christos #define _COMPONENT          ACPI_CA_DISASSEMBLER
     53       1.1  christos         ACPI_MODULE_NAME    ("dmtbdump2")
     54       1.1  christos 
     55       1.1  christos 
     56       1.1  christos /*******************************************************************************
     57       1.1  christos  *
     58       1.1  christos  * FUNCTION:    AcpiDmDumpIort
     59       1.1  christos  *
     60       1.1  christos  * PARAMETERS:  Table               - A IORT table
     61       1.1  christos  *
     62       1.1  christos  * RETURN:      None
     63       1.1  christos  *
     64       1.1  christos  * DESCRIPTION: Format the contents of a IORT
     65       1.1  christos  *
     66       1.1  christos  ******************************************************************************/
     67       1.1  christos 
     68       1.1  christos void
     69       1.1  christos AcpiDmDumpIort (
     70       1.1  christos     ACPI_TABLE_HEADER       *Table)
     71       1.1  christos {
     72       1.1  christos     ACPI_STATUS             Status;
     73       1.1  christos     ACPI_TABLE_IORT         *Iort;
     74       1.1  christos     ACPI_IORT_NODE          *IortNode;
     75       1.1  christos     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
     76       1.1  christos     ACPI_IORT_SMMU          *IortSmmu = NULL;
     77   1.1.1.8  christos     ACPI_IORT_RMR           *IortRmr = NULL;
     78       1.1  christos     UINT32                  Offset;
     79       1.1  christos     UINT32                  NodeOffset;
     80       1.1  christos     UINT32                  Length;
     81       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
     82       1.1  christos     char                    *String;
     83       1.1  christos     UINT32                  i;
     84   1.1.1.5  christos     UINT32                  MappingByteLength;
     85   1.1.1.8  christos     UINT8                   Revision;
     86       1.1  christos 
     87       1.1  christos 
     88       1.1  christos     /* Main table */
     89       1.1  christos 
     90       1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
     91       1.1  christos     if (ACPI_FAILURE (Status))
     92       1.1  christos     {
     93       1.1  christos         return;
     94       1.1  christos     }
     95       1.1  christos 
     96   1.1.1.8  christos     Revision = Table->Revision;
     97   1.1.1.8  christos 
     98  1.1.1.12  christos     /* IORT Revisions E, E.a and E.c have known issues and are not supported */
     99   1.1.1.8  christos 
    100  1.1.1.12  christos     if (Revision == 1 || Revision == 2 || Revision == 4)
    101   1.1.1.8  christos     {
    102   1.1.1.8  christos         AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n",
    103   1.1.1.8  christos                       Revision);
    104   1.1.1.8  christos         return;
    105   1.1.1.8  christos     }
    106   1.1.1.8  christos 
    107       1.1  christos     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
    108       1.1  christos     Offset = sizeof (ACPI_TABLE_IORT);
    109       1.1  christos 
    110       1.1  christos     /* Dump the OptionalPadding (optional) */
    111       1.1  christos 
    112       1.1  christos     if (Iort->NodeOffset > Offset)
    113       1.1  christos     {
    114       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
    115       1.1  christos             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
    116       1.1  christos         if (ACPI_FAILURE (Status))
    117       1.1  christos         {
    118       1.1  christos             return;
    119       1.1  christos         }
    120       1.1  christos     }
    121       1.1  christos 
    122       1.1  christos     Offset = Iort->NodeOffset;
    123       1.1  christos     while (Offset < Table->Length)
    124       1.1  christos     {
    125       1.1  christos         /* Common subtable header */
    126       1.1  christos 
    127       1.1  christos         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
    128       1.1  christos         AcpiOsPrintf ("\n");
    129       1.1  christos         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
    130   1.1.1.8  christos 
    131   1.1.1.8  christos         if (Revision == 0)
    132   1.1.1.8  christos         {
    133   1.1.1.8  christos             Status = AcpiDmDumpTable (Table->Length, Offset,
    134   1.1.1.8  christos                 IortNode, Length, AcpiDmTableInfoIortHdr);
    135   1.1.1.8  christos         }
    136   1.1.1.8  christos         else if (Revision >= 3)
    137   1.1.1.8  christos         {
    138   1.1.1.8  christos             Status = AcpiDmDumpTable (Table->Length, Offset,
    139   1.1.1.8  christos                 IortNode, Length, AcpiDmTableInfoIortHdr3);
    140   1.1.1.8  christos         }
    141   1.1.1.8  christos 
    142       1.1  christos         if (ACPI_FAILURE (Status))
    143       1.1  christos         {
    144       1.1  christos             return;
    145       1.1  christos         }
    146       1.1  christos 
    147       1.1  christos         NodeOffset = Length;
    148       1.1  christos 
    149       1.1  christos         switch (IortNode->Type)
    150       1.1  christos         {
    151       1.1  christos         case ACPI_IORT_NODE_ITS_GROUP:
    152       1.1  christos 
    153       1.1  christos             InfoTable = AcpiDmTableInfoIort0;
    154       1.1  christos             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
    155       1.1  christos             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
    156       1.1  christos             break;
    157       1.1  christos 
    158       1.1  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
    159       1.1  christos 
    160       1.1  christos             InfoTable = AcpiDmTableInfoIort1;
    161       1.1  christos             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
    162       1.1  christos             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
    163       1.1  christos             Length += strlen (String) + 1;
    164       1.1  christos             break;
    165       1.1  christos 
    166       1.1  christos         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
    167       1.1  christos 
    168       1.1  christos             InfoTable = AcpiDmTableInfoIort2;
    169       1.1  christos             Length = IortNode->Length - NodeOffset;
    170       1.1  christos             break;
    171       1.1  christos 
    172       1.1  christos         case ACPI_IORT_NODE_SMMU:
    173       1.1  christos 
    174       1.1  christos             InfoTable = AcpiDmTableInfoIort3;
    175       1.1  christos             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
    176       1.1  christos             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
    177       1.1  christos             break;
    178       1.1  christos 
    179       1.1  christos         case ACPI_IORT_NODE_SMMU_V3:
    180       1.1  christos 
    181       1.1  christos             InfoTable = AcpiDmTableInfoIort4;
    182       1.1  christos             Length = IortNode->Length - NodeOffset;
    183       1.1  christos             break;
    184       1.1  christos 
    185   1.1.1.2  christos         case ACPI_IORT_NODE_PMCG:
    186   1.1.1.2  christos 
    187   1.1.1.2  christos             InfoTable = AcpiDmTableInfoIort5;
    188   1.1.1.2  christos             Length = IortNode->Length - NodeOffset;
    189   1.1.1.2  christos             break;
    190   1.1.1.2  christos 
    191   1.1.1.8  christos         case ACPI_IORT_NODE_RMR:
    192   1.1.1.8  christos 
    193   1.1.1.8  christos             InfoTable = AcpiDmTableInfoIort6;
    194   1.1.1.8  christos             Length = IortNode->Length - NodeOffset;
    195   1.1.1.8  christos             IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset);
    196   1.1.1.8  christos             break;
    197   1.1.1.8  christos 
    198       1.1  christos         default:
    199       1.1  christos 
    200       1.1  christos             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
    201       1.1  christos                 IortNode->Type);
    202       1.1  christos 
    203       1.1  christos             /* Attempt to continue */
    204       1.1  christos 
    205       1.1  christos             if (!IortNode->Length)
    206       1.1  christos             {
    207       1.1  christos                 AcpiOsPrintf ("Invalid zero length IORT node\n");
    208       1.1  christos                 return;
    209       1.1  christos             }
    210       1.1  christos             goto NextSubtable;
    211       1.1  christos         }
    212       1.1  christos 
    213       1.1  christos         /* Dump the node subtable header */
    214       1.1  christos 
    215       1.1  christos         AcpiOsPrintf ("\n");
    216       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    217       1.1  christos             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    218       1.1  christos             Length, InfoTable);
    219       1.1  christos         if (ACPI_FAILURE (Status))
    220       1.1  christos         {
    221       1.1  christos             return;
    222       1.1  christos         }
    223       1.1  christos 
    224       1.1  christos         NodeOffset += Length;
    225       1.1  christos 
    226       1.1  christos         /* Dump the node specific data */
    227       1.1  christos 
    228       1.1  christos         switch (IortNode->Type)
    229       1.1  christos         {
    230       1.1  christos         case ACPI_IORT_NODE_ITS_GROUP:
    231       1.1  christos 
    232       1.1  christos             /* Validate IortItsGroup to avoid compiler warnings */
    233       1.1  christos 
    234       1.1  christos             if (IortItsGroup)
    235       1.1  christos             {
    236       1.1  christos                 for (i = 0; i < IortItsGroup->ItsCount; i++)
    237       1.1  christos                 {
    238       1.1  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    239       1.1  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    240       1.1  christos                         4, AcpiDmTableInfoIort0a);
    241   1.1.1.5  christos                     if (ACPI_FAILURE (Status))
    242   1.1.1.5  christos                     {
    243   1.1.1.5  christos                         return;
    244   1.1.1.5  christos                     }
    245   1.1.1.5  christos 
    246       1.1  christos                     NodeOffset += 4;
    247       1.1  christos                 }
    248       1.1  christos             }
    249       1.1  christos             break;
    250       1.1  christos 
    251       1.1  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
    252       1.1  christos 
    253       1.1  christos             /* Dump the Padding (optional) */
    254       1.1  christos 
    255       1.1  christos             if (IortNode->Length > NodeOffset)
    256       1.1  christos             {
    257   1.1.1.5  christos                 MappingByteLength =
    258   1.1.1.5  christos                     IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
    259       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    260   1.1.1.5  christos                     Table, IortNode->Length - NodeOffset - MappingByteLength,
    261       1.1  christos                     AcpiDmTableInfoIort1a);
    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             break;
    268       1.1  christos 
    269       1.1  christos         case ACPI_IORT_NODE_SMMU:
    270       1.1  christos 
    271       1.1  christos             AcpiOsPrintf ("\n");
    272       1.1  christos 
    273       1.1  christos             /* Validate IortSmmu to avoid compiler warnings */
    274       1.1  christos 
    275       1.1  christos             if (IortSmmu)
    276       1.1  christos             {
    277       1.1  christos                 Length = 2 * sizeof (UINT64);
    278       1.1  christos                 NodeOffset = IortSmmu->GlobalInterruptOffset;
    279       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    280       1.1  christos                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    281       1.1  christos                     Length, AcpiDmTableInfoIort3a);
    282       1.1  christos                 if (ACPI_FAILURE (Status))
    283       1.1  christos                 {
    284       1.1  christos                     return;
    285       1.1  christos                 }
    286       1.1  christos 
    287       1.1  christos                 NodeOffset = IortSmmu->ContextInterruptOffset;
    288       1.1  christos                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
    289       1.1  christos                 {
    290       1.1  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    291       1.1  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    292       1.1  christos                         8, AcpiDmTableInfoIort3b);
    293       1.1  christos                     if (ACPI_FAILURE (Status))
    294       1.1  christos                     {
    295       1.1  christos                         return;
    296       1.1  christos                     }
    297       1.1  christos 
    298       1.1  christos                     NodeOffset += 8;
    299       1.1  christos                 }
    300       1.1  christos 
    301       1.1  christos                 NodeOffset = IortSmmu->PmuInterruptOffset;
    302       1.1  christos                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
    303       1.1  christos                 {
    304       1.1  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    305       1.1  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    306       1.1  christos                         8, AcpiDmTableInfoIort3c);
    307       1.1  christos                     if (ACPI_FAILURE (Status))
    308       1.1  christos                     {
    309       1.1  christos                         return;
    310       1.1  christos                     }
    311       1.1  christos 
    312       1.1  christos                     NodeOffset += 8;
    313       1.1  christos                 }
    314       1.1  christos             }
    315       1.1  christos             break;
    316       1.1  christos 
    317   1.1.1.8  christos         case ACPI_IORT_NODE_RMR:
    318   1.1.1.8  christos 
    319   1.1.1.8  christos             /* Validate IortRmr to avoid compiler warnings */
    320   1.1.1.8  christos             if (IortRmr)
    321   1.1.1.8  christos             {
    322   1.1.1.8  christos                 NodeOffset = IortRmr->RmrOffset;
    323   1.1.1.8  christos                 Length = sizeof (ACPI_IORT_RMR_DESC);
    324   1.1.1.8  christos                 for (i = 0; i < IortRmr->RmrCount; i++)
    325   1.1.1.8  christos                 {
    326   1.1.1.8  christos                     AcpiOsPrintf ("\n");
    327   1.1.1.8  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    328   1.1.1.8  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    329   1.1.1.8  christos                         Length, AcpiDmTableInfoIort6a);
    330   1.1.1.8  christos                     if (ACPI_FAILURE (Status))
    331   1.1.1.8  christos                     {
    332   1.1.1.8  christos                         return;
    333   1.1.1.8  christos                     }
    334   1.1.1.8  christos 
    335   1.1.1.8  christos                     NodeOffset += Length;
    336   1.1.1.8  christos                 }
    337   1.1.1.8  christos             }
    338   1.1.1.8  christos             break;
    339   1.1.1.8  christos 
    340  1.1.1.12  christos         default:
    341       1.1  christos 
    342       1.1  christos             break;
    343       1.1  christos         }
    344       1.1  christos 
    345       1.1  christos         /* Dump the ID mappings */
    346       1.1  christos 
    347       1.1  christos         NodeOffset = IortNode->MappingOffset;
    348       1.1  christos         for (i = 0; i < IortNode->MappingCount; i++)
    349       1.1  christos         {
    350       1.1  christos             AcpiOsPrintf ("\n");
    351       1.1  christos             Length = sizeof (ACPI_IORT_ID_MAPPING);
    352       1.1  christos             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
    353       1.1  christos                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
    354       1.1  christos                 Length, AcpiDmTableInfoIortMap);
    355       1.1  christos             if (ACPI_FAILURE (Status))
    356       1.1  christos             {
    357       1.1  christos                 return;
    358       1.1  christos             }
    359       1.1  christos 
    360       1.1  christos             NodeOffset += Length;
    361       1.1  christos         }
    362       1.1  christos 
    363       1.1  christos NextSubtable:
    364       1.1  christos         /* Point to next node subtable */
    365       1.1  christos 
    366       1.1  christos         Offset += IortNode->Length;
    367       1.1  christos     }
    368       1.1  christos }
    369       1.1  christos 
    370       1.1  christos 
    371       1.1  christos /*******************************************************************************
    372       1.1  christos  *
    373       1.1  christos  * FUNCTION:    AcpiDmDumpIvrs
    374       1.1  christos  *
    375       1.1  christos  * PARAMETERS:  Table               - A IVRS table
    376       1.1  christos  *
    377       1.1  christos  * RETURN:      None
    378       1.1  christos  *
    379   1.1.1.9  christos  * DESCRIPTION: Format the contents of a IVRS. Notes:
    380   1.1.1.9  christos  *              The IVRS is essentially a flat table, with the following
    381   1.1.1.9  christos  *              structure:
    382   1.1.1.9  christos  *              <Main ACPI Table Header>
    383   1.1.1.9  christos  *              <Main subtable - virtualization info>
    384   1.1.1.9  christos  *              <IVHD>
    385   1.1.1.9  christos  *                  <Device Entries>
    386   1.1.1.9  christos  *              ...
    387   1.1.1.9  christos  *              <IVHD>
    388   1.1.1.9  christos  *                  <Device Entries>
    389   1.1.1.9  christos  *              <IVMD>
    390   1.1.1.9  christos  *              ...
    391       1.1  christos  *
    392       1.1  christos  ******************************************************************************/
    393       1.1  christos 
    394       1.1  christos void
    395       1.1  christos AcpiDmDumpIvrs (
    396       1.1  christos     ACPI_TABLE_HEADER       *Table)
    397       1.1  christos {
    398       1.1  christos     ACPI_STATUS             Status;
    399       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
    400       1.1  christos     UINT32                  EntryOffset;
    401       1.1  christos     UINT32                  EntryLength;
    402       1.1  christos     UINT32                  EntryType;
    403   1.1.1.8  christos     ACPI_IVRS_DEVICE_HID    *HidSubtable;
    404       1.1  christos     ACPI_IVRS_DE_HEADER     *DeviceEntry;
    405       1.1  christos     ACPI_IVRS_HEADER        *Subtable;
    406       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    407       1.1  christos 
    408       1.1  christos 
    409       1.1  christos     /* Main table */
    410       1.1  christos 
    411       1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
    412       1.1  christos     if (ACPI_FAILURE (Status))
    413       1.1  christos     {
    414       1.1  christos         return;
    415       1.1  christos     }
    416       1.1  christos 
    417       1.1  christos     /* Subtables */
    418       1.1  christos 
    419       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
    420   1.1.1.9  christos 
    421       1.1  christos     while (Offset < Table->Length)
    422       1.1  christos     {
    423       1.1  christos         switch (Subtable->Type)
    424       1.1  christos         {
    425   1.1.1.9  christos         /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */
    426   1.1.1.9  christos 
    427   1.1.1.6  christos         case ACPI_IVRS_TYPE_HARDWARE1:
    428       1.1  christos 
    429   1.1.1.9  christos             AcpiOsPrintf ("\n");
    430   1.1.1.9  christos             InfoTable = AcpiDmTableInfoIvrsHware1;
    431       1.1  christos             break;
    432       1.1  christos 
    433   1.1.1.9  christos         /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */
    434   1.1.1.9  christos 
    435   1.1.1.6  christos         case ACPI_IVRS_TYPE_HARDWARE2:
    436   1.1.1.8  christos         case ACPI_IVRS_TYPE_HARDWARE3:
    437   1.1.1.6  christos 
    438   1.1.1.9  christos             AcpiOsPrintf ("\n");
    439   1.1.1.9  christos             InfoTable = AcpiDmTableInfoIvrsHware23;
    440   1.1.1.6  christos             break;
    441   1.1.1.6  christos 
    442   1.1.1.9  christos         /* Types 20h-22h, IVMD (I/O Virtualization Memory Definition Block) */
    443   1.1.1.9  christos 
    444       1.1  christos         case ACPI_IVRS_TYPE_MEMORY1:
    445       1.1  christos         case ACPI_IVRS_TYPE_MEMORY2:
    446       1.1  christos         case ACPI_IVRS_TYPE_MEMORY3:
    447       1.1  christos 
    448   1.1.1.9  christos             AcpiOsPrintf ("\n");
    449   1.1.1.9  christos             InfoTable = AcpiDmTableInfoIvrsMemory;
    450       1.1  christos             break;
    451       1.1  christos 
    452       1.1  christos         default:
    453       1.1  christos 
    454       1.1  christos             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
    455       1.1  christos                 Subtable->Type);
    456       1.1  christos 
    457       1.1  christos             /* Attempt to continue */
    458       1.1  christos 
    459       1.1  christos             if (!Subtable->Length)
    460       1.1  christos             {
    461       1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
    462       1.1  christos                 return;
    463       1.1  christos             }
    464       1.1  christos             goto NextSubtable;
    465       1.1  christos         }
    466       1.1  christos 
    467       1.1  christos         /* Dump the subtable */
    468       1.1  christos 
    469       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    470       1.1  christos             Subtable->Length, InfoTable);
    471       1.1  christos         if (ACPI_FAILURE (Status))
    472       1.1  christos         {
    473       1.1  christos             return;
    474       1.1  christos         }
    475       1.1  christos 
    476   1.1.1.9  christos         /* The hardware subtables (IVHD) can contain multiple device entries */
    477       1.1  christos 
    478   1.1.1.6  christos         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
    479   1.1.1.8  christos             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 ||
    480   1.1.1.8  christos             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3)
    481       1.1  christos         {
    482   1.1.1.6  christos             if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
    483   1.1.1.6  christos             {
    484   1.1.1.6  christos                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
    485   1.1.1.6  christos                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
    486   1.1.1.6  christos                     sizeof (ACPI_IVRS_HARDWARE1));
    487   1.1.1.6  christos             }
    488   1.1.1.7  christos             else
    489   1.1.1.6  christos             {
    490   1.1.1.9  christos                 /* ACPI_IVRS_TYPE_HARDWARE2, HARDWARE3 subtable types */
    491   1.1.1.7  christos 
    492   1.1.1.6  christos                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
    493   1.1.1.6  christos                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
    494   1.1.1.6  christos                     sizeof (ACPI_IVRS_HARDWARE2));
    495   1.1.1.6  christos             }
    496       1.1  christos 
    497   1.1.1.9  christos             /* Process all of the Device Entries */
    498   1.1.1.9  christos 
    499       1.1  christos             while (EntryOffset < (Offset + Subtable->Length))
    500       1.1  christos             {
    501       1.1  christos                 AcpiOsPrintf ("\n");
    502   1.1.1.9  christos 
    503       1.1  christos                 /*
    504       1.1  christos                  * Upper 2 bits of Type encode the length of the device entry
    505       1.1  christos                  *
    506       1.1  christos                  * 00 = 4 byte
    507       1.1  christos                  * 01 = 8 byte
    508   1.1.1.8  christos                  * 1x = variable length
    509       1.1  christos                  */
    510       1.1  christos                 EntryType = DeviceEntry->Type;
    511   1.1.1.8  christos                 EntryLength = EntryType >> 6 == 1 ? 8 : 4;
    512       1.1  christos 
    513       1.1  christos                 switch (EntryType)
    514       1.1  christos                 {
    515       1.1  christos                 /* 4-byte device entries */
    516       1.1  christos 
    517       1.1  christos                 case ACPI_IVRS_TYPE_PAD4:
    518       1.1  christos                 case ACPI_IVRS_TYPE_ALL:
    519       1.1  christos                 case ACPI_IVRS_TYPE_SELECT:
    520       1.1  christos                 case ACPI_IVRS_TYPE_START:
    521       1.1  christos                 case ACPI_IVRS_TYPE_END:
    522       1.1  christos 
    523       1.1  christos                     InfoTable = AcpiDmTableInfoIvrs4;
    524       1.1  christos                     break;
    525       1.1  christos 
    526       1.1  christos                 /* 8-byte entries, type A */
    527       1.1  christos 
    528       1.1  christos                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
    529       1.1  christos                 case ACPI_IVRS_TYPE_ALIAS_START:
    530       1.1  christos 
    531       1.1  christos                     InfoTable = AcpiDmTableInfoIvrs8a;
    532       1.1  christos                     break;
    533       1.1  christos 
    534       1.1  christos                 /* 8-byte entries, type B */
    535       1.1  christos 
    536       1.1  christos                 case ACPI_IVRS_TYPE_PAD8:
    537       1.1  christos                 case ACPI_IVRS_TYPE_EXT_SELECT:
    538       1.1  christos                 case ACPI_IVRS_TYPE_EXT_START:
    539       1.1  christos 
    540       1.1  christos                     InfoTable = AcpiDmTableInfoIvrs8b;
    541       1.1  christos                     break;
    542       1.1  christos 
    543       1.1  christos                 /* 8-byte entries, type C */
    544       1.1  christos 
    545       1.1  christos                 case ACPI_IVRS_TYPE_SPECIAL:
    546       1.1  christos 
    547       1.1  christos                     InfoTable = AcpiDmTableInfoIvrs8c;
    548       1.1  christos                     break;
    549       1.1  christos 
    550   1.1.1.8  christos                 /* Variable-length entries */
    551   1.1.1.8  christos 
    552   1.1.1.8  christos                 case ACPI_IVRS_TYPE_HID:
    553   1.1.1.8  christos 
    554   1.1.1.9  christos                     EntryLength = 4;
    555   1.1.1.8  christos                     InfoTable = AcpiDmTableInfoIvrsHid;
    556   1.1.1.8  christos                     break;
    557   1.1.1.8  christos 
    558       1.1  christos                 default:
    559       1.1  christos                     InfoTable = AcpiDmTableInfoIvrs4;
    560       1.1  christos                     AcpiOsPrintf (
    561       1.1  christos                         "\n**** Unknown IVRS device entry type/length: "
    562       1.1  christos                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
    563       1.1  christos                         EntryType, EntryLength, EntryOffset);
    564       1.1  christos                     break;
    565       1.1  christos                 }
    566       1.1  christos 
    567       1.1  christos                 /* Dump the Device Entry */
    568       1.1  christos 
    569       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    570       1.1  christos                     DeviceEntry, EntryLength, InfoTable);
    571       1.1  christos                 if (ACPI_FAILURE (Status))
    572       1.1  christos                 {
    573       1.1  christos                     return;
    574       1.1  christos                 }
    575       1.1  christos 
    576   1.1.1.8  christos                 HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry);
    577       1.1  christos                 EntryOffset += EntryLength;
    578   1.1.1.9  christos                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, HidSubtable,
    579       1.1  christos                     EntryLength);
    580   1.1.1.8  christos 
    581   1.1.1.8  christos                 if (EntryType == ACPI_IVRS_TYPE_HID)
    582   1.1.1.8  christos                 {
    583   1.1.1.9  christos                     /*
    584   1.1.1.9  christos                      * Determine if the HID is an integer or a string.
    585   1.1.1.9  christos                      * An integer is defined to be 32 bits, with the upper 32 bits
    586   1.1.1.9  christos                      * set to zero. (from the ACPI Spec): "The HID can be a 32-bit
    587   1.1.1.9  christos                      * integer or a character string. If an integer, the lower
    588   1.1.1.9  christos                      * 4 bytes of the field contain the integer and the upper
    589   1.1.1.9  christos                      * 4 bytes are padded with 0".
    590   1.1.1.9  christos                      */
    591   1.1.1.9  christos                     if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid))
    592   1.1.1.9  christos                     {
    593   1.1.1.9  christos                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    594   1.1.1.9  christos                             &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger);
    595   1.1.1.9  christos                     }
    596   1.1.1.9  christos                     else
    597   1.1.1.9  christos                     {
    598   1.1.1.9  christos                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    599   1.1.1.9  christos                             &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString);
    600   1.1.1.9  christos                     }
    601   1.1.1.8  christos                     if (ACPI_FAILURE (Status))
    602   1.1.1.8  christos                     {
    603   1.1.1.8  christos                         return;
    604   1.1.1.8  christos                     }
    605   1.1.1.9  christos 
    606   1.1.1.9  christos                     EntryOffset += 8;
    607   1.1.1.9  christos 
    608   1.1.1.9  christos                     /*
    609   1.1.1.9  christos                      * Determine if the CID is an integer or a string. The format
    610   1.1.1.9  christos                      * of the CID is the same as the HID above. From ACPI Spec:
    611   1.1.1.9  christos                      * "If present, CID must be a single Compatible Device ID
    612   1.1.1.9  christos                      * following the same format as the HID field."
    613   1.1.1.9  christos                      */
    614   1.1.1.9  christos                     if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid))
    615   1.1.1.9  christos                     {
    616   1.1.1.9  christos                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    617   1.1.1.9  christos                             &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger);
    618   1.1.1.9  christos                     }
    619   1.1.1.9  christos                     else
    620   1.1.1.9  christos                     {
    621   1.1.1.9  christos                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    622   1.1.1.9  christos                             &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString);
    623   1.1.1.9  christos                     }
    624   1.1.1.9  christos                     if (ACPI_FAILURE (Status))
    625   1.1.1.9  christos                     {
    626   1.1.1.9  christos                         return;
    627   1.1.1.9  christos                     }
    628   1.1.1.9  christos 
    629   1.1.1.9  christos                     EntryOffset += 8;
    630   1.1.1.9  christos                     EntryLength = HidSubtable->UidLength;
    631   1.1.1.9  christos 
    632   1.1.1.9  christos                     if (EntryLength > ACPI_IVRS_UID_NOT_PRESENT)
    633   1.1.1.9  christos                     {
    634   1.1.1.9  christos                         /* Dump the UID based upon the UidType field (String or Integer) */
    635   1.1.1.9  christos 
    636   1.1.1.9  christos                         if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING)
    637   1.1.1.9  christos                         {
    638   1.1.1.9  christos                             Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    639   1.1.1.9  christos                                 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString);
    640   1.1.1.9  christos                             if (ACPI_FAILURE (Status))
    641   1.1.1.9  christos                             {
    642   1.1.1.9  christos                                 return;
    643   1.1.1.9  christos                             }
    644   1.1.1.9  christos                         }
    645   1.1.1.9  christos                         else /* ACPI_IVRS_UID_IS_INTEGER */
    646   1.1.1.9  christos                         {
    647   1.1.1.9  christos                             Status = AcpiDmDumpTable (Table->Length, EntryOffset,
    648   1.1.1.9  christos                                 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger);
    649   1.1.1.9  christos                             if (ACPI_FAILURE (Status))
    650   1.1.1.9  christos                             {
    651   1.1.1.9  christos                                 return;
    652   1.1.1.9  christos                             }
    653   1.1.1.9  christos                         }
    654   1.1.1.9  christos                     }
    655   1.1.1.9  christos 
    656   1.1.1.9  christos                     EntryOffset += EntryLength+2;
    657   1.1.1.8  christos                     DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER,
    658   1.1.1.9  christos                         Table, EntryOffset);
    659   1.1.1.8  christos                 }
    660       1.1  christos             }
    661       1.1  christos         }
    662       1.1  christos 
    663       1.1  christos NextSubtable:
    664       1.1  christos         /* Point to next subtable */
    665       1.1  christos 
    666       1.1  christos         Offset += Subtable->Length;
    667       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
    668       1.1  christos     }
    669       1.1  christos }
    670       1.1  christos 
    671       1.1  christos 
    672       1.1  christos /*******************************************************************************
    673       1.1  christos  *
    674       1.1  christos  * FUNCTION:    AcpiDmDumpLpit
    675       1.1  christos  *
    676       1.1  christos  * PARAMETERS:  Table               - A LPIT table
    677       1.1  christos  *
    678       1.1  christos  * RETURN:      None
    679       1.1  christos  *
    680       1.1  christos  * DESCRIPTION: Format the contents of a LPIT. This table type consists
    681       1.1  christos  *              of an open-ended number of subtables. Note: There are no
    682       1.1  christos  *              entries in the main table. An LPIT consists of the table
    683       1.1  christos  *              header and then subtables only.
    684       1.1  christos  *
    685       1.1  christos  ******************************************************************************/
    686       1.1  christos 
    687       1.1  christos void
    688       1.1  christos AcpiDmDumpLpit (
    689       1.1  christos     ACPI_TABLE_HEADER       *Table)
    690       1.1  christos {
    691       1.1  christos     ACPI_STATUS             Status;
    692       1.1  christos     ACPI_LPIT_HEADER        *Subtable;
    693       1.1  christos     UINT32                  Length = Table->Length;
    694       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
    695       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    696       1.1  christos     UINT32                  SubtableLength;
    697       1.1  christos 
    698       1.1  christos 
    699       1.1  christos     /* Subtables */
    700       1.1  christos 
    701       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
    702       1.1  christos     while (Offset < Table->Length)
    703       1.1  christos     {
    704       1.1  christos         /* Common subtable header */
    705       1.1  christos 
    706       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    707       1.1  christos             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
    708       1.1  christos         if (ACPI_FAILURE (Status))
    709       1.1  christos         {
    710       1.1  christos             return;
    711       1.1  christos         }
    712       1.1  christos 
    713       1.1  christos         switch (Subtable->Type)
    714       1.1  christos         {
    715       1.1  christos         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
    716       1.1  christos 
    717       1.1  christos             InfoTable = AcpiDmTableInfoLpit0;
    718       1.1  christos             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
    719       1.1  christos             break;
    720       1.1  christos 
    721       1.1  christos         default:
    722       1.1  christos 
    723       1.1  christos             /* Cannot continue on unknown type - no length */
    724       1.1  christos 
    725       1.1  christos             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
    726       1.1  christos                 Subtable->Type);
    727       1.1  christos             return;
    728       1.1  christos         }
    729       1.1  christos 
    730       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    731       1.1  christos             SubtableLength, InfoTable);
    732       1.1  christos         if (ACPI_FAILURE (Status))
    733       1.1  christos         {
    734       1.1  christos             return;
    735       1.1  christos         }
    736       1.1  christos 
    737       1.1  christos         AcpiOsPrintf ("\n");
    738       1.1  christos 
    739       1.1  christos         /* Point to next subtable */
    740       1.1  christos 
    741       1.1  christos         Offset += SubtableLength;
    742       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
    743       1.1  christos     }
    744       1.1  christos }
    745       1.1  christos 
    746       1.1  christos 
    747       1.1  christos /*******************************************************************************
    748       1.1  christos  *
    749       1.1  christos  * FUNCTION:    AcpiDmDumpMadt
    750       1.1  christos  *
    751       1.1  christos  * PARAMETERS:  Table               - A MADT table
    752       1.1  christos  *
    753       1.1  christos  * RETURN:      None
    754       1.1  christos  *
    755       1.1  christos  * DESCRIPTION: Format the contents of a MADT. This table type consists
    756       1.1  christos  *              of an open-ended number of subtables.
    757       1.1  christos  *
    758       1.1  christos  ******************************************************************************/
    759       1.1  christos 
    760       1.1  christos void
    761       1.1  christos AcpiDmDumpMadt (
    762       1.1  christos     ACPI_TABLE_HEADER       *Table)
    763       1.1  christos {
    764       1.1  christos     ACPI_STATUS             Status;
    765       1.1  christos     ACPI_SUBTABLE_HEADER    *Subtable;
    766       1.1  christos     UINT32                  Length = Table->Length;
    767       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
    768       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
    769       1.1  christos 
    770       1.1  christos 
    771       1.1  christos     /* Main table */
    772       1.1  christos 
    773       1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
    774       1.1  christos     if (ACPI_FAILURE (Status))
    775       1.1  christos     {
    776       1.1  christos         return;
    777       1.1  christos     }
    778       1.1  christos 
    779       1.1  christos     /* Subtables */
    780       1.1  christos 
    781       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
    782  1.1.1.12  christos     DbgPrint (ASL_PARSE_OUTPUT, "//0B) Offset %X, from table start: 0x%8.8X%8.8X\n",
    783  1.1.1.12  christos         Offset, ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
    784       1.1  christos     while (Offset < Table->Length)
    785       1.1  christos     {
    786       1.1  christos         /* Common subtable header */
    787       1.1  christos 
    788       1.1  christos         AcpiOsPrintf ("\n");
    789       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    790       1.1  christos             Subtable->Length, AcpiDmTableInfoMadtHdr);
    791       1.1  christos         if (ACPI_FAILURE (Status))
    792       1.1  christos         {
    793       1.1  christos             return;
    794       1.1  christos         }
    795       1.1  christos 
    796  1.1.1.12  christos         DbgPrint (ASL_PARSE_OUTPUT, "subtableType: %X\n", Subtable->Type);
    797       1.1  christos         switch (Subtable->Type)
    798       1.1  christos         {
    799       1.1  christos         case ACPI_MADT_TYPE_LOCAL_APIC:
    800       1.1  christos 
    801       1.1  christos             InfoTable = AcpiDmTableInfoMadt0;
    802       1.1  christos             break;
    803       1.1  christos 
    804       1.1  christos         case ACPI_MADT_TYPE_IO_APIC:
    805       1.1  christos 
    806       1.1  christos             InfoTable = AcpiDmTableInfoMadt1;
    807       1.1  christos             break;
    808       1.1  christos 
    809       1.1  christos         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
    810       1.1  christos 
    811       1.1  christos             InfoTable = AcpiDmTableInfoMadt2;
    812       1.1  christos             break;
    813       1.1  christos 
    814       1.1  christos         case ACPI_MADT_TYPE_NMI_SOURCE:
    815       1.1  christos 
    816       1.1  christos             InfoTable = AcpiDmTableInfoMadt3;
    817       1.1  christos             break;
    818       1.1  christos 
    819       1.1  christos         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
    820       1.1  christos 
    821       1.1  christos             InfoTable = AcpiDmTableInfoMadt4;
    822       1.1  christos             break;
    823       1.1  christos 
    824       1.1  christos         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
    825       1.1  christos 
    826       1.1  christos             InfoTable = AcpiDmTableInfoMadt5;
    827       1.1  christos             break;
    828       1.1  christos 
    829       1.1  christos         case ACPI_MADT_TYPE_IO_SAPIC:
    830       1.1  christos 
    831       1.1  christos             InfoTable = AcpiDmTableInfoMadt6;
    832       1.1  christos             break;
    833       1.1  christos 
    834       1.1  christos         case ACPI_MADT_TYPE_LOCAL_SAPIC:
    835       1.1  christos 
    836       1.1  christos             InfoTable = AcpiDmTableInfoMadt7;
    837       1.1  christos             break;
    838       1.1  christos 
    839       1.1  christos         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
    840       1.1  christos 
    841       1.1  christos             InfoTable = AcpiDmTableInfoMadt8;
    842       1.1  christos             break;
    843       1.1  christos 
    844       1.1  christos         case ACPI_MADT_TYPE_LOCAL_X2APIC:
    845       1.1  christos 
    846       1.1  christos             InfoTable = AcpiDmTableInfoMadt9;
    847       1.1  christos             break;
    848       1.1  christos 
    849       1.1  christos         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
    850       1.1  christos 
    851       1.1  christos             InfoTable = AcpiDmTableInfoMadt10;
    852       1.1  christos             break;
    853       1.1  christos 
    854       1.1  christos         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
    855       1.1  christos 
    856       1.1  christos             InfoTable = AcpiDmTableInfoMadt11;
    857       1.1  christos             break;
    858       1.1  christos 
    859       1.1  christos         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
    860       1.1  christos 
    861       1.1  christos             InfoTable = AcpiDmTableInfoMadt12;
    862       1.1  christos             break;
    863       1.1  christos 
    864       1.1  christos         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
    865       1.1  christos 
    866       1.1  christos             InfoTable = AcpiDmTableInfoMadt13;
    867       1.1  christos             break;
    868       1.1  christos 
    869       1.1  christos         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
    870       1.1  christos 
    871       1.1  christos             InfoTable = AcpiDmTableInfoMadt14;
    872       1.1  christos             break;
    873       1.1  christos 
    874       1.1  christos         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
    875       1.1  christos 
    876       1.1  christos             InfoTable = AcpiDmTableInfoMadt15;
    877       1.1  christos             break;
    878       1.1  christos 
    879   1.1.1.8  christos         case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
    880   1.1.1.8  christos 
    881   1.1.1.8  christos             InfoTable = AcpiDmTableInfoMadt16;
    882   1.1.1.8  christos             break;
    883   1.1.1.8  christos 
    884       1.1  christos         default:
    885       1.1  christos 
    886  1.1.1.12  christos             if ((Subtable->Type >= ACPI_MADT_TYPE_RESERVED) &&
    887  1.1.1.12  christos                 (Subtable->Type < ACPI_MADT_TYPE_OEM_RESERVED))
    888  1.1.1.12  christos             {
    889  1.1.1.12  christos                 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
    890  1.1.1.12  christos                     Subtable->Type);
    891  1.1.1.12  christos                 goto NextSubtable;
    892  1.1.1.12  christos             }
    893  1.1.1.12  christos             else if (Subtable->Type >= ACPI_MADT_TYPE_OEM_RESERVED)
    894  1.1.1.12  christos             {
    895  1.1.1.12  christos                 DbgPrint (ASL_PARSE_OUTPUT, "//[Found an OEM structure, type = %0x]\n",
    896  1.1.1.12  christos                     Subtable->Type);
    897  1.1.1.12  christos                 Offset += sizeof (ACPI_SUBTABLE_HEADER);
    898  1.1.1.12  christos                 DbgPrint (ASL_PARSE_OUTPUT, "//[0) Subtable->Length = %X, Subtable = %p, Offset = %X]\n",
    899  1.1.1.12  christos                     Subtable->Length, Subtable, Offset);
    900  1.1.1.12  christos                 DbgPrint (ASL_PARSE_OUTPUT, "//[0A) Offset from table start: 0x%8.8X%8.8X]\n",
    901  1.1.1.12  christos                     ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
    902  1.1.1.12  christos             }
    903       1.1  christos 
    904       1.1  christos             /* Attempt to continue */
    905       1.1  christos 
    906       1.1  christos             if (!Subtable->Length)
    907       1.1  christos             {
    908       1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
    909       1.1  christos                 return;
    910       1.1  christos             }
    911       1.1  christos 
    912  1.1.1.12  christos             /* Dump the OEM data */
    913  1.1.1.12  christos 
    914  1.1.1.12  christos             Status = AcpiDmDumpTable (Length, Offset, ACPI_CAST_PTR (UINT8, Table) + Offset,
    915  1.1.1.12  christos                 Subtable->Length - sizeof (ACPI_SUBTABLE_HEADER), AcpiDmTableInfoMadt17);
    916  1.1.1.12  christos             if (ACPI_FAILURE (Status))
    917  1.1.1.12  christos             {
    918  1.1.1.12  christos                 return;
    919  1.1.1.12  christos             }
    920  1.1.1.12  christos 
    921  1.1.1.12  christos             DbgPrint (ASL_PARSE_OUTPUT, "//[1) Subtable->Length = %X, Offset = %X]\n",
    922  1.1.1.12  christos                 Subtable->Length, Offset);
    923  1.1.1.12  christos             Offset -= sizeof (ACPI_SUBTABLE_HEADER);
    924  1.1.1.12  christos 
    925       1.1  christos             goto NextSubtable;
    926       1.1  christos         }
    927       1.1  christos 
    928  1.1.1.12  christos         DbgPrint (ASL_PARSE_OUTPUT, "//[2) Subtable->Length = %X, Offset = %X]\n",
    929  1.1.1.12  christos             Subtable->Length, Offset);
    930       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    931       1.1  christos             Subtable->Length, InfoTable);
    932       1.1  christos         if (ACPI_FAILURE (Status))
    933       1.1  christos         {
    934       1.1  christos             return;
    935       1.1  christos         }
    936       1.1  christos 
    937       1.1  christos NextSubtable:
    938       1.1  christos         /* Point to next subtable */
    939       1.1  christos 
    940  1.1.1.12  christos         DbgPrint (ASL_PARSE_OUTPUT, "//[3) Subtable->Length = %X, Offset = %X]\n",
    941  1.1.1.12  christos             Subtable->Length, Offset);
    942  1.1.1.12  christos         DbgPrint (ASL_PARSE_OUTPUT, "//[4) Offset from table start: 0x%8.8X%8.8X (%p) %p]\n",
    943  1.1.1.12  christos             ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (UINT8, Subtable) - ACPI_CAST_PTR (UINT8, Table)), Subtable, Table);
    944  1.1.1.12  christos         if (Offset > Table->Length)
    945  1.1.1.12  christos         {
    946  1.1.1.12  christos             return;
    947  1.1.1.12  christos         }
    948  1.1.1.12  christos 
    949       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
    950       1.1  christos             Subtable->Length);
    951  1.1.1.12  christos 
    952  1.1.1.12  christos         DbgPrint (ASL_PARSE_OUTPUT, "//[5) Next Subtable %p, length %X]\n",
    953  1.1.1.12  christos             Subtable, Subtable->Length);
    954  1.1.1.12  christos         DbgPrint (ASL_PARSE_OUTPUT, "//[5B) Offset from table start: 0x%8.8X%8.8X (%p)]\n",
    955  1.1.1.12  christos             ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)), Subtable);
    956  1.1.1.12  christos 
    957  1.1.1.12  christos         Offset = ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table);
    958  1.1.1.12  christos         if (Offset >= Table->Length)
    959  1.1.1.12  christos         {
    960  1.1.1.12  christos             return;
    961  1.1.1.12  christos         }
    962       1.1  christos     }
    963       1.1  christos }
    964       1.1  christos 
    965       1.1  christos 
    966       1.1  christos /*******************************************************************************
    967       1.1  christos  *
    968       1.1  christos  * FUNCTION:    AcpiDmDumpMcfg
    969       1.1  christos  *
    970       1.1  christos  * PARAMETERS:  Table               - A MCFG Table
    971       1.1  christos  *
    972       1.1  christos  * RETURN:      None
    973       1.1  christos  *
    974       1.1  christos  * DESCRIPTION: Format the contents of a MCFG table
    975       1.1  christos  *
    976       1.1  christos  ******************************************************************************/
    977       1.1  christos 
    978       1.1  christos void
    979       1.1  christos AcpiDmDumpMcfg (
    980       1.1  christos     ACPI_TABLE_HEADER       *Table)
    981       1.1  christos {
    982       1.1  christos     ACPI_STATUS             Status;
    983       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
    984       1.1  christos     ACPI_MCFG_ALLOCATION    *Subtable;
    985       1.1  christos 
    986       1.1  christos 
    987       1.1  christos     /* Main table */
    988       1.1  christos 
    989       1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
    990       1.1  christos     if (ACPI_FAILURE (Status))
    991       1.1  christos     {
    992       1.1  christos         return;
    993       1.1  christos     }
    994       1.1  christos 
    995       1.1  christos     /* Subtables */
    996       1.1  christos 
    997       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
    998       1.1  christos     while (Offset < Table->Length)
    999       1.1  christos     {
   1000       1.1  christos         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
   1001       1.1  christos         {
   1002       1.1  christos             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
   1003   1.1.1.4  christos                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
   1004       1.1  christos             return;
   1005       1.1  christos         }
   1006       1.1  christos 
   1007       1.1  christos         AcpiOsPrintf ("\n");
   1008       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1009       1.1  christos             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
   1010       1.1  christos         if (ACPI_FAILURE (Status))
   1011       1.1  christos         {
   1012       1.1  christos             return;
   1013       1.1  christos         }
   1014       1.1  christos 
   1015       1.1  christos         /* Point to next subtable (each subtable is of fixed length) */
   1016       1.1  christos 
   1017       1.1  christos         Offset += sizeof (ACPI_MCFG_ALLOCATION);
   1018       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
   1019       1.1  christos             sizeof (ACPI_MCFG_ALLOCATION));
   1020       1.1  christos     }
   1021       1.1  christos }
   1022       1.1  christos 
   1023       1.1  christos 
   1024       1.1  christos /*******************************************************************************
   1025       1.1  christos  *
   1026       1.1  christos  * FUNCTION:    AcpiDmDumpMpst
   1027       1.1  christos  *
   1028       1.1  christos  * PARAMETERS:  Table               - A MPST Table
   1029       1.1  christos  *
   1030       1.1  christos  * RETURN:      None
   1031       1.1  christos  *
   1032       1.1  christos  * DESCRIPTION: Format the contents of a MPST table
   1033       1.1  christos  *
   1034       1.1  christos  ******************************************************************************/
   1035       1.1  christos 
   1036       1.1  christos void
   1037       1.1  christos AcpiDmDumpMpst (
   1038       1.1  christos     ACPI_TABLE_HEADER       *Table)
   1039       1.1  christos {
   1040       1.1  christos     ACPI_STATUS             Status;
   1041       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
   1042       1.1  christos     ACPI_MPST_POWER_NODE    *Subtable0;
   1043       1.1  christos     ACPI_MPST_POWER_STATE   *Subtable0A;
   1044       1.1  christos     ACPI_MPST_COMPONENT     *Subtable0B;
   1045       1.1  christos     ACPI_MPST_DATA_HDR      *Subtable1;
   1046       1.1  christos     ACPI_MPST_POWER_DATA    *Subtable2;
   1047       1.1  christos     UINT16                  SubtableCount;
   1048       1.1  christos     UINT32                  PowerStateCount;
   1049       1.1  christos     UINT32                  ComponentCount;
   1050       1.1  christos 
   1051       1.1  christos 
   1052       1.1  christos     /* Main table */
   1053       1.1  christos 
   1054       1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
   1055       1.1  christos     if (ACPI_FAILURE (Status))
   1056       1.1  christos     {
   1057       1.1  christos         return;
   1058       1.1  christos     }
   1059       1.1  christos 
   1060       1.1  christos     /* Subtable: Memory Power Node(s) */
   1061       1.1  christos 
   1062       1.1  christos     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
   1063       1.1  christos     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
   1064       1.1  christos 
   1065       1.1  christos     while ((Offset < Table->Length) && SubtableCount)
   1066       1.1  christos     {
   1067       1.1  christos         AcpiOsPrintf ("\n");
   1068       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
   1069       1.1  christos             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
   1070       1.1  christos         if (ACPI_FAILURE (Status))
   1071       1.1  christos         {
   1072       1.1  christos             return;
   1073       1.1  christos         }
   1074       1.1  christos 
   1075       1.1  christos         /* Extract the sub-subtable counts */
   1076       1.1  christos 
   1077       1.1  christos         PowerStateCount = Subtable0->NumPowerStates;
   1078       1.1  christos         ComponentCount = Subtable0->NumPhysicalComponents;
   1079       1.1  christos         Offset += sizeof (ACPI_MPST_POWER_NODE);
   1080       1.1  christos 
   1081       1.1  christos         /* Sub-subtables - Memory Power State Structure(s) */
   1082       1.1  christos 
   1083       1.1  christos         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
   1084       1.1  christos             sizeof (ACPI_MPST_POWER_NODE));
   1085       1.1  christos 
   1086       1.1  christos         while (PowerStateCount)
   1087       1.1  christos         {
   1088       1.1  christos             AcpiOsPrintf ("\n");
   1089       1.1  christos             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
   1090       1.1  christos                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
   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             Subtable0A++;
   1097       1.1  christos             PowerStateCount--;
   1098       1.1  christos             Offset += sizeof (ACPI_MPST_POWER_STATE);
   1099       1.1  christos        }
   1100       1.1  christos 
   1101       1.1  christos         /* Sub-subtables - Physical Component ID Structure(s) */
   1102       1.1  christos 
   1103       1.1  christos         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
   1104       1.1  christos 
   1105       1.1  christos         if (ComponentCount)
   1106       1.1  christos         {
   1107       1.1  christos             AcpiOsPrintf ("\n");
   1108       1.1  christos         }
   1109       1.1  christos 
   1110       1.1  christos         while (ComponentCount)
   1111       1.1  christos         {
   1112       1.1  christos             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
   1113       1.1  christos                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
   1114       1.1  christos             if (ACPI_FAILURE (Status))
   1115       1.1  christos             {
   1116       1.1  christos                 return;
   1117       1.1  christos             }
   1118       1.1  christos 
   1119       1.1  christos             Subtable0B++;
   1120       1.1  christos             ComponentCount--;
   1121       1.1  christos             Offset += sizeof (ACPI_MPST_COMPONENT);
   1122       1.1  christos         }
   1123       1.1  christos 
   1124       1.1  christos         /* Point to next Memory Power Node subtable */
   1125       1.1  christos 
   1126       1.1  christos         SubtableCount--;
   1127       1.1  christos         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
   1128       1.1  christos             sizeof (ACPI_MPST_POWER_NODE) +
   1129       1.1  christos             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
   1130       1.1  christos             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
   1131       1.1  christos     }
   1132       1.1  christos 
   1133       1.1  christos     /* Subtable: Count of Memory Power State Characteristic structures */
   1134       1.1  christos 
   1135       1.1  christos     AcpiOsPrintf ("\n");
   1136       1.1  christos     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
   1137       1.1  christos     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
   1138       1.1  christos         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
   1139       1.1  christos     if (ACPI_FAILURE (Status))
   1140       1.1  christos     {
   1141       1.1  christos         return;
   1142       1.1  christos     }
   1143       1.1  christos 
   1144       1.1  christos     SubtableCount = Subtable1->CharacteristicsCount;
   1145       1.1  christos     Offset += sizeof (ACPI_MPST_DATA_HDR);
   1146       1.1  christos 
   1147       1.1  christos     /* Subtable: Memory Power State Characteristics structure(s) */
   1148       1.1  christos 
   1149       1.1  christos     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
   1150       1.1  christos         sizeof (ACPI_MPST_DATA_HDR));
   1151       1.1  christos 
   1152       1.1  christos     while ((Offset < Table->Length) && SubtableCount)
   1153       1.1  christos     {
   1154       1.1  christos         AcpiOsPrintf ("\n");
   1155       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
   1156       1.1  christos             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
   1157       1.1  christos         if (ACPI_FAILURE (Status))
   1158       1.1  christos         {
   1159       1.1  christos             return;
   1160       1.1  christos         }
   1161       1.1  christos 
   1162       1.1  christos         Subtable2++;
   1163       1.1  christos         SubtableCount--;
   1164       1.1  christos         Offset += sizeof (ACPI_MPST_POWER_DATA);
   1165       1.1  christos     }
   1166       1.1  christos }
   1167       1.1  christos 
   1168       1.1  christos 
   1169       1.1  christos /*******************************************************************************
   1170       1.1  christos  *
   1171       1.1  christos  * FUNCTION:    AcpiDmDumpMsct
   1172       1.1  christos  *
   1173       1.1  christos  * PARAMETERS:  Table               - A MSCT table
   1174       1.1  christos  *
   1175       1.1  christos  * RETURN:      None
   1176       1.1  christos  *
   1177       1.1  christos  * DESCRIPTION: Format the contents of a MSCT
   1178       1.1  christos  *
   1179       1.1  christos  ******************************************************************************/
   1180       1.1  christos 
   1181       1.1  christos void
   1182       1.1  christos AcpiDmDumpMsct (
   1183       1.1  christos     ACPI_TABLE_HEADER       *Table)
   1184       1.1  christos {
   1185       1.1  christos     ACPI_STATUS             Status;
   1186       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
   1187       1.1  christos     ACPI_MSCT_PROXIMITY     *Subtable;
   1188       1.1  christos 
   1189       1.1  christos 
   1190       1.1  christos     /* Main table */
   1191       1.1  christos 
   1192       1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
   1193       1.1  christos     if (ACPI_FAILURE (Status))
   1194       1.1  christos     {
   1195       1.1  christos         return;
   1196       1.1  christos     }
   1197       1.1  christos 
   1198       1.1  christos     /* Subtables */
   1199       1.1  christos 
   1200       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
   1201       1.1  christos     while (Offset < Table->Length)
   1202       1.1  christos     {
   1203       1.1  christos         /* Common subtable header */
   1204       1.1  christos 
   1205       1.1  christos         AcpiOsPrintf ("\n");
   1206       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1207       1.1  christos             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
   1208       1.1  christos         if (ACPI_FAILURE (Status))
   1209       1.1  christos         {
   1210       1.1  christos             return;
   1211       1.1  christos         }
   1212       1.1  christos 
   1213       1.1  christos         /* Point to next subtable */
   1214       1.1  christos 
   1215       1.1  christos         Offset += sizeof (ACPI_MSCT_PROXIMITY);
   1216       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
   1217       1.1  christos             sizeof (ACPI_MSCT_PROXIMITY));
   1218       1.1  christos     }
   1219       1.1  christos }
   1220       1.1  christos 
   1221       1.1  christos 
   1222       1.1  christos /*******************************************************************************
   1223       1.1  christos  *
   1224       1.1  christos  * FUNCTION:    AcpiDmDumpNfit
   1225       1.1  christos  *
   1226       1.1  christos  * PARAMETERS:  Table               - A NFIT table
   1227       1.1  christos  *
   1228       1.1  christos  * RETURN:      None
   1229       1.1  christos  *
   1230       1.1  christos  * DESCRIPTION: Format the contents of an NFIT.
   1231       1.1  christos  *
   1232       1.1  christos  ******************************************************************************/
   1233       1.1  christos 
   1234       1.1  christos void
   1235       1.1  christos AcpiDmDumpNfit (
   1236       1.1  christos     ACPI_TABLE_HEADER       *Table)
   1237       1.1  christos {
   1238       1.1  christos     ACPI_STATUS             Status;
   1239       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
   1240       1.1  christos     UINT32                  FieldOffset = 0;
   1241       1.1  christos     UINT32                  Length;
   1242       1.1  christos     ACPI_NFIT_HEADER        *Subtable;
   1243       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1244       1.1  christos     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
   1245       1.1  christos     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
   1246       1.1  christos     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
   1247       1.1  christos     UINT32                  i;
   1248       1.1  christos 
   1249       1.1  christos 
   1250       1.1  christos     /* Main table */
   1251       1.1  christos 
   1252       1.1  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
   1253       1.1  christos     if (ACPI_FAILURE (Status))
   1254       1.1  christos     {
   1255       1.1  christos         return;
   1256       1.1  christos     }
   1257       1.1  christos 
   1258       1.1  christos     /* Subtables */
   1259       1.1  christos 
   1260       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
   1261       1.1  christos     while (Offset < Table->Length)
   1262       1.1  christos     {
   1263       1.1  christos         /* NFIT subtable header */
   1264       1.1  christos 
   1265       1.1  christos         AcpiOsPrintf ("\n");
   1266       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1267       1.1  christos             Subtable->Length, AcpiDmTableInfoNfitHdr);
   1268       1.1  christos         if (ACPI_FAILURE (Status))
   1269       1.1  christos         {
   1270       1.1  christos             return;
   1271       1.1  christos         }
   1272       1.1  christos 
   1273       1.1  christos         switch (Subtable->Type)
   1274       1.1  christos         {
   1275       1.1  christos         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
   1276       1.1  christos 
   1277       1.1  christos             InfoTable = AcpiDmTableInfoNfit0;
   1278       1.1  christos             break;
   1279       1.1  christos 
   1280       1.1  christos         case ACPI_NFIT_TYPE_MEMORY_MAP:
   1281       1.1  christos 
   1282       1.1  christos             InfoTable = AcpiDmTableInfoNfit1;
   1283       1.1  christos             break;
   1284       1.1  christos 
   1285       1.1  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   1286       1.1  christos 
   1287       1.1  christos             /* Has a variable number of 32-bit values at the end */
   1288       1.1  christos 
   1289       1.1  christos             InfoTable = AcpiDmTableInfoNfit2;
   1290       1.1  christos             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
   1291       1.1  christos             break;
   1292       1.1  christos 
   1293       1.1  christos         case ACPI_NFIT_TYPE_SMBIOS:
   1294       1.1  christos 
   1295       1.1  christos             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
   1296       1.1  christos             InfoTable = AcpiDmTableInfoNfit3;
   1297       1.1  christos             break;
   1298       1.1  christos 
   1299       1.1  christos         case ACPI_NFIT_TYPE_CONTROL_REGION:
   1300       1.1  christos 
   1301       1.1  christos             InfoTable = AcpiDmTableInfoNfit4;
   1302       1.1  christos             break;
   1303       1.1  christos 
   1304       1.1  christos         case ACPI_NFIT_TYPE_DATA_REGION:
   1305       1.1  christos 
   1306       1.1  christos             InfoTable = AcpiDmTableInfoNfit5;
   1307       1.1  christos             break;
   1308       1.1  christos 
   1309       1.1  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   1310       1.1  christos 
   1311       1.1  christos             /* Has a variable number of 64-bit addresses at the end */
   1312       1.1  christos 
   1313       1.1  christos             InfoTable = AcpiDmTableInfoNfit6;
   1314       1.1  christos             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
   1315       1.1  christos             break;
   1316       1.1  christos 
   1317       1.1  christos         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
   1318       1.1  christos 
   1319       1.1  christos             InfoTable = AcpiDmTableInfoNfit7;
   1320       1.1  christos             break;
   1321       1.1  christos 
   1322       1.1  christos         default:
   1323       1.1  christos             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
   1324       1.1  christos                 Subtable->Type);
   1325       1.1  christos 
   1326       1.1  christos             /* Attempt to continue */
   1327       1.1  christos 
   1328       1.1  christos             if (!Subtable->Length)
   1329       1.1  christos             {
   1330       1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   1331       1.1  christos                 return;
   1332       1.1  christos             }
   1333       1.1  christos             goto NextSubtable;
   1334       1.1  christos         }
   1335       1.1  christos 
   1336       1.1  christos         AcpiOsPrintf ("\n");
   1337       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   1338       1.1  christos             Subtable->Length, InfoTable);
   1339       1.1  christos         if (ACPI_FAILURE (Status))
   1340       1.1  christos         {
   1341       1.1  christos             return;
   1342       1.1  christos         }
   1343       1.1  christos 
   1344       1.1  christos         /* Per-subtable variable-length fields */
   1345       1.1  christos 
   1346       1.1  christos         switch (Subtable->Type)
   1347       1.1  christos         {
   1348       1.1  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   1349       1.1  christos 
   1350   1.1.1.5  christos             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
   1351       1.1  christos             for (i = 0; i < Interleave->LineCount; i++)
   1352       1.1  christos             {
   1353       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   1354       1.1  christos                     &Interleave->LineOffset[i],
   1355       1.1  christos                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
   1356       1.1  christos                 if (ACPI_FAILURE (Status))
   1357       1.1  christos                 {
   1358       1.1  christos                     return;
   1359       1.1  christos                 }
   1360       1.1  christos 
   1361       1.1  christos                 FieldOffset += sizeof (UINT32);
   1362       1.1  christos             }
   1363       1.1  christos             break;
   1364       1.1  christos 
   1365       1.1  christos         case ACPI_NFIT_TYPE_SMBIOS:
   1366       1.1  christos 
   1367       1.1  christos             Length = Subtable->Length -
   1368       1.1  christos                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
   1369       1.1  christos 
   1370       1.1  christos             if (Length)
   1371       1.1  christos             {
   1372       1.1  christos                 Status = AcpiDmDumpTable (Table->Length,
   1373       1.1  christos                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
   1374       1.1  christos                     SmbiosInfo,
   1375       1.1  christos                     Length, AcpiDmTableInfoNfit3a);
   1376       1.1  christos                 if (ACPI_FAILURE (Status))
   1377       1.1  christos                 {
   1378       1.1  christos                     return;
   1379       1.1  christos                 }
   1380       1.1  christos             }
   1381       1.1  christos 
   1382       1.1  christos             break;
   1383       1.1  christos 
   1384       1.1  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   1385       1.1  christos 
   1386   1.1.1.5  christos             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
   1387       1.1  christos             for (i = 0; i < Hint->HintCount; i++)
   1388       1.1  christos             {
   1389       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   1390       1.1  christos                     &Hint->HintAddress[i],
   1391       1.1  christos                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
   1392       1.1  christos                 if (ACPI_FAILURE (Status))
   1393       1.1  christos                 {
   1394       1.1  christos                     return;
   1395       1.1  christos                 }
   1396       1.1  christos 
   1397       1.1  christos                 FieldOffset += sizeof (UINT64);
   1398       1.1  christos             }
   1399       1.1  christos             break;
   1400       1.1  christos 
   1401       1.1  christos         default:
   1402       1.1  christos             break;
   1403       1.1  christos         }
   1404       1.1  christos 
   1405       1.1  christos NextSubtable:
   1406       1.1  christos         /* Point to next subtable */
   1407       1.1  christos 
   1408       1.1  christos         Offset += Subtable->Length;
   1409       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
   1410       1.1  christos     }
   1411       1.1  christos }
   1412       1.1  christos 
   1413       1.1  christos 
   1414       1.1  christos /*******************************************************************************
   1415       1.1  christos  *
   1416  1.1.1.10  christos  * FUNCTION:    AcpiDmDumpNhlt
   1417  1.1.1.10  christos  *
   1418  1.1.1.10  christos  * PARAMETERS:  Table               - A NHLT table
   1419  1.1.1.10  christos  *
   1420  1.1.1.10  christos  * RETURN:      None
   1421  1.1.1.10  christos  *
   1422  1.1.1.10  christos  * DESCRIPTION: Format the contents of an NHLT.
   1423  1.1.1.10  christos  *
   1424  1.1.1.10  christos  ******************************************************************************/
   1425  1.1.1.10  christos 
   1426  1.1.1.10  christos void
   1427  1.1.1.10  christos AcpiDmDumpNhlt (
   1428  1.1.1.10  christos     ACPI_TABLE_HEADER       *Table)
   1429  1.1.1.10  christos {
   1430  1.1.1.10  christos     ACPI_STATUS             Status;
   1431  1.1.1.10  christos     UINT32                  Offset;
   1432  1.1.1.10  christos     UINT32                  TableLength = Table->Length;
   1433  1.1.1.10  christos     UINT32                  EndpointCount;
   1434  1.1.1.10  christos     UINT8                   FormatsCount;
   1435  1.1.1.10  christos     ACPI_NHLT_ENDPOINT      *Subtable;
   1436  1.1.1.10  christos     ACPI_NHLT_FORMAT_CONFIG *FormatSubtable;
   1437  1.1.1.10  christos     ACPI_TABLE_NHLT         *InfoTable;
   1438  1.1.1.10  christos     UINT32                  CapabilitiesSize;
   1439  1.1.1.10  christos     UINT32                  i;
   1440  1.1.1.10  christos     UINT32                  j;
   1441  1.1.1.10  christos     UINT32                  EndpointEndOffset;
   1442  1.1.1.10  christos     UINT8                   ConfigType = 0;
   1443  1.1.1.10  christos     UINT8                   ArrayType;
   1444  1.1.1.11  christos     UINT8                   MicrophoneCount;
   1445  1.1.1.11  christos     ACPI_NHLT_VENDOR_MIC_COUNT          *MicCount;
   1446  1.1.1.10  christos     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A  *DevSpecific;
   1447  1.1.1.10  christos     ACPI_NHLT_FORMATS_CONFIG            *FormatsConfig;
   1448  1.1.1.12  christos     ACPI_NHLT_DEVICE_INFO_COUNT         *Count;
   1449  1.1.1.12  christos     ACPI_NHLT_DEVICE_INFO               *DeviceInfo;
   1450  1.1.1.12  christos     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B  *Capabilities;
   1451  1.1.1.10  christos 
   1452  1.1.1.10  christos 
   1453  1.1.1.10  christos     /* Main table */
   1454  1.1.1.10  christos 
   1455  1.1.1.11  christos     AcpiOsPrintf ("    /* Main table */\n");
   1456  1.1.1.10  christos 
   1457  1.1.1.10  christos     Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNhlt);
   1458  1.1.1.10  christos     if (ACPI_FAILURE (Status))
   1459  1.1.1.10  christos     {
   1460  1.1.1.10  christos         return;
   1461  1.1.1.10  christos     }
   1462  1.1.1.10  christos 
   1463  1.1.1.10  christos     /* Get the Endpoint Descriptor Count */
   1464  1.1.1.10  christos 
   1465  1.1.1.10  christos     InfoTable = ACPI_ADD_PTR (ACPI_TABLE_NHLT, Table, 0);
   1466  1.1.1.10  christos     EndpointCount = InfoTable->EndpointCount;
   1467  1.1.1.10  christos 
   1468  1.1.1.10  christos     /* Subtables */
   1469  1.1.1.10  christos 
   1470  1.1.1.10  christos     Offset = sizeof (ACPI_TABLE_NHLT);
   1471  1.1.1.10  christos 
   1472  1.1.1.10  christos     while (Offset < TableLength)
   1473  1.1.1.10  christos     {
   1474  1.1.1.10  christos         /* A variable number of Endpoint Descriptors - process each */
   1475  1.1.1.10  christos 
   1476  1.1.1.10  christos         for (i = 0; i < EndpointCount; i++)
   1477  1.1.1.10  christos         {
   1478  1.1.1.10  christos             /* Do the Endpoint Descriptor table */
   1479  1.1.1.10  christos 
   1480  1.1.1.10  christos             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
   1481  1.1.1.11  christos 
   1482  1.1.1.11  christos             /* Check for endpoint descriptor length beyond end-of-table */
   1483  1.1.1.11  christos 
   1484  1.1.1.10  christos             if (Subtable->DescriptorLength > TableLength)
   1485  1.1.1.10  christos             {
   1486  1.1.1.10  christos                 Offset += 1;
   1487  1.1.1.11  christos                 AcpiOsPrintf ("\n    /* Endpoint Descriptor Length larger than"
   1488  1.1.1.10  christos                     " table size: %X, table %X, adjusting table offset (+1) */\n",
   1489  1.1.1.10  christos                     Subtable->DescriptorLength, TableLength);
   1490  1.1.1.10  christos 
   1491  1.1.1.10  christos                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
   1492  1.1.1.10  christos             }
   1493  1.1.1.10  christos 
   1494  1.1.1.11  christos             AcpiOsPrintf ("\n    /* Endpoint Descriptor #%u */\n", i+1);
   1495  1.1.1.10  christos             Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
   1496  1.1.1.10  christos                 Subtable->DescriptorLength, AcpiDmTableInfoNhlt0);
   1497  1.1.1.10  christos             if (ACPI_FAILURE (Status))
   1498  1.1.1.10  christos             {
   1499  1.1.1.10  christos                 return;
   1500  1.1.1.10  christos             }
   1501  1.1.1.11  christos 
   1502  1.1.1.10  christos             EndpointEndOffset = Subtable->DescriptorLength + Offset;
   1503  1.1.1.10  christos 
   1504  1.1.1.10  christos             /* Check for endpoint descriptor beyond end-of-table */
   1505  1.1.1.10  christos 
   1506  1.1.1.10  christos             if (Subtable->DescriptorLength > TableLength)
   1507  1.1.1.10  christos             {
   1508  1.1.1.11  christos                 AcpiOsPrintf ("\n    /* Endpoint Descriptor Length larger than table size: %X, table %X */\n",
   1509  1.1.1.10  christos                     Subtable->DescriptorLength, TableLength);
   1510  1.1.1.10  christos             }
   1511  1.1.1.11  christos 
   1512  1.1.1.10  christos             Offset += sizeof (ACPI_NHLT_ENDPOINT);
   1513  1.1.1.10  christos             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
   1514  1.1.1.10  christos 
   1515  1.1.1.10  christos             /* Do the Device Specific table */
   1516  1.1.1.10  christos 
   1517  1.1.1.11  christos             AcpiOsPrintf ("\n    /* Endpoint Device_Specific_Config table */\n");
   1518  1.1.1.10  christos             DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
   1519  1.1.1.10  christos             CapabilitiesSize = DevSpecific->CapabilitiesSize;
   1520  1.1.1.11  christos             Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1521  1.1.1.11  christos                 sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
   1522  1.1.1.11  christos             if (ACPI_FAILURE (Status))
   1523  1.1.1.11  christos             {
   1524  1.1.1.11  christos                 return;
   1525  1.1.1.11  christos             }
   1526  1.1.1.11  christos 
   1527  1.1.1.11  christos             ArrayType = 0;
   1528  1.1.1.10  christos 
   1529  1.1.1.10  christos             /* Different subtables based upon capabilities_size */
   1530  1.1.1.10  christos 
   1531  1.1.1.10  christos             switch (CapabilitiesSize)
   1532  1.1.1.10  christos             {
   1533  1.1.1.10  christos             case 0:
   1534  1.1.1.10  christos                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
   1535  1.1.1.10  christos                 break;
   1536  1.1.1.10  christos 
   1537  1.1.1.10  christos             case 1:
   1538  1.1.1.10  christos                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1539  1.1.1.10  christos                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C), AcpiDmTableInfoNhlt5c);
   1540  1.1.1.10  christos                 if (ACPI_FAILURE (Status))
   1541  1.1.1.10  christos                 {
   1542  1.1.1.10  christos                     return;
   1543  1.1.1.10  christos                 }
   1544  1.1.1.10  christos                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C);
   1545  1.1.1.10  christos                 break;
   1546  1.1.1.10  christos 
   1547  1.1.1.10  christos             case 2:
   1548  1.1.1.10  christos                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1549  1.1.1.10  christos                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
   1550  1.1.1.10  christos                 if (ACPI_FAILURE (Status))
   1551  1.1.1.10  christos                 {
   1552  1.1.1.10  christos                     return;
   1553  1.1.1.10  christos                 }
   1554  1.1.1.10  christos                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
   1555  1.1.1.10  christos                 break;
   1556  1.1.1.10  christos 
   1557  1.1.1.10  christos             case 3:
   1558  1.1.1.11  christos             default:
   1559  1.1.1.11  christos                 /* Extract the ConfigType and ArrayType */
   1560  1.1.1.11  christos 
   1561  1.1.1.10  christos                 ConfigType = DevSpecific->ConfigType;
   1562  1.1.1.10  christos                 ArrayType = DevSpecific->ArrayType;
   1563  1.1.1.10  christos 
   1564  1.1.1.10  christos                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1565  1.1.1.10  christos                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A), AcpiDmTableInfoNhlt5a);
   1566  1.1.1.10  christos                 if (ACPI_FAILURE (Status))
   1567  1.1.1.10  christos                 {
   1568  1.1.1.10  christos                     return;
   1569  1.1.1.10  christos                 }
   1570  1.1.1.10  christos 
   1571  1.1.1.10  christos                 /* Capabilities Size == 3 */
   1572  1.1.1.10  christos                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A);
   1573  1.1.1.11  christos                 break;
   1574  1.1.1.10  christos 
   1575  1.1.1.11  christos             case 7:
   1576  1.1.1.11  christos                 ConfigType = DevSpecific->ConfigType;
   1577  1.1.1.11  christos                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
   1578  1.1.1.11  christos                 DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
   1579  1.1.1.10  christos 
   1580  1.1.1.11  christos                 AcpiOsPrintf ("\n    /* Render Feedback Device-Specific table */\n");
   1581  1.1.1.11  christos                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1582  1.1.1.11  christos                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
   1583  1.1.1.11  christos                 if (ACPI_FAILURE (Status))
   1584  1.1.1.10  christos                 {
   1585  1.1.1.11  christos                     return;
   1586  1.1.1.11  christos                 }
   1587  1.1.1.11  christos 
   1588  1.1.1.11  christos                 /* Capabilities Size = 7 */
   1589  1.1.1.11  christos                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
   1590  1.1.1.10  christos 
   1591  1.1.1.11  christos                 if (ConfigType == ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK)
   1592  1.1.1.11  christos                 {
   1593  1.1.1.11  christos                     Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
   1594  1.1.1.11  christos                     DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
   1595  1.1.1.10  christos 
   1596  1.1.1.10  christos                     Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1597  1.1.1.11  christos                         sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt6b);
   1598  1.1.1.10  christos                     if (ACPI_FAILURE (Status))
   1599  1.1.1.10  christos                     {
   1600  1.1.1.10  christos                         return;
   1601  1.1.1.10  christos                     }
   1602  1.1.1.11  christos                     Offset += sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG);
   1603  1.1.1.10  christos                 }
   1604  1.1.1.10  christos                 break;
   1605  1.1.1.11  christos            }
   1606  1.1.1.10  christos 
   1607  1.1.1.11  christos             /* Check for a vendor-defined mic array */
   1608  1.1.1.10  christos 
   1609  1.1.1.11  christos             if (ConfigType == ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY)
   1610  1.1.1.11  christos             {
   1611  1.1.1.11  christos                 if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_MASK) == ACPI_NHLT_VENDOR_DEFINED)
   1612  1.1.1.10  christos                 {
   1613  1.1.1.11  christos                     /* Vendor-defined microphone array; get the microphone count first */
   1614  1.1.1.11  christos 
   1615  1.1.1.11  christos                     AcpiOsPrintf ("\n    /* Vendor-defined microphone count */\n");
   1616  1.1.1.11  christos                     MicCount = ACPI_ADD_PTR (ACPI_NHLT_VENDOR_MIC_COUNT, Table, Offset);
   1617  1.1.1.11  christos                     MicrophoneCount = MicCount->MicrophoneCount;
   1618  1.1.1.11  christos 
   1619  1.1.1.11  christos                     Status = AcpiDmDumpTable (TableLength, Offset, MicCount,
   1620  1.1.1.11  christos                         sizeof (ACPI_NHLT_VENDOR_MIC_COUNT), AcpiDmTableInfoNhlt6a);
   1621  1.1.1.11  christos                     Offset += sizeof (ACPI_NHLT_VENDOR_MIC_COUNT);
   1622  1.1.1.11  christos                     if (ACPI_FAILURE (Status))
   1623  1.1.1.11  christos                     {
   1624  1.1.1.11  christos                         return;
   1625  1.1.1.11  christos                     }
   1626  1.1.1.11  christos 
   1627  1.1.1.11  christos                     /* Get the vendor microphone config structure(s) */
   1628  1.1.1.11  christos 
   1629  1.1.1.11  christos                     for (j = 0; j < MicrophoneCount; j++)
   1630  1.1.1.11  christos                     {
   1631  1.1.1.11  christos                         AcpiOsPrintf ("\n    /* Vendor-defined microphone array #%u*/\n", j+1);
   1632  1.1.1.11  christos                         DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
   1633  1.1.1.11  christos 
   1634  1.1.1.11  christos                         Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1635  1.1.1.11  christos                             sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG), AcpiDmTableInfoNhlt6);
   1636  1.1.1.11  christos                         if (ACPI_FAILURE (Status))
   1637  1.1.1.11  christos                         {
   1638  1.1.1.11  christos                             return;
   1639  1.1.1.11  christos                         }
   1640  1.1.1.11  christos 
   1641  1.1.1.11  christos                         Offset += sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG);
   1642  1.1.1.11  christos                     }
   1643  1.1.1.11  christos 
   1644  1.1.1.11  christos                     /* Check for Microphone SNR and sensitivity extension */
   1645  1.1.1.11  christos 
   1646  1.1.1.11  christos                     if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_EXT_MASK) == ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT)
   1647  1.1.1.11  christos                     {
   1648  1.1.1.11  christos                         AcpiOsPrintf ("\n    /* Microphone SNR and sensitivity array */\n");
   1649  1.1.1.11  christos                         DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
   1650  1.1.1.11  christos 
   1651  1.1.1.11  christos                         Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
   1652  1.1.1.11  christos                             sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION), AcpiDmTableInfoNhlt9);
   1653  1.1.1.11  christos                         if (ACPI_FAILURE (Status))
   1654  1.1.1.11  christos                         {
   1655  1.1.1.11  christos                             return;
   1656  1.1.1.11  christos                         }
   1657  1.1.1.11  christos 
   1658  1.1.1.11  christos                         Offset += sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION);
   1659  1.1.1.11  christos                     }
   1660  1.1.1.10  christos                 }
   1661  1.1.1.10  christos             }
   1662  1.1.1.10  christos 
   1663  1.1.1.11  christos             /* Do the Formats_Config table - starts with the FormatsCount field */
   1664  1.1.1.10  christos 
   1665  1.1.1.10  christos             FormatsConfig = ACPI_ADD_PTR (ACPI_NHLT_FORMATS_CONFIG, Table, Offset);
   1666  1.1.1.10  christos             FormatsCount = FormatsConfig->FormatsCount;
   1667  1.1.1.10  christos 
   1668  1.1.1.11  christos             AcpiOsPrintf ("\n    /* Formats_Config table */\n");
   1669  1.1.1.10  christos 
   1670  1.1.1.11  christos             /* Dump the FormatsCount value */
   1671  1.1.1.11  christos 
   1672  1.1.1.11  christos             if (FormatsCount > 0)
   1673  1.1.1.10  christos             {
   1674  1.1.1.11  christos                 Status = AcpiDmDumpTable (TableLength, Offset, FormatsConfig,
   1675  1.1.1.11  christos                     sizeof (ACPI_NHLT_FORMATS_CONFIG), AcpiDmTableInfoNhlt4);
   1676  1.1.1.11  christos                 if (ACPI_FAILURE (Status))
   1677  1.1.1.11  christos                 {
   1678  1.1.1.11  christos                     return;
   1679  1.1.1.11  christos                 }
   1680  1.1.1.10  christos             }
   1681  1.1.1.10  christos             Offset += sizeof (ACPI_NHLT_FORMATS_CONFIG);
   1682  1.1.1.10  christos 
   1683  1.1.1.10  christos             /* A variable number of Format_Config Descriptors - process each */
   1684  1.1.1.10  christos 
   1685  1.1.1.10  christos             for (j = 0; j < FormatsCount; j++)
   1686  1.1.1.10  christos             {
   1687  1.1.1.10  christos                 FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset);
   1688  1.1.1.10  christos                 CapabilitiesSize = FormatSubtable->CapabilitySize;
   1689  1.1.1.10  christos 
   1690  1.1.1.10  christos                 /* Do the Wave_extensible struct */
   1691  1.1.1.10  christos 
   1692  1.1.1.11  christos                 AcpiOsPrintf ("\n    /* Wave_Format_Extensible table #%u */\n", j+1);
   1693  1.1.1.10  christos                 Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable,
   1694  1.1.1.10  christos                     sizeof (ACPI_NHLT_FORMAT_CONFIG), AcpiDmTableInfoNhlt3);
   1695  1.1.1.10  christos                 if (ACPI_FAILURE (Status))
   1696  1.1.1.10  christos                 {
   1697  1.1.1.10  christos                     return;
   1698  1.1.1.10  christos                 }
   1699  1.1.1.10  christos 
   1700  1.1.1.11  christos                 Offset += sizeof (ACPI_NHLT_FORMAT_CONFIG);
   1701  1.1.1.10  christos 
   1702  1.1.1.11  christos                 if (CapabilitiesSize > 0)
   1703  1.1.1.10  christos                 {
   1704  1.1.1.12  christos                     UINT8* CapabilitiesBuf = ACPI_ADD_PTR (UINT8, Table, Offset);
   1705  1.1.1.11  christos                     /* Do the Capabilities array (of bytes) */
   1706  1.1.1.11  christos 
   1707  1.1.1.11  christos                     AcpiOsPrintf ("\n    /* Specific_Config table #%u */\n", j+1);
   1708  1.1.1.12  christos 
   1709  1.1.1.12  christos                     Status = AcpiDmDumpTable (TableLength, Offset, CapabilitiesBuf,
   1710  1.1.1.11  christos                         CapabilitiesSize, AcpiDmTableInfoNhlt3a);
   1711  1.1.1.11  christos                     if (ACPI_FAILURE (Status))
   1712  1.1.1.11  christos                     {
   1713  1.1.1.11  christos                         return;
   1714  1.1.1.11  christos                     }
   1715  1.1.1.11  christos 
   1716  1.1.1.12  christos                     Offset += CapabilitiesSize; /* + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); */
   1717  1.1.1.10  christos                 }
   1718  1.1.1.11  christos 
   1719  1.1.1.11  christos             } /* for (j = 0; j < FormatsCount; j++) */
   1720  1.1.1.10  christos 
   1721  1.1.1.10  christos             /*
   1722  1.1.1.11  christos              * If we are not done with the current Endpoint yet, then there must be
   1723  1.1.1.12  christos              * some non documented structure(s) yet to be processed. First, get
   1724  1.1.1.11  christos              * the count of such structure(s).
   1725  1.1.1.10  christos              */
   1726  1.1.1.10  christos             if (Offset < EndpointEndOffset)
   1727  1.1.1.10  christos             {
   1728  1.1.1.12  christos                 AcpiOsPrintf ("\n    /* Structures that are not part of NHLT spec */\n");
   1729  1.1.1.12  christos                 Count = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO_COUNT, Table, Offset);
   1730  1.1.1.10  christos                 Status = AcpiDmDumpTable (TableLength, Offset, Count,
   1731  1.1.1.12  christos                     sizeof (ACPI_NHLT_DEVICE_INFO_COUNT), AcpiDmTableInfoNhlt7);
   1732  1.1.1.10  christos                 if (ACPI_FAILURE (Status))
   1733  1.1.1.10  christos                 {
   1734  1.1.1.10  christos                     return;
   1735  1.1.1.10  christos                 }
   1736  1.1.1.12  christos                 Offset += sizeof (ACPI_NHLT_DEVICE_INFO_COUNT);
   1737  1.1.1.11  christos 
   1738  1.1.1.12  christos                 /* Variable number of device structures */
   1739  1.1.1.10  christos 
   1740  1.1.1.11  christos                 for (j = 0; j < Count->StructureCount; j++)
   1741  1.1.1.10  christos                 {
   1742  1.1.1.12  christos                     DeviceInfo = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO, Table, Offset);
   1743  1.1.1.12  christos                     AcpiOsPrintf ("\n    /* Device Info structure #%u (not part of NHLT spec) */\n", j+1);
   1744  1.1.1.10  christos 
   1745  1.1.1.11  christos                     /*
   1746  1.1.1.12  christos                      * Dump the following Device Info fields:
   1747  1.1.1.11  christos                      *  1) Device ID
   1748  1.1.1.11  christos                      *  2) Device Instance ID
   1749  1.1.1.11  christos                      *  3) Device Port ID
   1750  1.1.1.11  christos                      */
   1751  1.1.1.12  christos                     Status = AcpiDmDumpTable (TableLength, Offset, DeviceInfo,
   1752  1.1.1.12  christos                         sizeof (ACPI_NHLT_DEVICE_INFO), AcpiDmTableInfoNhlt7a);
   1753  1.1.1.10  christos                     if (ACPI_FAILURE (Status))
   1754  1.1.1.10  christos                     {
   1755  1.1.1.10  christos                         return;
   1756  1.1.1.10  christos                     }
   1757  1.1.1.10  christos 
   1758  1.1.1.12  christos                     Offset += sizeof (ACPI_NHLT_DEVICE_INFO);
   1759  1.1.1.12  christos                 }
   1760  1.1.1.11  christos 
   1761  1.1.1.12  christos                 /*
   1762  1.1.1.12  christos                  * Check that the current offset is not beyond the end of
   1763  1.1.1.12  christos                  * this endpoint descriptor. If it is not, print those
   1764  1.1.1.12  christos                  * undocumented bytes.
   1765  1.1.1.12  christos                  */
   1766  1.1.1.12  christos                 if (Offset < EndpointEndOffset)
   1767  1.1.1.12  christos                 {
   1768  1.1.1.12  christos                     /* Unknown data at the end of the Endpoint */
   1769  1.1.1.12  christos                     UINT32 size = EndpointEndOffset - Offset;
   1770  1.1.1.12  christos                     UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
   1771  1.1.1.12  christos                     AcpiOsPrintf ("\n    /* Unknown data at the end of the Endpoint, size: %X */\n", size);
   1772  1.1.1.12  christos                     Status = AcpiDmDumpTable (TableLength, Offset, buffer,
   1773  1.1.1.12  christos                         size, AcpiDmTableInfoNhlt7b);
   1774  1.1.1.12  christos                     Offset = EndpointEndOffset;
   1775  1.1.1.10  christos                 }
   1776  1.1.1.11  christos 
   1777  1.1.1.11  christos                 /* Should be at the end of the Endpoint structure. */
   1778  1.1.1.10  christos             }
   1779  1.1.1.10  christos 
   1780  1.1.1.11  christos         } /* for (i = 0; i < EndpointCount; i++) */
   1781  1.1.1.11  christos 
   1782  1.1.1.10  christos 
   1783  1.1.1.11  christos         /*
   1784  1.1.1.11  christos          * Done with all of the Endpoint Descriptors, Emit the table terminator
   1785  1.1.1.11  christos          * (if such a legacy structure is present -- not in NHLT specification)
   1786  1.1.1.11  christos          */
   1787  1.1.1.12  christos         if (Offset < TableLength)
   1788  1.1.1.10  christos         {
   1789  1.1.1.12  christos             Capabilities = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Table, Offset);
   1790  1.1.1.12  christos             AcpiOsPrintf ("\n/* Terminating specific config (not part of NHLT spec) */\n");
   1791  1.1.1.10  christos 
   1792  1.1.1.12  christos             Status = AcpiDmDumpTable (TableLength, Offset, Capabilities,
   1793  1.1.1.12  christos                 sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
   1794  1.1.1.10  christos             if (ACPI_FAILURE (Status))
   1795  1.1.1.10  christos             {
   1796  1.1.1.10  christos                 return;
   1797  1.1.1.10  christos             }
   1798  1.1.1.12  christos             Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
   1799  1.1.1.12  christos 
   1800  1.1.1.12  christos             if (Capabilities->CapabilitiesSize > 0)
   1801  1.1.1.12  christos             {
   1802  1.1.1.12  christos                 UINT32 remainingBytes = TableLength - Offset;
   1803  1.1.1.12  christos                 UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
   1804  1.1.1.12  christos 
   1805  1.1.1.12  christos                 if (remainingBytes != Capabilities->CapabilitiesSize)
   1806  1.1.1.12  christos                     AcpiOsPrintf ("\n/* Incorrect config size, should be %X, is %X */\n",
   1807  1.1.1.12  christos                         Capabilities->CapabilitiesSize, remainingBytes);
   1808  1.1.1.12  christos                 Status = AcpiDmDumpTable (TableLength, Offset, buffer,
   1809  1.1.1.12  christos                         remainingBytes, AcpiDmTableInfoNhlt3a);
   1810  1.1.1.12  christos             }
   1811  1.1.1.10  christos         }
   1812  1.1.1.10  christos 
   1813  1.1.1.10  christos         return;
   1814  1.1.1.10  christos     }
   1815  1.1.1.10  christos }
   1816  1.1.1.10  christos 
   1817  1.1.1.10  christos 
   1818  1.1.1.10  christos /*******************************************************************************
   1819  1.1.1.10  christos  *
   1820       1.1  christos  * FUNCTION:    AcpiDmDumpPcct
   1821       1.1  christos  *
   1822       1.1  christos  * PARAMETERS:  Table               - A PCCT table
   1823       1.1  christos  *
   1824       1.1  christos  * RETURN:      None
   1825       1.1  christos  *
   1826       1.1  christos  * DESCRIPTION: Format the contents of a PCCT. This table type consists
   1827       1.1  christos  *              of an open-ended number of subtables.
   1828       1.1  christos  *
   1829       1.1  christos  ******************************************************************************/
   1830       1.1  christos 
   1831       1.1  christos void
   1832       1.1  christos AcpiDmDumpPcct (
   1833       1.1  christos     ACPI_TABLE_HEADER       *Table)
   1834       1.1  christos {
   1835       1.1  christos     ACPI_STATUS             Status;
   1836       1.1  christos     ACPI_PCCT_SUBSPACE      *Subtable;
   1837       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1838       1.1  christos     UINT32                  Length = Table->Length;
   1839       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
   1840       1.1  christos 
   1841       1.1  christos 
   1842       1.1  christos     /* Main table */
   1843       1.1  christos 
   1844       1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
   1845       1.1  christos     if (ACPI_FAILURE (Status))
   1846       1.1  christos     {
   1847       1.1  christos         return;
   1848       1.1  christos     }
   1849       1.1  christos 
   1850       1.1  christos     /* Subtables */
   1851       1.1  christos 
   1852       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
   1853       1.1  christos     while (Offset < Table->Length)
   1854       1.1  christos     {
   1855       1.1  christos         /* Common subtable header */
   1856       1.1  christos 
   1857       1.1  christos         AcpiOsPrintf ("\n");
   1858       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1859       1.1  christos             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
   1860       1.1  christos         if (ACPI_FAILURE (Status))
   1861       1.1  christos         {
   1862       1.1  christos             return;
   1863       1.1  christos         }
   1864       1.1  christos 
   1865       1.1  christos         switch (Subtable->Header.Type)
   1866       1.1  christos         {
   1867       1.1  christos         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
   1868       1.1  christos 
   1869       1.1  christos             InfoTable = AcpiDmTableInfoPcct0;
   1870       1.1  christos             break;
   1871       1.1  christos 
   1872       1.1  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
   1873       1.1  christos 
   1874       1.1  christos             InfoTable = AcpiDmTableInfoPcct1;
   1875       1.1  christos             break;
   1876       1.1  christos 
   1877       1.1  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
   1878       1.1  christos 
   1879       1.1  christos             InfoTable = AcpiDmTableInfoPcct2;
   1880       1.1  christos             break;
   1881       1.1  christos 
   1882       1.1  christos         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
   1883       1.1  christos 
   1884       1.1  christos             InfoTable = AcpiDmTableInfoPcct3;
   1885       1.1  christos             break;
   1886       1.1  christos 
   1887       1.1  christos         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
   1888       1.1  christos 
   1889       1.1  christos             InfoTable = AcpiDmTableInfoPcct4;
   1890       1.1  christos             break;
   1891       1.1  christos 
   1892   1.1.1.8  christos         case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
   1893   1.1.1.8  christos 
   1894   1.1.1.8  christos             InfoTable = AcpiDmTableInfoPcct5;
   1895   1.1.1.8  christos             break;
   1896   1.1.1.8  christos 
   1897       1.1  christos         default:
   1898       1.1  christos 
   1899       1.1  christos             AcpiOsPrintf (
   1900       1.1  christos                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
   1901       1.1  christos                 Subtable->Header.Type);
   1902       1.1  christos             return;
   1903       1.1  christos         }
   1904       1.1  christos 
   1905       1.1  christos         AcpiOsPrintf ("\n");
   1906       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1907       1.1  christos             Subtable->Header.Length, InfoTable);
   1908       1.1  christos         if (ACPI_FAILURE (Status))
   1909       1.1  christos         {
   1910       1.1  christos             return;
   1911       1.1  christos         }
   1912       1.1  christos 
   1913       1.1  christos         /* Point to next subtable */
   1914       1.1  christos 
   1915       1.1  christos         Offset += Subtable->Header.Length;
   1916       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
   1917       1.1  christos             Subtable->Header.Length);
   1918       1.1  christos     }
   1919       1.1  christos }
   1920       1.1  christos 
   1921       1.1  christos 
   1922       1.1  christos /*******************************************************************************
   1923       1.1  christos  *
   1924       1.1  christos  * FUNCTION:    AcpiDmDumpPdtt
   1925       1.1  christos  *
   1926       1.1  christos  * PARAMETERS:  Table               - A PDTT table
   1927       1.1  christos  *
   1928       1.1  christos  * RETURN:      None
   1929       1.1  christos  *
   1930       1.1  christos  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
   1931       1.1  christos  *              table that contains an open-ended number of IDs
   1932       1.1  christos  *              at the end of the table.
   1933       1.1  christos  *
   1934       1.1  christos  ******************************************************************************/
   1935       1.1  christos 
   1936       1.1  christos void
   1937       1.1  christos AcpiDmDumpPdtt (
   1938       1.1  christos     ACPI_TABLE_HEADER       *Table)
   1939       1.1  christos {
   1940       1.1  christos     ACPI_STATUS             Status;
   1941       1.1  christos     ACPI_PDTT_CHANNEL       *Subtable;
   1942       1.1  christos     UINT32                  Length = Table->Length;
   1943       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
   1944       1.1  christos 
   1945       1.1  christos 
   1946       1.1  christos     /* Main table */
   1947       1.1  christos 
   1948       1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
   1949       1.1  christos     if (ACPI_FAILURE (Status))
   1950       1.1  christos     {
   1951       1.1  christos         return;
   1952       1.1  christos     }
   1953       1.1  christos 
   1954       1.1  christos     /* Subtables. Currently there is only one type, but can be multiples */
   1955       1.1  christos 
   1956       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
   1957       1.1  christos     while (Offset < Table->Length)
   1958       1.1  christos     {
   1959       1.1  christos         AcpiOsPrintf ("\n");
   1960       1.1  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1961       1.1  christos             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
   1962       1.1  christos         if (ACPI_FAILURE (Status))
   1963       1.1  christos         {
   1964       1.1  christos             return;
   1965       1.1  christos         }
   1966       1.1  christos 
   1967       1.1  christos         /* Point to next subtable */
   1968       1.1  christos 
   1969       1.1  christos         Offset += sizeof (ACPI_PDTT_CHANNEL);
   1970       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
   1971       1.1  christos             sizeof (ACPI_PDTT_CHANNEL));
   1972       1.1  christos     }
   1973       1.1  christos }
   1974       1.1  christos 
   1975       1.1  christos 
   1976       1.1  christos /*******************************************************************************
   1977       1.1  christos  *
   1978   1.1.1.8  christos  * FUNCTION:    AcpiDmDumpPhat
   1979       1.1  christos  *
   1980   1.1.1.8  christos  * PARAMETERS:  Table               - A PHAT table
   1981       1.1  christos  *
   1982       1.1  christos  * RETURN:      None
   1983       1.1  christos  *
   1984   1.1.1.8  christos  * DESCRIPTION: Format the contents of a PHAT.
   1985       1.1  christos  *
   1986       1.1  christos  ******************************************************************************/
   1987       1.1  christos 
   1988       1.1  christos void
   1989   1.1.1.8  christos AcpiDmDumpPhat (
   1990       1.1  christos     ACPI_TABLE_HEADER       *Table)
   1991       1.1  christos {
   1992       1.1  christos     ACPI_STATUS             Status;
   1993   1.1.1.8  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1994   1.1.1.8  christos     ACPI_PHAT_HEADER        *Subtable;
   1995   1.1.1.8  christos     ACPI_PHAT_VERSION_DATA  *VersionData;
   1996   1.1.1.8  christos     UINT32                  RecordCount;
   1997       1.1  christos     UINT32                  Length = Table->Length;
   1998   1.1.1.8  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PHAT);
   1999   1.1.1.8  christos     UINT32                  SubtableLength;
   2000   1.1.1.8  christos     UINT32                  PathLength;
   2001   1.1.1.8  christos     UINT32                  VendorLength;
   2002       1.1  christos 
   2003       1.1  christos 
   2004   1.1.1.8  christos     Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
   2005       1.1  christos 
   2006       1.1  christos     while (Offset < Table->Length)
   2007       1.1  christos     {
   2008       1.1  christos         /* Common subtable header */
   2009       1.1  christos 
   2010       1.1  christos         AcpiOsPrintf ("\n");
   2011   1.1.1.8  christos         Status = AcpiDmDumpTable (Length, 0, Subtable,
   2012   1.1.1.8  christos             sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
   2013       1.1  christos         if (ACPI_FAILURE (Status))
   2014       1.1  christos         {
   2015       1.1  christos             return;
   2016       1.1  christos         }
   2017       1.1  christos 
   2018   1.1.1.8  christos         switch (Subtable->Type)
   2019       1.1  christos         {
   2020   1.1.1.8  christos         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
   2021   1.1.1.8  christos 
   2022   1.1.1.8  christos             InfoTable = AcpiDmTableInfoPhat0;
   2023   1.1.1.8  christos             SubtableLength = sizeof (ACPI_PHAT_VERSION_DATA);
   2024   1.1.1.8  christos             break;
   2025   1.1.1.8  christos 
   2026   1.1.1.8  christos         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
   2027   1.1.1.8  christos 
   2028   1.1.1.8  christos             InfoTable = AcpiDmTableInfoPhat1;
   2029   1.1.1.8  christos             SubtableLength = sizeof (ACPI_PHAT_HEALTH_DATA);
   2030   1.1.1.8  christos             break;
   2031   1.1.1.8  christos 
   2032   1.1.1.8  christos         default:
   2033   1.1.1.8  christos 
   2034   1.1.1.8  christos             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
   2035       1.1  christos                 Subtable->Type);
   2036   1.1.1.8  christos 
   2037       1.1  christos             return;
   2038       1.1  christos         }
   2039       1.1  christos 
   2040   1.1.1.8  christos         Status = AcpiDmDumpTable (Length, 0, Subtable,
   2041   1.1.1.8  christos             SubtableLength, InfoTable);
   2042       1.1  christos         if (ACPI_FAILURE (Status))
   2043       1.1  christos         {
   2044       1.1  christos             return;
   2045       1.1  christos         }
   2046       1.1  christos 
   2047   1.1.1.8  christos         switch (Subtable->Type)
   2048       1.1  christos         {
   2049   1.1.1.8  christos         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
   2050       1.1  christos 
   2051   1.1.1.8  christos             VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
   2052   1.1.1.8  christos             RecordCount = VersionData->ElementCount;
   2053   1.1.1.8  christos             while (RecordCount)
   2054   1.1.1.8  christos             {
   2055   1.1.1.8  christos                 Status = AcpiDmDumpTable (Length, Offset,
   2056   1.1.1.8  christos                     ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)),
   2057   1.1.1.8  christos                     sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
   2058   1.1.1.8  christos                 if (ACPI_FAILURE (Status))
   2059   1.1.1.8  christos                 {
   2060   1.1.1.8  christos                     return;
   2061   1.1.1.8  christos                 }
   2062   1.1.1.8  christos 
   2063   1.1.1.8  christos                 RecordCount--;
   2064       1.1  christos             }
   2065       1.1  christos 
   2066   1.1.1.8  christos             break;
   2067   1.1.1.8  christos 
   2068   1.1.1.8  christos         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
   2069   1.1.1.8  christos 
   2070   1.1.1.8  christos             /* account for the null terminator */
   2071       1.1  christos 
   2072   1.1.1.8  christos             PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1;
   2073   1.1.1.8  christos             Status = AcpiDmDumpTable (Length, Offset,
   2074   1.1.1.8  christos                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
   2075   1.1.1.8  christos                 PathLength, AcpiDmTableInfoPhat1a);
   2076   1.1.1.8  christos             if (ACPI_FAILURE (Status))
   2077       1.1  christos             {
   2078       1.1  christos                 return;
   2079       1.1  christos             }
   2080       1.1  christos 
   2081   1.1.1.8  christos             /* Get vendor data - data length is the remaining subtable length */
   2082       1.1  christos 
   2083   1.1.1.8  christos             VendorLength =
   2084   1.1.1.8  christos                 Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
   2085   1.1.1.8  christos             Status = AcpiDmDumpTable (Length, 0,
   2086   1.1.1.8  christos                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
   2087   1.1.1.8  christos                 VendorLength, AcpiDmTableInfoPhat1b);
   2088       1.1  christos             if (ACPI_FAILURE (Status))
   2089       1.1  christos             {
   2090       1.1  christos                 return;
   2091       1.1  christos             }
   2092   1.1.1.8  christos             break;
   2093       1.1  christos 
   2094   1.1.1.8  christos         default:
   2095       1.1  christos 
   2096   1.1.1.8  christos             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
   2097   1.1.1.8  christos                 Subtable->Type);
   2098   1.1.1.8  christos             return;
   2099   1.1.1.8  christos         }
   2100       1.1  christos 
   2101   1.1.1.8  christos         /* Next subtable */
   2102       1.1  christos 
   2103   1.1.1.8  christos         Offset += Subtable->Length;
   2104   1.1.1.8  christos         Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable,
   2105   1.1.1.8  christos             Subtable->Length);
   2106   1.1.1.8  christos     }
   2107   1.1.1.8  christos }
   2108       1.1  christos 
   2109       1.1  christos 
   2110   1.1.1.8  christos /*******************************************************************************
   2111   1.1.1.8  christos  *
   2112   1.1.1.8  christos  * FUNCTION:    AcpiDmDumpPmtt
   2113   1.1.1.8  christos  *
   2114   1.1.1.8  christos  * PARAMETERS:  Table               - A PMTT table
   2115   1.1.1.8  christos  *
   2116   1.1.1.8  christos  * RETURN:      None
   2117   1.1.1.8  christos  *
   2118   1.1.1.8  christos  * DESCRIPTION: Format the contents of a PMTT. This table type consists
   2119   1.1.1.8  christos  *              of an open-ended number of subtables.
   2120   1.1.1.8  christos  *
   2121   1.1.1.8  christos  ******************************************************************************/
   2122       1.1  christos 
   2123   1.1.1.8  christos void
   2124   1.1.1.8  christos AcpiDmDumpPmtt (
   2125   1.1.1.8  christos     ACPI_TABLE_HEADER       *Table)
   2126   1.1.1.8  christos {
   2127   1.1.1.8  christos     ACPI_STATUS             Status;
   2128   1.1.1.8  christos     ACPI_PMTT_HEADER        *Subtable;
   2129   1.1.1.8  christos     UINT32                  Length = Table->Length;
   2130   1.1.1.8  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
   2131       1.1  christos 
   2132       1.1  christos 
   2133   1.1.1.8  christos     /* Main table */
   2134       1.1  christos 
   2135   1.1.1.8  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
   2136   1.1.1.8  christos     if (ACPI_FAILURE (Status))
   2137   1.1.1.8  christos     {
   2138   1.1.1.8  christos         return;
   2139   1.1.1.8  christos     }
   2140       1.1  christos 
   2141   1.1.1.8  christos     /* Subtables */
   2142       1.1  christos 
   2143   1.1.1.8  christos     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
   2144   1.1.1.8  christos     while (Offset < Table->Length)
   2145   1.1.1.8  christos     {
   2146   1.1.1.8  christos         /* Each of the types below contain the common subtable header */
   2147       1.1  christos 
   2148   1.1.1.8  christos         AcpiOsPrintf ("\n");
   2149   1.1.1.8  christos         switch (Subtable->Type)
   2150   1.1.1.8  christos         {
   2151   1.1.1.8  christos         case ACPI_PMTT_TYPE_SOCKET:
   2152       1.1  christos 
   2153   1.1.1.8  christos             Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2154   1.1.1.8  christos                 Subtable->Length, AcpiDmTableInfoPmtt0);
   2155   1.1.1.8  christos             if (ACPI_FAILURE (Status))
   2156   1.1.1.8  christos             {
   2157   1.1.1.8  christos                 return;
   2158       1.1  christos             }
   2159   1.1.1.8  christos             break;
   2160   1.1.1.8  christos 
   2161   1.1.1.8  christos         case ACPI_PMTT_TYPE_CONTROLLER:
   2162   1.1.1.8  christos             Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2163   1.1.1.8  christos                 Subtable->Length, AcpiDmTableInfoPmtt1);
   2164   1.1.1.8  christos             if (ACPI_FAILURE (Status))
   2165   1.1.1.8  christos             {
   2166   1.1.1.8  christos                 return;
   2167   1.1.1.8  christos             }
   2168   1.1.1.8  christos             break;
   2169   1.1.1.8  christos 
   2170   1.1.1.8  christos        case ACPI_PMTT_TYPE_DIMM:
   2171   1.1.1.8  christos             Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2172   1.1.1.8  christos                 Subtable->Length, AcpiDmTableInfoPmtt2);
   2173   1.1.1.8  christos             if (ACPI_FAILURE (Status))
   2174   1.1.1.8  christos             {
   2175   1.1.1.8  christos                 return;
   2176   1.1.1.8  christos             }
   2177   1.1.1.8  christos             break;
   2178       1.1  christos 
   2179   1.1.1.8  christos         case ACPI_PMTT_TYPE_VENDOR:
   2180   1.1.1.8  christos             Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2181   1.1.1.8  christos                 Subtable->Length, AcpiDmTableInfoPmttVendor);
   2182   1.1.1.8  christos             if (ACPI_FAILURE (Status))
   2183   1.1.1.8  christos             {
   2184   1.1.1.8  christos                 return;
   2185   1.1.1.8  christos             }
   2186   1.1.1.8  christos             break;
   2187       1.1  christos 
   2188   1.1.1.8  christos         default:
   2189   1.1.1.8  christos             AcpiOsPrintf (
   2190   1.1.1.8  christos                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   2191   1.1.1.8  christos                 Subtable->Type);
   2192   1.1.1.8  christos             return;
   2193       1.1  christos         }
   2194       1.1  christos 
   2195   1.1.1.8  christos         /* Point to next subtable */
   2196       1.1  christos 
   2197       1.1  christos         Offset += Subtable->Length;
   2198       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   2199       1.1  christos             Subtable, Subtable->Length);
   2200       1.1  christos     }
   2201       1.1  christos }
   2202       1.1  christos 
   2203       1.1  christos 
   2204       1.1  christos /*******************************************************************************
   2205       1.1  christos  *
   2206       1.1  christos  * FUNCTION:    AcpiDmDumpPptt
   2207       1.1  christos  *
   2208       1.1  christos  * PARAMETERS:  Table               - A PMTT table
   2209       1.1  christos  *
   2210       1.1  christos  * RETURN:      None
   2211       1.1  christos  *
   2212       1.1  christos  * DESCRIPTION: Format the contents of a PPTT. This table type consists
   2213       1.1  christos  *              of an open-ended number of subtables.
   2214       1.1  christos  *
   2215       1.1  christos  ******************************************************************************/
   2216       1.1  christos 
   2217       1.1  christos void
   2218       1.1  christos AcpiDmDumpPptt (
   2219       1.1  christos     ACPI_TABLE_HEADER       *Table)
   2220       1.1  christos {
   2221       1.1  christos     ACPI_STATUS             Status;
   2222       1.1  christos     ACPI_SUBTABLE_HEADER    *Subtable;
   2223       1.1  christos     ACPI_PPTT_PROCESSOR     *PpttProcessor;
   2224       1.1  christos     UINT8                   Length;
   2225       1.1  christos     UINT8                   SubtableOffset;
   2226       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
   2227       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2228       1.1  christos     UINT32                  i;
   2229       1.1  christos 
   2230       1.1  christos 
   2231       1.1  christos     /* There is no main table (other than the standard ACPI header) */
   2232       1.1  christos 
   2233       1.1  christos     /* Subtables */
   2234       1.1  christos 
   2235       1.1  christos     Offset = sizeof (ACPI_TABLE_HEADER);
   2236       1.1  christos     while (Offset < Table->Length)
   2237       1.1  christos     {
   2238       1.1  christos         AcpiOsPrintf ("\n");
   2239       1.1  christos 
   2240       1.1  christos         /* Common subtable header */
   2241       1.1  christos 
   2242       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   2243       1.1  christos         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
   2244       1.1  christos         {
   2245       1.1  christos             AcpiOsPrintf ("Invalid subtable length\n");
   2246       1.1  christos             return;
   2247       1.1  christos         }
   2248       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2249       1.1  christos             Subtable->Length, AcpiDmTableInfoPpttHdr);
   2250       1.1  christos         if (ACPI_FAILURE (Status))
   2251       1.1  christos         {
   2252       1.1  christos             return;
   2253       1.1  christos         }
   2254       1.1  christos 
   2255       1.1  christos         switch (Subtable->Type)
   2256       1.1  christos         {
   2257       1.1  christos         case ACPI_PPTT_TYPE_PROCESSOR:
   2258       1.1  christos 
   2259       1.1  christos             InfoTable = AcpiDmTableInfoPptt0;
   2260       1.1  christos             Length = sizeof (ACPI_PPTT_PROCESSOR);
   2261       1.1  christos             break;
   2262       1.1  christos 
   2263       1.1  christos         case ACPI_PPTT_TYPE_CACHE:
   2264       1.1  christos 
   2265       1.1  christos             InfoTable = AcpiDmTableInfoPptt1;
   2266       1.1  christos             Length = sizeof (ACPI_PPTT_CACHE);
   2267       1.1  christos             break;
   2268       1.1  christos 
   2269       1.1  christos         case ACPI_PPTT_TYPE_ID:
   2270       1.1  christos 
   2271       1.1  christos             InfoTable = AcpiDmTableInfoPptt2;
   2272       1.1  christos             Length = sizeof (ACPI_PPTT_ID);
   2273       1.1  christos             break;
   2274       1.1  christos 
   2275       1.1  christos         default:
   2276       1.1  christos 
   2277       1.1  christos             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
   2278       1.1  christos                 Subtable->Type);
   2279       1.1  christos 
   2280       1.1  christos             /* Attempt to continue */
   2281       1.1  christos 
   2282       1.1  christos             goto NextSubtable;
   2283       1.1  christos         }
   2284       1.1  christos 
   2285       1.1  christos         if (Subtable->Length < Length)
   2286       1.1  christos         {
   2287       1.1  christos             AcpiOsPrintf ("Invalid subtable length\n");
   2288       1.1  christos             return;
   2289       1.1  christos         }
   2290       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2291       1.1  christos             Subtable->Length, InfoTable);
   2292       1.1  christos         if (ACPI_FAILURE (Status))
   2293       1.1  christos         {
   2294       1.1  christos             return;
   2295       1.1  christos         }
   2296       1.1  christos         SubtableOffset = Length;
   2297       1.1  christos 
   2298       1.1  christos         switch (Subtable->Type)
   2299       1.1  christos         {
   2300       1.1  christos         case ACPI_PPTT_TYPE_PROCESSOR:
   2301       1.1  christos 
   2302       1.1  christos             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
   2303       1.1  christos 
   2304       1.1  christos             /* Dump SMBIOS handles */
   2305       1.1  christos 
   2306       1.1  christos             if ((UINT8)(Subtable->Length - SubtableOffset) <
   2307       1.1  christos                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
   2308       1.1  christos             {
   2309       1.1  christos                 AcpiOsPrintf ("Invalid private resource number\n");
   2310       1.1  christos                 return;
   2311       1.1  christos             }
   2312       1.1  christos             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
   2313       1.1  christos             {
   2314       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   2315       1.1  christos                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
   2316       1.1  christos                     4, AcpiDmTableInfoPptt0a);
   2317   1.1.1.5  christos                 if (ACPI_FAILURE (Status))
   2318   1.1.1.5  christos                 {
   2319   1.1.1.5  christos                     return;
   2320   1.1.1.5  christos                 }
   2321   1.1.1.5  christos 
   2322       1.1  christos                 SubtableOffset += 4;
   2323       1.1  christos             }
   2324       1.1  christos             break;
   2325       1.1  christos 
   2326   1.1.1.8  christos         case ACPI_PPTT_TYPE_CACHE:
   2327   1.1.1.8  christos 
   2328   1.1.1.8  christos             if (Table->Revision < 3)
   2329   1.1.1.8  christos             {
   2330   1.1.1.8  christos                 break;
   2331   1.1.1.8  christos             }
   2332   1.1.1.8  christos             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   2333   1.1.1.8  christos                 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
   2334   1.1.1.8  christos                 sizeof (ACPI_PPTT_CACHE_V1), AcpiDmTableInfoPptt1a);
   2335   1.1.1.8  christos             if (ACPI_FAILURE (Status))
   2336   1.1.1.8  christos             {
   2337   1.1.1.8  christos                 return;
   2338   1.1.1.8  christos             }
   2339   1.1.1.8  christos             break;
   2340   1.1.1.8  christos 
   2341       1.1  christos         default:
   2342       1.1  christos 
   2343       1.1  christos             break;
   2344       1.1  christos         }
   2345       1.1  christos 
   2346       1.1  christos NextSubtable:
   2347       1.1  christos         /* Point to next subtable */
   2348       1.1  christos 
   2349       1.1  christos         Offset += Subtable->Length;
   2350       1.1  christos     }
   2351       1.1  christos }
   2352       1.1  christos 
   2353       1.1  christos 
   2354       1.1  christos /*******************************************************************************
   2355       1.1  christos  *
   2356   1.1.1.9  christos  * FUNCTION:    AcpiDmDumpPrmt
   2357   1.1.1.9  christos  *
   2358   1.1.1.9  christos  * PARAMETERS:  Table               - A PRMT table
   2359   1.1.1.9  christos  *
   2360   1.1.1.9  christos  * RETURN:      None
   2361   1.1.1.9  christos  *
   2362   1.1.1.9  christos  * DESCRIPTION: Format the contents of a PRMT. This table type consists
   2363   1.1.1.9  christos  *              of an open-ended number of subtables.
   2364   1.1.1.9  christos  *
   2365   1.1.1.9  christos  ******************************************************************************/
   2366   1.1.1.9  christos 
   2367   1.1.1.9  christos void
   2368   1.1.1.9  christos AcpiDmDumpPrmt (
   2369   1.1.1.9  christos     ACPI_TABLE_HEADER       *Table)
   2370   1.1.1.9  christos {
   2371   1.1.1.9  christos     UINT32                  CurrentOffset = sizeof (ACPI_TABLE_HEADER);
   2372   1.1.1.9  christos     ACPI_TABLE_PRMT_HEADER  *PrmtHeader;
   2373   1.1.1.9  christos     ACPI_PRMT_MODULE_INFO   *PrmtModuleInfo;
   2374   1.1.1.9  christos     ACPI_PRMT_HANDLER_INFO  *PrmtHandlerInfo;
   2375   1.1.1.9  christos     ACPI_STATUS             Status;
   2376   1.1.1.9  christos     UINT32                  i, j;
   2377   1.1.1.9  christos 
   2378   1.1.1.9  christos 
   2379   1.1.1.9  christos     /* Main table header */
   2380   1.1.1.9  christos 
   2381   1.1.1.9  christos     PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
   2382   1.1.1.9  christos     Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
   2383   1.1.1.9  christos         sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
   2384   1.1.1.9  christos     if (ACPI_FAILURE (Status))
   2385   1.1.1.9  christos     {
   2386   1.1.1.9  christos         AcpiOsPrintf ("Invalid PRMT header\n");
   2387   1.1.1.9  christos         return;
   2388   1.1.1.9  christos     }
   2389   1.1.1.9  christos 
   2390   1.1.1.9  christos     CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER);
   2391   1.1.1.9  christos 
   2392   1.1.1.9  christos     /* PRM Module Information Structure array */
   2393   1.1.1.9  christos 
   2394   1.1.1.9  christos     for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
   2395   1.1.1.9  christos     {
   2396   1.1.1.9  christos         PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
   2397   1.1.1.9  christos         Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
   2398   1.1.1.9  christos             sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
   2399   1.1.1.9  christos 
   2400   1.1.1.9  christos         CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
   2401   1.1.1.9  christos 
   2402   1.1.1.9  christos         /* PRM handler information structure array */
   2403   1.1.1.9  christos 
   2404   1.1.1.9  christos         for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
   2405   1.1.1.9  christos         {
   2406   1.1.1.9  christos             PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
   2407   1.1.1.9  christos             Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
   2408   1.1.1.9  christos                 sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
   2409   1.1.1.9  christos 
   2410   1.1.1.9  christos             CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
   2411   1.1.1.9  christos         }
   2412   1.1.1.9  christos     }
   2413   1.1.1.9  christos }
   2414   1.1.1.9  christos 
   2415   1.1.1.9  christos 
   2416   1.1.1.9  christos /*******************************************************************************
   2417   1.1.1.9  christos  *
   2418   1.1.1.9  christos  * FUNCTION:    AcpiDmDumpRgrt
   2419   1.1.1.9  christos  *
   2420   1.1.1.9  christos  * PARAMETERS:  Table               - A RGRT table
   2421   1.1.1.9  christos  *
   2422   1.1.1.9  christos  * RETURN:      None
   2423   1.1.1.9  christos  *
   2424   1.1.1.9  christos  * DESCRIPTION: Format the contents of a RGRT
   2425   1.1.1.9  christos  *
   2426   1.1.1.9  christos  ******************************************************************************/
   2427   1.1.1.9  christos 
   2428   1.1.1.9  christos void
   2429   1.1.1.9  christos AcpiDmDumpRgrt (
   2430   1.1.1.9  christos     ACPI_TABLE_HEADER       *Table)
   2431   1.1.1.9  christos {
   2432   1.1.1.9  christos     ACPI_STATUS             Status;
   2433   1.1.1.9  christos     ACPI_TABLE_RGRT         *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table);
   2434   1.1.1.9  christos     UINT32                  Offset = sizeof (ACPI_TABLE_RGRT);
   2435   1.1.1.9  christos 
   2436   1.1.1.9  christos 
   2437   1.1.1.9  christos     /* Main table */
   2438   1.1.1.9  christos 
   2439   1.1.1.9  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt);
   2440   1.1.1.9  christos     if (ACPI_FAILURE (Status))
   2441   1.1.1.9  christos     {
   2442   1.1.1.9  christos         return;
   2443   1.1.1.9  christos     }
   2444   1.1.1.9  christos 
   2445   1.1.1.9  christos     /* Dump the binary image as a subtable */
   2446   1.1.1.9  christos 
   2447   1.1.1.9  christos     Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image,
   2448   1.1.1.9  christos         Table->Length - Offset, AcpiDmTableInfoRgrt0);
   2449   1.1.1.9  christos     if (ACPI_FAILURE (Status))
   2450   1.1.1.9  christos     {
   2451   1.1.1.9  christos         return;
   2452   1.1.1.9  christos     }
   2453   1.1.1.9  christos }
   2454   1.1.1.9  christos 
   2455   1.1.1.9  christos 
   2456   1.1.1.9  christos /*******************************************************************************
   2457   1.1.1.9  christos  *
   2458       1.1  christos  * FUNCTION:    AcpiDmDumpS3pt
   2459       1.1  christos  *
   2460       1.1  christos  * PARAMETERS:  Table               - A S3PT table
   2461       1.1  christos  *
   2462       1.1  christos  * RETURN:      Length of the table
   2463       1.1  christos  *
   2464       1.1  christos  * DESCRIPTION: Format the contents of a S3PT
   2465       1.1  christos  *
   2466       1.1  christos  ******************************************************************************/
   2467       1.1  christos 
   2468       1.1  christos UINT32
   2469       1.1  christos AcpiDmDumpS3pt (
   2470       1.1  christos     ACPI_TABLE_HEADER       *Tables)
   2471       1.1  christos {
   2472       1.1  christos     ACPI_STATUS             Status;
   2473       1.1  christos     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
   2474       1.1  christos     ACPI_FPDT_HEADER        *Subtable;
   2475       1.1  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2476       1.1  christos     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
   2477       1.1  christos 
   2478       1.1  christos 
   2479       1.1  christos     /* Main table */
   2480       1.1  christos 
   2481       1.1  christos     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
   2482       1.1  christos     if (ACPI_FAILURE (Status))
   2483       1.1  christos     {
   2484       1.1  christos         return 0;
   2485       1.1  christos     }
   2486       1.1  christos 
   2487       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
   2488       1.1  christos     while (Offset < S3ptTable->Length)
   2489       1.1  christos     {
   2490       1.1  christos         /* Common subtable header */
   2491       1.1  christos 
   2492       1.1  christos         AcpiOsPrintf ("\n");
   2493       1.1  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
   2494       1.1  christos             Subtable->Length, AcpiDmTableInfoS3ptHdr);
   2495       1.1  christos         if (ACPI_FAILURE (Status))
   2496       1.1  christos         {
   2497       1.1  christos             return 0;
   2498       1.1  christos         }
   2499       1.1  christos 
   2500       1.1  christos         switch (Subtable->Type)
   2501       1.1  christos         {
   2502       1.1  christos         case ACPI_S3PT_TYPE_RESUME:
   2503       1.1  christos 
   2504       1.1  christos             InfoTable = AcpiDmTableInfoS3pt0;
   2505       1.1  christos             break;
   2506       1.1  christos 
   2507       1.1  christos         case ACPI_S3PT_TYPE_SUSPEND:
   2508       1.1  christos 
   2509       1.1  christos             InfoTable = AcpiDmTableInfoS3pt1;
   2510       1.1  christos             break;
   2511       1.1  christos 
   2512       1.1  christos         default:
   2513       1.1  christos 
   2514       1.1  christos             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
   2515       1.1  christos                 Subtable->Type);
   2516       1.1  christos 
   2517       1.1  christos             /* Attempt to continue */
   2518       1.1  christos 
   2519       1.1  christos             if (!Subtable->Length)
   2520       1.1  christos             {
   2521       1.1  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   2522       1.1  christos                 return 0;
   2523       1.1  christos             }
   2524       1.1  christos             goto NextSubtable;
   2525       1.1  christos         }
   2526       1.1  christos 
   2527       1.1  christos         AcpiOsPrintf ("\n");
   2528       1.1  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
   2529       1.1  christos             Subtable->Length, InfoTable);
   2530       1.1  christos         if (ACPI_FAILURE (Status))
   2531       1.1  christos         {
   2532       1.1  christos             return 0;
   2533       1.1  christos         }
   2534       1.1  christos 
   2535       1.1  christos NextSubtable:
   2536       1.1  christos         /* Point to next subtable */
   2537       1.1  christos 
   2538       1.1  christos         Offset += Subtable->Length;
   2539       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
   2540       1.1  christos     }
   2541       1.1  christos 
   2542       1.1  christos     return (S3ptTable->Length);
   2543       1.1  christos }
   2544       1.1  christos 
   2545       1.1  christos 
   2546       1.1  christos /*******************************************************************************
   2547       1.1  christos  *
   2548       1.1  christos  * FUNCTION:    AcpiDmDumpSdev
   2549       1.1  christos  *
   2550       1.1  christos  * PARAMETERS:  Table               - A SDEV table
   2551       1.1  christos  *
   2552       1.1  christos  * RETURN:      None
   2553       1.1  christos  *
   2554       1.1  christos  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
   2555       1.1  christos  *              table that contains variable strings and vendor data.
   2556       1.1  christos  *
   2557       1.1  christos  ******************************************************************************/
   2558       1.1  christos 
   2559       1.1  christos void
   2560       1.1  christos AcpiDmDumpSdev (
   2561       1.1  christos     ACPI_TABLE_HEADER       *Table)
   2562       1.1  christos {
   2563   1.1.1.8  christos     ACPI_STATUS                 Status;
   2564   1.1.1.8  christos     ACPI_SDEV_HEADER            *Subtable;
   2565   1.1.1.8  christos     ACPI_SDEV_PCIE              *Pcie;
   2566   1.1.1.8  christos     ACPI_SDEV_NAMESPACE         *Namesp;
   2567   1.1.1.8  christos     ACPI_DMTABLE_INFO           *InfoTable;
   2568   1.1.1.8  christos     ACPI_DMTABLE_INFO           *SecureComponentInfoTable;
   2569   1.1.1.8  christos     UINT32                      Length = Table->Length;
   2570   1.1.1.8  christos     UINT32                      Offset = sizeof (ACPI_TABLE_SDEV);
   2571   1.1.1.8  christos     UINT16                      PathOffset;
   2572   1.1.1.8  christos     UINT16                      PathLength;
   2573   1.1.1.8  christos     UINT16                      VendorDataOffset;
   2574   1.1.1.8  christos     UINT16                      VendorDataLength;
   2575   1.1.1.8  christos     ACPI_SDEV_SECURE_COMPONENT  *SecureComponent = NULL;
   2576   1.1.1.8  christos     UINT32                      CurrentOffset = 0;
   2577       1.1  christos 
   2578       1.1  christos 
   2579       1.1  christos     /* Main table */
   2580       1.1  christos 
   2581       1.1  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
   2582       1.1  christos     if (ACPI_FAILURE (Status))
   2583       1.1  christos     {
   2584       1.1  christos         return;
   2585       1.1  christos     }
   2586       1.1  christos 
   2587       1.1  christos     /* Subtables */
   2588       1.1  christos 
   2589       1.1  christos     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
   2590       1.1  christos     while (Offset < Table->Length)
   2591       1.1  christos     {
   2592       1.1  christos         /* Common subtable header */
   2593       1.1  christos 
   2594       1.1  christos         AcpiOsPrintf ("\n");
   2595       1.1  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2596       1.1  christos             Subtable->Length, AcpiDmTableInfoSdevHdr);
   2597       1.1  christos         if (ACPI_FAILURE (Status))
   2598       1.1  christos         {
   2599       1.1  christos             return;
   2600       1.1  christos         }
   2601       1.1  christos 
   2602       1.1  christos         switch (Subtable->Type)
   2603       1.1  christos         {
   2604       1.1  christos         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
   2605       1.1  christos 
   2606       1.1  christos             InfoTable = AcpiDmTableInfoSdev0;
   2607       1.1  christos             break;
   2608       1.1  christos 
   2609       1.1  christos         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
   2610       1.1  christos 
   2611       1.1  christos             InfoTable = AcpiDmTableInfoSdev1;
   2612       1.1  christos             break;
   2613       1.1  christos 
   2614       1.1  christos         default:
   2615       1.1  christos             goto NextSubtable;
   2616       1.1  christos         }
   2617       1.1  christos 
   2618       1.1  christos         AcpiOsPrintf ("\n");
   2619   1.1.1.8  christos         Status = AcpiDmDumpTable (Table->Length, 0, Subtable,
   2620       1.1  christos             Subtable->Length, InfoTable);
   2621       1.1  christos         if (ACPI_FAILURE (Status))
   2622       1.1  christos         {
   2623       1.1  christos             return;
   2624       1.1  christos         }
   2625       1.1  christos 
   2626       1.1  christos         switch (Subtable->Type)
   2627       1.1  christos         {
   2628       1.1  christos         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
   2629       1.1  christos 
   2630   1.1.1.8  christos             CurrentOffset = sizeof (ACPI_SDEV_NAMESPACE);
   2631   1.1.1.8  christos             if (Subtable->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
   2632   1.1.1.8  christos             {
   2633   1.1.1.8  christos                 SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
   2634   1.1.1.8  christos                     ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)));
   2635   1.1.1.8  christos 
   2636   1.1.1.8  christos                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
   2637   1.1.1.8  christos                     ACPI_ADD_PTR(UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)),
   2638   1.1.1.8  christos                     sizeof (ACPI_SDEV_SECURE_COMPONENT), AcpiDmTableInfoSdev0b);
   2639   1.1.1.8  christos                 if (ACPI_FAILURE (Status))
   2640   1.1.1.8  christos                 {
   2641   1.1.1.8  christos                     return;
   2642   1.1.1.8  christos                 }
   2643   1.1.1.8  christos                 CurrentOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
   2644   1.1.1.8  christos 
   2645   1.1.1.8  christos                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
   2646   1.1.1.8  christos                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
   2647   1.1.1.8  christos                     sizeof (ACPI_SDEV_HEADER), AcpiDmTableInfoSdevSecCompHdr);
   2648   1.1.1.8  christos                 if (ACPI_FAILURE (Status))
   2649   1.1.1.8  christos                 {
   2650   1.1.1.8  christos                     return;
   2651   1.1.1.8  christos                 }
   2652   1.1.1.8  christos                 CurrentOffset += sizeof (ACPI_SDEV_HEADER);
   2653   1.1.1.8  christos 
   2654   1.1.1.8  christos                 switch (Subtable->Type)
   2655   1.1.1.8  christos                 {
   2656   1.1.1.8  christos                 case ACPI_SDEV_TYPE_ID_COMPONENT:
   2657   1.1.1.8  christos 
   2658   1.1.1.8  christos                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
   2659   1.1.1.8  christos                     break;
   2660   1.1.1.8  christos 
   2661   1.1.1.8  christos                 case ACPI_SDEV_TYPE_MEM_COMPONENT:
   2662   1.1.1.8  christos 
   2663   1.1.1.8  christos                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
   2664   1.1.1.8  christos                     break;
   2665   1.1.1.8  christos 
   2666   1.1.1.8  christos                 default:
   2667   1.1.1.8  christos                     goto NextSubtable;
   2668   1.1.1.8  christos                 }
   2669   1.1.1.8  christos 
   2670   1.1.1.8  christos                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
   2671   1.1.1.8  christos                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
   2672   1.1.1.8  christos                     SecureComponent->SecureComponentLength, SecureComponentInfoTable);
   2673   1.1.1.8  christos                 CurrentOffset += SecureComponent->SecureComponentLength;
   2674   1.1.1.8  christos             }
   2675   1.1.1.8  christos 
   2676       1.1  christos             /* Dump the PCIe device ID(s) */
   2677       1.1  christos 
   2678       1.1  christos             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
   2679       1.1  christos             PathOffset = Namesp->DeviceIdOffset;
   2680       1.1  christos             PathLength = Namesp->DeviceIdLength;
   2681       1.1  christos 
   2682       1.1  christos             if (PathLength)
   2683       1.1  christos             {
   2684   1.1.1.8  christos                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
   2685       1.1  christos                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
   2686       1.1  christos                     PathLength, AcpiDmTableInfoSdev0a);
   2687       1.1  christos                 if (ACPI_FAILURE (Status))
   2688       1.1  christos                 {
   2689       1.1  christos                     return;
   2690       1.1  christos                 }
   2691   1.1.1.8  christos                 CurrentOffset += PathLength;
   2692       1.1  christos             }
   2693       1.1  christos 
   2694       1.1  christos             /* Dump the vendor-specific data */
   2695       1.1  christos 
   2696       1.1  christos             VendorDataLength =
   2697       1.1  christos                 Namesp->VendorDataLength;
   2698       1.1  christos             VendorDataOffset =
   2699       1.1  christos                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
   2700       1.1  christos 
   2701       1.1  christos             if (VendorDataLength)
   2702       1.1  christos             {
   2703       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   2704       1.1  christos                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
   2705       1.1  christos                     VendorDataLength, AcpiDmTableInfoSdev1b);
   2706       1.1  christos                 if (ACPI_FAILURE (Status))
   2707       1.1  christos                 {
   2708       1.1  christos                     return;
   2709       1.1  christos                 }
   2710       1.1  christos             }
   2711       1.1  christos             break;
   2712       1.1  christos 
   2713       1.1  christos         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
   2714       1.1  christos 
   2715       1.1  christos             /* PCI path substructures */
   2716       1.1  christos 
   2717       1.1  christos             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
   2718       1.1  christos             PathOffset = Pcie->PathOffset;
   2719       1.1  christos             PathLength = Pcie->PathLength;
   2720       1.1  christos 
   2721       1.1  christos             while (PathLength)
   2722       1.1  christos             {
   2723       1.1  christos                 Status = AcpiDmDumpTable (Table->Length,
   2724       1.1  christos                     PathOffset + Offset,
   2725       1.1  christos                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
   2726       1.1  christos                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
   2727       1.1  christos                 if (ACPI_FAILURE (Status))
   2728       1.1  christos                 {
   2729       1.1  christos                     return;
   2730       1.1  christos                 }
   2731       1.1  christos 
   2732       1.1  christos                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
   2733       1.1  christos                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
   2734       1.1  christos             }
   2735       1.1  christos 
   2736       1.1  christos             /* VendorData */
   2737       1.1  christos 
   2738       1.1  christos             VendorDataLength = Pcie->VendorDataLength;
   2739       1.1  christos             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
   2740       1.1  christos 
   2741       1.1  christos             if (VendorDataLength)
   2742       1.1  christos             {
   2743       1.1  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   2744       1.1  christos                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
   2745       1.1  christos                     VendorDataLength, AcpiDmTableInfoSdev1b);
   2746   1.1.1.5  christos                 if (ACPI_FAILURE (Status))
   2747   1.1.1.5  christos                 {
   2748   1.1.1.5  christos                     return;
   2749   1.1.1.5  christos                 }
   2750       1.1  christos             }
   2751       1.1  christos             break;
   2752       1.1  christos 
   2753       1.1  christos         default:
   2754       1.1  christos             goto NextSubtable;
   2755       1.1  christos         }
   2756       1.1  christos 
   2757       1.1  christos NextSubtable:
   2758       1.1  christos         /* Point to next subtable */
   2759       1.1  christos 
   2760       1.1  christos         Offset += Subtable->Length;
   2761       1.1  christos         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
   2762       1.1  christos             Subtable->Length);
   2763       1.1  christos     }
   2764       1.1  christos }
   2765