Home | History | Annotate | Line # | Download | only in common
dmtbdump.c revision 1.4
      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.4  christos  * Copyright (C) 2000 - 2016, 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.2  christos /* Local prototypes */
     56  1.2  christos 
     57  1.2  christos static void
     58  1.2  christos AcpiDmValidateFadtLength (
     59  1.2  christos     UINT32                  Revision,
     60  1.2  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.3  christos 
    362  1.1    jruoho 
    363  1.2  christos     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
    364  1.1    jruoho 
    365  1.4  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    366  1.4  christos         AcpiDmTableInfoFadt1);
    367  1.3  christos     if (ACPI_FAILURE (Status))
    368  1.3  christos     {
    369  1.3  christos         return;
    370  1.3  christos     }
    371  1.1    jruoho 
    372  1.2  christos     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
    373  1.1    jruoho 
    374  1.2  christos     if ((Table->Length > ACPI_FADT_V1_SIZE) &&
    375  1.2  christos         (Table->Length <= ACPI_FADT_V2_SIZE))
    376  1.1    jruoho     {
    377  1.4  christos         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    378  1.4  christos             AcpiDmTableInfoFadt2);
    379  1.3  christos         if (ACPI_FAILURE (Status))
    380  1.3  christos         {
    381  1.3  christos             return;
    382  1.3  christos         }
    383  1.1    jruoho     }
    384  1.1    jruoho 
    385  1.2  christos     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
    386  1.1    jruoho 
    387  1.2  christos     else if (Table->Length > ACPI_FADT_V2_SIZE)
    388  1.1    jruoho     {
    389  1.4  christos         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    390  1.4  christos             AcpiDmTableInfoFadt3);
    391  1.3  christos         if (ACPI_FAILURE (Status))
    392  1.3  christos         {
    393  1.3  christos             return;
    394  1.3  christos         }
    395  1.2  christos 
    396  1.2  christos         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
    397  1.2  christos 
    398  1.2  christos         if (Table->Length > ACPI_FADT_V3_SIZE)
    399  1.2  christos         {
    400  1.4  christos             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    401  1.4  christos                 AcpiDmTableInfoFadt5);
    402  1.3  christos             if (ACPI_FAILURE (Status))
    403  1.3  christos             {
    404  1.3  christos                 return;
    405  1.3  christos             }
    406  1.3  christos         }
    407  1.3  christos 
    408  1.3  christos         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
    409  1.3  christos 
    410  1.3  christos         if (Table->Length > ACPI_FADT_V3_SIZE)
    411  1.3  christos         {
    412  1.4  christos             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
    413  1.4  christos                 AcpiDmTableInfoFadt6);
    414  1.3  christos             if (ACPI_FAILURE (Status))
    415  1.3  christos             {
    416  1.3  christos                 return;
    417  1.3  christos             }
    418  1.2  christos         }
    419  1.1    jruoho     }
    420  1.1    jruoho 
    421  1.1    jruoho     /* Validate various fields in the FADT, including length */
    422  1.1    jruoho 
    423  1.1    jruoho     AcpiTbCreateLocalFadt (Table, Table->Length);
    424  1.2  christos 
    425  1.2  christos     /* Validate FADT length against the revision */
    426  1.2  christos 
    427  1.2  christos     AcpiDmValidateFadtLength (Table->Revision, Table->Length);
    428  1.2  christos }
    429  1.2  christos 
    430  1.2  christos 
    431  1.2  christos /*******************************************************************************
    432  1.2  christos  *
    433  1.2  christos  * FUNCTION:    AcpiDmValidateFadtLength
    434  1.2  christos  *
    435  1.2  christos  * PARAMETERS:  Revision            - FADT revision (Header->Revision)
    436  1.2  christos  *              Length              - FADT length (Header->Length
    437  1.2  christos  *
    438  1.2  christos  * RETURN:      None
    439  1.2  christos  *
    440  1.2  christos  * DESCRIPTION: Check the FADT revision against the expected table length for
    441  1.2  christos  *              that revision. Issue a warning if the length is not what was
    442  1.2  christos  *              expected. This seems to be such a common BIOS bug that the
    443  1.2  christos  *              FADT revision has been rendered virtually meaningless.
    444  1.2  christos  *
    445  1.2  christos  ******************************************************************************/
    446  1.2  christos 
    447  1.2  christos static void
    448  1.2  christos AcpiDmValidateFadtLength (
    449  1.2  christos     UINT32                  Revision,
    450  1.2  christos     UINT32                  Length)
    451  1.2  christos {
    452  1.2  christos     UINT32                  ExpectedLength;
    453  1.2  christos 
    454  1.2  christos 
    455  1.2  christos     switch (Revision)
    456  1.2  christos     {
    457  1.2  christos     case 0:
    458  1.2  christos 
    459  1.2  christos         AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
    460  1.2  christos         return;
    461  1.2  christos 
    462  1.2  christos     case 1:
    463  1.2  christos 
    464  1.2  christos         ExpectedLength = ACPI_FADT_V1_SIZE;
    465  1.2  christos         break;
    466  1.2  christos 
    467  1.2  christos     case 2:
    468  1.2  christos 
    469  1.2  christos         ExpectedLength = ACPI_FADT_V2_SIZE;
    470  1.2  christos         break;
    471  1.2  christos 
    472  1.2  christos     case 3:
    473  1.2  christos     case 4:
    474  1.2  christos 
    475  1.2  christos         ExpectedLength = ACPI_FADT_V3_SIZE;
    476  1.2  christos         break;
    477  1.2  christos 
    478  1.2  christos     case 5:
    479  1.2  christos 
    480  1.2  christos         ExpectedLength = ACPI_FADT_V5_SIZE;
    481  1.2  christos         break;
    482  1.2  christos 
    483  1.2  christos     default:
    484  1.2  christos 
    485  1.2  christos         return;
    486  1.2  christos     }
    487  1.2  christos 
    488  1.2  christos     if (Length == ExpectedLength)
    489  1.2  christos     {
    490  1.2  christos         return;
    491  1.2  christos     }
    492  1.2  christos 
    493  1.2  christos     AcpiOsPrintf (
    494  1.4  christos         "\n// ACPI Warning: FADT revision %X does not match length: "
    495  1.4  christos         "found %X expected %X\n",
    496  1.2  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.1    jruoho     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.1    jruoho     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.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
    537  1.4  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.1    jruoho         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.1    jruoho             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
    559  1.1    jruoho             DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
    560  1.1    jruoho             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.1    jruoho             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
    569  1.1    jruoho             DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
    570  1.1    jruoho             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.1    jruoho             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
    583  1.1    jruoho             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.4  christos                 SubTable->Header.Type);
    591  1.1    jruoho             return;
    592  1.1    jruoho         }
    593  1.1    jruoho 
    594  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
    595  1.4  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.1    jruoho         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.1    jruoho         Offset += SubTable->Header.Length;
    664  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable,
    665  1.4  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.1    jruoho     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.1    jruoho     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.1    jruoho         Status = AcpiDmDumpTable (Length, Offset, SubTable,
    708  1.4  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.1    jruoho         Offset += SubTable->Header.Length;
    717  1.1    jruoho         SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
    718  1.4  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.2  christos     ACPI_CSRT_GROUP         *SubTable;
    742  1.2  christos     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
    743  1.2  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.2  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.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
    762  1.4  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.2  christos         SubOffset += SubTable->SharedInfoLength;
    783  1.2  christos 
    784  1.2  christos         /* Sub-Subtables (Resource Descriptors) */
    785  1.2  christos 
    786  1.2  christos         SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
    787  1.2  christos             Offset + SubOffset);
    788  1.2  christos 
    789  1.2  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.2  christos             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
    794  1.4  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.2  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.2  christos             SubOffset += SubSubTable->Length;
    820  1.2  christos             SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
    821  1.4  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.2  christos         Offset += SubTable->Length;
    827  1.2  christos         SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
    828  1.4  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.2  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.2  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.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
    875  1.4  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.2  christos         for (i = 0; i < SubTable->RegisterCount; i++)
    884  1.2  christos         {
    885  1.2  christos             ArrayOffset = SubTable->BaseAddressOffset +
    886  1.2  christos                 (sizeof (ACPI_GENERIC_ADDRESS) * i);
    887  1.2  christos             AbsoluteOffset = Offset + ArrayOffset;
    888  1.2  christos             Array = (UINT8 *) SubTable + ArrayOffset;
    889  1.2  christos 
    890  1.2  christos             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
    891  1.4  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.2  christos         for (i = 0; i < SubTable->RegisterCount; i++)
    901  1.2  christos         {
    902  1.2  christos             ArrayOffset = SubTable->AddressSizeOffset +
    903  1.2  christos                 (sizeof (UINT32) * i);
    904  1.2  christos             AbsoluteOffset = Offset + ArrayOffset;
    905  1.2  christos             Array = (UINT8 *) SubTable + ArrayOffset;
    906  1.2  christos 
    907  1.2  christos             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
    908  1.4  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.2  christos         ArrayOffset = SubTable->NamepathOffset;
    919  1.2  christos         AbsoluteOffset = Offset + ArrayOffset;
    920  1.2  christos         Array = (UINT8 *) SubTable + ArrayOffset;
    921  1.2  christos 
    922  1.2  christos         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
    923  1.4  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.2  christos         if (SubTable->OemDataOffset)
    932  1.2  christos         {
    933  1.3  christos             Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset,
    934  1.4  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.2  christos         Offset += SubTable->Length;
    945  1.2  christos         SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
    946  1.4  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.1    jruoho     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.1    jruoho     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.1    jruoho         Status = AcpiDmDumpTable (Length, Offset, SubTable,
    996  1.4  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.1    jruoho         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.4  christos                 SubTable->Type);
   1040  1.1    jruoho             return;
   1041  1.1    jruoho         }
   1042  1.1    jruoho 
   1043  1.1    jruoho         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   1044  1.4  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.2  christos         if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
   1054  1.2  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.1    jruoho         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
   1062  1.1    jruoho         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.1    jruoho         Offset += SubTable->Length;
   1104  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable,
   1105  1.4  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.1    jruoho     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.1    jruoho     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.1    jruoho         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.1    jruoho         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.1    jruoho     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.1    jruoho     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.1    jruoho         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.1    jruoho         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.2  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.2  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.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   1361  1.4  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.2  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.4  christos                 SubTable->Type);
   1383  1.2  christos 
   1384  1.2  christos             /* Attempt to continue */
   1385  1.2  christos 
   1386  1.2  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.2  christos             goto NextSubTable;
   1392  1.2  christos         }
   1393  1.2  christos 
   1394  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   1395  1.4  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.2  christos NextSubTable:
   1402  1.2  christos         /* Point to next subtable */
   1403  1.2  christos 
   1404  1.2  christos         Offset += SubTable->Length;
   1405  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable,
   1406  1.4  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.2  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.2  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.2  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.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   1455  1.4  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.2  christos         switch (SubTable->Type)
   1463  1.2  christos         {
   1464  1.2  christos         case ACPI_GTDT_TYPE_TIMER_BLOCK:
   1465  1.2  christos 
   1466  1.2  christos             SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
   1467  1.2  christos             GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
   1468  1.4  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.2  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.4  christos                 SubTable->Type);
   1486  1.2  christos             return;
   1487  1.2  christos         }
   1488  1.2  christos 
   1489  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   1490  1.4  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.2  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.4  christos                 ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
   1506  1.2  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.2  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.2  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.1    jruoho     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.1    jruoho     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.1    jruoho         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.1    jruoho             SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
   1577  1.1    jruoho             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
   1578  1.4  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.1    jruoho             SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
   1585  1.1    jruoho             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
   1586  1.4  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.1    jruoho             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.1    jruoho             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.1    jruoho             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.1    jruoho             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.1    jruoho             SubTableLength = sizeof (ACPI_HEST_GENERIC);
   1617  1.1    jruoho             break;
   1618  1.1    jruoho 
   1619  1.1    jruoho         default:
   1620  1.2  christos 
   1621  1.1    jruoho             /* Cannot continue on unknown type - no length */
   1622  1.1    jruoho 
   1623  1.4  christos             AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
   1624  1.4  christos                 SubTable->Type);
   1625  1.1    jruoho             return;
   1626  1.1    jruoho         }
   1627  1.1    jruoho 
   1628  1.1    jruoho         AcpiOsPrintf ("\n");
   1629  1.1    jruoho         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   1630  1.4  christos             SubTableLength, InfoTable);
   1631  1.1    jruoho         if (ACPI_FAILURE (Status))
   1632  1.1    jruoho         {
   1633  1.1    jruoho             return;
   1634  1.1    jruoho         }
   1635  1.1    jruoho 
   1636  1.1    jruoho         /* Point to end of current subtable (each subtable above is of fixed length) */
   1637  1.1    jruoho 
   1638  1.1    jruoho         Offset += SubTableLength;
   1639  1.1    jruoho 
   1640  1.1    jruoho         /* If there are any (fixed-length) Error Banks from above, dump them now */
   1641  1.1    jruoho 
   1642  1.1    jruoho         if (BankCount)
   1643  1.1    jruoho         {
   1644  1.4  christos             BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable,
   1645  1.4  christos                 SubTableLength);
   1646  1.3  christos             SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
   1647  1.3  christos 
   1648  1.3  christos             while (BankCount)
   1649  1.3  christos             {
   1650  1.3  christos                 AcpiOsPrintf ("\n");
   1651  1.3  christos                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
   1652  1.4  christos                     sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
   1653  1.3  christos                 if (ACPI_FAILURE (Status))
   1654  1.3  christos                 {
   1655  1.3  christos                     return;
   1656  1.3  christos                 }
   1657  1.4  christos 
   1658  1.3  christos                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
   1659  1.3  christos                 BankTable++;
   1660  1.3  christos                 BankCount--;
   1661  1.3  christos             }
   1662  1.3  christos         }
   1663  1.3  christos 
   1664  1.3  christos         /* Point to next subtable */
   1665  1.3  christos 
   1666  1.3  christos         SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
   1667  1.3  christos     }
   1668  1.3  christos }
   1669  1.3  christos 
   1670  1.3  christos 
   1671  1.3  christos /*******************************************************************************
   1672  1.3  christos  *
   1673  1.3  christos  * FUNCTION:    AcpiDmDumpIort
   1674  1.3  christos  *
   1675  1.3  christos  * PARAMETERS:  Table               - A IORT table
   1676  1.3  christos  *
   1677  1.3  christos  * RETURN:      None
   1678  1.3  christos  *
   1679  1.3  christos  * DESCRIPTION: Format the contents of a IORT
   1680  1.3  christos  *
   1681  1.3  christos  ******************************************************************************/
   1682  1.3  christos 
   1683  1.3  christos void
   1684  1.3  christos AcpiDmDumpIort (
   1685  1.3  christos     ACPI_TABLE_HEADER       *Table)
   1686  1.3  christos {
   1687  1.3  christos     ACPI_STATUS             Status;
   1688  1.3  christos     ACPI_TABLE_IORT         *Iort;
   1689  1.3  christos     ACPI_IORT_NODE          *IortNode;
   1690  1.3  christos     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
   1691  1.3  christos     ACPI_IORT_SMMU          *IortSmmu = NULL;
   1692  1.3  christos     UINT32                  Offset;
   1693  1.3  christos     UINT32                  NodeOffset;
   1694  1.3  christos     UINT32                  Length;
   1695  1.3  christos     ACPI_DMTABLE_INFO       *InfoTable;
   1696  1.3  christos     char                    *String;
   1697  1.3  christos     UINT32                  i;
   1698  1.3  christos 
   1699  1.3  christos 
   1700  1.3  christos     /* Main table */
   1701  1.3  christos 
   1702  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
   1703  1.3  christos     if (ACPI_FAILURE (Status))
   1704  1.3  christos     {
   1705  1.3  christos         return;
   1706  1.3  christos     }
   1707  1.3  christos 
   1708  1.3  christos     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
   1709  1.3  christos     Offset = sizeof (ACPI_TABLE_IORT);
   1710  1.3  christos 
   1711  1.3  christos     /* Dump the OptionalPadding (optional) */
   1712  1.3  christos 
   1713  1.3  christos     if (Iort->NodeOffset > Offset)
   1714  1.3  christos     {
   1715  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
   1716  1.4  christos             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
   1717  1.3  christos         if (ACPI_FAILURE (Status))
   1718  1.3  christos         {
   1719  1.3  christos             return;
   1720  1.3  christos         }
   1721  1.3  christos     }
   1722  1.3  christos 
   1723  1.3  christos     Offset = Iort->NodeOffset;
   1724  1.3  christos     while (Offset < Table->Length)
   1725  1.3  christos     {
   1726  1.3  christos         /* Common subtable header */
   1727  1.3  christos 
   1728  1.3  christos         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
   1729  1.3  christos         AcpiOsPrintf ("\n");
   1730  1.3  christos         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
   1731  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset,
   1732  1.4  christos             IortNode, Length, AcpiDmTableInfoIortHdr);
   1733  1.3  christos         if (ACPI_FAILURE (Status))
   1734  1.3  christos         {
   1735  1.3  christos             return;
   1736  1.3  christos         }
   1737  1.3  christos 
   1738  1.3  christos         NodeOffset = Length;
   1739  1.3  christos 
   1740  1.3  christos         switch (IortNode->Type)
   1741  1.3  christos         {
   1742  1.3  christos         case ACPI_IORT_NODE_ITS_GROUP:
   1743  1.3  christos 
   1744  1.3  christos             InfoTable = AcpiDmTableInfoIort0;
   1745  1.3  christos             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
   1746  1.3  christos             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
   1747  1.3  christos             break;
   1748  1.3  christos 
   1749  1.3  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
   1750  1.3  christos 
   1751  1.3  christos             InfoTable = AcpiDmTableInfoIort1;
   1752  1.3  christos             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
   1753  1.3  christos             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
   1754  1.3  christos             Length += strlen (String) + 1;
   1755  1.3  christos             break;
   1756  1.3  christos 
   1757  1.3  christos         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
   1758  1.3  christos 
   1759  1.3  christos             InfoTable = AcpiDmTableInfoIort2;
   1760  1.3  christos             Length = IortNode->Length - NodeOffset;
   1761  1.3  christos             break;
   1762  1.3  christos 
   1763  1.3  christos         case ACPI_IORT_NODE_SMMU:
   1764  1.3  christos 
   1765  1.3  christos             InfoTable = AcpiDmTableInfoIort3;
   1766  1.3  christos             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
   1767  1.3  christos             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
   1768  1.3  christos             break;
   1769  1.3  christos 
   1770  1.3  christos         default:
   1771  1.3  christos 
   1772  1.3  christos             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
   1773  1.3  christos                 IortNode->Type);
   1774  1.3  christos 
   1775  1.3  christos             /* Attempt to continue */
   1776  1.3  christos 
   1777  1.3  christos             if (!IortNode->Length)
   1778  1.3  christos             {
   1779  1.3  christos                 AcpiOsPrintf ("Invalid zero length IORT node\n");
   1780  1.3  christos                 return;
   1781  1.3  christos             }
   1782  1.3  christos             goto NextSubTable;
   1783  1.3  christos         }
   1784  1.3  christos 
   1785  1.3  christos         /* Dump the node subtable header */
   1786  1.3  christos 
   1787  1.3  christos         AcpiOsPrintf ("\n");
   1788  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1789  1.4  christos             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   1790  1.4  christos             Length, InfoTable);
   1791  1.3  christos         if (ACPI_FAILURE (Status))
   1792  1.3  christos         {
   1793  1.3  christos             return;
   1794  1.3  christos         }
   1795  1.3  christos 
   1796  1.3  christos         NodeOffset += Length;
   1797  1.3  christos 
   1798  1.3  christos         /* Dump the node specific data */
   1799  1.3  christos 
   1800  1.3  christos         switch (IortNode->Type)
   1801  1.3  christos         {
   1802  1.3  christos         case ACPI_IORT_NODE_ITS_GROUP:
   1803  1.3  christos 
   1804  1.3  christos             /* Validate IortItsGroup to avoid compiler warnings */
   1805  1.3  christos 
   1806  1.3  christos             if (IortItsGroup)
   1807  1.3  christos             {
   1808  1.3  christos                 for (i = 0; i < IortItsGroup->ItsCount; i++)
   1809  1.3  christos                 {
   1810  1.3  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1811  1.4  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   1812  1.4  christos                         4, AcpiDmTableInfoIort0a);
   1813  1.3  christos                     NodeOffset += 4;
   1814  1.3  christos                 }
   1815  1.3  christos             }
   1816  1.3  christos             break;
   1817  1.3  christos 
   1818  1.3  christos         case ACPI_IORT_NODE_NAMED_COMPONENT:
   1819  1.3  christos 
   1820  1.3  christos             /* Dump the Padding (optional) */
   1821  1.3  christos 
   1822  1.3  christos             if (IortNode->Length > NodeOffset)
   1823  1.3  christos             {
   1824  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1825  1.4  christos                     Table, IortNode->Length - NodeOffset,
   1826  1.4  christos                     AcpiDmTableInfoIort1a);
   1827  1.3  christos                 if (ACPI_FAILURE (Status))
   1828  1.3  christos                 {
   1829  1.3  christos                     return;
   1830  1.3  christos                 }
   1831  1.3  christos             }
   1832  1.3  christos             break;
   1833  1.3  christos 
   1834  1.3  christos         case ACPI_IORT_NODE_SMMU:
   1835  1.3  christos 
   1836  1.3  christos             AcpiOsPrintf ("\n");
   1837  1.3  christos 
   1838  1.3  christos             /* Validate IortSmmu to avoid compiler warnings */
   1839  1.3  christos 
   1840  1.3  christos             if (IortSmmu)
   1841  1.3  christos             {
   1842  1.3  christos                 Length = 2 * sizeof (UINT64);
   1843  1.3  christos                 NodeOffset = IortSmmu->GlobalInterruptOffset;
   1844  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1845  1.4  christos                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   1846  1.4  christos                     Length, AcpiDmTableInfoIort3a);
   1847  1.3  christos                 if (ACPI_FAILURE (Status))
   1848  1.3  christos                 {
   1849  1.3  christos                     return;
   1850  1.3  christos                 }
   1851  1.3  christos 
   1852  1.3  christos                 NodeOffset = IortSmmu->ContextInterruptOffset;
   1853  1.3  christos                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
   1854  1.3  christos                 {
   1855  1.3  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1856  1.4  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   1857  1.4  christos                         8, AcpiDmTableInfoIort3b);
   1858  1.3  christos                     if (ACPI_FAILURE (Status))
   1859  1.3  christos                     {
   1860  1.3  christos                         return;
   1861  1.3  christos                     }
   1862  1.4  christos 
   1863  1.3  christos                     NodeOffset += 8;
   1864  1.3  christos                 }
   1865  1.3  christos 
   1866  1.3  christos                 NodeOffset = IortSmmu->PmuInterruptOffset;
   1867  1.3  christos                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
   1868  1.3  christos                 {
   1869  1.3  christos                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1870  1.4  christos                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   1871  1.4  christos                         8, AcpiDmTableInfoIort3c);
   1872  1.3  christos                     if (ACPI_FAILURE (Status))
   1873  1.3  christos                     {
   1874  1.3  christos                         return;
   1875  1.3  christos                     }
   1876  1.4  christos 
   1877  1.3  christos                     NodeOffset += 8;
   1878  1.3  christos                 }
   1879  1.3  christos             }
   1880  1.3  christos             break;
   1881  1.3  christos 
   1882  1.3  christos         default:
   1883  1.3  christos 
   1884  1.3  christos             break;
   1885  1.3  christos         }
   1886  1.3  christos 
   1887  1.3  christos         /* Dump the ID mappings */
   1888  1.3  christos 
   1889  1.3  christos         NodeOffset = IortNode->MappingOffset;
   1890  1.3  christos         for (i = 0; i < IortNode->MappingCount; i++)
   1891  1.3  christos         {
   1892  1.3  christos             AcpiOsPrintf ("\n");
   1893  1.3  christos             Length = sizeof (ACPI_IORT_ID_MAPPING);
   1894  1.3  christos             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
   1895  1.4  christos                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
   1896  1.4  christos                 Length, AcpiDmTableInfoIortMap);
   1897  1.3  christos             if (ACPI_FAILURE (Status))
   1898  1.1    jruoho             {
   1899  1.3  christos                 return;
   1900  1.1    jruoho             }
   1901  1.4  christos 
   1902  1.3  christos             NodeOffset += Length;
   1903  1.1    jruoho         }
   1904  1.1    jruoho 
   1905  1.3  christos NextSubTable:
   1906  1.3  christos         /* Point to next node subtable */
   1907  1.1    jruoho 
   1908  1.3  christos         Offset += IortNode->Length;
   1909  1.3  christos         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
   1910  1.1    jruoho     }
   1911  1.1    jruoho }
   1912  1.1    jruoho 
   1913  1.1    jruoho 
   1914  1.1    jruoho /*******************************************************************************
   1915  1.1    jruoho  *
   1916  1.1    jruoho  * FUNCTION:    AcpiDmDumpIvrs
   1917  1.1    jruoho  *
   1918  1.1    jruoho  * PARAMETERS:  Table               - A IVRS table
   1919  1.1    jruoho  *
   1920  1.1    jruoho  * RETURN:      None
   1921  1.1    jruoho  *
   1922  1.1    jruoho  * DESCRIPTION: Format the contents of a IVRS
   1923  1.1    jruoho  *
   1924  1.1    jruoho  ******************************************************************************/
   1925  1.1    jruoho 
   1926  1.1    jruoho static UINT8 EntrySizes[] = {4,8,16,32};
   1927  1.1    jruoho 
   1928  1.1    jruoho void
   1929  1.1    jruoho AcpiDmDumpIvrs (
   1930  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   1931  1.1    jruoho {
   1932  1.1    jruoho     ACPI_STATUS             Status;
   1933  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
   1934  1.1    jruoho     UINT32                  EntryOffset;
   1935  1.1    jruoho     UINT32                  EntryLength;
   1936  1.1    jruoho     UINT32                  EntryType;
   1937  1.1    jruoho     ACPI_IVRS_DE_HEADER     *DeviceEntry;
   1938  1.1    jruoho     ACPI_IVRS_HEADER        *SubTable;
   1939  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   1940  1.1    jruoho 
   1941  1.1    jruoho 
   1942  1.1    jruoho     /* Main table */
   1943  1.1    jruoho 
   1944  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
   1945  1.1    jruoho     if (ACPI_FAILURE (Status))
   1946  1.1    jruoho     {
   1947  1.1    jruoho         return;
   1948  1.1    jruoho     }
   1949  1.1    jruoho 
   1950  1.2  christos     /* Subtables */
   1951  1.1    jruoho 
   1952  1.1    jruoho     SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
   1953  1.1    jruoho     while (Offset < Table->Length)
   1954  1.1    jruoho     {
   1955  1.2  christos         /* Common subtable header */
   1956  1.1    jruoho 
   1957  1.1    jruoho         AcpiOsPrintf ("\n");
   1958  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   1959  1.4  christos             SubTable->Length, AcpiDmTableInfoIvrsHdr);
   1960  1.1    jruoho         if (ACPI_FAILURE (Status))
   1961  1.1    jruoho         {
   1962  1.1    jruoho             return;
   1963  1.1    jruoho         }
   1964  1.1    jruoho 
   1965  1.1    jruoho         switch (SubTable->Type)
   1966  1.1    jruoho         {
   1967  1.1    jruoho         case ACPI_IVRS_TYPE_HARDWARE:
   1968  1.2  christos 
   1969  1.1    jruoho             InfoTable = AcpiDmTableInfoIvrs0;
   1970  1.1    jruoho             break;
   1971  1.2  christos 
   1972  1.1    jruoho         case ACPI_IVRS_TYPE_MEMORY1:
   1973  1.1    jruoho         case ACPI_IVRS_TYPE_MEMORY2:
   1974  1.1    jruoho         case ACPI_IVRS_TYPE_MEMORY3:
   1975  1.2  christos 
   1976  1.1    jruoho             InfoTable = AcpiDmTableInfoIvrs1;
   1977  1.1    jruoho             break;
   1978  1.2  christos 
   1979  1.1    jruoho         default:
   1980  1.2  christos 
   1981  1.2  christos             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
   1982  1.1    jruoho                 SubTable->Type);
   1983  1.1    jruoho 
   1984  1.1    jruoho             /* Attempt to continue */
   1985  1.1    jruoho 
   1986  1.1    jruoho             if (!SubTable->Length)
   1987  1.1    jruoho             {
   1988  1.1    jruoho                 AcpiOsPrintf ("Invalid zero length subtable\n");
   1989  1.1    jruoho                 return;
   1990  1.1    jruoho             }
   1991  1.1    jruoho             goto NextSubTable;
   1992  1.1    jruoho         }
   1993  1.1    jruoho 
   1994  1.1    jruoho         /* Dump the subtable */
   1995  1.1    jruoho 
   1996  1.1    jruoho         AcpiOsPrintf ("\n");
   1997  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   1998  1.4  christos             SubTable->Length, InfoTable);
   1999  1.1    jruoho         if (ACPI_FAILURE (Status))
   2000  1.1    jruoho         {
   2001  1.1    jruoho             return;
   2002  1.1    jruoho         }
   2003  1.1    jruoho 
   2004  1.1    jruoho         /* The hardware subtable can contain multiple device entries */
   2005  1.1    jruoho 
   2006  1.1    jruoho         if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
   2007  1.1    jruoho         {
   2008  1.1    jruoho             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
   2009  1.1    jruoho             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
   2010  1.4  christos                 sizeof (ACPI_IVRS_HARDWARE));
   2011  1.1    jruoho 
   2012  1.1    jruoho             while (EntryOffset < (Offset + SubTable->Length))
   2013  1.1    jruoho             {
   2014  1.1    jruoho                 AcpiOsPrintf ("\n");
   2015  1.1    jruoho                 /*
   2016  1.1    jruoho                  * Upper 2 bits of Type encode the length of the device entry
   2017  1.1    jruoho                  *
   2018  1.1    jruoho                  * 00 = 4 byte
   2019  1.1    jruoho                  * 01 = 8 byte
   2020  1.1    jruoho                  * 10 = 16 byte - currently no entries defined
   2021  1.1    jruoho                  * 11 = 32 byte - currently no entries defined
   2022  1.1    jruoho                  */
   2023  1.1    jruoho                 EntryType = DeviceEntry->Type;
   2024  1.1    jruoho                 EntryLength = EntrySizes [EntryType >> 6];
   2025  1.1    jruoho 
   2026  1.1    jruoho                 switch (EntryType)
   2027  1.1    jruoho                 {
   2028  1.1    jruoho                 /* 4-byte device entries */
   2029  1.1    jruoho 
   2030  1.1    jruoho                 case ACPI_IVRS_TYPE_PAD4:
   2031  1.1    jruoho                 case ACPI_IVRS_TYPE_ALL:
   2032  1.1    jruoho                 case ACPI_IVRS_TYPE_SELECT:
   2033  1.1    jruoho                 case ACPI_IVRS_TYPE_START:
   2034  1.1    jruoho                 case ACPI_IVRS_TYPE_END:
   2035  1.1    jruoho 
   2036  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs4;
   2037  1.1    jruoho                     break;
   2038  1.1    jruoho 
   2039  1.1    jruoho                 /* 8-byte entries, type A */
   2040  1.1    jruoho 
   2041  1.1    jruoho                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
   2042  1.1    jruoho                 case ACPI_IVRS_TYPE_ALIAS_START:
   2043  1.1    jruoho 
   2044  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs8a;
   2045  1.1    jruoho                     break;
   2046  1.1    jruoho 
   2047  1.1    jruoho                 /* 8-byte entries, type B */
   2048  1.1    jruoho 
   2049  1.1    jruoho                 case ACPI_IVRS_TYPE_PAD8:
   2050  1.1    jruoho                 case ACPI_IVRS_TYPE_EXT_SELECT:
   2051  1.1    jruoho                 case ACPI_IVRS_TYPE_EXT_START:
   2052  1.1    jruoho 
   2053  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs8b;
   2054  1.1    jruoho                     break;
   2055  1.1    jruoho 
   2056  1.1    jruoho                 /* 8-byte entries, type C */
   2057  1.1    jruoho 
   2058  1.1    jruoho                 case ACPI_IVRS_TYPE_SPECIAL:
   2059  1.1    jruoho 
   2060  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs8c;
   2061  1.1    jruoho                     break;
   2062  1.1    jruoho 
   2063  1.1    jruoho                 default:
   2064  1.1    jruoho                     InfoTable = AcpiDmTableInfoIvrs4;
   2065  1.1    jruoho                     AcpiOsPrintf (
   2066  1.1    jruoho                         "\n**** Unknown IVRS device entry type/length: "
   2067  1.1    jruoho                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
   2068  1.1    jruoho                         EntryType, EntryLength, EntryOffset);
   2069  1.1    jruoho                     break;
   2070  1.1    jruoho                 }
   2071  1.1    jruoho 
   2072  1.1    jruoho                 /* Dump the Device Entry */
   2073  1.1    jruoho 
   2074  1.1    jruoho                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
   2075  1.4  christos                     DeviceEntry, EntryLength, InfoTable);
   2076  1.3  christos                 if (ACPI_FAILURE (Status))
   2077  1.3  christos                 {
   2078  1.3  christos                     return;
   2079  1.3  christos                 }
   2080  1.1    jruoho 
   2081  1.1    jruoho                 EntryOffset += EntryLength;
   2082  1.1    jruoho                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
   2083  1.4  christos                     EntryLength);
   2084  1.1    jruoho             }
   2085  1.1    jruoho         }
   2086  1.1    jruoho 
   2087  1.1    jruoho NextSubTable:
   2088  1.2  christos         /* Point to next subtable */
   2089  1.1    jruoho 
   2090  1.1    jruoho         Offset += SubTable->Length;
   2091  1.1    jruoho         SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
   2092  1.1    jruoho     }
   2093  1.1    jruoho }
   2094  1.1    jruoho 
   2095  1.1    jruoho 
   2096  1.1    jruoho /*******************************************************************************
   2097  1.1    jruoho  *
   2098  1.2  christos  * FUNCTION:    AcpiDmDumpLpit
   2099  1.2  christos  *
   2100  1.2  christos  * PARAMETERS:  Table               - A LPIT table
   2101  1.2  christos  *
   2102  1.2  christos  * RETURN:      None
   2103  1.2  christos  *
   2104  1.2  christos  * DESCRIPTION: Format the contents of a LPIT. This table type consists
   2105  1.2  christos  *              of an open-ended number of subtables. Note: There are no
   2106  1.2  christos  *              entries in the main table. An LPIT consists of the table
   2107  1.2  christos  *              header and then subtables only.
   2108  1.2  christos  *
   2109  1.2  christos  ******************************************************************************/
   2110  1.2  christos 
   2111  1.2  christos void
   2112  1.2  christos AcpiDmDumpLpit (
   2113  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2114  1.2  christos {
   2115  1.2  christos     ACPI_STATUS             Status;
   2116  1.2  christos     ACPI_LPIT_HEADER        *SubTable;
   2117  1.2  christos     UINT32                  Length = Table->Length;
   2118  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
   2119  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2120  1.2  christos     UINT32                  SubTableLength;
   2121  1.2  christos 
   2122  1.2  christos 
   2123  1.2  christos     /* Subtables */
   2124  1.2  christos 
   2125  1.2  christos     SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
   2126  1.2  christos     while (Offset < Table->Length)
   2127  1.2  christos     {
   2128  1.2  christos         /* Common subtable header */
   2129  1.2  christos 
   2130  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2131  1.4  christos             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
   2132  1.2  christos         if (ACPI_FAILURE (Status))
   2133  1.2  christos         {
   2134  1.2  christos             return;
   2135  1.2  christos         }
   2136  1.2  christos 
   2137  1.2  christos         switch (SubTable->Type)
   2138  1.2  christos         {
   2139  1.2  christos         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
   2140  1.2  christos 
   2141  1.2  christos             InfoTable = AcpiDmTableInfoLpit0;
   2142  1.2  christos             SubTableLength = sizeof (ACPI_LPIT_NATIVE);
   2143  1.2  christos             break;
   2144  1.2  christos 
   2145  1.2  christos         default:
   2146  1.2  christos 
   2147  1.2  christos             /* Cannot continue on unknown type - no length */
   2148  1.2  christos 
   2149  1.4  christos             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
   2150  1.4  christos                 SubTable->Type);
   2151  1.2  christos             return;
   2152  1.2  christos         }
   2153  1.2  christos 
   2154  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2155  1.4  christos             SubTableLength, InfoTable);
   2156  1.2  christos         if (ACPI_FAILURE (Status))
   2157  1.2  christos         {
   2158  1.2  christos             return;
   2159  1.2  christos         }
   2160  1.4  christos 
   2161  1.2  christos         AcpiOsPrintf ("\n");
   2162  1.2  christos 
   2163  1.2  christos         /* Point to next subtable */
   2164  1.2  christos 
   2165  1.2  christos         Offset += SubTableLength;
   2166  1.2  christos         SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength);
   2167  1.2  christos     }
   2168  1.2  christos }
   2169  1.2  christos 
   2170  1.2  christos 
   2171  1.2  christos /*******************************************************************************
   2172  1.2  christos  *
   2173  1.1    jruoho  * FUNCTION:    AcpiDmDumpMadt
   2174  1.1    jruoho  *
   2175  1.1    jruoho  * PARAMETERS:  Table               - A MADT table
   2176  1.1    jruoho  *
   2177  1.1    jruoho  * RETURN:      None
   2178  1.1    jruoho  *
   2179  1.1    jruoho  * DESCRIPTION: Format the contents of a MADT. This table type consists
   2180  1.1    jruoho  *              of an open-ended number of subtables.
   2181  1.1    jruoho  *
   2182  1.1    jruoho  ******************************************************************************/
   2183  1.1    jruoho 
   2184  1.1    jruoho void
   2185  1.1    jruoho AcpiDmDumpMadt (
   2186  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2187  1.1    jruoho {
   2188  1.1    jruoho     ACPI_STATUS             Status;
   2189  1.1    jruoho     ACPI_SUBTABLE_HEADER    *SubTable;
   2190  1.1    jruoho     UINT32                  Length = Table->Length;
   2191  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
   2192  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   2193  1.1    jruoho 
   2194  1.1    jruoho 
   2195  1.1    jruoho     /* Main table */
   2196  1.1    jruoho 
   2197  1.1    jruoho     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
   2198  1.1    jruoho     if (ACPI_FAILURE (Status))
   2199  1.1    jruoho     {
   2200  1.1    jruoho         return;
   2201  1.1    jruoho     }
   2202  1.1    jruoho 
   2203  1.2  christos     /* Subtables */
   2204  1.1    jruoho 
   2205  1.1    jruoho     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   2206  1.1    jruoho     while (Offset < Table->Length)
   2207  1.1    jruoho     {
   2208  1.2  christos         /* Common subtable header */
   2209  1.1    jruoho 
   2210  1.1    jruoho         AcpiOsPrintf ("\n");
   2211  1.1    jruoho         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2212  1.4  christos             SubTable->Length, AcpiDmTableInfoMadtHdr);
   2213  1.1    jruoho         if (ACPI_FAILURE (Status))
   2214  1.1    jruoho         {
   2215  1.1    jruoho             return;
   2216  1.1    jruoho         }
   2217  1.1    jruoho 
   2218  1.1    jruoho         switch (SubTable->Type)
   2219  1.1    jruoho         {
   2220  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_APIC:
   2221  1.2  christos 
   2222  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt0;
   2223  1.1    jruoho             break;
   2224  1.2  christos 
   2225  1.1    jruoho         case ACPI_MADT_TYPE_IO_APIC:
   2226  1.2  christos 
   2227  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt1;
   2228  1.1    jruoho             break;
   2229  1.2  christos 
   2230  1.1    jruoho         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
   2231  1.2  christos 
   2232  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt2;
   2233  1.1    jruoho             break;
   2234  1.2  christos 
   2235  1.1    jruoho         case ACPI_MADT_TYPE_NMI_SOURCE:
   2236  1.2  christos 
   2237  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt3;
   2238  1.1    jruoho             break;
   2239  1.2  christos 
   2240  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
   2241  1.2  christos 
   2242  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt4;
   2243  1.1    jruoho             break;
   2244  1.2  christos 
   2245  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
   2246  1.2  christos 
   2247  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt5;
   2248  1.1    jruoho             break;
   2249  1.2  christos 
   2250  1.1    jruoho         case ACPI_MADT_TYPE_IO_SAPIC:
   2251  1.2  christos 
   2252  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt6;
   2253  1.1    jruoho             break;
   2254  1.2  christos 
   2255  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_SAPIC:
   2256  1.2  christos 
   2257  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt7;
   2258  1.1    jruoho             break;
   2259  1.2  christos 
   2260  1.1    jruoho         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
   2261  1.2  christos 
   2262  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt8;
   2263  1.1    jruoho             break;
   2264  1.2  christos 
   2265  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_X2APIC:
   2266  1.2  christos 
   2267  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt9;
   2268  1.1    jruoho             break;
   2269  1.2  christos 
   2270  1.1    jruoho         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
   2271  1.2  christos 
   2272  1.1    jruoho             InfoTable = AcpiDmTableInfoMadt10;
   2273  1.1    jruoho             break;
   2274  1.2  christos 
   2275  1.2  christos         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
   2276  1.2  christos 
   2277  1.2  christos             InfoTable = AcpiDmTableInfoMadt11;
   2278  1.2  christos             break;
   2279  1.2  christos 
   2280  1.2  christos         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
   2281  1.2  christos 
   2282  1.2  christos             InfoTable = AcpiDmTableInfoMadt12;
   2283  1.2  christos             break;
   2284  1.2  christos 
   2285  1.2  christos         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
   2286  1.2  christos 
   2287  1.2  christos             InfoTable = AcpiDmTableInfoMadt13;
   2288  1.2  christos             break;
   2289  1.2  christos 
   2290  1.2  christos         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
   2291  1.2  christos 
   2292  1.2  christos             InfoTable = AcpiDmTableInfoMadt14;
   2293  1.2  christos             break;
   2294  1.2  christos 
   2295  1.3  christos         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
   2296  1.3  christos 
   2297  1.3  christos             InfoTable = AcpiDmTableInfoMadt15;
   2298  1.3  christos             break;
   2299  1.3  christos 
   2300  1.1    jruoho         default:
   2301  1.2  christos 
   2302  1.4  christos             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
   2303  1.4  christos                 SubTable->Type);
   2304  1.1    jruoho 
   2305  1.1    jruoho             /* Attempt to continue */
   2306  1.1    jruoho 
   2307  1.1    jruoho             if (!SubTable->Length)
   2308  1.1    jruoho             {
   2309  1.1    jruoho                 AcpiOsPrintf ("Invalid zero length subtable\n");
   2310  1.1    jruoho                 return;
   2311  1.1    jruoho             }
   2312  1.4  christos 
   2313  1.1    jruoho             goto NextSubTable;
   2314  1.1    jruoho         }
   2315  1.1    jruoho 
   2316  1.1    jruoho         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2317  1.4  christos             SubTable->Length, InfoTable);
   2318  1.1    jruoho         if (ACPI_FAILURE (Status))
   2319  1.1    jruoho         {
   2320  1.1    jruoho             return;
   2321  1.1    jruoho         }
   2322  1.1    jruoho 
   2323  1.1    jruoho NextSubTable:
   2324  1.2  christos         /* Point to next subtable */
   2325  1.1    jruoho 
   2326  1.1    jruoho         Offset += SubTable->Length;
   2327  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
   2328  1.4  christos             SubTable->Length);
   2329  1.1    jruoho     }
   2330  1.1    jruoho }
   2331  1.1    jruoho 
   2332  1.1    jruoho 
   2333  1.1    jruoho /*******************************************************************************
   2334  1.1    jruoho  *
   2335  1.1    jruoho  * FUNCTION:    AcpiDmDumpMcfg
   2336  1.1    jruoho  *
   2337  1.1    jruoho  * PARAMETERS:  Table               - A MCFG Table
   2338  1.1    jruoho  *
   2339  1.1    jruoho  * RETURN:      None
   2340  1.1    jruoho  *
   2341  1.1    jruoho  * DESCRIPTION: Format the contents of a MCFG table
   2342  1.1    jruoho  *
   2343  1.1    jruoho  ******************************************************************************/
   2344  1.1    jruoho 
   2345  1.1    jruoho void
   2346  1.1    jruoho AcpiDmDumpMcfg (
   2347  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2348  1.1    jruoho {
   2349  1.1    jruoho     ACPI_STATUS             Status;
   2350  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
   2351  1.1    jruoho     ACPI_MCFG_ALLOCATION    *SubTable;
   2352  1.1    jruoho 
   2353  1.1    jruoho 
   2354  1.1    jruoho     /* Main table */
   2355  1.1    jruoho 
   2356  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
   2357  1.1    jruoho     if (ACPI_FAILURE (Status))
   2358  1.1    jruoho     {
   2359  1.1    jruoho         return;
   2360  1.1    jruoho     }
   2361  1.1    jruoho 
   2362  1.2  christos     /* Subtables */
   2363  1.1    jruoho 
   2364  1.1    jruoho     SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
   2365  1.1    jruoho     while (Offset < Table->Length)
   2366  1.1    jruoho     {
   2367  1.1    jruoho         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
   2368  1.1    jruoho         {
   2369  1.1    jruoho             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
   2370  1.1    jruoho                 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
   2371  1.1    jruoho             return;
   2372  1.1    jruoho         }
   2373  1.1    jruoho 
   2374  1.1    jruoho         AcpiOsPrintf ("\n");
   2375  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   2376  1.4  christos             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
   2377  1.1    jruoho         if (ACPI_FAILURE (Status))
   2378  1.1    jruoho         {
   2379  1.1    jruoho             return;
   2380  1.1    jruoho         }
   2381  1.1    jruoho 
   2382  1.2  christos         /* Point to next subtable (each subtable is of fixed length) */
   2383  1.1    jruoho 
   2384  1.1    jruoho         Offset += sizeof (ACPI_MCFG_ALLOCATION);
   2385  1.1    jruoho         SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
   2386  1.4  christos             sizeof (ACPI_MCFG_ALLOCATION));
   2387  1.1    jruoho     }
   2388  1.1    jruoho }
   2389  1.1    jruoho 
   2390  1.1    jruoho 
   2391  1.1    jruoho /*******************************************************************************
   2392  1.1    jruoho  *
   2393  1.2  christos  * FUNCTION:    AcpiDmDumpMpst
   2394  1.2  christos  *
   2395  1.2  christos  * PARAMETERS:  Table               - A MPST Table
   2396  1.2  christos  *
   2397  1.2  christos  * RETURN:      None
   2398  1.2  christos  *
   2399  1.2  christos  * DESCRIPTION: Format the contents of a MPST table
   2400  1.2  christos  *
   2401  1.2  christos  ******************************************************************************/
   2402  1.2  christos 
   2403  1.2  christos void
   2404  1.2  christos AcpiDmDumpMpst (
   2405  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2406  1.2  christos {
   2407  1.2  christos     ACPI_STATUS             Status;
   2408  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
   2409  1.2  christos     ACPI_MPST_POWER_NODE    *SubTable0;
   2410  1.2  christos     ACPI_MPST_POWER_STATE   *SubTable0A;
   2411  1.2  christos     ACPI_MPST_COMPONENT     *SubTable0B;
   2412  1.2  christos     ACPI_MPST_DATA_HDR      *SubTable1;
   2413  1.2  christos     ACPI_MPST_POWER_DATA    *SubTable2;
   2414  1.2  christos     UINT16                  SubtableCount;
   2415  1.2  christos     UINT32                  PowerStateCount;
   2416  1.2  christos     UINT32                  ComponentCount;
   2417  1.2  christos 
   2418  1.2  christos 
   2419  1.2  christos     /* Main table */
   2420  1.2  christos 
   2421  1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
   2422  1.2  christos     if (ACPI_FAILURE (Status))
   2423  1.2  christos     {
   2424  1.2  christos         return;
   2425  1.2  christos     }
   2426  1.2  christos 
   2427  1.2  christos     /* Subtable: Memory Power Node(s) */
   2428  1.2  christos 
   2429  1.2  christos     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
   2430  1.2  christos     SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
   2431  1.2  christos 
   2432  1.2  christos     while ((Offset < Table->Length) && SubtableCount)
   2433  1.2  christos     {
   2434  1.2  christos         AcpiOsPrintf ("\n");
   2435  1.2  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
   2436  1.4  christos             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
   2437  1.2  christos         if (ACPI_FAILURE (Status))
   2438  1.2  christos         {
   2439  1.2  christos             return;
   2440  1.2  christos         }
   2441  1.2  christos 
   2442  1.2  christos         /* Extract the sub-subtable counts */
   2443  1.2  christos 
   2444  1.2  christos         PowerStateCount = SubTable0->NumPowerStates;
   2445  1.2  christos         ComponentCount = SubTable0->NumPhysicalComponents;
   2446  1.2  christos         Offset += sizeof (ACPI_MPST_POWER_NODE);
   2447  1.2  christos 
   2448  1.2  christos         /* Sub-subtables - Memory Power State Structure(s) */
   2449  1.2  christos 
   2450  1.2  christos         SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
   2451  1.2  christos             sizeof (ACPI_MPST_POWER_NODE));
   2452  1.2  christos 
   2453  1.2  christos         while (PowerStateCount)
   2454  1.2  christos         {
   2455  1.2  christos             AcpiOsPrintf ("\n");
   2456  1.2  christos             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
   2457  1.4  christos                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
   2458  1.2  christos             if (ACPI_FAILURE (Status))
   2459  1.2  christos             {
   2460  1.2  christos                 return;
   2461  1.2  christos             }
   2462  1.2  christos 
   2463  1.2  christos             SubTable0A++;
   2464  1.2  christos             PowerStateCount--;
   2465  1.2  christos             Offset += sizeof (ACPI_MPST_POWER_STATE);
   2466  1.2  christos        }
   2467  1.2  christos 
   2468  1.2  christos         /* Sub-subtables - Physical Component ID Structure(s) */
   2469  1.2  christos 
   2470  1.2  christos         SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
   2471  1.2  christos 
   2472  1.2  christos         if (ComponentCount)
   2473  1.2  christos         {
   2474  1.2  christos             AcpiOsPrintf ("\n");
   2475  1.2  christos         }
   2476  1.2  christos 
   2477  1.2  christos         while (ComponentCount)
   2478  1.2  christos         {
   2479  1.2  christos             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
   2480  1.4  christos                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
   2481  1.2  christos             if (ACPI_FAILURE (Status))
   2482  1.2  christos             {
   2483  1.2  christos                 return;
   2484  1.2  christos             }
   2485  1.2  christos 
   2486  1.2  christos             SubTable0B++;
   2487  1.2  christos             ComponentCount--;
   2488  1.2  christos             Offset += sizeof (ACPI_MPST_COMPONENT);
   2489  1.2  christos         }
   2490  1.2  christos 
   2491  1.2  christos         /* Point to next Memory Power Node subtable */
   2492  1.2  christos 
   2493  1.2  christos         SubtableCount--;
   2494  1.2  christos         SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
   2495  1.2  christos             sizeof (ACPI_MPST_POWER_NODE) +
   2496  1.2  christos             (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
   2497  1.2  christos             (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
   2498  1.2  christos     }
   2499  1.2  christos 
   2500  1.2  christos     /* Subtable: Count of Memory Power State Characteristic structures */
   2501  1.2  christos 
   2502  1.2  christos     AcpiOsPrintf ("\n");
   2503  1.2  christos     SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
   2504  1.2  christos     Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
   2505  1.4  christos         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
   2506  1.2  christos     if (ACPI_FAILURE (Status))
   2507  1.2  christos     {
   2508  1.2  christos         return;
   2509  1.2  christos     }
   2510  1.2  christos 
   2511  1.2  christos     SubtableCount = SubTable1->CharacteristicsCount;
   2512  1.2  christos     Offset += sizeof (ACPI_MPST_DATA_HDR);
   2513  1.2  christos 
   2514  1.2  christos     /* Subtable: Memory Power State Characteristics structure(s) */
   2515  1.2  christos 
   2516  1.4  christos     SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1,
   2517  1.4  christos         sizeof (ACPI_MPST_DATA_HDR));
   2518  1.2  christos 
   2519  1.2  christos     while ((Offset < Table->Length) && SubtableCount)
   2520  1.2  christos     {
   2521  1.2  christos         AcpiOsPrintf ("\n");
   2522  1.2  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
   2523  1.4  christos             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
   2524  1.2  christos         if (ACPI_FAILURE (Status))
   2525  1.2  christos         {
   2526  1.2  christos             return;
   2527  1.2  christos         }
   2528  1.2  christos 
   2529  1.2  christos         SubTable2++;
   2530  1.2  christos         SubtableCount--;
   2531  1.2  christos         Offset += sizeof (ACPI_MPST_POWER_DATA);
   2532  1.2  christos     }
   2533  1.2  christos }
   2534  1.2  christos 
   2535  1.2  christos 
   2536  1.2  christos /*******************************************************************************
   2537  1.2  christos  *
   2538  1.1    jruoho  * FUNCTION:    AcpiDmDumpMsct
   2539  1.1    jruoho  *
   2540  1.1    jruoho  * PARAMETERS:  Table               - A MSCT table
   2541  1.1    jruoho  *
   2542  1.1    jruoho  * RETURN:      None
   2543  1.1    jruoho  *
   2544  1.1    jruoho  * DESCRIPTION: Format the contents of a MSCT
   2545  1.1    jruoho  *
   2546  1.1    jruoho  ******************************************************************************/
   2547  1.1    jruoho 
   2548  1.1    jruoho void
   2549  1.1    jruoho AcpiDmDumpMsct (
   2550  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   2551  1.1    jruoho {
   2552  1.1    jruoho     ACPI_STATUS             Status;
   2553  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
   2554  1.1    jruoho     ACPI_MSCT_PROXIMITY     *SubTable;
   2555  1.1    jruoho 
   2556  1.1    jruoho 
   2557  1.1    jruoho     /* Main table */
   2558  1.1    jruoho 
   2559  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
   2560  1.1    jruoho     if (ACPI_FAILURE (Status))
   2561  1.1    jruoho     {
   2562  1.1    jruoho         return;
   2563  1.1    jruoho     }
   2564  1.1    jruoho 
   2565  1.2  christos     /* Subtables */
   2566  1.1    jruoho 
   2567  1.1    jruoho     SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
   2568  1.1    jruoho     while (Offset < Table->Length)
   2569  1.1    jruoho     {
   2570  1.2  christos         /* Common subtable header */
   2571  1.1    jruoho 
   2572  1.1    jruoho         AcpiOsPrintf ("\n");
   2573  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   2574  1.4  christos             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
   2575  1.1    jruoho         if (ACPI_FAILURE (Status))
   2576  1.1    jruoho         {
   2577  1.1    jruoho             return;
   2578  1.1    jruoho         }
   2579  1.1    jruoho 
   2580  1.2  christos         /* Point to next subtable */
   2581  1.1    jruoho 
   2582  1.1    jruoho         Offset += sizeof (ACPI_MSCT_PROXIMITY);
   2583  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable,
   2584  1.4  christos             sizeof (ACPI_MSCT_PROXIMITY));
   2585  1.1    jruoho     }
   2586  1.1    jruoho }
   2587  1.1    jruoho 
   2588  1.1    jruoho 
   2589  1.1    jruoho /*******************************************************************************
   2590  1.1    jruoho  *
   2591  1.2  christos  * FUNCTION:    AcpiDmDumpMtmr
   2592  1.2  christos  *
   2593  1.2  christos  * PARAMETERS:  Table               - A MTMR table
   2594  1.2  christos  *
   2595  1.2  christos  * RETURN:      None
   2596  1.2  christos  *
   2597  1.2  christos  * DESCRIPTION: Format the contents of a MTMR
   2598  1.2  christos  *
   2599  1.2  christos  ******************************************************************************/
   2600  1.2  christos 
   2601  1.2  christos void
   2602  1.2  christos AcpiDmDumpMtmr (
   2603  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2604  1.2  christos {
   2605  1.2  christos     ACPI_STATUS             Status;
   2606  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
   2607  1.2  christos     ACPI_MTMR_ENTRY         *SubTable;
   2608  1.2  christos 
   2609  1.2  christos 
   2610  1.2  christos     /* Main table */
   2611  1.2  christos 
   2612  1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
   2613  1.2  christos     if (ACPI_FAILURE (Status))
   2614  1.2  christos     {
   2615  1.2  christos         return;
   2616  1.2  christos     }
   2617  1.2  christos 
   2618  1.2  christos     /* Subtables */
   2619  1.2  christos 
   2620  1.2  christos     SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
   2621  1.2  christos     while (Offset < Table->Length)
   2622  1.2  christos     {
   2623  1.2  christos         /* Common subtable header */
   2624  1.2  christos 
   2625  1.2  christos         AcpiOsPrintf ("\n");
   2626  1.2  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   2627  1.4  christos             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
   2628  1.2  christos         if (ACPI_FAILURE (Status))
   2629  1.2  christos         {
   2630  1.2  christos             return;
   2631  1.2  christos         }
   2632  1.2  christos 
   2633  1.2  christos         /* Point to next subtable */
   2634  1.2  christos 
   2635  1.2  christos         Offset += sizeof (ACPI_MTMR_ENTRY);
   2636  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable,
   2637  1.4  christos             sizeof (ACPI_MTMR_ENTRY));
   2638  1.2  christos     }
   2639  1.2  christos }
   2640  1.2  christos 
   2641  1.2  christos 
   2642  1.2  christos /*******************************************************************************
   2643  1.2  christos  *
   2644  1.3  christos  * FUNCTION:    AcpiDmDumpNfit
   2645  1.3  christos  *
   2646  1.3  christos  * PARAMETERS:  Table               - A NFIT table
   2647  1.3  christos  *
   2648  1.3  christos  * RETURN:      None
   2649  1.3  christos  *
   2650  1.3  christos  * DESCRIPTION: Format the contents of an NFIT.
   2651  1.3  christos  *
   2652  1.3  christos  ******************************************************************************/
   2653  1.3  christos 
   2654  1.3  christos void
   2655  1.3  christos AcpiDmDumpNfit (
   2656  1.3  christos     ACPI_TABLE_HEADER       *Table)
   2657  1.3  christos {
   2658  1.3  christos     ACPI_STATUS             Status;
   2659  1.3  christos     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
   2660  1.3  christos     UINT32                  FieldOffset = 0;
   2661  1.3  christos     UINT32                  Length;
   2662  1.3  christos     ACPI_NFIT_HEADER        *SubTable;
   2663  1.3  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2664  1.3  christos     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
   2665  1.3  christos     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
   2666  1.3  christos     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
   2667  1.3  christos     UINT32                  i;
   2668  1.3  christos 
   2669  1.3  christos 
   2670  1.3  christos     /* Main table */
   2671  1.3  christos 
   2672  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
   2673  1.3  christos     if (ACPI_FAILURE (Status))
   2674  1.3  christos     {
   2675  1.3  christos         return;
   2676  1.3  christos     }
   2677  1.3  christos 
   2678  1.3  christos     /* Subtables */
   2679  1.3  christos 
   2680  1.3  christos     SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
   2681  1.3  christos     while (Offset < Table->Length)
   2682  1.3  christos     {
   2683  1.3  christos         /* NFIT subtable header */
   2684  1.3  christos 
   2685  1.3  christos         AcpiOsPrintf ("\n");
   2686  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   2687  1.4  christos             SubTable->Length, AcpiDmTableInfoNfitHdr);
   2688  1.3  christos         if (ACPI_FAILURE (Status))
   2689  1.3  christos         {
   2690  1.3  christos             return;
   2691  1.3  christos         }
   2692  1.3  christos 
   2693  1.3  christos         switch (SubTable->Type)
   2694  1.3  christos         {
   2695  1.3  christos         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
   2696  1.3  christos 
   2697  1.3  christos             InfoTable = AcpiDmTableInfoNfit0;
   2698  1.3  christos             break;
   2699  1.3  christos 
   2700  1.3  christos         case ACPI_NFIT_TYPE_MEMORY_MAP:
   2701  1.3  christos 
   2702  1.3  christos             InfoTable = AcpiDmTableInfoNfit1;
   2703  1.3  christos             break;
   2704  1.3  christos 
   2705  1.3  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   2706  1.3  christos 
   2707  1.3  christos             /* Has a variable number of 32-bit values at the end */
   2708  1.3  christos 
   2709  1.3  christos             InfoTable = AcpiDmTableInfoNfit2;
   2710  1.3  christos             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable);
   2711  1.3  christos             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
   2712  1.3  christos             break;
   2713  1.3  christos 
   2714  1.3  christos         case ACPI_NFIT_TYPE_SMBIOS:
   2715  1.3  christos 
   2716  1.3  christos             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable);
   2717  1.3  christos             InfoTable = AcpiDmTableInfoNfit3;
   2718  1.3  christos             break;
   2719  1.3  christos 
   2720  1.3  christos         case ACPI_NFIT_TYPE_CONTROL_REGION:
   2721  1.3  christos 
   2722  1.3  christos             InfoTable = AcpiDmTableInfoNfit4;
   2723  1.3  christos             break;
   2724  1.3  christos 
   2725  1.3  christos         case ACPI_NFIT_TYPE_DATA_REGION:
   2726  1.3  christos 
   2727  1.3  christos             InfoTable = AcpiDmTableInfoNfit5;
   2728  1.3  christos             break;
   2729  1.3  christos 
   2730  1.3  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   2731  1.3  christos 
   2732  1.3  christos             /* Has a variable number of 64-bit addresses at the end */
   2733  1.3  christos 
   2734  1.3  christos             InfoTable = AcpiDmTableInfoNfit6;
   2735  1.3  christos             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable);
   2736  1.3  christos             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
   2737  1.3  christos             break;
   2738  1.3  christos 
   2739  1.3  christos         default:
   2740  1.4  christos             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
   2741  1.4  christos                 SubTable->Type);
   2742  1.3  christos 
   2743  1.3  christos             /* Attempt to continue */
   2744  1.3  christos 
   2745  1.3  christos             if (!SubTable->Length)
   2746  1.3  christos             {
   2747  1.3  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   2748  1.3  christos                 return;
   2749  1.3  christos             }
   2750  1.3  christos             goto NextSubTable;
   2751  1.3  christos         }
   2752  1.3  christos 
   2753  1.3  christos         AcpiOsPrintf ("\n");
   2754  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   2755  1.4  christos             SubTable->Length, InfoTable);
   2756  1.3  christos         if (ACPI_FAILURE (Status))
   2757  1.3  christos         {
   2758  1.3  christos             return;
   2759  1.3  christos         }
   2760  1.3  christos 
   2761  1.3  christos         /* Per-subtable variable-length fields */
   2762  1.3  christos 
   2763  1.3  christos         switch (SubTable->Type)
   2764  1.3  christos         {
   2765  1.3  christos         case ACPI_NFIT_TYPE_INTERLEAVE:
   2766  1.3  christos 
   2767  1.3  christos             for (i = 0; i < Interleave->LineCount; i++)
   2768  1.3  christos             {
   2769  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   2770  1.4  christos                     &Interleave->LineOffset[i],
   2771  1.4  christos                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
   2772  1.3  christos                 if (ACPI_FAILURE (Status))
   2773  1.3  christos                 {
   2774  1.3  christos                     return;
   2775  1.3  christos                 }
   2776  1.3  christos 
   2777  1.3  christos                 FieldOffset += sizeof (UINT32);
   2778  1.3  christos             }
   2779  1.3  christos             break;
   2780  1.3  christos 
   2781  1.3  christos         case ACPI_NFIT_TYPE_SMBIOS:
   2782  1.3  christos 
   2783  1.4  christos             Length = SubTable->Length -
   2784  1.4  christos                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
   2785  1.4  christos 
   2786  1.3  christos             if (Length)
   2787  1.3  christos             {
   2788  1.3  christos                 Status = AcpiDmDumpTable (Table->Length,
   2789  1.4  christos                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
   2790  1.4  christos                     SmbiosInfo,
   2791  1.4  christos                     Length, AcpiDmTableInfoNfit3a);
   2792  1.3  christos                 if (ACPI_FAILURE (Status))
   2793  1.3  christos                 {
   2794  1.3  christos                     return;
   2795  1.3  christos                 }
   2796  1.3  christos             }
   2797  1.3  christos 
   2798  1.3  christos             break;
   2799  1.3  christos 
   2800  1.3  christos         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
   2801  1.3  christos 
   2802  1.3  christos             for (i = 0; i < Hint->HintCount; i++)
   2803  1.3  christos             {
   2804  1.3  christos                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
   2805  1.4  christos                     &Hint->HintAddress[i],
   2806  1.4  christos                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
   2807  1.3  christos                 if (ACPI_FAILURE (Status))
   2808  1.3  christos                 {
   2809  1.3  christos                     return;
   2810  1.3  christos                 }
   2811  1.3  christos 
   2812  1.3  christos                 FieldOffset += sizeof (UINT64);
   2813  1.3  christos             }
   2814  1.3  christos             break;
   2815  1.3  christos 
   2816  1.3  christos         default:
   2817  1.3  christos             break;
   2818  1.3  christos         }
   2819  1.3  christos 
   2820  1.3  christos NextSubTable:
   2821  1.3  christos         /* Point to next subtable */
   2822  1.3  christos 
   2823  1.3  christos         Offset += SubTable->Length;
   2824  1.3  christos         SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length);
   2825  1.3  christos     }
   2826  1.3  christos }
   2827  1.3  christos 
   2828  1.3  christos 
   2829  1.3  christos /*******************************************************************************
   2830  1.3  christos  *
   2831  1.2  christos  * FUNCTION:    AcpiDmDumpPcct
   2832  1.2  christos  *
   2833  1.2  christos  * PARAMETERS:  Table               - A PCCT table
   2834  1.2  christos  *
   2835  1.2  christos  * RETURN:      None
   2836  1.2  christos  *
   2837  1.2  christos  * DESCRIPTION: Format the contents of a PCCT. This table type consists
   2838  1.2  christos  *              of an open-ended number of subtables.
   2839  1.2  christos  *
   2840  1.2  christos  ******************************************************************************/
   2841  1.2  christos 
   2842  1.2  christos void
   2843  1.2  christos AcpiDmDumpPcct (
   2844  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2845  1.2  christos {
   2846  1.2  christos     ACPI_STATUS             Status;
   2847  1.2  christos     ACPI_PCCT_SUBSPACE      *SubTable;
   2848  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   2849  1.2  christos     UINT32                  Length = Table->Length;
   2850  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
   2851  1.2  christos 
   2852  1.2  christos 
   2853  1.2  christos     /* Main table */
   2854  1.2  christos 
   2855  1.2  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
   2856  1.2  christos     if (ACPI_FAILURE (Status))
   2857  1.2  christos     {
   2858  1.2  christos         return;
   2859  1.2  christos     }
   2860  1.2  christos 
   2861  1.2  christos     /* Subtables */
   2862  1.2  christos 
   2863  1.2  christos     SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
   2864  1.2  christos     while (Offset < Table->Length)
   2865  1.2  christos     {
   2866  1.2  christos         /* Common subtable header */
   2867  1.2  christos 
   2868  1.2  christos         AcpiOsPrintf ("\n");
   2869  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2870  1.4  christos             SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
   2871  1.2  christos         if (ACPI_FAILURE (Status))
   2872  1.2  christos         {
   2873  1.2  christos             return;
   2874  1.2  christos         }
   2875  1.2  christos 
   2876  1.2  christos         switch (SubTable->Header.Type)
   2877  1.2  christos         {
   2878  1.2  christos         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
   2879  1.2  christos 
   2880  1.2  christos             InfoTable = AcpiDmTableInfoPcct0;
   2881  1.2  christos             break;
   2882  1.2  christos 
   2883  1.2  christos         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
   2884  1.2  christos 
   2885  1.2  christos             InfoTable = AcpiDmTableInfoPcct1;
   2886  1.2  christos             break;
   2887  1.2  christos 
   2888  1.2  christos         default:
   2889  1.2  christos 
   2890  1.2  christos             AcpiOsPrintf (
   2891  1.2  christos                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
   2892  1.2  christos                 SubTable->Header.Type);
   2893  1.2  christos             return;
   2894  1.2  christos         }
   2895  1.2  christos 
   2896  1.2  christos         AcpiOsPrintf ("\n");
   2897  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2898  1.4  christos             SubTable->Header.Length, InfoTable);
   2899  1.2  christos         if (ACPI_FAILURE (Status))
   2900  1.2  christos         {
   2901  1.2  christos             return;
   2902  1.2  christos         }
   2903  1.2  christos 
   2904  1.2  christos         /* Point to next subtable */
   2905  1.2  christos 
   2906  1.2  christos         Offset += SubTable->Header.Length;
   2907  1.2  christos         SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
   2908  1.4  christos             SubTable->Header.Length);
   2909  1.2  christos     }
   2910  1.2  christos }
   2911  1.2  christos 
   2912  1.2  christos 
   2913  1.2  christos /*******************************************************************************
   2914  1.2  christos  *
   2915  1.2  christos  * FUNCTION:    AcpiDmDumpPmtt
   2916  1.2  christos  *
   2917  1.2  christos  * PARAMETERS:  Table               - A PMTT table
   2918  1.2  christos  *
   2919  1.2  christos  * RETURN:      None
   2920  1.2  christos  *
   2921  1.2  christos  * DESCRIPTION: Format the contents of a PMTT. This table type consists
   2922  1.2  christos  *              of an open-ended number of subtables.
   2923  1.2  christos  *
   2924  1.2  christos  ******************************************************************************/
   2925  1.2  christos 
   2926  1.2  christos void
   2927  1.2  christos AcpiDmDumpPmtt (
   2928  1.2  christos     ACPI_TABLE_HEADER       *Table)
   2929  1.2  christos {
   2930  1.2  christos     ACPI_STATUS             Status;
   2931  1.2  christos     ACPI_PMTT_HEADER        *SubTable;
   2932  1.2  christos     ACPI_PMTT_HEADER        *MemSubTable;
   2933  1.2  christos     ACPI_PMTT_HEADER        *DimmSubTable;
   2934  1.2  christos     ACPI_PMTT_DOMAIN        *DomainArray;
   2935  1.2  christos     UINT32                  Length = Table->Length;
   2936  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
   2937  1.2  christos     UINT32                  MemOffset;
   2938  1.2  christos     UINT32                  DimmOffset;
   2939  1.2  christos     UINT32                  DomainOffset;
   2940  1.2  christos     UINT32                  DomainCount;
   2941  1.2  christos 
   2942  1.2  christos 
   2943  1.2  christos     /* Main table */
   2944  1.2  christos 
   2945  1.2  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
   2946  1.2  christos     if (ACPI_FAILURE (Status))
   2947  1.2  christos     {
   2948  1.2  christos         return;
   2949  1.2  christos     }
   2950  1.2  christos 
   2951  1.2  christos     /* Subtables */
   2952  1.2  christos 
   2953  1.2  christos     SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
   2954  1.2  christos     while (Offset < Table->Length)
   2955  1.2  christos     {
   2956  1.2  christos         /* Common subtable header */
   2957  1.2  christos 
   2958  1.2  christos         AcpiOsPrintf ("\n");
   2959  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2960  1.4  christos             SubTable->Length, AcpiDmTableInfoPmttHdr);
   2961  1.2  christos         if (ACPI_FAILURE (Status))
   2962  1.2  christos         {
   2963  1.2  christos             return;
   2964  1.2  christos         }
   2965  1.2  christos 
   2966  1.2  christos         /* Only Socket subtables are expected at this level */
   2967  1.2  christos 
   2968  1.2  christos         if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
   2969  1.2  christos         {
   2970  1.2  christos             AcpiOsPrintf (
   2971  1.2  christos                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   2972  1.2  christos                 SubTable->Type);
   2973  1.2  christos             return;
   2974  1.2  christos         }
   2975  1.2  christos 
   2976  1.2  christos         /* Dump the fixed-length portion of the subtable */
   2977  1.2  christos 
   2978  1.2  christos         Status = AcpiDmDumpTable (Length, Offset, SubTable,
   2979  1.4  christos             SubTable->Length, AcpiDmTableInfoPmtt0);
   2980  1.2  christos         if (ACPI_FAILURE (Status))
   2981  1.2  christos         {
   2982  1.2  christos             return;
   2983  1.2  christos         }
   2984  1.2  christos 
   2985  1.2  christos         /* Walk the memory controller subtables */
   2986  1.2  christos 
   2987  1.2  christos         MemOffset = sizeof (ACPI_PMTT_SOCKET);
   2988  1.2  christos         MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
   2989  1.2  christos             sizeof (ACPI_PMTT_SOCKET));
   2990  1.2  christos 
   2991  1.2  christos         while (((Offset + MemOffset) < Table->Length) &&
   2992  1.2  christos             (MemOffset < SubTable->Length))
   2993  1.2  christos         {
   2994  1.2  christos             /* Common subtable header */
   2995  1.2  christos 
   2996  1.2  christos             AcpiOsPrintf ("\n");
   2997  1.2  christos             Status = AcpiDmDumpTable (Length,
   2998  1.4  christos                 Offset + MemOffset, MemSubTable,
   2999  1.4  christos                 MemSubTable->Length, AcpiDmTableInfoPmttHdr);
   3000  1.2  christos             if (ACPI_FAILURE (Status))
   3001  1.2  christos             {
   3002  1.2  christos                 return;
   3003  1.2  christos             }
   3004  1.2  christos 
   3005  1.2  christos             /* Only memory controller subtables are expected at this level */
   3006  1.2  christos 
   3007  1.2  christos             if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
   3008  1.2  christos             {
   3009  1.2  christos                 AcpiOsPrintf (
   3010  1.2  christos                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   3011  1.2  christos                     MemSubTable->Type);
   3012  1.2  christos                 return;
   3013  1.2  christos             }
   3014  1.2  christos 
   3015  1.2  christos             /* Dump the fixed-length portion of the controller subtable */
   3016  1.2  christos 
   3017  1.2  christos             Status = AcpiDmDumpTable (Length,
   3018  1.4  christos                 Offset + MemOffset, MemSubTable,
   3019  1.4  christos                 MemSubTable->Length, AcpiDmTableInfoPmtt1);
   3020  1.2  christos             if (ACPI_FAILURE (Status))
   3021  1.2  christos             {
   3022  1.2  christos                 return;
   3023  1.2  christos             }
   3024  1.2  christos 
   3025  1.2  christos             /* Walk the variable count of proximity domains */
   3026  1.2  christos 
   3027  1.2  christos             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
   3028  1.2  christos             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
   3029  1.2  christos             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
   3030  1.2  christos                 sizeof (ACPI_PMTT_CONTROLLER));
   3031  1.2  christos 
   3032  1.2  christos             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
   3033  1.2  christos                 ((MemOffset + DomainOffset) < SubTable->Length) &&
   3034  1.2  christos                 DomainCount)
   3035  1.2  christos             {
   3036  1.2  christos                 Status = AcpiDmDumpTable (Length,
   3037  1.4  christos                     Offset + MemOffset + DomainOffset, DomainArray,
   3038  1.4  christos                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
   3039  1.2  christos                 if (ACPI_FAILURE (Status))
   3040  1.2  christos                 {
   3041  1.2  christos                     return;
   3042  1.2  christos                 }
   3043  1.2  christos 
   3044  1.2  christos                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
   3045  1.2  christos                 DomainArray++;
   3046  1.2  christos                 DomainCount--;
   3047  1.2  christos             }
   3048  1.2  christos 
   3049  1.2  christos             if (DomainCount)
   3050  1.2  christos             {
   3051  1.2  christos                 AcpiOsPrintf (
   3052  1.2  christos                     "\n**** DomainCount exceeds subtable length\n\n");
   3053  1.2  christos             }
   3054  1.2  christos 
   3055  1.2  christos             /* Walk the physical component (DIMM) subtables */
   3056  1.2  christos 
   3057  1.2  christos             DimmOffset = DomainOffset;
   3058  1.2  christos             DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
   3059  1.2  christos                 DomainOffset);
   3060  1.2  christos 
   3061  1.2  christos             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
   3062  1.2  christos                 (DimmOffset < MemSubTable->Length))
   3063  1.2  christos             {
   3064  1.2  christos                 /* Common subtable header */
   3065  1.2  christos 
   3066  1.2  christos                 AcpiOsPrintf ("\n");
   3067  1.2  christos                 Status = AcpiDmDumpTable (Length,
   3068  1.4  christos                     Offset + MemOffset + DimmOffset, DimmSubTable,
   3069  1.4  christos                     DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
   3070  1.2  christos                 if (ACPI_FAILURE (Status))
   3071  1.2  christos                 {
   3072  1.2  christos                     return;
   3073  1.2  christos                 }
   3074  1.2  christos 
   3075  1.2  christos                 /* Only DIMM subtables are expected at this level */
   3076  1.2  christos 
   3077  1.2  christos                 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
   3078  1.2  christos                 {
   3079  1.2  christos                     AcpiOsPrintf (
   3080  1.2  christos                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
   3081  1.2  christos                         DimmSubTable->Type);
   3082  1.2  christos                     return;
   3083  1.2  christos                 }
   3084  1.2  christos 
   3085  1.2  christos                 /* Dump the fixed-length DIMM subtable */
   3086  1.2  christos 
   3087  1.2  christos                 Status = AcpiDmDumpTable (Length,
   3088  1.4  christos                     Offset + MemOffset + DimmOffset, DimmSubTable,
   3089  1.4  christos                     DimmSubTable->Length, AcpiDmTableInfoPmtt2);
   3090  1.2  christos                 if (ACPI_FAILURE (Status))
   3091  1.2  christos                 {
   3092  1.2  christos                     return;
   3093  1.2  christos                 }
   3094  1.2  christos 
   3095  1.2  christos                 /* Point to next DIMM subtable */
   3096  1.2  christos 
   3097  1.2  christos                 DimmOffset += DimmSubTable->Length;
   3098  1.2  christos                 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   3099  1.2  christos                     DimmSubTable, DimmSubTable->Length);
   3100  1.2  christos             }
   3101  1.2  christos 
   3102  1.2  christos             /* Point to next Controller subtable */
   3103  1.2  christos 
   3104  1.2  christos             MemOffset += MemSubTable->Length;
   3105  1.2  christos             MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   3106  1.2  christos                 MemSubTable, MemSubTable->Length);
   3107  1.2  christos         }
   3108  1.2  christos 
   3109  1.2  christos         /* Point to next Socket subtable */
   3110  1.2  christos 
   3111  1.2  christos         Offset += SubTable->Length;
   3112  1.2  christos         SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
   3113  1.2  christos             SubTable, SubTable->Length);
   3114  1.2  christos     }
   3115  1.2  christos }
   3116  1.2  christos 
   3117  1.2  christos 
   3118  1.2  christos /*******************************************************************************
   3119  1.2  christos  *
   3120  1.2  christos  * FUNCTION:    AcpiDmDumpS3pt
   3121  1.2  christos  *
   3122  1.2  christos  * PARAMETERS:  Table               - A S3PT table
   3123  1.2  christos  *
   3124  1.2  christos  * RETURN:      Length of the table
   3125  1.2  christos  *
   3126  1.2  christos  * DESCRIPTION: Format the contents of a S3PT
   3127  1.2  christos  *
   3128  1.2  christos  ******************************************************************************/
   3129  1.2  christos 
   3130  1.2  christos UINT32
   3131  1.2  christos AcpiDmDumpS3pt (
   3132  1.2  christos     ACPI_TABLE_HEADER       *Tables)
   3133  1.2  christos {
   3134  1.2  christos     ACPI_STATUS             Status;
   3135  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
   3136  1.2  christos     ACPI_S3PT_HEADER        *SubTable;
   3137  1.2  christos     ACPI_DMTABLE_INFO       *InfoTable;
   3138  1.2  christos     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
   3139  1.2  christos 
   3140  1.2  christos 
   3141  1.2  christos     /* Main table */
   3142  1.2  christos 
   3143  1.2  christos     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
   3144  1.2  christos     if (ACPI_FAILURE (Status))
   3145  1.2  christos     {
   3146  1.2  christos         return 0;
   3147  1.2  christos     }
   3148  1.2  christos 
   3149  1.2  christos     SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset);
   3150  1.2  christos     while (Offset < S3ptTable->Length)
   3151  1.2  christos     {
   3152  1.2  christos         /* Common subtable header */
   3153  1.2  christos 
   3154  1.2  christos         AcpiOsPrintf ("\n");
   3155  1.2  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
   3156  1.4  christos             SubTable->Length, AcpiDmTableInfoS3ptHdr);
   3157  1.2  christos         if (ACPI_FAILURE (Status))
   3158  1.2  christos         {
   3159  1.2  christos             return 0;
   3160  1.2  christos         }
   3161  1.2  christos 
   3162  1.2  christos         switch (SubTable->Type)
   3163  1.2  christos         {
   3164  1.2  christos         case ACPI_S3PT_TYPE_RESUME:
   3165  1.2  christos 
   3166  1.2  christos             InfoTable = AcpiDmTableInfoS3pt0;
   3167  1.2  christos             break;
   3168  1.2  christos 
   3169  1.2  christos         case ACPI_S3PT_TYPE_SUSPEND:
   3170  1.2  christos 
   3171  1.2  christos             InfoTable = AcpiDmTableInfoS3pt1;
   3172  1.2  christos             break;
   3173  1.2  christos 
   3174  1.2  christos         default:
   3175  1.2  christos 
   3176  1.4  christos             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
   3177  1.4  christos                 SubTable->Type);
   3178  1.2  christos 
   3179  1.2  christos             /* Attempt to continue */
   3180  1.2  christos 
   3181  1.2  christos             if (!SubTable->Length)
   3182  1.2  christos             {
   3183  1.2  christos                 AcpiOsPrintf ("Invalid zero length subtable\n");
   3184  1.2  christos                 return 0;
   3185  1.2  christos             }
   3186  1.2  christos             goto NextSubTable;
   3187  1.2  christos         }
   3188  1.2  christos 
   3189  1.2  christos         AcpiOsPrintf ("\n");
   3190  1.2  christos         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
   3191  1.4  christos             SubTable->Length, InfoTable);
   3192  1.2  christos         if (ACPI_FAILURE (Status))
   3193  1.2  christos         {
   3194  1.2  christos             return 0;
   3195  1.2  christos         }
   3196  1.2  christos 
   3197  1.2  christos NextSubTable:
   3198  1.2  christos         /* Point to next subtable */
   3199  1.2  christos 
   3200  1.2  christos         Offset += SubTable->Length;
   3201  1.2  christos         SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length);
   3202  1.2  christos     }
   3203  1.2  christos 
   3204  1.2  christos     return (S3ptTable->Length);
   3205  1.2  christos }
   3206  1.2  christos 
   3207  1.2  christos 
   3208  1.2  christos /*******************************************************************************
   3209  1.2  christos  *
   3210  1.2  christos  * FUNCTION:    AcpiDmDumpSlic
   3211  1.2  christos  *
   3212  1.2  christos  * PARAMETERS:  Table               - A SLIC table
   3213  1.2  christos  *
   3214  1.2  christos  * RETURN:      None
   3215  1.2  christos  *
   3216  1.2  christos  * DESCRIPTION: Format the contents of a SLIC
   3217  1.2  christos  *
   3218  1.2  christos  ******************************************************************************/
   3219  1.2  christos 
   3220  1.2  christos void
   3221  1.2  christos AcpiDmDumpSlic (
   3222  1.2  christos     ACPI_TABLE_HEADER       *Table)
   3223  1.2  christos {
   3224  1.4  christos 
   3225  1.3  christos     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
   3226  1.4  christos         Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
   3227  1.2  christos }
   3228  1.2  christos 
   3229  1.2  christos 
   3230  1.2  christos /*******************************************************************************
   3231  1.2  christos  *
   3232  1.1    jruoho  * FUNCTION:    AcpiDmDumpSlit
   3233  1.1    jruoho  *
   3234  1.1    jruoho  * PARAMETERS:  Table               - An SLIT
   3235  1.1    jruoho  *
   3236  1.1    jruoho  * RETURN:      None
   3237  1.1    jruoho  *
   3238  1.1    jruoho  * DESCRIPTION: Format the contents of a SLIT
   3239  1.1    jruoho  *
   3240  1.1    jruoho  ******************************************************************************/
   3241  1.1    jruoho 
   3242  1.1    jruoho void
   3243  1.1    jruoho AcpiDmDumpSlit (
   3244  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   3245  1.1    jruoho {
   3246  1.1    jruoho     ACPI_STATUS             Status;
   3247  1.1    jruoho     UINT32                  Offset;
   3248  1.1    jruoho     UINT8                   *Row;
   3249  1.1    jruoho     UINT32                  Localities;
   3250  1.1    jruoho     UINT32                  i;
   3251  1.1    jruoho     UINT32                  j;
   3252  1.1    jruoho 
   3253  1.1    jruoho 
   3254  1.1    jruoho     /* Main table */
   3255  1.1    jruoho 
   3256  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
   3257  1.1    jruoho     if (ACPI_FAILURE (Status))
   3258  1.1    jruoho     {
   3259  1.1    jruoho         return;
   3260  1.1    jruoho     }
   3261  1.1    jruoho 
   3262  1.1    jruoho     /* Display the Locality NxN Matrix */
   3263  1.1    jruoho 
   3264  1.1    jruoho     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
   3265  1.1    jruoho     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
   3266  1.1    jruoho     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
   3267  1.1    jruoho 
   3268  1.1    jruoho     for (i = 0; i < Localities; i++)
   3269  1.1    jruoho     {
   3270  1.1    jruoho         /* Display one row of the matrix */
   3271  1.1    jruoho 
   3272  1.1    jruoho         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
   3273  1.1    jruoho         for  (j = 0; j < Localities; j++)
   3274  1.1    jruoho         {
   3275  1.1    jruoho             /* Check for beyond EOT */
   3276  1.1    jruoho 
   3277  1.1    jruoho             if (Offset >= Table->Length)
   3278  1.1    jruoho             {
   3279  1.4  christos                 AcpiOsPrintf (
   3280  1.4  christos                     "\n**** Not enough room in table for all localities\n");
   3281  1.1    jruoho                 return;
   3282  1.1    jruoho             }
   3283  1.1    jruoho 
   3284  1.2  christos             AcpiOsPrintf ("%2.2X", Row[j]);
   3285  1.1    jruoho             Offset++;
   3286  1.1    jruoho 
   3287  1.1    jruoho             /* Display up to 16 bytes per output row */
   3288  1.1    jruoho 
   3289  1.2  christos             if ((j+1) < Localities)
   3290  1.1    jruoho             {
   3291  1.2  christos                 AcpiOsPrintf (" ");
   3292  1.2  christos 
   3293  1.2  christos                 if (j && (((j+1) % 16) == 0))
   3294  1.2  christos                 {
   3295  1.2  christos                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
   3296  1.2  christos                     AcpiDmLineHeader (Offset, 0, NULL);
   3297  1.2  christos                 }
   3298  1.1    jruoho             }
   3299  1.1    jruoho         }
   3300  1.1    jruoho 
   3301  1.1    jruoho         /* Point to next row */
   3302  1.1    jruoho 
   3303  1.1    jruoho         AcpiOsPrintf ("\n");
   3304  1.1    jruoho         Row += Localities;
   3305  1.1    jruoho     }
   3306  1.1    jruoho }
   3307  1.1    jruoho 
   3308  1.1    jruoho 
   3309  1.1    jruoho /*******************************************************************************
   3310  1.1    jruoho  *
   3311  1.1    jruoho  * FUNCTION:    AcpiDmDumpSrat
   3312  1.1    jruoho  *
   3313  1.1    jruoho  * PARAMETERS:  Table               - A SRAT table
   3314  1.1    jruoho  *
   3315  1.1    jruoho  * RETURN:      None
   3316  1.1    jruoho  *
   3317  1.1    jruoho  * DESCRIPTION: Format the contents of a SRAT
   3318  1.1    jruoho  *
   3319  1.1    jruoho  ******************************************************************************/
   3320  1.1    jruoho 
   3321  1.1    jruoho void
   3322  1.1    jruoho AcpiDmDumpSrat (
   3323  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   3324  1.1    jruoho {
   3325  1.1    jruoho     ACPI_STATUS             Status;
   3326  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
   3327  1.1    jruoho     ACPI_SUBTABLE_HEADER    *SubTable;
   3328  1.1    jruoho     ACPI_DMTABLE_INFO       *InfoTable;
   3329  1.1    jruoho 
   3330  1.1    jruoho 
   3331  1.1    jruoho     /* Main table */
   3332  1.1    jruoho 
   3333  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
   3334  1.1    jruoho     if (ACPI_FAILURE (Status))
   3335  1.1    jruoho     {
   3336  1.1    jruoho         return;
   3337  1.1    jruoho     }
   3338  1.1    jruoho 
   3339  1.2  christos     /* Subtables */
   3340  1.1    jruoho 
   3341  1.1    jruoho     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
   3342  1.1    jruoho     while (Offset < Table->Length)
   3343  1.1    jruoho     {
   3344  1.2  christos         /* Common subtable header */
   3345  1.1    jruoho 
   3346  1.1    jruoho         AcpiOsPrintf ("\n");
   3347  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   3348  1.4  christos             SubTable->Length, AcpiDmTableInfoSratHdr);
   3349  1.1    jruoho         if (ACPI_FAILURE (Status))
   3350  1.1    jruoho         {
   3351  1.1    jruoho             return;
   3352  1.1    jruoho         }
   3353  1.1    jruoho 
   3354  1.1    jruoho         switch (SubTable->Type)
   3355  1.1    jruoho         {
   3356  1.1    jruoho         case ACPI_SRAT_TYPE_CPU_AFFINITY:
   3357  1.2  christos 
   3358  1.1    jruoho             InfoTable = AcpiDmTableInfoSrat0;
   3359  1.1    jruoho             break;
   3360  1.2  christos 
   3361  1.1    jruoho         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
   3362  1.2  christos 
   3363  1.1    jruoho             InfoTable = AcpiDmTableInfoSrat1;
   3364  1.1    jruoho             break;
   3365  1.2  christos 
   3366  1.1    jruoho         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
   3367  1.2  christos 
   3368  1.1    jruoho             InfoTable = AcpiDmTableInfoSrat2;
   3369  1.1    jruoho             break;
   3370  1.2  christos 
   3371  1.2  christos         case ACPI_SRAT_TYPE_GICC_AFFINITY:
   3372  1.2  christos 
   3373  1.2  christos             InfoTable = AcpiDmTableInfoSrat3;
   3374  1.2  christos             break;
   3375  1.2  christos 
   3376  1.1    jruoho         default:
   3377  1.4  christos             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
   3378  1.4  christos                 SubTable->Type);
   3379  1.1    jruoho 
   3380  1.1    jruoho             /* Attempt to continue */
   3381  1.1    jruoho 
   3382  1.1    jruoho             if (!SubTable->Length)
   3383  1.1    jruoho             {
   3384  1.1    jruoho                 AcpiOsPrintf ("Invalid zero length subtable\n");
   3385  1.1    jruoho                 return;
   3386  1.1    jruoho             }
   3387  1.1    jruoho             goto NextSubTable;
   3388  1.1    jruoho         }
   3389  1.1    jruoho 
   3390  1.1    jruoho         AcpiOsPrintf ("\n");
   3391  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   3392  1.4  christos             SubTable->Length, InfoTable);
   3393  1.1    jruoho         if (ACPI_FAILURE (Status))
   3394  1.1    jruoho         {
   3395  1.1    jruoho             return;
   3396  1.1    jruoho         }
   3397  1.1    jruoho 
   3398  1.1    jruoho NextSubTable:
   3399  1.2  christos         /* Point to next subtable */
   3400  1.1    jruoho 
   3401  1.1    jruoho         Offset += SubTable->Length;
   3402  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
   3403  1.4  christos             SubTable->Length);
   3404  1.1    jruoho     }
   3405  1.1    jruoho }
   3406  1.1    jruoho 
   3407  1.1    jruoho 
   3408  1.1    jruoho /*******************************************************************************
   3409  1.1    jruoho  *
   3410  1.3  christos  * FUNCTION:    AcpiDmDumpStao
   3411  1.3  christos  *
   3412  1.3  christos  * PARAMETERS:  Table               - A STAO table
   3413  1.3  christos  *
   3414  1.3  christos  * RETURN:      None
   3415  1.3  christos  *
   3416  1.3  christos  * DESCRIPTION: Format the contents of a STAO. This is a variable-length
   3417  1.3  christos  *              table that contains an open-ended number of ASCII strings
   3418  1.3  christos  *              at the end of the table.
   3419  1.3  christos  *
   3420  1.3  christos  ******************************************************************************/
   3421  1.3  christos 
   3422  1.3  christos void
   3423  1.3  christos AcpiDmDumpStao (
   3424  1.3  christos     ACPI_TABLE_HEADER       *Table)
   3425  1.3  christos {
   3426  1.3  christos     ACPI_STATUS             Status;
   3427  1.3  christos     char                    *Namepath;
   3428  1.3  christos     UINT32                  Length = Table->Length;
   3429  1.3  christos     UINT32                  StringLength;
   3430  1.3  christos     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
   3431  1.3  christos 
   3432  1.3  christos 
   3433  1.3  christos     /* Main table */
   3434  1.3  christos 
   3435  1.3  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
   3436  1.3  christos     if (ACPI_FAILURE (Status))
   3437  1.3  christos     {
   3438  1.3  christos         return;
   3439  1.3  christos     }
   3440  1.3  christos 
   3441  1.3  christos     /* The rest of the table consists of Namepath strings */
   3442  1.3  christos 
   3443  1.3  christos     while (Offset < Table->Length)
   3444  1.3  christos     {
   3445  1.3  christos         Namepath = ACPI_ADD_PTR (char, Table, Offset);
   3446  1.3  christos         StringLength = strlen (Namepath) + 1;
   3447  1.3  christos 
   3448  1.3  christos         AcpiDmLineHeader (Offset, StringLength, "Namestring");
   3449  1.3  christos         AcpiOsPrintf ("\"%s\"\n", Namepath);
   3450  1.3  christos 
   3451  1.3  christos         /* Point to next namepath */
   3452  1.3  christos 
   3453  1.3  christos         Offset += StringLength;
   3454  1.3  christos     }
   3455  1.3  christos }
   3456  1.3  christos 
   3457  1.3  christos 
   3458  1.3  christos /*******************************************************************************
   3459  1.3  christos  *
   3460  1.3  christos  * FUNCTION:    AcpiDmDumpTcpa
   3461  1.3  christos  *
   3462  1.3  christos  * PARAMETERS:  Table               - A TCPA table
   3463  1.3  christos  *
   3464  1.3  christos  * RETURN:      None
   3465  1.3  christos  *
   3466  1.3  christos  * DESCRIPTION: Format the contents of a TCPA.
   3467  1.3  christos  *
   3468  1.3  christos  * NOTE:        There are two versions of the table with the same signature:
   3469  1.3  christos  *              the client version and the server version. The common
   3470  1.3  christos  *              PlatformClass field is used to differentiate the two types of
   3471  1.3  christos  *              tables.
   3472  1.3  christos  *
   3473  1.3  christos  ******************************************************************************/
   3474  1.3  christos 
   3475  1.3  christos void
   3476  1.3  christos AcpiDmDumpTcpa (
   3477  1.3  christos     ACPI_TABLE_HEADER       *Table)
   3478  1.3  christos {
   3479  1.3  christos     UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);
   3480  1.3  christos     ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (
   3481  1.3  christos                                 ACPI_TABLE_TCPA_HDR, Table);
   3482  1.3  christos     ACPI_TABLE_TCPA_HDR     *SubTable = ACPI_ADD_PTR (
   3483  1.3  christos                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
   3484  1.3  christos     ACPI_STATUS             Status;
   3485  1.3  christos 
   3486  1.3  christos 
   3487  1.3  christos     /* Main table */
   3488  1.3  christos 
   3489  1.3  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table,
   3490  1.3  christos         0, AcpiDmTableInfoTcpaHdr);
   3491  1.3  christos     if (ACPI_FAILURE (Status))
   3492  1.3  christos     {
   3493  1.3  christos         return;
   3494  1.3  christos     }
   3495  1.3  christos 
   3496  1.3  christos     /*
   3497  1.3  christos      * Examine the PlatformClass field to determine the table type.
   3498  1.3  christos      * Either a client or server table. Only one.
   3499  1.3  christos      */
   3500  1.3  christos     switch (CommonHeader->PlatformClass)
   3501  1.3  christos     {
   3502  1.3  christos     case ACPI_TCPA_CLIENT_TABLE:
   3503  1.3  christos 
   3504  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   3505  1.3  christos             Table->Length - Offset, AcpiDmTableInfoTcpaClient);
   3506  1.3  christos         break;
   3507  1.3  christos 
   3508  1.3  christos     case ACPI_TCPA_SERVER_TABLE:
   3509  1.3  christos 
   3510  1.3  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   3511  1.3  christos             Table->Length - Offset, AcpiDmTableInfoTcpaServer);
   3512  1.3  christos         break;
   3513  1.3  christos 
   3514  1.3  christos     default:
   3515  1.3  christos 
   3516  1.3  christos         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
   3517  1.3  christos             CommonHeader->PlatformClass);
   3518  1.3  christos         Status = AE_ERROR;
   3519  1.3  christos         break;
   3520  1.3  christos     }
   3521  1.3  christos 
   3522  1.3  christos     if (ACPI_FAILURE (Status))
   3523  1.3  christos     {
   3524  1.3  christos         AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
   3525  1.3  christos     }
   3526  1.3  christos }
   3527  1.3  christos 
   3528  1.3  christos 
   3529  1.3  christos /*******************************************************************************
   3530  1.3  christos  *
   3531  1.2  christos  * FUNCTION:    AcpiDmDumpVrtc
   3532  1.2  christos  *
   3533  1.2  christos  * PARAMETERS:  Table               - A VRTC table
   3534  1.2  christos  *
   3535  1.2  christos  * RETURN:      None
   3536  1.2  christos  *
   3537  1.2  christos  * DESCRIPTION: Format the contents of a VRTC
   3538  1.2  christos  *
   3539  1.2  christos  ******************************************************************************/
   3540  1.2  christos 
   3541  1.2  christos void
   3542  1.2  christos AcpiDmDumpVrtc (
   3543  1.2  christos     ACPI_TABLE_HEADER       *Table)
   3544  1.2  christos {
   3545  1.2  christos     ACPI_STATUS             Status;
   3546  1.2  christos     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
   3547  1.2  christos     ACPI_VRTC_ENTRY         *SubTable;
   3548  1.2  christos 
   3549  1.2  christos 
   3550  1.2  christos     /* Main table */
   3551  1.2  christos 
   3552  1.2  christos     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
   3553  1.2  christos     if (ACPI_FAILURE (Status))
   3554  1.2  christos     {
   3555  1.2  christos         return;
   3556  1.2  christos     }
   3557  1.2  christos 
   3558  1.2  christos     /* Subtables */
   3559  1.2  christos 
   3560  1.2  christos     SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
   3561  1.2  christos     while (Offset < Table->Length)
   3562  1.2  christos     {
   3563  1.2  christos         /* Common subtable header */
   3564  1.2  christos 
   3565  1.2  christos         AcpiOsPrintf ("\n");
   3566  1.2  christos         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   3567  1.4  christos             sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
   3568  1.2  christos         if (ACPI_FAILURE (Status))
   3569  1.2  christos         {
   3570  1.2  christos             return;
   3571  1.2  christos         }
   3572  1.2  christos 
   3573  1.2  christos         /* Point to next subtable */
   3574  1.2  christos 
   3575  1.2  christos         Offset += sizeof (ACPI_VRTC_ENTRY);
   3576  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable,
   3577  1.4  christos             sizeof (ACPI_VRTC_ENTRY));
   3578  1.2  christos     }
   3579  1.2  christos }
   3580  1.2  christos 
   3581  1.2  christos 
   3582  1.2  christos /*******************************************************************************
   3583  1.2  christos  *
   3584  1.1    jruoho  * FUNCTION:    AcpiDmDumpWdat
   3585  1.1    jruoho  *
   3586  1.1    jruoho  * PARAMETERS:  Table               - A WDAT table
   3587  1.1    jruoho  *
   3588  1.1    jruoho  * RETURN:      None
   3589  1.1    jruoho  *
   3590  1.1    jruoho  * DESCRIPTION: Format the contents of a WDAT
   3591  1.1    jruoho  *
   3592  1.1    jruoho  ******************************************************************************/
   3593  1.1    jruoho 
   3594  1.1    jruoho void
   3595  1.1    jruoho AcpiDmDumpWdat (
   3596  1.1    jruoho     ACPI_TABLE_HEADER       *Table)
   3597  1.1    jruoho {
   3598  1.1    jruoho     ACPI_STATUS             Status;
   3599  1.1    jruoho     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
   3600  1.1    jruoho     ACPI_WDAT_ENTRY         *SubTable;
   3601  1.1    jruoho 
   3602  1.1    jruoho 
   3603  1.1    jruoho     /* Main table */
   3604  1.1    jruoho 
   3605  1.1    jruoho     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
   3606  1.1    jruoho     if (ACPI_FAILURE (Status))
   3607  1.1    jruoho     {
   3608  1.1    jruoho         return;
   3609  1.1    jruoho     }
   3610  1.1    jruoho 
   3611  1.2  christos     /* Subtables */
   3612  1.1    jruoho 
   3613  1.1    jruoho     SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
   3614  1.1    jruoho     while (Offset < Table->Length)
   3615  1.1    jruoho     {
   3616  1.2  christos         /* Common subtable header */
   3617  1.1    jruoho 
   3618  1.1    jruoho         AcpiOsPrintf ("\n");
   3619  1.1    jruoho         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
   3620  1.4  christos             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
   3621  1.1    jruoho         if (ACPI_FAILURE (Status))
   3622  1.1    jruoho         {
   3623  1.1    jruoho             return;
   3624  1.1    jruoho         }
   3625  1.1    jruoho 
   3626  1.2  christos         /* Point to next subtable */
   3627  1.1    jruoho 
   3628  1.1    jruoho         Offset += sizeof (ACPI_WDAT_ENTRY);
   3629  1.4  christos         SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable,
   3630  1.4  christos             sizeof (ACPI_WDAT_ENTRY));
   3631  1.1    jruoho     }
   3632  1.1    jruoho }
   3633  1.3  christos 
   3634  1.4  christos 
   3635  1.3  christos /*******************************************************************************
   3636  1.3  christos  *
   3637  1.3  christos  * FUNCTION:    AcpiDmDumpWpbt
   3638  1.3  christos  *
   3639  1.3  christos  * PARAMETERS:  Table               - A WPBT table
   3640  1.3  christos  *
   3641  1.3  christos  * RETURN:      None
   3642  1.3  christos  *
   3643  1.3  christos  * DESCRIPTION: Format the contents of a WPBT. This table type consists
   3644  1.3  christos  *              of an open-ended arguments buffer at the end of the table.
   3645  1.3  christos  *
   3646  1.3  christos  ******************************************************************************/
   3647  1.3  christos 
   3648  1.3  christos void
   3649  1.3  christos AcpiDmDumpWpbt (
   3650  1.3  christos     ACPI_TABLE_HEADER       *Table)
   3651  1.3  christos {
   3652  1.3  christos     ACPI_STATUS             Status;
   3653  1.3  christos     ACPI_TABLE_WPBT         *SubTable;
   3654  1.3  christos     UINT32                  Length = Table->Length;
   3655  1.3  christos     UINT16                  ArgumentsLength;
   3656  1.3  christos 
   3657  1.3  christos 
   3658  1.3  christos     /* Dump the main table */
   3659  1.3  christos 
   3660  1.3  christos     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
   3661  1.3  christos     if (ACPI_FAILURE (Status))
   3662  1.3  christos     {
   3663  1.3  christos         return;
   3664  1.3  christos     }
   3665  1.3  christos 
   3666  1.3  christos     /* Extract the arguments buffer length from the main table */
   3667  1.3  christos 
   3668  1.3  christos     SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
   3669  1.3  christos     ArgumentsLength = SubTable->ArgumentsLength;
   3670  1.3  christos 
   3671  1.3  christos     /* Dump the arguments buffer */
   3672  1.3  christos 
   3673  1.3  christos     (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
   3674  1.3  christos         AcpiDmTableInfoWpbt0);
   3675  1.3  christos }
   3676