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