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 *
11722b1667SJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2023, 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
1529a4bc520SJung-uk Kim #include <wchar.h>
153ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
154ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
155ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h>
156ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/actables.h>
1571970d693SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h>
158ff879b07SJung-uk Kim
159ff879b07SJung-uk Kim /* This module used for application-level code only */
160ff879b07SJung-uk Kim
161ff879b07SJung-uk Kim #define _COMPONENT ACPI_CA_DISASSEMBLER
162ff879b07SJung-uk Kim ACPI_MODULE_NAME ("dmtbdump2")
163ff879b07SJung-uk Kim
164ff879b07SJung-uk Kim
165ff879b07SJung-uk Kim /*******************************************************************************
166ff879b07SJung-uk Kim *
167ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpIort
168ff879b07SJung-uk Kim *
169ff879b07SJung-uk Kim * PARAMETERS: Table - A IORT table
170ff879b07SJung-uk Kim *
171ff879b07SJung-uk Kim * RETURN: None
172ff879b07SJung-uk Kim *
173ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a IORT
174ff879b07SJung-uk Kim *
175ff879b07SJung-uk Kim ******************************************************************************/
176ff879b07SJung-uk Kim
177ff879b07SJung-uk Kim void
AcpiDmDumpIort(ACPI_TABLE_HEADER * Table)178ff879b07SJung-uk Kim AcpiDmDumpIort (
179ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
180ff879b07SJung-uk Kim {
181ff879b07SJung-uk Kim ACPI_STATUS Status;
182ff879b07SJung-uk Kim ACPI_TABLE_IORT *Iort;
183ff879b07SJung-uk Kim ACPI_IORT_NODE *IortNode;
184ff879b07SJung-uk Kim ACPI_IORT_ITS_GROUP *IortItsGroup = NULL;
185ff879b07SJung-uk Kim ACPI_IORT_SMMU *IortSmmu = NULL;
186cfd1ed46SJung-uk Kim ACPI_IORT_RMR *IortRmr = NULL;
187ff879b07SJung-uk Kim UINT32 Offset;
188ff879b07SJung-uk Kim UINT32 NodeOffset;
189ff879b07SJung-uk Kim UINT32 Length;
190ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
191ff879b07SJung-uk Kim char *String;
192ff879b07SJung-uk Kim UINT32 i;
193a009b7dcSJung-uk Kim UINT32 MappingByteLength;
194cfd1ed46SJung-uk Kim UINT8 Revision;
195ff879b07SJung-uk Kim
196ff879b07SJung-uk Kim
197ff879b07SJung-uk Kim /* Main table */
198ff879b07SJung-uk Kim
199ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
200ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
201ff879b07SJung-uk Kim {
202ff879b07SJung-uk Kim return;
203ff879b07SJung-uk Kim }
204ff879b07SJung-uk Kim
205cfd1ed46SJung-uk Kim Revision = Table->Revision;
206cfd1ed46SJung-uk Kim
207ab71bbb7SJung-uk Kim /* IORT Revisions E, E.a and E.c have known issues and are not supported */
208cfd1ed46SJung-uk Kim
209ab71bbb7SJung-uk Kim if (Revision == 1 || Revision == 2 || Revision == 4)
210cfd1ed46SJung-uk Kim {
211cfd1ed46SJung-uk Kim AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n",
212cfd1ed46SJung-uk Kim Revision);
213cfd1ed46SJung-uk Kim return;
214cfd1ed46SJung-uk Kim }
215cfd1ed46SJung-uk Kim
216ff879b07SJung-uk Kim Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
217ff879b07SJung-uk Kim Offset = sizeof (ACPI_TABLE_IORT);
218ff879b07SJung-uk Kim
219ff879b07SJung-uk Kim /* Dump the OptionalPadding (optional) */
220ff879b07SJung-uk Kim
221ff879b07SJung-uk Kim if (Iort->NodeOffset > Offset)
222ff879b07SJung-uk Kim {
223ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Table,
224ff879b07SJung-uk Kim Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
225ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
226ff879b07SJung-uk Kim {
227ff879b07SJung-uk Kim return;
228ff879b07SJung-uk Kim }
229ff879b07SJung-uk Kim }
230ff879b07SJung-uk Kim
231ff879b07SJung-uk Kim Offset = Iort->NodeOffset;
232ff879b07SJung-uk Kim while (Offset < Table->Length)
233ff879b07SJung-uk Kim {
234ff879b07SJung-uk Kim /* Common subtable header */
235ff879b07SJung-uk Kim
236ff879b07SJung-uk Kim IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
237ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
238ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
239cfd1ed46SJung-uk Kim
240cfd1ed46SJung-uk Kim if (Revision == 0)
241cfd1ed46SJung-uk Kim {
242ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset,
243ff879b07SJung-uk Kim IortNode, Length, AcpiDmTableInfoIortHdr);
244cfd1ed46SJung-uk Kim }
245cfd1ed46SJung-uk Kim else if (Revision >= 3)
246cfd1ed46SJung-uk Kim {
247cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset,
248cfd1ed46SJung-uk Kim IortNode, Length, AcpiDmTableInfoIortHdr3);
249cfd1ed46SJung-uk Kim }
250cfd1ed46SJung-uk Kim
251ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
252ff879b07SJung-uk Kim {
253ff879b07SJung-uk Kim return;
254ff879b07SJung-uk Kim }
255ff879b07SJung-uk Kim
256ff879b07SJung-uk Kim NodeOffset = Length;
257ff879b07SJung-uk Kim
258ff879b07SJung-uk Kim switch (IortNode->Type)
259ff879b07SJung-uk Kim {
260ff879b07SJung-uk Kim case ACPI_IORT_NODE_ITS_GROUP:
261ff879b07SJung-uk Kim
262ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort0;
263ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
264ff879b07SJung-uk Kim IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
265ff879b07SJung-uk Kim break;
266ff879b07SJung-uk Kim
267ff879b07SJung-uk Kim case ACPI_IORT_NODE_NAMED_COMPONENT:
268ff879b07SJung-uk Kim
269ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort1;
270ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
271ff879b07SJung-uk Kim String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
272ff879b07SJung-uk Kim Length += strlen (String) + 1;
273ff879b07SJung-uk Kim break;
274ff879b07SJung-uk Kim
275ff879b07SJung-uk Kim case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
276ff879b07SJung-uk Kim
277ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort2;
278ff879b07SJung-uk Kim Length = IortNode->Length - NodeOffset;
279ff879b07SJung-uk Kim break;
280ff879b07SJung-uk Kim
281ff879b07SJung-uk Kim case ACPI_IORT_NODE_SMMU:
282ff879b07SJung-uk Kim
283ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort3;
284ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
285ff879b07SJung-uk Kim IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
286ff879b07SJung-uk Kim break;
287ff879b07SJung-uk Kim
288ff879b07SJung-uk Kim case ACPI_IORT_NODE_SMMU_V3:
289ff879b07SJung-uk Kim
290ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort4;
291ff879b07SJung-uk Kim Length = IortNode->Length - NodeOffset;
292ff879b07SJung-uk Kim break;
293ff879b07SJung-uk Kim
2943d90091dSJung-uk Kim case ACPI_IORT_NODE_PMCG:
2953d90091dSJung-uk Kim
2963d90091dSJung-uk Kim InfoTable = AcpiDmTableInfoIort5;
2973d90091dSJung-uk Kim Length = IortNode->Length - NodeOffset;
2983d90091dSJung-uk Kim break;
2993d90091dSJung-uk Kim
300cfd1ed46SJung-uk Kim case ACPI_IORT_NODE_RMR:
301cfd1ed46SJung-uk Kim
302cfd1ed46SJung-uk Kim InfoTable = AcpiDmTableInfoIort6;
303cfd1ed46SJung-uk Kim Length = IortNode->Length - NodeOffset;
304cfd1ed46SJung-uk Kim IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset);
305cfd1ed46SJung-uk Kim break;
306cfd1ed46SJung-uk Kim
307ff879b07SJung-uk Kim default:
308ff879b07SJung-uk Kim
309ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
310ff879b07SJung-uk Kim IortNode->Type);
311ff879b07SJung-uk Kim
312ff879b07SJung-uk Kim /* Attempt to continue */
313ff879b07SJung-uk Kim
314ff879b07SJung-uk Kim if (!IortNode->Length)
315ff879b07SJung-uk Kim {
316ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length IORT node\n");
317ff879b07SJung-uk Kim return;
318ff879b07SJung-uk Kim }
319ff879b07SJung-uk Kim goto NextSubtable;
320ff879b07SJung-uk Kim }
321ff879b07SJung-uk Kim
322ff879b07SJung-uk Kim /* Dump the node subtable header */
323ff879b07SJung-uk Kim
324ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
325ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
326ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
327ff879b07SJung-uk Kim Length, InfoTable);
328ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
329ff879b07SJung-uk Kim {
330ff879b07SJung-uk Kim return;
331ff879b07SJung-uk Kim }
332ff879b07SJung-uk Kim
333ff879b07SJung-uk Kim NodeOffset += Length;
334ff879b07SJung-uk Kim
335ff879b07SJung-uk Kim /* Dump the node specific data */
336ff879b07SJung-uk Kim
337ff879b07SJung-uk Kim switch (IortNode->Type)
338ff879b07SJung-uk Kim {
339ff879b07SJung-uk Kim case ACPI_IORT_NODE_ITS_GROUP:
340ff879b07SJung-uk Kim
341ff879b07SJung-uk Kim /* Validate IortItsGroup to avoid compiler warnings */
342ff879b07SJung-uk Kim
343ff879b07SJung-uk Kim if (IortItsGroup)
344ff879b07SJung-uk Kim {
345ff879b07SJung-uk Kim for (i = 0; i < IortItsGroup->ItsCount; i++)
346ff879b07SJung-uk Kim {
347ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
348ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
349ff879b07SJung-uk Kim 4, AcpiDmTableInfoIort0a);
350a009b7dcSJung-uk Kim if (ACPI_FAILURE (Status))
351a009b7dcSJung-uk Kim {
352a009b7dcSJung-uk Kim return;
353a009b7dcSJung-uk Kim }
354a009b7dcSJung-uk Kim
355ff879b07SJung-uk Kim NodeOffset += 4;
356ff879b07SJung-uk Kim }
357ff879b07SJung-uk Kim }
358ff879b07SJung-uk Kim break;
359ff879b07SJung-uk Kim
360ff879b07SJung-uk Kim case ACPI_IORT_NODE_NAMED_COMPONENT:
361ff879b07SJung-uk Kim
362ff879b07SJung-uk Kim /* Dump the Padding (optional) */
363ff879b07SJung-uk Kim
364ff879b07SJung-uk Kim if (IortNode->Length > NodeOffset)
365ff879b07SJung-uk Kim {
366a009b7dcSJung-uk Kim MappingByteLength =
367a009b7dcSJung-uk Kim IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
368ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
369a009b7dcSJung-uk Kim Table, IortNode->Length - NodeOffset - MappingByteLength,
370ff879b07SJung-uk Kim AcpiDmTableInfoIort1a);
371ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
372ff879b07SJung-uk Kim {
373ff879b07SJung-uk Kim return;
374ff879b07SJung-uk Kim }
375ff879b07SJung-uk Kim }
376ff879b07SJung-uk Kim break;
377ff879b07SJung-uk Kim
378ff879b07SJung-uk Kim case ACPI_IORT_NODE_SMMU:
379ff879b07SJung-uk Kim
380ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
381ff879b07SJung-uk Kim
382ff879b07SJung-uk Kim /* Validate IortSmmu to avoid compiler warnings */
383ff879b07SJung-uk Kim
384ff879b07SJung-uk Kim if (IortSmmu)
385ff879b07SJung-uk Kim {
386ff879b07SJung-uk Kim Length = 2 * sizeof (UINT64);
387ff879b07SJung-uk Kim NodeOffset = IortSmmu->GlobalInterruptOffset;
388ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
389ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
390ff879b07SJung-uk Kim Length, AcpiDmTableInfoIort3a);
391ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
392ff879b07SJung-uk Kim {
393ff879b07SJung-uk Kim return;
394ff879b07SJung-uk Kim }
395ff879b07SJung-uk Kim
396ff879b07SJung-uk Kim NodeOffset = IortSmmu->ContextInterruptOffset;
397ff879b07SJung-uk Kim for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
398ff879b07SJung-uk Kim {
399ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
400ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
401ff879b07SJung-uk Kim 8, AcpiDmTableInfoIort3b);
402ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
403ff879b07SJung-uk Kim {
404ff879b07SJung-uk Kim return;
405ff879b07SJung-uk Kim }
406ff879b07SJung-uk Kim
407ff879b07SJung-uk Kim NodeOffset += 8;
408ff879b07SJung-uk Kim }
409ff879b07SJung-uk Kim
410ff879b07SJung-uk Kim NodeOffset = IortSmmu->PmuInterruptOffset;
411ff879b07SJung-uk Kim for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
412ff879b07SJung-uk Kim {
413ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
414ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
415ff879b07SJung-uk Kim 8, AcpiDmTableInfoIort3c);
416ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
417ff879b07SJung-uk Kim {
418ff879b07SJung-uk Kim return;
419ff879b07SJung-uk Kim }
420ff879b07SJung-uk Kim
421ff879b07SJung-uk Kim NodeOffset += 8;
422ff879b07SJung-uk Kim }
423ff879b07SJung-uk Kim }
424ff879b07SJung-uk Kim break;
425ff879b07SJung-uk Kim
426cfd1ed46SJung-uk Kim case ACPI_IORT_NODE_RMR:
427cfd1ed46SJung-uk Kim
428cfd1ed46SJung-uk Kim /* Validate IortRmr to avoid compiler warnings */
429cfd1ed46SJung-uk Kim if (IortRmr)
430cfd1ed46SJung-uk Kim {
431cfd1ed46SJung-uk Kim NodeOffset = IortRmr->RmrOffset;
432cfd1ed46SJung-uk Kim Length = sizeof (ACPI_IORT_RMR_DESC);
433cfd1ed46SJung-uk Kim for (i = 0; i < IortRmr->RmrCount; i++)
434cfd1ed46SJung-uk Kim {
435cfd1ed46SJung-uk Kim AcpiOsPrintf ("\n");
436cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
437cfd1ed46SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
438cfd1ed46SJung-uk Kim Length, AcpiDmTableInfoIort6a);
439cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
440cfd1ed46SJung-uk Kim {
441cfd1ed46SJung-uk Kim return;
442cfd1ed46SJung-uk Kim }
443cfd1ed46SJung-uk Kim
444cfd1ed46SJung-uk Kim NodeOffset += Length;
445cfd1ed46SJung-uk Kim }
446cfd1ed46SJung-uk Kim }
447cfd1ed46SJung-uk Kim break;
448cfd1ed46SJung-uk Kim
449ff879b07SJung-uk Kim default:
450ff879b07SJung-uk Kim
451ff879b07SJung-uk Kim break;
452ff879b07SJung-uk Kim }
453ff879b07SJung-uk Kim
454ff879b07SJung-uk Kim /* Dump the ID mappings */
455ff879b07SJung-uk Kim
456ff879b07SJung-uk Kim NodeOffset = IortNode->MappingOffset;
457ff879b07SJung-uk Kim for (i = 0; i < IortNode->MappingCount; i++)
458ff879b07SJung-uk Kim {
459ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
460ff879b07SJung-uk Kim Length = sizeof (ACPI_IORT_ID_MAPPING);
461ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
462ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
463ff879b07SJung-uk Kim Length, AcpiDmTableInfoIortMap);
464ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
465ff879b07SJung-uk Kim {
466ff879b07SJung-uk Kim return;
467ff879b07SJung-uk Kim }
468ff879b07SJung-uk Kim
469ff879b07SJung-uk Kim NodeOffset += Length;
470ff879b07SJung-uk Kim }
471ff879b07SJung-uk Kim
472ff879b07SJung-uk Kim NextSubtable:
473ff879b07SJung-uk Kim /* Point to next node subtable */
474ff879b07SJung-uk Kim
475ff879b07SJung-uk Kim Offset += IortNode->Length;
476ff879b07SJung-uk Kim }
477ff879b07SJung-uk Kim }
478ff879b07SJung-uk Kim
479ff879b07SJung-uk Kim
480ff879b07SJung-uk Kim /*******************************************************************************
481ff879b07SJung-uk Kim *
482ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpIvrs
483ff879b07SJung-uk Kim *
484ff879b07SJung-uk Kim * PARAMETERS: Table - A IVRS table
485ff879b07SJung-uk Kim *
486ff879b07SJung-uk Kim * RETURN: None
487ff879b07SJung-uk Kim *
4881970d693SJung-uk Kim * DESCRIPTION: Format the contents of a IVRS. Notes:
4891970d693SJung-uk Kim * The IVRS is essentially a flat table, with the following
4901970d693SJung-uk Kim * structure:
4911970d693SJung-uk Kim * <Main ACPI Table Header>
4921970d693SJung-uk Kim * <Main subtable - virtualization info>
4931970d693SJung-uk Kim * <IVHD>
4941970d693SJung-uk Kim * <Device Entries>
4951970d693SJung-uk Kim * ...
4961970d693SJung-uk Kim * <IVHD>
4971970d693SJung-uk Kim * <Device Entries>
4981970d693SJung-uk Kim * <IVMD>
4991970d693SJung-uk Kim * ...
500ff879b07SJung-uk Kim *
501ff879b07SJung-uk Kim ******************************************************************************/
502ff879b07SJung-uk Kim
503ff879b07SJung-uk Kim void
AcpiDmDumpIvrs(ACPI_TABLE_HEADER * Table)504ff879b07SJung-uk Kim AcpiDmDumpIvrs (
505ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
506ff879b07SJung-uk Kim {
507ff879b07SJung-uk Kim ACPI_STATUS Status;
508ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
509ff879b07SJung-uk Kim UINT32 EntryOffset;
510ff879b07SJung-uk Kim UINT32 EntryLength;
511ff879b07SJung-uk Kim UINT32 EntryType;
512cfd1ed46SJung-uk Kim ACPI_IVRS_DEVICE_HID *HidSubtable;
513ff879b07SJung-uk Kim ACPI_IVRS_DE_HEADER *DeviceEntry;
514ff879b07SJung-uk Kim ACPI_IVRS_HEADER *Subtable;
515ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
516ff879b07SJung-uk Kim
517ff879b07SJung-uk Kim
518ff879b07SJung-uk Kim /* Main table */
519ff879b07SJung-uk Kim
520ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
521ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
522ff879b07SJung-uk Kim {
523ff879b07SJung-uk Kim return;
524ff879b07SJung-uk Kim }
525ff879b07SJung-uk Kim
526ff879b07SJung-uk Kim /* Subtables */
527ff879b07SJung-uk Kim
528ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
5291970d693SJung-uk Kim
530ff879b07SJung-uk Kim while (Offset < Table->Length)
531ff879b07SJung-uk Kim {
532ff879b07SJung-uk Kim switch (Subtable->Type)
533ff879b07SJung-uk Kim {
5341970d693SJung-uk Kim /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */
5351970d693SJung-uk Kim
5363ee58df5SJung-uk Kim case ACPI_IVRS_TYPE_HARDWARE1:
537ff879b07SJung-uk Kim
5381970d693SJung-uk Kim AcpiOsPrintf ("\n");
5391970d693SJung-uk Kim InfoTable = AcpiDmTableInfoIvrsHware1;
540ff879b07SJung-uk Kim break;
541ff879b07SJung-uk Kim
5421970d693SJung-uk Kim /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */
5431970d693SJung-uk Kim
5443ee58df5SJung-uk Kim case ACPI_IVRS_TYPE_HARDWARE2:
545cfd1ed46SJung-uk Kim case ACPI_IVRS_TYPE_HARDWARE3:
5463ee58df5SJung-uk Kim
5471970d693SJung-uk Kim AcpiOsPrintf ("\n");
5481970d693SJung-uk Kim InfoTable = AcpiDmTableInfoIvrsHware23;
5493ee58df5SJung-uk Kim break;
5503ee58df5SJung-uk Kim
5511970d693SJung-uk Kim /* Types 20h-22h, IVMD (I/O Virtualization Memory Definition Block) */
5521970d693SJung-uk Kim
553ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_MEMORY1:
554ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_MEMORY2:
555ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_MEMORY3:
556ff879b07SJung-uk Kim
5571970d693SJung-uk Kim AcpiOsPrintf ("\n");
5581970d693SJung-uk Kim InfoTable = AcpiDmTableInfoIvrsMemory;
559ff879b07SJung-uk Kim break;
560ff879b07SJung-uk Kim
561ff879b07SJung-uk Kim default:
562ff879b07SJung-uk Kim
563ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
564ff879b07SJung-uk Kim Subtable->Type);
565ff879b07SJung-uk Kim
566ff879b07SJung-uk Kim /* Attempt to continue */
567ff879b07SJung-uk Kim
568ff879b07SJung-uk Kim if (!Subtable->Length)
569ff879b07SJung-uk Kim {
570ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n");
571ff879b07SJung-uk Kim return;
572ff879b07SJung-uk Kim }
573ff879b07SJung-uk Kim goto NextSubtable;
574ff879b07SJung-uk Kim }
575ff879b07SJung-uk Kim
576ff879b07SJung-uk Kim /* Dump the subtable */
577ff879b07SJung-uk Kim
578ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
579ff879b07SJung-uk Kim Subtable->Length, InfoTable);
580ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
581ff879b07SJung-uk Kim {
582ff879b07SJung-uk Kim return;
583ff879b07SJung-uk Kim }
584ff879b07SJung-uk Kim
5851970d693SJung-uk Kim /* The hardware subtables (IVHD) can contain multiple device entries */
586ff879b07SJung-uk Kim
5873ee58df5SJung-uk Kim if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
588cfd1ed46SJung-uk Kim Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 ||
589cfd1ed46SJung-uk Kim Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3)
590ff879b07SJung-uk Kim {
5913ee58df5SJung-uk Kim if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
5923ee58df5SJung-uk Kim {
5933ee58df5SJung-uk Kim EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
594ff879b07SJung-uk Kim DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
5953ee58df5SJung-uk Kim sizeof (ACPI_IVRS_HARDWARE1));
5963ee58df5SJung-uk Kim }
59708ddfe86SJung-uk Kim else
5983ee58df5SJung-uk Kim {
5991970d693SJung-uk Kim /* ACPI_IVRS_TYPE_HARDWARE2, HARDWARE3 subtable types */
60008ddfe86SJung-uk Kim
6013ee58df5SJung-uk Kim EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
6023ee58df5SJung-uk Kim DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
6033ee58df5SJung-uk Kim sizeof (ACPI_IVRS_HARDWARE2));
6043ee58df5SJung-uk Kim }
605ff879b07SJung-uk Kim
6061970d693SJung-uk Kim /* Process all of the Device Entries */
6071970d693SJung-uk Kim
608ff879b07SJung-uk Kim while (EntryOffset < (Offset + Subtable->Length))
609ff879b07SJung-uk Kim {
610ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
6111970d693SJung-uk Kim
612ff879b07SJung-uk Kim /*
613ff879b07SJung-uk Kim * Upper 2 bits of Type encode the length of the device entry
614ff879b07SJung-uk Kim *
615ff879b07SJung-uk Kim * 00 = 4 byte
616ff879b07SJung-uk Kim * 01 = 8 byte
617cfd1ed46SJung-uk Kim * 1x = variable length
618ff879b07SJung-uk Kim */
619ff879b07SJung-uk Kim EntryType = DeviceEntry->Type;
620cfd1ed46SJung-uk Kim EntryLength = EntryType >> 6 == 1 ? 8 : 4;
621ff879b07SJung-uk Kim
622ff879b07SJung-uk Kim switch (EntryType)
623ff879b07SJung-uk Kim {
624ff879b07SJung-uk Kim /* 4-byte device entries */
625ff879b07SJung-uk Kim
626ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_PAD4:
627ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_ALL:
628ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_SELECT:
629ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_START:
630ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_END:
631ff879b07SJung-uk Kim
632ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs4;
633ff879b07SJung-uk Kim break;
634ff879b07SJung-uk Kim
635ff879b07SJung-uk Kim /* 8-byte entries, type A */
636ff879b07SJung-uk Kim
637ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_ALIAS_SELECT:
638ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_ALIAS_START:
639ff879b07SJung-uk Kim
640ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs8a;
641ff879b07SJung-uk Kim break;
642ff879b07SJung-uk Kim
643ff879b07SJung-uk Kim /* 8-byte entries, type B */
644ff879b07SJung-uk Kim
645ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_PAD8:
646ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_EXT_SELECT:
647ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_EXT_START:
648ff879b07SJung-uk Kim
649ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs8b;
650ff879b07SJung-uk Kim break;
651ff879b07SJung-uk Kim
652ff879b07SJung-uk Kim /* 8-byte entries, type C */
653ff879b07SJung-uk Kim
654ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_SPECIAL:
655ff879b07SJung-uk Kim
656ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs8c;
657ff879b07SJung-uk Kim break;
658ff879b07SJung-uk Kim
659cfd1ed46SJung-uk Kim /* Variable-length entries */
660cfd1ed46SJung-uk Kim
661cfd1ed46SJung-uk Kim case ACPI_IVRS_TYPE_HID:
662cfd1ed46SJung-uk Kim
6631970d693SJung-uk Kim EntryLength = 4;
664cfd1ed46SJung-uk Kim InfoTable = AcpiDmTableInfoIvrsHid;
665cfd1ed46SJung-uk Kim break;
666cfd1ed46SJung-uk Kim
667ff879b07SJung-uk Kim default:
668ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs4;
669ff879b07SJung-uk Kim AcpiOsPrintf (
670ff879b07SJung-uk Kim "\n**** Unknown IVRS device entry type/length: "
671ff879b07SJung-uk Kim "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
672ff879b07SJung-uk Kim EntryType, EntryLength, EntryOffset);
673ff879b07SJung-uk Kim break;
674ff879b07SJung-uk Kim }
675ff879b07SJung-uk Kim
676ff879b07SJung-uk Kim /* Dump the Device Entry */
677ff879b07SJung-uk Kim
678ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
679ff879b07SJung-uk Kim DeviceEntry, EntryLength, InfoTable);
680ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
681ff879b07SJung-uk Kim {
682ff879b07SJung-uk Kim return;
683ff879b07SJung-uk Kim }
684ff879b07SJung-uk Kim
685cfd1ed46SJung-uk Kim HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry);
686ff879b07SJung-uk Kim EntryOffset += EntryLength;
6871970d693SJung-uk Kim DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, HidSubtable,
688ff879b07SJung-uk Kim EntryLength);
689cfd1ed46SJung-uk Kim
690cfd1ed46SJung-uk Kim if (EntryType == ACPI_IVRS_TYPE_HID)
691cfd1ed46SJung-uk Kim {
6921970d693SJung-uk Kim /*
6931970d693SJung-uk Kim * Determine if the HID is an integer or a string.
6941970d693SJung-uk Kim * An integer is defined to be 32 bits, with the upper 32 bits
6951970d693SJung-uk Kim * set to zero. (from the ACPI Spec): "The HID can be a 32-bit
6961970d693SJung-uk Kim * integer or a character string. If an integer, the lower
6971970d693SJung-uk Kim * 4 bytes of the field contain the integer and the upper
6981970d693SJung-uk Kim * 4 bytes are padded with 0".
6991970d693SJung-uk Kim */
7001970d693SJung-uk Kim if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid))
7011970d693SJung-uk Kim {
702cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7031970d693SJung-uk Kim &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger);
7041970d693SJung-uk Kim }
7051970d693SJung-uk Kim else
7061970d693SJung-uk Kim {
7071970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7081970d693SJung-uk Kim &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString);
7091970d693SJung-uk Kim }
710cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
711cfd1ed46SJung-uk Kim {
712cfd1ed46SJung-uk Kim return;
713cfd1ed46SJung-uk Kim }
7141970d693SJung-uk Kim
7151970d693SJung-uk Kim EntryOffset += 8;
7161970d693SJung-uk Kim
7171970d693SJung-uk Kim /*
7181970d693SJung-uk Kim * Determine if the CID is an integer or a string. The format
7191970d693SJung-uk Kim * of the CID is the same as the HID above. From ACPI Spec:
7201970d693SJung-uk Kim * "If present, CID must be a single Compatible Device ID
7211970d693SJung-uk Kim * following the same format as the HID field."
7221970d693SJung-uk Kim */
7231970d693SJung-uk Kim if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid))
7241970d693SJung-uk Kim {
7251970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7261970d693SJung-uk Kim &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger);
7271970d693SJung-uk Kim }
7281970d693SJung-uk Kim else
7291970d693SJung-uk Kim {
7301970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7311970d693SJung-uk Kim &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString);
7321970d693SJung-uk Kim }
7331970d693SJung-uk Kim if (ACPI_FAILURE (Status))
7341970d693SJung-uk Kim {
7351970d693SJung-uk Kim return;
7361970d693SJung-uk Kim }
7371970d693SJung-uk Kim
7381970d693SJung-uk Kim EntryOffset += 8;
7391970d693SJung-uk Kim EntryLength = HidSubtable->UidLength;
7401970d693SJung-uk Kim
7411970d693SJung-uk Kim if (EntryLength > ACPI_IVRS_UID_NOT_PRESENT)
7421970d693SJung-uk Kim {
7431970d693SJung-uk Kim /* Dump the UID based upon the UidType field (String or Integer) */
7441970d693SJung-uk Kim
7451970d693SJung-uk Kim if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING)
7461970d693SJung-uk Kim {
7471970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7481970d693SJung-uk Kim &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString);
7491970d693SJung-uk Kim if (ACPI_FAILURE (Status))
7501970d693SJung-uk Kim {
7511970d693SJung-uk Kim return;
7521970d693SJung-uk Kim }
7531970d693SJung-uk Kim }
7541970d693SJung-uk Kim else /* ACPI_IVRS_UID_IS_INTEGER */
7551970d693SJung-uk Kim {
7561970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset,
7571970d693SJung-uk Kim &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger);
7581970d693SJung-uk Kim if (ACPI_FAILURE (Status))
7591970d693SJung-uk Kim {
7601970d693SJung-uk Kim return;
7611970d693SJung-uk Kim }
7621970d693SJung-uk Kim }
7631970d693SJung-uk Kim }
7641970d693SJung-uk Kim
7651970d693SJung-uk Kim EntryOffset += EntryLength+2;
766cfd1ed46SJung-uk Kim DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER,
7671970d693SJung-uk Kim Table, EntryOffset);
768cfd1ed46SJung-uk Kim }
769ff879b07SJung-uk Kim }
770ff879b07SJung-uk Kim }
771ff879b07SJung-uk Kim
772ff879b07SJung-uk Kim NextSubtable:
773ff879b07SJung-uk Kim /* Point to next subtable */
774ff879b07SJung-uk Kim
775ff879b07SJung-uk Kim Offset += Subtable->Length;
776ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
777ff879b07SJung-uk Kim }
778ff879b07SJung-uk Kim }
779ff879b07SJung-uk Kim
780ff879b07SJung-uk Kim
781ff879b07SJung-uk Kim /*******************************************************************************
782ff879b07SJung-uk Kim *
783ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpLpit
784ff879b07SJung-uk Kim *
785ff879b07SJung-uk Kim * PARAMETERS: Table - A LPIT table
786ff879b07SJung-uk Kim *
787ff879b07SJung-uk Kim * RETURN: None
788ff879b07SJung-uk Kim *
789ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a LPIT. This table type consists
790ff879b07SJung-uk Kim * of an open-ended number of subtables. Note: There are no
791ff879b07SJung-uk Kim * entries in the main table. An LPIT consists of the table
792ff879b07SJung-uk Kim * header and then subtables only.
793ff879b07SJung-uk Kim *
794ff879b07SJung-uk Kim ******************************************************************************/
795ff879b07SJung-uk Kim
796ff879b07SJung-uk Kim void
AcpiDmDumpLpit(ACPI_TABLE_HEADER * Table)797ff879b07SJung-uk Kim AcpiDmDumpLpit (
798ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
799ff879b07SJung-uk Kim {
800ff879b07SJung-uk Kim ACPI_STATUS Status;
801ff879b07SJung-uk Kim ACPI_LPIT_HEADER *Subtable;
802ff879b07SJung-uk Kim UINT32 Length = Table->Length;
803ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
804ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
805ff879b07SJung-uk Kim UINT32 SubtableLength;
806ff879b07SJung-uk Kim
807ff879b07SJung-uk Kim
808ff879b07SJung-uk Kim /* Subtables */
809ff879b07SJung-uk Kim
810ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
811ff879b07SJung-uk Kim while (Offset < Table->Length)
812ff879b07SJung-uk Kim {
813ff879b07SJung-uk Kim /* Common subtable header */
814ff879b07SJung-uk Kim
815ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
816ff879b07SJung-uk Kim sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
817ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
818ff879b07SJung-uk Kim {
819ff879b07SJung-uk Kim return;
820ff879b07SJung-uk Kim }
821ff879b07SJung-uk Kim
822ff879b07SJung-uk Kim switch (Subtable->Type)
823ff879b07SJung-uk Kim {
824ff879b07SJung-uk Kim case ACPI_LPIT_TYPE_NATIVE_CSTATE:
825ff879b07SJung-uk Kim
826ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoLpit0;
827ff879b07SJung-uk Kim SubtableLength = sizeof (ACPI_LPIT_NATIVE);
828ff879b07SJung-uk Kim break;
829ff879b07SJung-uk Kim
830ff879b07SJung-uk Kim default:
831ff879b07SJung-uk Kim
832ff879b07SJung-uk Kim /* Cannot continue on unknown type - no length */
833ff879b07SJung-uk Kim
834ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
835ff879b07SJung-uk Kim Subtable->Type);
836ff879b07SJung-uk Kim return;
837ff879b07SJung-uk Kim }
838ff879b07SJung-uk Kim
839ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
840ff879b07SJung-uk Kim SubtableLength, InfoTable);
841ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
842ff879b07SJung-uk Kim {
843ff879b07SJung-uk Kim return;
844ff879b07SJung-uk Kim }
845ff879b07SJung-uk Kim
846ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
847ff879b07SJung-uk Kim
848ff879b07SJung-uk Kim /* Point to next subtable */
849ff879b07SJung-uk Kim
850ff879b07SJung-uk Kim Offset += SubtableLength;
851ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
852ff879b07SJung-uk Kim }
853ff879b07SJung-uk Kim }
854ff879b07SJung-uk Kim
855ff879b07SJung-uk Kim
856ff879b07SJung-uk Kim /*******************************************************************************
857ff879b07SJung-uk Kim *
858ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMadt
859ff879b07SJung-uk Kim *
860ff879b07SJung-uk Kim * PARAMETERS: Table - A MADT table
861ff879b07SJung-uk Kim *
862ff879b07SJung-uk Kim * RETURN: None
863ff879b07SJung-uk Kim *
864ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MADT. This table type consists
865ff879b07SJung-uk Kim * of an open-ended number of subtables.
866ff879b07SJung-uk Kim *
867ff879b07SJung-uk Kim ******************************************************************************/
868ff879b07SJung-uk Kim
869ff879b07SJung-uk Kim void
AcpiDmDumpMadt(ACPI_TABLE_HEADER * Table)870ff879b07SJung-uk Kim AcpiDmDumpMadt (
871ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
872ff879b07SJung-uk Kim {
873ff879b07SJung-uk Kim ACPI_STATUS Status;
874ff879b07SJung-uk Kim ACPI_SUBTABLE_HEADER *Subtable;
875ff879b07SJung-uk Kim UINT32 Length = Table->Length;
876ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MADT);
877ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
878ff879b07SJung-uk Kim
879ff879b07SJung-uk Kim
880ff879b07SJung-uk Kim /* Main table */
881ff879b07SJung-uk Kim
882ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
883ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
884ff879b07SJung-uk Kim {
885ff879b07SJung-uk Kim return;
886ff879b07SJung-uk Kim }
887ff879b07SJung-uk Kim
888ff879b07SJung-uk Kim /* Subtables */
889ff879b07SJung-uk Kim
890ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
891ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//0B) Offset %X, from table start: 0x%8.8X%8.8X\n",
892ab71bbb7SJung-uk Kim Offset, ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
893ff879b07SJung-uk Kim while (Offset < Table->Length)
894ff879b07SJung-uk Kim {
895ff879b07SJung-uk Kim /* Common subtable header */
896ff879b07SJung-uk Kim
897ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
898ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
899ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoMadtHdr);
900ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
901ff879b07SJung-uk Kim {
902ff879b07SJung-uk Kim return;
903ff879b07SJung-uk Kim }
904ff879b07SJung-uk Kim
905ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "subtableType: %X\n", Subtable->Type);
906ff879b07SJung-uk Kim switch (Subtable->Type)
907ff879b07SJung-uk Kim {
908ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_APIC:
909ff879b07SJung-uk Kim
910ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt0;
911ff879b07SJung-uk Kim break;
912ff879b07SJung-uk Kim
913ff879b07SJung-uk Kim case ACPI_MADT_TYPE_IO_APIC:
914ff879b07SJung-uk Kim
915ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt1;
916ff879b07SJung-uk Kim break;
917ff879b07SJung-uk Kim
918ff879b07SJung-uk Kim case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
919ff879b07SJung-uk Kim
920ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt2;
921ff879b07SJung-uk Kim break;
922ff879b07SJung-uk Kim
923ff879b07SJung-uk Kim case ACPI_MADT_TYPE_NMI_SOURCE:
924ff879b07SJung-uk Kim
925ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt3;
926ff879b07SJung-uk Kim break;
927ff879b07SJung-uk Kim
928ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
929ff879b07SJung-uk Kim
930ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt4;
931ff879b07SJung-uk Kim break;
932ff879b07SJung-uk Kim
933ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
934ff879b07SJung-uk Kim
935ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt5;
936ff879b07SJung-uk Kim break;
937ff879b07SJung-uk Kim
938ff879b07SJung-uk Kim case ACPI_MADT_TYPE_IO_SAPIC:
939ff879b07SJung-uk Kim
940ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt6;
941ff879b07SJung-uk Kim break;
942ff879b07SJung-uk Kim
943ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_SAPIC:
944ff879b07SJung-uk Kim
945ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt7;
946ff879b07SJung-uk Kim break;
947ff879b07SJung-uk Kim
948ff879b07SJung-uk Kim case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
949ff879b07SJung-uk Kim
950ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt8;
951ff879b07SJung-uk Kim break;
952ff879b07SJung-uk Kim
953ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_X2APIC:
954ff879b07SJung-uk Kim
955ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt9;
956ff879b07SJung-uk Kim break;
957ff879b07SJung-uk Kim
958ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
959ff879b07SJung-uk Kim
960ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt10;
961ff879b07SJung-uk Kim break;
962ff879b07SJung-uk Kim
963ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
964ff879b07SJung-uk Kim
965ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt11;
966ff879b07SJung-uk Kim break;
967ff879b07SJung-uk Kim
968ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
969ff879b07SJung-uk Kim
970ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt12;
971ff879b07SJung-uk Kim break;
972ff879b07SJung-uk Kim
973ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
974ff879b07SJung-uk Kim
975ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt13;
976ff879b07SJung-uk Kim break;
977ff879b07SJung-uk Kim
978ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
979ff879b07SJung-uk Kim
980ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt14;
981ff879b07SJung-uk Kim break;
982ff879b07SJung-uk Kim
983ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
984ff879b07SJung-uk Kim
985ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt15;
986ff879b07SJung-uk Kim break;
987ff879b07SJung-uk Kim
988cfd1ed46SJung-uk Kim case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
989cfd1ed46SJung-uk Kim
990cfd1ed46SJung-uk Kim InfoTable = AcpiDmTableInfoMadt16;
991cfd1ed46SJung-uk Kim break;
992cfd1ed46SJung-uk Kim
993*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_CORE_PIC:
994*07c64d74SJung-uk Kim
995*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt17;
996*07c64d74SJung-uk Kim break;
997*07c64d74SJung-uk Kim
998*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_LIO_PIC:
999*07c64d74SJung-uk Kim
1000*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt18;
1001*07c64d74SJung-uk Kim break;
1002*07c64d74SJung-uk Kim
1003*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_HT_PIC:
1004*07c64d74SJung-uk Kim
1005*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt19;
1006*07c64d74SJung-uk Kim break;
1007*07c64d74SJung-uk Kim
1008*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_EIO_PIC:
1009*07c64d74SJung-uk Kim
1010*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt20;
1011*07c64d74SJung-uk Kim break;
1012*07c64d74SJung-uk Kim
1013*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_MSI_PIC:
1014*07c64d74SJung-uk Kim
1015*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt21;
1016*07c64d74SJung-uk Kim break;
1017*07c64d74SJung-uk Kim
1018*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_BIO_PIC:
1019*07c64d74SJung-uk Kim
1020*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt22;
1021*07c64d74SJung-uk Kim break;
1022*07c64d74SJung-uk Kim
1023*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_LPC_PIC:
1024*07c64d74SJung-uk Kim
1025*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt23;
1026*07c64d74SJung-uk Kim break;
1027*07c64d74SJung-uk Kim
1028*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_RINTC:
1029*07c64d74SJung-uk Kim
1030*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt24;
1031*07c64d74SJung-uk Kim break;
1032*07c64d74SJung-uk Kim
1033*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_IMSIC:
1034*07c64d74SJung-uk Kim
1035*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt25;
1036*07c64d74SJung-uk Kim break;
1037*07c64d74SJung-uk Kim
1038*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_APLIC:
1039*07c64d74SJung-uk Kim
1040*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt26;
1041*07c64d74SJung-uk Kim break;
1042*07c64d74SJung-uk Kim
1043*07c64d74SJung-uk Kim case ACPI_MADT_TYPE_PLIC:
1044*07c64d74SJung-uk Kim
1045*07c64d74SJung-uk Kim InfoTable = AcpiDmTableInfoMadt27;
1046*07c64d74SJung-uk Kim break;
1047*07c64d74SJung-uk Kim
1048ff879b07SJung-uk Kim default:
1049ff879b07SJung-uk Kim
1050ab71bbb7SJung-uk Kim if ((Subtable->Type >= ACPI_MADT_TYPE_RESERVED) &&
1051ab71bbb7SJung-uk Kim (Subtable->Type < ACPI_MADT_TYPE_OEM_RESERVED))
1052ab71bbb7SJung-uk Kim {
1053ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
1054ff879b07SJung-uk Kim Subtable->Type);
1055ab71bbb7SJung-uk Kim goto NextSubtable;
1056ab71bbb7SJung-uk Kim }
1057ab71bbb7SJung-uk Kim else if (Subtable->Type >= ACPI_MADT_TYPE_OEM_RESERVED)
1058ab71bbb7SJung-uk Kim {
1059ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[Found an OEM structure, type = %0x]\n",
1060ab71bbb7SJung-uk Kim Subtable->Type);
1061ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_SUBTABLE_HEADER);
1062ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[0) Subtable->Length = %X, Subtable = %p, Offset = %X]\n",
1063ab71bbb7SJung-uk Kim Subtable->Length, Subtable, Offset);
1064ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[0A) Offset from table start: 0x%8.8X%8.8X]\n",
1065ab71bbb7SJung-uk Kim ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
1066ab71bbb7SJung-uk Kim }
1067ff879b07SJung-uk Kim
1068ff879b07SJung-uk Kim /* Attempt to continue */
1069ff879b07SJung-uk Kim
1070ff879b07SJung-uk Kim if (!Subtable->Length)
1071ff879b07SJung-uk Kim {
1072ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n");
1073ff879b07SJung-uk Kim return;
1074ff879b07SJung-uk Kim }
1075ff879b07SJung-uk Kim
1076ab71bbb7SJung-uk Kim /* Dump the OEM data */
1077ab71bbb7SJung-uk Kim
1078ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, ACPI_CAST_PTR (UINT8, Table) + Offset,
1079*07c64d74SJung-uk Kim Subtable->Length - sizeof (ACPI_SUBTABLE_HEADER), AcpiDmTableInfoMadt128);
1080ab71bbb7SJung-uk Kim if (ACPI_FAILURE (Status))
1081ab71bbb7SJung-uk Kim {
1082ab71bbb7SJung-uk Kim return;
1083ab71bbb7SJung-uk Kim }
1084ab71bbb7SJung-uk Kim
1085ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[1) Subtable->Length = %X, Offset = %X]\n",
1086ab71bbb7SJung-uk Kim Subtable->Length, Offset);
1087ab71bbb7SJung-uk Kim Offset -= sizeof (ACPI_SUBTABLE_HEADER);
1088ab71bbb7SJung-uk Kim
1089ff879b07SJung-uk Kim goto NextSubtable;
1090ff879b07SJung-uk Kim }
1091ff879b07SJung-uk Kim
1092ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[2) Subtable->Length = %X, Offset = %X]\n",
1093ab71bbb7SJung-uk Kim Subtable->Length, Offset);
1094ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
1095ff879b07SJung-uk Kim Subtable->Length, InfoTable);
1096ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1097ff879b07SJung-uk Kim {
1098ff879b07SJung-uk Kim return;
1099ff879b07SJung-uk Kim }
1100ff879b07SJung-uk Kim
1101ff879b07SJung-uk Kim NextSubtable:
1102ff879b07SJung-uk Kim /* Point to next subtable */
1103ff879b07SJung-uk Kim
1104ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[3) Subtable->Length = %X, Offset = %X]\n",
1105ab71bbb7SJung-uk Kim Subtable->Length, Offset);
1106ab71bbb7SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[4) Offset from table start: 0x%8.8X%8.8X (%p) %p]\n",
1107ab71bbb7SJung-uk Kim ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (UINT8, Subtable) - ACPI_CAST_PTR (UINT8, Table)), Subtable, Table);
1108ab71bbb7SJung-uk Kim if (Offset > Table->Length)
1109ab71bbb7SJung-uk Kim {
1110ab71bbb7SJung-uk Kim return;
1111ab71bbb7SJung-uk Kim }
1112ab71bbb7SJung-uk Kim
1113ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
1114ff879b07SJung-uk Kim Subtable->Length);
1115ab71bbb7SJung-uk Kim
1116ab71bbb7SJung-uk Kim Offset = ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table);
1117ab71bbb7SJung-uk Kim if (Offset >= Table->Length)
1118ab71bbb7SJung-uk Kim {
1119ab71bbb7SJung-uk Kim return;
1120ab71bbb7SJung-uk Kim }
1121*07c64d74SJung-uk Kim
1122*07c64d74SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[5) Next Subtable %p, length %X]\n",
1123*07c64d74SJung-uk Kim Subtable, Subtable->Length);
1124*07c64d74SJung-uk Kim DbgPrint (ASL_PARSE_OUTPUT, "//[5B) Offset from table start: 0x%8.8X%8.8X (%p)]\n",
1125*07c64d74SJung-uk Kim ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)), Subtable);
1126ff879b07SJung-uk Kim }
1127ff879b07SJung-uk Kim }
1128ff879b07SJung-uk Kim
1129ff879b07SJung-uk Kim
1130ff879b07SJung-uk Kim /*******************************************************************************
1131ff879b07SJung-uk Kim *
1132ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMcfg
1133ff879b07SJung-uk Kim *
1134ff879b07SJung-uk Kim * PARAMETERS: Table - A MCFG Table
1135ff879b07SJung-uk Kim *
1136ff879b07SJung-uk Kim * RETURN: None
1137ff879b07SJung-uk Kim *
1138ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MCFG table
1139ff879b07SJung-uk Kim *
1140ff879b07SJung-uk Kim ******************************************************************************/
1141ff879b07SJung-uk Kim
1142ff879b07SJung-uk Kim void
AcpiDmDumpMcfg(ACPI_TABLE_HEADER * Table)1143ff879b07SJung-uk Kim AcpiDmDumpMcfg (
1144ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
1145ff879b07SJung-uk Kim {
1146ff879b07SJung-uk Kim ACPI_STATUS Status;
1147ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
1148ff879b07SJung-uk Kim ACPI_MCFG_ALLOCATION *Subtable;
1149ff879b07SJung-uk Kim
1150ff879b07SJung-uk Kim
1151ff879b07SJung-uk Kim /* Main table */
1152ff879b07SJung-uk Kim
1153ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1154ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1155ff879b07SJung-uk Kim {
1156ff879b07SJung-uk Kim return;
1157ff879b07SJung-uk Kim }
1158ff879b07SJung-uk Kim
1159ff879b07SJung-uk Kim /* Subtables */
1160ff879b07SJung-uk Kim
1161ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1162ff879b07SJung-uk Kim while (Offset < Table->Length)
1163ff879b07SJung-uk Kim {
1164ff879b07SJung-uk Kim if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1165ff879b07SJung-uk Kim {
1166ff879b07SJung-uk Kim AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1167a009b7dcSJung-uk Kim (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1168ff879b07SJung-uk Kim return;
1169ff879b07SJung-uk Kim }
1170ff879b07SJung-uk Kim
1171ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1172ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1173ff879b07SJung-uk Kim sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1174ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1175ff879b07SJung-uk Kim {
1176ff879b07SJung-uk Kim return;
1177ff879b07SJung-uk Kim }
1178ff879b07SJung-uk Kim
1179ff879b07SJung-uk Kim /* Point to next subtable (each subtable is of fixed length) */
1180ff879b07SJung-uk Kim
1181ff879b07SJung-uk Kim Offset += sizeof (ACPI_MCFG_ALLOCATION);
1182ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
1183ff879b07SJung-uk Kim sizeof (ACPI_MCFG_ALLOCATION));
1184ff879b07SJung-uk Kim }
1185ff879b07SJung-uk Kim }
1186ff879b07SJung-uk Kim
1187722b1667SJung-uk Kim /*******************************************************************************
1188722b1667SJung-uk Kim *
1189722b1667SJung-uk Kim * FUNCTION: AcpiDmDumpMpam
1190722b1667SJung-uk Kim *
1191722b1667SJung-uk Kim * PARAMETERS: Table - A MPAM table
1192722b1667SJung-uk Kim *
1193722b1667SJung-uk Kim * RETURN: None
1194722b1667SJung-uk Kim *
1195722b1667SJung-uk Kim * DESCRIPTION: Format the contents of a MPAM table
1196722b1667SJung-uk Kim *
1197722b1667SJung-uk Kim ******************************************************************************/
1198722b1667SJung-uk Kim
1199722b1667SJung-uk Kim void
AcpiDmDumpMpam(ACPI_TABLE_HEADER * Table)1200722b1667SJung-uk Kim AcpiDmDumpMpam (
1201722b1667SJung-uk Kim ACPI_TABLE_HEADER *Table)
1202722b1667SJung-uk Kim {
1203722b1667SJung-uk Kim ACPI_STATUS Status;
1204722b1667SJung-uk Kim ACPI_MPAM_MSC_NODE *MpamMscNode;
1205722b1667SJung-uk Kim ACPI_MPAM_RESOURCE_NODE *MpamResourceNode;
1206722b1667SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
1207722b1667SJung-uk Kim UINT32 Offset = sizeof(ACPI_TABLE_HEADER);
1208722b1667SJung-uk Kim UINT32 MpamResourceNodeLength = 0;
1209722b1667SJung-uk Kim
1210722b1667SJung-uk Kim while (Offset < Table->Length)
1211722b1667SJung-uk Kim {
1212722b1667SJung-uk Kim MpamMscNode = ACPI_ADD_PTR (ACPI_MPAM_MSC_NODE, Table, Offset);
1213722b1667SJung-uk Kim
1214722b1667SJung-uk Kim /* Subtable: MSC */
1215722b1667SJung-uk Kim Status = AcpiDmDumpTable (MpamMscNode->Length, 0, MpamMscNode, 0,
1216722b1667SJung-uk Kim AcpiDmTableInfoMpam0);
1217722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
1218722b1667SJung-uk Kim {
1219722b1667SJung-uk Kim return;
1220722b1667SJung-uk Kim }
1221722b1667SJung-uk Kim
1222722b1667SJung-uk Kim /* Offset the start of the array of resources */
1223722b1667SJung-uk Kim Offset += sizeof(ACPI_MPAM_MSC_NODE);
1224722b1667SJung-uk Kim
1225722b1667SJung-uk Kim /* Subtable: MSC RIS(es) */
1226722b1667SJung-uk Kim for (UINT32 ResourceIdx = 0; ResourceIdx < MpamMscNode->NumResouceNodes; ResourceIdx++)
1227722b1667SJung-uk Kim {
1228722b1667SJung-uk Kim MpamResourceNode = ACPI_ADD_PTR (ACPI_MPAM_RESOURCE_NODE, Table, Offset);
1229722b1667SJung-uk Kim
1230722b1667SJung-uk Kim MpamResourceNodeLength = sizeof(ACPI_MPAM_RESOURCE_NODE) +
1231722b1667SJung-uk Kim MpamResourceNode->NumFunctionalDeps * sizeof(ACPI_MPAM_FUNC_DEPS);
1232722b1667SJung-uk Kim
1233722b1667SJung-uk Kim Offset += MpamResourceNodeLength;
1234722b1667SJung-uk Kim
1235722b1667SJung-uk Kim /* Subtable: MSC RIS */
1236722b1667SJung-uk Kim Status = AcpiDmDumpTable (MpamResourceNodeLength, 0, MpamResourceNode, 0,
1237722b1667SJung-uk Kim AcpiDmTableInfoMpam1);
1238722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
1239722b1667SJung-uk Kim {
1240722b1667SJung-uk Kim return;
1241722b1667SJung-uk Kim }
1242722b1667SJung-uk Kim
1243722b1667SJung-uk Kim switch (MpamResourceNode->LocatorType)
1244722b1667SJung-uk Kim {
1245722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE:
1246722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1A;
1247722b1667SJung-uk Kim break;
1248722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_MEMORY:
1249722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1B;
1250722b1667SJung-uk Kim break;
1251722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_SMMU:
1252722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1C;
1253722b1667SJung-uk Kim break;
1254722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE:
1255722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1D;
1256722b1667SJung-uk Kim break;
1257722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE:
1258722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1E;
1259722b1667SJung-uk Kim break;
1260722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_INTERCONNECT:
1261722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1F;
1262722b1667SJung-uk Kim break;
1263722b1667SJung-uk Kim case ACPI_MPAM_LOCATION_TYPE_UNKNOWN:
1264722b1667SJung-uk Kim InfoTable = AcpiDmTableInfoMpam1G;
1265722b1667SJung-uk Kim default:
1266722b1667SJung-uk Kim AcpiOsPrintf ("\n**** Unknown MPAM locator type 0x%X\n",
1267722b1667SJung-uk Kim MpamResourceNode->LocatorType);
1268722b1667SJung-uk Kim return;
1269722b1667SJung-uk Kim }
1270722b1667SJung-uk Kim
1271722b1667SJung-uk Kim /* Subtable: MSC Resource Locator(s) */
1272722b1667SJung-uk Kim Status = AcpiDmDumpTable (sizeof(ACPI_MPAM_RESOURCE_LOCATOR), 0,
1273722b1667SJung-uk Kim &MpamResourceNode->Locator, 0, InfoTable);
1274722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
1275722b1667SJung-uk Kim {
1276722b1667SJung-uk Kim return;
1277722b1667SJung-uk Kim }
1278722b1667SJung-uk Kim
1279722b1667SJung-uk Kim /* Get the number of functional dependencies of an RIS */
1280722b1667SJung-uk Kim Status = AcpiDmDumpTable (sizeof(UINT32), 0, &MpamResourceNode->NumFunctionalDeps, 0,
1281722b1667SJung-uk Kim AcpiDmTableInfoMpam1Deps);
1282722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
1283722b1667SJung-uk Kim {
1284722b1667SJung-uk Kim return;
1285722b1667SJung-uk Kim }
1286722b1667SJung-uk Kim
1287722b1667SJung-uk Kim /* Subtable: MSC functional dependencies */
1288722b1667SJung-uk Kim for (UINT32 funcDep = 0; funcDep < MpamResourceNode->NumFunctionalDeps; funcDep++)
1289722b1667SJung-uk Kim {
1290722b1667SJung-uk Kim Status = AcpiDmDumpTable (sizeof(ACPI_MPAM_FUNC_DEPS), 0,
1291722b1667SJung-uk Kim &MpamResourceNode->NumFunctionalDeps, 0, AcpiDmTableInfoMpam2);
1292722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
1293722b1667SJung-uk Kim {
1294722b1667SJung-uk Kim return;
1295722b1667SJung-uk Kim }
1296722b1667SJung-uk Kim }
1297722b1667SJung-uk Kim
1298722b1667SJung-uk Kim AcpiOsPrintf ("\n\n");
1299722b1667SJung-uk Kim }
1300722b1667SJung-uk Kim
1301722b1667SJung-uk Kim }
1302722b1667SJung-uk Kim
1303722b1667SJung-uk Kim return;
1304722b1667SJung-uk Kim }
1305ff879b07SJung-uk Kim
1306ff879b07SJung-uk Kim /*******************************************************************************
1307ff879b07SJung-uk Kim *
1308ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMpst
1309ff879b07SJung-uk Kim *
1310ff879b07SJung-uk Kim * PARAMETERS: Table - A MPST Table
1311ff879b07SJung-uk Kim *
1312ff879b07SJung-uk Kim * RETURN: None
1313ff879b07SJung-uk Kim *
1314ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MPST table
1315ff879b07SJung-uk Kim *
1316ff879b07SJung-uk Kim ******************************************************************************/
1317ff879b07SJung-uk Kim
1318ff879b07SJung-uk Kim void
AcpiDmDumpMpst(ACPI_TABLE_HEADER * Table)1319ff879b07SJung-uk Kim AcpiDmDumpMpst (
1320ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
1321ff879b07SJung-uk Kim {
1322ff879b07SJung-uk Kim ACPI_STATUS Status;
1323ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MPST);
1324ff879b07SJung-uk Kim ACPI_MPST_POWER_NODE *Subtable0;
1325ff879b07SJung-uk Kim ACPI_MPST_POWER_STATE *Subtable0A;
1326ff879b07SJung-uk Kim ACPI_MPST_COMPONENT *Subtable0B;
1327ff879b07SJung-uk Kim ACPI_MPST_DATA_HDR *Subtable1;
1328ff879b07SJung-uk Kim ACPI_MPST_POWER_DATA *Subtable2;
1329ff879b07SJung-uk Kim UINT16 SubtableCount;
1330ff879b07SJung-uk Kim UINT32 PowerStateCount;
1331ff879b07SJung-uk Kim UINT32 ComponentCount;
1332ff879b07SJung-uk Kim
1333ff879b07SJung-uk Kim
1334ff879b07SJung-uk Kim /* Main table */
1335ff879b07SJung-uk Kim
1336ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1337ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1338ff879b07SJung-uk Kim {
1339ff879b07SJung-uk Kim return;
1340ff879b07SJung-uk Kim }
1341ff879b07SJung-uk Kim
1342ff879b07SJung-uk Kim /* Subtable: Memory Power Node(s) */
1343ff879b07SJung-uk Kim
1344ff879b07SJung-uk Kim SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1345ff879b07SJung-uk Kim Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1346ff879b07SJung-uk Kim
1347ff879b07SJung-uk Kim while ((Offset < Table->Length) && SubtableCount)
1348ff879b07SJung-uk Kim {
1349ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1350ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
1351ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1352ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1353ff879b07SJung-uk Kim {
1354ff879b07SJung-uk Kim return;
1355ff879b07SJung-uk Kim }
1356ff879b07SJung-uk Kim
1357ff879b07SJung-uk Kim /* Extract the sub-subtable counts */
1358ff879b07SJung-uk Kim
1359ff879b07SJung-uk Kim PowerStateCount = Subtable0->NumPowerStates;
1360ff879b07SJung-uk Kim ComponentCount = Subtable0->NumPhysicalComponents;
1361ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_POWER_NODE);
1362ff879b07SJung-uk Kim
1363ff879b07SJung-uk Kim /* Sub-subtables - Memory Power State Structure(s) */
1364ff879b07SJung-uk Kim
1365ff879b07SJung-uk Kim Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
1366ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_NODE));
1367ff879b07SJung-uk Kim
1368ff879b07SJung-uk Kim while (PowerStateCount)
1369ff879b07SJung-uk Kim {
1370ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1371ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
1372ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1373ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1374ff879b07SJung-uk Kim {
1375ff879b07SJung-uk Kim return;
1376ff879b07SJung-uk Kim }
1377ff879b07SJung-uk Kim
1378ff879b07SJung-uk Kim Subtable0A++;
1379ff879b07SJung-uk Kim PowerStateCount--;
1380ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_POWER_STATE);
1381ff879b07SJung-uk Kim }
1382ff879b07SJung-uk Kim
1383ff879b07SJung-uk Kim /* Sub-subtables - Physical Component ID Structure(s) */
1384ff879b07SJung-uk Kim
1385ff879b07SJung-uk Kim Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
1386ff879b07SJung-uk Kim
1387ff879b07SJung-uk Kim if (ComponentCount)
1388ff879b07SJung-uk Kim {
1389ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1390ff879b07SJung-uk Kim }
1391ff879b07SJung-uk Kim
1392ff879b07SJung-uk Kim while (ComponentCount)
1393ff879b07SJung-uk Kim {
1394ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
1395ff879b07SJung-uk Kim sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1396ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1397ff879b07SJung-uk Kim {
1398ff879b07SJung-uk Kim return;
1399ff879b07SJung-uk Kim }
1400ff879b07SJung-uk Kim
1401ff879b07SJung-uk Kim Subtable0B++;
1402ff879b07SJung-uk Kim ComponentCount--;
1403ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_COMPONENT);
1404ff879b07SJung-uk Kim }
1405ff879b07SJung-uk Kim
1406ff879b07SJung-uk Kim /* Point to next Memory Power Node subtable */
1407ff879b07SJung-uk Kim
1408ff879b07SJung-uk Kim SubtableCount--;
1409ff879b07SJung-uk Kim Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1410ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_NODE) +
1411ff879b07SJung-uk Kim (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1412ff879b07SJung-uk Kim (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1413ff879b07SJung-uk Kim }
1414ff879b07SJung-uk Kim
1415ff879b07SJung-uk Kim /* Subtable: Count of Memory Power State Characteristic structures */
1416ff879b07SJung-uk Kim
1417ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1418ff879b07SJung-uk Kim Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1419ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1420ff879b07SJung-uk Kim sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1421ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1422ff879b07SJung-uk Kim {
1423ff879b07SJung-uk Kim return;
1424ff879b07SJung-uk Kim }
1425ff879b07SJung-uk Kim
1426ff879b07SJung-uk Kim SubtableCount = Subtable1->CharacteristicsCount;
1427ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_DATA_HDR);
1428ff879b07SJung-uk Kim
1429ff879b07SJung-uk Kim /* Subtable: Memory Power State Characteristics structure(s) */
1430ff879b07SJung-uk Kim
1431ff879b07SJung-uk Kim Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1432ff879b07SJung-uk Kim sizeof (ACPI_MPST_DATA_HDR));
1433ff879b07SJung-uk Kim
1434ff879b07SJung-uk Kim while ((Offset < Table->Length) && SubtableCount)
1435ff879b07SJung-uk Kim {
1436ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1437ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1438ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1439ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1440ff879b07SJung-uk Kim {
1441ff879b07SJung-uk Kim return;
1442ff879b07SJung-uk Kim }
1443ff879b07SJung-uk Kim
1444ff879b07SJung-uk Kim Subtable2++;
1445ff879b07SJung-uk Kim SubtableCount--;
1446ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_POWER_DATA);
1447ff879b07SJung-uk Kim }
1448ff879b07SJung-uk Kim }
1449ff879b07SJung-uk Kim
1450ff879b07SJung-uk Kim
1451ff879b07SJung-uk Kim /*******************************************************************************
1452ff879b07SJung-uk Kim *
1453ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMsct
1454ff879b07SJung-uk Kim *
1455ff879b07SJung-uk Kim * PARAMETERS: Table - A MSCT table
1456ff879b07SJung-uk Kim *
1457ff879b07SJung-uk Kim * RETURN: None
1458ff879b07SJung-uk Kim *
1459ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MSCT
1460ff879b07SJung-uk Kim *
1461ff879b07SJung-uk Kim ******************************************************************************/
1462ff879b07SJung-uk Kim
1463ff879b07SJung-uk Kim void
AcpiDmDumpMsct(ACPI_TABLE_HEADER * Table)1464ff879b07SJung-uk Kim AcpiDmDumpMsct (
1465ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
1466ff879b07SJung-uk Kim {
1467ff879b07SJung-uk Kim ACPI_STATUS Status;
1468ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
1469ff879b07SJung-uk Kim ACPI_MSCT_PROXIMITY *Subtable;
1470ff879b07SJung-uk Kim
1471ff879b07SJung-uk Kim
1472ff879b07SJung-uk Kim /* Main table */
1473ff879b07SJung-uk Kim
1474ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1475ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1476ff879b07SJung-uk Kim {
1477ff879b07SJung-uk Kim return;
1478ff879b07SJung-uk Kim }
1479ff879b07SJung-uk Kim
1480ff879b07SJung-uk Kim /* Subtables */
1481ff879b07SJung-uk Kim
1482ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1483ff879b07SJung-uk Kim while (Offset < Table->Length)
1484ff879b07SJung-uk Kim {
1485ff879b07SJung-uk Kim /* Common subtable header */
1486ff879b07SJung-uk Kim
1487ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1488ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1489ff879b07SJung-uk Kim sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1490ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1491ff879b07SJung-uk Kim {
1492ff879b07SJung-uk Kim return;
1493ff879b07SJung-uk Kim }
1494ff879b07SJung-uk Kim
1495ff879b07SJung-uk Kim /* Point to next subtable */
1496ff879b07SJung-uk Kim
1497ff879b07SJung-uk Kim Offset += sizeof (ACPI_MSCT_PROXIMITY);
1498ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1499ff879b07SJung-uk Kim sizeof (ACPI_MSCT_PROXIMITY));
1500ff879b07SJung-uk Kim }
1501ff879b07SJung-uk Kim }
1502ff879b07SJung-uk Kim
1503ff879b07SJung-uk Kim
1504ff879b07SJung-uk Kim /*******************************************************************************
1505ff879b07SJung-uk Kim *
1506ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpNfit
1507ff879b07SJung-uk Kim *
1508ff879b07SJung-uk Kim * PARAMETERS: Table - A NFIT table
1509ff879b07SJung-uk Kim *
1510ff879b07SJung-uk Kim * RETURN: None
1511ff879b07SJung-uk Kim *
1512ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of an NFIT.
1513ff879b07SJung-uk Kim *
1514ff879b07SJung-uk Kim ******************************************************************************/
1515ff879b07SJung-uk Kim
1516ff879b07SJung-uk Kim void
AcpiDmDumpNfit(ACPI_TABLE_HEADER * Table)1517ff879b07SJung-uk Kim AcpiDmDumpNfit (
1518ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
1519ff879b07SJung-uk Kim {
1520ff879b07SJung-uk Kim ACPI_STATUS Status;
1521ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_NFIT);
1522ff879b07SJung-uk Kim UINT32 FieldOffset = 0;
1523ff879b07SJung-uk Kim UINT32 Length;
1524ff879b07SJung-uk Kim ACPI_NFIT_HEADER *Subtable;
1525ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
1526ff879b07SJung-uk Kim ACPI_NFIT_INTERLEAVE *Interleave = NULL;
1527ff879b07SJung-uk Kim ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
1528ff879b07SJung-uk Kim ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1529ff879b07SJung-uk Kim UINT32 i;
1530ff879b07SJung-uk Kim
1531ff879b07SJung-uk Kim
1532ff879b07SJung-uk Kim /* Main table */
1533ff879b07SJung-uk Kim
1534ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1535ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1536ff879b07SJung-uk Kim {
1537ff879b07SJung-uk Kim return;
1538ff879b07SJung-uk Kim }
1539ff879b07SJung-uk Kim
1540ff879b07SJung-uk Kim /* Subtables */
1541ff879b07SJung-uk Kim
1542ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1543ff879b07SJung-uk Kim while (Offset < Table->Length)
1544ff879b07SJung-uk Kim {
1545ff879b07SJung-uk Kim /* NFIT subtable header */
1546ff879b07SJung-uk Kim
1547ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1548ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1549ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoNfitHdr);
1550ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1551ff879b07SJung-uk Kim {
1552ff879b07SJung-uk Kim return;
1553ff879b07SJung-uk Kim }
1554ff879b07SJung-uk Kim
1555ff879b07SJung-uk Kim switch (Subtable->Type)
1556ff879b07SJung-uk Kim {
1557ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1558ff879b07SJung-uk Kim
1559ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit0;
1560ff879b07SJung-uk Kim break;
1561ff879b07SJung-uk Kim
1562ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_MEMORY_MAP:
1563ff879b07SJung-uk Kim
1564ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit1;
1565ff879b07SJung-uk Kim break;
1566ff879b07SJung-uk Kim
1567ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_INTERLEAVE:
1568ff879b07SJung-uk Kim
1569ff879b07SJung-uk Kim /* Has a variable number of 32-bit values at the end */
1570ff879b07SJung-uk Kim
1571ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit2;
1572ff879b07SJung-uk Kim FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1573ff879b07SJung-uk Kim break;
1574ff879b07SJung-uk Kim
1575ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_SMBIOS:
1576ff879b07SJung-uk Kim
1577ff879b07SJung-uk Kim SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1578ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit3;
1579ff879b07SJung-uk Kim break;
1580ff879b07SJung-uk Kim
1581ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_CONTROL_REGION:
1582ff879b07SJung-uk Kim
1583ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit4;
1584ff879b07SJung-uk Kim break;
1585ff879b07SJung-uk Kim
1586ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_DATA_REGION:
1587ff879b07SJung-uk Kim
1588ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit5;
1589ff879b07SJung-uk Kim break;
1590ff879b07SJung-uk Kim
1591ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1592ff879b07SJung-uk Kim
1593ff879b07SJung-uk Kim /* Has a variable number of 64-bit addresses at the end */
1594ff879b07SJung-uk Kim
1595ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit6;
1596722b1667SJung-uk Kim FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS);
1597ff879b07SJung-uk Kim break;
1598ff879b07SJung-uk Kim
1599ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_CAPABILITIES: /* ACPI 6.0A */
1600ff879b07SJung-uk Kim
1601ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit7;
1602ff879b07SJung-uk Kim break;
1603ff879b07SJung-uk Kim
1604ff879b07SJung-uk Kim default:
1605ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1606ff879b07SJung-uk Kim Subtable->Type);
1607ff879b07SJung-uk Kim
1608ff879b07SJung-uk Kim /* Attempt to continue */
1609ff879b07SJung-uk Kim
1610ff879b07SJung-uk Kim if (!Subtable->Length)
1611ff879b07SJung-uk Kim {
1612ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n");
1613ff879b07SJung-uk Kim return;
1614ff879b07SJung-uk Kim }
1615ff879b07SJung-uk Kim goto NextSubtable;
1616ff879b07SJung-uk Kim }
1617ff879b07SJung-uk Kim
1618ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
1619ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1620ff879b07SJung-uk Kim Subtable->Length, InfoTable);
1621ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1622ff879b07SJung-uk Kim {
1623ff879b07SJung-uk Kim return;
1624ff879b07SJung-uk Kim }
1625ff879b07SJung-uk Kim
1626ff879b07SJung-uk Kim /* Per-subtable variable-length fields */
1627ff879b07SJung-uk Kim
1628ff879b07SJung-uk Kim switch (Subtable->Type)
1629ff879b07SJung-uk Kim {
1630ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_INTERLEAVE:
1631ff879b07SJung-uk Kim
1632a009b7dcSJung-uk Kim Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1633ff879b07SJung-uk Kim for (i = 0; i < Interleave->LineCount; i++)
1634ff879b07SJung-uk Kim {
1635ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1636ff879b07SJung-uk Kim &Interleave->LineOffset[i],
1637ff879b07SJung-uk Kim sizeof (UINT32), AcpiDmTableInfoNfit2a);
1638ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1639ff879b07SJung-uk Kim {
1640ff879b07SJung-uk Kim return;
1641ff879b07SJung-uk Kim }
1642ff879b07SJung-uk Kim
1643ff879b07SJung-uk Kim FieldOffset += sizeof (UINT32);
1644ff879b07SJung-uk Kim }
1645ff879b07SJung-uk Kim break;
1646ff879b07SJung-uk Kim
1647ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_SMBIOS:
1648ff879b07SJung-uk Kim
1649ff879b07SJung-uk Kim Length = Subtable->Length -
1650722b1667SJung-uk Kim sizeof (ACPI_NFIT_SMBIOS);
1651ff879b07SJung-uk Kim
1652ff879b07SJung-uk Kim if (Length)
1653ff879b07SJung-uk Kim {
1654ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length,
1655722b1667SJung-uk Kim sizeof (ACPI_NFIT_SMBIOS),
1656ff879b07SJung-uk Kim SmbiosInfo,
1657ff879b07SJung-uk Kim Length, AcpiDmTableInfoNfit3a);
1658ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1659ff879b07SJung-uk Kim {
1660ff879b07SJung-uk Kim return;
1661ff879b07SJung-uk Kim }
1662ff879b07SJung-uk Kim }
1663ff879b07SJung-uk Kim
1664ff879b07SJung-uk Kim break;
1665ff879b07SJung-uk Kim
1666ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1667ff879b07SJung-uk Kim
1668a009b7dcSJung-uk Kim Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1669ff879b07SJung-uk Kim for (i = 0; i < Hint->HintCount; i++)
1670ff879b07SJung-uk Kim {
1671ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1672ff879b07SJung-uk Kim &Hint->HintAddress[i],
1673ff879b07SJung-uk Kim sizeof (UINT64), AcpiDmTableInfoNfit6a);
1674ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
1675ff879b07SJung-uk Kim {
1676ff879b07SJung-uk Kim return;
1677ff879b07SJung-uk Kim }
1678ff879b07SJung-uk Kim
1679ff879b07SJung-uk Kim FieldOffset += sizeof (UINT64);
1680ff879b07SJung-uk Kim }
1681ff879b07SJung-uk Kim break;
1682ff879b07SJung-uk Kim
1683ff879b07SJung-uk Kim default:
1684ff879b07SJung-uk Kim break;
1685ff879b07SJung-uk Kim }
1686ff879b07SJung-uk Kim
1687ff879b07SJung-uk Kim NextSubtable:
1688ff879b07SJung-uk Kim /* Point to next subtable */
1689ff879b07SJung-uk Kim
1690ff879b07SJung-uk Kim Offset += Subtable->Length;
1691ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1692ff879b07SJung-uk Kim }
1693ff879b07SJung-uk Kim }
1694ff879b07SJung-uk Kim
1695ff879b07SJung-uk Kim
1696ff879b07SJung-uk Kim /*******************************************************************************
1697ff879b07SJung-uk Kim *
16981b7a2680SJung-uk Kim * FUNCTION: AcpiDmDumpNhlt
16991b7a2680SJung-uk Kim *
17001b7a2680SJung-uk Kim * PARAMETERS: Table - A NHLT table
17011b7a2680SJung-uk Kim *
17021b7a2680SJung-uk Kim * RETURN: None
17031b7a2680SJung-uk Kim *
17041b7a2680SJung-uk Kim * DESCRIPTION: Format the contents of an NHLT.
17051b7a2680SJung-uk Kim *
17061b7a2680SJung-uk Kim ******************************************************************************/
17071b7a2680SJung-uk Kim
17081b7a2680SJung-uk Kim void
AcpiDmDumpNhlt(ACPI_TABLE_HEADER * Table)17091b7a2680SJung-uk Kim AcpiDmDumpNhlt (
17101b7a2680SJung-uk Kim ACPI_TABLE_HEADER *Table)
17111b7a2680SJung-uk Kim {
17121b7a2680SJung-uk Kim ACPI_STATUS Status;
17131b7a2680SJung-uk Kim UINT32 Offset;
17141b7a2680SJung-uk Kim UINT32 TableLength = Table->Length;
17151b7a2680SJung-uk Kim UINT32 EndpointCount;
17161b7a2680SJung-uk Kim UINT8 FormatsCount;
17171b7a2680SJung-uk Kim ACPI_NHLT_ENDPOINT *Subtable;
17181b7a2680SJung-uk Kim ACPI_NHLT_FORMAT_CONFIG *FormatSubtable;
17191b7a2680SJung-uk Kim ACPI_TABLE_NHLT *InfoTable;
17201b7a2680SJung-uk Kim UINT32 CapabilitiesSize;
17211b7a2680SJung-uk Kim UINT32 i;
17221b7a2680SJung-uk Kim UINT32 j;
17231b7a2680SJung-uk Kim UINT32 EndpointEndOffset;
17241b7a2680SJung-uk Kim UINT8 ConfigType = 0;
17251b7a2680SJung-uk Kim UINT8 ArrayType;
1726ab71bbb7SJung-uk Kim UINT8 MicrophoneCount;
1727ab71bbb7SJung-uk Kim ACPI_NHLT_VENDOR_MIC_COUNT *MicCount;
17281b7a2680SJung-uk Kim ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A *DevSpecific;
17291b7a2680SJung-uk Kim ACPI_NHLT_FORMATS_CONFIG *FormatsConfig;
1730ab71bbb7SJung-uk Kim ACPI_NHLT_DEVICE_INFO_COUNT *Count;
1731ab71bbb7SJung-uk Kim ACPI_NHLT_DEVICE_INFO *DeviceInfo;
1732ab71bbb7SJung-uk Kim ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B *Capabilities;
17331b7a2680SJung-uk Kim
17341b7a2680SJung-uk Kim
17351b7a2680SJung-uk Kim /* Main table */
17361b7a2680SJung-uk Kim
17371b7a2680SJung-uk Kim AcpiOsPrintf (" /* Main table */\n");
17381b7a2680SJung-uk Kim
17391b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNhlt);
17401b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
17411b7a2680SJung-uk Kim {
17421b7a2680SJung-uk Kim return;
17431b7a2680SJung-uk Kim }
17441b7a2680SJung-uk Kim
17451b7a2680SJung-uk Kim /* Get the Endpoint Descriptor Count */
17461b7a2680SJung-uk Kim
17471b7a2680SJung-uk Kim InfoTable = ACPI_ADD_PTR (ACPI_TABLE_NHLT, Table, 0);
17481b7a2680SJung-uk Kim EndpointCount = InfoTable->EndpointCount;
17491b7a2680SJung-uk Kim
17501b7a2680SJung-uk Kim /* Subtables */
17511b7a2680SJung-uk Kim
17521b7a2680SJung-uk Kim Offset = sizeof (ACPI_TABLE_NHLT);
17531b7a2680SJung-uk Kim
17541b7a2680SJung-uk Kim while (Offset < TableLength)
17551b7a2680SJung-uk Kim {
17561b7a2680SJung-uk Kim /* A variable number of Endpoint Descriptors - process each */
17571b7a2680SJung-uk Kim
17581b7a2680SJung-uk Kim for (i = 0; i < EndpointCount; i++)
17591b7a2680SJung-uk Kim {
17601b7a2680SJung-uk Kim /* Do the Endpoint Descriptor table */
17611b7a2680SJung-uk Kim
17621b7a2680SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1763ab71bbb7SJung-uk Kim
1764ab71bbb7SJung-uk Kim /* Check for endpoint descriptor length beyond end-of-table */
1765ab71bbb7SJung-uk Kim
17661b7a2680SJung-uk Kim if (Subtable->DescriptorLength > TableLength)
17671b7a2680SJung-uk Kim {
17681b7a2680SJung-uk Kim Offset += 1;
17691b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Endpoint Descriptor Length larger than"
17701b7a2680SJung-uk Kim " table size: %X, table %X, adjusting table offset (+1) */\n",
17711b7a2680SJung-uk Kim Subtable->DescriptorLength, TableLength);
17721b7a2680SJung-uk Kim
17731b7a2680SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
17741b7a2680SJung-uk Kim }
17751b7a2680SJung-uk Kim
17761b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Endpoint Descriptor #%u */\n", i+1);
17771b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
17781b7a2680SJung-uk Kim Subtable->DescriptorLength, AcpiDmTableInfoNhlt0);
17791b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
17801b7a2680SJung-uk Kim {
17811b7a2680SJung-uk Kim return;
17821b7a2680SJung-uk Kim }
1783ab71bbb7SJung-uk Kim
17841b7a2680SJung-uk Kim EndpointEndOffset = Subtable->DescriptorLength + Offset;
17851b7a2680SJung-uk Kim
17861b7a2680SJung-uk Kim /* Check for endpoint descriptor beyond end-of-table */
17871b7a2680SJung-uk Kim
17881b7a2680SJung-uk Kim if (Subtable->DescriptorLength > TableLength)
17891b7a2680SJung-uk Kim {
17901b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Endpoint Descriptor Length larger than table size: %X, table %X */\n",
17911b7a2680SJung-uk Kim Subtable->DescriptorLength, TableLength);
17921b7a2680SJung-uk Kim }
1793ab71bbb7SJung-uk Kim
17941b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_ENDPOINT);
17951b7a2680SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
17961b7a2680SJung-uk Kim
17971b7a2680SJung-uk Kim /* Do the Device Specific table */
17981b7a2680SJung-uk Kim
17991b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Endpoint Device_Specific_Config table */\n");
18001b7a2680SJung-uk Kim DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
18011b7a2680SJung-uk Kim CapabilitiesSize = DevSpecific->CapabilitiesSize;
18021b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
18031b7a2680SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
18041b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
18051b7a2680SJung-uk Kim {
18061b7a2680SJung-uk Kim return;
18071b7a2680SJung-uk Kim }
1808ab71bbb7SJung-uk Kim
1809ab71bbb7SJung-uk Kim ArrayType = 0;
1810ab71bbb7SJung-uk Kim
1811ab71bbb7SJung-uk Kim /* Different subtables based upon capabilities_size */
1812ab71bbb7SJung-uk Kim
1813ab71bbb7SJung-uk Kim switch (CapabilitiesSize)
1814ab71bbb7SJung-uk Kim {
1815ab71bbb7SJung-uk Kim case 0:
18161b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
18171b7a2680SJung-uk Kim break;
18181b7a2680SJung-uk Kim
18191b7a2680SJung-uk Kim case 1:
18201b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
18211b7a2680SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C), AcpiDmTableInfoNhlt5c);
18221b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
18231b7a2680SJung-uk Kim {
18241b7a2680SJung-uk Kim return;
18251b7a2680SJung-uk Kim }
18261b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C);
18271b7a2680SJung-uk Kim break;
18281b7a2680SJung-uk Kim
18291b7a2680SJung-uk Kim case 2:
18301b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
18311b7a2680SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
18321b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
18331b7a2680SJung-uk Kim {
18341b7a2680SJung-uk Kim return;
18351b7a2680SJung-uk Kim }
18361b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
18371b7a2680SJung-uk Kim break;
18381b7a2680SJung-uk Kim
18391b7a2680SJung-uk Kim case 3:
1840ab71bbb7SJung-uk Kim default:
1841ab71bbb7SJung-uk Kim /* Extract the ConfigType and ArrayType */
1842ab71bbb7SJung-uk Kim
18431b7a2680SJung-uk Kim ConfigType = DevSpecific->ConfigType;
18441b7a2680SJung-uk Kim ArrayType = DevSpecific->ArrayType;
18451b7a2680SJung-uk Kim
18461b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
18471b7a2680SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A), AcpiDmTableInfoNhlt5a);
18481b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
18491b7a2680SJung-uk Kim {
18501b7a2680SJung-uk Kim return;
18511b7a2680SJung-uk Kim }
18521b7a2680SJung-uk Kim
18531b7a2680SJung-uk Kim /* Capabilities Size == 3 */
18541b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A);
1855ab71bbb7SJung-uk Kim break;
1856ab71bbb7SJung-uk Kim
1857ab71bbb7SJung-uk Kim case 7:
1858ab71bbb7SJung-uk Kim ConfigType = DevSpecific->ConfigType;
1859ab71bbb7SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1860ab71bbb7SJung-uk Kim DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1861ab71bbb7SJung-uk Kim
1862ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Render Feedback Device-Specific table */\n");
1863ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1864ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
1865ab71bbb7SJung-uk Kim if (ACPI_FAILURE (Status))
1866ab71bbb7SJung-uk Kim {
1867ab71bbb7SJung-uk Kim return;
1868ab71bbb7SJung-uk Kim }
1869ab71bbb7SJung-uk Kim
1870ab71bbb7SJung-uk Kim /* Capabilities Size = 7 */
1871ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
1872ab71bbb7SJung-uk Kim
1873ab71bbb7SJung-uk Kim if (ConfigType == ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK)
1874ab71bbb7SJung-uk Kim {
1875ab71bbb7SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1876ab71bbb7SJung-uk Kim DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1877ab71bbb7SJung-uk Kim
1878ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1879ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt6b);
1880ab71bbb7SJung-uk Kim if (ACPI_FAILURE (Status))
1881ab71bbb7SJung-uk Kim {
1882ab71bbb7SJung-uk Kim return;
1883ab71bbb7SJung-uk Kim }
1884ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG);
1885ab71bbb7SJung-uk Kim }
1886ab71bbb7SJung-uk Kim break;
1887ab71bbb7SJung-uk Kim }
18881b7a2680SJung-uk Kim
18891b7a2680SJung-uk Kim /* Check for a vendor-defined mic array */
18901b7a2680SJung-uk Kim
1891ab71bbb7SJung-uk Kim if (ConfigType == ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY)
18921b7a2680SJung-uk Kim {
1893ab71bbb7SJung-uk Kim if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_MASK) == ACPI_NHLT_VENDOR_DEFINED)
1894ab71bbb7SJung-uk Kim {
1895ab71bbb7SJung-uk Kim /* Vendor-defined microphone array; get the microphone count first */
18961b7a2680SJung-uk Kim
1897ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Vendor-defined microphone count */\n");
1898ab71bbb7SJung-uk Kim MicCount = ACPI_ADD_PTR (ACPI_NHLT_VENDOR_MIC_COUNT, Table, Offset);
1899ab71bbb7SJung-uk Kim MicrophoneCount = MicCount->MicrophoneCount;
1900ab71bbb7SJung-uk Kim
1901ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, MicCount,
1902ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_VENDOR_MIC_COUNT), AcpiDmTableInfoNhlt6a);
1903ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_VENDOR_MIC_COUNT);
1904ab71bbb7SJung-uk Kim if (ACPI_FAILURE (Status))
1905ab71bbb7SJung-uk Kim {
1906ab71bbb7SJung-uk Kim return;
1907ab71bbb7SJung-uk Kim }
1908ab71bbb7SJung-uk Kim
1909ab71bbb7SJung-uk Kim /* Get the vendor microphone config structure(s) */
1910ab71bbb7SJung-uk Kim
1911ab71bbb7SJung-uk Kim for (j = 0; j < MicrophoneCount; j++)
1912ab71bbb7SJung-uk Kim {
1913ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Vendor-defined microphone array #%u*/\n", j+1);
1914ab71bbb7SJung-uk Kim DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
19151b7a2680SJung-uk Kim
19161b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
19171b7a2680SJung-uk Kim sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG), AcpiDmTableInfoNhlt6);
19181b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
19191b7a2680SJung-uk Kim {
19201b7a2680SJung-uk Kim return;
19211b7a2680SJung-uk Kim }
1922ab71bbb7SJung-uk Kim
19231b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG);
19241b7a2680SJung-uk Kim }
19251b7a2680SJung-uk Kim
1926ab71bbb7SJung-uk Kim /* Check for Microphone SNR and sensitivity extension */
1927ab71bbb7SJung-uk Kim
1928ab71bbb7SJung-uk Kim if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_EXT_MASK) == ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT)
1929ab71bbb7SJung-uk Kim {
1930ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Microphone SNR and sensitivity array */\n");
1931ab71bbb7SJung-uk Kim DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
1932ab71bbb7SJung-uk Kim
19331b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1934ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION), AcpiDmTableInfoNhlt9);
19351b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
19361b7a2680SJung-uk Kim {
19371b7a2680SJung-uk Kim return;
19381b7a2680SJung-uk Kim }
19391b7a2680SJung-uk Kim
1940ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION);
19411b7a2680SJung-uk Kim }
1942ab71bbb7SJung-uk Kim }
19431b7a2680SJung-uk Kim }
19441b7a2680SJung-uk Kim
1945ab71bbb7SJung-uk Kim /* Do the Formats_Config table - starts with the FormatsCount field */
19461b7a2680SJung-uk Kim
19471b7a2680SJung-uk Kim FormatsConfig = ACPI_ADD_PTR (ACPI_NHLT_FORMATS_CONFIG, Table, Offset);
19481b7a2680SJung-uk Kim FormatsCount = FormatsConfig->FormatsCount;
19491b7a2680SJung-uk Kim
19501b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Formats_Config table */\n");
19511b7a2680SJung-uk Kim
1952ab71bbb7SJung-uk Kim /* Dump the FormatsCount value */
1953ab71bbb7SJung-uk Kim
1954ab71bbb7SJung-uk Kim if (FormatsCount > 0)
1955ab71bbb7SJung-uk Kim {
19561b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, FormatsConfig,
19571b7a2680SJung-uk Kim sizeof (ACPI_NHLT_FORMATS_CONFIG), AcpiDmTableInfoNhlt4);
19581b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
19591b7a2680SJung-uk Kim {
19601b7a2680SJung-uk Kim return;
19611b7a2680SJung-uk Kim }
1962ab71bbb7SJung-uk Kim }
19631b7a2680SJung-uk Kim Offset += sizeof (ACPI_NHLT_FORMATS_CONFIG);
19641b7a2680SJung-uk Kim
19651b7a2680SJung-uk Kim /* A variable number of Format_Config Descriptors - process each */
19661b7a2680SJung-uk Kim
19671b7a2680SJung-uk Kim for (j = 0; j < FormatsCount; j++)
19681b7a2680SJung-uk Kim {
19691b7a2680SJung-uk Kim FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset);
19701b7a2680SJung-uk Kim CapabilitiesSize = FormatSubtable->CapabilitySize;
19711b7a2680SJung-uk Kim
19721b7a2680SJung-uk Kim /* Do the Wave_extensible struct */
19731b7a2680SJung-uk Kim
19741b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Wave_Format_Extensible table #%u */\n", j+1);
19751b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable,
19761b7a2680SJung-uk Kim sizeof (ACPI_NHLT_FORMAT_CONFIG), AcpiDmTableInfoNhlt3);
19771b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
19781b7a2680SJung-uk Kim {
19791b7a2680SJung-uk Kim return;
19801b7a2680SJung-uk Kim }
19811b7a2680SJung-uk Kim
1982ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_FORMAT_CONFIG);
19831b7a2680SJung-uk Kim
1984ab71bbb7SJung-uk Kim if (CapabilitiesSize > 0)
1985ab71bbb7SJung-uk Kim {
1986ab71bbb7SJung-uk Kim UINT8* CapabilitiesBuf = ACPI_ADD_PTR (UINT8, Table, Offset);
1987ab71bbb7SJung-uk Kim /* Do the Capabilities array (of bytes) */
1988ab71bbb7SJung-uk Kim
19891b7a2680SJung-uk Kim AcpiOsPrintf ("\n /* Specific_Config table #%u */\n", j+1);
1990ab71bbb7SJung-uk Kim
1991ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, CapabilitiesBuf,
19921b7a2680SJung-uk Kim CapabilitiesSize, AcpiDmTableInfoNhlt3a);
19931b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
19941b7a2680SJung-uk Kim {
19951b7a2680SJung-uk Kim return;
19961b7a2680SJung-uk Kim }
1997ab71bbb7SJung-uk Kim
1998ab71bbb7SJung-uk Kim Offset += CapabilitiesSize; /* + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); */
19991b7a2680SJung-uk Kim }
20001b7a2680SJung-uk Kim
2001ab71bbb7SJung-uk Kim } /* for (j = 0; j < FormatsCount; j++) */
2002ab71bbb7SJung-uk Kim
20031b7a2680SJung-uk Kim /*
2004ab71bbb7SJung-uk Kim * If we are not done with the current Endpoint yet, then there must be
2005ab71bbb7SJung-uk Kim * some non documented structure(s) yet to be processed. First, get
2006ab71bbb7SJung-uk Kim * the count of such structure(s).
20071b7a2680SJung-uk Kim */
20081b7a2680SJung-uk Kim if (Offset < EndpointEndOffset)
20091b7a2680SJung-uk Kim {
2010ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Structures that are not part of NHLT spec */\n");
2011ab71bbb7SJung-uk Kim Count = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO_COUNT, Table, Offset);
20121b7a2680SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, Count,
2013ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_INFO_COUNT), AcpiDmTableInfoNhlt7);
20141b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
20151b7a2680SJung-uk Kim {
20161b7a2680SJung-uk Kim return;
20171b7a2680SJung-uk Kim }
2018ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_INFO_COUNT);
20191b7a2680SJung-uk Kim
2020ab71bbb7SJung-uk Kim /* Variable number of device structures */
20211b7a2680SJung-uk Kim
2022ab71bbb7SJung-uk Kim for (j = 0; j < Count->StructureCount; j++)
20231b7a2680SJung-uk Kim {
2024ab71bbb7SJung-uk Kim DeviceInfo = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO, Table, Offset);
2025ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Device Info structure #%u (not part of NHLT spec) */\n", j+1);
20261b7a2680SJung-uk Kim
2027ab71bbb7SJung-uk Kim /*
2028ab71bbb7SJung-uk Kim * Dump the following Device Info fields:
2029ab71bbb7SJung-uk Kim * 1) Device ID
2030ab71bbb7SJung-uk Kim * 2) Device Instance ID
2031ab71bbb7SJung-uk Kim * 3) Device Port ID
2032ab71bbb7SJung-uk Kim */
2033ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, DeviceInfo,
2034ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_INFO), AcpiDmTableInfoNhlt7a);
20351b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
20361b7a2680SJung-uk Kim {
20371b7a2680SJung-uk Kim return;
20381b7a2680SJung-uk Kim }
20391b7a2680SJung-uk Kim
2040ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_INFO);
20411b7a2680SJung-uk Kim }
20421b7a2680SJung-uk Kim
2043ab71bbb7SJung-uk Kim /*
2044ab71bbb7SJung-uk Kim * Check that the current offset is not beyond the end of
2045ab71bbb7SJung-uk Kim * this endpoint descriptor. If it is not, print those
2046ab71bbb7SJung-uk Kim * undocumented bytes.
2047ab71bbb7SJung-uk Kim */
20481b7a2680SJung-uk Kim if (Offset < EndpointEndOffset)
20491b7a2680SJung-uk Kim {
2050ab71bbb7SJung-uk Kim /* Unknown data at the end of the Endpoint */
2051ab71bbb7SJung-uk Kim UINT32 size = EndpointEndOffset - Offset;
2052ab71bbb7SJung-uk Kim UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
2053ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n /* Unknown data at the end of the Endpoint, size: %X */\n", size);
2054ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, buffer,
2055ab71bbb7SJung-uk Kim size, AcpiDmTableInfoNhlt7b);
20561b7a2680SJung-uk Kim Offset = EndpointEndOffset;
20571b7a2680SJung-uk Kim }
2058ab71bbb7SJung-uk Kim
2059ab71bbb7SJung-uk Kim /* Should be at the end of the Endpoint structure. */
20601b7a2680SJung-uk Kim }
20611b7a2680SJung-uk Kim
2062ab71bbb7SJung-uk Kim } /* for (i = 0; i < EndpointCount; i++) */
20631b7a2680SJung-uk Kim
2064ab71bbb7SJung-uk Kim
2065ab71bbb7SJung-uk Kim /*
2066ab71bbb7SJung-uk Kim * Done with all of the Endpoint Descriptors, Emit the table terminator
2067ab71bbb7SJung-uk Kim * (if such a legacy structure is present -- not in NHLT specification)
2068ab71bbb7SJung-uk Kim */
2069ab71bbb7SJung-uk Kim if (Offset < TableLength)
20701b7a2680SJung-uk Kim {
2071ab71bbb7SJung-uk Kim Capabilities = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Table, Offset);
2072ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n/* Terminating specific config (not part of NHLT spec) */\n");
20731b7a2680SJung-uk Kim
2074ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, Capabilities,
2075ab71bbb7SJung-uk Kim sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
20761b7a2680SJung-uk Kim if (ACPI_FAILURE (Status))
20771b7a2680SJung-uk Kim {
20781b7a2680SJung-uk Kim return;
20791b7a2680SJung-uk Kim }
2080ab71bbb7SJung-uk Kim Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
2081ab71bbb7SJung-uk Kim
2082ab71bbb7SJung-uk Kim if (Capabilities->CapabilitiesSize > 0)
2083ab71bbb7SJung-uk Kim {
2084ab71bbb7SJung-uk Kim UINT32 remainingBytes = TableLength - Offset;
2085ab71bbb7SJung-uk Kim UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
2086ab71bbb7SJung-uk Kim
2087ab71bbb7SJung-uk Kim if (remainingBytes != Capabilities->CapabilitiesSize)
2088ab71bbb7SJung-uk Kim AcpiOsPrintf ("\n/* Incorrect config size, should be %X, is %X */\n",
2089ab71bbb7SJung-uk Kim Capabilities->CapabilitiesSize, remainingBytes);
2090ab71bbb7SJung-uk Kim Status = AcpiDmDumpTable (TableLength, Offset, buffer,
2091ab71bbb7SJung-uk Kim remainingBytes, AcpiDmTableInfoNhlt3a);
2092ab71bbb7SJung-uk Kim }
20931b7a2680SJung-uk Kim }
20941b7a2680SJung-uk Kim
20951b7a2680SJung-uk Kim return;
20961b7a2680SJung-uk Kim }
20971b7a2680SJung-uk Kim }
20981b7a2680SJung-uk Kim
20991b7a2680SJung-uk Kim
21001b7a2680SJung-uk Kim /*******************************************************************************
21011b7a2680SJung-uk Kim *
2102ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPcct
2103ff879b07SJung-uk Kim *
2104ff879b07SJung-uk Kim * PARAMETERS: Table - A PCCT table
2105ff879b07SJung-uk Kim *
2106ff879b07SJung-uk Kim * RETURN: None
2107ff879b07SJung-uk Kim *
2108ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a PCCT. This table type consists
2109ff879b07SJung-uk Kim * of an open-ended number of subtables.
2110ff879b07SJung-uk Kim *
2111ff879b07SJung-uk Kim ******************************************************************************/
2112ff879b07SJung-uk Kim
2113ff879b07SJung-uk Kim void
AcpiDmDumpPcct(ACPI_TABLE_HEADER * Table)2114ff879b07SJung-uk Kim AcpiDmDumpPcct (
2115ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
2116ff879b07SJung-uk Kim {
2117ff879b07SJung-uk Kim ACPI_STATUS Status;
2118ff879b07SJung-uk Kim ACPI_PCCT_SUBSPACE *Subtable;
2119ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
2120ff879b07SJung-uk Kim UINT32 Length = Table->Length;
2121ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
2122ff879b07SJung-uk Kim
2123ff879b07SJung-uk Kim
2124ff879b07SJung-uk Kim /* Main table */
2125ff879b07SJung-uk Kim
2126ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
2127ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2128ff879b07SJung-uk Kim {
2129ff879b07SJung-uk Kim return;
2130ff879b07SJung-uk Kim }
2131ff879b07SJung-uk Kim
2132ff879b07SJung-uk Kim /* Subtables */
2133ff879b07SJung-uk Kim
2134ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
2135ff879b07SJung-uk Kim while (Offset < Table->Length)
2136ff879b07SJung-uk Kim {
2137ff879b07SJung-uk Kim /* Common subtable header */
2138ff879b07SJung-uk Kim
2139ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
2140ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2141ff879b07SJung-uk Kim Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
2142ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2143ff879b07SJung-uk Kim {
2144ff879b07SJung-uk Kim return;
2145ff879b07SJung-uk Kim }
2146ff879b07SJung-uk Kim
2147ff879b07SJung-uk Kim switch (Subtable->Header.Type)
2148ff879b07SJung-uk Kim {
2149ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
2150ff879b07SJung-uk Kim
2151ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct0;
2152ff879b07SJung-uk Kim break;
2153ff879b07SJung-uk Kim
2154ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
2155ff879b07SJung-uk Kim
2156ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct1;
2157ff879b07SJung-uk Kim break;
2158ff879b07SJung-uk Kim
2159ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
2160ff879b07SJung-uk Kim
2161ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct2;
2162ff879b07SJung-uk Kim break;
2163ff879b07SJung-uk Kim
2164ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
2165ff879b07SJung-uk Kim
2166ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct3;
2167ff879b07SJung-uk Kim break;
2168ff879b07SJung-uk Kim
2169ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
2170ff879b07SJung-uk Kim
2171ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct4;
2172ff879b07SJung-uk Kim break;
2173ff879b07SJung-uk Kim
2174cfd1ed46SJung-uk Kim case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
2175cfd1ed46SJung-uk Kim
2176cfd1ed46SJung-uk Kim InfoTable = AcpiDmTableInfoPcct5;
2177cfd1ed46SJung-uk Kim break;
2178cfd1ed46SJung-uk Kim
2179ff879b07SJung-uk Kim default:
2180ff879b07SJung-uk Kim
2181ff879b07SJung-uk Kim AcpiOsPrintf (
2182ff879b07SJung-uk Kim "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2183ff879b07SJung-uk Kim Subtable->Header.Type);
2184ff879b07SJung-uk Kim return;
2185ff879b07SJung-uk Kim }
2186ff879b07SJung-uk Kim
2187ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
2188ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2189ff879b07SJung-uk Kim Subtable->Header.Length, InfoTable);
2190ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2191ff879b07SJung-uk Kim {
2192ff879b07SJung-uk Kim return;
2193ff879b07SJung-uk Kim }
2194ff879b07SJung-uk Kim
2195ff879b07SJung-uk Kim /* Point to next subtable */
2196ff879b07SJung-uk Kim
2197ff879b07SJung-uk Kim Offset += Subtable->Header.Length;
2198ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
2199ff879b07SJung-uk Kim Subtable->Header.Length);
2200ff879b07SJung-uk Kim }
2201ff879b07SJung-uk Kim }
2202ff879b07SJung-uk Kim
2203ff879b07SJung-uk Kim
2204ff879b07SJung-uk Kim /*******************************************************************************
2205ff879b07SJung-uk Kim *
2206ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPdtt
2207ff879b07SJung-uk Kim *
2208ff879b07SJung-uk Kim * PARAMETERS: Table - A PDTT table
2209ff879b07SJung-uk Kim *
2210ff879b07SJung-uk Kim * RETURN: None
2211ff879b07SJung-uk Kim *
2212ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
2213ff879b07SJung-uk Kim * table that contains an open-ended number of IDs
2214ff879b07SJung-uk Kim * at the end of the table.
2215ff879b07SJung-uk Kim *
2216ff879b07SJung-uk Kim ******************************************************************************/
2217ff879b07SJung-uk Kim
2218ff879b07SJung-uk Kim void
AcpiDmDumpPdtt(ACPI_TABLE_HEADER * Table)2219ff879b07SJung-uk Kim AcpiDmDumpPdtt (
2220ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
2221ff879b07SJung-uk Kim {
2222ff879b07SJung-uk Kim ACPI_STATUS Status;
2223ff879b07SJung-uk Kim ACPI_PDTT_CHANNEL *Subtable;
2224ff879b07SJung-uk Kim UINT32 Length = Table->Length;
2225ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PDTT);
2226ff879b07SJung-uk Kim
2227ff879b07SJung-uk Kim
2228ff879b07SJung-uk Kim /* Main table */
2229ff879b07SJung-uk Kim
2230ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
2231ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2232ff879b07SJung-uk Kim {
2233ff879b07SJung-uk Kim return;
2234ff879b07SJung-uk Kim }
2235ff879b07SJung-uk Kim
2236ff879b07SJung-uk Kim /* Subtables. Currently there is only one type, but can be multiples */
2237ff879b07SJung-uk Kim
2238ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
2239ff879b07SJung-uk Kim while (Offset < Table->Length)
2240ff879b07SJung-uk Kim {
2241ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
2242ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2243ff879b07SJung-uk Kim sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
2244ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2245ff879b07SJung-uk Kim {
2246ff879b07SJung-uk Kim return;
2247ff879b07SJung-uk Kim }
2248ff879b07SJung-uk Kim
2249ff879b07SJung-uk Kim /* Point to next subtable */
2250ff879b07SJung-uk Kim
2251ff879b07SJung-uk Kim Offset += sizeof (ACPI_PDTT_CHANNEL);
2252ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
2253ff879b07SJung-uk Kim sizeof (ACPI_PDTT_CHANNEL));
2254ff879b07SJung-uk Kim }
2255ff879b07SJung-uk Kim }
2256ff879b07SJung-uk Kim
2257ff879b07SJung-uk Kim
2258ff879b07SJung-uk Kim /*******************************************************************************
2259ff879b07SJung-uk Kim *
2260cfd1ed46SJung-uk Kim * FUNCTION: AcpiDmDumpPhat
2261cfd1ed46SJung-uk Kim *
2262cfd1ed46SJung-uk Kim * PARAMETERS: Table - A PHAT table
2263cfd1ed46SJung-uk Kim *
2264cfd1ed46SJung-uk Kim * RETURN: None
2265cfd1ed46SJung-uk Kim *
2266cfd1ed46SJung-uk Kim * DESCRIPTION: Format the contents of a PHAT.
2267cfd1ed46SJung-uk Kim *
2268cfd1ed46SJung-uk Kim ******************************************************************************/
2269cfd1ed46SJung-uk Kim
2270cfd1ed46SJung-uk Kim void
AcpiDmDumpPhat(ACPI_TABLE_HEADER * Table)2271cfd1ed46SJung-uk Kim AcpiDmDumpPhat (
2272cfd1ed46SJung-uk Kim ACPI_TABLE_HEADER *Table)
2273cfd1ed46SJung-uk Kim {
2274cfd1ed46SJung-uk Kim ACPI_STATUS Status;
2275cfd1ed46SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
2276cfd1ed46SJung-uk Kim ACPI_PHAT_HEADER *Subtable;
2277cfd1ed46SJung-uk Kim ACPI_PHAT_VERSION_DATA *VersionData;
2278cfd1ed46SJung-uk Kim UINT32 RecordCount;
2279cfd1ed46SJung-uk Kim UINT32 Length = Table->Length;
2280cfd1ed46SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PHAT);
22819a4bc520SJung-uk Kim UINT32 OriginalOffset;
2282cfd1ed46SJung-uk Kim UINT32 SubtableLength;
2283cfd1ed46SJung-uk Kim UINT32 PathLength;
2284cfd1ed46SJung-uk Kim UINT32 VendorLength;
22859a4bc520SJung-uk Kim UINT16 RecordType;
22869a4bc520SJung-uk Kim const wchar_t *WideString;
2287cfd1ed46SJung-uk Kim
2288cfd1ed46SJung-uk Kim
2289cfd1ed46SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
2290cfd1ed46SJung-uk Kim
2291cfd1ed46SJung-uk Kim while (Offset < Table->Length)
2292cfd1ed46SJung-uk Kim {
2293cfd1ed46SJung-uk Kim /* Common subtable header */
2294cfd1ed46SJung-uk Kim
2295cfd1ed46SJung-uk Kim AcpiOsPrintf ("\n");
22969a4bc520SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2297cfd1ed46SJung-uk Kim sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
2298cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2299cfd1ed46SJung-uk Kim {
2300cfd1ed46SJung-uk Kim return;
2301cfd1ed46SJung-uk Kim }
2302cfd1ed46SJung-uk Kim
23039a4bc520SJung-uk Kim DbgPrint (ASL_DEBUG_OUTPUT, "\n/* %u, Subtable->Type %X */\n",
23049a4bc520SJung-uk Kim __LINE__, Subtable->Type);
23059a4bc520SJung-uk Kim
2306cfd1ed46SJung-uk Kim switch (Subtable->Type)
2307cfd1ed46SJung-uk Kim {
2308cfd1ed46SJung-uk Kim case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2309cfd1ed46SJung-uk Kim
2310cfd1ed46SJung-uk Kim InfoTable = AcpiDmTableInfoPhat0;
23119a4bc520SJung-uk Kim SubtableLength = Offset += sizeof (ACPI_PHAT_VERSION_DATA);
2312cfd1ed46SJung-uk Kim break;
2313cfd1ed46SJung-uk Kim
2314cfd1ed46SJung-uk Kim case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2315cfd1ed46SJung-uk Kim
2316cfd1ed46SJung-uk Kim InfoTable = AcpiDmTableInfoPhat1;
23179a4bc520SJung-uk Kim SubtableLength = Offset += sizeof (ACPI_PHAT_TYPE_FW_HEALTH_DATA);
2318cfd1ed46SJung-uk Kim break;
2319cfd1ed46SJung-uk Kim
2320cfd1ed46SJung-uk Kim default:
2321cfd1ed46SJung-uk Kim
23229a4bc520SJung-uk Kim DbgPrint (ASL_DEBUG_OUTPUT, "\n**** Unknown PHAT subtable type 0x%X\n\n",
2323cfd1ed46SJung-uk Kim Subtable->Type);
2324cfd1ed46SJung-uk Kim
2325cfd1ed46SJung-uk Kim return;
2326cfd1ed46SJung-uk Kim }
2327cfd1ed46SJung-uk Kim
23289a4bc520SJung-uk Kim Status = AcpiDmDumpTable (Length, SubtableLength, Subtable,
2329cfd1ed46SJung-uk Kim SubtableLength, InfoTable);
2330cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2331cfd1ed46SJung-uk Kim {
2332cfd1ed46SJung-uk Kim return;
2333cfd1ed46SJung-uk Kim }
2334cfd1ed46SJung-uk Kim
23359a4bc520SJung-uk Kim OriginalOffset = Offset;
2336cfd1ed46SJung-uk Kim switch (Subtable->Type)
2337cfd1ed46SJung-uk Kim {
2338cfd1ed46SJung-uk Kim case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2339cfd1ed46SJung-uk Kim
2340cfd1ed46SJung-uk Kim VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
2341cfd1ed46SJung-uk Kim RecordCount = VersionData->ElementCount;
23429a4bc520SJung-uk Kim RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
23439a4bc520SJung-uk Kim
23449a4bc520SJung-uk Kim /*
23459a4bc520SJung-uk Kim * Skip past a zero-valued block (not part of the ACPI PHAT specification).
23469a4bc520SJung-uk Kim * First, check for a zero length record and a zero element count
23479a4bc520SJung-uk Kim */
23489a4bc520SJung-uk Kim if (!VersionData->Header.Length && !VersionData->ElementCount)
2349cfd1ed46SJung-uk Kim {
23509a4bc520SJung-uk Kim while (RecordType == 0)
23519a4bc520SJung-uk Kim {
23529a4bc520SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
23539a4bc520SJung-uk Kim RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
23549a4bc520SJung-uk Kim RecordCount = VersionData->ElementCount;
23559a4bc520SJung-uk Kim Offset += 1;
23569a4bc520SJung-uk Kim }
23579a4bc520SJung-uk Kim
23589a4bc520SJung-uk Kim Offset -= 1;
23599a4bc520SJung-uk Kim AcpiOsPrintf ("\n/* Warning: Block of zeros found above starting at Offset %X Length %X */\n"
23609a4bc520SJung-uk Kim "/* (not compliant to PHAT specification -- ignoring block) */\n",
23619a4bc520SJung-uk Kim OriginalOffset - 12, Offset - OriginalOffset + 12);
23629a4bc520SJung-uk Kim }
23639a4bc520SJung-uk Kim
23649a4bc520SJung-uk Kim DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, RecordCount: %X, Offset %X, SubtableLength %X */\n",
23659a4bc520SJung-uk Kim __LINE__, RecordCount, Offset, SubtableLength);
23669a4bc520SJung-uk Kim
23679a4bc520SJung-uk Kim /* Emit each of the version elements */
23689a4bc520SJung-uk Kim
23699a4bc520SJung-uk Kim while (RecordCount && VersionData->Header.Length)
23709a4bc520SJung-uk Kim {
23719a4bc520SJung-uk Kim AcpiOsPrintf ("\n/* Version Element #%Xh Offset %Xh */\n\n",
23729a4bc520SJung-uk Kim VersionData->ElementCount - RecordCount + 1, Offset);
23739a4bc520SJung-uk Kim
23749a4bc520SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
23759a4bc520SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2376cfd1ed46SJung-uk Kim sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
2377cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2378cfd1ed46SJung-uk Kim {
2379cfd1ed46SJung-uk Kim return;
2380cfd1ed46SJung-uk Kim }
2381cfd1ed46SJung-uk Kim
23829a4bc520SJung-uk Kim Offset += sizeof (ACPI_PHAT_VERSION_ELEMENT);
2383cfd1ed46SJung-uk Kim RecordCount--;
2384cfd1ed46SJung-uk Kim }
2385cfd1ed46SJung-uk Kim
2386cfd1ed46SJung-uk Kim break;
2387cfd1ed46SJung-uk Kim
2388cfd1ed46SJung-uk Kim case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2389cfd1ed46SJung-uk Kim
23909a4bc520SJung-uk Kim /*
23919a4bc520SJung-uk Kim * Get the length of the Device Path (UEFI wide string).
23929a4bc520SJung-uk Kim * Include the wide null terminator (+2),
23939a4bc520SJung-uk Kim */
23949a4bc520SJung-uk Kim WideString = ACPI_ADD_PTR (wchar_t, Subtable,
23959a4bc520SJung-uk Kim sizeof (ACPI_PHAT_HEALTH_DATA));
2396cfd1ed46SJung-uk Kim
23979a4bc520SJung-uk Kim PathLength = (wcslen (WideString) * 2) + 2;
23989a4bc520SJung-uk Kim DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, PathLength %X, Offset %X, Table->Length %X */\n",
23999a4bc520SJung-uk Kim __LINE__, PathLength, Offset, Length);
24009a4bc520SJung-uk Kim
2401cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset,
2402cfd1ed46SJung-uk Kim ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
2403cfd1ed46SJung-uk Kim PathLength, AcpiDmTableInfoPhat1a);
24049a4bc520SJung-uk Kim Offset += PathLength;
2405cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2406cfd1ed46SJung-uk Kim {
2407cfd1ed46SJung-uk Kim return;
2408cfd1ed46SJung-uk Kim }
2409cfd1ed46SJung-uk Kim
24109a4bc520SJung-uk Kim /* Get Device-Specific Data - length of which is the remaining subtable length. */
2411cfd1ed46SJung-uk Kim
2412cfd1ed46SJung-uk Kim VendorLength =
2413cfd1ed46SJung-uk Kim Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
24149a4bc520SJung-uk Kim DbgPrint (ASL_DEBUG_OUTPUT, "%u, Subtable->Length %X, VendorLength %X, Offset %X PathLength: %X\n",
24159a4bc520SJung-uk Kim __LINE__, Subtable->Length, VendorLength, Offset, PathLength);
24169a4bc520SJung-uk Kim
24179a4bc520SJung-uk Kim if (VendorLength)
24189a4bc520SJung-uk Kim {
24199a4bc520SJung-uk Kim /* Point past the Device Path, Compile the Device-Specific Data */
24209a4bc520SJung-uk Kim
24219a4bc520SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset,
2422cfd1ed46SJung-uk Kim ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
2423cfd1ed46SJung-uk Kim VendorLength, AcpiDmTableInfoPhat1b);
2424cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2425cfd1ed46SJung-uk Kim {
2426cfd1ed46SJung-uk Kim return;
2427cfd1ed46SJung-uk Kim }
24289a4bc520SJung-uk Kim
24299a4bc520SJung-uk Kim Offset += VendorLength;
24309a4bc520SJung-uk Kim }
24319a4bc520SJung-uk Kim
24329a4bc520SJung-uk Kim if (ACPI_FAILURE (Status))
24339a4bc520SJung-uk Kim {
24349a4bc520SJung-uk Kim return;
24359a4bc520SJung-uk Kim }
2436cfd1ed46SJung-uk Kim break;
2437cfd1ed46SJung-uk Kim
2438cfd1ed46SJung-uk Kim default:
2439cfd1ed46SJung-uk Kim
2440cfd1ed46SJung-uk Kim AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
2441cfd1ed46SJung-uk Kim Subtable->Type);
2442cfd1ed46SJung-uk Kim return;
2443cfd1ed46SJung-uk Kim }
2444cfd1ed46SJung-uk Kim
2445cfd1ed46SJung-uk Kim /* Next subtable */
2446cfd1ed46SJung-uk Kim
24479a4bc520SJung-uk Kim DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, Bottom of main loop: Offset %X, "
24489a4bc520SJung-uk Kim "Subtable->Length %X, Table->Length %X */\n",
24499a4bc520SJung-uk Kim __LINE__, Offset, Subtable->Length, Table->Length);
24509a4bc520SJung-uk Kim
24519a4bc520SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table,
24529a4bc520SJung-uk Kim Offset);
2453cfd1ed46SJung-uk Kim }
2454cfd1ed46SJung-uk Kim }
2455cfd1ed46SJung-uk Kim
2456cfd1ed46SJung-uk Kim
2457cfd1ed46SJung-uk Kim /*******************************************************************************
2458cfd1ed46SJung-uk Kim *
2459ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPmtt
2460ff879b07SJung-uk Kim *
2461ff879b07SJung-uk Kim * PARAMETERS: Table - A PMTT table
2462ff879b07SJung-uk Kim *
2463ff879b07SJung-uk Kim * RETURN: None
2464ff879b07SJung-uk Kim *
2465ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a PMTT. This table type consists
2466ff879b07SJung-uk Kim * of an open-ended number of subtables.
2467ff879b07SJung-uk Kim *
2468ff879b07SJung-uk Kim ******************************************************************************/
2469ff879b07SJung-uk Kim
2470ff879b07SJung-uk Kim void
AcpiDmDumpPmtt(ACPI_TABLE_HEADER * Table)2471ff879b07SJung-uk Kim AcpiDmDumpPmtt (
2472ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
2473ff879b07SJung-uk Kim {
2474ff879b07SJung-uk Kim ACPI_STATUS Status;
2475ff879b07SJung-uk Kim ACPI_PMTT_HEADER *Subtable;
2476ff879b07SJung-uk Kim UINT32 Length = Table->Length;
2477ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
2478ff879b07SJung-uk Kim
2479ff879b07SJung-uk Kim
2480ff879b07SJung-uk Kim /* Main table */
2481ff879b07SJung-uk Kim
2482ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2483ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2484ff879b07SJung-uk Kim {
2485ff879b07SJung-uk Kim return;
2486ff879b07SJung-uk Kim }
2487ff879b07SJung-uk Kim
2488ff879b07SJung-uk Kim /* Subtables */
2489ff879b07SJung-uk Kim
2490ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2491ff879b07SJung-uk Kim while (Offset < Table->Length)
2492ff879b07SJung-uk Kim {
2493cfd1ed46SJung-uk Kim /* Each of the types below contain the common subtable header */
2494ff879b07SJung-uk Kim
2495ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
2496cfd1ed46SJung-uk Kim switch (Subtable->Type)
2497ff879b07SJung-uk Kim {
2498cfd1ed46SJung-uk Kim case ACPI_PMTT_TYPE_SOCKET:
2499ff879b07SJung-uk Kim
2500ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2501ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoPmtt0);
2502ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2503ff879b07SJung-uk Kim {
2504ff879b07SJung-uk Kim return;
2505ff879b07SJung-uk Kim }
2506cfd1ed46SJung-uk Kim break;
2507ff879b07SJung-uk Kim
2508cfd1ed46SJung-uk Kim case ACPI_PMTT_TYPE_CONTROLLER:
2509cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2510cfd1ed46SJung-uk Kim Subtable->Length, AcpiDmTableInfoPmtt1);
2511ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2512ff879b07SJung-uk Kim {
2513ff879b07SJung-uk Kim return;
2514ff879b07SJung-uk Kim }
2515cfd1ed46SJung-uk Kim break;
2516ff879b07SJung-uk Kim
2517cfd1ed46SJung-uk Kim case ACPI_PMTT_TYPE_DIMM:
2518cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2519cfd1ed46SJung-uk Kim Subtable->Length, AcpiDmTableInfoPmtt2);
2520cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2521ff879b07SJung-uk Kim {
2522cfd1ed46SJung-uk Kim return;
2523cfd1ed46SJung-uk Kim }
2524cfd1ed46SJung-uk Kim break;
2525cfd1ed46SJung-uk Kim
2526cfd1ed46SJung-uk Kim case ACPI_PMTT_TYPE_VENDOR:
2527cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable,
2528cfd1ed46SJung-uk Kim Subtable->Length, AcpiDmTableInfoPmttVendor);
2529cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2530cfd1ed46SJung-uk Kim {
2531cfd1ed46SJung-uk Kim return;
2532cfd1ed46SJung-uk Kim }
2533cfd1ed46SJung-uk Kim break;
2534cfd1ed46SJung-uk Kim
2535cfd1ed46SJung-uk Kim default:
2536ff879b07SJung-uk Kim AcpiOsPrintf (
2537ff879b07SJung-uk Kim "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2538cfd1ed46SJung-uk Kim Subtable->Type);
2539ff879b07SJung-uk Kim return;
2540ff879b07SJung-uk Kim }
2541ff879b07SJung-uk Kim
2542cfd1ed46SJung-uk Kim /* Point to next subtable */
2543ff879b07SJung-uk Kim
2544ff879b07SJung-uk Kim Offset += Subtable->Length;
2545ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2546ff879b07SJung-uk Kim Subtable, Subtable->Length);
2547ff879b07SJung-uk Kim }
2548ff879b07SJung-uk Kim }
2549ff879b07SJung-uk Kim
2550ff879b07SJung-uk Kim
2551ff879b07SJung-uk Kim /*******************************************************************************
2552ff879b07SJung-uk Kim *
2553ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPptt
2554ff879b07SJung-uk Kim *
2555ff879b07SJung-uk Kim * PARAMETERS: Table - A PMTT table
2556ff879b07SJung-uk Kim *
2557ff879b07SJung-uk Kim * RETURN: None
2558ff879b07SJung-uk Kim *
2559ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a PPTT. This table type consists
2560ff879b07SJung-uk Kim * of an open-ended number of subtables.
2561ff879b07SJung-uk Kim *
2562ff879b07SJung-uk Kim ******************************************************************************/
2563ff879b07SJung-uk Kim
2564ff879b07SJung-uk Kim void
AcpiDmDumpPptt(ACPI_TABLE_HEADER * Table)2565ff879b07SJung-uk Kim AcpiDmDumpPptt (
2566ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
2567ff879b07SJung-uk Kim {
2568ff879b07SJung-uk Kim ACPI_STATUS Status;
2569ff879b07SJung-uk Kim ACPI_SUBTABLE_HEADER *Subtable;
2570ff879b07SJung-uk Kim ACPI_PPTT_PROCESSOR *PpttProcessor;
2571ff879b07SJung-uk Kim UINT8 Length;
2572ff879b07SJung-uk Kim UINT8 SubtableOffset;
2573ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
2574ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
2575ff879b07SJung-uk Kim UINT32 i;
2576ff879b07SJung-uk Kim
2577ff879b07SJung-uk Kim
2578ff879b07SJung-uk Kim /* There is no main table (other than the standard ACPI header) */
2579ff879b07SJung-uk Kim
2580ff879b07SJung-uk Kim /* Subtables */
2581ff879b07SJung-uk Kim
2582ff879b07SJung-uk Kim Offset = sizeof (ACPI_TABLE_HEADER);
2583ff879b07SJung-uk Kim while (Offset < Table->Length)
2584ff879b07SJung-uk Kim {
2585ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
2586ff879b07SJung-uk Kim
2587ff879b07SJung-uk Kim /* Common subtable header */
2588ff879b07SJung-uk Kim
2589ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2590ff879b07SJung-uk Kim if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
2591ff879b07SJung-uk Kim {
2592ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid subtable length\n");
2593ff879b07SJung-uk Kim return;
2594ff879b07SJung-uk Kim }
2595ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2596ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoPpttHdr);
2597ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2598ff879b07SJung-uk Kim {
2599ff879b07SJung-uk Kim return;
2600ff879b07SJung-uk Kim }
2601ff879b07SJung-uk Kim
2602ff879b07SJung-uk Kim switch (Subtable->Type)
2603ff879b07SJung-uk Kim {
2604ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_PROCESSOR:
2605ff879b07SJung-uk Kim
2606ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPptt0;
2607ff879b07SJung-uk Kim Length = sizeof (ACPI_PPTT_PROCESSOR);
2608ff879b07SJung-uk Kim break;
2609ff879b07SJung-uk Kim
2610ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_CACHE:
2611ff879b07SJung-uk Kim
2612ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPptt1;
2613ff879b07SJung-uk Kim Length = sizeof (ACPI_PPTT_CACHE);
2614ff879b07SJung-uk Kim break;
2615ff879b07SJung-uk Kim
2616ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_ID:
2617ff879b07SJung-uk Kim
2618ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPptt2;
2619ff879b07SJung-uk Kim Length = sizeof (ACPI_PPTT_ID);
2620ff879b07SJung-uk Kim break;
2621ff879b07SJung-uk Kim
2622ff879b07SJung-uk Kim default:
2623ff879b07SJung-uk Kim
2624ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
2625ff879b07SJung-uk Kim Subtable->Type);
2626ff879b07SJung-uk Kim
2627ff879b07SJung-uk Kim /* Attempt to continue */
2628ff879b07SJung-uk Kim
2629ff879b07SJung-uk Kim goto NextSubtable;
2630ff879b07SJung-uk Kim }
2631ff879b07SJung-uk Kim
2632ff879b07SJung-uk Kim if (Subtable->Length < Length)
2633ff879b07SJung-uk Kim {
2634ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid subtable length\n");
2635ff879b07SJung-uk Kim return;
2636ff879b07SJung-uk Kim }
2637ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2638ff879b07SJung-uk Kim Subtable->Length, InfoTable);
2639ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2640ff879b07SJung-uk Kim {
2641ff879b07SJung-uk Kim return;
2642ff879b07SJung-uk Kim }
2643ff879b07SJung-uk Kim SubtableOffset = Length;
2644ff879b07SJung-uk Kim
2645ff879b07SJung-uk Kim switch (Subtable->Type)
2646ff879b07SJung-uk Kim {
2647ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_PROCESSOR:
2648ff879b07SJung-uk Kim
2649ff879b07SJung-uk Kim PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
2650ff879b07SJung-uk Kim
2651ff879b07SJung-uk Kim /* Dump SMBIOS handles */
2652ff879b07SJung-uk Kim
2653ff879b07SJung-uk Kim if ((UINT8)(Subtable->Length - SubtableOffset) <
2654ff879b07SJung-uk Kim (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
2655ff879b07SJung-uk Kim {
2656ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid private resource number\n");
2657ff879b07SJung-uk Kim return;
2658ff879b07SJung-uk Kim }
2659ff879b07SJung-uk Kim for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
2660ff879b07SJung-uk Kim {
2661ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2662ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2663ff879b07SJung-uk Kim 4, AcpiDmTableInfoPptt0a);
2664a009b7dcSJung-uk Kim if (ACPI_FAILURE (Status))
2665a009b7dcSJung-uk Kim {
2666a009b7dcSJung-uk Kim return;
2667a009b7dcSJung-uk Kim }
2668a009b7dcSJung-uk Kim
2669ff879b07SJung-uk Kim SubtableOffset += 4;
2670ff879b07SJung-uk Kim }
2671ff879b07SJung-uk Kim break;
2672ff879b07SJung-uk Kim
2673cfd1ed46SJung-uk Kim case ACPI_PPTT_TYPE_CACHE:
2674cfd1ed46SJung-uk Kim
2675cfd1ed46SJung-uk Kim if (Table->Revision < 3)
2676cfd1ed46SJung-uk Kim {
2677cfd1ed46SJung-uk Kim break;
2678cfd1ed46SJung-uk Kim }
2679cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2680cfd1ed46SJung-uk Kim ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2681cfd1ed46SJung-uk Kim sizeof (ACPI_PPTT_CACHE_V1), AcpiDmTableInfoPptt1a);
2682cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
2683cfd1ed46SJung-uk Kim {
2684cfd1ed46SJung-uk Kim return;
2685cfd1ed46SJung-uk Kim }
2686cfd1ed46SJung-uk Kim break;
2687cfd1ed46SJung-uk Kim
2688ff879b07SJung-uk Kim default:
2689ff879b07SJung-uk Kim
2690ff879b07SJung-uk Kim break;
2691ff879b07SJung-uk Kim }
2692ff879b07SJung-uk Kim
2693ff879b07SJung-uk Kim NextSubtable:
2694ff879b07SJung-uk Kim /* Point to next subtable */
2695ff879b07SJung-uk Kim
2696ff879b07SJung-uk Kim Offset += Subtable->Length;
2697ff879b07SJung-uk Kim }
2698ff879b07SJung-uk Kim }
2699ff879b07SJung-uk Kim
2700ff879b07SJung-uk Kim
2701ff879b07SJung-uk Kim /*******************************************************************************
2702ff879b07SJung-uk Kim *
27031970d693SJung-uk Kim * FUNCTION: AcpiDmDumpPrmt
27041970d693SJung-uk Kim *
27051970d693SJung-uk Kim * PARAMETERS: Table - A PRMT table
27061970d693SJung-uk Kim *
27071970d693SJung-uk Kim * RETURN: None
27081970d693SJung-uk Kim *
27091970d693SJung-uk Kim * DESCRIPTION: Format the contents of a PRMT. This table type consists
27101970d693SJung-uk Kim * of an open-ended number of subtables.
27111970d693SJung-uk Kim *
27121970d693SJung-uk Kim ******************************************************************************/
27131970d693SJung-uk Kim
27141970d693SJung-uk Kim void
AcpiDmDumpPrmt(ACPI_TABLE_HEADER * Table)27151970d693SJung-uk Kim AcpiDmDumpPrmt (
27161970d693SJung-uk Kim ACPI_TABLE_HEADER *Table)
27171970d693SJung-uk Kim {
27181970d693SJung-uk Kim UINT32 CurrentOffset = sizeof (ACPI_TABLE_HEADER);
27191970d693SJung-uk Kim ACPI_TABLE_PRMT_HEADER *PrmtHeader;
27201970d693SJung-uk Kim ACPI_PRMT_MODULE_INFO *PrmtModuleInfo;
27211970d693SJung-uk Kim ACPI_PRMT_HANDLER_INFO *PrmtHandlerInfo;
27221970d693SJung-uk Kim ACPI_STATUS Status;
27231970d693SJung-uk Kim UINT32 i, j;
27241970d693SJung-uk Kim
27251970d693SJung-uk Kim
27261970d693SJung-uk Kim /* Main table header */
27271970d693SJung-uk Kim
27281970d693SJung-uk Kim PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
27291970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
27301970d693SJung-uk Kim sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
27311970d693SJung-uk Kim if (ACPI_FAILURE (Status))
27321970d693SJung-uk Kim {
27331970d693SJung-uk Kim AcpiOsPrintf ("Invalid PRMT header\n");
27341970d693SJung-uk Kim return;
27351970d693SJung-uk Kim }
27361970d693SJung-uk Kim
27371970d693SJung-uk Kim CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER);
27381970d693SJung-uk Kim
27391970d693SJung-uk Kim /* PRM Module Information Structure array */
27401970d693SJung-uk Kim
27411970d693SJung-uk Kim for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
27421970d693SJung-uk Kim {
27431970d693SJung-uk Kim PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
27441970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
27451970d693SJung-uk Kim sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
27461970d693SJung-uk Kim
27471970d693SJung-uk Kim CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
27481970d693SJung-uk Kim
27491970d693SJung-uk Kim /* PRM handler information structure array */
27501970d693SJung-uk Kim
27511970d693SJung-uk Kim for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
27521970d693SJung-uk Kim {
27531970d693SJung-uk Kim PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
27541970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
27551970d693SJung-uk Kim sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
27561970d693SJung-uk Kim
27571970d693SJung-uk Kim CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
27581970d693SJung-uk Kim }
27591970d693SJung-uk Kim }
27601970d693SJung-uk Kim }
27611970d693SJung-uk Kim
27621970d693SJung-uk Kim
27631970d693SJung-uk Kim /*******************************************************************************
27641970d693SJung-uk Kim *
27651970d693SJung-uk Kim * FUNCTION: AcpiDmDumpRgrt
27661970d693SJung-uk Kim *
27671970d693SJung-uk Kim * PARAMETERS: Table - A RGRT table
27681970d693SJung-uk Kim *
27691970d693SJung-uk Kim * RETURN: None
27701970d693SJung-uk Kim *
27711970d693SJung-uk Kim * DESCRIPTION: Format the contents of a RGRT
27721970d693SJung-uk Kim *
27731970d693SJung-uk Kim ******************************************************************************/
27741970d693SJung-uk Kim
27751970d693SJung-uk Kim void
AcpiDmDumpRgrt(ACPI_TABLE_HEADER * Table)27761970d693SJung-uk Kim AcpiDmDumpRgrt (
27771970d693SJung-uk Kim ACPI_TABLE_HEADER *Table)
27781970d693SJung-uk Kim {
27791970d693SJung-uk Kim ACPI_STATUS Status;
27801970d693SJung-uk Kim ACPI_TABLE_RGRT *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table);
27811970d693SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_RGRT);
27821970d693SJung-uk Kim
27831970d693SJung-uk Kim
27841970d693SJung-uk Kim /* Main table */
27851970d693SJung-uk Kim
27861970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt);
27871970d693SJung-uk Kim if (ACPI_FAILURE (Status))
27881970d693SJung-uk Kim {
27891970d693SJung-uk Kim return;
27901970d693SJung-uk Kim }
27911970d693SJung-uk Kim
27921970d693SJung-uk Kim /* Dump the binary image as a subtable */
27931970d693SJung-uk Kim
27941970d693SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image,
27951970d693SJung-uk Kim Table->Length - Offset, AcpiDmTableInfoRgrt0);
27961970d693SJung-uk Kim if (ACPI_FAILURE (Status))
27971970d693SJung-uk Kim {
27981970d693SJung-uk Kim return;
27991970d693SJung-uk Kim }
28001970d693SJung-uk Kim }
28011970d693SJung-uk Kim
28021970d693SJung-uk Kim
28031970d693SJung-uk Kim /*******************************************************************************
28041970d693SJung-uk Kim *
2805722b1667SJung-uk Kim * FUNCTION: AcpiDmDumpRhct
2806722b1667SJung-uk Kim *
2807722b1667SJung-uk Kim * PARAMETERS: Table - A RHCT table
2808722b1667SJung-uk Kim *
2809722b1667SJung-uk Kim * RETURN: None
2810722b1667SJung-uk Kim *
2811722b1667SJung-uk Kim * DESCRIPTION: Format the contents of a RHCT.
2812722b1667SJung-uk Kim *
2813722b1667SJung-uk Kim ******************************************************************************/
2814722b1667SJung-uk Kim
2815722b1667SJung-uk Kim void
AcpiDmDumpRhct(ACPI_TABLE_HEADER * Table)2816722b1667SJung-uk Kim AcpiDmDumpRhct (
2817722b1667SJung-uk Kim ACPI_TABLE_HEADER *Table)
2818722b1667SJung-uk Kim {
2819722b1667SJung-uk Kim ACPI_STATUS Status;
2820722b1667SJung-uk Kim ACPI_RHCT_NODE_HEADER *Subtable;
2821722b1667SJung-uk Kim ACPI_RHCT_HART_INFO *RhctHartInfo;
2822722b1667SJung-uk Kim ACPI_RHCT_ISA_STRING *RhctIsaString;
2823*07c64d74SJung-uk Kim ACPI_RHCT_CMO_NODE *RhctCmoNode;
2824*07c64d74SJung-uk Kim ACPI_RHCT_MMU_NODE *RhctMmuNode;
2825722b1667SJung-uk Kim UINT32 Length = Table->Length;
2826722b1667SJung-uk Kim UINT8 SubtableOffset, IsaPadOffset;
2827722b1667SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_RHCT);
2828722b1667SJung-uk Kim UINT32 i;
2829722b1667SJung-uk Kim
2830722b1667SJung-uk Kim /* Main table */
2831722b1667SJung-uk Kim
2832722b1667SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRhct);
2833722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
2834722b1667SJung-uk Kim {
2835722b1667SJung-uk Kim return;
2836722b1667SJung-uk Kim }
2837722b1667SJung-uk Kim
2838722b1667SJung-uk Kim /* Subtables */
2839722b1667SJung-uk Kim
2840722b1667SJung-uk Kim while (Offset < Table->Length)
2841722b1667SJung-uk Kim {
2842722b1667SJung-uk Kim AcpiOsPrintf ("\n");
2843722b1667SJung-uk Kim
2844722b1667SJung-uk Kim /* Common subtable header */
2845722b1667SJung-uk Kim
2846722b1667SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_RHCT_NODE_HEADER, Table, Offset);
2847722b1667SJung-uk Kim if (Subtable->Length < sizeof (ACPI_RHCT_NODE_HEADER))
2848722b1667SJung-uk Kim {
2849722b1667SJung-uk Kim AcpiOsPrintf ("Invalid subtable length\n");
2850722b1667SJung-uk Kim return;
2851722b1667SJung-uk Kim }
2852722b1667SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2853722b1667SJung-uk Kim Subtable->Length, AcpiDmTableInfoRhctNodeHdr);
2854722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
2855722b1667SJung-uk Kim {
2856722b1667SJung-uk Kim return;
2857722b1667SJung-uk Kim }
2858722b1667SJung-uk Kim
2859722b1667SJung-uk Kim Length = sizeof (ACPI_RHCT_NODE_HEADER);
2860722b1667SJung-uk Kim
2861722b1667SJung-uk Kim if (Subtable->Length < Length)
2862722b1667SJung-uk Kim {
2863722b1667SJung-uk Kim AcpiOsPrintf ("Invalid subtable length\n");
2864722b1667SJung-uk Kim return;
2865722b1667SJung-uk Kim }
2866722b1667SJung-uk Kim SubtableOffset = (UINT8) Length;
2867722b1667SJung-uk Kim
2868722b1667SJung-uk Kim switch (Subtable->Type)
2869722b1667SJung-uk Kim {
2870722b1667SJung-uk Kim case ACPI_RHCT_NODE_TYPE_HART_INFO:
2871722b1667SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2872722b1667SJung-uk Kim ACPI_ADD_PTR (ACPI_RHCT_HART_INFO, Subtable, SubtableOffset),
2873722b1667SJung-uk Kim sizeof (ACPI_RHCT_HART_INFO), AcpiDmTableInfoRhctHartInfo1);
2874722b1667SJung-uk Kim
2875722b1667SJung-uk Kim RhctHartInfo = ACPI_ADD_PTR (ACPI_RHCT_HART_INFO, Subtable, SubtableOffset);
2876722b1667SJung-uk Kim
2877722b1667SJung-uk Kim if ((UINT16)(Subtable->Length - SubtableOffset) <
2878722b1667SJung-uk Kim (UINT16)(RhctHartInfo->NumOffsets * 4))
2879722b1667SJung-uk Kim {
2880722b1667SJung-uk Kim AcpiOsPrintf ("Invalid number of offsets\n");
2881722b1667SJung-uk Kim return;
2882722b1667SJung-uk Kim }
2883722b1667SJung-uk Kim SubtableOffset += sizeof (ACPI_RHCT_HART_INFO);
2884722b1667SJung-uk Kim for (i = 0; i < RhctHartInfo->NumOffsets; i++)
2885722b1667SJung-uk Kim {
2886722b1667SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2887722b1667SJung-uk Kim ACPI_ADD_PTR (UINT32, Subtable, SubtableOffset),
2888722b1667SJung-uk Kim 4, AcpiDmTableInfoRhctHartInfo2);
2889722b1667SJung-uk Kim if (ACPI_FAILURE (Status))
2890722b1667SJung-uk Kim {
2891722b1667SJung-uk Kim return;
2892722b1667SJung-uk Kim }
2893722b1667SJung-uk Kim
2894722b1667SJung-uk Kim SubtableOffset += 4;
2895722b1667SJung-uk Kim }
2896722b1667SJung-uk Kim break;
2897722b1667SJung-uk Kim
2898722b1667SJung-uk Kim case ACPI_RHCT_NODE_TYPE_ISA_STRING:
2899722b1667SJung-uk Kim RhctIsaString = ACPI_ADD_PTR (ACPI_RHCT_ISA_STRING, Subtable, SubtableOffset);
2900722b1667SJung-uk Kim IsaPadOffset = (UINT8) (SubtableOffset + 2 + RhctIsaString->IsaLength);
2901722b1667SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2902722b1667SJung-uk Kim RhctIsaString, RhctIsaString->IsaLength, AcpiDmTableInfoRhctIsa1);
2903722b1667SJung-uk Kim if (Subtable->Length > IsaPadOffset)
2904722b1667SJung-uk Kim {
2905722b1667SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2906722b1667SJung-uk Kim ACPI_ADD_PTR (UINT8, Subtable, IsaPadOffset),
2907722b1667SJung-uk Kim (Subtable->Length - IsaPadOffset), AcpiDmTableInfoRhctIsaPad);
2908722b1667SJung-uk Kim }
2909722b1667SJung-uk Kim
2910*07c64d74SJung-uk Kim break;
2911*07c64d74SJung-uk Kim
2912*07c64d74SJung-uk Kim case ACPI_RHCT_NODE_TYPE_CMO:
2913*07c64d74SJung-uk Kim RhctCmoNode = ACPI_ADD_PTR (ACPI_RHCT_CMO_NODE, Subtable, SubtableOffset);
2914*07c64d74SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2915*07c64d74SJung-uk Kim RhctCmoNode, 4, AcpiDmTableInfoRhctCmo1);
2916*07c64d74SJung-uk Kim break;
2917*07c64d74SJung-uk Kim
2918*07c64d74SJung-uk Kim case ACPI_RHCT_NODE_TYPE_MMU:
2919*07c64d74SJung-uk Kim RhctMmuNode = ACPI_ADD_PTR (ACPI_RHCT_MMU_NODE, Subtable, SubtableOffset);
2920*07c64d74SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2921*07c64d74SJung-uk Kim RhctMmuNode, 2, AcpiDmTableInfoRhctMmu1);
2922*07c64d74SJung-uk Kim break;
2923*07c64d74SJung-uk Kim
2924722b1667SJung-uk Kim default:
2925722b1667SJung-uk Kim break;
2926722b1667SJung-uk Kim }
2927722b1667SJung-uk Kim
2928722b1667SJung-uk Kim /* Point to next subtable */
2929722b1667SJung-uk Kim
2930722b1667SJung-uk Kim Offset += Subtable->Length;
2931722b1667SJung-uk Kim }
2932722b1667SJung-uk Kim }
2933722b1667SJung-uk Kim
2934722b1667SJung-uk Kim
2935722b1667SJung-uk Kim /*******************************************************************************
2936722b1667SJung-uk Kim *
2937ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpS3pt
2938ff879b07SJung-uk Kim *
2939ff879b07SJung-uk Kim * PARAMETERS: Table - A S3PT table
2940ff879b07SJung-uk Kim *
2941ff879b07SJung-uk Kim * RETURN: Length of the table
2942ff879b07SJung-uk Kim *
2943ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a S3PT
2944ff879b07SJung-uk Kim *
2945ff879b07SJung-uk Kim ******************************************************************************/
2946ff879b07SJung-uk Kim
2947ff879b07SJung-uk Kim UINT32
AcpiDmDumpS3pt(ACPI_TABLE_HEADER * Tables)2948ff879b07SJung-uk Kim AcpiDmDumpS3pt (
2949ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Tables)
2950ff879b07SJung-uk Kim {
2951ff879b07SJung-uk Kim ACPI_STATUS Status;
2952ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_S3PT);
2953ff879b07SJung-uk Kim ACPI_FPDT_HEADER *Subtable;
2954ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
2955ff879b07SJung-uk Kim ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2956ff879b07SJung-uk Kim
2957ff879b07SJung-uk Kim
2958ff879b07SJung-uk Kim /* Main table */
2959ff879b07SJung-uk Kim
2960ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2961ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2962ff879b07SJung-uk Kim {
2963ff879b07SJung-uk Kim return 0;
2964ff879b07SJung-uk Kim }
2965ff879b07SJung-uk Kim
2966ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
2967ff879b07SJung-uk Kim while (Offset < S3ptTable->Length)
2968ff879b07SJung-uk Kim {
2969ff879b07SJung-uk Kim /* Common subtable header */
2970ff879b07SJung-uk Kim
2971ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
2972ff879b07SJung-uk Kim Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2973ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoS3ptHdr);
2974ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
2975ff879b07SJung-uk Kim {
2976ff879b07SJung-uk Kim return 0;
2977ff879b07SJung-uk Kim }
2978ff879b07SJung-uk Kim
2979ff879b07SJung-uk Kim switch (Subtable->Type)
2980ff879b07SJung-uk Kim {
2981ff879b07SJung-uk Kim case ACPI_S3PT_TYPE_RESUME:
2982ff879b07SJung-uk Kim
2983ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoS3pt0;
2984ff879b07SJung-uk Kim break;
2985ff879b07SJung-uk Kim
2986ff879b07SJung-uk Kim case ACPI_S3PT_TYPE_SUSPEND:
2987ff879b07SJung-uk Kim
2988ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoS3pt1;
2989ff879b07SJung-uk Kim break;
2990ff879b07SJung-uk Kim
2991ff879b07SJung-uk Kim default:
2992ff879b07SJung-uk Kim
2993ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
2994ff879b07SJung-uk Kim Subtable->Type);
2995ff879b07SJung-uk Kim
2996ff879b07SJung-uk Kim /* Attempt to continue */
2997ff879b07SJung-uk Kim
2998ff879b07SJung-uk Kim if (!Subtable->Length)
2999ff879b07SJung-uk Kim {
3000ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n");
3001ff879b07SJung-uk Kim return 0;
3002ff879b07SJung-uk Kim }
3003ff879b07SJung-uk Kim goto NextSubtable;
3004ff879b07SJung-uk Kim }
3005ff879b07SJung-uk Kim
3006ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
3007ff879b07SJung-uk Kim Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
3008ff879b07SJung-uk Kim Subtable->Length, InfoTable);
3009ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3010ff879b07SJung-uk Kim {
3011ff879b07SJung-uk Kim return 0;
3012ff879b07SJung-uk Kim }
3013ff879b07SJung-uk Kim
3014ff879b07SJung-uk Kim NextSubtable:
3015ff879b07SJung-uk Kim /* Point to next subtable */
3016ff879b07SJung-uk Kim
3017ff879b07SJung-uk Kim Offset += Subtable->Length;
3018ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
3019ff879b07SJung-uk Kim }
3020ff879b07SJung-uk Kim
3021ff879b07SJung-uk Kim return (S3ptTable->Length);
3022ff879b07SJung-uk Kim }
3023ff879b07SJung-uk Kim
3024ff879b07SJung-uk Kim
3025ff879b07SJung-uk Kim /*******************************************************************************
3026ff879b07SJung-uk Kim *
3027ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpSdev
3028ff879b07SJung-uk Kim *
3029ff879b07SJung-uk Kim * PARAMETERS: Table - A SDEV table
3030ff879b07SJung-uk Kim *
3031ff879b07SJung-uk Kim * RETURN: None
3032ff879b07SJung-uk Kim *
3033ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
3034ff879b07SJung-uk Kim * table that contains variable strings and vendor data.
3035ff879b07SJung-uk Kim *
3036ff879b07SJung-uk Kim ******************************************************************************/
3037ff879b07SJung-uk Kim
3038ff879b07SJung-uk Kim void
AcpiDmDumpSdev(ACPI_TABLE_HEADER * Table)3039ff879b07SJung-uk Kim AcpiDmDumpSdev (
3040ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table)
3041ff879b07SJung-uk Kim {
3042ff879b07SJung-uk Kim ACPI_STATUS Status;
3043ff879b07SJung-uk Kim ACPI_SDEV_HEADER *Subtable;
3044ff879b07SJung-uk Kim ACPI_SDEV_PCIE *Pcie;
3045ff879b07SJung-uk Kim ACPI_SDEV_NAMESPACE *Namesp;
3046ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable;
3047cfd1ed46SJung-uk Kim ACPI_DMTABLE_INFO *SecureComponentInfoTable;
3048ff879b07SJung-uk Kim UINT32 Length = Table->Length;
3049ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_SDEV);
3050ff879b07SJung-uk Kim UINT16 PathOffset;
3051ff879b07SJung-uk Kim UINT16 PathLength;
3052ff879b07SJung-uk Kim UINT16 VendorDataOffset;
3053ff879b07SJung-uk Kim UINT16 VendorDataLength;
3054cfd1ed46SJung-uk Kim ACPI_SDEV_SECURE_COMPONENT *SecureComponent = NULL;
3055cfd1ed46SJung-uk Kim UINT32 CurrentOffset = 0;
3056ff879b07SJung-uk Kim
3057ff879b07SJung-uk Kim
3058ff879b07SJung-uk Kim /* Main table */
3059ff879b07SJung-uk Kim
3060ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
3061ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3062ff879b07SJung-uk Kim {
3063ff879b07SJung-uk Kim return;
3064ff879b07SJung-uk Kim }
3065ff879b07SJung-uk Kim
3066ff879b07SJung-uk Kim /* Subtables */
3067ff879b07SJung-uk Kim
3068ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
3069ff879b07SJung-uk Kim while (Offset < Table->Length)
3070ff879b07SJung-uk Kim {
3071ff879b07SJung-uk Kim /* Common subtable header */
3072ff879b07SJung-uk Kim
3073ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
3074ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3075ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoSdevHdr);
3076ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3077ff879b07SJung-uk Kim {
3078ff879b07SJung-uk Kim return;
3079ff879b07SJung-uk Kim }
3080ff879b07SJung-uk Kim
3081ff879b07SJung-uk Kim switch (Subtable->Type)
3082ff879b07SJung-uk Kim {
3083ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
3084ff879b07SJung-uk Kim
3085ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoSdev0;
3086ff879b07SJung-uk Kim break;
3087ff879b07SJung-uk Kim
3088ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
3089ff879b07SJung-uk Kim
3090ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoSdev1;
3091ff879b07SJung-uk Kim break;
3092ff879b07SJung-uk Kim
3093ff879b07SJung-uk Kim default:
3094ff879b07SJung-uk Kim goto NextSubtable;
3095ff879b07SJung-uk Kim }
3096ff879b07SJung-uk Kim
3097ff879b07SJung-uk Kim AcpiOsPrintf ("\n");
3098cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Subtable,
3099ff879b07SJung-uk Kim Subtable->Length, InfoTable);
3100ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3101ff879b07SJung-uk Kim {
3102ff879b07SJung-uk Kim return;
3103ff879b07SJung-uk Kim }
3104ff879b07SJung-uk Kim
3105ff879b07SJung-uk Kim switch (Subtable->Type)
3106ff879b07SJung-uk Kim {
3107ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
3108ff879b07SJung-uk Kim
3109cfd1ed46SJung-uk Kim CurrentOffset = sizeof (ACPI_SDEV_NAMESPACE);
3110cfd1ed46SJung-uk Kim if (Subtable->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
3111cfd1ed46SJung-uk Kim {
3112cfd1ed46SJung-uk Kim SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
3113cfd1ed46SJung-uk Kim ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)));
3114cfd1ed46SJung-uk Kim
3115cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3116cfd1ed46SJung-uk Kim ACPI_ADD_PTR(UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)),
3117cfd1ed46SJung-uk Kim sizeof (ACPI_SDEV_SECURE_COMPONENT), AcpiDmTableInfoSdev0b);
3118cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
3119cfd1ed46SJung-uk Kim {
3120cfd1ed46SJung-uk Kim return;
3121cfd1ed46SJung-uk Kim }
3122cfd1ed46SJung-uk Kim CurrentOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
3123cfd1ed46SJung-uk Kim
3124cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3125cfd1ed46SJung-uk Kim ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
3126cfd1ed46SJung-uk Kim sizeof (ACPI_SDEV_HEADER), AcpiDmTableInfoSdevSecCompHdr);
3127cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
3128cfd1ed46SJung-uk Kim {
3129cfd1ed46SJung-uk Kim return;
3130cfd1ed46SJung-uk Kim }
3131cfd1ed46SJung-uk Kim CurrentOffset += sizeof (ACPI_SDEV_HEADER);
3132cfd1ed46SJung-uk Kim
3133cfd1ed46SJung-uk Kim switch (Subtable->Type)
3134cfd1ed46SJung-uk Kim {
3135cfd1ed46SJung-uk Kim case ACPI_SDEV_TYPE_ID_COMPONENT:
3136cfd1ed46SJung-uk Kim
3137cfd1ed46SJung-uk Kim SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
3138cfd1ed46SJung-uk Kim break;
3139cfd1ed46SJung-uk Kim
3140cfd1ed46SJung-uk Kim case ACPI_SDEV_TYPE_MEM_COMPONENT:
3141cfd1ed46SJung-uk Kim
3142cfd1ed46SJung-uk Kim SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
3143cfd1ed46SJung-uk Kim break;
3144cfd1ed46SJung-uk Kim
3145cfd1ed46SJung-uk Kim default:
3146cfd1ed46SJung-uk Kim goto NextSubtable;
3147cfd1ed46SJung-uk Kim }
3148cfd1ed46SJung-uk Kim
3149cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3150cfd1ed46SJung-uk Kim ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
3151cfd1ed46SJung-uk Kim SecureComponent->SecureComponentLength, SecureComponentInfoTable);
3152cfd1ed46SJung-uk Kim CurrentOffset += SecureComponent->SecureComponentLength;
3153cfd1ed46SJung-uk Kim }
3154cfd1ed46SJung-uk Kim
3155ff879b07SJung-uk Kim /* Dump the PCIe device ID(s) */
3156ff879b07SJung-uk Kim
3157ff879b07SJung-uk Kim Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
3158ff879b07SJung-uk Kim PathOffset = Namesp->DeviceIdOffset;
3159ff879b07SJung-uk Kim PathLength = Namesp->DeviceIdLength;
3160ff879b07SJung-uk Kim
3161ff879b07SJung-uk Kim if (PathLength)
3162ff879b07SJung-uk Kim {
3163cfd1ed46SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3164ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
3165ff879b07SJung-uk Kim PathLength, AcpiDmTableInfoSdev0a);
3166ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3167ff879b07SJung-uk Kim {
3168ff879b07SJung-uk Kim return;
3169ff879b07SJung-uk Kim }
3170cfd1ed46SJung-uk Kim CurrentOffset += PathLength;
3171ff879b07SJung-uk Kim }
3172ff879b07SJung-uk Kim
3173ff879b07SJung-uk Kim /* Dump the vendor-specific data */
3174ff879b07SJung-uk Kim
3175ff879b07SJung-uk Kim VendorDataLength =
3176ff879b07SJung-uk Kim Namesp->VendorDataLength;
3177ff879b07SJung-uk Kim VendorDataOffset =
3178ff879b07SJung-uk Kim Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
3179ff879b07SJung-uk Kim
3180ff879b07SJung-uk Kim if (VendorDataLength)
3181ff879b07SJung-uk Kim {
3182ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0,
3183ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
3184ff879b07SJung-uk Kim VendorDataLength, AcpiDmTableInfoSdev1b);
3185ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3186ff879b07SJung-uk Kim {
3187ff879b07SJung-uk Kim return;
3188ff879b07SJung-uk Kim }
3189ff879b07SJung-uk Kim }
3190ff879b07SJung-uk Kim break;
3191ff879b07SJung-uk Kim
3192ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
3193ff879b07SJung-uk Kim
3194ff879b07SJung-uk Kim /* PCI path substructures */
3195ff879b07SJung-uk Kim
3196ff879b07SJung-uk Kim Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
3197ff879b07SJung-uk Kim PathOffset = Pcie->PathOffset;
3198ff879b07SJung-uk Kim PathLength = Pcie->PathLength;
3199ff879b07SJung-uk Kim
3200ff879b07SJung-uk Kim while (PathLength)
3201ff879b07SJung-uk Kim {
3202ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length,
3203ff879b07SJung-uk Kim PathOffset + Offset,
3204ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
3205ff879b07SJung-uk Kim sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
3206ff879b07SJung-uk Kim if (ACPI_FAILURE (Status))
3207ff879b07SJung-uk Kim {
3208ff879b07SJung-uk Kim return;
3209ff879b07SJung-uk Kim }
3210ff879b07SJung-uk Kim
3211ff879b07SJung-uk Kim PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
3212ff879b07SJung-uk Kim PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
3213ff879b07SJung-uk Kim }
3214ff879b07SJung-uk Kim
3215ff879b07SJung-uk Kim /* VendorData */
3216ff879b07SJung-uk Kim
3217ff879b07SJung-uk Kim VendorDataLength = Pcie->VendorDataLength;
3218ff879b07SJung-uk Kim VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
3219ff879b07SJung-uk Kim
3220ff879b07SJung-uk Kim if (VendorDataLength)
3221ff879b07SJung-uk Kim {
3222ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0,
3223ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
3224ff879b07SJung-uk Kim VendorDataLength, AcpiDmTableInfoSdev1b);
3225a009b7dcSJung-uk Kim if (ACPI_FAILURE (Status))
3226a009b7dcSJung-uk Kim {
3227a009b7dcSJung-uk Kim return;
3228a009b7dcSJung-uk Kim }
3229ff879b07SJung-uk Kim }
3230ff879b07SJung-uk Kim break;
3231ff879b07SJung-uk Kim
3232ff879b07SJung-uk Kim default:
3233ff879b07SJung-uk Kim goto NextSubtable;
3234ff879b07SJung-uk Kim }
3235ff879b07SJung-uk Kim
3236ff879b07SJung-uk Kim NextSubtable:
3237ff879b07SJung-uk Kim /* Point to next subtable */
3238ff879b07SJung-uk Kim
3239ff879b07SJung-uk Kim Offset += Subtable->Length;
3240ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
3241ff879b07SJung-uk Kim Subtable->Length);
3242ff879b07SJung-uk Kim }
3243ff879b07SJung-uk Kim }
3244