xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump2.c (revision 1b7a2680fba589daf6f700565214919cb941ab56)
1ff879b07SJung-uk Kim /******************************************************************************
2ff879b07SJung-uk Kim  *
3ff879b07SJung-uk Kim  * Module Name: dmtbdump2 - Dump ACPI data tables that contain no AML code
4ff879b07SJung-uk Kim  *
5ff879b07SJung-uk Kim  *****************************************************************************/
6ff879b07SJung-uk Kim 
7ff879b07SJung-uk Kim /******************************************************************************
8ff879b07SJung-uk Kim  *
9ff879b07SJung-uk Kim  * 1. Copyright Notice
10ff879b07SJung-uk Kim  *
1129f37e9bSJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12ff879b07SJung-uk Kim  * All rights reserved.
13ff879b07SJung-uk Kim  *
14ff879b07SJung-uk Kim  * 2. License
15ff879b07SJung-uk Kim  *
16ff879b07SJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
17ff879b07SJung-uk Kim  * rights. You may have additional license terms from the party that provided
18ff879b07SJung-uk Kim  * you this software, covering your right to use that party's intellectual
19ff879b07SJung-uk Kim  * property rights.
20ff879b07SJung-uk Kim  *
21ff879b07SJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22ff879b07SJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
23ff879b07SJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24ff879b07SJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
25ff879b07SJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
26ff879b07SJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
27ff879b07SJung-uk Kim  *
28ff879b07SJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29ff879b07SJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
30ff879b07SJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
31ff879b07SJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
32ff879b07SJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
33ff879b07SJung-uk Kim  * license, and in no event shall the patent license extend to any additions
34ff879b07SJung-uk Kim  * to or modifications of the Original Intel Code. No other license or right
35ff879b07SJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
36ff879b07SJung-uk Kim  *
37ff879b07SJung-uk Kim  * The above copyright and patent license is granted only if the following
38ff879b07SJung-uk Kim  * conditions are met:
39ff879b07SJung-uk Kim  *
40ff879b07SJung-uk Kim  * 3. Conditions
41ff879b07SJung-uk Kim  *
42ff879b07SJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43ff879b07SJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
44ff879b07SJung-uk Kim  * Code or modification with rights to further distribute source must include
45ff879b07SJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
46ff879b07SJung-uk Kim  * and the following Disclaimer and Export Compliance provision. In addition,
47ff879b07SJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
48ff879b07SJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
49ff879b07SJung-uk Kim  * Code and the date of any change. Licensee must include in that file the
50ff879b07SJung-uk Kim  * documentation of any changes made by any predecessor Licensee. Licensee
51ff879b07SJung-uk Kim  * must include a prominent statement that the modification is derived,
52ff879b07SJung-uk Kim  * directly or indirectly, from Original Intel Code.
53ff879b07SJung-uk Kim  *
54ff879b07SJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55ff879b07SJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
56ff879b07SJung-uk Kim  * Code or modification without rights to further distribute source must
57ff879b07SJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
58ff879b07SJung-uk Kim  * documentation and/or other materials provided with distribution. In
59ff879b07SJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
60ff879b07SJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
61ff879b07SJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
62ff879b07SJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
63ff879b07SJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
64ff879b07SJung-uk Kim  * make.
65ff879b07SJung-uk Kim  *
66ff879b07SJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67ff879b07SJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
68ff879b07SJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
69ff879b07SJung-uk Kim  * provision in the documentation and/or other materials provided with the
70ff879b07SJung-uk Kim  * distribution.
71ff879b07SJung-uk Kim  *
72ff879b07SJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
73ff879b07SJung-uk Kim  * Intel Code.
74ff879b07SJung-uk Kim  *
75ff879b07SJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76ff879b07SJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
77ff879b07SJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
78ff879b07SJung-uk Kim  * without prior written authorization from Intel.
79ff879b07SJung-uk Kim  *
80ff879b07SJung-uk Kim  * 4. Disclaimer and Export Compliance
81ff879b07SJung-uk Kim  *
82ff879b07SJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83ff879b07SJung-uk Kim  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84ff879b07SJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85ff879b07SJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86ff879b07SJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87ff879b07SJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88ff879b07SJung-uk Kim  * PARTICULAR PURPOSE.
89ff879b07SJung-uk Kim  *
90ff879b07SJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91ff879b07SJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92ff879b07SJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93ff879b07SJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94ff879b07SJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95ff879b07SJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96ff879b07SJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97ff879b07SJung-uk Kim  * LIMITED REMEDY.
98ff879b07SJung-uk Kim  *
99ff879b07SJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100ff879b07SJung-uk Kim  * software or system incorporating such software without first obtaining any
101ff879b07SJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
102ff879b07SJung-uk Kim  * any other agency or department of the United States Government. In the
103ff879b07SJung-uk Kim  * event Licensee exports any such software from the United States or
104ff879b07SJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
105ff879b07SJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
106ff879b07SJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
107ff879b07SJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108ff879b07SJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
109ff879b07SJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
110ff879b07SJung-uk Kim  * United States government or any agency thereof requires an export license,
111ff879b07SJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
112ff879b07SJung-uk Kim  * such license, approval or letter.
113ff879b07SJung-uk Kim  *
114ff879b07SJung-uk Kim  *****************************************************************************
115ff879b07SJung-uk Kim  *
116ff879b07SJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
117ff879b07SJung-uk Kim  * following license:
118ff879b07SJung-uk Kim  *
119ff879b07SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
120ff879b07SJung-uk Kim  * modification, are permitted provided that the following conditions
121ff879b07SJung-uk Kim  * are met:
122ff879b07SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
123ff879b07SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
124ff879b07SJung-uk Kim  *    without modification.
125ff879b07SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126ff879b07SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
127ff879b07SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
128ff879b07SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
129ff879b07SJung-uk Kim  *    binary redistribution.
130ff879b07SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
131ff879b07SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
132ff879b07SJung-uk Kim  *    from this software without specific prior written permission.
133ff879b07SJung-uk Kim  *
134ff879b07SJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135ff879b07SJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136ff879b07SJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137ff879b07SJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138ff879b07SJung-uk Kim  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139ff879b07SJung-uk Kim  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140ff879b07SJung-uk Kim  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141ff879b07SJung-uk Kim  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142ff879b07SJung-uk Kim  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143ff879b07SJung-uk Kim  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144ff879b07SJung-uk Kim  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145ff879b07SJung-uk Kim  *
146ff879b07SJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
147ff879b07SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
148ff879b07SJung-uk Kim  * Software Foundation.
149ff879b07SJung-uk Kim  *
150ff879b07SJung-uk Kim  *****************************************************************************/
151ff879b07SJung-uk Kim 
152ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
153ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
154ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h>
155ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/actables.h>
1561970d693SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h>
157ff879b07SJung-uk Kim 
158ff879b07SJung-uk Kim /* This module used for application-level code only */
159ff879b07SJung-uk Kim 
160ff879b07SJung-uk Kim #define _COMPONENT          ACPI_CA_DISASSEMBLER
161ff879b07SJung-uk Kim         ACPI_MODULE_NAME    ("dmtbdump2")
162ff879b07SJung-uk Kim 
163ff879b07SJung-uk Kim 
164ff879b07SJung-uk Kim /*******************************************************************************
165ff879b07SJung-uk Kim  *
166ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpIort
167ff879b07SJung-uk Kim  *
168ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A IORT table
169ff879b07SJung-uk Kim  *
170ff879b07SJung-uk Kim  * RETURN:      None
171ff879b07SJung-uk Kim  *
172ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a IORT
173ff879b07SJung-uk Kim  *
174ff879b07SJung-uk Kim  ******************************************************************************/
175ff879b07SJung-uk Kim 
176ff879b07SJung-uk Kim void
177ff879b07SJung-uk Kim AcpiDmDumpIort (
178ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
179ff879b07SJung-uk Kim {
180ff879b07SJung-uk Kim     ACPI_STATUS             Status;
181ff879b07SJung-uk Kim     ACPI_TABLE_IORT         *Iort;
182ff879b07SJung-uk Kim     ACPI_IORT_NODE          *IortNode;
183ff879b07SJung-uk Kim     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
184ff879b07SJung-uk Kim     ACPI_IORT_SMMU          *IortSmmu = NULL;
185cfd1ed46SJung-uk Kim     ACPI_IORT_RMR           *IortRmr = NULL;
186ff879b07SJung-uk Kim     UINT32                  Offset;
187ff879b07SJung-uk Kim     UINT32                  NodeOffset;
188ff879b07SJung-uk Kim     UINT32                  Length;
189ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
190ff879b07SJung-uk Kim     char                    *String;
191ff879b07SJung-uk Kim     UINT32                  i;
192a009b7dcSJung-uk Kim     UINT32                  MappingByteLength;
193cfd1ed46SJung-uk Kim     UINT8                   Revision;
194ff879b07SJung-uk Kim 
195ff879b07SJung-uk Kim 
196ff879b07SJung-uk Kim     /* Main table */
197ff879b07SJung-uk Kim 
198ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
199ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
200ff879b07SJung-uk Kim     {
201ff879b07SJung-uk Kim         return;
202ff879b07SJung-uk Kim     }
203ff879b07SJung-uk Kim 
204cfd1ed46SJung-uk Kim     Revision = Table->Revision;
205cfd1ed46SJung-uk Kim 
206cfd1ed46SJung-uk Kim     /* Both IORT Rev E and E.a have known issues and are not supported */
207cfd1ed46SJung-uk Kim 
208cfd1ed46SJung-uk Kim     if (Revision == 1 || Revision == 2)
209cfd1ed46SJung-uk Kim     {
210cfd1ed46SJung-uk Kim         AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n",
211cfd1ed46SJung-uk Kim                       Revision);
212cfd1ed46SJung-uk Kim         return;
213cfd1ed46SJung-uk Kim     }
214cfd1ed46SJung-uk Kim 
215ff879b07SJung-uk Kim     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
216ff879b07SJung-uk Kim     Offset = sizeof (ACPI_TABLE_IORT);
217ff879b07SJung-uk Kim 
218ff879b07SJung-uk Kim     /* Dump the OptionalPadding (optional) */
219ff879b07SJung-uk Kim 
220ff879b07SJung-uk Kim     if (Iort->NodeOffset > Offset)
221ff879b07SJung-uk Kim     {
222ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
223ff879b07SJung-uk Kim             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
224ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
225ff879b07SJung-uk Kim         {
226ff879b07SJung-uk Kim             return;
227ff879b07SJung-uk Kim         }
228ff879b07SJung-uk Kim     }
229ff879b07SJung-uk Kim 
230ff879b07SJung-uk Kim     Offset = Iort->NodeOffset;
231ff879b07SJung-uk Kim     while (Offset < Table->Length)
232ff879b07SJung-uk Kim     {
233ff879b07SJung-uk Kim         /* Common subtable header */
234ff879b07SJung-uk Kim 
235ff879b07SJung-uk Kim         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
236ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
237ff879b07SJung-uk Kim         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
238cfd1ed46SJung-uk Kim 
239cfd1ed46SJung-uk Kim         if (Revision == 0)
240cfd1ed46SJung-uk Kim         {
241ff879b07SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, Offset,
242ff879b07SJung-uk Kim                 IortNode, Length, AcpiDmTableInfoIortHdr);
243cfd1ed46SJung-uk Kim         }
244cfd1ed46SJung-uk Kim         else if (Revision >= 3)
245cfd1ed46SJung-uk Kim         {
246cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, Offset,
247cfd1ed46SJung-uk Kim                 IortNode, Length, AcpiDmTableInfoIortHdr3);
248cfd1ed46SJung-uk Kim         }
249cfd1ed46SJung-uk Kim 
250ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
251ff879b07SJung-uk Kim         {
252ff879b07SJung-uk Kim             return;
253ff879b07SJung-uk Kim         }
254ff879b07SJung-uk Kim 
255ff879b07SJung-uk Kim         NodeOffset = Length;
256ff879b07SJung-uk Kim 
257ff879b07SJung-uk Kim         switch (IortNode->Type)
258ff879b07SJung-uk Kim         {
259ff879b07SJung-uk Kim         case ACPI_IORT_NODE_ITS_GROUP:
260ff879b07SJung-uk Kim 
261ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoIort0;
262ff879b07SJung-uk Kim             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
263ff879b07SJung-uk Kim             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
264ff879b07SJung-uk Kim             break;
265ff879b07SJung-uk Kim 
266ff879b07SJung-uk Kim         case ACPI_IORT_NODE_NAMED_COMPONENT:
267ff879b07SJung-uk Kim 
268ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoIort1;
269ff879b07SJung-uk Kim             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
270ff879b07SJung-uk Kim             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
271ff879b07SJung-uk Kim             Length += strlen (String) + 1;
272ff879b07SJung-uk Kim             break;
273ff879b07SJung-uk Kim 
274ff879b07SJung-uk Kim         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
275ff879b07SJung-uk Kim 
276ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoIort2;
277ff879b07SJung-uk Kim             Length = IortNode->Length - NodeOffset;
278ff879b07SJung-uk Kim             break;
279ff879b07SJung-uk Kim 
280ff879b07SJung-uk Kim         case ACPI_IORT_NODE_SMMU:
281ff879b07SJung-uk Kim 
282ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoIort3;
283ff879b07SJung-uk Kim             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
284ff879b07SJung-uk Kim             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
285ff879b07SJung-uk Kim             break;
286ff879b07SJung-uk Kim 
287ff879b07SJung-uk Kim         case ACPI_IORT_NODE_SMMU_V3:
288ff879b07SJung-uk Kim 
289ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoIort4;
290ff879b07SJung-uk Kim             Length = IortNode->Length - NodeOffset;
291ff879b07SJung-uk Kim             break;
292ff879b07SJung-uk Kim 
2933d90091dSJung-uk Kim         case ACPI_IORT_NODE_PMCG:
2943d90091dSJung-uk Kim 
2953d90091dSJung-uk Kim             InfoTable = AcpiDmTableInfoIort5;
2963d90091dSJung-uk Kim             Length = IortNode->Length - NodeOffset;
2973d90091dSJung-uk Kim             break;
2983d90091dSJung-uk Kim 
299cfd1ed46SJung-uk Kim         case ACPI_IORT_NODE_RMR:
300cfd1ed46SJung-uk Kim 
301cfd1ed46SJung-uk Kim             InfoTable = AcpiDmTableInfoIort6;
302cfd1ed46SJung-uk Kim             Length = IortNode->Length - NodeOffset;
303cfd1ed46SJung-uk Kim             IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset);
304cfd1ed46SJung-uk Kim             break;
305cfd1ed46SJung-uk Kim 
306ff879b07SJung-uk Kim         default:
307ff879b07SJung-uk Kim 
308ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
309ff879b07SJung-uk Kim                 IortNode->Type);
310ff879b07SJung-uk Kim 
311ff879b07SJung-uk Kim             /* Attempt to continue */
312ff879b07SJung-uk Kim 
313ff879b07SJung-uk Kim             if (!IortNode->Length)
314ff879b07SJung-uk Kim             {
315ff879b07SJung-uk Kim                 AcpiOsPrintf ("Invalid zero length IORT node\n");
316ff879b07SJung-uk Kim                 return;
317ff879b07SJung-uk Kim             }
318ff879b07SJung-uk Kim             goto NextSubtable;
319ff879b07SJung-uk Kim         }
320ff879b07SJung-uk Kim 
321ff879b07SJung-uk Kim         /* Dump the node subtable header */
322ff879b07SJung-uk Kim 
323ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
324ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
325ff879b07SJung-uk Kim             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
326ff879b07SJung-uk Kim             Length, InfoTable);
327ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
328ff879b07SJung-uk Kim         {
329ff879b07SJung-uk Kim             return;
330ff879b07SJung-uk Kim         }
331ff879b07SJung-uk Kim 
332ff879b07SJung-uk Kim         NodeOffset += Length;
333ff879b07SJung-uk Kim 
334ff879b07SJung-uk Kim         /* Dump the node specific data */
335ff879b07SJung-uk Kim 
336ff879b07SJung-uk Kim         switch (IortNode->Type)
337ff879b07SJung-uk Kim         {
338ff879b07SJung-uk Kim         case ACPI_IORT_NODE_ITS_GROUP:
339ff879b07SJung-uk Kim 
340ff879b07SJung-uk Kim             /* Validate IortItsGroup to avoid compiler warnings */
341ff879b07SJung-uk Kim 
342ff879b07SJung-uk Kim             if (IortItsGroup)
343ff879b07SJung-uk Kim             {
344ff879b07SJung-uk Kim                 for (i = 0; i < IortItsGroup->ItsCount; i++)
345ff879b07SJung-uk Kim                 {
346ff879b07SJung-uk Kim                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
347ff879b07SJung-uk Kim                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
348ff879b07SJung-uk Kim                         4, AcpiDmTableInfoIort0a);
349a009b7dcSJung-uk Kim                     if (ACPI_FAILURE (Status))
350a009b7dcSJung-uk Kim                     {
351a009b7dcSJung-uk Kim                         return;
352a009b7dcSJung-uk Kim                     }
353a009b7dcSJung-uk Kim 
354ff879b07SJung-uk Kim                     NodeOffset += 4;
355ff879b07SJung-uk Kim                 }
356ff879b07SJung-uk Kim             }
357ff879b07SJung-uk Kim             break;
358ff879b07SJung-uk Kim 
359ff879b07SJung-uk Kim         case ACPI_IORT_NODE_NAMED_COMPONENT:
360ff879b07SJung-uk Kim 
361ff879b07SJung-uk Kim             /* Dump the Padding (optional) */
362ff879b07SJung-uk Kim 
363ff879b07SJung-uk Kim             if (IortNode->Length > NodeOffset)
364ff879b07SJung-uk Kim             {
365a009b7dcSJung-uk Kim                 MappingByteLength =
366a009b7dcSJung-uk Kim                     IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
367ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
368a009b7dcSJung-uk Kim                     Table, IortNode->Length - NodeOffset - MappingByteLength,
369ff879b07SJung-uk Kim                     AcpiDmTableInfoIort1a);
370ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
371ff879b07SJung-uk Kim                 {
372ff879b07SJung-uk Kim                     return;
373ff879b07SJung-uk Kim                 }
374ff879b07SJung-uk Kim             }
375ff879b07SJung-uk Kim             break;
376ff879b07SJung-uk Kim 
377ff879b07SJung-uk Kim         case ACPI_IORT_NODE_SMMU:
378ff879b07SJung-uk Kim 
379ff879b07SJung-uk Kim             AcpiOsPrintf ("\n");
380ff879b07SJung-uk Kim 
381ff879b07SJung-uk Kim             /* Validate IortSmmu to avoid compiler warnings */
382ff879b07SJung-uk Kim 
383ff879b07SJung-uk Kim             if (IortSmmu)
384ff879b07SJung-uk Kim             {
385ff879b07SJung-uk Kim                 Length = 2 * sizeof (UINT64);
386ff879b07SJung-uk Kim                 NodeOffset = IortSmmu->GlobalInterruptOffset;
387ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
388ff879b07SJung-uk Kim                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
389ff879b07SJung-uk Kim                     Length, AcpiDmTableInfoIort3a);
390ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
391ff879b07SJung-uk Kim                 {
392ff879b07SJung-uk Kim                     return;
393ff879b07SJung-uk Kim                 }
394ff879b07SJung-uk Kim 
395ff879b07SJung-uk Kim                 NodeOffset = IortSmmu->ContextInterruptOffset;
396ff879b07SJung-uk Kim                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
397ff879b07SJung-uk Kim                 {
398ff879b07SJung-uk Kim                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
399ff879b07SJung-uk Kim                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
400ff879b07SJung-uk Kim                         8, AcpiDmTableInfoIort3b);
401ff879b07SJung-uk Kim                     if (ACPI_FAILURE (Status))
402ff879b07SJung-uk Kim                     {
403ff879b07SJung-uk Kim                         return;
404ff879b07SJung-uk Kim                     }
405ff879b07SJung-uk Kim 
406ff879b07SJung-uk Kim                     NodeOffset += 8;
407ff879b07SJung-uk Kim                 }
408ff879b07SJung-uk Kim 
409ff879b07SJung-uk Kim                 NodeOffset = IortSmmu->PmuInterruptOffset;
410ff879b07SJung-uk Kim                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
411ff879b07SJung-uk Kim                 {
412ff879b07SJung-uk Kim                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
413ff879b07SJung-uk Kim                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
414ff879b07SJung-uk Kim                         8, AcpiDmTableInfoIort3c);
415ff879b07SJung-uk Kim                     if (ACPI_FAILURE (Status))
416ff879b07SJung-uk Kim                     {
417ff879b07SJung-uk Kim                         return;
418ff879b07SJung-uk Kim                     }
419ff879b07SJung-uk Kim 
420ff879b07SJung-uk Kim                     NodeOffset += 8;
421ff879b07SJung-uk Kim                 }
422ff879b07SJung-uk Kim             }
423ff879b07SJung-uk Kim             break;
424ff879b07SJung-uk Kim 
425cfd1ed46SJung-uk Kim         case ACPI_IORT_NODE_RMR:
426cfd1ed46SJung-uk Kim 
427cfd1ed46SJung-uk Kim             /* Validate IortRmr to avoid compiler warnings */
428cfd1ed46SJung-uk Kim             if (IortRmr)
429cfd1ed46SJung-uk Kim             {
430cfd1ed46SJung-uk Kim                 NodeOffset = IortRmr->RmrOffset;
431cfd1ed46SJung-uk Kim                 Length = sizeof (ACPI_IORT_RMR_DESC);
432cfd1ed46SJung-uk Kim                 for (i = 0; i < IortRmr->RmrCount; i++)
433cfd1ed46SJung-uk Kim                 {
434cfd1ed46SJung-uk Kim                     AcpiOsPrintf ("\n");
435cfd1ed46SJung-uk Kim                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
436cfd1ed46SJung-uk Kim                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
437cfd1ed46SJung-uk Kim                         Length, AcpiDmTableInfoIort6a);
438cfd1ed46SJung-uk Kim                     if (ACPI_FAILURE (Status))
439cfd1ed46SJung-uk Kim                     {
440cfd1ed46SJung-uk Kim                         return;
441cfd1ed46SJung-uk Kim                     }
442cfd1ed46SJung-uk Kim 
443cfd1ed46SJung-uk Kim                     NodeOffset += Length;
444cfd1ed46SJung-uk Kim                 }
445cfd1ed46SJung-uk Kim             }
446cfd1ed46SJung-uk Kim             break;
447cfd1ed46SJung-uk Kim 
448ff879b07SJung-uk Kim 	default:
449ff879b07SJung-uk Kim 
450ff879b07SJung-uk Kim             break;
451ff879b07SJung-uk Kim         }
452ff879b07SJung-uk Kim 
453ff879b07SJung-uk Kim         /* Dump the ID mappings */
454ff879b07SJung-uk Kim 
455ff879b07SJung-uk Kim         NodeOffset = IortNode->MappingOffset;
456ff879b07SJung-uk Kim         for (i = 0; i < IortNode->MappingCount; i++)
457ff879b07SJung-uk Kim         {
458ff879b07SJung-uk Kim             AcpiOsPrintf ("\n");
459ff879b07SJung-uk Kim             Length = sizeof (ACPI_IORT_ID_MAPPING);
460ff879b07SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
461ff879b07SJung-uk Kim                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
462ff879b07SJung-uk Kim                 Length, AcpiDmTableInfoIortMap);
463ff879b07SJung-uk Kim             if (ACPI_FAILURE (Status))
464ff879b07SJung-uk Kim             {
465ff879b07SJung-uk Kim                 return;
466ff879b07SJung-uk Kim             }
467ff879b07SJung-uk Kim 
468ff879b07SJung-uk Kim             NodeOffset += Length;
469ff879b07SJung-uk Kim         }
470ff879b07SJung-uk Kim 
471ff879b07SJung-uk Kim NextSubtable:
472ff879b07SJung-uk Kim         /* Point to next node subtable */
473ff879b07SJung-uk Kim 
474ff879b07SJung-uk Kim         Offset += IortNode->Length;
475ff879b07SJung-uk Kim     }
476ff879b07SJung-uk Kim }
477ff879b07SJung-uk Kim 
478ff879b07SJung-uk Kim 
479ff879b07SJung-uk Kim /*******************************************************************************
480ff879b07SJung-uk Kim  *
481ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpIvrs
482ff879b07SJung-uk Kim  *
483ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A IVRS table
484ff879b07SJung-uk Kim  *
485ff879b07SJung-uk Kim  * RETURN:      None
486ff879b07SJung-uk Kim  *
4871970d693SJung-uk Kim  * DESCRIPTION: Format the contents of a IVRS. Notes:
4881970d693SJung-uk Kim  *              The IVRS is essentially a flat table, with the following
4891970d693SJung-uk Kim  *              structure:
4901970d693SJung-uk Kim  *              <Main ACPI Table Header>
4911970d693SJung-uk Kim  *              <Main subtable - virtualization info>
4921970d693SJung-uk Kim  *              <IVHD>
4931970d693SJung-uk Kim  *                  <Device Entries>
4941970d693SJung-uk Kim  *              ...
4951970d693SJung-uk Kim  *              <IVHD>
4961970d693SJung-uk Kim  *                  <Device Entries>
4971970d693SJung-uk Kim  *              <IVMD>
4981970d693SJung-uk Kim  *              ...
499ff879b07SJung-uk Kim  *
500ff879b07SJung-uk Kim  ******************************************************************************/
501ff879b07SJung-uk Kim 
502ff879b07SJung-uk Kim void
503ff879b07SJung-uk Kim AcpiDmDumpIvrs (
504ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
505ff879b07SJung-uk Kim {
506ff879b07SJung-uk Kim     ACPI_STATUS             Status;
507ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
508ff879b07SJung-uk Kim     UINT32                  EntryOffset;
509ff879b07SJung-uk Kim     UINT32                  EntryLength;
510ff879b07SJung-uk Kim     UINT32                  EntryType;
511cfd1ed46SJung-uk Kim     ACPI_IVRS_DEVICE_HID    *HidSubtable;
512ff879b07SJung-uk Kim     ACPI_IVRS_DE_HEADER     *DeviceEntry;
513ff879b07SJung-uk Kim     ACPI_IVRS_HEADER        *Subtable;
514ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
515ff879b07SJung-uk Kim 
516ff879b07SJung-uk Kim 
517ff879b07SJung-uk Kim     /* Main table */
518ff879b07SJung-uk Kim 
519ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
520ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
521ff879b07SJung-uk Kim     {
522ff879b07SJung-uk Kim         return;
523ff879b07SJung-uk Kim     }
524ff879b07SJung-uk Kim 
525ff879b07SJung-uk Kim     /* Subtables */
526ff879b07SJung-uk Kim 
527ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
5281970d693SJung-uk Kim 
529ff879b07SJung-uk Kim     while (Offset < Table->Length)
530ff879b07SJung-uk Kim     {
531ff879b07SJung-uk Kim         switch (Subtable->Type)
532ff879b07SJung-uk Kim         {
5331970d693SJung-uk Kim         /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */
5341970d693SJung-uk Kim 
5353ee58df5SJung-uk Kim         case ACPI_IVRS_TYPE_HARDWARE1:
536ff879b07SJung-uk Kim 
5371970d693SJung-uk Kim             AcpiOsPrintf ("\n");
5381970d693SJung-uk Kim             InfoTable = AcpiDmTableInfoIvrsHware1;
539ff879b07SJung-uk Kim             break;
540ff879b07SJung-uk Kim 
5411970d693SJung-uk Kim         /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */
5421970d693SJung-uk Kim 
5433ee58df5SJung-uk Kim         case ACPI_IVRS_TYPE_HARDWARE2:
544cfd1ed46SJung-uk Kim         case ACPI_IVRS_TYPE_HARDWARE3:
5453ee58df5SJung-uk Kim 
5461970d693SJung-uk Kim             AcpiOsPrintf ("\n");
5471970d693SJung-uk Kim             InfoTable = AcpiDmTableInfoIvrsHware23;
5483ee58df5SJung-uk Kim             break;
5493ee58df5SJung-uk Kim 
5501970d693SJung-uk Kim         /* Types 20h-22h, IVMD (I/O Virtualization Memory Definition Block) */
5511970d693SJung-uk Kim 
552ff879b07SJung-uk Kim         case ACPI_IVRS_TYPE_MEMORY1:
553ff879b07SJung-uk Kim         case ACPI_IVRS_TYPE_MEMORY2:
554ff879b07SJung-uk Kim         case ACPI_IVRS_TYPE_MEMORY3:
555ff879b07SJung-uk Kim 
5561970d693SJung-uk Kim             AcpiOsPrintf ("\n");
5571970d693SJung-uk Kim             InfoTable = AcpiDmTableInfoIvrsMemory;
558ff879b07SJung-uk Kim             break;
559ff879b07SJung-uk Kim 
560ff879b07SJung-uk Kim         default:
561ff879b07SJung-uk Kim 
562ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
563ff879b07SJung-uk Kim                 Subtable->Type);
564ff879b07SJung-uk Kim 
565ff879b07SJung-uk Kim             /* Attempt to continue */
566ff879b07SJung-uk Kim 
567ff879b07SJung-uk Kim             if (!Subtable->Length)
568ff879b07SJung-uk Kim             {
569ff879b07SJung-uk Kim                 AcpiOsPrintf ("Invalid zero length subtable\n");
570ff879b07SJung-uk Kim                 return;
571ff879b07SJung-uk Kim             }
572ff879b07SJung-uk Kim             goto NextSubtable;
573ff879b07SJung-uk Kim         }
574ff879b07SJung-uk Kim 
575ff879b07SJung-uk Kim         /* Dump the subtable */
576ff879b07SJung-uk Kim 
577ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
578ff879b07SJung-uk Kim             Subtable->Length, InfoTable);
579ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
580ff879b07SJung-uk Kim         {
581ff879b07SJung-uk Kim             return;
582ff879b07SJung-uk Kim         }
583ff879b07SJung-uk Kim 
5841970d693SJung-uk Kim         /* The hardware subtables (IVHD) can contain multiple device entries */
585ff879b07SJung-uk Kim 
5863ee58df5SJung-uk Kim         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
587cfd1ed46SJung-uk Kim             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 ||
588cfd1ed46SJung-uk Kim             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3)
589ff879b07SJung-uk Kim         {
5903ee58df5SJung-uk Kim             if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
5913ee58df5SJung-uk Kim             {
5923ee58df5SJung-uk Kim                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
593ff879b07SJung-uk Kim                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
5943ee58df5SJung-uk Kim                     sizeof (ACPI_IVRS_HARDWARE1));
5953ee58df5SJung-uk Kim             }
59608ddfe86SJung-uk Kim             else
5973ee58df5SJung-uk Kim             {
5981970d693SJung-uk Kim                 /* ACPI_IVRS_TYPE_HARDWARE2, HARDWARE3 subtable types */
59908ddfe86SJung-uk Kim 
6003ee58df5SJung-uk Kim                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
6013ee58df5SJung-uk Kim                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
6023ee58df5SJung-uk Kim                     sizeof (ACPI_IVRS_HARDWARE2));
6033ee58df5SJung-uk Kim             }
604ff879b07SJung-uk Kim 
6051970d693SJung-uk Kim             /* Process all of the Device Entries */
6061970d693SJung-uk Kim 
607ff879b07SJung-uk Kim             while (EntryOffset < (Offset + Subtable->Length))
608ff879b07SJung-uk Kim             {
609ff879b07SJung-uk Kim                 AcpiOsPrintf ("\n");
6101970d693SJung-uk Kim 
611ff879b07SJung-uk Kim                 /*
612ff879b07SJung-uk Kim                  * Upper 2 bits of Type encode the length of the device entry
613ff879b07SJung-uk Kim                  *
614ff879b07SJung-uk Kim                  * 00 = 4 byte
615ff879b07SJung-uk Kim                  * 01 = 8 byte
616cfd1ed46SJung-uk Kim                  * 1x = variable length
617ff879b07SJung-uk Kim                  */
618ff879b07SJung-uk Kim                 EntryType = DeviceEntry->Type;
619cfd1ed46SJung-uk Kim                 EntryLength = EntryType >> 6 == 1 ? 8 : 4;
620ff879b07SJung-uk Kim 
621ff879b07SJung-uk Kim                 switch (EntryType)
622ff879b07SJung-uk Kim                 {
623ff879b07SJung-uk Kim                 /* 4-byte device entries */
624ff879b07SJung-uk Kim 
625ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_PAD4:
626ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_ALL:
627ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_SELECT:
628ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_START:
629ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_END:
630ff879b07SJung-uk Kim 
631ff879b07SJung-uk Kim                     InfoTable = AcpiDmTableInfoIvrs4;
632ff879b07SJung-uk Kim                     break;
633ff879b07SJung-uk Kim 
634ff879b07SJung-uk Kim                 /* 8-byte entries, type A */
635ff879b07SJung-uk Kim 
636ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
637ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_ALIAS_START:
638ff879b07SJung-uk Kim 
639ff879b07SJung-uk Kim                     InfoTable = AcpiDmTableInfoIvrs8a;
640ff879b07SJung-uk Kim                     break;
641ff879b07SJung-uk Kim 
642ff879b07SJung-uk Kim                 /* 8-byte entries, type B */
643ff879b07SJung-uk Kim 
644ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_PAD8:
645ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_EXT_SELECT:
646ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_EXT_START:
647ff879b07SJung-uk Kim 
648ff879b07SJung-uk Kim                     InfoTable = AcpiDmTableInfoIvrs8b;
649ff879b07SJung-uk Kim                     break;
650ff879b07SJung-uk Kim 
651ff879b07SJung-uk Kim                 /* 8-byte entries, type C */
652ff879b07SJung-uk Kim 
653ff879b07SJung-uk Kim                 case ACPI_IVRS_TYPE_SPECIAL:
654ff879b07SJung-uk Kim 
655ff879b07SJung-uk Kim                     InfoTable = AcpiDmTableInfoIvrs8c;
656ff879b07SJung-uk Kim                     break;
657ff879b07SJung-uk Kim 
658cfd1ed46SJung-uk Kim                 /* Variable-length entries */
659cfd1ed46SJung-uk Kim 
660cfd1ed46SJung-uk Kim                 case ACPI_IVRS_TYPE_HID:
661cfd1ed46SJung-uk Kim 
6621970d693SJung-uk Kim                     EntryLength = 4;
663cfd1ed46SJung-uk Kim                     InfoTable = AcpiDmTableInfoIvrsHid;
664cfd1ed46SJung-uk Kim                     break;
665cfd1ed46SJung-uk Kim 
666ff879b07SJung-uk Kim                 default:
667ff879b07SJung-uk Kim                     InfoTable = AcpiDmTableInfoIvrs4;
668ff879b07SJung-uk Kim                     AcpiOsPrintf (
669ff879b07SJung-uk Kim                         "\n**** Unknown IVRS device entry type/length: "
670ff879b07SJung-uk Kim                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
671ff879b07SJung-uk Kim                         EntryType, EntryLength, EntryOffset);
672ff879b07SJung-uk Kim                     break;
673ff879b07SJung-uk Kim                 }
674ff879b07SJung-uk Kim 
675ff879b07SJung-uk Kim                 /* Dump the Device Entry */
676ff879b07SJung-uk Kim 
677ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
678ff879b07SJung-uk Kim                     DeviceEntry, EntryLength, InfoTable);
679ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
680ff879b07SJung-uk Kim                 {
681ff879b07SJung-uk Kim                     return;
682ff879b07SJung-uk Kim                 }
683ff879b07SJung-uk Kim 
684cfd1ed46SJung-uk Kim                 HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry);
685ff879b07SJung-uk Kim                 EntryOffset += EntryLength;
6861970d693SJung-uk Kim                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, HidSubtable,
687ff879b07SJung-uk Kim                     EntryLength);
688cfd1ed46SJung-uk Kim 
689cfd1ed46SJung-uk Kim                 if (EntryType == ACPI_IVRS_TYPE_HID)
690cfd1ed46SJung-uk Kim                 {
6911970d693SJung-uk Kim                     /*
6921970d693SJung-uk Kim                      * Determine if the HID is an integer or a string.
6931970d693SJung-uk Kim                      * An integer is defined to be 32 bits, with the upper 32 bits
6941970d693SJung-uk Kim                      * set to zero. (from the ACPI Spec): "The HID can be a 32-bit
6951970d693SJung-uk Kim                      * integer or a character string. If an integer, the lower
6961970d693SJung-uk Kim                      * 4 bytes of the field contain the integer and the upper
6971970d693SJung-uk Kim                      * 4 bytes are padded with 0".
6981970d693SJung-uk Kim                      */
6991970d693SJung-uk Kim                     if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid))
7001970d693SJung-uk Kim                     {
701cfd1ed46SJung-uk Kim                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7021970d693SJung-uk Kim                             &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger);
7031970d693SJung-uk Kim                     }
7041970d693SJung-uk Kim                     else
7051970d693SJung-uk Kim                     {
7061970d693SJung-uk Kim                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7071970d693SJung-uk Kim                             &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString);
7081970d693SJung-uk Kim                     }
709cfd1ed46SJung-uk Kim                     if (ACPI_FAILURE (Status))
710cfd1ed46SJung-uk Kim                     {
711cfd1ed46SJung-uk Kim                         return;
712cfd1ed46SJung-uk Kim                     }
7131970d693SJung-uk Kim 
7141970d693SJung-uk Kim                     EntryOffset += 8;
7151970d693SJung-uk Kim 
7161970d693SJung-uk Kim                     /*
7171970d693SJung-uk Kim                      * Determine if the CID is an integer or a string. The format
7181970d693SJung-uk Kim                      * of the CID is the same as the HID above. From ACPI Spec:
7191970d693SJung-uk Kim                      * "If present, CID must be a single Compatible Device ID
7201970d693SJung-uk Kim                      * following the same format as the HID field."
7211970d693SJung-uk Kim                      */
7221970d693SJung-uk Kim                     if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid))
7231970d693SJung-uk Kim                     {
7241970d693SJung-uk Kim                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7251970d693SJung-uk Kim                             &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger);
7261970d693SJung-uk Kim                     }
7271970d693SJung-uk Kim                     else
7281970d693SJung-uk Kim                     {
7291970d693SJung-uk Kim                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7301970d693SJung-uk Kim                             &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString);
7311970d693SJung-uk Kim                     }
7321970d693SJung-uk Kim                     if (ACPI_FAILURE (Status))
7331970d693SJung-uk Kim                     {
7341970d693SJung-uk Kim                         return;
7351970d693SJung-uk Kim                     }
7361970d693SJung-uk Kim 
7371970d693SJung-uk Kim                     EntryOffset += 8;
7381970d693SJung-uk Kim                     EntryLength = HidSubtable->UidLength;
7391970d693SJung-uk Kim 
7401970d693SJung-uk Kim                     if (EntryLength > ACPI_IVRS_UID_NOT_PRESENT)
7411970d693SJung-uk Kim                     {
7421970d693SJung-uk Kim                         /* Dump the UID based upon the UidType field (String or Integer) */
7431970d693SJung-uk Kim 
7441970d693SJung-uk Kim                         if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING)
7451970d693SJung-uk Kim                         {
7461970d693SJung-uk Kim                             Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7471970d693SJung-uk Kim                                 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString);
7481970d693SJung-uk Kim                             if (ACPI_FAILURE (Status))
7491970d693SJung-uk Kim                             {
7501970d693SJung-uk Kim                                 return;
7511970d693SJung-uk Kim                             }
7521970d693SJung-uk Kim                         }
7531970d693SJung-uk Kim                         else /* ACPI_IVRS_UID_IS_INTEGER */
7541970d693SJung-uk Kim                         {
7551970d693SJung-uk Kim                             Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7561970d693SJung-uk Kim                                 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger);
7571970d693SJung-uk Kim                             if (ACPI_FAILURE (Status))
7581970d693SJung-uk Kim                             {
7591970d693SJung-uk Kim                                 return;
7601970d693SJung-uk Kim                             }
7611970d693SJung-uk Kim                         }
7621970d693SJung-uk Kim                     }
7631970d693SJung-uk Kim 
7641970d693SJung-uk Kim                     EntryOffset += EntryLength+2;
765cfd1ed46SJung-uk Kim                     DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER,
7661970d693SJung-uk Kim                         Table, EntryOffset);
767cfd1ed46SJung-uk Kim                 }
768ff879b07SJung-uk Kim             }
769ff879b07SJung-uk Kim         }
770ff879b07SJung-uk Kim 
771ff879b07SJung-uk Kim NextSubtable:
772ff879b07SJung-uk Kim         /* Point to next subtable */
773ff879b07SJung-uk Kim 
774ff879b07SJung-uk Kim         Offset += Subtable->Length;
775ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
776ff879b07SJung-uk Kim     }
777ff879b07SJung-uk Kim }
778ff879b07SJung-uk Kim 
779ff879b07SJung-uk Kim 
780ff879b07SJung-uk Kim /*******************************************************************************
781ff879b07SJung-uk Kim  *
782ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpLpit
783ff879b07SJung-uk Kim  *
784ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A LPIT table
785ff879b07SJung-uk Kim  *
786ff879b07SJung-uk Kim  * RETURN:      None
787ff879b07SJung-uk Kim  *
788ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a LPIT. This table type consists
789ff879b07SJung-uk Kim  *              of an open-ended number of subtables. Note: There are no
790ff879b07SJung-uk Kim  *              entries in the main table. An LPIT consists of the table
791ff879b07SJung-uk Kim  *              header and then subtables only.
792ff879b07SJung-uk Kim  *
793ff879b07SJung-uk Kim  ******************************************************************************/
794ff879b07SJung-uk Kim 
795ff879b07SJung-uk Kim void
796ff879b07SJung-uk Kim AcpiDmDumpLpit (
797ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
798ff879b07SJung-uk Kim {
799ff879b07SJung-uk Kim     ACPI_STATUS             Status;
800ff879b07SJung-uk Kim     ACPI_LPIT_HEADER        *Subtable;
801ff879b07SJung-uk Kim     UINT32                  Length = Table->Length;
802ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
803ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
804ff879b07SJung-uk Kim     UINT32                  SubtableLength;
805ff879b07SJung-uk Kim 
806ff879b07SJung-uk Kim 
807ff879b07SJung-uk Kim     /* Subtables */
808ff879b07SJung-uk Kim 
809ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
810ff879b07SJung-uk Kim     while (Offset < Table->Length)
811ff879b07SJung-uk Kim     {
812ff879b07SJung-uk Kim         /* Common subtable header */
813ff879b07SJung-uk Kim 
814ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
815ff879b07SJung-uk Kim             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
816ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
817ff879b07SJung-uk Kim         {
818ff879b07SJung-uk Kim             return;
819ff879b07SJung-uk Kim         }
820ff879b07SJung-uk Kim 
821ff879b07SJung-uk Kim         switch (Subtable->Type)
822ff879b07SJung-uk Kim         {
823ff879b07SJung-uk Kim         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
824ff879b07SJung-uk Kim 
825ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoLpit0;
826ff879b07SJung-uk Kim             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
827ff879b07SJung-uk Kim             break;
828ff879b07SJung-uk Kim 
829ff879b07SJung-uk Kim         default:
830ff879b07SJung-uk Kim 
831ff879b07SJung-uk Kim             /* Cannot continue on unknown type - no length */
832ff879b07SJung-uk Kim 
833ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
834ff879b07SJung-uk Kim                 Subtable->Type);
835ff879b07SJung-uk Kim             return;
836ff879b07SJung-uk Kim         }
837ff879b07SJung-uk Kim 
838ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
839ff879b07SJung-uk Kim             SubtableLength, InfoTable);
840ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
841ff879b07SJung-uk Kim         {
842ff879b07SJung-uk Kim             return;
843ff879b07SJung-uk Kim         }
844ff879b07SJung-uk Kim 
845ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
846ff879b07SJung-uk Kim 
847ff879b07SJung-uk Kim         /* Point to next subtable */
848ff879b07SJung-uk Kim 
849ff879b07SJung-uk Kim         Offset += SubtableLength;
850ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
851ff879b07SJung-uk Kim     }
852ff879b07SJung-uk Kim }
853ff879b07SJung-uk Kim 
854ff879b07SJung-uk Kim 
855ff879b07SJung-uk Kim /*******************************************************************************
856ff879b07SJung-uk Kim  *
857ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpMadt
858ff879b07SJung-uk Kim  *
859ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A MADT table
860ff879b07SJung-uk Kim  *
861ff879b07SJung-uk Kim  * RETURN:      None
862ff879b07SJung-uk Kim  *
863ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a MADT. This table type consists
864ff879b07SJung-uk Kim  *              of an open-ended number of subtables.
865ff879b07SJung-uk Kim  *
866ff879b07SJung-uk Kim  ******************************************************************************/
867ff879b07SJung-uk Kim 
868ff879b07SJung-uk Kim void
869ff879b07SJung-uk Kim AcpiDmDumpMadt (
870ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
871ff879b07SJung-uk Kim {
872ff879b07SJung-uk Kim     ACPI_STATUS             Status;
873ff879b07SJung-uk Kim     ACPI_SUBTABLE_HEADER    *Subtable;
874ff879b07SJung-uk Kim     UINT32                  Length = Table->Length;
875ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
876ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
877ff879b07SJung-uk Kim 
878ff879b07SJung-uk Kim 
879ff879b07SJung-uk Kim     /* Main table */
880ff879b07SJung-uk Kim 
881ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
882ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
883ff879b07SJung-uk Kim     {
884ff879b07SJung-uk Kim         return;
885ff879b07SJung-uk Kim     }
886ff879b07SJung-uk Kim 
887ff879b07SJung-uk Kim     /* Subtables */
888ff879b07SJung-uk Kim 
889ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
890ff879b07SJung-uk Kim     while (Offset < Table->Length)
891ff879b07SJung-uk Kim     {
892ff879b07SJung-uk Kim         /* Common subtable header */
893ff879b07SJung-uk Kim 
894ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
895ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
896ff879b07SJung-uk Kim             Subtable->Length, AcpiDmTableInfoMadtHdr);
897ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
898ff879b07SJung-uk Kim         {
899ff879b07SJung-uk Kim             return;
900ff879b07SJung-uk Kim         }
901ff879b07SJung-uk Kim 
902ff879b07SJung-uk Kim         switch (Subtable->Type)
903ff879b07SJung-uk Kim         {
904ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_LOCAL_APIC:
905ff879b07SJung-uk Kim 
906ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt0;
907ff879b07SJung-uk Kim             break;
908ff879b07SJung-uk Kim 
909ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_IO_APIC:
910ff879b07SJung-uk Kim 
911ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt1;
912ff879b07SJung-uk Kim             break;
913ff879b07SJung-uk Kim 
914ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
915ff879b07SJung-uk Kim 
916ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt2;
917ff879b07SJung-uk Kim             break;
918ff879b07SJung-uk Kim 
919ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_NMI_SOURCE:
920ff879b07SJung-uk Kim 
921ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt3;
922ff879b07SJung-uk Kim             break;
923ff879b07SJung-uk Kim 
924ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
925ff879b07SJung-uk Kim 
926ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt4;
927ff879b07SJung-uk Kim             break;
928ff879b07SJung-uk Kim 
929ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
930ff879b07SJung-uk Kim 
931ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt5;
932ff879b07SJung-uk Kim             break;
933ff879b07SJung-uk Kim 
934ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_IO_SAPIC:
935ff879b07SJung-uk Kim 
936ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt6;
937ff879b07SJung-uk Kim             break;
938ff879b07SJung-uk Kim 
939ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_LOCAL_SAPIC:
940ff879b07SJung-uk Kim 
941ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt7;
942ff879b07SJung-uk Kim             break;
943ff879b07SJung-uk Kim 
944ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
945ff879b07SJung-uk Kim 
946ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt8;
947ff879b07SJung-uk Kim             break;
948ff879b07SJung-uk Kim 
949ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_LOCAL_X2APIC:
950ff879b07SJung-uk Kim 
951ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt9;
952ff879b07SJung-uk Kim             break;
953ff879b07SJung-uk Kim 
954ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
955ff879b07SJung-uk Kim 
956ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt10;
957ff879b07SJung-uk Kim             break;
958ff879b07SJung-uk Kim 
959ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
960ff879b07SJung-uk Kim 
961ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt11;
962ff879b07SJung-uk Kim             break;
963ff879b07SJung-uk Kim 
964ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
965ff879b07SJung-uk Kim 
966ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt12;
967ff879b07SJung-uk Kim             break;
968ff879b07SJung-uk Kim 
969ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
970ff879b07SJung-uk Kim 
971ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt13;
972ff879b07SJung-uk Kim             break;
973ff879b07SJung-uk Kim 
974ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
975ff879b07SJung-uk Kim 
976ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt14;
977ff879b07SJung-uk Kim             break;
978ff879b07SJung-uk Kim 
979ff879b07SJung-uk Kim         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
980ff879b07SJung-uk Kim 
981ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt15;
982ff879b07SJung-uk Kim             break;
983ff879b07SJung-uk Kim 
984cfd1ed46SJung-uk Kim         case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
985cfd1ed46SJung-uk Kim 
986cfd1ed46SJung-uk Kim             InfoTable = AcpiDmTableInfoMadt16;
987cfd1ed46SJung-uk Kim             break;
988cfd1ed46SJung-uk Kim 
989ff879b07SJung-uk Kim         default:
990ff879b07SJung-uk Kim 
991ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
992ff879b07SJung-uk Kim                 Subtable->Type);
993ff879b07SJung-uk Kim 
994ff879b07SJung-uk Kim             /* Attempt to continue */
995ff879b07SJung-uk Kim 
996ff879b07SJung-uk Kim             if (!Subtable->Length)
997ff879b07SJung-uk Kim             {
998ff879b07SJung-uk Kim                 AcpiOsPrintf ("Invalid zero length subtable\n");
999ff879b07SJung-uk Kim                 return;
1000ff879b07SJung-uk Kim             }
1001ff879b07SJung-uk Kim 
1002ff879b07SJung-uk Kim             goto NextSubtable;
1003ff879b07SJung-uk Kim         }
1004ff879b07SJung-uk Kim 
1005ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1006ff879b07SJung-uk Kim             Subtable->Length, InfoTable);
1007ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1008ff879b07SJung-uk Kim         {
1009ff879b07SJung-uk Kim             return;
1010ff879b07SJung-uk Kim         }
1011ff879b07SJung-uk Kim 
1012ff879b07SJung-uk Kim NextSubtable:
1013ff879b07SJung-uk Kim         /* Point to next subtable */
1014ff879b07SJung-uk Kim 
1015ff879b07SJung-uk Kim         Offset += Subtable->Length;
1016ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
1017ff879b07SJung-uk Kim             Subtable->Length);
1018ff879b07SJung-uk Kim     }
1019ff879b07SJung-uk Kim }
1020ff879b07SJung-uk Kim 
1021ff879b07SJung-uk Kim 
1022ff879b07SJung-uk Kim /*******************************************************************************
1023ff879b07SJung-uk Kim  *
1024ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpMcfg
1025ff879b07SJung-uk Kim  *
1026ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A MCFG Table
1027ff879b07SJung-uk Kim  *
1028ff879b07SJung-uk Kim  * RETURN:      None
1029ff879b07SJung-uk Kim  *
1030ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a MCFG table
1031ff879b07SJung-uk Kim  *
1032ff879b07SJung-uk Kim  ******************************************************************************/
1033ff879b07SJung-uk Kim 
1034ff879b07SJung-uk Kim void
1035ff879b07SJung-uk Kim AcpiDmDumpMcfg (
1036ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1037ff879b07SJung-uk Kim {
1038ff879b07SJung-uk Kim     ACPI_STATUS             Status;
1039ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
1040ff879b07SJung-uk Kim     ACPI_MCFG_ALLOCATION    *Subtable;
1041ff879b07SJung-uk Kim 
1042ff879b07SJung-uk Kim 
1043ff879b07SJung-uk Kim     /* Main table */
1044ff879b07SJung-uk Kim 
1045ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1046ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1047ff879b07SJung-uk Kim     {
1048ff879b07SJung-uk Kim         return;
1049ff879b07SJung-uk Kim     }
1050ff879b07SJung-uk Kim 
1051ff879b07SJung-uk Kim     /* Subtables */
1052ff879b07SJung-uk Kim 
1053ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1054ff879b07SJung-uk Kim     while (Offset < Table->Length)
1055ff879b07SJung-uk Kim     {
1056ff879b07SJung-uk Kim         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1057ff879b07SJung-uk Kim         {
1058ff879b07SJung-uk Kim             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1059a009b7dcSJung-uk Kim                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1060ff879b07SJung-uk Kim             return;
1061ff879b07SJung-uk Kim         }
1062ff879b07SJung-uk Kim 
1063ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1064ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1065ff879b07SJung-uk Kim             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1066ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1067ff879b07SJung-uk Kim         {
1068ff879b07SJung-uk Kim             return;
1069ff879b07SJung-uk Kim         }
1070ff879b07SJung-uk Kim 
1071ff879b07SJung-uk Kim         /* Point to next subtable (each subtable is of fixed length) */
1072ff879b07SJung-uk Kim 
1073ff879b07SJung-uk Kim         Offset += sizeof (ACPI_MCFG_ALLOCATION);
1074ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
1075ff879b07SJung-uk Kim             sizeof (ACPI_MCFG_ALLOCATION));
1076ff879b07SJung-uk Kim     }
1077ff879b07SJung-uk Kim }
1078ff879b07SJung-uk Kim 
1079ff879b07SJung-uk Kim 
1080ff879b07SJung-uk Kim /*******************************************************************************
1081ff879b07SJung-uk Kim  *
1082ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpMpst
1083ff879b07SJung-uk Kim  *
1084ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A MPST Table
1085ff879b07SJung-uk Kim  *
1086ff879b07SJung-uk Kim  * RETURN:      None
1087ff879b07SJung-uk Kim  *
1088ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a MPST table
1089ff879b07SJung-uk Kim  *
1090ff879b07SJung-uk Kim  ******************************************************************************/
1091ff879b07SJung-uk Kim 
1092ff879b07SJung-uk Kim void
1093ff879b07SJung-uk Kim AcpiDmDumpMpst (
1094ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1095ff879b07SJung-uk Kim {
1096ff879b07SJung-uk Kim     ACPI_STATUS             Status;
1097ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
1098ff879b07SJung-uk Kim     ACPI_MPST_POWER_NODE    *Subtable0;
1099ff879b07SJung-uk Kim     ACPI_MPST_POWER_STATE   *Subtable0A;
1100ff879b07SJung-uk Kim     ACPI_MPST_COMPONENT     *Subtable0B;
1101ff879b07SJung-uk Kim     ACPI_MPST_DATA_HDR      *Subtable1;
1102ff879b07SJung-uk Kim     ACPI_MPST_POWER_DATA    *Subtable2;
1103ff879b07SJung-uk Kim     UINT16                  SubtableCount;
1104ff879b07SJung-uk Kim     UINT32                  PowerStateCount;
1105ff879b07SJung-uk Kim     UINT32                  ComponentCount;
1106ff879b07SJung-uk Kim 
1107ff879b07SJung-uk Kim 
1108ff879b07SJung-uk Kim     /* Main table */
1109ff879b07SJung-uk Kim 
1110ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1111ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1112ff879b07SJung-uk Kim     {
1113ff879b07SJung-uk Kim         return;
1114ff879b07SJung-uk Kim     }
1115ff879b07SJung-uk Kim 
1116ff879b07SJung-uk Kim     /* Subtable: Memory Power Node(s) */
1117ff879b07SJung-uk Kim 
1118ff879b07SJung-uk Kim     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1119ff879b07SJung-uk Kim     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1120ff879b07SJung-uk Kim 
1121ff879b07SJung-uk Kim     while ((Offset < Table->Length) && SubtableCount)
1122ff879b07SJung-uk Kim     {
1123ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1124ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
1125ff879b07SJung-uk Kim             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1126ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1127ff879b07SJung-uk Kim         {
1128ff879b07SJung-uk Kim             return;
1129ff879b07SJung-uk Kim         }
1130ff879b07SJung-uk Kim 
1131ff879b07SJung-uk Kim         /* Extract the sub-subtable counts */
1132ff879b07SJung-uk Kim 
1133ff879b07SJung-uk Kim         PowerStateCount = Subtable0->NumPowerStates;
1134ff879b07SJung-uk Kim         ComponentCount = Subtable0->NumPhysicalComponents;
1135ff879b07SJung-uk Kim         Offset += sizeof (ACPI_MPST_POWER_NODE);
1136ff879b07SJung-uk Kim 
1137ff879b07SJung-uk Kim         /* Sub-subtables - Memory Power State Structure(s) */
1138ff879b07SJung-uk Kim 
1139ff879b07SJung-uk Kim         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
1140ff879b07SJung-uk Kim             sizeof (ACPI_MPST_POWER_NODE));
1141ff879b07SJung-uk Kim 
1142ff879b07SJung-uk Kim         while (PowerStateCount)
1143ff879b07SJung-uk Kim         {
1144ff879b07SJung-uk Kim             AcpiOsPrintf ("\n");
1145ff879b07SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
1146ff879b07SJung-uk Kim                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1147ff879b07SJung-uk Kim             if (ACPI_FAILURE (Status))
1148ff879b07SJung-uk Kim             {
1149ff879b07SJung-uk Kim                 return;
1150ff879b07SJung-uk Kim             }
1151ff879b07SJung-uk Kim 
1152ff879b07SJung-uk Kim             Subtable0A++;
1153ff879b07SJung-uk Kim             PowerStateCount--;
1154ff879b07SJung-uk Kim             Offset += sizeof (ACPI_MPST_POWER_STATE);
1155ff879b07SJung-uk Kim        }
1156ff879b07SJung-uk Kim 
1157ff879b07SJung-uk Kim         /* Sub-subtables - Physical Component ID Structure(s) */
1158ff879b07SJung-uk Kim 
1159ff879b07SJung-uk Kim         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
1160ff879b07SJung-uk Kim 
1161ff879b07SJung-uk Kim         if (ComponentCount)
1162ff879b07SJung-uk Kim         {
1163ff879b07SJung-uk Kim             AcpiOsPrintf ("\n");
1164ff879b07SJung-uk Kim         }
1165ff879b07SJung-uk Kim 
1166ff879b07SJung-uk Kim         while (ComponentCount)
1167ff879b07SJung-uk Kim         {
1168ff879b07SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
1169ff879b07SJung-uk Kim                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1170ff879b07SJung-uk Kim             if (ACPI_FAILURE (Status))
1171ff879b07SJung-uk Kim             {
1172ff879b07SJung-uk Kim                 return;
1173ff879b07SJung-uk Kim             }
1174ff879b07SJung-uk Kim 
1175ff879b07SJung-uk Kim             Subtable0B++;
1176ff879b07SJung-uk Kim             ComponentCount--;
1177ff879b07SJung-uk Kim             Offset += sizeof (ACPI_MPST_COMPONENT);
1178ff879b07SJung-uk Kim         }
1179ff879b07SJung-uk Kim 
1180ff879b07SJung-uk Kim         /* Point to next Memory Power Node subtable */
1181ff879b07SJung-uk Kim 
1182ff879b07SJung-uk Kim         SubtableCount--;
1183ff879b07SJung-uk Kim         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1184ff879b07SJung-uk Kim             sizeof (ACPI_MPST_POWER_NODE) +
1185ff879b07SJung-uk Kim             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1186ff879b07SJung-uk Kim             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1187ff879b07SJung-uk Kim     }
1188ff879b07SJung-uk Kim 
1189ff879b07SJung-uk Kim     /* Subtable: Count of Memory Power State Characteristic structures */
1190ff879b07SJung-uk Kim 
1191ff879b07SJung-uk Kim     AcpiOsPrintf ("\n");
1192ff879b07SJung-uk Kim     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1193ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1194ff879b07SJung-uk Kim         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1195ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1196ff879b07SJung-uk Kim     {
1197ff879b07SJung-uk Kim         return;
1198ff879b07SJung-uk Kim     }
1199ff879b07SJung-uk Kim 
1200ff879b07SJung-uk Kim     SubtableCount = Subtable1->CharacteristicsCount;
1201ff879b07SJung-uk Kim     Offset += sizeof (ACPI_MPST_DATA_HDR);
1202ff879b07SJung-uk Kim 
1203ff879b07SJung-uk Kim     /* Subtable: Memory Power State Characteristics structure(s) */
1204ff879b07SJung-uk Kim 
1205ff879b07SJung-uk Kim     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1206ff879b07SJung-uk Kim         sizeof (ACPI_MPST_DATA_HDR));
1207ff879b07SJung-uk Kim 
1208ff879b07SJung-uk Kim     while ((Offset < Table->Length) && SubtableCount)
1209ff879b07SJung-uk Kim     {
1210ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1211ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1212ff879b07SJung-uk Kim             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1213ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1214ff879b07SJung-uk Kim         {
1215ff879b07SJung-uk Kim             return;
1216ff879b07SJung-uk Kim         }
1217ff879b07SJung-uk Kim 
1218ff879b07SJung-uk Kim         Subtable2++;
1219ff879b07SJung-uk Kim         SubtableCount--;
1220ff879b07SJung-uk Kim         Offset += sizeof (ACPI_MPST_POWER_DATA);
1221ff879b07SJung-uk Kim     }
1222ff879b07SJung-uk Kim }
1223ff879b07SJung-uk Kim 
1224ff879b07SJung-uk Kim 
1225ff879b07SJung-uk Kim /*******************************************************************************
1226ff879b07SJung-uk Kim  *
1227ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpMsct
1228ff879b07SJung-uk Kim  *
1229ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A MSCT table
1230ff879b07SJung-uk Kim  *
1231ff879b07SJung-uk Kim  * RETURN:      None
1232ff879b07SJung-uk Kim  *
1233ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a MSCT
1234ff879b07SJung-uk Kim  *
1235ff879b07SJung-uk Kim  ******************************************************************************/
1236ff879b07SJung-uk Kim 
1237ff879b07SJung-uk Kim void
1238ff879b07SJung-uk Kim AcpiDmDumpMsct (
1239ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1240ff879b07SJung-uk Kim {
1241ff879b07SJung-uk Kim     ACPI_STATUS             Status;
1242ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1243ff879b07SJung-uk Kim     ACPI_MSCT_PROXIMITY     *Subtable;
1244ff879b07SJung-uk Kim 
1245ff879b07SJung-uk Kim 
1246ff879b07SJung-uk Kim     /* Main table */
1247ff879b07SJung-uk Kim 
1248ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1249ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1250ff879b07SJung-uk Kim     {
1251ff879b07SJung-uk Kim         return;
1252ff879b07SJung-uk Kim     }
1253ff879b07SJung-uk Kim 
1254ff879b07SJung-uk Kim     /* Subtables */
1255ff879b07SJung-uk Kim 
1256ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1257ff879b07SJung-uk Kim     while (Offset < Table->Length)
1258ff879b07SJung-uk Kim     {
1259ff879b07SJung-uk Kim         /* Common subtable header */
1260ff879b07SJung-uk Kim 
1261ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1262ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1263ff879b07SJung-uk Kim             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1264ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1265ff879b07SJung-uk Kim         {
1266ff879b07SJung-uk Kim             return;
1267ff879b07SJung-uk Kim         }
1268ff879b07SJung-uk Kim 
1269ff879b07SJung-uk Kim         /* Point to next subtable */
1270ff879b07SJung-uk Kim 
1271ff879b07SJung-uk Kim         Offset += sizeof (ACPI_MSCT_PROXIMITY);
1272ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1273ff879b07SJung-uk Kim             sizeof (ACPI_MSCT_PROXIMITY));
1274ff879b07SJung-uk Kim     }
1275ff879b07SJung-uk Kim }
1276ff879b07SJung-uk Kim 
1277ff879b07SJung-uk Kim 
1278ff879b07SJung-uk Kim /*******************************************************************************
1279ff879b07SJung-uk Kim  *
1280ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpNfit
1281ff879b07SJung-uk Kim  *
1282ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A NFIT table
1283ff879b07SJung-uk Kim  *
1284ff879b07SJung-uk Kim  * RETURN:      None
1285ff879b07SJung-uk Kim  *
1286ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of an NFIT.
1287ff879b07SJung-uk Kim  *
1288ff879b07SJung-uk Kim  ******************************************************************************/
1289ff879b07SJung-uk Kim 
1290ff879b07SJung-uk Kim void
1291ff879b07SJung-uk Kim AcpiDmDumpNfit (
1292ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1293ff879b07SJung-uk Kim {
1294ff879b07SJung-uk Kim     ACPI_STATUS             Status;
1295ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
1296ff879b07SJung-uk Kim     UINT32                  FieldOffset = 0;
1297ff879b07SJung-uk Kim     UINT32                  Length;
1298ff879b07SJung-uk Kim     ACPI_NFIT_HEADER        *Subtable;
1299ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
1300ff879b07SJung-uk Kim     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
1301ff879b07SJung-uk Kim     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
1302ff879b07SJung-uk Kim     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1303ff879b07SJung-uk Kim     UINT32                  i;
1304ff879b07SJung-uk Kim 
1305ff879b07SJung-uk Kim 
1306ff879b07SJung-uk Kim     /* Main table */
1307ff879b07SJung-uk Kim 
1308ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1309ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1310ff879b07SJung-uk Kim     {
1311ff879b07SJung-uk Kim         return;
1312ff879b07SJung-uk Kim     }
1313ff879b07SJung-uk Kim 
1314ff879b07SJung-uk Kim     /* Subtables */
1315ff879b07SJung-uk Kim 
1316ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1317ff879b07SJung-uk Kim     while (Offset < Table->Length)
1318ff879b07SJung-uk Kim     {
1319ff879b07SJung-uk Kim         /* NFIT subtable header */
1320ff879b07SJung-uk Kim 
1321ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1322ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1323ff879b07SJung-uk Kim             Subtable->Length, AcpiDmTableInfoNfitHdr);
1324ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1325ff879b07SJung-uk Kim         {
1326ff879b07SJung-uk Kim             return;
1327ff879b07SJung-uk Kim         }
1328ff879b07SJung-uk Kim 
1329ff879b07SJung-uk Kim         switch (Subtable->Type)
1330ff879b07SJung-uk Kim         {
1331ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1332ff879b07SJung-uk Kim 
1333ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit0;
1334ff879b07SJung-uk Kim             break;
1335ff879b07SJung-uk Kim 
1336ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_MEMORY_MAP:
1337ff879b07SJung-uk Kim 
1338ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit1;
1339ff879b07SJung-uk Kim             break;
1340ff879b07SJung-uk Kim 
1341ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_INTERLEAVE:
1342ff879b07SJung-uk Kim 
1343ff879b07SJung-uk Kim             /* Has a variable number of 32-bit values at the end */
1344ff879b07SJung-uk Kim 
1345ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit2;
1346ff879b07SJung-uk Kim             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1347ff879b07SJung-uk Kim             break;
1348ff879b07SJung-uk Kim 
1349ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_SMBIOS:
1350ff879b07SJung-uk Kim 
1351ff879b07SJung-uk Kim             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1352ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit3;
1353ff879b07SJung-uk Kim             break;
1354ff879b07SJung-uk Kim 
1355ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_CONTROL_REGION:
1356ff879b07SJung-uk Kim 
1357ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit4;
1358ff879b07SJung-uk Kim             break;
1359ff879b07SJung-uk Kim 
1360ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_DATA_REGION:
1361ff879b07SJung-uk Kim 
1362ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit5;
1363ff879b07SJung-uk Kim             break;
1364ff879b07SJung-uk Kim 
1365ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1366ff879b07SJung-uk Kim 
1367ff879b07SJung-uk Kim             /* Has a variable number of 64-bit addresses at the end */
1368ff879b07SJung-uk Kim 
1369ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit6;
1370ff879b07SJung-uk Kim             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
1371ff879b07SJung-uk Kim             break;
1372ff879b07SJung-uk Kim 
1373ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
1374ff879b07SJung-uk Kim 
1375ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoNfit7;
1376ff879b07SJung-uk Kim             break;
1377ff879b07SJung-uk Kim 
1378ff879b07SJung-uk Kim         default:
1379ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1380ff879b07SJung-uk Kim                 Subtable->Type);
1381ff879b07SJung-uk Kim 
1382ff879b07SJung-uk Kim             /* Attempt to continue */
1383ff879b07SJung-uk Kim 
1384ff879b07SJung-uk Kim             if (!Subtable->Length)
1385ff879b07SJung-uk Kim             {
1386ff879b07SJung-uk Kim                 AcpiOsPrintf ("Invalid zero length subtable\n");
1387ff879b07SJung-uk Kim                 return;
1388ff879b07SJung-uk Kim             }
1389ff879b07SJung-uk Kim             goto NextSubtable;
1390ff879b07SJung-uk Kim         }
1391ff879b07SJung-uk Kim 
1392ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1393ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1394ff879b07SJung-uk Kim             Subtable->Length, InfoTable);
1395ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1396ff879b07SJung-uk Kim         {
1397ff879b07SJung-uk Kim             return;
1398ff879b07SJung-uk Kim         }
1399ff879b07SJung-uk Kim 
1400ff879b07SJung-uk Kim         /* Per-subtable variable-length fields */
1401ff879b07SJung-uk Kim 
1402ff879b07SJung-uk Kim         switch (Subtable->Type)
1403ff879b07SJung-uk Kim         {
1404ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_INTERLEAVE:
1405ff879b07SJung-uk Kim 
1406a009b7dcSJung-uk Kim             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1407ff879b07SJung-uk Kim             for (i = 0; i < Interleave->LineCount; i++)
1408ff879b07SJung-uk Kim             {
1409ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1410ff879b07SJung-uk Kim                     &Interleave->LineOffset[i],
1411ff879b07SJung-uk Kim                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
1412ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
1413ff879b07SJung-uk Kim                 {
1414ff879b07SJung-uk Kim                     return;
1415ff879b07SJung-uk Kim                 }
1416ff879b07SJung-uk Kim 
1417ff879b07SJung-uk Kim                 FieldOffset += sizeof (UINT32);
1418ff879b07SJung-uk Kim             }
1419ff879b07SJung-uk Kim             break;
1420ff879b07SJung-uk Kim 
1421ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_SMBIOS:
1422ff879b07SJung-uk Kim 
1423ff879b07SJung-uk Kim             Length = Subtable->Length -
1424ff879b07SJung-uk Kim                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
1425ff879b07SJung-uk Kim 
1426ff879b07SJung-uk Kim             if (Length)
1427ff879b07SJung-uk Kim             {
1428ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length,
1429ff879b07SJung-uk Kim                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
1430ff879b07SJung-uk Kim                     SmbiosInfo,
1431ff879b07SJung-uk Kim                     Length, AcpiDmTableInfoNfit3a);
1432ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
1433ff879b07SJung-uk Kim                 {
1434ff879b07SJung-uk Kim                     return;
1435ff879b07SJung-uk Kim                 }
1436ff879b07SJung-uk Kim             }
1437ff879b07SJung-uk Kim 
1438ff879b07SJung-uk Kim             break;
1439ff879b07SJung-uk Kim 
1440ff879b07SJung-uk Kim         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1441ff879b07SJung-uk Kim 
1442a009b7dcSJung-uk Kim             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1443ff879b07SJung-uk Kim             for (i = 0; i < Hint->HintCount; i++)
1444ff879b07SJung-uk Kim             {
1445ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1446ff879b07SJung-uk Kim                     &Hint->HintAddress[i],
1447ff879b07SJung-uk Kim                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
1448ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
1449ff879b07SJung-uk Kim                 {
1450ff879b07SJung-uk Kim                     return;
1451ff879b07SJung-uk Kim                 }
1452ff879b07SJung-uk Kim 
1453ff879b07SJung-uk Kim                 FieldOffset += sizeof (UINT64);
1454ff879b07SJung-uk Kim             }
1455ff879b07SJung-uk Kim             break;
1456ff879b07SJung-uk Kim 
1457ff879b07SJung-uk Kim         default:
1458ff879b07SJung-uk Kim             break;
1459ff879b07SJung-uk Kim         }
1460ff879b07SJung-uk Kim 
1461ff879b07SJung-uk Kim NextSubtable:
1462ff879b07SJung-uk Kim         /* Point to next subtable */
1463ff879b07SJung-uk Kim 
1464ff879b07SJung-uk Kim         Offset += Subtable->Length;
1465ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1466ff879b07SJung-uk Kim     }
1467ff879b07SJung-uk Kim }
1468ff879b07SJung-uk Kim 
1469ff879b07SJung-uk Kim 
1470ff879b07SJung-uk Kim /*******************************************************************************
1471ff879b07SJung-uk Kim  *
1472*1b7a2680SJung-uk Kim  * FUNCTION:    AcpiDmDumpNhlt
1473*1b7a2680SJung-uk Kim  *
1474*1b7a2680SJung-uk Kim  * PARAMETERS:  Table               - A NHLT table
1475*1b7a2680SJung-uk Kim  *
1476*1b7a2680SJung-uk Kim  * RETURN:      None
1477*1b7a2680SJung-uk Kim  *
1478*1b7a2680SJung-uk Kim  * DESCRIPTION: Format the contents of an NHLT.
1479*1b7a2680SJung-uk Kim  *
1480*1b7a2680SJung-uk Kim  ******************************************************************************/
1481*1b7a2680SJung-uk Kim 
1482*1b7a2680SJung-uk Kim void
1483*1b7a2680SJung-uk Kim AcpiDmDumpNhlt (
1484*1b7a2680SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1485*1b7a2680SJung-uk Kim {
1486*1b7a2680SJung-uk Kim     ACPI_STATUS             Status;
1487*1b7a2680SJung-uk Kim     UINT32                  Offset;
1488*1b7a2680SJung-uk Kim     UINT32                  TableLength = Table->Length;
1489*1b7a2680SJung-uk Kim     UINT32                  EndpointCount;
1490*1b7a2680SJung-uk Kim     UINT8                   FormatsCount;
1491*1b7a2680SJung-uk Kim     ACPI_NHLT_ENDPOINT      *Subtable;
1492*1b7a2680SJung-uk Kim     ACPI_NHLT_FORMAT_CONFIG *FormatSubtable;
1493*1b7a2680SJung-uk Kim     ACPI_TABLE_NHLT         *InfoTable;
1494*1b7a2680SJung-uk Kim     UINT32                  CapabilitiesSize;
1495*1b7a2680SJung-uk Kim     UINT32                  i;
1496*1b7a2680SJung-uk Kim     UINT32                  j;
1497*1b7a2680SJung-uk Kim     UINT32                  k;
1498*1b7a2680SJung-uk Kim     UINT32                  EndpointEndOffset;
1499*1b7a2680SJung-uk Kim     UINT8                   ConfigType = 0;
1500*1b7a2680SJung-uk Kim     UINT8                   ArrayType;
1501*1b7a2680SJung-uk Kim     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A  *DevSpecific;
1502*1b7a2680SJung-uk Kim     ACPI_NHLT_FORMATS_CONFIG            *FormatsConfig;
1503*1b7a2680SJung-uk Kim     ACPI_NHLT_LINUX_SPECIFIC_COUNT      *Count;
1504*1b7a2680SJung-uk Kim     ACPI_NHLT_LINUX_SPECIFIC_DATA       *LinuxData;
1505*1b7a2680SJung-uk Kim 
1506*1b7a2680SJung-uk Kim 
1507*1b7a2680SJung-uk Kim     /* Main table */
1508*1b7a2680SJung-uk Kim 
1509*1b7a2680SJung-uk Kim     AcpiOsPrintf ("/* Main table */\n");
1510*1b7a2680SJung-uk Kim 
1511*1b7a2680SJung-uk Kim     Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNhlt);
1512*1b7a2680SJung-uk Kim     if (ACPI_FAILURE (Status))
1513*1b7a2680SJung-uk Kim     {
1514*1b7a2680SJung-uk Kim         return;
1515*1b7a2680SJung-uk Kim     }
1516*1b7a2680SJung-uk Kim 
1517*1b7a2680SJung-uk Kim     /* Get the Endpoint Descriptor Count */
1518*1b7a2680SJung-uk Kim 
1519*1b7a2680SJung-uk Kim     InfoTable = ACPI_ADD_PTR (ACPI_TABLE_NHLT, Table, 0);
1520*1b7a2680SJung-uk Kim     EndpointCount = InfoTable->EndpointCount;
1521*1b7a2680SJung-uk Kim 
1522*1b7a2680SJung-uk Kim     /* Subtables */
1523*1b7a2680SJung-uk Kim 
1524*1b7a2680SJung-uk Kim     Offset = sizeof (ACPI_TABLE_NHLT);
1525*1b7a2680SJung-uk Kim 
1526*1b7a2680SJung-uk Kim     while (Offset < TableLength)
1527*1b7a2680SJung-uk Kim     {
1528*1b7a2680SJung-uk Kim         /* A variable number of Endpoint Descriptors - process each */
1529*1b7a2680SJung-uk Kim 
1530*1b7a2680SJung-uk Kim         for (i = 0; i < EndpointCount; i++)
1531*1b7a2680SJung-uk Kim         {
1532*1b7a2680SJung-uk Kim             /* Do the Endpoint Descriptor table */
1533*1b7a2680SJung-uk Kim 
1534*1b7a2680SJung-uk Kim             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1535*1b7a2680SJung-uk Kim             if (Subtable->DescriptorLength > TableLength)
1536*1b7a2680SJung-uk Kim             {
1537*1b7a2680SJung-uk Kim                 Offset += 1;
1538*1b7a2680SJung-uk Kim                 AcpiOsPrintf ("\n/* Endpoint Descriptor Length larger than"
1539*1b7a2680SJung-uk Kim                     " table size: %X, table %X, adjusting table offset (+1) */\n",
1540*1b7a2680SJung-uk Kim                     Subtable->DescriptorLength, TableLength);
1541*1b7a2680SJung-uk Kim 
1542*1b7a2680SJung-uk Kim                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1543*1b7a2680SJung-uk Kim             }
1544*1b7a2680SJung-uk Kim 
1545*1b7a2680SJung-uk Kim             AcpiOsPrintf ("\n/* Endpoint Descriptor #%u */\n", i+1);
1546*1b7a2680SJung-uk Kim             Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
1547*1b7a2680SJung-uk Kim                 Subtable->DescriptorLength, AcpiDmTableInfoNhlt0);
1548*1b7a2680SJung-uk Kim             if (ACPI_FAILURE (Status))
1549*1b7a2680SJung-uk Kim             {
1550*1b7a2680SJung-uk Kim                 return;
1551*1b7a2680SJung-uk Kim             }
1552*1b7a2680SJung-uk Kim             EndpointEndOffset = Subtable->DescriptorLength + Offset;
1553*1b7a2680SJung-uk Kim 
1554*1b7a2680SJung-uk Kim             /* Check for endpoint descriptor beyond end-of-table */
1555*1b7a2680SJung-uk Kim 
1556*1b7a2680SJung-uk Kim             if (Subtable->DescriptorLength > TableLength)
1557*1b7a2680SJung-uk Kim             {
1558*1b7a2680SJung-uk Kim                 AcpiOsPrintf ("\n/* Endpoint Descriptor Length larger than table size: %X, table %X */\n",
1559*1b7a2680SJung-uk Kim                     Subtable->DescriptorLength, TableLength);
1560*1b7a2680SJung-uk Kim             }
1561*1b7a2680SJung-uk Kim             Offset += sizeof (ACPI_NHLT_ENDPOINT);
1562*1b7a2680SJung-uk Kim             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1563*1b7a2680SJung-uk Kim 
1564*1b7a2680SJung-uk Kim             /* Do the Device Specific table */
1565*1b7a2680SJung-uk Kim 
1566*1b7a2680SJung-uk Kim             AcpiOsPrintf ("\n/* Endpoint Device_Specific_Config table */\n");
1567*1b7a2680SJung-uk Kim             DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1568*1b7a2680SJung-uk Kim             CapabilitiesSize = DevSpecific->CapabilitiesSize;
1569*1b7a2680SJung-uk Kim 
1570*1b7a2680SJung-uk Kim             /* Different subtables based upon capabilities_size */
1571*1b7a2680SJung-uk Kim 
1572*1b7a2680SJung-uk Kim             switch (CapabilitiesSize)
1573*1b7a2680SJung-uk Kim             {
1574*1b7a2680SJung-uk Kim             case 0:
1575*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1576*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
1577*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1578*1b7a2680SJung-uk Kim                 {
1579*1b7a2680SJung-uk Kim                     return;
1580*1b7a2680SJung-uk Kim                 }
1581*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
1582*1b7a2680SJung-uk Kim                 break;
1583*1b7a2680SJung-uk Kim 
1584*1b7a2680SJung-uk Kim             case 1:
1585*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1586*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C), AcpiDmTableInfoNhlt5c);
1587*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1588*1b7a2680SJung-uk Kim                 {
1589*1b7a2680SJung-uk Kim                     return;
1590*1b7a2680SJung-uk Kim                 }
1591*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C);
1592*1b7a2680SJung-uk Kim                 break;
1593*1b7a2680SJung-uk Kim 
1594*1b7a2680SJung-uk Kim             case 2:
1595*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1596*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
1597*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1598*1b7a2680SJung-uk Kim                 {
1599*1b7a2680SJung-uk Kim                     return;
1600*1b7a2680SJung-uk Kim                 }
1601*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
1602*1b7a2680SJung-uk Kim                 break;
1603*1b7a2680SJung-uk Kim 
1604*1b7a2680SJung-uk Kim             case 3:
1605*1b7a2680SJung-uk Kim                 ConfigType = DevSpecific->ConfigType;
1606*1b7a2680SJung-uk Kim                 ArrayType = DevSpecific->ArrayType;
1607*1b7a2680SJung-uk Kim 
1608*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1609*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A), AcpiDmTableInfoNhlt5a);
1610*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1611*1b7a2680SJung-uk Kim                 {
1612*1b7a2680SJung-uk Kim                     return;
1613*1b7a2680SJung-uk Kim                 }
1614*1b7a2680SJung-uk Kim 
1615*1b7a2680SJung-uk Kim                 /* Capabilities Size == 3 */
1616*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A);
1617*1b7a2680SJung-uk Kim 
1618*1b7a2680SJung-uk Kim                 /* Check for a vendor-defined mic array */
1619*1b7a2680SJung-uk Kim 
1620*1b7a2680SJung-uk Kim                 if ((ConfigType == ACPI_NHLT_TYPE_MIC_ARRAY) && ((ArrayType & ARRAY_TYPE_MASK) == VENDOR_DEFINED))
1621*1b7a2680SJung-uk Kim                 {
1622*1b7a2680SJung-uk Kim                     /* Vendor-defined microphone array */
1623*1b7a2680SJung-uk Kim 
1624*1b7a2680SJung-uk Kim                     AcpiOsPrintf ("\n/* Vendor-defined microphone array */\n");
1625*1b7a2680SJung-uk Kim 
1626*1b7a2680SJung-uk Kim                     Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1627*1b7a2680SJung-uk Kim                         sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG), AcpiDmTableInfoNhlt6);
1628*1b7a2680SJung-uk Kim                     if (ACPI_FAILURE (Status))
1629*1b7a2680SJung-uk Kim                     {
1630*1b7a2680SJung-uk Kim                         return;
1631*1b7a2680SJung-uk Kim                     }
1632*1b7a2680SJung-uk Kim                     Offset += sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG);
1633*1b7a2680SJung-uk Kim                 }
1634*1b7a2680SJung-uk Kim                 break;
1635*1b7a2680SJung-uk Kim 
1636*1b7a2680SJung-uk Kim             default:
1637*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1638*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
1639*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1640*1b7a2680SJung-uk Kim                 {
1641*1b7a2680SJung-uk Kim                     return;
1642*1b7a2680SJung-uk Kim                 }
1643*1b7a2680SJung-uk Kim 
1644*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
1645*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1646*1b7a2680SJung-uk Kim                     CapabilitiesSize, AcpiDmTableInfoNhlt3a);
1647*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1648*1b7a2680SJung-uk Kim                 {
1649*1b7a2680SJung-uk Kim                     return;
1650*1b7a2680SJung-uk Kim                 }
1651*1b7a2680SJung-uk Kim                 Offset += CapabilitiesSize;
1652*1b7a2680SJung-uk Kim                 break;
1653*1b7a2680SJung-uk Kim             }
1654*1b7a2680SJung-uk Kim 
1655*1b7a2680SJung-uk Kim             /* Do the Formats_Config table */
1656*1b7a2680SJung-uk Kim 
1657*1b7a2680SJung-uk Kim             FormatsConfig = ACPI_ADD_PTR (ACPI_NHLT_FORMATS_CONFIG, Table, Offset);
1658*1b7a2680SJung-uk Kim             FormatsCount = FormatsConfig->FormatsCount;
1659*1b7a2680SJung-uk Kim 
1660*1b7a2680SJung-uk Kim             AcpiOsPrintf ("\n/* Formats_Config table */\n");
1661*1b7a2680SJung-uk Kim 
1662*1b7a2680SJung-uk Kim             Status = AcpiDmDumpTable (TableLength, Offset, FormatsConfig,
1663*1b7a2680SJung-uk Kim                 sizeof (ACPI_NHLT_FORMATS_CONFIG), AcpiDmTableInfoNhlt4);
1664*1b7a2680SJung-uk Kim             if (ACPI_FAILURE (Status))
1665*1b7a2680SJung-uk Kim             {
1666*1b7a2680SJung-uk Kim                 return;
1667*1b7a2680SJung-uk Kim             }
1668*1b7a2680SJung-uk Kim             Offset += sizeof (ACPI_NHLT_FORMATS_CONFIG);
1669*1b7a2680SJung-uk Kim 
1670*1b7a2680SJung-uk Kim             /* A variable number of Format_Config Descriptors - process each */
1671*1b7a2680SJung-uk Kim 
1672*1b7a2680SJung-uk Kim             for (j = 0; j < FormatsCount; j++)
1673*1b7a2680SJung-uk Kim             {
1674*1b7a2680SJung-uk Kim                 FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset);
1675*1b7a2680SJung-uk Kim                 CapabilitiesSize = FormatSubtable->CapabilitySize;
1676*1b7a2680SJung-uk Kim 
1677*1b7a2680SJung-uk Kim                 /* Do the Wave_extensible struct */
1678*1b7a2680SJung-uk Kim 
1679*1b7a2680SJung-uk Kim                 AcpiOsPrintf ("\n/* Wave_Format_Extensible table #%u */\n", j+1);
1680*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable,
1681*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_FORMAT_CONFIG), AcpiDmTableInfoNhlt3);
1682*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1683*1b7a2680SJung-uk Kim                 {
1684*1b7a2680SJung-uk Kim                     return;
1685*1b7a2680SJung-uk Kim                 }
1686*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_WAVE_EXTENSIBLE);
1687*1b7a2680SJung-uk Kim 
1688*1b7a2680SJung-uk Kim                 /* Do the Capabilities array */
1689*1b7a2680SJung-uk Kim 
1690*1b7a2680SJung-uk Kim                 Offset += sizeof (UINT32);
1691*1b7a2680SJung-uk Kim                 AcpiOsPrintf ("\n/* Specific_Config table #%u */\n", j+1);
1692*1b7a2680SJung-uk Kim                 FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset);
1693*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable,
1694*1b7a2680SJung-uk Kim                     CapabilitiesSize, AcpiDmTableInfoNhlt3a);
1695*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1696*1b7a2680SJung-uk Kim                 {
1697*1b7a2680SJung-uk Kim                     return;
1698*1b7a2680SJung-uk Kim                 }
1699*1b7a2680SJung-uk Kim                 Offset += CapabilitiesSize;
1700*1b7a2680SJung-uk Kim             }
1701*1b7a2680SJung-uk Kim 
1702*1b7a2680SJung-uk Kim             /*
1703*1b7a2680SJung-uk Kim              * If we are not done with the Endpoint(s) yet, then there must be
1704*1b7a2680SJung-uk Kim              * some Linux-specific structure(s) yet to be processed.
1705*1b7a2680SJung-uk Kim              */
1706*1b7a2680SJung-uk Kim             if (Offset < EndpointEndOffset)
1707*1b7a2680SJung-uk Kim             {
1708*1b7a2680SJung-uk Kim                 AcpiOsPrintf ("\n");
1709*1b7a2680SJung-uk Kim                 Count = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_COUNT, Table, Offset);
1710*1b7a2680SJung-uk Kim                 Status = AcpiDmDumpTable (TableLength, Offset, Count,
1711*1b7a2680SJung-uk Kim                     sizeof (ACPI_NHLT_LINUX_SPECIFIC_COUNT), AcpiDmTableInfoNhlt7);
1712*1b7a2680SJung-uk Kim                 if (ACPI_FAILURE (Status))
1713*1b7a2680SJung-uk Kim                 {
1714*1b7a2680SJung-uk Kim                     return;
1715*1b7a2680SJung-uk Kim                 }
1716*1b7a2680SJung-uk Kim                 Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_COUNT);
1717*1b7a2680SJung-uk Kim 
1718*1b7a2680SJung-uk Kim                 /* Variable number of linux-specific structures */
1719*1b7a2680SJung-uk Kim 
1720*1b7a2680SJung-uk Kim                 for (k = 0; k < Count->StructureCount; k++)
1721*1b7a2680SJung-uk Kim                 {
1722*1b7a2680SJung-uk Kim                     LinuxData = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA, Table, Offset);
1723*1b7a2680SJung-uk Kim 
1724*1b7a2680SJung-uk Kim                     AcpiOsPrintf ("\n/* Linux-specific structure #%u */\n", k+1);
1725*1b7a2680SJung-uk Kim 
1726*1b7a2680SJung-uk Kim                     Status = AcpiDmDumpTable (TableLength, Offset, LinuxData,
1727*1b7a2680SJung-uk Kim                         sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA), AcpiDmTableInfoNhlt7a);
1728*1b7a2680SJung-uk Kim                     if (ACPI_FAILURE (Status))
1729*1b7a2680SJung-uk Kim                     {
1730*1b7a2680SJung-uk Kim                         return;
1731*1b7a2680SJung-uk Kim                     }
1732*1b7a2680SJung-uk Kim 
1733*1b7a2680SJung-uk Kim                     Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA);
1734*1b7a2680SJung-uk Kim                 }
1735*1b7a2680SJung-uk Kim 
1736*1b7a2680SJung-uk Kim                 /* Should be at the end of the Endpoint structure. Skip any extra bytes */
1737*1b7a2680SJung-uk Kim 
1738*1b7a2680SJung-uk Kim                 if (Offset < EndpointEndOffset)
1739*1b7a2680SJung-uk Kim                 {
1740*1b7a2680SJung-uk Kim                     AcpiOsPrintf ("\n/* Endpoint descriptor ended before endpoint size was reached. "
1741*1b7a2680SJung-uk Kim                         "skipped %X input bytes, current offset: %X, Endpoint End Offset: %X */\n",
1742*1b7a2680SJung-uk Kim                         EndpointEndOffset - Offset, Offset, EndpointEndOffset);
1743*1b7a2680SJung-uk Kim                     AcpiUtDumpBuffer (((UINT8 *)Table)+Offset,
1744*1b7a2680SJung-uk Kim                         EndpointEndOffset - Offset, DB_BYTE_DISPLAY, Offset);
1745*1b7a2680SJung-uk Kim                     Offset = EndpointEndOffset;
1746*1b7a2680SJung-uk Kim                 }
1747*1b7a2680SJung-uk Kim             }
1748*1b7a2680SJung-uk Kim         }
1749*1b7a2680SJung-uk Kim 
1750*1b7a2680SJung-uk Kim         /* Emit the table terminator (if present) */
1751*1b7a2680SJung-uk Kim 
1752*1b7a2680SJung-uk Kim         if (Offset == TableLength - sizeof (ACPI_NHLT_TABLE_TERMINATOR))
1753*1b7a2680SJung-uk Kim         {
1754*1b7a2680SJung-uk Kim             LinuxData = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA, Table, Offset);
1755*1b7a2680SJung-uk Kim             AcpiOsPrintf ("\n/* Table terminator structure */\n");
1756*1b7a2680SJung-uk Kim 
1757*1b7a2680SJung-uk Kim             Status = AcpiDmDumpTable (TableLength, Offset, LinuxData,
1758*1b7a2680SJung-uk Kim                 sizeof (ACPI_NHLT_TABLE_TERMINATOR), AcpiDmTableInfoNhlt8);
1759*1b7a2680SJung-uk Kim             if (ACPI_FAILURE (Status))
1760*1b7a2680SJung-uk Kim             {
1761*1b7a2680SJung-uk Kim                 return;
1762*1b7a2680SJung-uk Kim             }
1763*1b7a2680SJung-uk Kim         }
1764*1b7a2680SJung-uk Kim 
1765*1b7a2680SJung-uk Kim         return;
1766*1b7a2680SJung-uk Kim     }
1767*1b7a2680SJung-uk Kim }
1768*1b7a2680SJung-uk Kim 
1769*1b7a2680SJung-uk Kim 
1770*1b7a2680SJung-uk Kim /*******************************************************************************
1771*1b7a2680SJung-uk Kim  *
1772ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpPcct
1773ff879b07SJung-uk Kim  *
1774ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A PCCT table
1775ff879b07SJung-uk Kim  *
1776ff879b07SJung-uk Kim  * RETURN:      None
1777ff879b07SJung-uk Kim  *
1778ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a PCCT. This table type consists
1779ff879b07SJung-uk Kim  *              of an open-ended number of subtables.
1780ff879b07SJung-uk Kim  *
1781ff879b07SJung-uk Kim  ******************************************************************************/
1782ff879b07SJung-uk Kim 
1783ff879b07SJung-uk Kim void
1784ff879b07SJung-uk Kim AcpiDmDumpPcct (
1785ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1786ff879b07SJung-uk Kim {
1787ff879b07SJung-uk Kim     ACPI_STATUS             Status;
1788ff879b07SJung-uk Kim     ACPI_PCCT_SUBSPACE      *Subtable;
1789ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
1790ff879b07SJung-uk Kim     UINT32                  Length = Table->Length;
1791ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
1792ff879b07SJung-uk Kim 
1793ff879b07SJung-uk Kim 
1794ff879b07SJung-uk Kim     /* Main table */
1795ff879b07SJung-uk Kim 
1796ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1797ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1798ff879b07SJung-uk Kim     {
1799ff879b07SJung-uk Kim         return;
1800ff879b07SJung-uk Kim     }
1801ff879b07SJung-uk Kim 
1802ff879b07SJung-uk Kim     /* Subtables */
1803ff879b07SJung-uk Kim 
1804ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1805ff879b07SJung-uk Kim     while (Offset < Table->Length)
1806ff879b07SJung-uk Kim     {
1807ff879b07SJung-uk Kim         /* Common subtable header */
1808ff879b07SJung-uk Kim 
1809ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1810ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1811ff879b07SJung-uk Kim             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
1812ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1813ff879b07SJung-uk Kim         {
1814ff879b07SJung-uk Kim             return;
1815ff879b07SJung-uk Kim         }
1816ff879b07SJung-uk Kim 
1817ff879b07SJung-uk Kim         switch (Subtable->Header.Type)
1818ff879b07SJung-uk Kim         {
1819ff879b07SJung-uk Kim         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
1820ff879b07SJung-uk Kim 
1821ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPcct0;
1822ff879b07SJung-uk Kim             break;
1823ff879b07SJung-uk Kim 
1824ff879b07SJung-uk Kim         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
1825ff879b07SJung-uk Kim 
1826ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPcct1;
1827ff879b07SJung-uk Kim             break;
1828ff879b07SJung-uk Kim 
1829ff879b07SJung-uk Kim         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
1830ff879b07SJung-uk Kim 
1831ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPcct2;
1832ff879b07SJung-uk Kim             break;
1833ff879b07SJung-uk Kim 
1834ff879b07SJung-uk Kim         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
1835ff879b07SJung-uk Kim 
1836ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPcct3;
1837ff879b07SJung-uk Kim             break;
1838ff879b07SJung-uk Kim 
1839ff879b07SJung-uk Kim         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
1840ff879b07SJung-uk Kim 
1841ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPcct4;
1842ff879b07SJung-uk Kim             break;
1843ff879b07SJung-uk Kim 
1844cfd1ed46SJung-uk Kim         case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
1845cfd1ed46SJung-uk Kim 
1846cfd1ed46SJung-uk Kim             InfoTable = AcpiDmTableInfoPcct5;
1847cfd1ed46SJung-uk Kim             break;
1848cfd1ed46SJung-uk Kim 
1849ff879b07SJung-uk Kim         default:
1850ff879b07SJung-uk Kim 
1851ff879b07SJung-uk Kim             AcpiOsPrintf (
1852ff879b07SJung-uk Kim                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
1853ff879b07SJung-uk Kim                 Subtable->Header.Type);
1854ff879b07SJung-uk Kim             return;
1855ff879b07SJung-uk Kim         }
1856ff879b07SJung-uk Kim 
1857ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1858ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1859ff879b07SJung-uk Kim             Subtable->Header.Length, InfoTable);
1860ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1861ff879b07SJung-uk Kim         {
1862ff879b07SJung-uk Kim             return;
1863ff879b07SJung-uk Kim         }
1864ff879b07SJung-uk Kim 
1865ff879b07SJung-uk Kim         /* Point to next subtable */
1866ff879b07SJung-uk Kim 
1867ff879b07SJung-uk Kim         Offset += Subtable->Header.Length;
1868ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
1869ff879b07SJung-uk Kim             Subtable->Header.Length);
1870ff879b07SJung-uk Kim     }
1871ff879b07SJung-uk Kim }
1872ff879b07SJung-uk Kim 
1873ff879b07SJung-uk Kim 
1874ff879b07SJung-uk Kim /*******************************************************************************
1875ff879b07SJung-uk Kim  *
1876ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpPdtt
1877ff879b07SJung-uk Kim  *
1878ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A PDTT table
1879ff879b07SJung-uk Kim  *
1880ff879b07SJung-uk Kim  * RETURN:      None
1881ff879b07SJung-uk Kim  *
1882ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
1883ff879b07SJung-uk Kim  *              table that contains an open-ended number of IDs
1884ff879b07SJung-uk Kim  *              at the end of the table.
1885ff879b07SJung-uk Kim  *
1886ff879b07SJung-uk Kim  ******************************************************************************/
1887ff879b07SJung-uk Kim 
1888ff879b07SJung-uk Kim void
1889ff879b07SJung-uk Kim AcpiDmDumpPdtt (
1890ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1891ff879b07SJung-uk Kim {
1892ff879b07SJung-uk Kim     ACPI_STATUS             Status;
1893ff879b07SJung-uk Kim     ACPI_PDTT_CHANNEL       *Subtable;
1894ff879b07SJung-uk Kim     UINT32                  Length = Table->Length;
1895ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
1896ff879b07SJung-uk Kim 
1897ff879b07SJung-uk Kim 
1898ff879b07SJung-uk Kim     /* Main table */
1899ff879b07SJung-uk Kim 
1900ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
1901ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
1902ff879b07SJung-uk Kim     {
1903ff879b07SJung-uk Kim         return;
1904ff879b07SJung-uk Kim     }
1905ff879b07SJung-uk Kim 
1906ff879b07SJung-uk Kim     /* Subtables. Currently there is only one type, but can be multiples */
1907ff879b07SJung-uk Kim 
1908ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
1909ff879b07SJung-uk Kim     while (Offset < Table->Length)
1910ff879b07SJung-uk Kim     {
1911ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
1912ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1913ff879b07SJung-uk Kim             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
1914ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
1915ff879b07SJung-uk Kim         {
1916ff879b07SJung-uk Kim             return;
1917ff879b07SJung-uk Kim         }
1918ff879b07SJung-uk Kim 
1919ff879b07SJung-uk Kim         /* Point to next subtable */
1920ff879b07SJung-uk Kim 
1921ff879b07SJung-uk Kim         Offset += sizeof (ACPI_PDTT_CHANNEL);
1922ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
1923ff879b07SJung-uk Kim             sizeof (ACPI_PDTT_CHANNEL));
1924ff879b07SJung-uk Kim     }
1925ff879b07SJung-uk Kim }
1926ff879b07SJung-uk Kim 
1927ff879b07SJung-uk Kim 
1928ff879b07SJung-uk Kim /*******************************************************************************
1929ff879b07SJung-uk Kim  *
1930cfd1ed46SJung-uk Kim  * FUNCTION:    AcpiDmDumpPhat
1931cfd1ed46SJung-uk Kim  *
1932cfd1ed46SJung-uk Kim  * PARAMETERS:  Table               - A PHAT table
1933cfd1ed46SJung-uk Kim  *
1934cfd1ed46SJung-uk Kim  * RETURN:      None
1935cfd1ed46SJung-uk Kim  *
1936cfd1ed46SJung-uk Kim  * DESCRIPTION: Format the contents of a PHAT.
1937cfd1ed46SJung-uk Kim  *
1938cfd1ed46SJung-uk Kim  ******************************************************************************/
1939cfd1ed46SJung-uk Kim 
1940cfd1ed46SJung-uk Kim void
1941cfd1ed46SJung-uk Kim AcpiDmDumpPhat (
1942cfd1ed46SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
1943cfd1ed46SJung-uk Kim {
1944cfd1ed46SJung-uk Kim     ACPI_STATUS             Status;
1945cfd1ed46SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
1946cfd1ed46SJung-uk Kim     ACPI_PHAT_HEADER        *Subtable;
1947cfd1ed46SJung-uk Kim     ACPI_PHAT_VERSION_DATA  *VersionData;
1948cfd1ed46SJung-uk Kim     UINT32                  RecordCount;
1949cfd1ed46SJung-uk Kim     UINT32                  Length = Table->Length;
1950cfd1ed46SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_PHAT);
1951cfd1ed46SJung-uk Kim     UINT32                  SubtableLength;
1952cfd1ed46SJung-uk Kim     UINT32                  PathLength;
1953cfd1ed46SJung-uk Kim     UINT32                  VendorLength;
1954cfd1ed46SJung-uk Kim 
1955cfd1ed46SJung-uk Kim 
1956cfd1ed46SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
1957cfd1ed46SJung-uk Kim 
1958cfd1ed46SJung-uk Kim     while (Offset < Table->Length)
1959cfd1ed46SJung-uk Kim     {
1960cfd1ed46SJung-uk Kim         /* Common subtable header */
1961cfd1ed46SJung-uk Kim 
1962cfd1ed46SJung-uk Kim         AcpiOsPrintf ("\n");
1963cfd1ed46SJung-uk Kim         Status = AcpiDmDumpTable (Length, 0, Subtable,
1964cfd1ed46SJung-uk Kim             sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
1965cfd1ed46SJung-uk Kim         if (ACPI_FAILURE (Status))
1966cfd1ed46SJung-uk Kim         {
1967cfd1ed46SJung-uk Kim             return;
1968cfd1ed46SJung-uk Kim         }
1969cfd1ed46SJung-uk Kim 
1970cfd1ed46SJung-uk Kim         switch (Subtable->Type)
1971cfd1ed46SJung-uk Kim         {
1972cfd1ed46SJung-uk Kim         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
1973cfd1ed46SJung-uk Kim 
1974cfd1ed46SJung-uk Kim             InfoTable = AcpiDmTableInfoPhat0;
1975cfd1ed46SJung-uk Kim             SubtableLength = sizeof (ACPI_PHAT_VERSION_DATA);
1976cfd1ed46SJung-uk Kim             break;
1977cfd1ed46SJung-uk Kim 
1978cfd1ed46SJung-uk Kim         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
1979cfd1ed46SJung-uk Kim 
1980cfd1ed46SJung-uk Kim             InfoTable = AcpiDmTableInfoPhat1;
1981cfd1ed46SJung-uk Kim             SubtableLength = sizeof (ACPI_PHAT_HEALTH_DATA);
1982cfd1ed46SJung-uk Kim             break;
1983cfd1ed46SJung-uk Kim 
1984cfd1ed46SJung-uk Kim         default:
1985cfd1ed46SJung-uk Kim 
1986cfd1ed46SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
1987cfd1ed46SJung-uk Kim                 Subtable->Type);
1988cfd1ed46SJung-uk Kim 
1989cfd1ed46SJung-uk Kim             return;
1990cfd1ed46SJung-uk Kim         }
1991cfd1ed46SJung-uk Kim 
1992cfd1ed46SJung-uk Kim         Status = AcpiDmDumpTable (Length, 0, Subtable,
1993cfd1ed46SJung-uk Kim             SubtableLength, InfoTable);
1994cfd1ed46SJung-uk Kim         if (ACPI_FAILURE (Status))
1995cfd1ed46SJung-uk Kim         {
1996cfd1ed46SJung-uk Kim             return;
1997cfd1ed46SJung-uk Kim         }
1998cfd1ed46SJung-uk Kim 
1999cfd1ed46SJung-uk Kim         switch (Subtable->Type)
2000cfd1ed46SJung-uk Kim         {
2001cfd1ed46SJung-uk Kim         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2002cfd1ed46SJung-uk Kim 
2003cfd1ed46SJung-uk Kim             VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
2004cfd1ed46SJung-uk Kim             RecordCount = VersionData->ElementCount;
2005cfd1ed46SJung-uk Kim             while (RecordCount)
2006cfd1ed46SJung-uk Kim             {
2007cfd1ed46SJung-uk Kim                 Status = AcpiDmDumpTable (Length, Offset,
2008cfd1ed46SJung-uk Kim                     ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)),
2009cfd1ed46SJung-uk Kim                     sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
2010cfd1ed46SJung-uk Kim                 if (ACPI_FAILURE (Status))
2011cfd1ed46SJung-uk Kim                 {
2012cfd1ed46SJung-uk Kim                     return;
2013cfd1ed46SJung-uk Kim                 }
2014cfd1ed46SJung-uk Kim 
2015cfd1ed46SJung-uk Kim                 RecordCount--;
2016cfd1ed46SJung-uk Kim             }
2017cfd1ed46SJung-uk Kim 
2018cfd1ed46SJung-uk Kim             break;
2019cfd1ed46SJung-uk Kim 
2020cfd1ed46SJung-uk Kim         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2021cfd1ed46SJung-uk Kim 
2022cfd1ed46SJung-uk Kim             /* account for the null terminator */
2023cfd1ed46SJung-uk Kim 
2024cfd1ed46SJung-uk Kim             PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1;
2025cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Length, Offset,
2026cfd1ed46SJung-uk Kim                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
2027cfd1ed46SJung-uk Kim                 PathLength, AcpiDmTableInfoPhat1a);
2028cfd1ed46SJung-uk Kim             if (ACPI_FAILURE (Status))
2029cfd1ed46SJung-uk Kim             {
2030cfd1ed46SJung-uk Kim                 return;
2031cfd1ed46SJung-uk Kim             }
2032cfd1ed46SJung-uk Kim 
2033cfd1ed46SJung-uk Kim             /* Get vendor data - data length is the remaining subtable length */
2034cfd1ed46SJung-uk Kim 
2035cfd1ed46SJung-uk Kim             VendorLength =
2036cfd1ed46SJung-uk Kim                 Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
2037cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Length, 0,
2038cfd1ed46SJung-uk Kim                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
2039cfd1ed46SJung-uk Kim                 VendorLength, AcpiDmTableInfoPhat1b);
2040cfd1ed46SJung-uk Kim             if (ACPI_FAILURE (Status))
2041cfd1ed46SJung-uk Kim             {
2042cfd1ed46SJung-uk Kim                 return;
2043cfd1ed46SJung-uk Kim             }
2044cfd1ed46SJung-uk Kim             break;
2045cfd1ed46SJung-uk Kim 
2046cfd1ed46SJung-uk Kim         default:
2047cfd1ed46SJung-uk Kim 
2048cfd1ed46SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
2049cfd1ed46SJung-uk Kim                 Subtable->Type);
2050cfd1ed46SJung-uk Kim             return;
2051cfd1ed46SJung-uk Kim         }
2052cfd1ed46SJung-uk Kim 
2053cfd1ed46SJung-uk Kim         /* Next subtable */
2054cfd1ed46SJung-uk Kim 
2055cfd1ed46SJung-uk Kim         Offset += Subtable->Length;
2056cfd1ed46SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable,
2057cfd1ed46SJung-uk Kim             Subtable->Length);
2058cfd1ed46SJung-uk Kim     }
2059cfd1ed46SJung-uk Kim }
2060cfd1ed46SJung-uk Kim 
2061cfd1ed46SJung-uk Kim 
2062cfd1ed46SJung-uk Kim /*******************************************************************************
2063cfd1ed46SJung-uk Kim  *
2064ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpPmtt
2065ff879b07SJung-uk Kim  *
2066ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A PMTT table
2067ff879b07SJung-uk Kim  *
2068ff879b07SJung-uk Kim  * RETURN:      None
2069ff879b07SJung-uk Kim  *
2070ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a PMTT. This table type consists
2071ff879b07SJung-uk Kim  *              of an open-ended number of subtables.
2072ff879b07SJung-uk Kim  *
2073ff879b07SJung-uk Kim  ******************************************************************************/
2074ff879b07SJung-uk Kim 
2075ff879b07SJung-uk Kim void
2076ff879b07SJung-uk Kim AcpiDmDumpPmtt (
2077ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
2078ff879b07SJung-uk Kim {
2079ff879b07SJung-uk Kim     ACPI_STATUS             Status;
2080ff879b07SJung-uk Kim     ACPI_PMTT_HEADER        *Subtable;
2081ff879b07SJung-uk Kim     UINT32                  Length = Table->Length;
2082ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
2083ff879b07SJung-uk Kim 
2084ff879b07SJung-uk Kim 
2085ff879b07SJung-uk Kim     /* Main table */
2086ff879b07SJung-uk Kim 
2087ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2088ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
2089ff879b07SJung-uk Kim     {
2090ff879b07SJung-uk Kim         return;
2091ff879b07SJung-uk Kim     }
2092ff879b07SJung-uk Kim 
2093ff879b07SJung-uk Kim     /* Subtables */
2094ff879b07SJung-uk Kim 
2095ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2096ff879b07SJung-uk Kim     while (Offset < Table->Length)
2097ff879b07SJung-uk Kim     {
2098cfd1ed46SJung-uk Kim         /* Each of the types below contain the common subtable header */
2099ff879b07SJung-uk Kim 
2100ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
2101cfd1ed46SJung-uk Kim         switch (Subtable->Type)
2102ff879b07SJung-uk Kim         {
2103cfd1ed46SJung-uk Kim         case ACPI_PMTT_TYPE_SOCKET:
2104ff879b07SJung-uk Kim 
2105ff879b07SJung-uk Kim             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2106ff879b07SJung-uk Kim                 Subtable->Length, AcpiDmTableInfoPmtt0);
2107ff879b07SJung-uk Kim             if (ACPI_FAILURE (Status))
2108ff879b07SJung-uk Kim             {
2109ff879b07SJung-uk Kim                 return;
2110ff879b07SJung-uk Kim             }
2111cfd1ed46SJung-uk Kim             break;
2112ff879b07SJung-uk Kim 
2113cfd1ed46SJung-uk Kim         case ACPI_PMTT_TYPE_CONTROLLER:
2114cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2115cfd1ed46SJung-uk Kim                 Subtable->Length, AcpiDmTableInfoPmtt1);
2116ff879b07SJung-uk Kim             if (ACPI_FAILURE (Status))
2117ff879b07SJung-uk Kim             {
2118ff879b07SJung-uk Kim                 return;
2119ff879b07SJung-uk Kim             }
2120cfd1ed46SJung-uk Kim             break;
2121ff879b07SJung-uk Kim 
2122cfd1ed46SJung-uk Kim        case ACPI_PMTT_TYPE_DIMM:
2123cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2124cfd1ed46SJung-uk Kim                 Subtable->Length, AcpiDmTableInfoPmtt2);
2125cfd1ed46SJung-uk Kim             if (ACPI_FAILURE (Status))
2126ff879b07SJung-uk Kim             {
2127cfd1ed46SJung-uk Kim                 return;
2128cfd1ed46SJung-uk Kim             }
2129cfd1ed46SJung-uk Kim             break;
2130cfd1ed46SJung-uk Kim 
2131cfd1ed46SJung-uk Kim         case ACPI_PMTT_TYPE_VENDOR:
2132cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2133cfd1ed46SJung-uk Kim                 Subtable->Length, AcpiDmTableInfoPmttVendor);
2134cfd1ed46SJung-uk Kim             if (ACPI_FAILURE (Status))
2135cfd1ed46SJung-uk Kim             {
2136cfd1ed46SJung-uk Kim                 return;
2137cfd1ed46SJung-uk Kim             }
2138cfd1ed46SJung-uk Kim             break;
2139cfd1ed46SJung-uk Kim 
2140cfd1ed46SJung-uk Kim         default:
2141ff879b07SJung-uk Kim             AcpiOsPrintf (
2142ff879b07SJung-uk Kim                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2143cfd1ed46SJung-uk Kim                 Subtable->Type);
2144ff879b07SJung-uk Kim             return;
2145ff879b07SJung-uk Kim         }
2146ff879b07SJung-uk Kim 
2147cfd1ed46SJung-uk Kim         /* Point to next subtable */
2148ff879b07SJung-uk Kim 
2149ff879b07SJung-uk Kim         Offset += Subtable->Length;
2150ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2151ff879b07SJung-uk Kim             Subtable, Subtable->Length);
2152ff879b07SJung-uk Kim     }
2153ff879b07SJung-uk Kim }
2154ff879b07SJung-uk Kim 
2155ff879b07SJung-uk Kim 
2156ff879b07SJung-uk Kim /*******************************************************************************
2157ff879b07SJung-uk Kim  *
2158ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpPptt
2159ff879b07SJung-uk Kim  *
2160ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A PMTT table
2161ff879b07SJung-uk Kim  *
2162ff879b07SJung-uk Kim  * RETURN:      None
2163ff879b07SJung-uk Kim  *
2164ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a PPTT. This table type consists
2165ff879b07SJung-uk Kim  *              of an open-ended number of subtables.
2166ff879b07SJung-uk Kim  *
2167ff879b07SJung-uk Kim  ******************************************************************************/
2168ff879b07SJung-uk Kim 
2169ff879b07SJung-uk Kim void
2170ff879b07SJung-uk Kim AcpiDmDumpPptt (
2171ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
2172ff879b07SJung-uk Kim {
2173ff879b07SJung-uk Kim     ACPI_STATUS             Status;
2174ff879b07SJung-uk Kim     ACPI_SUBTABLE_HEADER    *Subtable;
2175ff879b07SJung-uk Kim     ACPI_PPTT_PROCESSOR     *PpttProcessor;
2176ff879b07SJung-uk Kim     UINT8                   Length;
2177ff879b07SJung-uk Kim     UINT8                   SubtableOffset;
2178ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
2179ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
2180ff879b07SJung-uk Kim     UINT32                  i;
2181ff879b07SJung-uk Kim 
2182ff879b07SJung-uk Kim 
2183ff879b07SJung-uk Kim     /* There is no main table (other than the standard ACPI header) */
2184ff879b07SJung-uk Kim 
2185ff879b07SJung-uk Kim     /* Subtables */
2186ff879b07SJung-uk Kim 
2187ff879b07SJung-uk Kim     Offset = sizeof (ACPI_TABLE_HEADER);
2188ff879b07SJung-uk Kim     while (Offset < Table->Length)
2189ff879b07SJung-uk Kim     {
2190ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
2191ff879b07SJung-uk Kim 
2192ff879b07SJung-uk Kim         /* Common subtable header */
2193ff879b07SJung-uk Kim 
2194ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2195ff879b07SJung-uk Kim         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
2196ff879b07SJung-uk Kim         {
2197ff879b07SJung-uk Kim             AcpiOsPrintf ("Invalid subtable length\n");
2198ff879b07SJung-uk Kim             return;
2199ff879b07SJung-uk Kim         }
2200ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2201ff879b07SJung-uk Kim             Subtable->Length, AcpiDmTableInfoPpttHdr);
2202ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
2203ff879b07SJung-uk Kim         {
2204ff879b07SJung-uk Kim             return;
2205ff879b07SJung-uk Kim         }
2206ff879b07SJung-uk Kim 
2207ff879b07SJung-uk Kim         switch (Subtable->Type)
2208ff879b07SJung-uk Kim         {
2209ff879b07SJung-uk Kim         case ACPI_PPTT_TYPE_PROCESSOR:
2210ff879b07SJung-uk Kim 
2211ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPptt0;
2212ff879b07SJung-uk Kim             Length = sizeof (ACPI_PPTT_PROCESSOR);
2213ff879b07SJung-uk Kim             break;
2214ff879b07SJung-uk Kim 
2215ff879b07SJung-uk Kim         case ACPI_PPTT_TYPE_CACHE:
2216ff879b07SJung-uk Kim 
2217ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPptt1;
2218ff879b07SJung-uk Kim             Length = sizeof (ACPI_PPTT_CACHE);
2219ff879b07SJung-uk Kim             break;
2220ff879b07SJung-uk Kim 
2221ff879b07SJung-uk Kim         case ACPI_PPTT_TYPE_ID:
2222ff879b07SJung-uk Kim 
2223ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoPptt2;
2224ff879b07SJung-uk Kim             Length = sizeof (ACPI_PPTT_ID);
2225ff879b07SJung-uk Kim             break;
2226ff879b07SJung-uk Kim 
2227ff879b07SJung-uk Kim         default:
2228ff879b07SJung-uk Kim 
2229ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
2230ff879b07SJung-uk Kim                 Subtable->Type);
2231ff879b07SJung-uk Kim 
2232ff879b07SJung-uk Kim             /* Attempt to continue */
2233ff879b07SJung-uk Kim 
2234ff879b07SJung-uk Kim             goto NextSubtable;
2235ff879b07SJung-uk Kim         }
2236ff879b07SJung-uk Kim 
2237ff879b07SJung-uk Kim         if (Subtable->Length < Length)
2238ff879b07SJung-uk Kim         {
2239ff879b07SJung-uk Kim             AcpiOsPrintf ("Invalid subtable length\n");
2240ff879b07SJung-uk Kim             return;
2241ff879b07SJung-uk Kim         }
2242ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2243ff879b07SJung-uk Kim             Subtable->Length, InfoTable);
2244ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
2245ff879b07SJung-uk Kim         {
2246ff879b07SJung-uk Kim             return;
2247ff879b07SJung-uk Kim         }
2248ff879b07SJung-uk Kim         SubtableOffset = Length;
2249ff879b07SJung-uk Kim 
2250ff879b07SJung-uk Kim         switch (Subtable->Type)
2251ff879b07SJung-uk Kim         {
2252ff879b07SJung-uk Kim         case ACPI_PPTT_TYPE_PROCESSOR:
2253ff879b07SJung-uk Kim 
2254ff879b07SJung-uk Kim             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
2255ff879b07SJung-uk Kim 
2256ff879b07SJung-uk Kim             /* Dump SMBIOS handles */
2257ff879b07SJung-uk Kim 
2258ff879b07SJung-uk Kim             if ((UINT8)(Subtable->Length - SubtableOffset) <
2259ff879b07SJung-uk Kim                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
2260ff879b07SJung-uk Kim             {
2261ff879b07SJung-uk Kim                 AcpiOsPrintf ("Invalid private resource number\n");
2262ff879b07SJung-uk Kim                 return;
2263ff879b07SJung-uk Kim             }
2264ff879b07SJung-uk Kim             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
2265ff879b07SJung-uk Kim             {
2266ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2267ff879b07SJung-uk Kim                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2268ff879b07SJung-uk Kim                     4, AcpiDmTableInfoPptt0a);
2269a009b7dcSJung-uk Kim                 if (ACPI_FAILURE (Status))
2270a009b7dcSJung-uk Kim                 {
2271a009b7dcSJung-uk Kim                     return;
2272a009b7dcSJung-uk Kim                 }
2273a009b7dcSJung-uk Kim 
2274ff879b07SJung-uk Kim                 SubtableOffset += 4;
2275ff879b07SJung-uk Kim             }
2276ff879b07SJung-uk Kim             break;
2277ff879b07SJung-uk Kim 
2278cfd1ed46SJung-uk Kim         case ACPI_PPTT_TYPE_CACHE:
2279cfd1ed46SJung-uk Kim 
2280cfd1ed46SJung-uk Kim             if (Table->Revision < 3)
2281cfd1ed46SJung-uk Kim             {
2282cfd1ed46SJung-uk Kim                 break;
2283cfd1ed46SJung-uk Kim             }
2284cfd1ed46SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2285cfd1ed46SJung-uk Kim                 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2286cfd1ed46SJung-uk Kim                 sizeof (ACPI_PPTT_CACHE_V1), AcpiDmTableInfoPptt1a);
2287cfd1ed46SJung-uk Kim             if (ACPI_FAILURE (Status))
2288cfd1ed46SJung-uk Kim             {
2289cfd1ed46SJung-uk Kim                 return;
2290cfd1ed46SJung-uk Kim             }
2291cfd1ed46SJung-uk Kim             break;
2292cfd1ed46SJung-uk Kim 
2293ff879b07SJung-uk Kim         default:
2294ff879b07SJung-uk Kim 
2295ff879b07SJung-uk Kim             break;
2296ff879b07SJung-uk Kim         }
2297ff879b07SJung-uk Kim 
2298ff879b07SJung-uk Kim NextSubtable:
2299ff879b07SJung-uk Kim         /* Point to next subtable */
2300ff879b07SJung-uk Kim 
2301ff879b07SJung-uk Kim         Offset += Subtable->Length;
2302ff879b07SJung-uk Kim     }
2303ff879b07SJung-uk Kim }
2304ff879b07SJung-uk Kim 
2305ff879b07SJung-uk Kim 
2306ff879b07SJung-uk Kim /*******************************************************************************
2307ff879b07SJung-uk Kim  *
23081970d693SJung-uk Kim  * FUNCTION:    AcpiDmDumpPrmt
23091970d693SJung-uk Kim  *
23101970d693SJung-uk Kim  * PARAMETERS:  Table               - A PRMT table
23111970d693SJung-uk Kim  *
23121970d693SJung-uk Kim  * RETURN:      None
23131970d693SJung-uk Kim  *
23141970d693SJung-uk Kim  * DESCRIPTION: Format the contents of a PRMT. This table type consists
23151970d693SJung-uk Kim  *              of an open-ended number of subtables.
23161970d693SJung-uk Kim  *
23171970d693SJung-uk Kim  ******************************************************************************/
23181970d693SJung-uk Kim 
23191970d693SJung-uk Kim void
23201970d693SJung-uk Kim AcpiDmDumpPrmt (
23211970d693SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
23221970d693SJung-uk Kim {
23231970d693SJung-uk Kim     UINT32                  CurrentOffset = sizeof (ACPI_TABLE_HEADER);
23241970d693SJung-uk Kim     ACPI_TABLE_PRMT_HEADER  *PrmtHeader;
23251970d693SJung-uk Kim     ACPI_PRMT_MODULE_INFO   *PrmtModuleInfo;
23261970d693SJung-uk Kim     ACPI_PRMT_HANDLER_INFO  *PrmtHandlerInfo;
23271970d693SJung-uk Kim     ACPI_STATUS             Status;
23281970d693SJung-uk Kim     UINT32                  i, j;
23291970d693SJung-uk Kim 
23301970d693SJung-uk Kim 
23311970d693SJung-uk Kim     /* Main table header */
23321970d693SJung-uk Kim 
23331970d693SJung-uk Kim     PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
23341970d693SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
23351970d693SJung-uk Kim         sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
23361970d693SJung-uk Kim     if (ACPI_FAILURE (Status))
23371970d693SJung-uk Kim     {
23381970d693SJung-uk Kim         AcpiOsPrintf ("Invalid PRMT header\n");
23391970d693SJung-uk Kim         return;
23401970d693SJung-uk Kim     }
23411970d693SJung-uk Kim 
23421970d693SJung-uk Kim     CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER);
23431970d693SJung-uk Kim 
23441970d693SJung-uk Kim     /* PRM Module Information Structure array */
23451970d693SJung-uk Kim 
23461970d693SJung-uk Kim     for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
23471970d693SJung-uk Kim     {
23481970d693SJung-uk Kim         PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
23491970d693SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
23501970d693SJung-uk Kim             sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
23511970d693SJung-uk Kim 
23521970d693SJung-uk Kim         CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
23531970d693SJung-uk Kim 
23541970d693SJung-uk Kim         /* PRM handler information structure array */
23551970d693SJung-uk Kim 
23561970d693SJung-uk Kim         for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
23571970d693SJung-uk Kim         {
23581970d693SJung-uk Kim             PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
23591970d693SJung-uk Kim             Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
23601970d693SJung-uk Kim                 sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
23611970d693SJung-uk Kim 
23621970d693SJung-uk Kim             CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
23631970d693SJung-uk Kim         }
23641970d693SJung-uk Kim     }
23651970d693SJung-uk Kim }
23661970d693SJung-uk Kim 
23671970d693SJung-uk Kim 
23681970d693SJung-uk Kim /*******************************************************************************
23691970d693SJung-uk Kim  *
23701970d693SJung-uk Kim  * FUNCTION:    AcpiDmDumpRgrt
23711970d693SJung-uk Kim  *
23721970d693SJung-uk Kim  * PARAMETERS:  Table               - A RGRT table
23731970d693SJung-uk Kim  *
23741970d693SJung-uk Kim  * RETURN:      None
23751970d693SJung-uk Kim  *
23761970d693SJung-uk Kim  * DESCRIPTION: Format the contents of a RGRT
23771970d693SJung-uk Kim  *
23781970d693SJung-uk Kim  ******************************************************************************/
23791970d693SJung-uk Kim 
23801970d693SJung-uk Kim void
23811970d693SJung-uk Kim AcpiDmDumpRgrt (
23821970d693SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
23831970d693SJung-uk Kim {
23841970d693SJung-uk Kim     ACPI_STATUS             Status;
23851970d693SJung-uk Kim     ACPI_TABLE_RGRT         *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table);
23861970d693SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_RGRT);
23871970d693SJung-uk Kim 
23881970d693SJung-uk Kim 
23891970d693SJung-uk Kim     /* Main table */
23901970d693SJung-uk Kim 
23911970d693SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt);
23921970d693SJung-uk Kim     if (ACPI_FAILURE (Status))
23931970d693SJung-uk Kim     {
23941970d693SJung-uk Kim         return;
23951970d693SJung-uk Kim     }
23961970d693SJung-uk Kim 
23971970d693SJung-uk Kim     /* Dump the binary image as a subtable */
23981970d693SJung-uk Kim 
23991970d693SJung-uk Kim     Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image,
24001970d693SJung-uk Kim         Table->Length - Offset, AcpiDmTableInfoRgrt0);
24011970d693SJung-uk Kim     if (ACPI_FAILURE (Status))
24021970d693SJung-uk Kim     {
24031970d693SJung-uk Kim         return;
24041970d693SJung-uk Kim     }
24051970d693SJung-uk Kim }
24061970d693SJung-uk Kim 
24071970d693SJung-uk Kim 
24081970d693SJung-uk Kim /*******************************************************************************
24091970d693SJung-uk Kim  *
2410ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpS3pt
2411ff879b07SJung-uk Kim  *
2412ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A S3PT table
2413ff879b07SJung-uk Kim  *
2414ff879b07SJung-uk Kim  * RETURN:      Length of the table
2415ff879b07SJung-uk Kim  *
2416ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a S3PT
2417ff879b07SJung-uk Kim  *
2418ff879b07SJung-uk Kim  ******************************************************************************/
2419ff879b07SJung-uk Kim 
2420ff879b07SJung-uk Kim UINT32
2421ff879b07SJung-uk Kim AcpiDmDumpS3pt (
2422ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Tables)
2423ff879b07SJung-uk Kim {
2424ff879b07SJung-uk Kim     ACPI_STATUS             Status;
2425ff879b07SJung-uk Kim     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
2426ff879b07SJung-uk Kim     ACPI_FPDT_HEADER        *Subtable;
2427ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO       *InfoTable;
2428ff879b07SJung-uk Kim     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2429ff879b07SJung-uk Kim 
2430ff879b07SJung-uk Kim 
2431ff879b07SJung-uk Kim     /* Main table */
2432ff879b07SJung-uk Kim 
2433ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2434ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
2435ff879b07SJung-uk Kim     {
2436ff879b07SJung-uk Kim         return 0;
2437ff879b07SJung-uk Kim     }
2438ff879b07SJung-uk Kim 
2439ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
2440ff879b07SJung-uk Kim     while (Offset < S3ptTable->Length)
2441ff879b07SJung-uk Kim     {
2442ff879b07SJung-uk Kim         /* Common subtable header */
2443ff879b07SJung-uk Kim 
2444ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
2445ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2446ff879b07SJung-uk Kim             Subtable->Length, AcpiDmTableInfoS3ptHdr);
2447ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
2448ff879b07SJung-uk Kim         {
2449ff879b07SJung-uk Kim             return 0;
2450ff879b07SJung-uk Kim         }
2451ff879b07SJung-uk Kim 
2452ff879b07SJung-uk Kim         switch (Subtable->Type)
2453ff879b07SJung-uk Kim         {
2454ff879b07SJung-uk Kim         case ACPI_S3PT_TYPE_RESUME:
2455ff879b07SJung-uk Kim 
2456ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoS3pt0;
2457ff879b07SJung-uk Kim             break;
2458ff879b07SJung-uk Kim 
2459ff879b07SJung-uk Kim         case ACPI_S3PT_TYPE_SUSPEND:
2460ff879b07SJung-uk Kim 
2461ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoS3pt1;
2462ff879b07SJung-uk Kim             break;
2463ff879b07SJung-uk Kim 
2464ff879b07SJung-uk Kim         default:
2465ff879b07SJung-uk Kim 
2466ff879b07SJung-uk Kim             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
2467ff879b07SJung-uk Kim                 Subtable->Type);
2468ff879b07SJung-uk Kim 
2469ff879b07SJung-uk Kim             /* Attempt to continue */
2470ff879b07SJung-uk Kim 
2471ff879b07SJung-uk Kim             if (!Subtable->Length)
2472ff879b07SJung-uk Kim             {
2473ff879b07SJung-uk Kim                 AcpiOsPrintf ("Invalid zero length subtable\n");
2474ff879b07SJung-uk Kim                 return 0;
2475ff879b07SJung-uk Kim             }
2476ff879b07SJung-uk Kim             goto NextSubtable;
2477ff879b07SJung-uk Kim         }
2478ff879b07SJung-uk Kim 
2479ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
2480ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2481ff879b07SJung-uk Kim             Subtable->Length, InfoTable);
2482ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
2483ff879b07SJung-uk Kim         {
2484ff879b07SJung-uk Kim             return 0;
2485ff879b07SJung-uk Kim         }
2486ff879b07SJung-uk Kim 
2487ff879b07SJung-uk Kim NextSubtable:
2488ff879b07SJung-uk Kim         /* Point to next subtable */
2489ff879b07SJung-uk Kim 
2490ff879b07SJung-uk Kim         Offset += Subtable->Length;
2491ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
2492ff879b07SJung-uk Kim     }
2493ff879b07SJung-uk Kim 
2494ff879b07SJung-uk Kim     return (S3ptTable->Length);
2495ff879b07SJung-uk Kim }
2496ff879b07SJung-uk Kim 
2497ff879b07SJung-uk Kim 
2498ff879b07SJung-uk Kim /*******************************************************************************
2499ff879b07SJung-uk Kim  *
2500ff879b07SJung-uk Kim  * FUNCTION:    AcpiDmDumpSdev
2501ff879b07SJung-uk Kim  *
2502ff879b07SJung-uk Kim  * PARAMETERS:  Table               - A SDEV table
2503ff879b07SJung-uk Kim  *
2504ff879b07SJung-uk Kim  * RETURN:      None
2505ff879b07SJung-uk Kim  *
2506ff879b07SJung-uk Kim  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
2507ff879b07SJung-uk Kim  *              table that contains variable strings and vendor data.
2508ff879b07SJung-uk Kim  *
2509ff879b07SJung-uk Kim  ******************************************************************************/
2510ff879b07SJung-uk Kim 
2511ff879b07SJung-uk Kim void
2512ff879b07SJung-uk Kim AcpiDmDumpSdev (
2513ff879b07SJung-uk Kim     ACPI_TABLE_HEADER       *Table)
2514ff879b07SJung-uk Kim {
2515ff879b07SJung-uk Kim     ACPI_STATUS                 Status;
2516ff879b07SJung-uk Kim     ACPI_SDEV_HEADER            *Subtable;
2517ff879b07SJung-uk Kim     ACPI_SDEV_PCIE              *Pcie;
2518ff879b07SJung-uk Kim     ACPI_SDEV_NAMESPACE         *Namesp;
2519ff879b07SJung-uk Kim     ACPI_DMTABLE_INFO           *InfoTable;
2520cfd1ed46SJung-uk Kim     ACPI_DMTABLE_INFO           *SecureComponentInfoTable;
2521ff879b07SJung-uk Kim     UINT32                      Length = Table->Length;
2522ff879b07SJung-uk Kim     UINT32                      Offset = sizeof (ACPI_TABLE_SDEV);
2523ff879b07SJung-uk Kim     UINT16                      PathOffset;
2524ff879b07SJung-uk Kim     UINT16                      PathLength;
2525ff879b07SJung-uk Kim     UINT16                      VendorDataOffset;
2526ff879b07SJung-uk Kim     UINT16                      VendorDataLength;
2527cfd1ed46SJung-uk Kim     ACPI_SDEV_SECURE_COMPONENT  *SecureComponent = NULL;
2528cfd1ed46SJung-uk Kim     UINT32                      CurrentOffset = 0;
2529ff879b07SJung-uk Kim 
2530ff879b07SJung-uk Kim 
2531ff879b07SJung-uk Kim     /* Main table */
2532ff879b07SJung-uk Kim 
2533ff879b07SJung-uk Kim     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
2534ff879b07SJung-uk Kim     if (ACPI_FAILURE (Status))
2535ff879b07SJung-uk Kim     {
2536ff879b07SJung-uk Kim         return;
2537ff879b07SJung-uk Kim     }
2538ff879b07SJung-uk Kim 
2539ff879b07SJung-uk Kim     /* Subtables */
2540ff879b07SJung-uk Kim 
2541ff879b07SJung-uk Kim     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
2542ff879b07SJung-uk Kim     while (Offset < Table->Length)
2543ff879b07SJung-uk Kim     {
2544ff879b07SJung-uk Kim         /* Common subtable header */
2545ff879b07SJung-uk Kim 
2546ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
2547ff879b07SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2548ff879b07SJung-uk Kim             Subtable->Length, AcpiDmTableInfoSdevHdr);
2549ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
2550ff879b07SJung-uk Kim         {
2551ff879b07SJung-uk Kim             return;
2552ff879b07SJung-uk Kim         }
2553ff879b07SJung-uk Kim 
2554ff879b07SJung-uk Kim         switch (Subtable->Type)
2555ff879b07SJung-uk Kim         {
2556ff879b07SJung-uk Kim         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2557ff879b07SJung-uk Kim 
2558ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoSdev0;
2559ff879b07SJung-uk Kim             break;
2560ff879b07SJung-uk Kim 
2561ff879b07SJung-uk Kim         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2562ff879b07SJung-uk Kim 
2563ff879b07SJung-uk Kim             InfoTable = AcpiDmTableInfoSdev1;
2564ff879b07SJung-uk Kim             break;
2565ff879b07SJung-uk Kim 
2566ff879b07SJung-uk Kim         default:
2567ff879b07SJung-uk Kim             goto NextSubtable;
2568ff879b07SJung-uk Kim         }
2569ff879b07SJung-uk Kim 
2570ff879b07SJung-uk Kim         AcpiOsPrintf ("\n");
2571cfd1ed46SJung-uk Kim         Status = AcpiDmDumpTable (Table->Length, 0, Subtable,
2572ff879b07SJung-uk Kim             Subtable->Length, InfoTable);
2573ff879b07SJung-uk Kim         if (ACPI_FAILURE (Status))
2574ff879b07SJung-uk Kim         {
2575ff879b07SJung-uk Kim             return;
2576ff879b07SJung-uk Kim         }
2577ff879b07SJung-uk Kim 
2578ff879b07SJung-uk Kim         switch (Subtable->Type)
2579ff879b07SJung-uk Kim         {
2580ff879b07SJung-uk Kim         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2581ff879b07SJung-uk Kim 
2582cfd1ed46SJung-uk Kim             CurrentOffset = sizeof (ACPI_SDEV_NAMESPACE);
2583cfd1ed46SJung-uk Kim             if (Subtable->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
2584cfd1ed46SJung-uk Kim             {
2585cfd1ed46SJung-uk Kim                 SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
2586cfd1ed46SJung-uk Kim                     ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)));
2587cfd1ed46SJung-uk Kim 
2588cfd1ed46SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2589cfd1ed46SJung-uk Kim                     ACPI_ADD_PTR(UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)),
2590cfd1ed46SJung-uk Kim                     sizeof (ACPI_SDEV_SECURE_COMPONENT), AcpiDmTableInfoSdev0b);
2591cfd1ed46SJung-uk Kim                 if (ACPI_FAILURE (Status))
2592cfd1ed46SJung-uk Kim                 {
2593cfd1ed46SJung-uk Kim                     return;
2594cfd1ed46SJung-uk Kim                 }
2595cfd1ed46SJung-uk Kim                 CurrentOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
2596cfd1ed46SJung-uk Kim 
2597cfd1ed46SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2598cfd1ed46SJung-uk Kim                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
2599cfd1ed46SJung-uk Kim                     sizeof (ACPI_SDEV_HEADER), AcpiDmTableInfoSdevSecCompHdr);
2600cfd1ed46SJung-uk Kim                 if (ACPI_FAILURE (Status))
2601cfd1ed46SJung-uk Kim                 {
2602cfd1ed46SJung-uk Kim                     return;
2603cfd1ed46SJung-uk Kim                 }
2604cfd1ed46SJung-uk Kim                 CurrentOffset += sizeof (ACPI_SDEV_HEADER);
2605cfd1ed46SJung-uk Kim 
2606cfd1ed46SJung-uk Kim                 switch (Subtable->Type)
2607cfd1ed46SJung-uk Kim                 {
2608cfd1ed46SJung-uk Kim                 case ACPI_SDEV_TYPE_ID_COMPONENT:
2609cfd1ed46SJung-uk Kim 
2610cfd1ed46SJung-uk Kim                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
2611cfd1ed46SJung-uk Kim                     break;
2612cfd1ed46SJung-uk Kim 
2613cfd1ed46SJung-uk Kim                 case ACPI_SDEV_TYPE_MEM_COMPONENT:
2614cfd1ed46SJung-uk Kim 
2615cfd1ed46SJung-uk Kim                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
2616cfd1ed46SJung-uk Kim                     break;
2617cfd1ed46SJung-uk Kim 
2618cfd1ed46SJung-uk Kim                 default:
2619cfd1ed46SJung-uk Kim                     goto NextSubtable;
2620cfd1ed46SJung-uk Kim                 }
2621cfd1ed46SJung-uk Kim 
2622cfd1ed46SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2623cfd1ed46SJung-uk Kim                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
2624cfd1ed46SJung-uk Kim                     SecureComponent->SecureComponentLength, SecureComponentInfoTable);
2625cfd1ed46SJung-uk Kim                 CurrentOffset += SecureComponent->SecureComponentLength;
2626cfd1ed46SJung-uk Kim             }
2627cfd1ed46SJung-uk Kim 
2628ff879b07SJung-uk Kim             /* Dump the PCIe device ID(s) */
2629ff879b07SJung-uk Kim 
2630ff879b07SJung-uk Kim             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
2631ff879b07SJung-uk Kim             PathOffset = Namesp->DeviceIdOffset;
2632ff879b07SJung-uk Kim             PathLength = Namesp->DeviceIdLength;
2633ff879b07SJung-uk Kim 
2634ff879b07SJung-uk Kim             if (PathLength)
2635ff879b07SJung-uk Kim             {
2636cfd1ed46SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2637ff879b07SJung-uk Kim                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
2638ff879b07SJung-uk Kim                     PathLength, AcpiDmTableInfoSdev0a);
2639ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
2640ff879b07SJung-uk Kim                 {
2641ff879b07SJung-uk Kim                     return;
2642ff879b07SJung-uk Kim                 }
2643cfd1ed46SJung-uk Kim                 CurrentOffset += PathLength;
2644ff879b07SJung-uk Kim             }
2645ff879b07SJung-uk Kim 
2646ff879b07SJung-uk Kim             /* Dump the vendor-specific data */
2647ff879b07SJung-uk Kim 
2648ff879b07SJung-uk Kim             VendorDataLength =
2649ff879b07SJung-uk Kim                 Namesp->VendorDataLength;
2650ff879b07SJung-uk Kim             VendorDataOffset =
2651ff879b07SJung-uk Kim                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
2652ff879b07SJung-uk Kim 
2653ff879b07SJung-uk Kim             if (VendorDataLength)
2654ff879b07SJung-uk Kim             {
2655ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, 0,
2656ff879b07SJung-uk Kim                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
2657ff879b07SJung-uk Kim                     VendorDataLength, AcpiDmTableInfoSdev1b);
2658ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
2659ff879b07SJung-uk Kim                 {
2660ff879b07SJung-uk Kim                     return;
2661ff879b07SJung-uk Kim                 }
2662ff879b07SJung-uk Kim             }
2663ff879b07SJung-uk Kim             break;
2664ff879b07SJung-uk Kim 
2665ff879b07SJung-uk Kim         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2666ff879b07SJung-uk Kim 
2667ff879b07SJung-uk Kim             /* PCI path substructures */
2668ff879b07SJung-uk Kim 
2669ff879b07SJung-uk Kim             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
2670ff879b07SJung-uk Kim             PathOffset = Pcie->PathOffset;
2671ff879b07SJung-uk Kim             PathLength = Pcie->PathLength;
2672ff879b07SJung-uk Kim 
2673ff879b07SJung-uk Kim             while (PathLength)
2674ff879b07SJung-uk Kim             {
2675ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length,
2676ff879b07SJung-uk Kim                     PathOffset + Offset,
2677ff879b07SJung-uk Kim                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
2678ff879b07SJung-uk Kim                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
2679ff879b07SJung-uk Kim                 if (ACPI_FAILURE (Status))
2680ff879b07SJung-uk Kim                 {
2681ff879b07SJung-uk Kim                     return;
2682ff879b07SJung-uk Kim                 }
2683ff879b07SJung-uk Kim 
2684ff879b07SJung-uk Kim                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
2685ff879b07SJung-uk Kim                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
2686ff879b07SJung-uk Kim             }
2687ff879b07SJung-uk Kim 
2688ff879b07SJung-uk Kim             /* VendorData */
2689ff879b07SJung-uk Kim 
2690ff879b07SJung-uk Kim             VendorDataLength = Pcie->VendorDataLength;
2691ff879b07SJung-uk Kim             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
2692ff879b07SJung-uk Kim 
2693ff879b07SJung-uk Kim             if (VendorDataLength)
2694ff879b07SJung-uk Kim             {
2695ff879b07SJung-uk Kim                 Status = AcpiDmDumpTable (Table->Length, 0,
2696ff879b07SJung-uk Kim                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
2697ff879b07SJung-uk Kim                     VendorDataLength, AcpiDmTableInfoSdev1b);
2698a009b7dcSJung-uk Kim                 if (ACPI_FAILURE (Status))
2699a009b7dcSJung-uk Kim                 {
2700a009b7dcSJung-uk Kim                     return;
2701a009b7dcSJung-uk Kim                 }
2702ff879b07SJung-uk Kim             }
2703ff879b07SJung-uk Kim             break;
2704ff879b07SJung-uk Kim 
2705ff879b07SJung-uk Kim         default:
2706ff879b07SJung-uk Kim             goto NextSubtable;
2707ff879b07SJung-uk Kim         }
2708ff879b07SJung-uk Kim 
2709ff879b07SJung-uk Kim NextSubtable:
2710ff879b07SJung-uk Kim         /* Point to next subtable */
2711ff879b07SJung-uk Kim 
2712ff879b07SJung-uk Kim         Offset += Subtable->Length;
2713ff879b07SJung-uk Kim         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
2714ff879b07SJung-uk Kim             Subtable->Length);
2715ff879b07SJung-uk Kim     }
2716ff879b07SJung-uk Kim }
2717