dmtbdump3.c revision 1.1.1.7 1 1.1 christos /******************************************************************************
2 1.1 christos *
3 1.1 christos * Module Name: dmtbdump3 - Dump ACPI data tables that contain no AML code
4 1.1 christos *
5 1.1 christos *****************************************************************************/
6 1.1 christos
7 1.1 christos /*
8 1.1.1.6 christos * Copyright (C) 2000 - 2021, Intel Corp.
9 1.1 christos * All rights reserved.
10 1.1 christos *
11 1.1 christos * Redistribution and use in source and binary forms, with or without
12 1.1 christos * modification, are permitted provided that the following conditions
13 1.1 christos * are met:
14 1.1 christos * 1. Redistributions of source code must retain the above copyright
15 1.1 christos * notice, this list of conditions, and the following disclaimer,
16 1.1 christos * without modification.
17 1.1 christos * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1 christos * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1 christos * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1 christos * including a substantially similar Disclaimer requirement for further
21 1.1 christos * binary redistribution.
22 1.1 christos * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1 christos * of any contributors may be used to endorse or promote products derived
24 1.1 christos * from this software without specific prior written permission.
25 1.1 christos *
26 1.1 christos * Alternatively, this software may be distributed under the terms of the
27 1.1 christos * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1 christos * Software Foundation.
29 1.1 christos *
30 1.1 christos * NO WARRANTY
31 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1 christos * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.6 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 1.1 christos * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1 christos * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1 christos * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1 christos * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1 christos * POSSIBILITY OF SUCH DAMAGES.
42 1.1 christos */
43 1.1 christos
44 1.1 christos #include "acpi.h"
45 1.1 christos #include "accommon.h"
46 1.1 christos #include "acdisasm.h"
47 1.1 christos #include "actables.h"
48 1.1 christos
49 1.1 christos /* This module used for application-level code only */
50 1.1 christos
51 1.1 christos #define _COMPONENT ACPI_CA_DISASSEMBLER
52 1.1 christos ACPI_MODULE_NAME ("dmtbdump3")
53 1.1 christos
54 1.1 christos
55 1.1 christos /*******************************************************************************
56 1.1 christos *
57 1.1 christos * FUNCTION: AcpiDmDumpSlic
58 1.1 christos *
59 1.1 christos * PARAMETERS: Table - A SLIC table
60 1.1 christos *
61 1.1 christos * RETURN: None
62 1.1 christos *
63 1.1 christos * DESCRIPTION: Format the contents of a SLIC
64 1.1 christos *
65 1.1 christos ******************************************************************************/
66 1.1 christos
67 1.1 christos void
68 1.1 christos AcpiDmDumpSlic (
69 1.1 christos ACPI_TABLE_HEADER *Table)
70 1.1 christos {
71 1.1 christos
72 1.1 christos (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
73 1.1 christos Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
74 1.1 christos }
75 1.1 christos
76 1.1 christos
77 1.1 christos /*******************************************************************************
78 1.1 christos *
79 1.1 christos * FUNCTION: AcpiDmDumpSlit
80 1.1 christos *
81 1.1 christos * PARAMETERS: Table - An SLIT
82 1.1 christos *
83 1.1 christos * RETURN: None
84 1.1 christos *
85 1.1 christos * DESCRIPTION: Format the contents of a SLIT
86 1.1 christos *
87 1.1 christos ******************************************************************************/
88 1.1 christos
89 1.1 christos void
90 1.1 christos AcpiDmDumpSlit (
91 1.1 christos ACPI_TABLE_HEADER *Table)
92 1.1 christos {
93 1.1 christos ACPI_STATUS Status;
94 1.1 christos UINT32 Offset;
95 1.1 christos UINT8 *Row;
96 1.1 christos UINT32 Localities;
97 1.1 christos UINT32 i;
98 1.1 christos UINT32 j;
99 1.1 christos
100 1.1 christos
101 1.1 christos /* Main table */
102 1.1 christos
103 1.1 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
104 1.1 christos if (ACPI_FAILURE (Status))
105 1.1 christos {
106 1.1 christos return;
107 1.1 christos }
108 1.1 christos
109 1.1 christos /* Display the Locality NxN Matrix */
110 1.1 christos
111 1.1 christos Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
112 1.1 christos Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
113 1.1 christos Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
114 1.1 christos
115 1.1 christos for (i = 0; i < Localities; i++)
116 1.1 christos {
117 1.1 christos /* Display one row of the matrix */
118 1.1 christos
119 1.1 christos AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
120 1.1 christos for (j = 0; j < Localities; j++)
121 1.1 christos {
122 1.1 christos /* Check for beyond EOT */
123 1.1 christos
124 1.1 christos if (Offset >= Table->Length)
125 1.1 christos {
126 1.1 christos AcpiOsPrintf (
127 1.1 christos "\n**** Not enough room in table for all localities\n");
128 1.1 christos return;
129 1.1 christos }
130 1.1 christos
131 1.1 christos AcpiOsPrintf ("%2.2X", Row[j]);
132 1.1 christos Offset++;
133 1.1 christos
134 1.1 christos /* Display up to 16 bytes per output row */
135 1.1 christos
136 1.1 christos if ((j+1) < Localities)
137 1.1 christos {
138 1.1 christos AcpiOsPrintf (" ");
139 1.1 christos
140 1.1 christos if (j && (((j+1) % 16) == 0))
141 1.1 christos {
142 1.1 christos AcpiOsPrintf ("\\\n"); /* With line continuation char */
143 1.1 christos AcpiDmLineHeader (Offset, 0, NULL);
144 1.1 christos }
145 1.1 christos }
146 1.1 christos }
147 1.1 christos
148 1.1 christos /* Point to next row */
149 1.1 christos
150 1.1 christos AcpiOsPrintf ("\n");
151 1.1 christos Row += Localities;
152 1.1 christos }
153 1.1 christos }
154 1.1 christos
155 1.1 christos
156 1.1 christos /*******************************************************************************
157 1.1 christos *
158 1.1 christos * FUNCTION: AcpiDmDumpSrat
159 1.1 christos *
160 1.1 christos * PARAMETERS: Table - A SRAT table
161 1.1 christos *
162 1.1 christos * RETURN: None
163 1.1 christos *
164 1.1 christos * DESCRIPTION: Format the contents of a SRAT
165 1.1 christos *
166 1.1 christos ******************************************************************************/
167 1.1 christos
168 1.1 christos void
169 1.1 christos AcpiDmDumpSrat (
170 1.1 christos ACPI_TABLE_HEADER *Table)
171 1.1 christos {
172 1.1 christos ACPI_STATUS Status;
173 1.1 christos UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
174 1.1 christos ACPI_SUBTABLE_HEADER *Subtable;
175 1.1 christos ACPI_DMTABLE_INFO *InfoTable;
176 1.1 christos
177 1.1 christos
178 1.1 christos /* Main table */
179 1.1 christos
180 1.1 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
181 1.1 christos if (ACPI_FAILURE (Status))
182 1.1 christos {
183 1.1 christos return;
184 1.1 christos }
185 1.1 christos
186 1.1 christos /* Subtables */
187 1.1 christos
188 1.1 christos Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
189 1.1 christos while (Offset < Table->Length)
190 1.1 christos {
191 1.1 christos /* Common subtable header */
192 1.1 christos
193 1.1 christos AcpiOsPrintf ("\n");
194 1.1 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
195 1.1 christos Subtable->Length, AcpiDmTableInfoSratHdr);
196 1.1 christos if (ACPI_FAILURE (Status))
197 1.1 christos {
198 1.1 christos return;
199 1.1 christos }
200 1.1 christos
201 1.1 christos switch (Subtable->Type)
202 1.1 christos {
203 1.1 christos case ACPI_SRAT_TYPE_CPU_AFFINITY:
204 1.1 christos
205 1.1 christos InfoTable = AcpiDmTableInfoSrat0;
206 1.1 christos break;
207 1.1 christos
208 1.1 christos case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
209 1.1 christos
210 1.1 christos InfoTable = AcpiDmTableInfoSrat1;
211 1.1 christos break;
212 1.1 christos
213 1.1 christos case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
214 1.1 christos
215 1.1 christos InfoTable = AcpiDmTableInfoSrat2;
216 1.1 christos break;
217 1.1 christos
218 1.1 christos case ACPI_SRAT_TYPE_GICC_AFFINITY:
219 1.1 christos
220 1.1 christos InfoTable = AcpiDmTableInfoSrat3;
221 1.1 christos break;
222 1.1 christos
223 1.1 christos case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
224 1.1 christos
225 1.1 christos InfoTable = AcpiDmTableInfoSrat4;
226 1.1 christos break;
227 1.1 christos
228 1.1.1.3 christos case ACPI_SRAT_TYPE_GENERIC_AFFINITY:
229 1.1.1.3 christos
230 1.1.1.3 christos InfoTable = AcpiDmTableInfoSrat5;
231 1.1.1.3 christos break;
232 1.1.1.3 christos
233 1.1 christos default:
234 1.1 christos AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
235 1.1 christos Subtable->Type);
236 1.1 christos
237 1.1 christos /* Attempt to continue */
238 1.1 christos
239 1.1 christos if (!Subtable->Length)
240 1.1 christos {
241 1.1 christos AcpiOsPrintf ("Invalid zero length subtable\n");
242 1.1 christos return;
243 1.1 christos }
244 1.1 christos goto NextSubtable;
245 1.1 christos }
246 1.1 christos
247 1.1 christos AcpiOsPrintf ("\n");
248 1.1 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
249 1.1 christos Subtable->Length, InfoTable);
250 1.1 christos if (ACPI_FAILURE (Status))
251 1.1 christos {
252 1.1 christos return;
253 1.1 christos }
254 1.1 christos
255 1.1 christos NextSubtable:
256 1.1 christos /* Point to next subtable */
257 1.1 christos
258 1.1 christos Offset += Subtable->Length;
259 1.1 christos Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
260 1.1 christos Subtable->Length);
261 1.1 christos }
262 1.1 christos }
263 1.1 christos
264 1.1 christos
265 1.1 christos /*******************************************************************************
266 1.1 christos *
267 1.1 christos * FUNCTION: AcpiDmDumpStao
268 1.1 christos *
269 1.1 christos * PARAMETERS: Table - A STAO table
270 1.1 christos *
271 1.1 christos * RETURN: None
272 1.1 christos *
273 1.1 christos * DESCRIPTION: Format the contents of a STAO. This is a variable-length
274 1.1 christos * table that contains an open-ended number of ASCII strings
275 1.1 christos * at the end of the table.
276 1.1 christos *
277 1.1 christos ******************************************************************************/
278 1.1 christos
279 1.1 christos void
280 1.1 christos AcpiDmDumpStao (
281 1.1 christos ACPI_TABLE_HEADER *Table)
282 1.1 christos {
283 1.1 christos ACPI_STATUS Status;
284 1.1 christos char *Namepath;
285 1.1 christos UINT32 Length = Table->Length;
286 1.1 christos UINT32 StringLength;
287 1.1 christos UINT32 Offset = sizeof (ACPI_TABLE_STAO);
288 1.1 christos
289 1.1 christos
290 1.1 christos /* Main table */
291 1.1 christos
292 1.1 christos Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
293 1.1 christos if (ACPI_FAILURE (Status))
294 1.1 christos {
295 1.1 christos return;
296 1.1 christos }
297 1.1 christos
298 1.1 christos /* The rest of the table consists of Namepath strings */
299 1.1 christos
300 1.1 christos while (Offset < Table->Length)
301 1.1 christos {
302 1.1 christos Namepath = ACPI_ADD_PTR (char, Table, Offset);
303 1.1 christos StringLength = strlen (Namepath) + 1;
304 1.1 christos
305 1.1.1.4 christos AcpiDmLineHeader (Offset, StringLength, "Namepath");
306 1.1 christos AcpiOsPrintf ("\"%s\"\n", Namepath);
307 1.1 christos
308 1.1 christos /* Point to next namepath */
309 1.1 christos
310 1.1 christos Offset += StringLength;
311 1.1 christos }
312 1.1 christos }
313 1.1 christos
314 1.1 christos
315 1.1 christos /*******************************************************************************
316 1.1 christos *
317 1.1.1.7 christos * FUNCTION: AcpiDmDumpSvkl
318 1.1.1.7 christos *
319 1.1.1.7 christos * PARAMETERS: Table - A SVKL table
320 1.1.1.7 christos *
321 1.1.1.7 christos * RETURN: None
322 1.1.1.7 christos *
323 1.1.1.7 christos * DESCRIPTION: Format the contents of a SVKL. This is a variable-length
324 1.1.1.7 christos * table that contains an open-ended number of key subtables at
325 1.1.1.7 christos * the end of the header.
326 1.1.1.7 christos *
327 1.1.1.7 christos * NOTES: SVKL is essentially a flat table, with a small main table and
328 1.1.1.7 christos * a variable number of a single type of subtable.
329 1.1.1.7 christos *
330 1.1.1.7 christos ******************************************************************************/
331 1.1.1.7 christos
332 1.1.1.7 christos void
333 1.1.1.7 christos AcpiDmDumpSvkl (
334 1.1.1.7 christos ACPI_TABLE_HEADER *Table)
335 1.1.1.7 christos {
336 1.1.1.7 christos ACPI_STATUS Status;
337 1.1.1.7 christos UINT32 Length = Table->Length;
338 1.1.1.7 christos UINT32 Offset = sizeof (ACPI_TABLE_SVKL);
339 1.1.1.7 christos ACPI_SVKL_KEY *Subtable;
340 1.1.1.7 christos
341 1.1.1.7 christos
342 1.1.1.7 christos /* Main table */
343 1.1.1.7 christos
344 1.1.1.7 christos Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSvkl);
345 1.1.1.7 christos if (ACPI_FAILURE (Status))
346 1.1.1.7 christos {
347 1.1.1.7 christos return;
348 1.1.1.7 christos }
349 1.1.1.7 christos
350 1.1.1.7 christos /* The rest of the table consists of subtables (single type) */
351 1.1.1.7 christos
352 1.1.1.7 christos Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Table, Offset);
353 1.1.1.7 christos while (Offset < Table->Length)
354 1.1.1.7 christos {
355 1.1.1.7 christos /* Dump the subtable */
356 1.1.1.7 christos
357 1.1.1.7 christos AcpiOsPrintf ("\n");
358 1.1.1.7 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
359 1.1.1.7 christos sizeof (ACPI_SVKL_KEY), AcpiDmTableInfoSvkl0);
360 1.1.1.7 christos if (ACPI_FAILURE (Status))
361 1.1.1.7 christos {
362 1.1.1.7 christos return;
363 1.1.1.7 christos }
364 1.1.1.7 christos
365 1.1.1.7 christos /* Point to next subtable */
366 1.1.1.7 christos
367 1.1.1.7 christos Offset += sizeof (ACPI_SVKL_KEY);
368 1.1.1.7 christos Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Subtable,
369 1.1.1.7 christos sizeof (ACPI_SVKL_KEY));
370 1.1.1.7 christos }
371 1.1.1.7 christos }
372 1.1.1.7 christos
373 1.1.1.7 christos
374 1.1.1.7 christos /*******************************************************************************
375 1.1.1.7 christos *
376 1.1 christos * FUNCTION: AcpiDmDumpTcpa
377 1.1 christos *
378 1.1 christos * PARAMETERS: Table - A TCPA table
379 1.1 christos *
380 1.1 christos * RETURN: None
381 1.1 christos *
382 1.1 christos * DESCRIPTION: Format the contents of a TCPA.
383 1.1 christos *
384 1.1 christos * NOTE: There are two versions of the table with the same signature:
385 1.1 christos * the client version and the server version. The common
386 1.1 christos * PlatformClass field is used to differentiate the two types of
387 1.1 christos * tables.
388 1.1 christos *
389 1.1 christos ******************************************************************************/
390 1.1 christos
391 1.1 christos void
392 1.1 christos AcpiDmDumpTcpa (
393 1.1 christos ACPI_TABLE_HEADER *Table)
394 1.1 christos {
395 1.1 christos UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR);
396 1.1 christos ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR (
397 1.1 christos ACPI_TABLE_TCPA_HDR, Table);
398 1.1 christos ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR (
399 1.1 christos ACPI_TABLE_TCPA_HDR, Table, Offset);
400 1.1 christos ACPI_STATUS Status;
401 1.1 christos
402 1.1 christos
403 1.1 christos /* Main table */
404 1.1 christos
405 1.1 christos Status = AcpiDmDumpTable (Table->Length, 0, Table,
406 1.1 christos 0, AcpiDmTableInfoTcpaHdr);
407 1.1 christos if (ACPI_FAILURE (Status))
408 1.1 christos {
409 1.1 christos return;
410 1.1 christos }
411 1.1 christos
412 1.1 christos /*
413 1.1 christos * Examine the PlatformClass field to determine the table type.
414 1.1 christos * Either a client or server table. Only one.
415 1.1 christos */
416 1.1 christos switch (CommonHeader->PlatformClass)
417 1.1 christos {
418 1.1 christos case ACPI_TCPA_CLIENT_TABLE:
419 1.1 christos
420 1.1 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
421 1.1 christos Table->Length - Offset, AcpiDmTableInfoTcpaClient);
422 1.1 christos break;
423 1.1 christos
424 1.1 christos case ACPI_TCPA_SERVER_TABLE:
425 1.1 christos
426 1.1 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
427 1.1 christos Table->Length - Offset, AcpiDmTableInfoTcpaServer);
428 1.1 christos break;
429 1.1 christos
430 1.1 christos default:
431 1.1 christos
432 1.1 christos AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
433 1.1 christos CommonHeader->PlatformClass);
434 1.1 christos Status = AE_ERROR;
435 1.1 christos break;
436 1.1 christos }
437 1.1 christos
438 1.1 christos if (ACPI_FAILURE (Status))
439 1.1 christos {
440 1.1 christos AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
441 1.1 christos }
442 1.1 christos }
443 1.1 christos
444 1.1 christos
445 1.1 christos /*******************************************************************************
446 1.1 christos *
447 1.1 christos * FUNCTION: AcpiDmDumpTpm2
448 1.1 christos *
449 1.1 christos * PARAMETERS: Table - A TPM2 table
450 1.1 christos *
451 1.1 christos * RETURN: None
452 1.1 christos *
453 1.1 christos * DESCRIPTION: Format the contents of a TPM2.
454 1.1 christos *
455 1.1 christos ******************************************************************************/
456 1.1.1.7 christos
457 1.1.1.2 christos static void
458 1.1.1.2 christos AcpiDmDumpTpm2Rev3 (
459 1.1.1.2 christos ACPI_TABLE_HEADER *Table)
460 1.1.1.2 christos {
461 1.1.1.2 christos UINT32 Offset = sizeof (ACPI_TABLE_TPM23);
462 1.1.1.2 christos ACPI_TABLE_TPM23 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
463 1.1.1.2 christos ACPI_TPM23_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
464 1.1.1.2 christos ACPI_STATUS Status;
465 1.1.1.2 christos
466 1.1.1.2 christos
467 1.1.1.2 christos /* Main table */
468 1.1.1.2 christos
469 1.1.1.2 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
470 1.1.1.2 christos if (ACPI_FAILURE (Status))
471 1.1.1.2 christos {
472 1.1.1.2 christos return;
473 1.1.1.2 christos }
474 1.1.1.2 christos
475 1.1.1.2 christos /* Optional subtable if start method is ACPI start method */
476 1.1.1.2 christos
477 1.1.1.2 christos switch (CommonHeader->StartMethod)
478 1.1.1.2 christos {
479 1.1.1.2 christos case ACPI_TPM23_ACPI_START_METHOD:
480 1.1.1.2 christos
481 1.1.1.4 christos (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
482 1.1.1.2 christos Table->Length - Offset, AcpiDmTableInfoTpm23a);
483 1.1.1.2 christos break;
484 1.1.1.2 christos
485 1.1.1.2 christos default:
486 1.1.1.2 christos break;
487 1.1.1.2 christos }
488 1.1.1.2 christos }
489 1.1.1.2 christos
490 1.1.1.2 christos
491 1.1.1.2 christos /*******************************************************************************
492 1.1.1.2 christos *
493 1.1.1.2 christos * FUNCTION: AcpiDmDumpTpm2
494 1.1.1.2 christos *
495 1.1.1.2 christos * PARAMETERS: Table - A TPM2 table
496 1.1.1.2 christos *
497 1.1.1.2 christos * RETURN: None
498 1.1.1.2 christos *
499 1.1.1.2 christos * DESCRIPTION: Format the contents of a TPM2.
500 1.1.1.2 christos *
501 1.1.1.2 christos ******************************************************************************/
502 1.1 christos
503 1.1 christos void
504 1.1 christos AcpiDmDumpTpm2 (
505 1.1 christos ACPI_TABLE_HEADER *Table)
506 1.1 christos {
507 1.1 christos UINT32 Offset = sizeof (ACPI_TABLE_TPM2);
508 1.1 christos ACPI_TABLE_TPM2 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);
509 1.1 christos ACPI_TPM2_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
510 1.1 christos ACPI_TPM2_ARM_SMC *ArmSubtable;
511 1.1 christos ACPI_STATUS Status;
512 1.1 christos
513 1.1 christos
514 1.1.1.2 christos if (Table->Revision == 3)
515 1.1.1.2 christos {
516 1.1.1.2 christos AcpiDmDumpTpm2Rev3(Table);
517 1.1.1.2 christos return;
518 1.1.1.2 christos }
519 1.1.1.2 christos
520 1.1 christos /* Main table */
521 1.1 christos
522 1.1 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
523 1.1.1.2 christos
524 1.1 christos if (ACPI_FAILURE (Status))
525 1.1 christos {
526 1.1 christos return;
527 1.1 christos }
528 1.1 christos
529 1.1 christos AcpiOsPrintf ("\n");
530 1.1 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
531 1.1 christos Table->Length - Offset, AcpiDmTableInfoTpm2a);
532 1.1 christos if (ACPI_FAILURE (Status))
533 1.1 christos {
534 1.1 christos return;
535 1.1 christos }
536 1.1 christos
537 1.1 christos switch (CommonHeader->StartMethod)
538 1.1 christos {
539 1.1 christos case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
540 1.1 christos
541 1.1 christos ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,
542 1.1 christos sizeof (ACPI_TPM2_TRAILER));
543 1.1 christos Offset += sizeof (ACPI_TPM2_TRAILER);
544 1.1 christos
545 1.1 christos AcpiOsPrintf ("\n");
546 1.1.1.4 christos (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
547 1.1 christos Table->Length - Offset, AcpiDmTableInfoTpm211);
548 1.1 christos break;
549 1.1 christos
550 1.1 christos default:
551 1.1 christos break;
552 1.1 christos }
553 1.1 christos }
554 1.1 christos
555 1.1 christos
556 1.1 christos /*******************************************************************************
557 1.1 christos *
558 1.1.1.6 christos * FUNCTION: AcpiDmDumpViot
559 1.1 christos *
560 1.1.1.6 christos * PARAMETERS: Table - A VIOT table
561 1.1 christos *
562 1.1 christos * RETURN: None
563 1.1 christos *
564 1.1.1.6 christos * DESCRIPTION: Format the contents of a VIOT
565 1.1 christos *
566 1.1 christos ******************************************************************************/
567 1.1 christos
568 1.1 christos void
569 1.1.1.6 christos AcpiDmDumpViot (
570 1.1 christos ACPI_TABLE_HEADER *Table)
571 1.1 christos {
572 1.1 christos ACPI_STATUS Status;
573 1.1.1.6 christos ACPI_TABLE_VIOT *Viot;
574 1.1.1.6 christos ACPI_VIOT_HEADER *ViotHeader;
575 1.1.1.6 christos UINT16 Length;
576 1.1.1.6 christos UINT16 Offset;
577 1.1.1.6 christos ACPI_DMTABLE_INFO *InfoTable;
578 1.1 christos
579 1.1 christos /* Main table */
580 1.1 christos
581 1.1.1.6 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoViot);
582 1.1 christos if (ACPI_FAILURE (Status))
583 1.1 christos {
584 1.1 christos return;
585 1.1 christos }
586 1.1 christos
587 1.1.1.6 christos Viot = ACPI_CAST_PTR (ACPI_TABLE_VIOT, Table);
588 1.1 christos
589 1.1.1.6 christos Offset = Viot->NodeOffset;
590 1.1 christos while (Offset < Table->Length)
591 1.1 christos {
592 1.1 christos /* Common subtable header */
593 1.1.1.6 christos ViotHeader = ACPI_ADD_PTR (ACPI_VIOT_HEADER, Table, Offset);
594 1.1 christos AcpiOsPrintf ("\n");
595 1.1.1.6 christos
596 1.1.1.6 christos Length = sizeof (ACPI_VIOT_HEADER);
597 1.1.1.6 christos Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
598 1.1.1.6 christos AcpiDmTableInfoViotHeader);
599 1.1 christos if (ACPI_FAILURE (Status))
600 1.1 christos {
601 1.1 christos return;
602 1.1 christos }
603 1.1 christos
604 1.1.1.6 christos Length = ViotHeader->Length;
605 1.1.1.6 christos switch (ViotHeader->Type)
606 1.1.1.6 christos {
607 1.1.1.6 christos case ACPI_VIOT_NODE_PCI_RANGE:
608 1.1.1.6 christos
609 1.1.1.6 christos InfoTable = AcpiDmTableInfoViot1;
610 1.1.1.6 christos break;
611 1.1.1.6 christos
612 1.1.1.6 christos case ACPI_VIOT_NODE_MMIO:
613 1.1.1.6 christos
614 1.1.1.6 christos InfoTable = AcpiDmTableInfoViot2;
615 1.1.1.6 christos break;
616 1.1.1.6 christos
617 1.1.1.6 christos case ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI:
618 1.1.1.6 christos
619 1.1.1.6 christos InfoTable = AcpiDmTableInfoViot3;
620 1.1.1.6 christos break;
621 1.1.1.6 christos
622 1.1.1.6 christos case ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO:
623 1.1.1.6 christos
624 1.1.1.6 christos InfoTable = AcpiDmTableInfoViot4;
625 1.1.1.6 christos break;
626 1.1 christos
627 1.1.1.6 christos default:
628 1.1.1.6 christos
629 1.1.1.6 christos AcpiOsPrintf ("\n*** Unknown VIOT node type 0x%X\n",
630 1.1.1.6 christos ViotHeader->Type);
631 1.1.1.6 christos
632 1.1.1.6 christos /* Attempt to continue */
633 1.1.1.6 christos
634 1.1.1.6 christos if (!Length)
635 1.1.1.6 christos {
636 1.1.1.6 christos AcpiOsPrintf ("Invalid zero length VIOT node\n");
637 1.1.1.6 christos return;
638 1.1.1.6 christos }
639 1.1.1.6 christos goto NextSubtable;
640 1.1.1.6 christos }
641 1.1.1.6 christos
642 1.1.1.6 christos AcpiOsPrintf ("\n");
643 1.1.1.6 christos Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
644 1.1.1.6 christos InfoTable);
645 1.1.1.6 christos if (ACPI_FAILURE (Status))
646 1.1.1.6 christos {
647 1.1.1.6 christos return;
648 1.1.1.6 christos }
649 1.1.1.6 christos
650 1.1.1.6 christos NextSubtable:
651 1.1.1.6 christos Offset += Length;
652 1.1 christos }
653 1.1 christos }
654 1.1 christos
655 1.1 christos
656 1.1 christos /*******************************************************************************
657 1.1 christos *
658 1.1 christos * FUNCTION: AcpiDmDumpWdat
659 1.1 christos *
660 1.1 christos * PARAMETERS: Table - A WDAT table
661 1.1 christos *
662 1.1 christos * RETURN: None
663 1.1 christos *
664 1.1 christos * DESCRIPTION: Format the contents of a WDAT
665 1.1 christos *
666 1.1 christos ******************************************************************************/
667 1.1 christos
668 1.1 christos void
669 1.1 christos AcpiDmDumpWdat (
670 1.1 christos ACPI_TABLE_HEADER *Table)
671 1.1 christos {
672 1.1 christos ACPI_STATUS Status;
673 1.1 christos UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
674 1.1 christos ACPI_WDAT_ENTRY *Subtable;
675 1.1 christos
676 1.1 christos
677 1.1 christos /* Main table */
678 1.1 christos
679 1.1 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
680 1.1 christos if (ACPI_FAILURE (Status))
681 1.1 christos {
682 1.1 christos return;
683 1.1 christos }
684 1.1 christos
685 1.1 christos /* Subtables */
686 1.1 christos
687 1.1 christos Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
688 1.1 christos while (Offset < Table->Length)
689 1.1 christos {
690 1.1 christos /* Common subtable header */
691 1.1 christos
692 1.1 christos AcpiOsPrintf ("\n");
693 1.1 christos Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
694 1.1 christos sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
695 1.1 christos if (ACPI_FAILURE (Status))
696 1.1 christos {
697 1.1 christos return;
698 1.1 christos }
699 1.1 christos
700 1.1 christos /* Point to next subtable */
701 1.1 christos
702 1.1 christos Offset += sizeof (ACPI_WDAT_ENTRY);
703 1.1 christos Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,
704 1.1 christos sizeof (ACPI_WDAT_ENTRY));
705 1.1 christos }
706 1.1 christos }
707 1.1 christos
708 1.1 christos
709 1.1 christos /*******************************************************************************
710 1.1 christos *
711 1.1 christos * FUNCTION: AcpiDmDumpWpbt
712 1.1 christos *
713 1.1 christos * PARAMETERS: Table - A WPBT table
714 1.1 christos *
715 1.1 christos * RETURN: None
716 1.1 christos *
717 1.1 christos * DESCRIPTION: Format the contents of a WPBT. This table type consists
718 1.1 christos * of an open-ended arguments buffer at the end of the table.
719 1.1 christos *
720 1.1 christos ******************************************************************************/
721 1.1 christos
722 1.1 christos void
723 1.1 christos AcpiDmDumpWpbt (
724 1.1 christos ACPI_TABLE_HEADER *Table)
725 1.1 christos {
726 1.1 christos ACPI_STATUS Status;
727 1.1 christos ACPI_TABLE_WPBT *Subtable;
728 1.1 christos UINT32 Length = Table->Length;
729 1.1 christos UINT16 ArgumentsLength;
730 1.1 christos
731 1.1 christos
732 1.1 christos /* Dump the main table */
733 1.1 christos
734 1.1 christos Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
735 1.1 christos if (ACPI_FAILURE (Status))
736 1.1 christos {
737 1.1 christos return;
738 1.1 christos }
739 1.1 christos
740 1.1 christos /* Extract the arguments buffer length from the main table */
741 1.1 christos
742 1.1 christos Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
743 1.1 christos ArgumentsLength = Subtable->ArgumentsLength;
744 1.1 christos
745 1.1 christos /* Dump the arguments buffer */
746 1.1 christos
747 1.1 christos (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
748 1.1 christos AcpiDmTableInfoWpbt0);
749 1.1 christos }
750