Home | History | Annotate | Line # | Download | only in common
dmtbdump.c revision 1.9
      1  1.1    jruoho /******************************************************************************
      2  1.1    jruoho  *
      3  1.1    jruoho  * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
      4  1.1    jruoho  *
      5  1.1    jruoho  *****************************************************************************/
      6  1.1    jruoho 
      7  1.2  christos /*
      8  1.7  christos  * Copyright (C) 2000 - 2017, Intel Corp.
      9  1.1    jruoho  * All rights reserved.
     10  1.1    jruoho  *
     11  1.2  christos  * Redistribution and use in source and binary forms, with or without
     12  1.2  christos  * modification, are permitted provided that the following conditions
     13  1.2  christos  * are met:
     14  1.2  christos  * 1. Redistributions of source code must retain the above copyright
     15  1.2  christos  *    notice, this list of conditions, and the following disclaimer,
     16  1.2  christos  *    without modification.
     17  1.2  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.2  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.2  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.2  christos  *    including a substantially similar Disclaimer requirement for further
     21  1.2  christos  *    binary redistribution.
     22  1.2  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.2  christos  *    of any contributors may be used to endorse or promote products derived
     24  1.2  christos  *    from this software without specific prior written permission.
     25  1.2  christos  *
     26  1.2  christos  * Alternatively, this software may be distributed under the terms of the
     27  1.2  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.2  christos  * Software Foundation.
     29  1.2  christos  *
     30  1.2  christos  * NO WARRANTY
     31  1.2  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.2  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.2  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.2  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.2  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.2  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.2  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.2  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.2  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.2  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.2  christos  * POSSIBILITY OF SUCH DAMAGES.
     42  1.2  christos  */
     43  1.1    jruoho 
     44  1.1    jruoho #include "acpi.h"
     45  1.1    jruoho #include "accommon.h"
     46  1.1    jruoho #include "acdisasm.h"
     47  1.1    jruoho #include "actables.h"
     48  1.1    jruoho 
     49  1.1    jruoho /* This module used for application-level code only */
     50  1.1    jruoho 
     51  1.1    jruoho #define _COMPONENT          ACPI_CA_DISASSEMBLER
     52  1.1    jruoho         ACPI_MODULE_NAME    ("dmtbdump")
     53  1.1    jruoho 
     54  1.1    jruoho 
     55  1.7  christos /* Local prototypes */
     56  1.2  christos 
     57  1.7  christos static void
     58  1.7  christos AcpiDmValidateFadtLength (
     59  1.7  christos     UINT32                  Revision,
     60  1.7  christos     UINT32                  Length);
     61  1.2  christos 
     62  1.2  christos 
     63  1.2  christos /*******************************************************************************
     64  1.2  christos  *
     65  1.2  christos  * FUNCTION:    AcpiDmDumpBuffer
     66  1.2  christos  *
     67  1.2  christos  * PARAMETERS:  Table               - ACPI Table or subtable
     68  1.2  christos  *              BufferOffset        - Offset of buffer from Table above
     69  1.2  christos  *              Length              - Length of the buffer
     70  1.2  christos  *              AbsoluteOffset      - Offset of buffer in the main ACPI table
     71  1.2  christos  *              Header              - Name of the buffer field (printed on the
     72  1.2  christos  *                                    first line only.)
     73  1.2  christos  *
     74  1.2  christos  * RETURN:      None
     75  1.2  christos  *
     76  1.2  christos  * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
     77  1.2  christos  *              disassembler output format.)
     78  1.2  christos  *
     79  1.2  christos  ******************************************************************************/
     80  1.2  christos 
     81  1.2  christos void
     82  1.2  christos AcpiDmDumpBuffer (
     83  1.2  christos     void                    *Table,
     84  1.2  christos     UINT32                  BufferOffset,
     85  1.2  christos     UINT32                  Length,
     86  1.2  christos     UINT32                  AbsoluteOffset,
     87  1.3  christos     char                    *Header)
     88  1.2  christos {
     89  1.2  christos     UINT8                   *Buffer;
     90  1.2  christos     UINT32                  i;
     91  1.2  christos 
     92  1.2  christos 
     93  1.2  christos     if (!Length)
     94  1.2  christos     {
     95  1.2  christos         return;
     96  1.2  christos     }
     97  1.2  christos 
     98  1.2  christos     Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
     99  1.2  christos     i = 0;
    100  1.2  christos 
    101  1.2  christos     while (i < Length)
    102  1.2  christos     {
    103  1.2  christos         if (!(i % 16))
    104  1.2  christos         {
    105  1.3  christos             /* Insert a backslash - line continuation character */
    106  1.3  christos 
    107  1.3  christos             if (Length > 16)
    108  1.2  christos             {
    109  1.2  christos                 AcpiOsPrintf ("\\\n    ");
    110  1.2  christos             }
    111  1.2  christos         }
    112  1.2  christos 
    113  1.2  christos         AcpiOsPrintf ("%.02X ", *Buffer);
    114  1.2  christos         i++;
    115  1.2  christos         Buffer++;
    116  1.2  christos         AbsoluteOffset++;
    117  1.2  christos     }
    118  1.2  christos 
    119  1.2  christos     AcpiOsPrintf ("\n");
    120  1.2  christos }
    121  1.2  christos 
    122  1.2  christos 
    123  1.1    jruoho /*******************************************************************************
    124  1.1    jruoho  *
    125  1.3  christos  * FUNCTION:    AcpiDmDumpUnicode
    126  1.3  christos  *
    127  1.3  christos  * PARAMETERS:  Table               - ACPI Table or subtable
    128  1.3  christos  *              BufferOffset        - Offset of buffer from Table above
    129  1.3  christos  *              ByteLength          - Length of the buffer
    130  1.3  christos  *
    131  1.3  christos  * RETURN:      None
    132  1.3  christos  *
    133  1.3  christos  * DESCRIPTION: Validate and dump the contents of a buffer that contains
    134  1.3  christos  *              unicode data. The output is a standard ASCII string. If it
    135  1.3  christos  *              appears that the data is not unicode, the buffer is dumped
    136  1.3  christos  *              as hex characters.
    137  1.3  christos  *
    138  1.3  christos  ******************************************************************************/
    139  1.3  christos 
    140  1.3  christos void
    141  1.3  christos AcpiDmDumpUnicode (
    142  1.3  christos     void                    *Table,
    143  1.3  christos     UINT32                  BufferOffset,
    144  1.3  christos     UINT32                  ByteLength)
    145  1.3  christos {
    146  1.3  christos     UINT8                   *Buffer;
    147  1.3  christos     UINT32                  Length;
    148  1.3  christos     UINT32                  i;
    149  1.3  christos 
    150  1.3  christos 
    151  1.3  christos     Buffer = ((UINT8 *) Table) + BufferOffset;
    152  1.3  christos     Length = ByteLength - 2; /* Last two bytes are the null terminator */
    153  1.3  christos 
    154  1.3  christos     /* Ensure all low bytes are entirely printable ASCII */
    155  1.3  christos 
    156  1.3  christos     for (i = 0; i < Length; i += 2)
    157  1.3  christos     {
    158  1.3  christos         if (!isprint (Buffer[i]))
    159  1.3  christos         {
    160  1.3  christos             goto DumpRawBuffer;
    161  1.3  christos         }
    162  1.3  christos     }
    163  1.3  christos 
    164  1.3  christos     /* Ensure all high bytes are zero */
    165  1.3  christos 
    166  1.3  christos     for (i = 1; i < Length; i += 2)
    167  1.3  christos     {
    168  1.3  christos         if (Buffer[i])
    169  1.3  christos         {
    170  1.3  christos             goto DumpRawBuffer;
    171  1.3  christos         }
    172  1.3  christos     }
    173  1.3  christos 
    174  1.3  christos     /* Dump the buffer as a normal string */
    175  1.3  christos 
    176  1.3  christos     AcpiOsPrintf ("\"");
    177  1.3  christos     for (i = 0; i < Length; i += 2)
    178  1.3  christos     {
    179  1.3  christos         AcpiOsPrintf ("%c", Buffer[i]);
    180  1.3  christos     }
    181  1.4  christos 
    182  1.3  christos     AcpiOsPrintf ("\"\n");
    183  1.3  christos     return;
    184  1.3  christos 
    185  1.3  christos DumpRawBuffer:
    186  1.3  christos     AcpiDmDumpBuffer (Table, BufferOffset, ByteLength,
    187  1.3  christos         BufferOffset, NULL);
    188  1.3  christos     AcpiOsPrintf ("\n");
    189  1.3  christos }
    190  1.3  christos 
    191  1.3  christos 
    192  1.3  christos /*******************************************************************************
    193  1.3  christos  *
    194  1.1    jruoho  * FUNCTION:    AcpiDmDumpRsdp
    195  1.1    jruoho  *
    196  1.1    jruoho  * PARAMETERS:  Table               - A RSDP
    197  1.1    jruoho  *
    198  1.2  christos  * RETURN:      Length of the table (there is not always a length field,
    199  1.2  christos  *              use revision or length if available (ACPI 2.0+))
    200  1.1    jruoho  *
    201  1.1    jruoho  * DESCRIPTION: Format the contents of a RSDP
    202  1.1    jruoho  *
    203  1.1    jruoho  ******************************************************************************/
    204  1.1    jruoho 
    205  1.1    jruoho UINT32
    206  1.1    jruoho AcpiDmDumpRsdp (
    207  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    208  1.1    jruoho {
    209  1.2  christos     ACPI_TABLE_RSDP         *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
    210  1.2  christos     UINT32                  Length = sizeof (ACPI_RSDP_COMMON);
    211  1.2  christos     UINT8                   Checksum;
    212  1.3  christos     ACPI_STATUS             Status;
    213  1.1    jruoho 
    214  1.1    jruoho 
    215  1.1    jruoho     /* Dump the common ACPI 1.0 portion */
    216  1.1    jruoho 
    217  1.3  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
    218  1.3  christos     if (ACPI_FAILURE (Status))
    219  1.3  christos     {
    220  1.3  christos         return (Length);
    221  1.3  christos     }
    222  1.1    jruoho 
    223  1.2  christos     /* Validate the first checksum */
    224  1.2  christos 
    225  1.2  christos     Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
    226  1.4  christos         Rsdp->Checksum);
    227  1.2  christos     if (Checksum != Rsdp->Checksum)
    228  1.2  christos     {
    229  1.2  christos         AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
    230  1.2  christos             Checksum);
    231  1.2  christos     }
    232  1.2  christos 
    233  1.2  christos     /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
    234  1.1    jruoho 
    235  1.2  christos     if (Rsdp->Revision > 0)
    236  1.1    jruoho     {
    237  1.2  christos         Length = Rsdp->Length;
    238  1.3  christos         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
    239  1.3  christos         if (ACPI_FAILURE (Status))
    240  1.3  christos         {
    241  1.3  christos             return (Length);
    242  1.3  christos         }
    243  1.2  christos 
    244  1.2  christos         /* Validate the extended checksum over entire RSDP */
    245  1.2  christos 
    246  1.2  christos         Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
    247  1.4  christos             Rsdp->ExtendedChecksum);
    248  1.2  christos         if (Checksum != Rsdp->ExtendedChecksum)
    249  1.2  christos         {
    250  1.2  christos             AcpiOsPrintf (
    251  1.2  christos                 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
    252  1.2  christos                 Checksum);
    253  1.2  christos         }
    254  1.1    jruoho     }
    255  1.1    jruoho 
    256  1.1    jruoho     return (Length);
    257  1.1    jruoho }
    258  1.1    jruoho 
    259  1.1    jruoho 
    260  1.1    jruoho /*******************************************************************************
    261  1.1    jruoho  *
    262  1.1    jruoho  * FUNCTION:    AcpiDmDumpRsdt
    263  1.1    jruoho  *
    264  1.1    jruoho  * PARAMETERS:  Table               - A RSDT
    265  1.1    jruoho  *
    266  1.1    jruoho  * RETURN:      None
    267  1.1    jruoho  *
    268  1.1    jruoho  * DESCRIPTION: Format the contents of a RSDT
    269  1.1    jruoho  *
    270  1.1    jruoho  ******************************************************************************/
    271  1.1    jruoho 
    272  1.1    jruoho void
    273  1.1    jruoho AcpiDmDumpRsdt (
    274  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    275  1.1    jruoho {
    276  1.1    jruoho     UINT32                  *Array;
    277  1.1    jruoho     UINT32                  Entries;
    278  1.1    jruoho     UINT32                  Offset;
    279  1.1    jruoho     UINT32                  i;
    280  1.1    jruoho 
    281  1.1    jruoho 
    282  1.1    jruoho     /* Point to start of table pointer array */
    283  1.1    jruoho 
    284  1.1    jruoho     Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
    285  1.1    jruoho     Offset = sizeof (ACPI_TABLE_HEADER);
    286  1.1    jruoho 
    287  1.1    jruoho     /* RSDT uses 32-bit pointers */
    288  1.1    jruoho 
    289  1.1    jruoho     Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
    290  1.1    jruoho 
    291  1.1    jruoho     for (i = 0; i < Entries; i++)
    292  1.1    jruoho     {
    293  1.1    jruoho         AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
    294  1.1    jruoho         AcpiOsPrintf ("%8.8X\n", Array[i]);
    295  1.1    jruoho         Offset += sizeof (UINT32);
    296  1.1    jruoho     }
    297  1.1    jruoho }
    298  1.1    jruoho 
    299  1.1    jruoho 
    300  1.1    jruoho /*******************************************************************************
    301  1.1    jruoho  *
    302  1.1    jruoho  * FUNCTION:    AcpiDmDumpXsdt
    303  1.1    jruoho  *
    304  1.1    jruoho  * PARAMETERS:  Table               - A XSDT
    305  1.1    jruoho  *
    306  1.1    jruoho  * RETURN:      None
    307  1.1    jruoho  *
    308  1.1    jruoho  * DESCRIPTION: Format the contents of a XSDT
    309  1.1    jruoho  *
    310  1.1    jruoho  ******************************************************************************/
    311  1.1    jruoho 
    312  1.1    jruoho void
    313  1.1    jruoho AcpiDmDumpXsdt (
    314  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    315  1.1    jruoho {
    316  1.1    jruoho     UINT64                  *Array;
    317  1.1    jruoho     UINT32                  Entries;
    318  1.1    jruoho     UINT32                  Offset;
    319  1.1    jruoho     UINT32                  i;
    320  1.1    jruoho 
    321  1.1    jruoho 
    322  1.1    jruoho     /* Point to start of table pointer array */
    323  1.1    jruoho 
    324  1.1    jruoho     Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
    325  1.1    jruoho     Offset = sizeof (ACPI_TABLE_HEADER);
    326  1.1    jruoho 
    327  1.1    jruoho     /* XSDT uses 64-bit pointers */
    328  1.1    jruoho 
    329  1.1    jruoho     Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
    330  1.1    jruoho 
    331  1.1    jruoho     for (i = 0; i < Entries; i++)
    332  1.1    jruoho     {
    333  1.1    jruoho         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
    334  1.1    jruoho         AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
    335  1.1    jruoho         Offset += sizeof (UINT64);
    336  1.1    jruoho     }
    337  1.1    jruoho }
    338  1.1    jruoho 
    339  1.1    jruoho 
    340  1.1    jruoho /*******************************************************************************
    341  1.1    jruoho  *
    342  1.1    jruoho  * FUNCTION:    AcpiDmDumpFadt
    343  1.1    jruoho  *
    344  1.1    jruoho  * PARAMETERS:  Table               - A FADT
    345  1.1    jruoho  *
    346  1.1    jruoho  * RETURN:      None
    347  1.1    jruoho  *
    348  1.1    jruoho  * DESCRIPTION: Format the contents of a FADT
    349  1.1    jruoho  *
    350  1.2  christos  * NOTE:        We cannot depend on the FADT version to indicate the actual
    351  1.2  christos  *              contents of the FADT because of BIOS bugs. The table length
    352  1.2  christos  *              is the only reliable indicator.
    353  1.2  christos  *
    354  1.1    jruoho  ******************************************************************************/
    355  1.1    jruoho 
    356  1.1    jruoho void
    357  1.1    jruoho AcpiDmDumpFadt (
    358  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    359  1.1    jruoho {
    360  1.3  christos     ACPI_STATUS             Status;
    361  1.6  christos 
    362  1.3  christos 
    363  1.7  christos     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
    364  1.1    jruoho 
    365  1.7  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    366  1.7  christos         AcpiDmTableInfoFadt1);
    367  1.7  christos     if (ACPI_FAILURE (Status))
    368  1.3  christos     {
    369  1.3  christos         return;
    370  1.3  christos     }
    371  1.1    jruoho 
    372  1.7  christos     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
    373  1.7  christos 
    374  1.7  christos     if ((Table->Length > ACPI_FADT_V1_SIZE) &&
    375  1.7  christos         (Table->Length <= ACPI_FADT_V2_SIZE))
    376  1.6  christos     {
    377  1.7  christos         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    378  1.7  christos             AcpiDmTableInfoFadt2);
    379  1.7  christos         if (ACPI_FAILURE (Status))
    380  1.3  christos         {
    381  1.7  christos             return;
    382  1.3  christos         }
    383  1.1    jruoho     }
    384  1.1    jruoho 
    385  1.7  christos     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
    386  1.7  christos 
    387  1.7  christos     else if (Table->Length > ACPI_FADT_V2_SIZE)
    388  1.1    jruoho     {
    389  1.7  christos         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    390  1.7  christos             AcpiDmTableInfoFadt3);
    391  1.7  christos         if (ACPI_FAILURE (Status))
    392  1.3  christos         {
    393  1.7  christos             return;
    394  1.3  christos         }
    395  1.2  christos 
    396  1.7  christos         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
    397  1.2  christos 
    398  1.7  christos         if (Table->Length > ACPI_FADT_V3_SIZE)
    399  1.2  christos         {
    400  1.7  christos             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    401  1.7  christos                 AcpiDmTableInfoFadt5);
    402  1.7  christos             if (ACPI_FAILURE (Status))
    403  1.7  christos             {
    404  1.7  christos                 return;
    405  1.7  christos             }
    406  1.3  christos         }
    407  1.3  christos 
    408  1.7  christos         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
    409  1.7  christos 
    410  1.7  christos         if (Table->Length > ACPI_FADT_V3_SIZE)
    411  1.3  christos         {
    412  1.7  christos             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    413  1.7  christos                 AcpiDmTableInfoFadt6);
    414  1.7  christos             if (ACPI_FAILURE (Status))
    415  1.7  christos             {
    416  1.7  christos                 return;
    417  1.7  christos             }
    418  1.2  christos         }
    419  1.1    jruoho     }
    420  1.1    jruoho 
    421  1.7  christos     /* Validate various fields in the FADT, including length */
    422  1.1    jruoho 
    423  1.1    jruoho     AcpiTbCreateLocalFadt (Table, Table->Length);
    424  1.7  christos 
    425  1.7  christos     /* Validate FADT length against the revision */
    426  1.7  christos 
    427  1.7  christos     AcpiDmValidateFadtLength (Table->Revision, Table->Length);
    428  1.7  christos }
    429  1.7  christos 
    430  1.7  christos 
    431  1.7  christos /*******************************************************************************
    432  1.7  christos  *
    433  1.7  christos  * FUNCTION:    AcpiDmValidateFadtLength
    434  1.7  christos  *
    435  1.7  christos  * PARAMETERS:  Revision            - FADT revision (Header->Revision)
    436  1.7  christos  *              Length              - FADT length (Header->Length
    437  1.7  christos  *
    438  1.7  christos  * RETURN:      None
    439  1.7  christos  *
    440  1.7  christos  * DESCRIPTION: Check the FADT revision against the expected table length for
    441  1.7  christos  *              that revision. Issue a warning if the length is not what was
    442  1.7  christos  *              expected. This seems to be such a common BIOS bug that the
    443  1.7  christos  *              FADT revision has been rendered virtually meaningless.
    444  1.7  christos  *
    445  1.7  christos  ******************************************************************************/
    446  1.7  christos 
    447  1.7  christos static void
    448  1.7  christos AcpiDmValidateFadtLength (
    449  1.7  christos     UINT32                  Revision,
    450  1.7  christos     UINT32                  Length)
    451  1.7  christos {
    452  1.7  christos     UINT32                  ExpectedLength;
    453  1.7  christos 
    454  1.7  christos 
    455  1.7  christos     switch (Revision)
    456  1.7  christos     {
    457  1.7  christos     case 0:
    458  1.7  christos 
    459  1.7  christos         AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
    460  1.7  christos         return;
    461  1.7  christos 
    462  1.7  christos     case 1:
    463  1.7  christos 
    464  1.7  christos         ExpectedLength = ACPI_FADT_V1_SIZE;
    465  1.7  christos         break;
    466  1.7  christos 
    467  1.7  christos     case 2:
    468  1.7  christos 
    469  1.7  christos         ExpectedLength = ACPI_FADT_V2_SIZE;
    470  1.7  christos         break;
    471  1.7  christos 
    472  1.7  christos     case 3:
    473  1.7  christos     case 4:
    474  1.7  christos 
    475  1.7  christos         ExpectedLength = ACPI_FADT_V3_SIZE;
    476  1.7  christos         break;
    477  1.7  christos 
    478  1.7  christos     case 5:
    479  1.7  christos 
    480  1.7  christos         ExpectedLength = ACPI_FADT_V5_SIZE;
    481  1.7  christos         break;
    482  1.7  christos 
    483  1.7  christos     default:
    484  1.7  christos 
    485  1.7  christos         return;
    486  1.7  christos     }
    487  1.7  christos 
    488  1.7  christos     if (Length == ExpectedLength)
    489  1.7  christos     {
    490  1.7  christos         return;
    491  1.7  christos     }
    492  1.7  christos 
    493  1.7  christos     AcpiOsPrintf (
    494  1.7  christos         "\n// ACPI Warning: FADT revision %X does not match length: "
    495  1.7  christos         "found %X expected %X\n",
    496  1.7  christos         Revision, Length, ExpectedLength);
    497  1.1    jruoho }
    498  1.1    jruoho 
    499  1.1    jruoho 
    500  1.1    jruoho /*******************************************************************************
    501  1.1    jruoho  *
    502  1.1    jruoho  * FUNCTION:    AcpiDmDumpAsf
    503  1.1    jruoho  *
    504  1.1    jruoho  * PARAMETERS:  Table               - A ASF table
    505  1.1    jruoho  *
    506  1.1    jruoho  * RETURN:      None
    507  1.1    jruoho  *
    508  1.1    jruoho  * DESCRIPTION: Format the contents of a ASF table
    509  1.1    jruoho  *
    510  1.1    jruoho  ******************************************************************************/
    511  1.1    jruoho 
    512  1.1    jruoho void
    513  1.1    jruoho AcpiDmDumpAsf (
    514  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    515  1.1    jruoho {
    516  1.1    jruoho     ACPI_STATUS             Status;
    517  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_HEADER);
    518  1.9  christos     ACPI_ASF_INFO           *Subtable;
    519  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
    520  1.1    jruoho     ACPI_DMTABLE_INFO       *DataInfoTable = NULL;
    521  1.1    jruoho     UINT8                   *DataTable = NULL;
    522  1.1    jruoho     UINT32                  DataCount = 0;
    523  1.1    jruoho     UINT32                  DataLength = 0;
    524  1.1    jruoho     UINT32                  DataOffset = 0;
    525  1.1    jruoho     UINT32                  i;
    526  1.1    jruoho     UINT8                   Type;
    527  1.1    jruoho 
    528  1.1    jruoho 
    529  1.2  christos     /* No main table, only subtables */
    530  1.1    jruoho 
    531  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
    532  1.1    jruoho     while (Offset < Table->Length)
    533  1.1    jruoho     {
    534  1.2  christos         /* Common subtable header */
    535  1.1    jruoho 
    536  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    537  1.9  christos             Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
    538  1.1    jruoho         if (ACPI_FAILURE (Status))
    539  1.1    jruoho         {
    540  1.1    jruoho             return;
    541  1.1    jruoho         }
    542  1.1    jruoho 
    543  1.1    jruoho         /* The actual type is the lower 7 bits of Type */
    544  1.1    jruoho 
    545  1.9  christos         Type = (UINT8) (Subtable->Header.Type & 0x7F);
    546  1.1    jruoho 
    547  1.1    jruoho         switch (Type)
    548  1.1    jruoho         {
    549  1.1    jruoho         case ACPI_ASF_TYPE_INFO:
    550  1.2  christos 
    551  1.1    jruoho             InfoTable = AcpiDmTableInfoAsf0;
    552  1.1    jruoho             break;
    553  1.1    jruoho 
    554  1.1    jruoho         case ACPI_ASF_TYPE_ALERT:
    555  1.2  christos 
    556  1.1    jruoho             InfoTable = AcpiDmTableInfoAsf1;
    557  1.1    jruoho             DataInfoTable = AcpiDmTableInfoAsf1a;
    558  1.9  christos             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT));
    559  1.9  christos             DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts;
    560  1.9  christos             DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength;
    561  1.1    jruoho             DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
    562  1.1    jruoho             break;
    563  1.1    jruoho 
    564  1.1    jruoho         case ACPI_ASF_TYPE_CONTROL:
    565  1.2  christos 
    566  1.1    jruoho             InfoTable = AcpiDmTableInfoAsf2;
    567  1.1    jruoho             DataInfoTable = AcpiDmTableInfoAsf2a;
    568  1.9  christos             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE));
    569  1.9  christos             DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls;
    570  1.9  christos             DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength;
    571  1.1    jruoho             DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
    572  1.1    jruoho             break;
    573  1.1    jruoho 
    574  1.1    jruoho         case ACPI_ASF_TYPE_BOOT:
    575  1.2  christos 
    576  1.1    jruoho             InfoTable = AcpiDmTableInfoAsf3;
    577  1.1    jruoho             break;
    578  1.1    jruoho 
    579  1.1    jruoho         case ACPI_ASF_TYPE_ADDRESS:
    580  1.2  christos 
    581  1.1    jruoho             InfoTable = AcpiDmTableInfoAsf4;
    582  1.9  christos             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS));
    583  1.9  christos             DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices;
    584  1.1    jruoho             DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
    585  1.1    jruoho             break;
    586  1.1    jruoho 
    587  1.1    jruoho         default:
    588  1.2  christos 
    589  1.4  christos             AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n",
    590  1.9  christos                 Subtable->Header.Type);
    591  1.1    jruoho             return;
    592  1.1    jruoho         }
    593  1.1    jruoho 
    594  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
    595  1.9  christos             Subtable->Header.Length, InfoTable);
    596  1.1    jruoho         if (ACPI_FAILURE (Status))
    597  1.1    jruoho         {
    598  1.1    jruoho             return;
    599  1.1    jruoho         }
    600  1.1    jruoho 
    601  1.1    jruoho         /* Dump variable-length extra data */
    602  1.1    jruoho 
    603  1.1    jruoho         switch (Type)
    604  1.1    jruoho         {
    605  1.1    jruoho         case ACPI_ASF_TYPE_ALERT:
    606  1.1    jruoho         case ACPI_ASF_TYPE_CONTROL:
    607  1.1    jruoho 
    608  1.1    jruoho             for (i = 0; i < DataCount; i++)
    609  1.1    jruoho             {
    610  1.1    jruoho                 AcpiOsPrintf ("\n");
    611  1.1    jruoho                 Status = AcpiDmDumpTable (Table->Length, DataOffset,
    612  1.4  christos                     DataTable, DataLength, DataInfoTable);
    613  1.1    jruoho                 if (ACPI_FAILURE (Status))
    614  1.1    jruoho                 {
    615  1.1    jruoho                     return;
    616  1.1    jruoho                 }
    617  1.1    jruoho 
    618  1.1    jruoho                 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
    619  1.1    jruoho                 DataOffset += DataLength;
    620  1.1    jruoho             }
    621  1.1    jruoho             break;
    622  1.1    jruoho 
    623  1.1    jruoho         case ACPI_ASF_TYPE_ADDRESS:
    624  1.1    jruoho 
    625  1.1    jruoho             for (i = 0; i < DataLength; i++)
    626  1.1    jruoho             {
    627  1.1    jruoho                 if (!(i % 16))
    628  1.1    jruoho                 {
    629  1.1    jruoho                     AcpiDmLineHeader (DataOffset, 1, "Addresses");
    630  1.1    jruoho                 }
    631  1.1    jruoho 
    632  1.1    jruoho                 AcpiOsPrintf ("%2.2X ", *DataTable);
    633  1.1    jruoho                 DataTable++;
    634  1.1    jruoho                 DataOffset++;
    635  1.4  christos 
    636  1.1    jruoho                 if (DataOffset > Table->Length)
    637  1.1    jruoho                 {
    638  1.4  christos                     AcpiOsPrintf (
    639  1.4  christos                         "**** ACPI table terminates in the middle of a "
    640  1.4  christos                         "data structure! (ASF! table)\n");
    641  1.1    jruoho                     return;
    642  1.1    jruoho                 }
    643  1.1    jruoho             }
    644  1.1    jruoho 
    645  1.1    jruoho             AcpiOsPrintf ("\n");
    646  1.1    jruoho             break;
    647  1.1    jruoho 
    648  1.1    jruoho         default:
    649  1.2  christos 
    650  1.1    jruoho             break;
    651  1.1    jruoho         }
    652  1.1    jruoho 
    653  1.1    jruoho         AcpiOsPrintf ("\n");
    654  1.1    jruoho 
    655  1.2  christos         /* Point to next subtable */
    656  1.1    jruoho 
    657  1.9  christos         if (!Subtable->Header.Length)
    658  1.1    jruoho         {
    659  1.1    jruoho             AcpiOsPrintf ("Invalid zero subtable header length\n");
    660  1.1    jruoho             return;
    661  1.1    jruoho         }
    662  1.1    jruoho 
    663  1.9  christos         Offset += Subtable->Header.Length;
    664  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
    665  1.9  christos             Subtable->Header.Length);
    666  1.1    jruoho     }
    667  1.1    jruoho }
    668  1.1    jruoho 
    669  1.1    jruoho 
    670  1.1    jruoho /*******************************************************************************
    671  1.1    jruoho  *
    672  1.1    jruoho  * FUNCTION:    AcpiDmDumpCpep
    673  1.1    jruoho  *
    674  1.1    jruoho  * PARAMETERS:  Table               - A CPEP table
    675  1.1    jruoho  *
    676  1.1    jruoho  * RETURN:      None
    677  1.1    jruoho  *
    678  1.1    jruoho  * DESCRIPTION: Format the contents of a CPEP. This table type consists
    679  1.1    jruoho  *              of an open-ended number of subtables.
    680  1.1    jruoho  *
    681  1.1    jruoho  ******************************************************************************/
    682  1.1    jruoho 
    683  1.1    jruoho void
    684  1.1    jruoho AcpiDmDumpCpep (
    685  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    686  1.1    jruoho {
    687  1.1    jruoho     ACPI_STATUS             Status;
    688  1.9  christos     ACPI_CPEP_POLLING       *Subtable;
    689  1.1    jruoho     UINT32                  Length = Table->Length;
    690  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
    691  1.1    jruoho 
    692  1.1    jruoho 
    693  1.1    jruoho     /* Main table */
    694  1.1    jruoho 
    695  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
    696  1.1    jruoho     if (ACPI_FAILURE (Status))
    697  1.1    jruoho     {
    698  1.1    jruoho         return;
    699  1.1    jruoho     }
    700  1.1    jruoho 
    701  1.2  christos     /* Subtables */
    702  1.1    jruoho 
    703  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
    704  1.1    jruoho     while (Offset < Table->Length)
    705  1.1    jruoho     {
    706  1.1    jruoho         AcpiOsPrintf ("\n");
    707  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    708  1.9  christos             Subtable->Header.Length, AcpiDmTableInfoCpep0);
    709  1.1    jruoho         if (ACPI_FAILURE (Status))
    710  1.1    jruoho         {
    711  1.1    jruoho             return;
    712  1.1    jruoho         }
    713  1.1    jruoho 
    714  1.2  christos         /* Point to next subtable */
    715  1.1    jruoho 
    716  1.9  christos         Offset += Subtable->Header.Length;
    717  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable,
    718  1.9  christos             Subtable->Header.Length);
    719  1.1    jruoho     }
    720  1.1    jruoho }
    721  1.1    jruoho 
    722  1.1    jruoho 
    723  1.1    jruoho /*******************************************************************************
    724  1.1    jruoho  *
    725  1.2  christos  * FUNCTION:    AcpiDmDumpCsrt
    726  1.2  christos  *
    727  1.2  christos  * PARAMETERS:  Table               - A CSRT table
    728  1.2  christos  *
    729  1.2  christos  * RETURN:      None
    730  1.2  christos  *
    731  1.2  christos  * DESCRIPTION: Format the contents of a CSRT. This table type consists
    732  1.2  christos  *              of an open-ended number of subtables.
    733  1.2  christos  *
    734  1.2  christos  ******************************************************************************/
    735  1.2  christos 
    736  1.2  christos void
    737  1.2  christos AcpiDmDumpCsrt (
    738  1.2  christos     ACPI_TABLE_HEADER       *Table)
    739  1.2  christos {
    740  1.2  christos     ACPI_STATUS             Status;
    741  1.9  christos     ACPI_CSRT_GROUP         *Subtable;
    742  1.2  christos     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
    743  1.9  christos     ACPI_CSRT_DESCRIPTOR    *SubSubtable;
    744  1.2  christos     UINT32                  Length = Table->Length;
    745  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
    746  1.2  christos     UINT32                  SubOffset;
    747  1.2  christos     UINT32                  SubSubOffset;
    748  1.2  christos     UINT32                  InfoLength;
    749  1.2  christos 
    750  1.2  christos 
    751  1.2  christos     /* The main table only contains the ACPI header, thus already handled */
    752  1.2  christos 
    753  1.2  christos     /* Subtables (Resource Groups) */
    754  1.2  christos 
    755  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
    756  1.2  christos     while (Offset < Table->Length)
    757  1.2  christos     {
    758  1.2  christos         /* Resource group subtable */
    759  1.2  christos 
    760  1.2  christos         AcpiOsPrintf ("\n");
    761  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    762  1.9  christos             Subtable->Length, AcpiDmTableInfoCsrt0);
    763  1.2  christos         if (ACPI_FAILURE (Status))
    764  1.2  christos         {
    765  1.2  christos             return;
    766  1.2  christos         }
    767  1.2  christos 
    768  1.2  christos         /* Shared info subtable (One per resource group) */
    769  1.2  christos 
    770  1.2  christos         SubOffset = sizeof (ACPI_CSRT_GROUP);
    771  1.2  christos         SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
    772  1.2  christos             Offset + SubOffset);
    773  1.2  christos 
    774  1.2  christos         AcpiOsPrintf ("\n");
    775  1.2  christos         Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
    776  1.4  christos             sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
    777  1.2  christos         if (ACPI_FAILURE (Status))
    778  1.2  christos         {
    779  1.2  christos             return;
    780  1.2  christos         }
    781  1.2  christos 
    782  1.9  christos         SubOffset += Subtable->SharedInfoLength;
    783  1.2  christos 
    784  1.2  christos         /* Sub-Subtables (Resource Descriptors) */
    785  1.2  christos 
    786  1.9  christos         SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
    787  1.2  christos             Offset + SubOffset);
    788  1.2  christos 
    789  1.9  christos         while ((SubOffset < Subtable->Length) &&
    790  1.2  christos               ((Offset + SubOffset) < Table->Length))
    791  1.2  christos         {
    792  1.2  christos             AcpiOsPrintf ("\n");
    793  1.9  christos             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
    794  1.9  christos                 SubSubtable->Length, AcpiDmTableInfoCsrt2);
    795  1.2  christos             if (ACPI_FAILURE (Status))
    796  1.2  christos             {
    797  1.2  christos                 return;
    798  1.2  christos             }
    799  1.2  christos 
    800  1.2  christos             SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
    801  1.2  christos 
    802  1.2  christos             /* Resource-specific info buffer */
    803  1.2  christos 
    804  1.9  christos             InfoLength = SubSubtable->Length - SubSubOffset;
    805  1.3  christos             if (InfoLength)
    806  1.3  christos             {
    807  1.3  christos                 Status = AcpiDmDumpTable (Length,
    808  1.4  christos                     Offset + SubOffset + SubSubOffset, Table,
    809  1.4  christos                     InfoLength, AcpiDmTableInfoCsrt2a);
    810  1.3  christos                 if (ACPI_FAILURE (Status))
    811  1.3  christos                 {
    812  1.3  christos                     return;
    813  1.3  christos                 }
    814  1.3  christos                 SubSubOffset += InfoLength;
    815  1.3  christos             }
    816  1.2  christos 
    817  1.2  christos             /* Point to next sub-subtable */
    818  1.2  christos 
    819  1.9  christos             SubOffset += SubSubtable->Length;
    820  1.9  christos             SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
    821  1.9  christos                 SubSubtable->Length);
    822  1.2  christos         }
    823  1.2  christos 
    824  1.2  christos         /* Point to next subtable */
    825  1.2  christos 
    826  1.9  christos         Offset += Subtable->Length;
    827  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable,
    828  1.9  christos             Subtable->Length);
    829  1.2  christos     }
    830  1.2  christos }
    831  1.2  christos 
    832  1.2  christos 
    833  1.2  christos /*******************************************************************************
    834  1.2  christos  *
    835  1.2  christos  * FUNCTION:    AcpiDmDumpDbg2
    836  1.2  christos  *
    837  1.2  christos  * PARAMETERS:  Table               - A DBG2 table
    838  1.2  christos  *
    839  1.2  christos  * RETURN:      None
    840  1.2  christos  *
    841  1.2  christos  * DESCRIPTION: Format the contents of a DBG2. This table type consists
    842  1.2  christos  *              of an open-ended number of subtables.
    843  1.2  christos  *
    844  1.2  christos  ******************************************************************************/
    845  1.2  christos 
    846  1.2  christos void
    847  1.2  christos AcpiDmDumpDbg2 (
    848  1.2  christos     ACPI_TABLE_HEADER       *Table)
    849  1.2  christos {
    850  1.2  christos     ACPI_STATUS             Status;
    851  1.9  christos     ACPI_DBG2_DEVICE        *Subtable;
    852  1.2  christos     UINT32                  Length = Table->Length;
    853  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
    854  1.2  christos     UINT32                  i;
    855  1.2  christos     UINT32                  ArrayOffset;
    856  1.2  christos     UINT32                  AbsoluteOffset;
    857  1.2  christos     UINT8                   *Array;
    858  1.2  christos 
    859  1.2  christos 
    860  1.2  christos     /* Main table */
    861  1.2  christos 
    862  1.2  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
    863  1.2  christos     if (ACPI_FAILURE (Status))
    864  1.2  christos     {
    865  1.2  christos         return;
    866  1.2  christos     }
    867  1.2  christos 
    868  1.2  christos     /* Subtables */
    869  1.2  christos 
    870  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
    871  1.2  christos     while (Offset < Table->Length)
    872  1.2  christos     {
    873  1.2  christos         AcpiOsPrintf ("\n");
    874  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    875  1.9  christos             Subtable->Length, AcpiDmTableInfoDbg2Device);
    876  1.2  christos         if (ACPI_FAILURE (Status))
    877  1.2  christos         {
    878  1.2  christos             return;
    879  1.2  christos         }
    880  1.2  christos 
    881  1.2  christos         /* Dump the BaseAddress array */
    882  1.2  christos 
    883  1.9  christos         for (i = 0; i < Subtable->RegisterCount; i++)
    884  1.2  christos         {
    885  1.9  christos             ArrayOffset = Subtable->BaseAddressOffset +
    886  1.2  christos                 (sizeof (ACPI_GENERIC_ADDRESS) * i);
    887  1.2  christos             AbsoluteOffset = Offset + ArrayOffset;
    888  1.9  christos             Array = (UINT8 *) Subtable + ArrayOffset;
    889  1.2  christos 
    890  1.2  christos             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
    891  1.9  christos                 Subtable->Length, AcpiDmTableInfoDbg2Addr);
    892  1.2  christos             if (ACPI_FAILURE (Status))
    893  1.2  christos             {
    894  1.2  christos                 return;
    895  1.2  christos             }
    896  1.2  christos         }
    897  1.2  christos 
    898  1.2  christos         /* Dump the AddressSize array */
    899  1.2  christos 
    900  1.9  christos         for (i = 0; i < Subtable->RegisterCount; i++)
    901  1.2  christos         {
    902  1.9  christos             ArrayOffset = Subtable->AddressSizeOffset +
    903  1.2  christos                 (sizeof (UINT32) * i);
    904  1.2  christos             AbsoluteOffset = Offset + ArrayOffset;
    905  1.9  christos             Array = (UINT8 *) Subtable + ArrayOffset;
    906  1.2  christos 
    907  1.2  christos             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
    908  1.9  christos                 Subtable->Length, AcpiDmTableInfoDbg2Size);
    909  1.2  christos             if (ACPI_FAILURE (Status))
    910  1.2  christos             {
    911  1.2  christos                 return;
    912  1.2  christos             }
    913  1.2  christos         }
    914  1.2  christos 
    915  1.2  christos         /* Dump the Namestring (required) */
    916  1.2  christos 
    917  1.2  christos         AcpiOsPrintf ("\n");
    918  1.9  christos         ArrayOffset = Subtable->NamepathOffset;
    919  1.2  christos         AbsoluteOffset = Offset + ArrayOffset;
    920  1.9  christos         Array = (UINT8 *) Subtable + ArrayOffset;
    921  1.2  christos 
    922  1.2  christos         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
    923  1.9  christos             Subtable->Length, AcpiDmTableInfoDbg2Name);
    924  1.2  christos         if (ACPI_FAILURE (Status))
    925  1.2  christos         {
    926  1.2  christos             return;
    927  1.2  christos         }
    928  1.2  christos 
    929  1.2  christos         /* Dump the OemData (optional) */
    930  1.2  christos 
    931  1.9  christos         if (Subtable->OemDataOffset)
    932  1.2  christos         {
    933  1.9  christos             Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
    934  1.9  christos                 Table, Subtable->OemDataLength,
    935  1.4  christos                 AcpiDmTableInfoDbg2OemData);
    936  1.3  christos             if (ACPI_FAILURE (Status))
    937  1.3  christos             {
    938  1.3  christos                 return;
    939  1.3  christos             }
    940  1.2  christos         }
    941  1.2  christos 
    942  1.2  christos         /* Point to next subtable */
    943  1.2  christos 
    944  1.9  christos         Offset += Subtable->Length;
    945  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
    946  1.9  christos             Subtable->Length);
    947  1.2  christos     }
    948  1.2  christos }
    949  1.2  christos 
    950  1.2  christos 
    951  1.2  christos /*******************************************************************************
    952  1.2  christos  *
    953  1.1    jruoho  * FUNCTION:    AcpiDmDumpDmar
    954  1.1    jruoho  *
    955  1.1    jruoho  * PARAMETERS:  Table               - A DMAR table
    956  1.1    jruoho  *
    957  1.1    jruoho  * RETURN:      None
    958  1.1    jruoho  *
    959  1.1    jruoho  * DESCRIPTION: Format the contents of a DMAR. This table type consists
    960  1.1    jruoho  *              of an open-ended number of subtables.
    961  1.1    jruoho  *
    962  1.1    jruoho  ******************************************************************************/
    963  1.1    jruoho 
    964  1.1    jruoho void
    965  1.1    jruoho AcpiDmDumpDmar (
    966  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
    967  1.1    jruoho {
    968  1.1    jruoho     ACPI_STATUS             Status;
    969  1.9  christos     ACPI_DMAR_HEADER        *Subtable;
    970  1.1    jruoho     UINT32                  Length = Table->Length;
    971  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
    972  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
    973  1.1    jruoho     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
    974  1.1    jruoho     UINT32                  ScopeOffset;
    975  1.1    jruoho     UINT8                   *PciPath;
    976  1.1    jruoho     UINT32                  PathOffset;
    977  1.1    jruoho 
    978  1.1    jruoho 
    979  1.1    jruoho     /* Main table */
    980  1.1    jruoho 
    981  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
    982  1.1    jruoho     if (ACPI_FAILURE (Status))
    983  1.1    jruoho     {
    984  1.1    jruoho         return;
    985  1.1    jruoho     }
    986  1.1    jruoho 
    987  1.2  christos     /* Subtables */
    988  1.1    jruoho 
    989  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
    990  1.1    jruoho     while (Offset < Table->Length)
    991  1.1    jruoho     {
    992  1.2  christos         /* Common subtable header */
    993  1.1    jruoho 
    994  1.1    jruoho         AcpiOsPrintf ("\n");
    995  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
    996  1.9  christos             Subtable->Length, AcpiDmTableInfoDmarHdr);
    997  1.1    jruoho         if (ACPI_FAILURE (Status))
    998  1.1    jruoho         {
    999  1.1    jruoho             return;
   1000  1.1    jruoho         }
   1001  1.4  christos 
   1002  1.2  christos         AcpiOsPrintf ("\n");
   1003  1.1    jruoho 
   1004  1.9  christos         switch (Subtable->Type)
   1005  1.1    jruoho         {
   1006  1.1    jruoho         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
   1007  1.2  christos 
   1008  1.1    jruoho             InfoTable = AcpiDmTableInfoDmar0;
   1009  1.1    jruoho             ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
   1010  1.1    jruoho             break;
   1011  1.2  christos 
   1012  1.1    jruoho         case ACPI_DMAR_TYPE_RESERVED_MEMORY:
   1013  1.2  christos 
   1014  1.1    jruoho             InfoTable = AcpiDmTableInfoDmar1;
   1015  1.1    jruoho             ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
   1016  1.1    jruoho             break;
   1017  1.2  christos 
   1018  1.2  christos         case ACPI_DMAR_TYPE_ROOT_ATS:
   1019  1.2  christos 
   1020  1.1    jruoho             InfoTable = AcpiDmTableInfoDmar2;
   1021  1.1    jruoho             ScopeOffset = sizeof (ACPI_DMAR_ATSR);
   1022  1.1    jruoho             break;
   1023  1.2  christos 
   1024  1.2  christos         case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
   1025  1.2  christos 
   1026  1.1    jruoho             InfoTable = AcpiDmTableInfoDmar3;
   1027  1.1    jruoho             ScopeOffset = sizeof (ACPI_DMAR_RHSA);
   1028  1.1    jruoho             break;
   1029  1.2  christos 
   1030  1.2  christos         case ACPI_DMAR_TYPE_NAMESPACE:
   1031  1.2  christos 
   1032  1.2  christos             InfoTable = AcpiDmTableInfoDmar4;
   1033  1.2  christos             ScopeOffset = sizeof (ACPI_DMAR_ANDD);
   1034  1.2  christos             break;
   1035  1.2  christos 
   1036  1.1    jruoho         default:
   1037  1.2  christos 
   1038  1.4  christos             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
   1039  1.9  christos                 Subtable->Type);
   1040  1.1    jruoho             return;
   1041  1.1    jruoho         }
   1042  1.1    jruoho 
   1043  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1044  1.9  christos             Subtable->Length, InfoTable);
   1045  1.1    jruoho         if (ACPI_FAILURE (Status))
   1046  1.1    jruoho         {
   1047  1.1    jruoho             return;
   1048  1.1    jruoho         }
   1049  1.1    jruoho 
   1050  1.2  christos         /*
   1051  1.2  christos          * Dump the optional device scope entries
   1052  1.2  christos          */
   1053  1.9  christos         if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
   1054  1.9  christos             (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
   1055  1.2  christos         {
   1056  1.2  christos             /* These types do not support device scopes */
   1057  1.2  christos 
   1058  1.2  christos             goto NextSubtable;
   1059  1.2  christos         }
   1060  1.1    jruoho 
   1061  1.9  christos         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
   1062  1.9  christos         while (ScopeOffset < Subtable->Length)
   1063  1.1    jruoho         {
   1064  1.1    jruoho             AcpiOsPrintf ("\n");
   1065  1.1    jruoho             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
   1066  1.4  christos                 ScopeTable->Length, AcpiDmTableInfoDmarScope);
   1067  1.1    jruoho             if (ACPI_FAILURE (Status))
   1068  1.1    jruoho             {
   1069  1.1    jruoho                 return;
   1070  1.1    jruoho             }
   1071  1.2  christos             AcpiOsPrintf ("\n");
   1072  1.1    jruoho 
   1073  1.1    jruoho             /* Dump the PCI Path entries for this device scope */
   1074  1.1    jruoho 
   1075  1.1    jruoho             PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
   1076  1.1    jruoho 
   1077  1.1    jruoho             PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
   1078  1.1    jruoho                 sizeof (ACPI_DMAR_DEVICE_SCOPE));
   1079  1.1    jruoho 
   1080  1.1    jruoho             while (PathOffset < ScopeTable->Length)
   1081  1.1    jruoho             {
   1082  1.4  christos                 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2,
   1083  1.4  christos                     "PCI Path");
   1084  1.2  christos                 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
   1085  1.1    jruoho 
   1086  1.1    jruoho                 /* Point to next PCI Path entry */
   1087  1.1    jruoho 
   1088  1.1    jruoho                 PathOffset += 2;
   1089  1.1    jruoho                 PciPath += 2;
   1090  1.2  christos                 AcpiOsPrintf ("\n");
   1091  1.1    jruoho             }
   1092  1.1    jruoho 
   1093  1.1    jruoho             /* Point to next device scope entry */
   1094  1.1    jruoho 
   1095  1.1    jruoho             ScopeOffset += ScopeTable->Length;
   1096  1.1    jruoho             ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
   1097  1.1    jruoho                 ScopeTable, ScopeTable->Length);
   1098  1.1    jruoho         }
   1099  1.1    jruoho 
   1100  1.2  christos NextSubtable:
   1101  1.2  christos         /* Point to next subtable */
   1102  1.1    jruoho 
   1103  1.9  christos         Offset += Subtable->Length;
   1104  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
   1105  1.9  christos             Subtable->Length);
   1106  1.1    jruoho     }
   1107  1.1    jruoho }
   1108  1.1    jruoho 
   1109  1.1    jruoho 
   1110  1.1    jruoho /*******************************************************************************
   1111  1.1    jruoho  *
   1112  1.3  christos  * FUNCTION:    AcpiDmDumpDrtm
   1113  1.3  christos  *
   1114  1.3  christos  * PARAMETERS:  Table               - A DRTM table
   1115  1.3  christos  *
   1116  1.3  christos  * RETURN:      None
   1117  1.3  christos  *
   1118  1.3  christos  * DESCRIPTION: Format the contents of a DRTM.
   1119  1.3  christos  *
   1120  1.3  christos  ******************************************************************************/
   1121  1.3  christos 
   1122  1.3  christos void
   1123  1.3  christos AcpiDmDumpDrtm (
   1124  1.3  christos     ACPI_TABLE_HEADER       *Table)
   1125  1.3  christos {
   1126  1.3  christos     ACPI_STATUS             Status;
   1127  1.3  christos     UINT32                  Offset;
   1128  1.3  christos     ACPI_DRTM_VTABLE_LIST   *DrtmVtl;
   1129  1.3  christos     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
   1130  1.3  christos     ACPI_DRTM_DPS_ID        *DrtmDps;
   1131  1.3  christos     UINT32                  Count;
   1132  1.3  christos 
   1133  1.3  christos 
   1134  1.3  christos     /* Main table */
   1135  1.3  christos 
   1136  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
   1137  1.4  christos         AcpiDmTableInfoDrtm);
   1138  1.3  christos     if (ACPI_FAILURE (Status))
   1139  1.3  christos     {
   1140  1.3  christos         return;
   1141  1.3  christos     }
   1142  1.3  christos 
   1143  1.3  christos     Offset = sizeof (ACPI_TABLE_DRTM);
   1144  1.3  christos 
   1145  1.3  christos     /* Sub-tables */
   1146  1.3  christos 
   1147  1.3  christos     /* Dump ValidatedTable length */
   1148  1.3  christos 
   1149  1.3  christos     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
   1150  1.3  christos     AcpiOsPrintf ("\n");
   1151  1.3  christos     Status = AcpiDmDumpTable (Table->Length, Offset,
   1152  1.4  christos         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
   1153  1.4  christos         AcpiDmTableInfoDrtm0);
   1154  1.3  christos     if (ACPI_FAILURE (Status))
   1155  1.3  christos     {
   1156  1.3  christos             return;
   1157  1.3  christos     }
   1158  1.4  christos 
   1159  1.3  christos     Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
   1160  1.3  christos 
   1161  1.3  christos     /* Dump Validated table addresses */
   1162  1.3  christos 
   1163  1.3  christos     Count = 0;
   1164  1.3  christos     while ((Offset < Table->Length) &&
   1165  1.3  christos             (DrtmVtl->ValidatedTableCount > Count))
   1166  1.3  christos     {
   1167  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset,
   1168  1.4  christos             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
   1169  1.4  christos             AcpiDmTableInfoDrtm0a);
   1170  1.3  christos         if (ACPI_FAILURE (Status))
   1171  1.3  christos         {
   1172  1.3  christos             return;
   1173  1.3  christos         }
   1174  1.4  christos 
   1175  1.3  christos         Offset += sizeof (UINT64);
   1176  1.3  christos         Count++;
   1177  1.3  christos     }
   1178  1.3  christos 
   1179  1.3  christos     /* Dump ResourceList length */
   1180  1.3  christos 
   1181  1.3  christos     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
   1182  1.3  christos     AcpiOsPrintf ("\n");
   1183  1.3  christos     Status = AcpiDmDumpTable (Table->Length, Offset,
   1184  1.4  christos         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
   1185  1.4  christos         AcpiDmTableInfoDrtm1);
   1186  1.3  christos     if (ACPI_FAILURE (Status))
   1187  1.3  christos     {
   1188  1.3  christos         return;
   1189  1.3  christos     }
   1190  1.3  christos 
   1191  1.3  christos     Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
   1192  1.3  christos 
   1193  1.3  christos     /* Dump the Resource List */
   1194  1.3  christos 
   1195  1.3  christos     Count = 0;
   1196  1.3  christos     while ((Offset < Table->Length) &&
   1197  1.3  christos            (DrtmRl->ResourceCount > Count))
   1198  1.3  christos     {
   1199  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset,
   1200  1.4  christos             ACPI_ADD_PTR (void, Table, Offset),
   1201  1.4  christos             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
   1202  1.3  christos         if (ACPI_FAILURE (Status))
   1203  1.3  christos         {
   1204  1.3  christos             return;
   1205  1.3  christos         }
   1206  1.3  christos 
   1207  1.3  christos         Offset += sizeof (ACPI_DRTM_RESOURCE);
   1208  1.3  christos         Count++;
   1209  1.3  christos     }
   1210  1.3  christos 
   1211  1.3  christos     /* Dump DPS */
   1212  1.3  christos 
   1213  1.3  christos     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
   1214  1.3  christos     AcpiOsPrintf ("\n");
   1215  1.3  christos     (void) AcpiDmDumpTable (Table->Length, Offset,
   1216  1.4  christos         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
   1217  1.3  christos }
   1218  1.3  christos 
   1219  1.3  christos 
   1220  1.3  christos /*******************************************************************************
   1221  1.3  christos  *
   1222  1.1    jruoho  * FUNCTION:    AcpiDmDumpEinj
   1223  1.1    jruoho  *
   1224  1.1    jruoho  * PARAMETERS:  Table               - A EINJ table
   1225  1.1    jruoho  *
   1226  1.1    jruoho  * RETURN:      None
   1227  1.1    jruoho  *
   1228  1.1    jruoho  * DESCRIPTION: Format the contents of a EINJ. This table type consists
   1229  1.1    jruoho  *              of an open-ended number of subtables.
   1230  1.1    jruoho  *
   1231  1.1    jruoho  ******************************************************************************/
   1232  1.1    jruoho 
   1233  1.1    jruoho void
   1234  1.1    jruoho AcpiDmDumpEinj (
   1235  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   1236  1.1    jruoho {
   1237  1.1    jruoho     ACPI_STATUS             Status;
   1238  1.9  christos     ACPI_WHEA_HEADER        *Subtable;
   1239  1.1    jruoho     UINT32                  Length = Table->Length;
   1240  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
   1241  1.1    jruoho 
   1242  1.1    jruoho 
   1243  1.1    jruoho     /* Main table */
   1244  1.1    jruoho 
   1245  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
   1246  1.1    jruoho     if (ACPI_FAILURE (Status))
   1247  1.1    jruoho     {
   1248  1.1    jruoho         return;
   1249  1.1    jruoho     }
   1250  1.1    jruoho 
   1251  1.2  christos     /* Subtables */
   1252  1.1    jruoho 
   1253  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
   1254  1.1    jruoho     while (Offset < Table->Length)
   1255  1.1    jruoho     {
   1256  1.1    jruoho         AcpiOsPrintf ("\n");
   1257  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1258  1.4  christos             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
   1259  1.1    jruoho         if (ACPI_FAILURE (Status))
   1260  1.1    jruoho         {
   1261  1.1    jruoho             return;
   1262  1.1    jruoho         }
   1263  1.1    jruoho 
   1264  1.2  christos         /* Point to next subtable (each subtable is of fixed length) */
   1265  1.1    jruoho 
   1266  1.1    jruoho         Offset += sizeof (ACPI_WHEA_HEADER);
   1267  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable,
   1268  1.4  christos             sizeof (ACPI_WHEA_HEADER));
   1269  1.1    jruoho     }
   1270  1.1    jruoho }
   1271  1.1    jruoho 
   1272  1.1    jruoho 
   1273  1.1    jruoho /*******************************************************************************
   1274  1.1    jruoho  *
   1275  1.1    jruoho  * FUNCTION:    AcpiDmDumpErst
   1276  1.1    jruoho  *
   1277  1.1    jruoho  * PARAMETERS:  Table               - A ERST table
   1278  1.1    jruoho  *
   1279  1.1    jruoho  * RETURN:      None
   1280  1.1    jruoho  *
   1281  1.1    jruoho  * DESCRIPTION: Format the contents of a ERST. This table type consists
   1282  1.1    jruoho  *              of an open-ended number of subtables.
   1283  1.1    jruoho  *
   1284  1.1    jruoho  ******************************************************************************/
   1285  1.1    jruoho 
   1286  1.1    jruoho void
   1287  1.1    jruoho AcpiDmDumpErst (
   1288  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   1289  1.1    jruoho {
   1290  1.1    jruoho     ACPI_STATUS             Status;
   1291  1.9  christos     ACPI_WHEA_HEADER        *Subtable;
   1292  1.1    jruoho     UINT32                  Length = Table->Length;
   1293  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
   1294  1.1    jruoho 
   1295  1.1    jruoho 
   1296  1.1    jruoho     /* Main table */
   1297  1.1    jruoho 
   1298  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
   1299  1.1    jruoho     if (ACPI_FAILURE (Status))
   1300  1.1    jruoho     {
   1301  1.1    jruoho         return;
   1302  1.1    jruoho     }
   1303  1.1    jruoho 
   1304  1.2  christos     /* Subtables */
   1305  1.1    jruoho 
   1306  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
   1307  1.1    jruoho     while (Offset < Table->Length)
   1308  1.1    jruoho     {
   1309  1.1    jruoho         AcpiOsPrintf ("\n");
   1310  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1311  1.4  christos             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
   1312  1.1    jruoho         if (ACPI_FAILURE (Status))
   1313  1.1    jruoho         {
   1314  1.1    jruoho             return;
   1315  1.1    jruoho         }
   1316  1.1    jruoho 
   1317  1.2  christos         /* Point to next subtable (each subtable is of fixed length) */
   1318  1.1    jruoho 
   1319  1.1    jruoho         Offset += sizeof (ACPI_WHEA_HEADER);
   1320  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable,
   1321  1.4  christos             sizeof (ACPI_WHEA_HEADER));
   1322  1.1    jruoho     }
   1323  1.1    jruoho }
   1324  1.1    jruoho 
   1325  1.1    jruoho 
   1326  1.1    jruoho /*******************************************************************************
   1327  1.1    jruoho  *
   1328  1.2  christos  * FUNCTION:    AcpiDmDumpFpdt
   1329  1.1    jruoho  *
   1330  1.2  christos  * PARAMETERS:  Table               - A FPDT table
   1331  1.1    jruoho  *
   1332  1.1    jruoho  * RETURN:      None
   1333  1.1    jruoho  *
   1334  1.2  christos  * DESCRIPTION: Format the contents of a FPDT. This table type consists
   1335  1.1    jruoho  *              of an open-ended number of subtables.
   1336  1.1    jruoho  *
   1337  1.1    jruoho  ******************************************************************************/
   1338  1.1    jruoho 
   1339  1.1    jruoho void
   1340  1.2  christos AcpiDmDumpFpdt (
   1341  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   1342  1.1    jruoho {
   1343  1.1    jruoho     ACPI_STATUS             Status;
   1344  1.9  christos     ACPI_FPDT_HEADER        *Subtable;
   1345  1.1    jruoho     UINT32                  Length = Table->Length;
   1346  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
   1347  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1348  1.2  christos 
   1349  1.2  christos 
   1350  1.2  christos     /* There is no main table (other than the standard ACPI header) */
   1351  1.2  christos 
   1352  1.2  christos     /* Subtables */
   1353  1.2  christos 
   1354  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
   1355  1.2  christos     while (Offset < Table->Length)
   1356  1.2  christos     {
   1357  1.2  christos         /* Common subtable header */
   1358  1.2  christos 
   1359  1.2  christos         AcpiOsPrintf ("\n");
   1360  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1361  1.9  christos             Subtable->Length, AcpiDmTableInfoFpdtHdr);
   1362  1.2  christos         if (ACPI_FAILURE (Status))
   1363  1.2  christos         {
   1364  1.2  christos             return;
   1365  1.2  christos         }
   1366  1.2  christos 
   1367  1.9  christos         switch (Subtable->Type)
   1368  1.2  christos         {
   1369  1.2  christos         case ACPI_FPDT_TYPE_BOOT:
   1370  1.2  christos 
   1371  1.2  christos             InfoTable = AcpiDmTableInfoFpdt0;
   1372  1.2  christos             break;
   1373  1.2  christos 
   1374  1.2  christos         case ACPI_FPDT_TYPE_S3PERF:
   1375  1.2  christos 
   1376  1.2  christos             InfoTable = AcpiDmTableInfoFpdt1;
   1377  1.2  christos             break;
   1378  1.2  christos 
   1379  1.2  christos         default:
   1380  1.2  christos 
   1381  1.4  christos             AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
   1382  1.9  christos                 Subtable->Type);
   1383  1.2  christos 
   1384  1.2  christos             /* Attempt to continue */
   1385  1.2  christos 
   1386  1.9  christos             if (!Subtable->Length)
   1387  1.2  christos             {
   1388  1.2  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   1389  1.2  christos                 return;
   1390  1.2  christos             }
   1391  1.9  christos             goto NextSubtable;
   1392  1.2  christos         }
   1393  1.2  christos 
   1394  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1395  1.9  christos             Subtable->Length, InfoTable);
   1396  1.2  christos         if (ACPI_FAILURE (Status))
   1397  1.2  christos         {
   1398  1.2  christos             return;
   1399  1.2  christos         }
   1400  1.2  christos 
   1401  1.9  christos NextSubtable:
   1402  1.2  christos         /* Point to next subtable */
   1403  1.2  christos 
   1404  1.9  christos         Offset += Subtable->Length;
   1405  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable,
   1406  1.9  christos             Subtable->Length);
   1407  1.2  christos     }
   1408  1.2  christos }
   1409  1.2  christos 
   1410  1.2  christos 
   1411  1.2  christos /*******************************************************************************
   1412  1.2  christos  *
   1413  1.2  christos  * FUNCTION:    AcpiDmDumpGtdt
   1414  1.2  christos  *
   1415  1.2  christos  * PARAMETERS:  Table               - A GTDT table
   1416  1.2  christos  *
   1417  1.2  christos  * RETURN:      None
   1418  1.2  christos  *
   1419  1.2  christos  * DESCRIPTION: Format the contents of a GTDT. This table type consists
   1420  1.2  christos  *              of an open-ended number of subtables.
   1421  1.2  christos  *
   1422  1.2  christos  ******************************************************************************/
   1423  1.2  christos 
   1424  1.2  christos void
   1425  1.2  christos AcpiDmDumpGtdt (
   1426  1.2  christos     ACPI_TABLE_HEADER       *Table)
   1427  1.2  christos {
   1428  1.2  christos     ACPI_STATUS             Status;
   1429  1.9  christos     ACPI_GTDT_HEADER        *Subtable;
   1430  1.2  christos     UINT32                  Length = Table->Length;
   1431  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
   1432  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1433  1.9  christos     UINT32                  SubtableLength;
   1434  1.2  christos     UINT32                  GtCount;
   1435  1.2  christos     ACPI_GTDT_TIMER_ENTRY   *GtxTable;
   1436  1.2  christos 
   1437  1.2  christos 
   1438  1.2  christos     /* Main table */
   1439  1.2  christos 
   1440  1.2  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
   1441  1.2  christos     if (ACPI_FAILURE (Status))
   1442  1.2  christos     {
   1443  1.2  christos         return;
   1444  1.2  christos     }
   1445  1.2  christos 
   1446  1.2  christos     /* Subtables */
   1447  1.2  christos 
   1448  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
   1449  1.2  christos     while (Offset < Table->Length)
   1450  1.2  christos     {
   1451  1.2  christos         /* Common subtable header */
   1452  1.2  christos 
   1453  1.2  christos         AcpiOsPrintf ("\n");
   1454  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1455  1.9  christos             Subtable->Length, AcpiDmTableInfoGtdtHdr);
   1456  1.2  christos         if (ACPI_FAILURE (Status))
   1457  1.2  christos         {
   1458  1.2  christos             return;
   1459  1.2  christos         }
   1460  1.2  christos 
   1461  1.2  christos         GtCount = 0;
   1462  1.9  christos         switch (Subtable->Type)
   1463  1.2  christos         {
   1464  1.2  christos         case ACPI_GTDT_TYPE_TIMER_BLOCK:
   1465  1.2  christos 
   1466  1.9  christos             SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
   1467  1.2  christos             GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
   1468  1.9  christos                 Subtable))->TimerCount;
   1469  1.2  christos 
   1470  1.2  christos             InfoTable = AcpiDmTableInfoGtdt0;
   1471  1.2  christos             break;
   1472  1.2  christos 
   1473  1.2  christos         case ACPI_GTDT_TYPE_WATCHDOG:
   1474  1.2  christos 
   1475  1.9  christos             SubtableLength = sizeof (ACPI_GTDT_WATCHDOG);
   1476  1.2  christos 
   1477  1.2  christos             InfoTable = AcpiDmTableInfoGtdt1;
   1478  1.2  christos             break;
   1479  1.2  christos 
   1480  1.2  christos         default:
   1481  1.2  christos 
   1482  1.2  christos             /* Cannot continue on unknown type - no length */
   1483  1.2  christos 
   1484  1.4  christos             AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n",
   1485  1.9  christos                 Subtable->Type);
   1486  1.2  christos             return;
   1487  1.2  christos         }
   1488  1.2  christos 
   1489  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1490  1.9  christos             Subtable->Length, InfoTable);
   1491  1.2  christos         if (ACPI_FAILURE (Status))
   1492  1.2  christos         {
   1493  1.2  christos             return;
   1494  1.2  christos         }
   1495  1.2  christos 
   1496  1.2  christos         /* Point to end of current subtable (each subtable above is of fixed length) */
   1497  1.2  christos 
   1498  1.9  christos         Offset += SubtableLength;
   1499  1.2  christos 
   1500  1.2  christos         /* If there are any Gt Timer Blocks from above, dump them now */
   1501  1.2  christos 
   1502  1.2  christos         if (GtCount)
   1503  1.2  christos         {
   1504  1.4  christos             GtxTable = ACPI_ADD_PTR (
   1505  1.9  christos                 ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength);
   1506  1.9  christos             SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
   1507  1.2  christos 
   1508  1.2  christos             while (GtCount)
   1509  1.2  christos             {
   1510  1.2  christos                 AcpiOsPrintf ("\n");
   1511  1.2  christos                 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
   1512  1.4  christos                     sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
   1513  1.2  christos                 if (ACPI_FAILURE (Status))
   1514  1.2  christos                 {
   1515  1.2  christos                     return;
   1516  1.2  christos                 }
   1517  1.2  christos                 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
   1518  1.2  christos                 GtxTable++;
   1519  1.2  christos                 GtCount--;
   1520  1.2  christos             }
   1521  1.2  christos         }
   1522  1.2  christos 
   1523  1.2  christos         /* Point to next subtable */
   1524  1.2  christos 
   1525  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength);
   1526  1.2  christos     }
   1527  1.2  christos }
   1528  1.2  christos 
   1529  1.2  christos 
   1530  1.2  christos /*******************************************************************************
   1531  1.2  christos  *
   1532  1.2  christos  * FUNCTION:    AcpiDmDumpHest
   1533  1.2  christos  *
   1534  1.2  christos  * PARAMETERS:  Table               - A HEST table
   1535  1.2  christos  *
   1536  1.2  christos  * RETURN:      None
   1537  1.2  christos  *
   1538  1.2  christos  * DESCRIPTION: Format the contents of a HEST. This table type consists
   1539  1.2  christos  *              of an open-ended number of subtables.
   1540  1.2  christos  *
   1541  1.2  christos  ******************************************************************************/
   1542  1.2  christos 
   1543  1.2  christos void
   1544  1.2  christos AcpiDmDumpHest (
   1545  1.2  christos     ACPI_TABLE_HEADER       *Table)
   1546  1.2  christos {
   1547  1.2  christos     ACPI_STATUS             Status;
   1548  1.9  christos     ACPI_HEST_HEADER        *Subtable;
   1549  1.2  christos     UINT32                  Length = Table->Length;
   1550  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
   1551  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   1552  1.9  christos     UINT32                  SubtableLength;
   1553  1.1    jruoho     UINT32                  BankCount;
   1554  1.1    jruoho     ACPI_HEST_IA_ERROR_BANK *BankTable;
   1555  1.1    jruoho 
   1556  1.1    jruoho 
   1557  1.1    jruoho     /* Main table */
   1558  1.1    jruoho 
   1559  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
   1560  1.1    jruoho     if (ACPI_FAILURE (Status))
   1561  1.1    jruoho     {
   1562  1.1    jruoho         return;
   1563  1.1    jruoho     }
   1564  1.1    jruoho 
   1565  1.2  christos     /* Subtables */
   1566  1.1    jruoho 
   1567  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
   1568  1.1    jruoho     while (Offset < Table->Length)
   1569  1.1    jruoho     {
   1570  1.1    jruoho         BankCount = 0;
   1571  1.9  christos         switch (Subtable->Type)
   1572  1.1    jruoho         {
   1573  1.1    jruoho         case ACPI_HEST_TYPE_IA32_CHECK:
   1574  1.2  christos 
   1575  1.1    jruoho             InfoTable = AcpiDmTableInfoHest0;
   1576  1.9  christos             SubtableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
   1577  1.1    jruoho             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
   1578  1.9  christos                 Subtable))->NumHardwareBanks;
   1579  1.1    jruoho             break;
   1580  1.1    jruoho 
   1581  1.1    jruoho         case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
   1582  1.2  christos 
   1583  1.1    jruoho             InfoTable = AcpiDmTableInfoHest1;
   1584  1.9  christos             SubtableLength = sizeof (ACPI_HEST_IA_CORRECTED);
   1585  1.1    jruoho             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
   1586  1.9  christos                 Subtable))->NumHardwareBanks;
   1587  1.1    jruoho             break;
   1588  1.1    jruoho 
   1589  1.1    jruoho         case ACPI_HEST_TYPE_IA32_NMI:
   1590  1.2  christos 
   1591  1.1    jruoho             InfoTable = AcpiDmTableInfoHest2;
   1592  1.9  christos             SubtableLength = sizeof (ACPI_HEST_IA_NMI);
   1593  1.1    jruoho             break;
   1594  1.1    jruoho 
   1595  1.1    jruoho         case ACPI_HEST_TYPE_AER_ROOT_PORT:
   1596  1.2  christos 
   1597  1.1    jruoho             InfoTable = AcpiDmTableInfoHest6;
   1598  1.9  christos             SubtableLength = sizeof (ACPI_HEST_AER_ROOT);
   1599  1.1    jruoho             break;
   1600  1.1    jruoho 
   1601  1.1    jruoho         case ACPI_HEST_TYPE_AER_ENDPOINT:
   1602  1.2  christos 
   1603  1.1    jruoho             InfoTable = AcpiDmTableInfoHest7;
   1604  1.9  christos             SubtableLength = sizeof (ACPI_HEST_AER);
   1605  1.1    jruoho             break;
   1606  1.1    jruoho 
   1607  1.1    jruoho         case ACPI_HEST_TYPE_AER_BRIDGE:
   1608  1.2  christos 
   1609  1.1    jruoho             InfoTable = AcpiDmTableInfoHest8;
   1610  1.9  christos             SubtableLength = sizeof (ACPI_HEST_AER_BRIDGE);
   1611  1.1    jruoho             break;
   1612  1.1    jruoho 
   1613  1.1    jruoho         case ACPI_HEST_TYPE_GENERIC_ERROR:
   1614  1.2  christos 
   1615  1.1    jruoho             InfoTable = AcpiDmTableInfoHest9;
   1616  1.9  christos             SubtableLength = sizeof (ACPI_HEST_GENERIC);
   1617  1.1    jruoho             break;
   1618  1.1    jruoho 
   1619  1.5  christos         case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
   1620  1.5  christos 
   1621  1.5  christos             InfoTable = AcpiDmTableInfoHest10;
   1622  1.9  christos             SubtableLength = sizeof (ACPI_HEST_GENERIC_V2);
   1623  1.5  christos             break;
   1624  1.5  christos 
   1625  1.8  christos         case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
   1626  1.8  christos 
   1627  1.8  christos             InfoTable = AcpiDmTableInfoHest11;
   1628  1.9  christos             SubtableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK);
   1629  1.8  christos             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK,
   1630  1.9  christos                 Subtable))->NumHardwareBanks;
   1631  1.8  christos             break;
   1632  1.8  christos 
   1633  1.1    jruoho         default:
   1634  1.2  christos 
   1635  1.1    jruoho             /* Cannot continue on unknown type - no length */
   1636  1.1    jruoho 
   1637  1.4  christos             AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
   1638  1.9  christos                 Subtable->Type);
   1639  1.1    jruoho             return;
   1640  1.1    jruoho         }
   1641  1.1    jruoho 
   1642  1.1    jruoho         AcpiOsPrintf ("\n");
   1643  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   1644  1.9  christos             SubtableLength, InfoTable);
   1645  1.1    jruoho         if (ACPI_FAILURE (Status))
   1646  1.1    jruoho         {
   1647  1.1    jruoho             return;
   1648  1.1    jruoho         }
   1649  1.1    jruoho 
   1650  1.1    jruoho         /* Point to end of current subtable (each subtable above is of fixed length) */
   1651  1.1    jruoho 
   1652  1.9  christos         Offset += SubtableLength;
   1653  1.1    jruoho 
   1654  1.1    jruoho         /* If there are any (fixed-length) Error Banks from above, dump them now */
   1655  1.1    jruoho 
   1656  1.1    jruoho         if (BankCount)
   1657  1.1    jruoho         {
   1658  1.9  christos             BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, Subtable,
   1659  1.9  christos                 SubtableLength);
   1660  1.9  christos             SubtableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
   1661  1.3  christos 
   1662  1.3  christos             while (BankCount)
   1663  1.3  christos             {
   1664  1.3  christos                 AcpiOsPrintf ("\n");
   1665  1.3  christos                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
   1666  1.4  christos                     sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
   1667  1.3  christos                 if (ACPI_FAILURE (Status))
   1668  1.3  christos                 {
   1669  1.3  christos                     return;
   1670  1.3  christos                 }
   1671  1.4  christos 
   1672  1.3  christos                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
   1673  1.3  christos                 BankTable++;
   1674  1.3  christos                 BankCount--;
   1675  1.3  christos             }
   1676  1.3  christos         }
   1677  1.3  christos 
   1678  1.3  christos         /* Point to next subtable */
   1679  1.3  christos 
   1680  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Subtable, SubtableLength);
   1681  1.3  christos     }
   1682  1.3  christos }
   1683  1.3  christos 
   1684  1.3  christos 
   1685  1.3  christos /*******************************************************************************
   1686  1.3  christos  *
   1687  1.8  christos  * FUNCTION:    AcpiDmDumpHmat
   1688  1.8  christos  *
   1689  1.8  christos  * PARAMETERS:  Table               - A HMAT table
   1690  1.8  christos  *
   1691  1.8  christos  * RETURN:      None
   1692  1.8  christos  *
   1693  1.8  christos  * DESCRIPTION: Format the contents of a HMAT.
   1694  1.8  christos  *
   1695  1.8  christos  ******************************************************************************/
   1696  1.8  christos 
   1697  1.8  christos void
   1698  1.8  christos AcpiDmDumpHmat (
   1699  1.8  christos     ACPI_TABLE_HEADER       *Table)
   1700  1.8  christos {
   1701  1.8  christos     ACPI_STATUS             Status;
   1702  1.8  christos     ACPI_HMAT_STRUCTURE     *HmatStruct;
   1703  1.8  christos     ACPI_HMAT_LOCALITY      *HmatLocality;
   1704  1.8  christos     ACPI_HMAT_CACHE         *HmatCache;
   1705  1.8  christos     UINT32                  Offset;
   1706  1.9  christos     UINT32                  SubtableOffset;
   1707  1.8  christos     UINT32                  Length;
   1708  1.8  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1709  1.8  christos     UINT32                  i, j;
   1710  1.8  christos 
   1711  1.8  christos 
   1712  1.8  christos     /* Main table */
   1713  1.8  christos 
   1714  1.8  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat);
   1715  1.8  christos     if (ACPI_FAILURE (Status))
   1716  1.8  christos     {
   1717  1.8  christos         return;
   1718  1.8  christos     }
   1719  1.8  christos     Offset = sizeof (ACPI_TABLE_HMAT);
   1720  1.8  christos 
   1721  1.8  christos     while (Offset < Table->Length)
   1722  1.8  christos     {
   1723  1.8  christos         AcpiOsPrintf ("\n");
   1724  1.9  christos         SubtableOffset = 0;
   1725  1.8  christos 
   1726  1.8  christos         /* Dump HMAT structure header */
   1727  1.8  christos 
   1728  1.8  christos         HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset);
   1729  1.8  christos         if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE))
   1730  1.8  christos         {
   1731  1.8  christos             AcpiOsPrintf ("Invalid HMAT structure length\n");
   1732  1.8  christos             return;
   1733  1.8  christos         }
   1734  1.8  christos         Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
   1735  1.8  christos             HmatStruct->Length, AcpiDmTableInfoHmatHdr);
   1736  1.8  christos         if (ACPI_FAILURE (Status))
   1737  1.8  christos         {
   1738  1.8  christos             return;
   1739  1.8  christos         }
   1740  1.8  christos 
   1741  1.8  christos         switch (HmatStruct->Type)
   1742  1.8  christos         {
   1743  1.8  christos         case ACPI_HMAT_TYPE_ADDRESS_RANGE:
   1744  1.8  christos 
   1745  1.8  christos             InfoTable = AcpiDmTableInfoHmat0;
   1746  1.8  christos             Length = sizeof (ACPI_HMAT_ADDRESS_RANGE);
   1747  1.8  christos             break;
   1748  1.8  christos 
   1749  1.8  christos         case ACPI_HMAT_TYPE_LOCALITY:
   1750  1.8  christos 
   1751  1.8  christos             InfoTable = AcpiDmTableInfoHmat1;
   1752  1.8  christos             Length = sizeof (ACPI_HMAT_LOCALITY);
   1753  1.8  christos             break;
   1754  1.8  christos 
   1755  1.8  christos         case ACPI_HMAT_TYPE_CACHE:
   1756  1.8  christos 
   1757  1.8  christos             InfoTable = AcpiDmTableInfoHmat2;
   1758  1.8  christos             Length = sizeof (ACPI_HMAT_CACHE);
   1759  1.8  christos             break;
   1760  1.8  christos 
   1761  1.8  christos         default:
   1762  1.8  christos 
   1763  1.8  christos             AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n",
   1764  1.8  christos                 HmatStruct->Type);
   1765  1.8  christos 
   1766  1.8  christos             /* Attempt to continue */
   1767  1.8  christos 
   1768  1.9  christos             goto NextSubtable;
   1769  1.8  christos         }
   1770  1.8  christos 
   1771  1.8  christos         /* Dump HMAT structure body */
   1772  1.8  christos 
   1773  1.8  christos         if (HmatStruct->Length < Length)
   1774  1.8  christos         {
   1775  1.8  christos             AcpiOsPrintf ("Invalid HMAT structure length\n");
   1776  1.8  christos             return;
   1777  1.8  christos         }
   1778  1.8  christos         Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
   1779  1.8  christos             HmatStruct->Length, InfoTable);
   1780  1.8  christos         if (ACPI_FAILURE (Status))
   1781  1.8  christos         {
   1782  1.8  christos             return;
   1783  1.8  christos         }
   1784  1.8  christos 
   1785  1.8  christos         /* Dump HMAT structure additionals */
   1786  1.8  christos 
   1787  1.8  christos         switch (HmatStruct->Type)
   1788  1.8  christos         {
   1789  1.8  christos         case ACPI_HMAT_TYPE_LOCALITY:
   1790  1.8  christos 
   1791  1.8  christos             HmatLocality = ACPI_CAST_PTR (ACPI_HMAT_LOCALITY, HmatStruct);
   1792  1.9  christos             SubtableOffset = sizeof (ACPI_HMAT_LOCALITY);
   1793  1.8  christos 
   1794  1.8  christos             /* Dump initiator proximity domains */
   1795  1.8  christos 
   1796  1.9  christos             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
   1797  1.8  christos                 (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4))
   1798  1.8  christos             {
   1799  1.8  christos                 AcpiOsPrintf ("Invalid initiator proximity domain number\n");
   1800  1.8  christos                 return;
   1801  1.8  christos             }
   1802  1.8  christos             for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
   1803  1.8  christos             {
   1804  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   1805  1.9  christos                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
   1806  1.8  christos                     4, AcpiDmTableInfoHmat1a);
   1807  1.9  christos                 SubtableOffset += 4;
   1808  1.8  christos             }
   1809  1.8  christos 
   1810  1.8  christos             /* Dump target proximity domains */
   1811  1.8  christos 
   1812  1.9  christos             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
   1813  1.8  christos                 (UINT32)(HmatLocality->NumberOfTargetPDs * 4))
   1814  1.8  christos             {
   1815  1.8  christos                 AcpiOsPrintf ("Invalid target proximity domain number\n");
   1816  1.8  christos                 return;
   1817  1.8  christos             }
   1818  1.8  christos             for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++)
   1819  1.8  christos             {
   1820  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   1821  1.9  christos                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
   1822  1.8  christos                     4, AcpiDmTableInfoHmat1b);
   1823  1.9  christos                 SubtableOffset += 4;
   1824  1.8  christos             }
   1825  1.8  christos 
   1826  1.8  christos             /* Dump latency/bandwidth entris */
   1827  1.8  christos 
   1828  1.9  christos             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
   1829  1.8  christos                 (UINT32)(HmatLocality->NumberOfInitiatorPDs *
   1830  1.8  christos                          HmatLocality->NumberOfTargetPDs * 2))
   1831  1.8  christos             {
   1832  1.8  christos                 AcpiOsPrintf ("Invalid latency/bandwidth entry number\n");
   1833  1.8  christos                 return;
   1834  1.8  christos             }
   1835  1.8  christos             for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
   1836  1.8  christos             {
   1837  1.8  christos                 for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++)
   1838  1.8  christos                 {
   1839  1.9  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   1840  1.9  christos                         ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
   1841  1.8  christos                         2, AcpiDmTableInfoHmat1c);
   1842  1.9  christos                     SubtableOffset += 2;
   1843  1.8  christos                 }
   1844  1.8  christos             }
   1845  1.8  christos             break;
   1846  1.8  christos 
   1847  1.8  christos         case ACPI_HMAT_TYPE_CACHE:
   1848  1.8  christos 
   1849  1.8  christos             HmatCache = ACPI_CAST_PTR (ACPI_HMAT_CACHE, HmatStruct);
   1850  1.9  christos             SubtableOffset = sizeof (ACPI_HMAT_CACHE);
   1851  1.8  christos 
   1852  1.8  christos             /* Dump SMBIOS handles */
   1853  1.8  christos 
   1854  1.9  christos             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
   1855  1.8  christos                 (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2))
   1856  1.8  christos             {
   1857  1.8  christos                 AcpiOsPrintf ("Invalid SMBIOS handle number\n");
   1858  1.8  christos                 return;
   1859  1.8  christos             }
   1860  1.8  christos             for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++)
   1861  1.8  christos             {
   1862  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   1863  1.9  christos                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
   1864  1.8  christos                     2, AcpiDmTableInfoHmat2a);
   1865  1.9  christos                 SubtableOffset += 2;
   1866  1.8  christos             }
   1867  1.8  christos             break;
   1868  1.8  christos 
   1869  1.8  christos         default:
   1870  1.8  christos 
   1871  1.8  christos             break;
   1872  1.8  christos         }
   1873  1.8  christos 
   1874  1.9  christos NextSubtable:
   1875  1.8  christos         /* Point to next HMAT structure subtable */
   1876  1.8  christos 
   1877  1.8  christos         Offset += (HmatStruct->Length);
   1878  1.8  christos     }
   1879  1.8  christos }
   1880  1.8  christos 
   1881  1.8  christos 
   1882  1.8  christos /*******************************************************************************
   1883  1.8  christos  *
   1884  1.3  christos  * FUNCTION:    AcpiDmDumpIort
   1885  1.3  christos  *
   1886  1.3  christos  * PARAMETERS:  Table               - A IORT table
   1887  1.3  christos  *
   1888  1.3  christos  * RETURN:      None
   1889  1.3  christos  *
   1890  1.3  christos  * DESCRIPTION: Format the contents of a IORT
   1891  1.3  christos  *
   1892  1.3  christos  ******************************************************************************/
   1893  1.3  christos 
   1894  1.3  christos void
   1895  1.3  christos AcpiDmDumpIort (
   1896  1.3  christos     ACPI_TABLE_HEADER       *Table)
   1897  1.3  christos {
   1898  1.3  christos     ACPI_STATUS             Status;
   1899  1.3  christos     ACPI_TABLE_IORT         *Iort;
   1900  1.3  christos     ACPI_IORT_NODE          *IortNode;
   1901  1.3  christos     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
   1902  1.3  christos     ACPI_IORT_SMMU          *IortSmmu = NULL;
   1903  1.3  christos     UINT32                  Offset;
   1904  1.3  christos     UINT32                  NodeOffset;
   1905  1.3  christos     UINT32                  Length;
   1906  1.3  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1907  1.3  christos     char                    *String;
   1908  1.3  christos     UINT32                  i;
   1909  1.3  christos 
   1910  1.3  christos 
   1911  1.3  christos     /* Main table */
   1912  1.3  christos 
   1913  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
   1914  1.3  christos     if (ACPI_FAILURE (Status))
   1915  1.3  christos     {
   1916  1.3  christos         return;
   1917  1.3  christos     }
   1918  1.3  christos 
   1919  1.3  christos     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
   1920  1.3  christos     Offset = sizeof (ACPI_TABLE_IORT);
   1921  1.3  christos 
   1922  1.3  christos     /* Dump the OptionalPadding (optional) */
   1923  1.3  christos 
   1924  1.3  christos     if (Iort->NodeOffset > Offset)
   1925  1.3  christos     {
   1926  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
   1927  1.4  christos             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
   1928  1.3  christos         if (ACPI_FAILURE (Status))
   1929  1.3  christos         {
   1930  1.3  christos             return;
   1931  1.3  christos         }
   1932  1.3  christos     }
   1933  1.3  christos 
   1934  1.3  christos     Offset = Iort->NodeOffset;
   1935  1.3  christos     while (Offset < Table->Length)
   1936  1.3  christos     {
   1937  1.3  christos         /* Common subtable header */
   1938  1.3  christos 
   1939  1.3  christos         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
   1940  1.3  christos         AcpiOsPrintf ("\n");
   1941  1.3  christos         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
   1942  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset,
   1943  1.4  christos             IortNode, Length, AcpiDmTableInfoIortHdr);
   1944  1.3  christos         if (ACPI_FAILURE (Status))
   1945  1.3  christos         {
   1946  1.3  christos             return;
   1947  1.3  christos         }
   1948  1.3  christos 
   1949  1.3  christos         NodeOffset = Length;
   1950  1.3  christos 
   1951  1.3  christos         switch (IortNode->Type)
   1952  1.3  christos         {
   1953  1.3  christos         case ACPI_IORT_NODE_ITS_GROUP:
   1954  1.3  christos 
   1955  1.3  christos             InfoTable = AcpiDmTableInfoIort0;
   1956  1.3  christos             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
   1957  1.3  christos             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
   1958  1.3  christos             break;
   1959  1.3  christos 
   1960  1.3  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
   1961  1.3  christos 
   1962  1.3  christos             InfoTable = AcpiDmTableInfoIort1;
   1963  1.3  christos             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
   1964  1.3  christos             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
   1965  1.3  christos             Length += strlen (String) + 1;
   1966  1.3  christos             break;
   1967  1.3  christos 
   1968  1.3  christos         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
   1969  1.3  christos 
   1970  1.3  christos             InfoTable = AcpiDmTableInfoIort2;
   1971  1.3  christos             Length = IortNode->Length - NodeOffset;
   1972  1.3  christos             break;
   1973  1.3  christos 
   1974  1.3  christos         case ACPI_IORT_NODE_SMMU:
   1975  1.3  christos 
   1976  1.3  christos             InfoTable = AcpiDmTableInfoIort3;
   1977  1.3  christos             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
   1978  1.3  christos             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
   1979  1.3  christos             break;
   1980  1.3  christos 
   1981  1.5  christos         case ACPI_IORT_NODE_SMMU_V3:
   1982  1.5  christos 
   1983  1.5  christos             InfoTable = AcpiDmTableInfoIort4;
   1984  1.5  christos             Length = IortNode->Length - NodeOffset;
   1985  1.5  christos             break;
   1986  1.5  christos 
   1987  1.3  christos         default:
   1988  1.3  christos 
   1989  1.3  christos             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
   1990  1.3  christos                 IortNode->Type);
   1991  1.3  christos 
   1992  1.3  christos             /* Attempt to continue */
   1993  1.3  christos 
   1994  1.3  christos             if (!IortNode->Length)
   1995  1.3  christos             {
   1996  1.3  christos                 AcpiOsPrintf ("Invalid zero length IORT node\n");
   1997  1.3  christos                 return;
   1998  1.3  christos             }
   1999  1.9  christos             goto NextSubtable;
   2000  1.3  christos         }
   2001  1.3  christos 
   2002  1.3  christos         /* Dump the node subtable header */
   2003  1.3  christos 
   2004  1.3  christos         AcpiOsPrintf ("\n");
   2005  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2006  1.4  christos             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   2007  1.4  christos             Length, InfoTable);
   2008  1.3  christos         if (ACPI_FAILURE (Status))
   2009  1.3  christos         {
   2010  1.3  christos             return;
   2011  1.3  christos         }
   2012  1.3  christos 
   2013  1.3  christos         NodeOffset += Length;
   2014  1.3  christos 
   2015  1.3  christos         /* Dump the node specific data */
   2016  1.3  christos 
   2017  1.3  christos         switch (IortNode->Type)
   2018  1.3  christos         {
   2019  1.3  christos         case ACPI_IORT_NODE_ITS_GROUP:
   2020  1.3  christos 
   2021  1.3  christos             /* Validate IortItsGroup to avoid compiler warnings */
   2022  1.3  christos 
   2023  1.3  christos             if (IortItsGroup)
   2024  1.3  christos             {
   2025  1.3  christos                 for (i = 0; i < IortItsGroup->ItsCount; i++)
   2026  1.3  christos                 {
   2027  1.3  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2028  1.4  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   2029  1.4  christos                         4, AcpiDmTableInfoIort0a);
   2030  1.3  christos                     NodeOffset += 4;
   2031  1.3  christos                 }
   2032  1.3  christos             }
   2033  1.3  christos             break;
   2034  1.3  christos 
   2035  1.3  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
   2036  1.3  christos 
   2037  1.3  christos             /* Dump the Padding (optional) */
   2038  1.3  christos 
   2039  1.3  christos             if (IortNode->Length > NodeOffset)
   2040  1.3  christos             {
   2041  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2042  1.4  christos                     Table, IortNode->Length - NodeOffset,
   2043  1.4  christos                     AcpiDmTableInfoIort1a);
   2044  1.3  christos                 if (ACPI_FAILURE (Status))
   2045  1.3  christos                 {
   2046  1.3  christos                     return;
   2047  1.3  christos                 }
   2048  1.3  christos             }
   2049  1.3  christos             break;
   2050  1.3  christos 
   2051  1.3  christos         case ACPI_IORT_NODE_SMMU:
   2052  1.3  christos 
   2053  1.3  christos             AcpiOsPrintf ("\n");
   2054  1.3  christos 
   2055  1.3  christos             /* Validate IortSmmu to avoid compiler warnings */
   2056  1.3  christos 
   2057  1.3  christos             if (IortSmmu)
   2058  1.3  christos             {
   2059  1.3  christos                 Length = 2 * sizeof (UINT64);
   2060  1.3  christos                 NodeOffset = IortSmmu->GlobalInterruptOffset;
   2061  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2062  1.4  christos                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   2063  1.4  christos                     Length, AcpiDmTableInfoIort3a);
   2064  1.3  christos                 if (ACPI_FAILURE (Status))
   2065  1.3  christos                 {
   2066  1.3  christos                     return;
   2067  1.3  christos                 }
   2068  1.3  christos 
   2069  1.3  christos                 NodeOffset = IortSmmu->ContextInterruptOffset;
   2070  1.3  christos                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
   2071  1.3  christos                 {
   2072  1.3  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2073  1.4  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   2074  1.4  christos                         8, AcpiDmTableInfoIort3b);
   2075  1.3  christos                     if (ACPI_FAILURE (Status))
   2076  1.3  christos                     {
   2077  1.3  christos                         return;
   2078  1.3  christos                     }
   2079  1.4  christos 
   2080  1.3  christos                     NodeOffset += 8;
   2081  1.3  christos                 }
   2082  1.3  christos 
   2083  1.3  christos                 NodeOffset = IortSmmu->PmuInterruptOffset;
   2084  1.3  christos                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
   2085  1.3  christos                 {
   2086  1.3  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2087  1.4  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   2088  1.4  christos                         8, AcpiDmTableInfoIort3c);
   2089  1.3  christos                     if (ACPI_FAILURE (Status))
   2090  1.3  christos                     {
   2091  1.3  christos                         return;
   2092  1.3  christos                     }
   2093  1.4  christos 
   2094  1.3  christos                     NodeOffset += 8;
   2095  1.3  christos                 }
   2096  1.3  christos             }
   2097  1.3  christos             break;
   2098  1.3  christos 
   2099  1.3  christos         default:
   2100  1.3  christos 
   2101  1.3  christos             break;
   2102  1.3  christos         }
   2103  1.3  christos 
   2104  1.3  christos         /* Dump the ID mappings */
   2105  1.3  christos 
   2106  1.3  christos         NodeOffset = IortNode->MappingOffset;
   2107  1.3  christos         for (i = 0; i < IortNode->MappingCount; i++)
   2108  1.3  christos         {
   2109  1.3  christos             AcpiOsPrintf ("\n");
   2110  1.3  christos             Length = sizeof (ACPI_IORT_ID_MAPPING);
   2111  1.3  christos             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   2112  1.4  christos                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   2113  1.4  christos                 Length, AcpiDmTableInfoIortMap);
   2114  1.3  christos             if (ACPI_FAILURE (Status))
   2115  1.1    jruoho             {
   2116  1.3  christos                 return;
   2117  1.1    jruoho             }
   2118  1.4  christos 
   2119  1.3  christos             NodeOffset += Length;
   2120  1.1    jruoho         }
   2121  1.1    jruoho 
   2122  1.9  christos NextSubtable:
   2123  1.3  christos         /* Point to next node subtable */
   2124  1.1    jruoho 
   2125  1.3  christos         Offset += IortNode->Length;
   2126  1.3  christos         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
   2127  1.1    jruoho     }
   2128  1.1    jruoho }
   2129  1.1    jruoho 
   2130  1.1    jruoho 
   2131  1.1    jruoho /*******************************************************************************
   2132  1.1    jruoho  *
   2133  1.1    jruoho  * FUNCTION:    AcpiDmDumpIvrs
   2134  1.1    jruoho  *
   2135  1.1    jruoho  * PARAMETERS:  Table               - A IVRS table
   2136  1.1    jruoho  *
   2137  1.1    jruoho  * RETURN:      None
   2138  1.1    jruoho  *
   2139  1.1    jruoho  * DESCRIPTION: Format the contents of a IVRS
   2140  1.1    jruoho  *
   2141  1.1    jruoho  ******************************************************************************/
   2142  1.1    jruoho 
   2143  1.1    jruoho static UINT8 EntrySizes[] = {4,8,16,32};
   2144  1.1    jruoho 
   2145  1.1    jruoho void
   2146  1.1    jruoho AcpiDmDumpIvrs (
   2147  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2148  1.1    jruoho {
   2149  1.1    jruoho     ACPI_STATUS             Status;
   2150  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
   2151  1.1    jruoho     UINT32                  EntryOffset;
   2152  1.1    jruoho     UINT32                  EntryLength;
   2153  1.1    jruoho     UINT32                  EntryType;
   2154  1.1    jruoho     ACPI_IVRS_DE_HEADER     *DeviceEntry;
   2155  1.9  christos     ACPI_IVRS_HEADER        *Subtable;
   2156  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   2157  1.1    jruoho 
   2158  1.1    jruoho 
   2159  1.1    jruoho     /* Main table */
   2160  1.1    jruoho 
   2161  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
   2162  1.1    jruoho     if (ACPI_FAILURE (Status))
   2163  1.1    jruoho     {
   2164  1.1    jruoho         return;
   2165  1.1    jruoho     }
   2166  1.1    jruoho 
   2167  1.2  christos     /* Subtables */
   2168  1.1    jruoho 
   2169  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
   2170  1.1    jruoho     while (Offset < Table->Length)
   2171  1.1    jruoho     {
   2172  1.2  christos         /* Common subtable header */
   2173  1.1    jruoho 
   2174  1.1    jruoho         AcpiOsPrintf ("\n");
   2175  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2176  1.9  christos             Subtable->Length, AcpiDmTableInfoIvrsHdr);
   2177  1.1    jruoho         if (ACPI_FAILURE (Status))
   2178  1.1    jruoho         {
   2179  1.1    jruoho             return;
   2180  1.1    jruoho         }
   2181  1.1    jruoho 
   2182  1.9  christos         switch (Subtable->Type)
   2183  1.1    jruoho         {
   2184  1.1    jruoho         case ACPI_IVRS_TYPE_HARDWARE:
   2185  1.2  christos 
   2186  1.1    jruoho             InfoTable = AcpiDmTableInfoIvrs0;
   2187  1.1    jruoho             break;
   2188  1.2  christos 
   2189  1.1    jruoho         case ACPI_IVRS_TYPE_MEMORY1:
   2190  1.1    jruoho         case ACPI_IVRS_TYPE_MEMORY2:
   2191  1.1    jruoho         case ACPI_IVRS_TYPE_MEMORY3:
   2192  1.2  christos 
   2193  1.1    jruoho             InfoTable = AcpiDmTableInfoIvrs1;
   2194  1.1    jruoho             break;
   2195  1.2  christos 
   2196  1.1    jruoho         default:
   2197  1.2  christos 
   2198  1.2  christos             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
   2199  1.9  christos                 Subtable->Type);
   2200  1.1    jruoho 
   2201  1.1    jruoho             /* Attempt to continue */
   2202  1.1    jruoho 
   2203  1.9  christos             if (!Subtable->Length)
   2204  1.1    jruoho             {
   2205  1.1    jruoho                 AcpiOsPrintf ("Invalid zero length subtable\n");
   2206  1.1    jruoho                 return;
   2207  1.1    jruoho             }
   2208  1.9  christos             goto NextSubtable;
   2209  1.1    jruoho         }
   2210  1.1    jruoho 
   2211  1.1    jruoho         /* Dump the subtable */
   2212  1.1    jruoho 
   2213  1.1    jruoho         AcpiOsPrintf ("\n");
   2214  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2215  1.9  christos             Subtable->Length, InfoTable);
   2216  1.1    jruoho         if (ACPI_FAILURE (Status))
   2217  1.1    jruoho         {
   2218  1.1    jruoho             return;
   2219  1.1    jruoho         }
   2220  1.1    jruoho 
   2221  1.1    jruoho         /* The hardware subtable can contain multiple device entries */
   2222  1.1    jruoho 
   2223  1.9  christos         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE)
   2224  1.1    jruoho         {
   2225  1.1    jruoho             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
   2226  1.9  christos             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
   2227  1.4  christos                 sizeof (ACPI_IVRS_HARDWARE));
   2228  1.1    jruoho 
   2229  1.9  christos             while (EntryOffset < (Offset + Subtable->Length))
   2230  1.1    jruoho             {
   2231  1.1    jruoho                 AcpiOsPrintf ("\n");
   2232  1.1    jruoho                 /*
   2233  1.1    jruoho                  * Upper 2 bits of Type encode the length of the device entry
   2234  1.1    jruoho                  *
   2235  1.1    jruoho                  * 00 = 4 byte
   2236  1.1    jruoho                  * 01 = 8 byte
   2237  1.1    jruoho                  * 10 = 16 byte - currently no entries defined
   2238  1.1    jruoho                  * 11 = 32 byte - currently no entries defined
   2239  1.1    jruoho                  */
   2240  1.1    jruoho                 EntryType = DeviceEntry->Type;
   2241  1.1    jruoho                 EntryLength = EntrySizes [EntryType >> 6];
   2242  1.1    jruoho 
   2243  1.1    jruoho                 switch (EntryType)
   2244  1.1    jruoho                 {
   2245  1.1    jruoho                 /* 4-byte device entries */
   2246  1.1    jruoho 
   2247  1.1    jruoho                 case ACPI_IVRS_TYPE_PAD4:
   2248  1.1    jruoho                 case ACPI_IVRS_TYPE_ALL:
   2249  1.1    jruoho                 case ACPI_IVRS_TYPE_SELECT:
   2250  1.1    jruoho                 case ACPI_IVRS_TYPE_START:
   2251  1.1    jruoho                 case ACPI_IVRS_TYPE_END:
   2252  1.1    jruoho 
   2253  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs4;
   2254  1.1    jruoho                     break;
   2255  1.1    jruoho 
   2256  1.1    jruoho                 /* 8-byte entries, type A */
   2257  1.1    jruoho 
   2258  1.1    jruoho                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
   2259  1.1    jruoho                 case ACPI_IVRS_TYPE_ALIAS_START:
   2260  1.1    jruoho 
   2261  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs8a;
   2262  1.1    jruoho                     break;
   2263  1.1    jruoho 
   2264  1.1    jruoho                 /* 8-byte entries, type B */
   2265  1.1    jruoho 
   2266  1.1    jruoho                 case ACPI_IVRS_TYPE_PAD8:
   2267  1.1    jruoho                 case ACPI_IVRS_TYPE_EXT_SELECT:
   2268  1.1    jruoho                 case ACPI_IVRS_TYPE_EXT_START:
   2269  1.1    jruoho 
   2270  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs8b;
   2271  1.1    jruoho                     break;
   2272  1.1    jruoho 
   2273  1.1    jruoho                 /* 8-byte entries, type C */
   2274  1.1    jruoho 
   2275  1.1    jruoho                 case ACPI_IVRS_TYPE_SPECIAL:
   2276  1.1    jruoho 
   2277  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs8c;
   2278  1.1    jruoho                     break;
   2279  1.1    jruoho 
   2280  1.1    jruoho                 default:
   2281  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs4;
   2282  1.1    jruoho                     AcpiOsPrintf (
   2283  1.1    jruoho                         "\n**** Unknown IVRS device entry type/length: "
   2284  1.1    jruoho                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
   2285  1.1    jruoho                         EntryType, EntryLength, EntryOffset);
   2286  1.1    jruoho                     break;
   2287  1.1    jruoho                 }
   2288  1.1    jruoho 
   2289  1.1    jruoho                 /* Dump the Device Entry */
   2290  1.1    jruoho 
   2291  1.1    jruoho                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
   2292  1.4  christos                     DeviceEntry, EntryLength, InfoTable);
   2293  1.3  christos                 if (ACPI_FAILURE (Status))
   2294  1.3  christos                 {
   2295  1.3  christos                     return;
   2296  1.3  christos                 }
   2297  1.1    jruoho 
   2298  1.1    jruoho                 EntryOffset += EntryLength;
   2299  1.1    jruoho                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
   2300  1.4  christos                     EntryLength);
   2301  1.1    jruoho             }
   2302  1.1    jruoho         }
   2303  1.1    jruoho 
   2304  1.9  christos NextSubtable:
   2305  1.2  christos         /* Point to next subtable */
   2306  1.1    jruoho 
   2307  1.9  christos         Offset += Subtable->Length;
   2308  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
   2309  1.1    jruoho     }
   2310  1.1    jruoho }
   2311  1.1    jruoho 
   2312  1.1    jruoho 
   2313  1.1    jruoho /*******************************************************************************
   2314  1.1    jruoho  *
   2315  1.2  christos  * FUNCTION:    AcpiDmDumpLpit
   2316  1.2  christos  *
   2317  1.2  christos  * PARAMETERS:  Table               - A LPIT table
   2318  1.2  christos  *
   2319  1.2  christos  * RETURN:      None
   2320  1.2  christos  *
   2321  1.2  christos  * DESCRIPTION: Format the contents of a LPIT. This table type consists
   2322  1.2  christos  *              of an open-ended number of subtables. Note: There are no
   2323  1.2  christos  *              entries in the main table. An LPIT consists of the table
   2324  1.2  christos  *              header and then subtables only.
   2325  1.2  christos  *
   2326  1.2  christos  ******************************************************************************/
   2327  1.2  christos 
   2328  1.2  christos void
   2329  1.2  christos AcpiDmDumpLpit (
   2330  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2331  1.2  christos {
   2332  1.2  christos     ACPI_STATUS             Status;
   2333  1.9  christos     ACPI_LPIT_HEADER        *Subtable;
   2334  1.2  christos     UINT32                  Length = Table->Length;
   2335  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
   2336  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2337  1.9  christos     UINT32                  SubtableLength;
   2338  1.2  christos 
   2339  1.2  christos 
   2340  1.2  christos     /* Subtables */
   2341  1.2  christos 
   2342  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
   2343  1.2  christos     while (Offset < Table->Length)
   2344  1.2  christos     {
   2345  1.2  christos         /* Common subtable header */
   2346  1.2  christos 
   2347  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2348  1.4  christos             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
   2349  1.2  christos         if (ACPI_FAILURE (Status))
   2350  1.2  christos         {
   2351  1.2  christos             return;
   2352  1.2  christos         }
   2353  1.2  christos 
   2354  1.9  christos         switch (Subtable->Type)
   2355  1.2  christos         {
   2356  1.2  christos         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
   2357  1.2  christos 
   2358  1.2  christos             InfoTable = AcpiDmTableInfoLpit0;
   2359  1.9  christos             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
   2360  1.2  christos             break;
   2361  1.2  christos 
   2362  1.2  christos         default:
   2363  1.2  christos 
   2364  1.2  christos             /* Cannot continue on unknown type - no length */
   2365  1.2  christos 
   2366  1.4  christos             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
   2367  1.9  christos                 Subtable->Type);
   2368  1.2  christos             return;
   2369  1.2  christos         }
   2370  1.2  christos 
   2371  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2372  1.9  christos             SubtableLength, InfoTable);
   2373  1.2  christos         if (ACPI_FAILURE (Status))
   2374  1.2  christos         {
   2375  1.2  christos             return;
   2376  1.2  christos         }
   2377  1.4  christos 
   2378  1.2  christos         AcpiOsPrintf ("\n");
   2379  1.2  christos 
   2380  1.2  christos         /* Point to next subtable */
   2381  1.2  christos 
   2382  1.9  christos         Offset += SubtableLength;
   2383  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
   2384  1.2  christos     }
   2385  1.2  christos }
   2386  1.2  christos 
   2387  1.2  christos 
   2388  1.2  christos /*******************************************************************************
   2389  1.2  christos  *
   2390  1.1    jruoho  * FUNCTION:    AcpiDmDumpMadt
   2391  1.1    jruoho  *
   2392  1.1    jruoho  * PARAMETERS:  Table               - A MADT table
   2393  1.1    jruoho  *
   2394  1.1    jruoho  * RETURN:      None
   2395  1.1    jruoho  *
   2396  1.1    jruoho  * DESCRIPTION: Format the contents of a MADT. This table type consists
   2397  1.1    jruoho  *              of an open-ended number of subtables.
   2398  1.1    jruoho  *
   2399  1.1    jruoho  ******************************************************************************/
   2400  1.1    jruoho 
   2401  1.1    jruoho void
   2402  1.1    jruoho AcpiDmDumpMadt (
   2403  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2404  1.1    jruoho {
   2405  1.1    jruoho     ACPI_STATUS             Status;
   2406  1.9  christos     ACPI_SUBTABLE_HEADER    *Subtable;
   2407  1.1    jruoho     UINT32                  Length = Table->Length;
   2408  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
   2409  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   2410  1.1    jruoho 
   2411  1.1    jruoho 
   2412  1.1    jruoho     /* Main table */
   2413  1.1    jruoho 
   2414  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
   2415  1.1    jruoho     if (ACPI_FAILURE (Status))
   2416  1.1    jruoho     {
   2417  1.1    jruoho         return;
   2418  1.1    jruoho     }
   2419  1.1    jruoho 
   2420  1.2  christos     /* Subtables */
   2421  1.1    jruoho 
   2422  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   2423  1.1    jruoho     while (Offset < Table->Length)
   2424  1.1    jruoho     {
   2425  1.2  christos         /* Common subtable header */
   2426  1.1    jruoho 
   2427  1.1    jruoho         AcpiOsPrintf ("\n");
   2428  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2429  1.9  christos             Subtable->Length, AcpiDmTableInfoMadtHdr);
   2430  1.1    jruoho         if (ACPI_FAILURE (Status))
   2431  1.1    jruoho         {
   2432  1.1    jruoho             return;
   2433  1.1    jruoho         }
   2434  1.1    jruoho 
   2435  1.9  christos         switch (Subtable->Type)
   2436  1.1    jruoho         {
   2437  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_APIC:
   2438  1.2  christos 
   2439  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt0;
   2440  1.1    jruoho             break;
   2441  1.2  christos 
   2442  1.1    jruoho         case ACPI_MADT_TYPE_IO_APIC:
   2443  1.2  christos 
   2444  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt1;
   2445  1.1    jruoho             break;
   2446  1.2  christos 
   2447  1.1    jruoho         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
   2448  1.2  christos 
   2449  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt2;
   2450  1.1    jruoho             break;
   2451  1.2  christos 
   2452  1.1    jruoho         case ACPI_MADT_TYPE_NMI_SOURCE:
   2453  1.2  christos 
   2454  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt3;
   2455  1.1    jruoho             break;
   2456  1.2  christos 
   2457  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
   2458  1.2  christos 
   2459  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt4;
   2460  1.1    jruoho             break;
   2461  1.2  christos 
   2462  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
   2463  1.2  christos 
   2464  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt5;
   2465  1.1    jruoho             break;
   2466  1.2  christos 
   2467  1.1    jruoho         case ACPI_MADT_TYPE_IO_SAPIC:
   2468  1.2  christos 
   2469  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt6;
   2470  1.1    jruoho             break;
   2471  1.2  christos 
   2472  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_SAPIC:
   2473  1.2  christos 
   2474  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt7;
   2475  1.1    jruoho             break;
   2476  1.2  christos 
   2477  1.1    jruoho         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
   2478  1.2  christos 
   2479  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt8;
   2480  1.1    jruoho             break;
   2481  1.2  christos 
   2482  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_X2APIC:
   2483  1.2  christos 
   2484  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt9;
   2485  1.1    jruoho             break;
   2486  1.2  christos 
   2487  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
   2488  1.2  christos 
   2489  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt10;
   2490  1.1    jruoho             break;
   2491  1.2  christos 
   2492  1.2  christos         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
   2493  1.2  christos 
   2494  1.2  christos             InfoTable = AcpiDmTableInfoMadt11;
   2495  1.2  christos             break;
   2496  1.2  christos 
   2497  1.2  christos         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
   2498  1.2  christos 
   2499  1.2  christos             InfoTable = AcpiDmTableInfoMadt12;
   2500  1.2  christos             break;
   2501  1.2  christos 
   2502  1.2  christos         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
   2503  1.2  christos 
   2504  1.2  christos             InfoTable = AcpiDmTableInfoMadt13;
   2505  1.2  christos             break;
   2506  1.2  christos 
   2507  1.2  christos         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
   2508  1.2  christos 
   2509  1.2  christos             InfoTable = AcpiDmTableInfoMadt14;
   2510  1.2  christos             break;
   2511  1.2  christos 
   2512  1.3  christos         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
   2513  1.3  christos 
   2514  1.3  christos             InfoTable = AcpiDmTableInfoMadt15;
   2515  1.3  christos             break;
   2516  1.3  christos 
   2517  1.1    jruoho         default:
   2518  1.2  christos 
   2519  1.4  christos             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
   2520  1.9  christos                 Subtable->Type);
   2521  1.1    jruoho 
   2522  1.1    jruoho             /* Attempt to continue */
   2523  1.1    jruoho 
   2524  1.9  christos             if (!Subtable->Length)
   2525  1.1    jruoho             {
   2526  1.1    jruoho                 AcpiOsPrintf ("Invalid zero length subtable\n");
   2527  1.1    jruoho                 return;
   2528  1.1    jruoho             }
   2529  1.4  christos 
   2530  1.9  christos             goto NextSubtable;
   2531  1.1    jruoho         }
   2532  1.1    jruoho 
   2533  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   2534  1.9  christos             Subtable->Length, InfoTable);
   2535  1.1    jruoho         if (ACPI_FAILURE (Status))
   2536  1.1    jruoho         {
   2537  1.1    jruoho             return;
   2538  1.1    jruoho         }
   2539  1.1    jruoho 
   2540  1.9  christos NextSubtable:
   2541  1.2  christos         /* Point to next subtable */
   2542  1.1    jruoho 
   2543  1.9  christos         Offset += Subtable->Length;
   2544  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
   2545  1.9  christos             Subtable->Length);
   2546  1.1    jruoho     }
   2547  1.1    jruoho }
   2548  1.1    jruoho 
   2549  1.1    jruoho 
   2550  1.1    jruoho /*******************************************************************************
   2551  1.1    jruoho  *
   2552  1.1    jruoho  * FUNCTION:    AcpiDmDumpMcfg
   2553  1.1    jruoho  *
   2554  1.1    jruoho  * PARAMETERS:  Table               - A MCFG Table
   2555  1.1    jruoho  *
   2556  1.1    jruoho  * RETURN:      None
   2557  1.1    jruoho  *
   2558  1.1    jruoho  * DESCRIPTION: Format the contents of a MCFG table
   2559  1.1    jruoho  *
   2560  1.1    jruoho  ******************************************************************************/
   2561  1.1    jruoho 
   2562  1.1    jruoho void
   2563  1.1    jruoho AcpiDmDumpMcfg (
   2564  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2565  1.1    jruoho {
   2566  1.1    jruoho     ACPI_STATUS             Status;
   2567  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
   2568  1.9  christos     ACPI_MCFG_ALLOCATION    *Subtable;
   2569  1.1    jruoho 
   2570  1.1    jruoho 
   2571  1.1    jruoho     /* Main table */
   2572  1.1    jruoho 
   2573  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
   2574  1.1    jruoho     if (ACPI_FAILURE (Status))
   2575  1.1    jruoho     {
   2576  1.1    jruoho         return;
   2577  1.1    jruoho     }
   2578  1.1    jruoho 
   2579  1.2  christos     /* Subtables */
   2580  1.1    jruoho 
   2581  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
   2582  1.1    jruoho     while (Offset < Table->Length)
   2583  1.1    jruoho     {
   2584  1.1    jruoho         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
   2585  1.1    jruoho         {
   2586  1.1    jruoho             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
   2587  1.1    jruoho                 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
   2588  1.1    jruoho             return;
   2589  1.1    jruoho         }
   2590  1.1    jruoho 
   2591  1.1    jruoho         AcpiOsPrintf ("\n");
   2592  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2593  1.4  christos             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
   2594  1.1    jruoho         if (ACPI_FAILURE (Status))
   2595  1.1    jruoho         {
   2596  1.1    jruoho             return;
   2597  1.1    jruoho         }
   2598  1.1    jruoho 
   2599  1.2  christos         /* Point to next subtable (each subtable is of fixed length) */
   2600  1.1    jruoho 
   2601  1.1    jruoho         Offset += sizeof (ACPI_MCFG_ALLOCATION);
   2602  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
   2603  1.4  christos             sizeof (ACPI_MCFG_ALLOCATION));
   2604  1.1    jruoho     }
   2605  1.1    jruoho }
   2606  1.1    jruoho 
   2607  1.1    jruoho 
   2608  1.1    jruoho /*******************************************************************************
   2609  1.1    jruoho  *
   2610  1.2  christos  * FUNCTION:    AcpiDmDumpMpst
   2611  1.2  christos  *
   2612  1.2  christos  * PARAMETERS:  Table               - A MPST Table
   2613  1.2  christos  *
   2614  1.2  christos  * RETURN:      None
   2615  1.2  christos  *
   2616  1.2  christos  * DESCRIPTION: Format the contents of a MPST table
   2617  1.2  christos  *
   2618  1.2  christos  ******************************************************************************/
   2619  1.2  christos 
   2620  1.2  christos void
   2621  1.2  christos AcpiDmDumpMpst (
   2622  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2623  1.2  christos {
   2624  1.2  christos     ACPI_STATUS             Status;
   2625  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
   2626  1.9  christos     ACPI_MPST_POWER_NODE    *Subtable0;
   2627  1.9  christos     ACPI_MPST_POWER_STATE   *Subtable0A;
   2628  1.9  christos     ACPI_MPST_COMPONENT     *Subtable0B;
   2629  1.9  christos     ACPI_MPST_DATA_HDR      *Subtable1;
   2630  1.9  christos     ACPI_MPST_POWER_DATA    *Subtable2;
   2631  1.2  christos     UINT16                  SubtableCount;
   2632  1.2  christos     UINT32                  PowerStateCount;
   2633  1.2  christos     UINT32                  ComponentCount;
   2634  1.2  christos 
   2635  1.2  christos 
   2636  1.2  christos     /* Main table */
   2637  1.2  christos 
   2638  1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
   2639  1.2  christos     if (ACPI_FAILURE (Status))
   2640  1.2  christos     {
   2641  1.2  christos         return;
   2642  1.2  christos     }
   2643  1.2  christos 
   2644  1.2  christos     /* Subtable: Memory Power Node(s) */
   2645  1.2  christos 
   2646  1.2  christos     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
   2647  1.9  christos     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
   2648  1.2  christos 
   2649  1.2  christos     while ((Offset < Table->Length) && SubtableCount)
   2650  1.2  christos     {
   2651  1.2  christos         AcpiOsPrintf ("\n");
   2652  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
   2653  1.4  christos             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
   2654  1.2  christos         if (ACPI_FAILURE (Status))
   2655  1.2  christos         {
   2656  1.2  christos             return;
   2657  1.2  christos         }
   2658  1.2  christos 
   2659  1.2  christos         /* Extract the sub-subtable counts */
   2660  1.2  christos 
   2661  1.9  christos         PowerStateCount = Subtable0->NumPowerStates;
   2662  1.9  christos         ComponentCount = Subtable0->NumPhysicalComponents;
   2663  1.2  christos         Offset += sizeof (ACPI_MPST_POWER_NODE);
   2664  1.2  christos 
   2665  1.2  christos         /* Sub-subtables - Memory Power State Structure(s) */
   2666  1.2  christos 
   2667  1.9  christos         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
   2668  1.2  christos             sizeof (ACPI_MPST_POWER_NODE));
   2669  1.2  christos 
   2670  1.2  christos         while (PowerStateCount)
   2671  1.2  christos         {
   2672  1.2  christos             AcpiOsPrintf ("\n");
   2673  1.9  christos             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
   2674  1.4  christos                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
   2675  1.2  christos             if (ACPI_FAILURE (Status))
   2676  1.2  christos             {
   2677  1.2  christos                 return;
   2678  1.2  christos             }
   2679  1.2  christos 
   2680  1.9  christos             Subtable0A++;
   2681  1.2  christos             PowerStateCount--;
   2682  1.2  christos             Offset += sizeof (ACPI_MPST_POWER_STATE);
   2683  1.2  christos        }
   2684  1.2  christos 
   2685  1.2  christos         /* Sub-subtables - Physical Component ID Structure(s) */
   2686  1.2  christos 
   2687  1.9  christos         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
   2688  1.2  christos 
   2689  1.2  christos         if (ComponentCount)
   2690  1.2  christos         {
   2691  1.2  christos             AcpiOsPrintf ("\n");
   2692  1.2  christos         }
   2693  1.2  christos 
   2694  1.2  christos         while (ComponentCount)
   2695  1.2  christos         {
   2696  1.9  christos             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
   2697  1.4  christos                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
   2698  1.2  christos             if (ACPI_FAILURE (Status))
   2699  1.2  christos             {
   2700  1.2  christos                 return;
   2701  1.2  christos             }
   2702  1.2  christos 
   2703  1.9  christos             Subtable0B++;
   2704  1.2  christos             ComponentCount--;
   2705  1.2  christos             Offset += sizeof (ACPI_MPST_COMPONENT);
   2706  1.2  christos         }
   2707  1.2  christos 
   2708  1.2  christos         /* Point to next Memory Power Node subtable */
   2709  1.2  christos 
   2710  1.2  christos         SubtableCount--;
   2711  1.9  christos         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
   2712  1.2  christos             sizeof (ACPI_MPST_POWER_NODE) +
   2713  1.9  christos             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
   2714  1.9  christos             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
   2715  1.2  christos     }
   2716  1.2  christos 
   2717  1.2  christos     /* Subtable: Count of Memory Power State Characteristic structures */
   2718  1.2  christos 
   2719  1.2  christos     AcpiOsPrintf ("\n");
   2720  1.9  christos     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
   2721  1.9  christos     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
   2722  1.4  christos         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
   2723  1.2  christos     if (ACPI_FAILURE (Status))
   2724  1.2  christos     {
   2725  1.2  christos         return;
   2726  1.2  christos     }
   2727  1.2  christos 
   2728  1.9  christos     SubtableCount = Subtable1->CharacteristicsCount;
   2729  1.2  christos     Offset += sizeof (ACPI_MPST_DATA_HDR);
   2730  1.2  christos 
   2731  1.2  christos     /* Subtable: Memory Power State Characteristics structure(s) */
   2732  1.2  christos 
   2733  1.9  christos     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
   2734  1.4  christos         sizeof (ACPI_MPST_DATA_HDR));
   2735  1.2  christos 
   2736  1.2  christos     while ((Offset < Table->Length) && SubtableCount)
   2737  1.2  christos     {
   2738  1.2  christos         AcpiOsPrintf ("\n");
   2739  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
   2740  1.4  christos             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
   2741  1.2  christos         if (ACPI_FAILURE (Status))
   2742  1.2  christos         {
   2743  1.2  christos             return;
   2744  1.2  christos         }
   2745  1.2  christos 
   2746  1.9  christos         Subtable2++;
   2747  1.2  christos         SubtableCount--;
   2748  1.2  christos         Offset += sizeof (ACPI_MPST_POWER_DATA);
   2749  1.2  christos     }
   2750  1.2  christos }
   2751  1.2  christos 
   2752  1.2  christos 
   2753  1.2  christos /*******************************************************************************
   2754  1.2  christos  *
   2755  1.1    jruoho  * FUNCTION:    AcpiDmDumpMsct
   2756  1.1    jruoho  *
   2757  1.1    jruoho  * PARAMETERS:  Table               - A MSCT table
   2758  1.1    jruoho  *
   2759  1.1    jruoho  * RETURN:      None
   2760  1.1    jruoho  *
   2761  1.1    jruoho  * DESCRIPTION: Format the contents of a MSCT
   2762  1.1    jruoho  *
   2763  1.1    jruoho  ******************************************************************************/
   2764  1.1    jruoho 
   2765  1.1    jruoho void
   2766  1.1    jruoho AcpiDmDumpMsct (
   2767  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2768  1.1    jruoho {
   2769  1.1    jruoho     ACPI_STATUS             Status;
   2770  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
   2771  1.9  christos     ACPI_MSCT_PROXIMITY     *Subtable;
   2772  1.1    jruoho 
   2773  1.1    jruoho 
   2774  1.1    jruoho     /* Main table */
   2775  1.1    jruoho 
   2776  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
   2777  1.1    jruoho     if (ACPI_FAILURE (Status))
   2778  1.1    jruoho     {
   2779  1.1    jruoho         return;
   2780  1.1    jruoho     }
   2781  1.1    jruoho 
   2782  1.2  christos     /* Subtables */
   2783  1.1    jruoho 
   2784  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
   2785  1.1    jruoho     while (Offset < Table->Length)
   2786  1.1    jruoho     {
   2787  1.2  christos         /* Common subtable header */
   2788  1.1    jruoho 
   2789  1.1    jruoho         AcpiOsPrintf ("\n");
   2790  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2791  1.4  christos             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
   2792  1.1    jruoho         if (ACPI_FAILURE (Status))
   2793  1.1    jruoho         {
   2794  1.1    jruoho             return;
   2795  1.1    jruoho         }
   2796  1.1    jruoho 
   2797  1.2  christos         /* Point to next subtable */
   2798  1.1    jruoho 
   2799  1.1    jruoho         Offset += sizeof (ACPI_MSCT_PROXIMITY);
   2800  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
   2801  1.4  christos             sizeof (ACPI_MSCT_PROXIMITY));
   2802  1.1    jruoho     }
   2803  1.1    jruoho }
   2804  1.1    jruoho 
   2805  1.1    jruoho 
   2806  1.1    jruoho /*******************************************************************************
   2807  1.1    jruoho  *
   2808  1.2  christos  * FUNCTION:    AcpiDmDumpMtmr
   2809  1.2  christos  *
   2810  1.2  christos  * PARAMETERS:  Table               - A MTMR table
   2811  1.2  christos  *
   2812  1.2  christos  * RETURN:      None
   2813  1.2  christos  *
   2814  1.2  christos  * DESCRIPTION: Format the contents of a MTMR
   2815  1.2  christos  *
   2816  1.2  christos  ******************************************************************************/
   2817  1.2  christos 
   2818  1.2  christos void
   2819  1.2  christos AcpiDmDumpMtmr (
   2820  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2821  1.2  christos {
   2822  1.2  christos     ACPI_STATUS             Status;
   2823  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
   2824  1.9  christos     ACPI_MTMR_ENTRY         *Subtable;
   2825  1.2  christos 
   2826  1.2  christos 
   2827  1.2  christos     /* Main table */
   2828  1.2  christos 
   2829  1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
   2830  1.2  christos     if (ACPI_FAILURE (Status))
   2831  1.2  christos     {
   2832  1.2  christos         return;
   2833  1.2  christos     }
   2834  1.2  christos 
   2835  1.2  christos     /* Subtables */
   2836  1.2  christos 
   2837  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
   2838  1.2  christos     while (Offset < Table->Length)
   2839  1.2  christos     {
   2840  1.2  christos         /* Common subtable header */
   2841  1.2  christos 
   2842  1.2  christos         AcpiOsPrintf ("\n");
   2843  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2844  1.4  christos             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
   2845  1.2  christos         if (ACPI_FAILURE (Status))
   2846  1.2  christos         {
   2847  1.2  christos             return;
   2848  1.2  christos         }
   2849  1.2  christos 
   2850  1.2  christos         /* Point to next subtable */
   2851  1.2  christos 
   2852  1.2  christos         Offset += sizeof (ACPI_MTMR_ENTRY);
   2853  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable,
   2854  1.4  christos             sizeof (ACPI_MTMR_ENTRY));
   2855  1.2  christos     }
   2856  1.2  christos }
   2857  1.2  christos 
   2858  1.2  christos 
   2859  1.2  christos /*******************************************************************************
   2860  1.2  christos  *
   2861  1.3  christos  * FUNCTION:    AcpiDmDumpNfit
   2862  1.3  christos  *
   2863  1.3  christos  * PARAMETERS:  Table               - A NFIT table
   2864  1.3  christos  *
   2865  1.3  christos  * RETURN:      None
   2866  1.3  christos  *
   2867  1.3  christos  * DESCRIPTION: Format the contents of an NFIT.
   2868  1.3  christos  *
   2869  1.3  christos  ******************************************************************************/
   2870  1.3  christos 
   2871  1.3  christos void
   2872  1.3  christos AcpiDmDumpNfit (
   2873  1.3  christos     ACPI_TABLE_HEADER       *Table)
   2874  1.3  christos {
   2875  1.3  christos     ACPI_STATUS             Status;
   2876  1.3  christos     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
   2877  1.3  christos     UINT32                  FieldOffset = 0;
   2878  1.3  christos     UINT32                  Length;
   2879  1.9  christos     ACPI_NFIT_HEADER        *Subtable;
   2880  1.3  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2881  1.3  christos     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
   2882  1.3  christos     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
   2883  1.3  christos     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
   2884  1.3  christos     UINT32                  i;
   2885  1.3  christos 
   2886  1.3  christos 
   2887  1.3  christos     /* Main table */
   2888  1.3  christos 
   2889  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
   2890  1.3  christos     if (ACPI_FAILURE (Status))
   2891  1.3  christos     {
   2892  1.3  christos         return;
   2893  1.3  christos     }
   2894  1.3  christos 
   2895  1.3  christos     /* Subtables */
   2896  1.3  christos 
   2897  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
   2898  1.3  christos     while (Offset < Table->Length)
   2899  1.3  christos     {
   2900  1.3  christos         /* NFIT subtable header */
   2901  1.3  christos 
   2902  1.3  christos         AcpiOsPrintf ("\n");
   2903  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2904  1.9  christos             Subtable->Length, AcpiDmTableInfoNfitHdr);
   2905  1.3  christos         if (ACPI_FAILURE (Status))
   2906  1.3  christos         {
   2907  1.3  christos             return;
   2908  1.3  christos         }
   2909  1.3  christos 
   2910  1.9  christos         switch (Subtable->Type)
   2911  1.3  christos         {
   2912  1.3  christos         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
   2913  1.3  christos 
   2914  1.3  christos             InfoTable = AcpiDmTableInfoNfit0;
   2915  1.3  christos             break;
   2916  1.3  christos 
   2917  1.3  christos         case ACPI_NFIT_TYPE_MEMORY_MAP:
   2918  1.3  christos 
   2919  1.3  christos             InfoTable = AcpiDmTableInfoNfit1;
   2920  1.3  christos             break;
   2921  1.3  christos 
   2922  1.3  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   2923  1.3  christos 
   2924  1.3  christos             /* Has a variable number of 32-bit values at the end */
   2925  1.3  christos 
   2926  1.3  christos             InfoTable = AcpiDmTableInfoNfit2;
   2927  1.9  christos             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
   2928  1.3  christos             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
   2929  1.3  christos             break;
   2930  1.3  christos 
   2931  1.3  christos         case ACPI_NFIT_TYPE_SMBIOS:
   2932  1.3  christos 
   2933  1.9  christos             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
   2934  1.3  christos             InfoTable = AcpiDmTableInfoNfit3;
   2935  1.3  christos             break;
   2936  1.3  christos 
   2937  1.3  christos         case ACPI_NFIT_TYPE_CONTROL_REGION:
   2938  1.3  christos 
   2939  1.3  christos             InfoTable = AcpiDmTableInfoNfit4;
   2940  1.3  christos             break;
   2941  1.3  christos 
   2942  1.3  christos         case ACPI_NFIT_TYPE_DATA_REGION:
   2943  1.3  christos 
   2944  1.3  christos             InfoTable = AcpiDmTableInfoNfit5;
   2945  1.3  christos             break;
   2946  1.3  christos 
   2947  1.3  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   2948  1.3  christos 
   2949  1.3  christos             /* Has a variable number of 64-bit addresses at the end */
   2950  1.3  christos 
   2951  1.3  christos             InfoTable = AcpiDmTableInfoNfit6;
   2952  1.9  christos             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
   2953  1.3  christos             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
   2954  1.3  christos             break;
   2955  1.3  christos 
   2956  1.9  christos         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
   2957  1.9  christos 
   2958  1.9  christos             InfoTable = AcpiDmTableInfoNfit7;
   2959  1.9  christos             break;
   2960  1.9  christos 
   2961  1.3  christos         default:
   2962  1.4  christos             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
   2963  1.9  christos                 Subtable->Type);
   2964  1.3  christos 
   2965  1.3  christos             /* Attempt to continue */
   2966  1.3  christos 
   2967  1.9  christos             if (!Subtable->Length)
   2968  1.3  christos             {
   2969  1.3  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   2970  1.3  christos                 return;
   2971  1.3  christos             }
   2972  1.9  christos             goto NextSubtable;
   2973  1.3  christos         }
   2974  1.3  christos 
   2975  1.3  christos         AcpiOsPrintf ("\n");
   2976  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   2977  1.9  christos             Subtable->Length, InfoTable);
   2978  1.3  christos         if (ACPI_FAILURE (Status))
   2979  1.3  christos         {
   2980  1.3  christos             return;
   2981  1.3  christos         }
   2982  1.3  christos 
   2983  1.3  christos         /* Per-subtable variable-length fields */
   2984  1.3  christos 
   2985  1.9  christos         switch (Subtable->Type)
   2986  1.3  christos         {
   2987  1.3  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   2988  1.3  christos 
   2989  1.3  christos             for (i = 0; i < Interleave->LineCount; i++)
   2990  1.3  christos             {
   2991  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   2992  1.4  christos                     &Interleave->LineOffset[i],
   2993  1.4  christos                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
   2994  1.3  christos                 if (ACPI_FAILURE (Status))
   2995  1.3  christos                 {
   2996  1.3  christos                     return;
   2997  1.3  christos                 }
   2998  1.3  christos 
   2999  1.3  christos                 FieldOffset += sizeof (UINT32);
   3000  1.3  christos             }
   3001  1.3  christos             break;
   3002  1.3  christos 
   3003  1.3  christos         case ACPI_NFIT_TYPE_SMBIOS:
   3004  1.3  christos 
   3005  1.9  christos             Length = Subtable->Length -
   3006  1.4  christos                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
   3007  1.4  christos 
   3008  1.3  christos             if (Length)
   3009  1.3  christos             {
   3010  1.3  christos                 Status = AcpiDmDumpTable (Table->Length,
   3011  1.4  christos                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
   3012  1.4  christos                     SmbiosInfo,
   3013  1.4  christos                     Length, AcpiDmTableInfoNfit3a);
   3014  1.3  christos                 if (ACPI_FAILURE (Status))
   3015  1.3  christos                 {
   3016  1.3  christos                     return;
   3017  1.3  christos                 }
   3018  1.3  christos             }
   3019  1.3  christos 
   3020  1.3  christos             break;
   3021  1.3  christos 
   3022  1.3  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   3023  1.3  christos 
   3024  1.3  christos             for (i = 0; i < Hint->HintCount; i++)
   3025  1.3  christos             {
   3026  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   3027  1.4  christos                     &Hint->HintAddress[i],
   3028  1.4  christos                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
   3029  1.3  christos                 if (ACPI_FAILURE (Status))
   3030  1.3  christos                 {
   3031  1.3  christos                     return;
   3032  1.3  christos                 }
   3033  1.3  christos 
   3034  1.3  christos                 FieldOffset += sizeof (UINT64);
   3035  1.3  christos             }
   3036  1.3  christos             break;
   3037  1.3  christos 
   3038  1.3  christos         default:
   3039  1.3  christos             break;
   3040  1.3  christos         }
   3041  1.3  christos 
   3042  1.9  christos NextSubtable:
   3043  1.3  christos         /* Point to next subtable */
   3044  1.3  christos 
   3045  1.9  christos         Offset += Subtable->Length;
   3046  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
   3047  1.3  christos     }
   3048  1.3  christos }
   3049  1.3  christos 
   3050  1.3  christos 
   3051  1.3  christos /*******************************************************************************
   3052  1.3  christos  *
   3053  1.2  christos  * FUNCTION:    AcpiDmDumpPcct
   3054  1.2  christos  *
   3055  1.2  christos  * PARAMETERS:  Table               - A PCCT table
   3056  1.2  christos  *
   3057  1.2  christos  * RETURN:      None
   3058  1.2  christos  *
   3059  1.2  christos  * DESCRIPTION: Format the contents of a PCCT. This table type consists
   3060  1.2  christos  *              of an open-ended number of subtables.
   3061  1.2  christos  *
   3062  1.2  christos  ******************************************************************************/
   3063  1.2  christos 
   3064  1.2  christos void
   3065  1.2  christos AcpiDmDumpPcct (
   3066  1.2  christos     ACPI_TABLE_HEADER       *Table)
   3067  1.2  christos {
   3068  1.2  christos     ACPI_STATUS             Status;
   3069  1.9  christos     ACPI_PCCT_SUBSPACE      *Subtable;
   3070  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   3071  1.2  christos     UINT32                  Length = Table->Length;
   3072  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
   3073  1.2  christos 
   3074  1.2  christos 
   3075  1.2  christos     /* Main table */
   3076  1.2  christos 
   3077  1.2  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
   3078  1.2  christos     if (ACPI_FAILURE (Status))
   3079  1.2  christos     {
   3080  1.2  christos         return;
   3081  1.2  christos     }
   3082  1.2  christos 
   3083  1.2  christos     /* Subtables */
   3084  1.2  christos 
   3085  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
   3086  1.2  christos     while (Offset < Table->Length)
   3087  1.2  christos     {
   3088  1.2  christos         /* Common subtable header */
   3089  1.2  christos 
   3090  1.2  christos         AcpiOsPrintf ("\n");
   3091  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   3092  1.9  christos             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
   3093  1.2  christos         if (ACPI_FAILURE (Status))
   3094  1.2  christos         {
   3095  1.2  christos             return;
   3096  1.2  christos         }
   3097  1.2  christos 
   3098  1.9  christos         switch (Subtable->Header.Type)
   3099  1.2  christos         {
   3100  1.2  christos         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
   3101  1.2  christos 
   3102  1.2  christos             InfoTable = AcpiDmTableInfoPcct0;
   3103  1.2  christos             break;
   3104  1.2  christos 
   3105  1.2  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
   3106  1.2  christos 
   3107  1.2  christos             InfoTable = AcpiDmTableInfoPcct1;
   3108  1.2  christos             break;
   3109  1.2  christos 
   3110  1.5  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
   3111  1.5  christos 
   3112  1.5  christos             InfoTable = AcpiDmTableInfoPcct2;
   3113  1.5  christos             break;
   3114  1.5  christos 
   3115  1.8  christos         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
   3116  1.8  christos 
   3117  1.8  christos             InfoTable = AcpiDmTableInfoPcct3;
   3118  1.8  christos             break;
   3119  1.8  christos 
   3120  1.8  christos         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
   3121  1.8  christos 
   3122  1.8  christos             InfoTable = AcpiDmTableInfoPcct4;
   3123  1.8  christos             break;
   3124  1.8  christos 
   3125  1.2  christos         default:
   3126  1.2  christos 
   3127  1.2  christos             AcpiOsPrintf (
   3128  1.2  christos                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
   3129  1.9  christos                 Subtable->Header.Type);
   3130  1.2  christos             return;
   3131  1.2  christos         }
   3132  1.2  christos 
   3133  1.2  christos         AcpiOsPrintf ("\n");
   3134  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   3135  1.9  christos             Subtable->Header.Length, InfoTable);
   3136  1.2  christos         if (ACPI_FAILURE (Status))
   3137  1.2  christos         {
   3138  1.2  christos             return;
   3139  1.2  christos         }
   3140  1.2  christos 
   3141  1.2  christos         /* Point to next subtable */
   3142  1.2  christos 
   3143  1.9  christos         Offset += Subtable->Header.Length;
   3144  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
   3145  1.9  christos             Subtable->Header.Length);
   3146  1.9  christos     }
   3147  1.9  christos }
   3148  1.9  christos 
   3149  1.9  christos 
   3150  1.9  christos /*******************************************************************************
   3151  1.9  christos  *
   3152  1.9  christos  * FUNCTION:    AcpiDmDumpPdtt
   3153  1.9  christos  *
   3154  1.9  christos  * PARAMETERS:  Table               - A PDTT table
   3155  1.9  christos  *
   3156  1.9  christos  * RETURN:      None
   3157  1.9  christos  *
   3158  1.9  christos  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
   3159  1.9  christos  *              table that contains an open-ended number of IDs
   3160  1.9  christos  *              at the end of the table.
   3161  1.9  christos  *
   3162  1.9  christos  ******************************************************************************/
   3163  1.9  christos 
   3164  1.9  christos void
   3165  1.9  christos AcpiDmDumpPdtt (
   3166  1.9  christos     ACPI_TABLE_HEADER       *Table)
   3167  1.9  christos {
   3168  1.9  christos     ACPI_STATUS             Status;
   3169  1.9  christos     ACPI_PDTT_CHANNEL       *Subtable;
   3170  1.9  christos     UINT32                  Length = Table->Length;
   3171  1.9  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
   3172  1.9  christos 
   3173  1.9  christos 
   3174  1.9  christos     /* Main table */
   3175  1.9  christos 
   3176  1.9  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
   3177  1.9  christos     if (ACPI_FAILURE (Status))
   3178  1.9  christos     {
   3179  1.9  christos         return;
   3180  1.9  christos     }
   3181  1.9  christos 
   3182  1.9  christos     /* Subtables. Currently there is only one type, but can be multiples */
   3183  1.9  christos 
   3184  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
   3185  1.9  christos     while (Offset < Table->Length)
   3186  1.9  christos     {
   3187  1.9  christos         AcpiOsPrintf ("\n");
   3188  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   3189  1.9  christos             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
   3190  1.9  christos         if (ACPI_FAILURE (Status))
   3191  1.9  christos         {
   3192  1.9  christos             return;
   3193  1.9  christos         }
   3194  1.9  christos 
   3195  1.9  christos         /* Point to next subtable */
   3196  1.9  christos 
   3197  1.9  christos         Offset += sizeof (ACPI_PDTT_CHANNEL);
   3198  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
   3199  1.9  christos             sizeof (ACPI_PDTT_CHANNEL));
   3200  1.2  christos     }
   3201  1.2  christos }
   3202  1.2  christos 
   3203  1.2  christos 
   3204  1.2  christos /*******************************************************************************
   3205  1.2  christos  *
   3206  1.2  christos  * FUNCTION:    AcpiDmDumpPmtt
   3207  1.2  christos  *
   3208  1.2  christos  * PARAMETERS:  Table               - A PMTT table
   3209  1.2  christos  *
   3210  1.2  christos  * RETURN:      None
   3211  1.2  christos  *
   3212  1.2  christos  * DESCRIPTION: Format the contents of a PMTT. This table type consists
   3213  1.2  christos  *              of an open-ended number of subtables.
   3214  1.2  christos  *
   3215  1.2  christos  ******************************************************************************/
   3216  1.2  christos 
   3217  1.2  christos void
   3218  1.2  christos AcpiDmDumpPmtt (
   3219  1.2  christos     ACPI_TABLE_HEADER       *Table)
   3220  1.2  christos {
   3221  1.2  christos     ACPI_STATUS             Status;
   3222  1.9  christos     ACPI_PMTT_HEADER        *Subtable;
   3223  1.9  christos     ACPI_PMTT_HEADER        *MemSubtable;
   3224  1.9  christos     ACPI_PMTT_HEADER        *DimmSubtable;
   3225  1.2  christos     ACPI_PMTT_DOMAIN        *DomainArray;
   3226  1.2  christos     UINT32                  Length = Table->Length;
   3227  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
   3228  1.2  christos     UINT32                  MemOffset;
   3229  1.2  christos     UINT32                  DimmOffset;
   3230  1.2  christos     UINT32                  DomainOffset;
   3231  1.2  christos     UINT32                  DomainCount;
   3232  1.2  christos 
   3233  1.2  christos 
   3234  1.2  christos     /* Main table */
   3235  1.2  christos 
   3236  1.2  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
   3237  1.2  christos     if (ACPI_FAILURE (Status))
   3238  1.2  christos     {
   3239  1.2  christos         return;
   3240  1.2  christos     }
   3241  1.2  christos 
   3242  1.2  christos     /* Subtables */
   3243  1.2  christos 
   3244  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
   3245  1.2  christos     while (Offset < Table->Length)
   3246  1.2  christos     {
   3247  1.2  christos         /* Common subtable header */
   3248  1.2  christos 
   3249  1.2  christos         AcpiOsPrintf ("\n");
   3250  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   3251  1.9  christos             Subtable->Length, AcpiDmTableInfoPmttHdr);
   3252  1.2  christos         if (ACPI_FAILURE (Status))
   3253  1.2  christos         {
   3254  1.2  christos             return;
   3255  1.2  christos         }
   3256  1.2  christos 
   3257  1.2  christos         /* Only Socket subtables are expected at this level */
   3258  1.2  christos 
   3259  1.9  christos         if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET)
   3260  1.2  christos         {
   3261  1.2  christos             AcpiOsPrintf (
   3262  1.2  christos                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   3263  1.9  christos                 Subtable->Type);
   3264  1.2  christos             return;
   3265  1.2  christos         }
   3266  1.2  christos 
   3267  1.2  christos         /* Dump the fixed-length portion of the subtable */
   3268  1.2  christos 
   3269  1.9  christos         Status = AcpiDmDumpTable (Length, Offset, Subtable,
   3270  1.9  christos             Subtable->Length, AcpiDmTableInfoPmtt0);
   3271  1.2  christos         if (ACPI_FAILURE (Status))
   3272  1.2  christos         {
   3273  1.2  christos             return;
   3274  1.2  christos         }
   3275  1.2  christos 
   3276  1.2  christos         /* Walk the memory controller subtables */
   3277  1.2  christos 
   3278  1.2  christos         MemOffset = sizeof (ACPI_PMTT_SOCKET);
   3279  1.9  christos         MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
   3280  1.2  christos             sizeof (ACPI_PMTT_SOCKET));
   3281  1.2  christos 
   3282  1.2  christos         while (((Offset + MemOffset) < Table->Length) &&
   3283  1.9  christos             (MemOffset < Subtable->Length))
   3284  1.2  christos         {
   3285  1.2  christos             /* Common subtable header */
   3286  1.2  christos 
   3287  1.2  christos             AcpiOsPrintf ("\n");
   3288  1.2  christos             Status = AcpiDmDumpTable (Length,
   3289  1.9  christos                 Offset + MemOffset, MemSubtable,
   3290  1.9  christos                 MemSubtable->Length, AcpiDmTableInfoPmttHdr);
   3291  1.2  christos             if (ACPI_FAILURE (Status))
   3292  1.2  christos             {
   3293  1.2  christos                 return;
   3294  1.2  christos             }
   3295  1.2  christos 
   3296  1.2  christos             /* Only memory controller subtables are expected at this level */
   3297  1.2  christos 
   3298  1.9  christos             if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER)
   3299  1.2  christos             {
   3300  1.2  christos                 AcpiOsPrintf (
   3301  1.2  christos                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   3302  1.9  christos                     MemSubtable->Type);
   3303  1.2  christos                 return;
   3304  1.2  christos             }
   3305  1.2  christos 
   3306  1.2  christos             /* Dump the fixed-length portion of the controller subtable */
   3307  1.2  christos 
   3308  1.2  christos             Status = AcpiDmDumpTable (Length,
   3309  1.9  christos                 Offset + MemOffset, MemSubtable,
   3310  1.9  christos                 MemSubtable->Length, AcpiDmTableInfoPmtt1);
   3311  1.2  christos             if (ACPI_FAILURE (Status))
   3312  1.2  christos             {
   3313  1.2  christos                 return;
   3314  1.2  christos             }
   3315  1.2  christos 
   3316  1.2  christos             /* Walk the variable count of proximity domains */
   3317  1.2  christos 
   3318  1.9  christos             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
   3319  1.2  christos             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
   3320  1.9  christos             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
   3321  1.2  christos                 sizeof (ACPI_PMTT_CONTROLLER));
   3322  1.2  christos 
   3323  1.2  christos             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
   3324  1.9  christos                 ((MemOffset + DomainOffset) < Subtable->Length) &&
   3325  1.2  christos                 DomainCount)
   3326  1.2  christos             {
   3327  1.2  christos                 Status = AcpiDmDumpTable (Length,
   3328  1.4  christos                     Offset + MemOffset + DomainOffset, DomainArray,
   3329  1.4  christos                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
   3330  1.2  christos                 if (ACPI_FAILURE (Status))
   3331  1.2  christos                 {
   3332  1.2  christos                     return;
   3333  1.2  christos                 }
   3334  1.2  christos 
   3335  1.2  christos                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
   3336  1.2  christos                 DomainArray++;
   3337  1.2  christos                 DomainCount--;
   3338  1.2  christos             }
   3339  1.2  christos 
   3340  1.2  christos             if (DomainCount)
   3341  1.2  christos             {
   3342  1.2  christos                 AcpiOsPrintf (
   3343  1.2  christos                     "\n**** DomainCount exceeds subtable length\n\n");
   3344  1.2  christos             }
   3345  1.2  christos 
   3346  1.2  christos             /* Walk the physical component (DIMM) subtables */
   3347  1.2  christos 
   3348  1.2  christos             DimmOffset = DomainOffset;
   3349  1.9  christos             DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
   3350  1.2  christos                 DomainOffset);
   3351  1.2  christos 
   3352  1.2  christos             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
   3353  1.9  christos                 (DimmOffset < MemSubtable->Length))
   3354  1.2  christos             {
   3355  1.2  christos                 /* Common subtable header */
   3356  1.2  christos 
   3357  1.2  christos                 AcpiOsPrintf ("\n");
   3358  1.2  christos                 Status = AcpiDmDumpTable (Length,
   3359  1.9  christos                     Offset + MemOffset + DimmOffset, DimmSubtable,
   3360  1.9  christos                     DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
   3361  1.2  christos                 if (ACPI_FAILURE (Status))
   3362  1.2  christos                 {
   3363  1.2  christos                     return;
   3364  1.2  christos                 }
   3365  1.2  christos 
   3366  1.2  christos                 /* Only DIMM subtables are expected at this level */
   3367  1.2  christos 
   3368  1.9  christos                 if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM)
   3369  1.2  christos                 {
   3370  1.2  christos                     AcpiOsPrintf (
   3371  1.2  christos                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   3372  1.9  christos                         DimmSubtable->Type);
   3373  1.2  christos                     return;
   3374  1.2  christos                 }
   3375  1.2  christos 
   3376  1.2  christos                 /* Dump the fixed-length DIMM subtable */
   3377  1.2  christos 
   3378  1.2  christos                 Status = AcpiDmDumpTable (Length,
   3379  1.9  christos                     Offset + MemOffset + DimmOffset, DimmSubtable,
   3380  1.9  christos                     DimmSubtable->Length, AcpiDmTableInfoPmtt2);
   3381  1.2  christos                 if (ACPI_FAILURE (Status))
   3382  1.2  christos                 {
   3383  1.2  christos                     return;
   3384  1.2  christos                 }
   3385  1.2  christos 
   3386  1.2  christos                 /* Point to next DIMM subtable */
   3387  1.2  christos 
   3388  1.9  christos                 DimmOffset += DimmSubtable->Length;
   3389  1.9  christos                 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   3390  1.9  christos                     DimmSubtable, DimmSubtable->Length);
   3391  1.2  christos             }
   3392  1.2  christos 
   3393  1.2  christos             /* Point to next Controller subtable */
   3394  1.2  christos 
   3395  1.9  christos             MemOffset += MemSubtable->Length;
   3396  1.9  christos             MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   3397  1.9  christos                 MemSubtable, MemSubtable->Length);
   3398  1.2  christos         }
   3399  1.2  christos 
   3400  1.2  christos         /* Point to next Socket subtable */
   3401  1.2  christos 
   3402  1.9  christos         Offset += Subtable->Length;
   3403  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   3404  1.9  christos             Subtable, Subtable->Length);
   3405  1.2  christos     }
   3406  1.2  christos }
   3407  1.2  christos 
   3408  1.2  christos 
   3409  1.2  christos /*******************************************************************************
   3410  1.2  christos  *
   3411  1.8  christos  * FUNCTION:    AcpiDmDumpPptt
   3412  1.8  christos  *
   3413  1.8  christos  * PARAMETERS:  Table               - A PMTT table
   3414  1.8  christos  *
   3415  1.8  christos  * RETURN:      None
   3416  1.8  christos  *
   3417  1.8  christos  * DESCRIPTION: Format the contents of a PPTT. This table type consists
   3418  1.8  christos  *              of an open-ended number of subtables.
   3419  1.8  christos  *
   3420  1.8  christos  ******************************************************************************/
   3421  1.8  christos 
   3422  1.8  christos void
   3423  1.8  christos AcpiDmDumpPptt (
   3424  1.8  christos     ACPI_TABLE_HEADER       *Table)
   3425  1.8  christos {
   3426  1.8  christos     ACPI_STATUS             Status;
   3427  1.9  christos     ACPI_SUBTABLE_HEADER    *Subtable;
   3428  1.8  christos     ACPI_PPTT_PROCESSOR     *PpttProcessor;
   3429  1.8  christos     UINT8                   Length;
   3430  1.9  christos     UINT8                   SubtableOffset;
   3431  1.8  christos     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
   3432  1.8  christos     ACPI_DMTABLE_INFO       *InfoTable;
   3433  1.8  christos     UINT32                  i;
   3434  1.8  christos 
   3435  1.8  christos 
   3436  1.8  christos     /* There is no main table (other than the standard ACPI header) */
   3437  1.8  christos 
   3438  1.8  christos     /* Subtables */
   3439  1.8  christos 
   3440  1.8  christos     Offset = sizeof (ACPI_TABLE_HEADER);
   3441  1.8  christos     while (Offset < Table->Length)
   3442  1.8  christos     {
   3443  1.8  christos         AcpiOsPrintf ("\n");
   3444  1.8  christos 
   3445  1.8  christos         /* Common subtable header */
   3446  1.8  christos 
   3447  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   3448  1.9  christos         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
   3449  1.8  christos         {
   3450  1.8  christos             AcpiOsPrintf ("Invalid subtable length\n");
   3451  1.8  christos             return;
   3452  1.8  christos         }
   3453  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   3454  1.9  christos             Subtable->Length, AcpiDmTableInfoPpttHdr);
   3455  1.8  christos         if (ACPI_FAILURE (Status))
   3456  1.8  christos         {
   3457  1.8  christos             return;
   3458  1.8  christos         }
   3459  1.8  christos 
   3460  1.9  christos         switch (Subtable->Type)
   3461  1.8  christos         {
   3462  1.8  christos         case ACPI_PPTT_TYPE_PROCESSOR:
   3463  1.8  christos 
   3464  1.8  christos             InfoTable = AcpiDmTableInfoPptt0;
   3465  1.8  christos             Length = sizeof (ACPI_PPTT_PROCESSOR);
   3466  1.8  christos             break;
   3467  1.8  christos 
   3468  1.8  christos         case ACPI_PPTT_TYPE_CACHE:
   3469  1.8  christos 
   3470  1.8  christos             InfoTable = AcpiDmTableInfoPptt1;
   3471  1.8  christos             Length = sizeof (ACPI_PPTT_CACHE);
   3472  1.8  christos             break;
   3473  1.8  christos 
   3474  1.8  christos         case ACPI_PPTT_TYPE_ID:
   3475  1.8  christos 
   3476  1.8  christos             InfoTable = AcpiDmTableInfoPptt2;
   3477  1.8  christos             Length = sizeof (ACPI_PPTT_ID);
   3478  1.8  christos             break;
   3479  1.8  christos 
   3480  1.8  christos         default:
   3481  1.8  christos 
   3482  1.8  christos             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
   3483  1.9  christos                 Subtable->Type);
   3484  1.8  christos 
   3485  1.8  christos             /* Attempt to continue */
   3486  1.8  christos 
   3487  1.9  christos             goto NextSubtable;
   3488  1.8  christos         }
   3489  1.8  christos 
   3490  1.9  christos         if (Subtable->Length < Length)
   3491  1.8  christos         {
   3492  1.8  christos             AcpiOsPrintf ("Invalid subtable length\n");
   3493  1.8  christos             return;
   3494  1.8  christos         }
   3495  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   3496  1.9  christos             Subtable->Length, InfoTable);
   3497  1.8  christos         if (ACPI_FAILURE (Status))
   3498  1.8  christos         {
   3499  1.8  christos             return;
   3500  1.8  christos         }
   3501  1.9  christos         SubtableOffset = Length;
   3502  1.8  christos 
   3503  1.9  christos         switch (Subtable->Type)
   3504  1.8  christos         {
   3505  1.8  christos         case ACPI_PPTT_TYPE_PROCESSOR:
   3506  1.8  christos 
   3507  1.9  christos             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
   3508  1.8  christos 
   3509  1.8  christos             /* Dump SMBIOS handles */
   3510  1.8  christos 
   3511  1.9  christos             if ((UINT8)(Subtable->Length - SubtableOffset) <
   3512  1.8  christos                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
   3513  1.8  christos             {
   3514  1.8  christos                 AcpiOsPrintf ("Invalid private resource number\n");
   3515  1.8  christos                 return;
   3516  1.8  christos             }
   3517  1.8  christos             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
   3518  1.8  christos             {
   3519  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
   3520  1.9  christos                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
   3521  1.8  christos                     4, AcpiDmTableInfoPptt0a);
   3522  1.9  christos                 SubtableOffset += 4;
   3523  1.8  christos             }
   3524  1.8  christos             break;
   3525  1.8  christos 
   3526  1.8  christos         default:
   3527  1.8  christos 
   3528  1.8  christos             break;
   3529  1.8  christos         }
   3530  1.8  christos 
   3531  1.9  christos NextSubtable:
   3532  1.8  christos         /* Point to next subtable */
   3533  1.8  christos 
   3534  1.9  christos         Offset += Subtable->Length;
   3535  1.8  christos     }
   3536  1.8  christos }
   3537  1.8  christos 
   3538  1.8  christos 
   3539  1.8  christos /*******************************************************************************
   3540  1.8  christos  *
   3541  1.2  christos  * FUNCTION:    AcpiDmDumpS3pt
   3542  1.2  christos  *
   3543  1.2  christos  * PARAMETERS:  Table               - A S3PT table
   3544  1.2  christos  *
   3545  1.2  christos  * RETURN:      Length of the table
   3546  1.2  christos  *
   3547  1.2  christos  * DESCRIPTION: Format the contents of a S3PT
   3548  1.2  christos  *
   3549  1.2  christos  ******************************************************************************/
   3550  1.2  christos 
   3551  1.2  christos UINT32
   3552  1.2  christos AcpiDmDumpS3pt (
   3553  1.2  christos     ACPI_TABLE_HEADER       *Tables)
   3554  1.2  christos {
   3555  1.2  christos     ACPI_STATUS             Status;
   3556  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
   3557  1.9  christos     ACPI_FPDT_HEADER        *Subtable;
   3558  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   3559  1.2  christos     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
   3560  1.2  christos 
   3561  1.2  christos 
   3562  1.2  christos     /* Main table */
   3563  1.2  christos 
   3564  1.2  christos     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
   3565  1.2  christos     if (ACPI_FAILURE (Status))
   3566  1.2  christos     {
   3567  1.2  christos         return 0;
   3568  1.2  christos     }
   3569  1.2  christos 
   3570  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
   3571  1.2  christos     while (Offset < S3ptTable->Length)
   3572  1.2  christos     {
   3573  1.2  christos         /* Common subtable header */
   3574  1.2  christos 
   3575  1.2  christos         AcpiOsPrintf ("\n");
   3576  1.9  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
   3577  1.9  christos             Subtable->Length, AcpiDmTableInfoS3ptHdr);
   3578  1.2  christos         if (ACPI_FAILURE (Status))
   3579  1.2  christos         {
   3580  1.2  christos             return 0;
   3581  1.2  christos         }
   3582  1.2  christos 
   3583  1.9  christos         switch (Subtable->Type)
   3584  1.2  christos         {
   3585  1.2  christos         case ACPI_S3PT_TYPE_RESUME:
   3586  1.2  christos 
   3587  1.2  christos             InfoTable = AcpiDmTableInfoS3pt0;
   3588  1.2  christos             break;
   3589  1.2  christos 
   3590  1.2  christos         case ACPI_S3PT_TYPE_SUSPEND:
   3591  1.2  christos 
   3592  1.2  christos             InfoTable = AcpiDmTableInfoS3pt1;
   3593  1.2  christos             break;
   3594  1.2  christos 
   3595  1.2  christos         default:
   3596  1.2  christos 
   3597  1.4  christos             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
   3598  1.9  christos                 Subtable->Type);
   3599  1.2  christos 
   3600  1.2  christos             /* Attempt to continue */
   3601  1.2  christos 
   3602  1.9  christos             if (!Subtable->Length)
   3603  1.2  christos             {
   3604  1.2  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   3605  1.2  christos                 return 0;
   3606  1.2  christos             }
   3607  1.9  christos             goto NextSubtable;
   3608  1.2  christos         }
   3609  1.2  christos 
   3610  1.2  christos         AcpiOsPrintf ("\n");
   3611  1.9  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
   3612  1.9  christos             Subtable->Length, InfoTable);
   3613  1.2  christos         if (ACPI_FAILURE (Status))
   3614  1.2  christos         {
   3615  1.2  christos             return 0;
   3616  1.2  christos         }
   3617  1.2  christos 
   3618  1.9  christos NextSubtable:
   3619  1.2  christos         /* Point to next subtable */
   3620  1.2  christos 
   3621  1.9  christos         Offset += Subtable->Length;
   3622  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
   3623  1.2  christos     }
   3624  1.2  christos 
   3625  1.2  christos     return (S3ptTable->Length);
   3626  1.2  christos }
   3627  1.2  christos 
   3628  1.2  christos 
   3629  1.9  christos 
   3630  1.9  christos /*******************************************************************************
   3631  1.9  christos  *
   3632  1.9  christos  * FUNCTION:    AcpiDmDumpSdev
   3633  1.9  christos  *
   3634  1.9  christos  * PARAMETERS:  Table               - A SDEV table
   3635  1.9  christos  *
   3636  1.9  christos  * RETURN:      None
   3637  1.9  christos  *
   3638  1.9  christos  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
   3639  1.9  christos  *              table that contains variable strings and vendor data.
   3640  1.9  christos  *
   3641  1.9  christos  ******************************************************************************/
   3642  1.9  christos 
   3643  1.9  christos void
   3644  1.9  christos AcpiDmDumpSdev (
   3645  1.9  christos     ACPI_TABLE_HEADER       *Table)
   3646  1.9  christos {
   3647  1.9  christos     ACPI_STATUS             Status;
   3648  1.9  christos     ACPI_SDEV_HEADER        *Subtable;
   3649  1.9  christos     ACPI_SDEV_PCIE          *Pcie;
   3650  1.9  christos     ACPI_SDEV_NAMESPACE     *Namesp;
   3651  1.9  christos     ACPI_DMTABLE_INFO       *InfoTable;
   3652  1.9  christos     UINT32                  Length = Table->Length;
   3653  1.9  christos     UINT32                  Offset = sizeof (ACPI_TABLE_SDEV);
   3654  1.9  christos     UINT16                  PathOffset;
   3655  1.9  christos     UINT16                  PathLength;
   3656  1.9  christos     UINT16                  VendorDataOffset;
   3657  1.9  christos     UINT16                  VendorDataLength;
   3658  1.9  christos 
   3659  1.9  christos 
   3660  1.9  christos     /* Main table */
   3661  1.9  christos 
   3662  1.9  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
   3663  1.9  christos     if (ACPI_FAILURE (Status))
   3664  1.9  christos     {
   3665  1.9  christos         return;
   3666  1.9  christos     }
   3667  1.9  christos 
   3668  1.9  christos     /* Subtables */
   3669  1.9  christos 
   3670  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
   3671  1.9  christos     while (Offset < Table->Length)
   3672  1.9  christos     {
   3673  1.9  christos         /* Common subtable header */
   3674  1.9  christos 
   3675  1.9  christos         AcpiOsPrintf ("\n");
   3676  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   3677  1.9  christos             Subtable->Length, AcpiDmTableInfoSdevHdr);
   3678  1.9  christos         if (ACPI_FAILURE (Status))
   3679  1.9  christos         {
   3680  1.9  christos             return;
   3681  1.9  christos         }
   3682  1.9  christos 
   3683  1.9  christos         switch (Subtable->Type)
   3684  1.9  christos         {
   3685  1.9  christos         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
   3686  1.9  christos 
   3687  1.9  christos             InfoTable = AcpiDmTableInfoSdev0;
   3688  1.9  christos             break;
   3689  1.9  christos 
   3690  1.9  christos         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
   3691  1.9  christos 
   3692  1.9  christos             InfoTable = AcpiDmTableInfoSdev1;
   3693  1.9  christos             break;
   3694  1.9  christos 
   3695  1.9  christos         default:
   3696  1.9  christos             goto NextSubtable;
   3697  1.9  christos         }
   3698  1.9  christos 
   3699  1.9  christos         AcpiOsPrintf ("\n");
   3700  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   3701  1.9  christos             Subtable->Length, InfoTable);
   3702  1.9  christos         if (ACPI_FAILURE (Status))
   3703  1.9  christos         {
   3704  1.9  christos             return;
   3705  1.9  christos         }
   3706  1.9  christos 
   3707  1.9  christos         switch (Subtable->Type)
   3708  1.9  christos         {
   3709  1.9  christos         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
   3710  1.9  christos 
   3711  1.9  christos             /* Dump the PCIe device ID(s) */
   3712  1.9  christos 
   3713  1.9  christos             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
   3714  1.9  christos             PathOffset = Namesp->DeviceIdOffset;
   3715  1.9  christos             PathLength = Namesp->DeviceIdLength;
   3716  1.9  christos 
   3717  1.9  christos             if (PathLength)
   3718  1.9  christos             {
   3719  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   3720  1.9  christos                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
   3721  1.9  christos                     PathLength, AcpiDmTableInfoSdev0a);
   3722  1.9  christos                 if (ACPI_FAILURE (Status))
   3723  1.9  christos                 {
   3724  1.9  christos                     return;
   3725  1.9  christos                 }
   3726  1.9  christos             }
   3727  1.9  christos 
   3728  1.9  christos             /* Dump the vendor-specific data */
   3729  1.9  christos 
   3730  1.9  christos             VendorDataLength =
   3731  1.9  christos                 Namesp->VendorDataLength;
   3732  1.9  christos             VendorDataOffset =
   3733  1.9  christos                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
   3734  1.9  christos 
   3735  1.9  christos             if (VendorDataLength)
   3736  1.9  christos             {
   3737  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   3738  1.9  christos                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
   3739  1.9  christos                     VendorDataLength, AcpiDmTableInfoSdev1b);
   3740  1.9  christos                 if (ACPI_FAILURE (Status))
   3741  1.9  christos                 {
   3742  1.9  christos                     return;
   3743  1.9  christos                 }
   3744  1.9  christos             }
   3745  1.9  christos             break;
   3746  1.9  christos 
   3747  1.9  christos         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
   3748  1.9  christos 
   3749  1.9  christos             /* PCI path substructures */
   3750  1.9  christos 
   3751  1.9  christos             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
   3752  1.9  christos             PathOffset = Pcie->PathOffset;
   3753  1.9  christos             PathLength = Pcie->PathLength;
   3754  1.9  christos 
   3755  1.9  christos             while (PathLength)
   3756  1.9  christos             {
   3757  1.9  christos                 Status = AcpiDmDumpTable (Table->Length,
   3758  1.9  christos                     PathOffset + Offset,
   3759  1.9  christos                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
   3760  1.9  christos                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
   3761  1.9  christos                 if (ACPI_FAILURE (Status))
   3762  1.9  christos                 {
   3763  1.9  christos                     return;
   3764  1.9  christos                 }
   3765  1.9  christos 
   3766  1.9  christos                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
   3767  1.9  christos                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
   3768  1.9  christos             }
   3769  1.9  christos 
   3770  1.9  christos             /* VendorData */
   3771  1.9  christos 
   3772  1.9  christos             VendorDataLength = Pcie->VendorDataLength;
   3773  1.9  christos             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
   3774  1.9  christos 
   3775  1.9  christos             if (VendorDataLength)
   3776  1.9  christos             {
   3777  1.9  christos                 Status = AcpiDmDumpTable (Table->Length, 0,
   3778  1.9  christos                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
   3779  1.9  christos                     VendorDataLength, AcpiDmTableInfoSdev1b);
   3780  1.9  christos             }
   3781  1.9  christos             break;
   3782  1.9  christos 
   3783  1.9  christos         default:
   3784  1.9  christos             goto NextSubtable;
   3785  1.9  christos         }
   3786  1.9  christos 
   3787  1.9  christos NextSubtable:
   3788  1.9  christos         /* Point to next subtable */
   3789  1.9  christos 
   3790  1.9  christos         Offset += Subtable->Length;
   3791  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
   3792  1.9  christos             Subtable->Length);
   3793  1.9  christos     }
   3794  1.9  christos }
   3795  1.9  christos 
   3796  1.9  christos 
   3797  1.2  christos /*******************************************************************************
   3798  1.2  christos  *
   3799  1.2  christos  * FUNCTION:    AcpiDmDumpSlic
   3800  1.2  christos  *
   3801  1.2  christos  * PARAMETERS:  Table               - A SLIC table
   3802  1.2  christos  *
   3803  1.2  christos  * RETURN:      None
   3804  1.2  christos  *
   3805  1.2  christos  * DESCRIPTION: Format the contents of a SLIC
   3806  1.2  christos  *
   3807  1.2  christos  ******************************************************************************/
   3808  1.2  christos 
   3809  1.2  christos void
   3810  1.2  christos AcpiDmDumpSlic (
   3811  1.2  christos     ACPI_TABLE_HEADER       *Table)
   3812  1.2  christos {
   3813  1.4  christos 
   3814  1.3  christos     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
   3815  1.4  christos         Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
   3816  1.2  christos }
   3817  1.2  christos 
   3818  1.2  christos 
   3819  1.2  christos /*******************************************************************************
   3820  1.2  christos  *
   3821  1.1    jruoho  * FUNCTION:    AcpiDmDumpSlit
   3822  1.1    jruoho  *
   3823  1.1    jruoho  * PARAMETERS:  Table               - An SLIT
   3824  1.1    jruoho  *
   3825  1.1    jruoho  * RETURN:      None
   3826  1.1    jruoho  *
   3827  1.1    jruoho  * DESCRIPTION: Format the contents of a SLIT
   3828  1.1    jruoho  *
   3829  1.1    jruoho  ******************************************************************************/
   3830  1.1    jruoho 
   3831  1.1    jruoho void
   3832  1.1    jruoho AcpiDmDumpSlit (
   3833  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   3834  1.1    jruoho {
   3835  1.1    jruoho     ACPI_STATUS             Status;
   3836  1.1    jruoho     UINT32                  Offset;
   3837  1.1    jruoho     UINT8                   *Row;
   3838  1.1    jruoho     UINT32                  Localities;
   3839  1.1    jruoho     UINT32                  i;
   3840  1.1    jruoho     UINT32                  j;
   3841  1.1    jruoho 
   3842  1.1    jruoho 
   3843  1.1    jruoho     /* Main table */
   3844  1.1    jruoho 
   3845  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
   3846  1.1    jruoho     if (ACPI_FAILURE (Status))
   3847  1.1    jruoho     {
   3848  1.1    jruoho         return;
   3849  1.1    jruoho     }
   3850  1.1    jruoho 
   3851  1.1    jruoho     /* Display the Locality NxN Matrix */
   3852  1.1    jruoho 
   3853  1.1    jruoho     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
   3854  1.1    jruoho     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
   3855  1.1    jruoho     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
   3856  1.1    jruoho 
   3857  1.1    jruoho     for (i = 0; i < Localities; i++)
   3858  1.1    jruoho     {
   3859  1.1    jruoho         /* Display one row of the matrix */
   3860  1.1    jruoho 
   3861  1.1    jruoho         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
   3862  1.1    jruoho         for  (j = 0; j < Localities; j++)
   3863  1.1    jruoho         {
   3864  1.1    jruoho             /* Check for beyond EOT */
   3865  1.1    jruoho 
   3866  1.1    jruoho             if (Offset >= Table->Length)
   3867  1.1    jruoho             {
   3868  1.4  christos                 AcpiOsPrintf (
   3869  1.4  christos                     "\n**** Not enough room in table for all localities\n");
   3870  1.1    jruoho                 return;
   3871  1.1    jruoho             }
   3872  1.1    jruoho 
   3873  1.2  christos             AcpiOsPrintf ("%2.2X", Row[j]);
   3874  1.1    jruoho             Offset++;
   3875  1.1    jruoho 
   3876  1.1    jruoho             /* Display up to 16 bytes per output row */
   3877  1.1    jruoho 
   3878  1.2  christos             if ((j+1) < Localities)
   3879  1.1    jruoho             {
   3880  1.2  christos                 AcpiOsPrintf (" ");
   3881  1.2  christos 
   3882  1.2  christos                 if (j && (((j+1) % 16) == 0))
   3883  1.2  christos                 {
   3884  1.2  christos                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
   3885  1.2  christos                     AcpiDmLineHeader (Offset, 0, NULL);
   3886  1.2  christos                 }
   3887  1.1    jruoho             }
   3888  1.1    jruoho         }
   3889  1.1    jruoho 
   3890  1.1    jruoho         /* Point to next row */
   3891  1.1    jruoho 
   3892  1.1    jruoho         AcpiOsPrintf ("\n");
   3893  1.1    jruoho         Row += Localities;
   3894  1.1    jruoho     }
   3895  1.1    jruoho }
   3896  1.1    jruoho 
   3897  1.1    jruoho 
   3898  1.1    jruoho /*******************************************************************************
   3899  1.1    jruoho  *
   3900  1.1    jruoho  * FUNCTION:    AcpiDmDumpSrat
   3901  1.1    jruoho  *
   3902  1.1    jruoho  * PARAMETERS:  Table               - A SRAT table
   3903  1.1    jruoho  *
   3904  1.1    jruoho  * RETURN:      None
   3905  1.1    jruoho  *
   3906  1.1    jruoho  * DESCRIPTION: Format the contents of a SRAT
   3907  1.1    jruoho  *
   3908  1.1    jruoho  ******************************************************************************/
   3909  1.1    jruoho 
   3910  1.1    jruoho void
   3911  1.1    jruoho AcpiDmDumpSrat (
   3912  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   3913  1.1    jruoho {
   3914  1.1    jruoho     ACPI_STATUS             Status;
   3915  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
   3916  1.9  christos     ACPI_SUBTABLE_HEADER    *Subtable;
   3917  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   3918  1.1    jruoho 
   3919  1.1    jruoho 
   3920  1.1    jruoho     /* Main table */
   3921  1.1    jruoho 
   3922  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
   3923  1.1    jruoho     if (ACPI_FAILURE (Status))
   3924  1.1    jruoho     {
   3925  1.1    jruoho         return;
   3926  1.1    jruoho     }
   3927  1.1    jruoho 
   3928  1.2  christos     /* Subtables */
   3929  1.1    jruoho 
   3930  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   3931  1.1    jruoho     while (Offset < Table->Length)
   3932  1.1    jruoho     {
   3933  1.2  christos         /* Common subtable header */
   3934  1.1    jruoho 
   3935  1.1    jruoho         AcpiOsPrintf ("\n");
   3936  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   3937  1.9  christos             Subtable->Length, AcpiDmTableInfoSratHdr);
   3938  1.1    jruoho         if (ACPI_FAILURE (Status))
   3939  1.1    jruoho         {
   3940  1.1    jruoho             return;
   3941  1.1    jruoho         }
   3942  1.1    jruoho 
   3943  1.9  christos         switch (Subtable->Type)
   3944  1.1    jruoho         {
   3945  1.1    jruoho         case ACPI_SRAT_TYPE_CPU_AFFINITY:
   3946  1.2  christos 
   3947  1.1    jruoho             InfoTable = AcpiDmTableInfoSrat0;
   3948  1.1    jruoho             break;
   3949  1.2  christos 
   3950  1.1    jruoho         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
   3951  1.2  christos 
   3952  1.1    jruoho             InfoTable = AcpiDmTableInfoSrat1;
   3953  1.1    jruoho             break;
   3954  1.2  christos 
   3955  1.1    jruoho         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
   3956  1.2  christos 
   3957  1.1    jruoho             InfoTable = AcpiDmTableInfoSrat2;
   3958  1.1    jruoho             break;
   3959  1.2  christos 
   3960  1.2  christos         case ACPI_SRAT_TYPE_GICC_AFFINITY:
   3961  1.2  christos 
   3962  1.2  christos             InfoTable = AcpiDmTableInfoSrat3;
   3963  1.2  christos             break;
   3964  1.2  christos 
   3965  1.8  christos         case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
   3966  1.8  christos 
   3967  1.8  christos             InfoTable = AcpiDmTableInfoSrat4;
   3968  1.8  christos             break;
   3969  1.8  christos 
   3970  1.1    jruoho         default:
   3971  1.4  christos             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
   3972  1.9  christos                 Subtable->Type);
   3973  1.1    jruoho 
   3974  1.1    jruoho             /* Attempt to continue */
   3975  1.1    jruoho 
   3976  1.9  christos             if (!Subtable->Length)
   3977  1.1    jruoho             {
   3978  1.1    jruoho                 AcpiOsPrintf ("Invalid zero length subtable\n");
   3979  1.1    jruoho                 return;
   3980  1.1    jruoho             }
   3981  1.9  christos             goto NextSubtable;
   3982  1.1    jruoho         }
   3983  1.1    jruoho 
   3984  1.1    jruoho         AcpiOsPrintf ("\n");
   3985  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   3986  1.9  christos             Subtable->Length, InfoTable);
   3987  1.1    jruoho         if (ACPI_FAILURE (Status))
   3988  1.1    jruoho         {
   3989  1.1    jruoho             return;
   3990  1.1    jruoho         }
   3991  1.1    jruoho 
   3992  1.9  christos NextSubtable:
   3993  1.2  christos         /* Point to next subtable */
   3994  1.1    jruoho 
   3995  1.9  christos         Offset += Subtable->Length;
   3996  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
   3997  1.9  christos             Subtable->Length);
   3998  1.1    jruoho     }
   3999  1.1    jruoho }
   4000  1.1    jruoho 
   4001  1.1    jruoho 
   4002  1.1    jruoho /*******************************************************************************
   4003  1.1    jruoho  *
   4004  1.3  christos  * FUNCTION:    AcpiDmDumpStao
   4005  1.3  christos  *
   4006  1.3  christos  * PARAMETERS:  Table               - A STAO table
   4007  1.3  christos  *
   4008  1.3  christos  * RETURN:      None
   4009  1.3  christos  *
   4010  1.3  christos  * DESCRIPTION: Format the contents of a STAO. This is a variable-length
   4011  1.3  christos  *              table that contains an open-ended number of ASCII strings
   4012  1.3  christos  *              at the end of the table.
   4013  1.3  christos  *
   4014  1.3  christos  ******************************************************************************/
   4015  1.3  christos 
   4016  1.3  christos void
   4017  1.3  christos AcpiDmDumpStao (
   4018  1.3  christos     ACPI_TABLE_HEADER       *Table)
   4019  1.3  christos {
   4020  1.3  christos     ACPI_STATUS             Status;
   4021  1.3  christos     char                    *Namepath;
   4022  1.3  christos     UINT32                  Length = Table->Length;
   4023  1.3  christos     UINT32                  StringLength;
   4024  1.3  christos     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
   4025  1.3  christos 
   4026  1.3  christos 
   4027  1.3  christos     /* Main table */
   4028  1.3  christos 
   4029  1.3  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
   4030  1.3  christos     if (ACPI_FAILURE (Status))
   4031  1.3  christos     {
   4032  1.3  christos         return;
   4033  1.3  christos     }
   4034  1.3  christos 
   4035  1.3  christos     /* The rest of the table consists of Namepath strings */
   4036  1.3  christos 
   4037  1.3  christos     while (Offset < Table->Length)
   4038  1.3  christos     {
   4039  1.3  christos         Namepath = ACPI_ADD_PTR (char, Table, Offset);
   4040  1.3  christos         StringLength = strlen (Namepath) + 1;
   4041  1.3  christos 
   4042  1.3  christos         AcpiDmLineHeader (Offset, StringLength, "Namestring");
   4043  1.3  christos         AcpiOsPrintf ("\"%s\"\n", Namepath);
   4044  1.3  christos 
   4045  1.3  christos         /* Point to next namepath */
   4046  1.3  christos 
   4047  1.3  christos         Offset += StringLength;
   4048  1.3  christos     }
   4049  1.3  christos }
   4050  1.3  christos 
   4051  1.3  christos 
   4052  1.3  christos /*******************************************************************************
   4053  1.3  christos  *
   4054  1.3  christos  * FUNCTION:    AcpiDmDumpTcpa
   4055  1.3  christos  *
   4056  1.3  christos  * PARAMETERS:  Table               - A TCPA table
   4057  1.3  christos  *
   4058  1.3  christos  * RETURN:      None
   4059  1.3  christos  *
   4060  1.3  christos  * DESCRIPTION: Format the contents of a TCPA.
   4061  1.3  christos  *
   4062  1.3  christos  * NOTE:        There are two versions of the table with the same signature:
   4063  1.3  christos  *              the client version and the server version. The common
   4064  1.3  christos  *              PlatformClass field is used to differentiate the two types of
   4065  1.3  christos  *              tables.
   4066  1.3  christos  *
   4067  1.3  christos  ******************************************************************************/
   4068  1.3  christos 
   4069  1.3  christos void
   4070  1.3  christos AcpiDmDumpTcpa (
   4071  1.3  christos     ACPI_TABLE_HEADER       *Table)
   4072  1.3  christos {
   4073  1.3  christos     UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);
   4074  1.3  christos     ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (
   4075  1.3  christos                                 ACPI_TABLE_TCPA_HDR, Table);
   4076  1.9  christos     ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (
   4077  1.3  christos                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
   4078  1.3  christos     ACPI_STATUS             Status;
   4079  1.3  christos 
   4080  1.3  christos 
   4081  1.3  christos     /* Main table */
   4082  1.3  christos 
   4083  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table,
   4084  1.3  christos         0, AcpiDmTableInfoTcpaHdr);
   4085  1.3  christos     if (ACPI_FAILURE (Status))
   4086  1.3  christos     {
   4087  1.3  christos         return;
   4088  1.3  christos     }
   4089  1.3  christos 
   4090  1.3  christos     /*
   4091  1.3  christos      * Examine the PlatformClass field to determine the table type.
   4092  1.3  christos      * Either a client or server table. Only one.
   4093  1.3  christos      */
   4094  1.3  christos     switch (CommonHeader->PlatformClass)
   4095  1.3  christos     {
   4096  1.3  christos     case ACPI_TCPA_CLIENT_TABLE:
   4097  1.3  christos 
   4098  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   4099  1.3  christos             Table->Length - Offset, AcpiDmTableInfoTcpaClient);
   4100  1.3  christos         break;
   4101  1.3  christos 
   4102  1.3  christos     case ACPI_TCPA_SERVER_TABLE:
   4103  1.3  christos 
   4104  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   4105  1.3  christos             Table->Length - Offset, AcpiDmTableInfoTcpaServer);
   4106  1.3  christos         break;
   4107  1.3  christos 
   4108  1.3  christos     default:
   4109  1.3  christos 
   4110  1.3  christos         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
   4111  1.3  christos             CommonHeader->PlatformClass);
   4112  1.3  christos         Status = AE_ERROR;
   4113  1.3  christos         break;
   4114  1.3  christos     }
   4115  1.3  christos 
   4116  1.3  christos     if (ACPI_FAILURE (Status))
   4117  1.3  christos     {
   4118  1.3  christos         AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
   4119  1.3  christos     }
   4120  1.3  christos }
   4121  1.3  christos 
   4122  1.3  christos 
   4123  1.3  christos /*******************************************************************************
   4124  1.3  christos  *
   4125  1.9  christos  * FUNCTION:    AcpiDmDumpTpm2
   4126  1.9  christos  *
   4127  1.9  christos  * PARAMETERS:  Table               - A TPM2 table
   4128  1.9  christos  *
   4129  1.9  christos  * RETURN:      None
   4130  1.9  christos  *
   4131  1.9  christos  * DESCRIPTION: Format the contents of a TPM2.
   4132  1.9  christos  *
   4133  1.9  christos  ******************************************************************************/
   4134  1.9  christos 
   4135  1.9  christos void
   4136  1.9  christos AcpiDmDumpTpm2 (
   4137  1.9  christos     ACPI_TABLE_HEADER       *Table)
   4138  1.9  christos {
   4139  1.9  christos     UINT32                  Offset = sizeof (ACPI_TABLE_TPM2);
   4140  1.9  christos     ACPI_TABLE_TPM2         *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);
   4141  1.9  christos     ACPI_TPM2_TRAILER       *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
   4142  1.9  christos     ACPI_TPM2_ARM_SMC       *ArmSubtable;
   4143  1.9  christos     ACPI_STATUS             Status;
   4144  1.9  christos 
   4145  1.9  christos 
   4146  1.9  christos     /* Main table */
   4147  1.9  christos 
   4148  1.9  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
   4149  1.9  christos     if (ACPI_FAILURE (Status))
   4150  1.9  christos     {
   4151  1.9  christos         return;
   4152  1.9  christos     }
   4153  1.9  christos 
   4154  1.9  christos     AcpiOsPrintf ("\n");
   4155  1.9  christos     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   4156  1.9  christos         Table->Length - Offset, AcpiDmTableInfoTpm2a);
   4157  1.9  christos     if (ACPI_FAILURE (Status))
   4158  1.9  christos     {
   4159  1.9  christos         return;
   4160  1.9  christos     }
   4161  1.9  christos 
   4162  1.9  christos     switch (CommonHeader->StartMethod)
   4163  1.9  christos     {
   4164  1.9  christos     case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
   4165  1.9  christos 
   4166  1.9  christos         ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,
   4167  1.9  christos             sizeof (ACPI_TPM2_TRAILER));
   4168  1.9  christos         Offset += sizeof (ACPI_TPM2_TRAILER);
   4169  1.9  christos 
   4170  1.9  christos         AcpiOsPrintf ("\n");
   4171  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
   4172  1.9  christos             Table->Length - Offset, AcpiDmTableInfoTpm211);
   4173  1.9  christos         break;
   4174  1.9  christos 
   4175  1.9  christos     default:
   4176  1.9  christos         break;
   4177  1.9  christos     }
   4178  1.9  christos }
   4179  1.9  christos 
   4180  1.9  christos 
   4181  1.9  christos /*******************************************************************************
   4182  1.9  christos  *
   4183  1.2  christos  * FUNCTION:    AcpiDmDumpVrtc
   4184  1.2  christos  *
   4185  1.2  christos  * PARAMETERS:  Table               - A VRTC table
   4186  1.2  christos  *
   4187  1.2  christos  * RETURN:      None
   4188  1.2  christos  *
   4189  1.2  christos  * DESCRIPTION: Format the contents of a VRTC
   4190  1.2  christos  *
   4191  1.2  christos  ******************************************************************************/
   4192  1.2  christos 
   4193  1.2  christos void
   4194  1.2  christos AcpiDmDumpVrtc (
   4195  1.2  christos     ACPI_TABLE_HEADER       *Table)
   4196  1.2  christos {
   4197  1.2  christos     ACPI_STATUS             Status;
   4198  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
   4199  1.9  christos     ACPI_VRTC_ENTRY         *Subtable;
   4200  1.2  christos 
   4201  1.2  christos 
   4202  1.2  christos     /* Main table */
   4203  1.2  christos 
   4204  1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
   4205  1.2  christos     if (ACPI_FAILURE (Status))
   4206  1.2  christos     {
   4207  1.2  christos         return;
   4208  1.2  christos     }
   4209  1.2  christos 
   4210  1.2  christos     /* Subtables */
   4211  1.2  christos 
   4212  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
   4213  1.2  christos     while (Offset < Table->Length)
   4214  1.2  christos     {
   4215  1.2  christos         /* Common subtable header */
   4216  1.2  christos 
   4217  1.2  christos         AcpiOsPrintf ("\n");
   4218  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   4219  1.4  christos             sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
   4220  1.2  christos         if (ACPI_FAILURE (Status))
   4221  1.2  christos         {
   4222  1.2  christos             return;
   4223  1.2  christos         }
   4224  1.2  christos 
   4225  1.2  christos         /* Point to next subtable */
   4226  1.2  christos 
   4227  1.2  christos         Offset += sizeof (ACPI_VRTC_ENTRY);
   4228  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Subtable,
   4229  1.4  christos             sizeof (ACPI_VRTC_ENTRY));
   4230  1.2  christos     }
   4231  1.2  christos }
   4232  1.2  christos 
   4233  1.2  christos 
   4234  1.2  christos /*******************************************************************************
   4235  1.2  christos  *
   4236  1.1    jruoho  * FUNCTION:    AcpiDmDumpWdat
   4237  1.1    jruoho  *
   4238  1.1    jruoho  * PARAMETERS:  Table               - A WDAT table
   4239  1.1    jruoho  *
   4240  1.1    jruoho  * RETURN:      None
   4241  1.1    jruoho  *
   4242  1.1    jruoho  * DESCRIPTION: Format the contents of a WDAT
   4243  1.1    jruoho  *
   4244  1.1    jruoho  ******************************************************************************/
   4245  1.1    jruoho 
   4246  1.1    jruoho void
   4247  1.1    jruoho AcpiDmDumpWdat (
   4248  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   4249  1.1    jruoho {
   4250  1.1    jruoho     ACPI_STATUS             Status;
   4251  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
   4252  1.9  christos     ACPI_WDAT_ENTRY         *Subtable;
   4253  1.1    jruoho 
   4254  1.1    jruoho 
   4255  1.1    jruoho     /* Main table */
   4256  1.1    jruoho 
   4257  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
   4258  1.1    jruoho     if (ACPI_FAILURE (Status))
   4259  1.1    jruoho     {
   4260  1.1    jruoho         return;
   4261  1.1    jruoho     }
   4262  1.1    jruoho 
   4263  1.2  christos     /* Subtables */
   4264  1.1    jruoho 
   4265  1.9  christos     Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
   4266  1.1    jruoho     while (Offset < Table->Length)
   4267  1.1    jruoho     {
   4268  1.2  christos         /* Common subtable header */
   4269  1.1    jruoho 
   4270  1.1    jruoho         AcpiOsPrintf ("\n");
   4271  1.9  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
   4272  1.4  christos             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
   4273  1.1    jruoho         if (ACPI_FAILURE (Status))
   4274  1.1    jruoho         {
   4275  1.1    jruoho             return;
   4276  1.1    jruoho         }
   4277  1.1    jruoho 
   4278  1.2  christos         /* Point to next subtable */
   4279  1.1    jruoho 
   4280  1.1    jruoho         Offset += sizeof (ACPI_WDAT_ENTRY);
   4281  1.9  christos         Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,
   4282  1.4  christos             sizeof (ACPI_WDAT_ENTRY));
   4283  1.1    jruoho     }
   4284  1.1    jruoho }
   4285  1.3  christos 
   4286  1.4  christos 
   4287  1.3  christos /*******************************************************************************
   4288  1.3  christos  *
   4289  1.3  christos  * FUNCTION:    AcpiDmDumpWpbt
   4290  1.3  christos  *
   4291  1.3  christos  * PARAMETERS:  Table               - A WPBT table
   4292  1.3  christos  *
   4293  1.3  christos  * RETURN:      None
   4294  1.3  christos  *
   4295  1.3  christos  * DESCRIPTION: Format the contents of a WPBT. This table type consists
   4296  1.3  christos  *              of an open-ended arguments buffer at the end of the table.
   4297  1.3  christos  *
   4298  1.3  christos  ******************************************************************************/
   4299  1.3  christos 
   4300  1.3  christos void
   4301  1.3  christos AcpiDmDumpWpbt (
   4302  1.3  christos     ACPI_TABLE_HEADER       *Table)
   4303  1.3  christos {
   4304  1.3  christos     ACPI_STATUS             Status;
   4305  1.9  christos     ACPI_TABLE_WPBT         *Subtable;
   4306  1.3  christos     UINT32                  Length = Table->Length;
   4307  1.3  christos     UINT16                  ArgumentsLength;
   4308  1.3  christos 
   4309  1.3  christos 
   4310  1.3  christos     /* Dump the main table */
   4311  1.3  christos 
   4312  1.3  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
   4313  1.3  christos     if (ACPI_FAILURE (Status))
   4314  1.3  christos     {
   4315  1.3  christos         return;
   4316  1.3  christos     }
   4317  1.3  christos 
   4318  1.3  christos     /* Extract the arguments buffer length from the main table */
   4319  1.3  christos 
   4320  1.9  christos     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
   4321  1.9  christos     ArgumentsLength = Subtable->ArgumentsLength;
   4322  1.3  christos 
   4323  1.3  christos     /* Dump the arguments buffer */
   4324  1.3  christos 
   4325  1.3  christos     (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
   4326  1.3  christos         AcpiDmTableInfoWpbt0);
   4327  1.3  christos }
   4328