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