1 /******************************************************************************
2 *
3 * Module Name: dmtbdump3 - Dump ACPI data tables that contain no AML code
4 *
5 *****************************************************************************/
6
7 /******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
27 *
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************
115 *
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
118 *
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
133 *
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 *
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
149 *
150 *****************************************************************************/
151
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acdisasm.h>
155 #include <contrib/dev/acpica/include/actables.h>
156
157 /* This module used for application-level code only */
158
159 #define _COMPONENT ACPI_CA_DISASSEMBLER
160 ACPI_MODULE_NAME ("dmtbdump3")
161
162
163 /*******************************************************************************
164 *
165 * FUNCTION: AcpiDmDumpSlic
166 *
167 * PARAMETERS: Table - A SLIC table
168 *
169 * RETURN: None
170 *
171 * DESCRIPTION: Format the contents of a SLIC
172 *
173 ******************************************************************************/
174
175 void
AcpiDmDumpSlic(ACPI_TABLE_HEADER * Table)176 AcpiDmDumpSlic (
177 ACPI_TABLE_HEADER *Table)
178 {
179
180 (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER),
181 (void *) ((UINT8 *)Table + sizeof (*Table)),
182 Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
183 }
184
185
186 /*******************************************************************************
187 *
188 * FUNCTION: AcpiDmDumpSlit
189 *
190 * PARAMETERS: Table - An SLIT
191 *
192 * RETURN: None
193 *
194 * DESCRIPTION: Format the contents of a SLIT
195 *
196 ******************************************************************************/
197
198 void
AcpiDmDumpSlit(ACPI_TABLE_HEADER * Table)199 AcpiDmDumpSlit (
200 ACPI_TABLE_HEADER *Table)
201 {
202 ACPI_STATUS Status;
203 UINT32 Offset;
204 UINT8 *Row;
205 UINT32 Localities;
206 UINT32 i;
207 UINT32 j;
208
209
210 /* Main table */
211
212 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
213 if (ACPI_FAILURE (Status))
214 {
215 return;
216 }
217
218 /* Display the Locality NxN Matrix */
219
220 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
221 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
222 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
223
224 for (i = 0; i < Localities; i++)
225 {
226 /* Display one row of the matrix */
227
228 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
229 for (j = 0; j < Localities; j++)
230 {
231 /* Check for beyond EOT */
232
233 if (Offset >= Table->Length)
234 {
235 AcpiOsPrintf (
236 "\n**** Not enough room in table for all localities\n");
237 return;
238 }
239
240 AcpiOsPrintf ("%2.2X", Row[j]);
241 Offset++;
242
243 /* Display up to 16 bytes per output row */
244
245 if ((j+1) < Localities)
246 {
247 AcpiOsPrintf (" ");
248
249 if (j && (((j+1) % 16) == 0))
250 {
251 AcpiOsPrintf ("\\\n"); /* With line continuation char */
252 AcpiDmLineHeader (Offset, 0, NULL);
253 }
254 }
255 }
256
257 /* Point to next row */
258
259 AcpiOsPrintf ("\n");
260 Row += Localities;
261 }
262 }
263
264
265 /*******************************************************************************
266 *
267 * FUNCTION: AcpiDmDumpSrat
268 *
269 * PARAMETERS: Table - A SRAT table
270 *
271 * RETURN: None
272 *
273 * DESCRIPTION: Format the contents of a SRAT
274 *
275 ******************************************************************************/
276
277 void
AcpiDmDumpSrat(ACPI_TABLE_HEADER * Table)278 AcpiDmDumpSrat (
279 ACPI_TABLE_HEADER *Table)
280 {
281 ACPI_STATUS Status;
282 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
283 ACPI_SUBTABLE_HEADER *Subtable;
284 ACPI_DMTABLE_INFO *InfoTable;
285
286
287 /* Main table */
288
289 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
290 if (ACPI_FAILURE (Status))
291 {
292 return;
293 }
294
295 /* Subtables */
296
297 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
298 while (Offset < Table->Length)
299 {
300 /* Common subtable header */
301
302 AcpiOsPrintf ("\n");
303 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
304 Subtable->Length, AcpiDmTableInfoSratHdr);
305 if (ACPI_FAILURE (Status))
306 {
307 return;
308 }
309
310 switch (Subtable->Type)
311 {
312 case ACPI_SRAT_TYPE_CPU_AFFINITY:
313
314 InfoTable = AcpiDmTableInfoSrat0;
315 break;
316
317 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
318
319 InfoTable = AcpiDmTableInfoSrat1;
320 break;
321
322 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
323
324 InfoTable = AcpiDmTableInfoSrat2;
325 break;
326
327 case ACPI_SRAT_TYPE_GICC_AFFINITY:
328
329 InfoTable = AcpiDmTableInfoSrat3;
330 break;
331
332 case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
333
334 InfoTable = AcpiDmTableInfoSrat4;
335 break;
336
337 case ACPI_SRAT_TYPE_GENERIC_AFFINITY:
338
339 InfoTable = AcpiDmTableInfoSrat5;
340 break;
341
342 case ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY:
343
344 InfoTable = AcpiDmTableInfoSrat6;
345 break;
346
347 case ACPI_SRAT_TYPE_RINTC_AFFINITY:
348
349 InfoTable = AcpiDmTableInfoSrat7;
350 break;
351
352 default:
353 AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
354 Subtable->Type);
355
356 /* Attempt to continue */
357
358 if (!Subtable->Length)
359 {
360 AcpiOsPrintf ("Invalid zero length subtable\n");
361 return;
362 }
363 goto NextSubtable;
364 }
365
366 AcpiOsPrintf ("\n");
367 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
368 Subtable->Length, InfoTable);
369 if (ACPI_FAILURE (Status))
370 {
371 return;
372 }
373
374 NextSubtable:
375 /* Point to next subtable */
376
377 Offset += Subtable->Length;
378 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
379 Subtable->Length);
380 }
381 }
382
383
384 /*******************************************************************************
385 *
386 * FUNCTION: AcpiDmDumpStao
387 *
388 * PARAMETERS: Table - A STAO table
389 *
390 * RETURN: None
391 *
392 * DESCRIPTION: Format the contents of a STAO. This is a variable-length
393 * table that contains an open-ended number of ASCII strings
394 * at the end of the table.
395 *
396 ******************************************************************************/
397
398 void
AcpiDmDumpStao(ACPI_TABLE_HEADER * Table)399 AcpiDmDumpStao (
400 ACPI_TABLE_HEADER *Table)
401 {
402 ACPI_STATUS Status;
403 char *Namepath;
404 UINT32 Length = Table->Length;
405 UINT32 StringLength;
406 UINT32 Offset = sizeof (ACPI_TABLE_STAO);
407
408
409 /* Main table */
410
411 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
412 if (ACPI_FAILURE (Status))
413 {
414 return;
415 }
416
417 /* The rest of the table consists of Namepath strings */
418
419 while (Offset < Table->Length)
420 {
421 Namepath = ACPI_ADD_PTR (char, Table, Offset);
422 StringLength = strlen (Namepath) + 1;
423
424 AcpiDmLineHeader (Offset, StringLength, "Namepath");
425 AcpiOsPrintf ("\"%s\"\n", Namepath);
426
427 /* Point to next namepath */
428
429 Offset += StringLength;
430 }
431 }
432
433
434 /*******************************************************************************
435 *
436 * FUNCTION: AcpiDmDumpSvkl
437 *
438 * PARAMETERS: Table - A SVKL table
439 *
440 * RETURN: None
441 *
442 * DESCRIPTION: Format the contents of a SVKL. This is a variable-length
443 * table that contains an open-ended number of key subtables at
444 * the end of the header.
445 *
446 * NOTES: SVKL is essentially a flat table, with a small main table and
447 * a variable number of a single type of subtable.
448 *
449 ******************************************************************************/
450
451 void
AcpiDmDumpSvkl(ACPI_TABLE_HEADER * Table)452 AcpiDmDumpSvkl (
453 ACPI_TABLE_HEADER *Table)
454 {
455 ACPI_STATUS Status;
456 UINT32 Length = Table->Length;
457 UINT32 Offset = sizeof (ACPI_TABLE_SVKL);
458 ACPI_SVKL_KEY *Subtable;
459
460
461 /* Main table */
462
463 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSvkl);
464 if (ACPI_FAILURE (Status))
465 {
466 return;
467 }
468
469 /* The rest of the table consists of subtables (single type) */
470
471 Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Table, Offset);
472 while (Offset < Table->Length)
473 {
474 /* Dump the subtable */
475
476 AcpiOsPrintf ("\n");
477 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
478 sizeof (ACPI_SVKL_KEY), AcpiDmTableInfoSvkl0);
479 if (ACPI_FAILURE (Status))
480 {
481 return;
482 }
483
484 /* Point to next subtable */
485
486 Offset += sizeof (ACPI_SVKL_KEY);
487 Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Subtable,
488 sizeof (ACPI_SVKL_KEY));
489 }
490 }
491
492
493 /*******************************************************************************
494 *
495 * FUNCTION: AcpiDmDumpSwft
496 *
497 * PARAMETERS: Table - A SWFT table
498 *
499 * RETURN: None
500 *
501 * DESCRIPTION: Format the contents of a SWFT. This is a variable-length
502 * table that contains an open-ended number of SoundWire files
503 * after the end of the header.
504 *
505 ******************************************************************************/
506
507 void
AcpiDmDumpSwft(ACPI_TABLE_HEADER * Table)508 AcpiDmDumpSwft (
509 ACPI_TABLE_HEADER *Table)
510 {
511 ACPI_STATUS Status;
512 UINT32 Length = Table->Length;
513 UINT32 Offset = sizeof (ACPI_TABLE_SWFT);
514 ACPI_SWFT_FILE *SubtableHdr;
515 ACPI_SWFT_FILE *SubtableData;
516
517
518 /* Main table */
519
520 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSwft);
521 if (ACPI_FAILURE (Status))
522 {
523 return;
524 }
525
526 /* The rest of the table consists of subtables (single type) */
527
528 while (Offset < Table->Length)
529 {
530 SubtableHdr = ACPI_ADD_PTR (ACPI_SWFT_FILE, Table, Offset);
531
532 /* Dump the subtable */
533
534 AcpiOsPrintf ("\n");
535 Status = AcpiDmDumpTable (Table->Length, Offset, SubtableHdr,
536 sizeof (ACPI_SWFT_FILE), AcpiDmTableInfoSwftFileHdr);
537 if (ACPI_FAILURE (Status))
538 {
539 return;
540 }
541
542 Offset += sizeof(ACPI_SWFT_FILE);
543
544 SubtableData = ACPI_ADD_PTR (ACPI_SWFT_FILE, Table, Offset);
545
546 Status = AcpiDmDumpTable (Table->Length, Offset, SubtableData,
547 SubtableHdr->FileLength - sizeof(ACPI_SWFT_FILE), AcpiDmTableInfoSwftFileData);
548 if (ACPI_FAILURE (Status))
549 {
550 return;
551 }
552
553 /* Point to next subtable */
554
555 Offset += SubtableHdr->FileLength - sizeof(ACPI_SWFT_FILE);
556 }
557 }
558
559
560 /*******************************************************************************
561 *
562 * FUNCTION: AcpiDmDumpTcpa
563 *
564 * PARAMETERS: Table - A TCPA table
565 *
566 * RETURN: None
567 *
568 * DESCRIPTION: Format the contents of a TCPA.
569 *
570 * NOTE: There are two versions of the table with the same signature:
571 * the client version and the server version. The common
572 * PlatformClass field is used to differentiate the two types of
573 * tables.
574 *
575 ******************************************************************************/
576
577 void
AcpiDmDumpTcpa(ACPI_TABLE_HEADER * Table)578 AcpiDmDumpTcpa (
579 ACPI_TABLE_HEADER *Table)
580 {
581 UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR);
582 ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR (
583 ACPI_TABLE_TCPA_HDR, Table);
584 ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR (
585 ACPI_TABLE_TCPA_HDR, Table, Offset);
586 ACPI_STATUS Status;
587
588
589 /* Main table */
590
591 Status = AcpiDmDumpTable (Table->Length, 0, Table,
592 0, AcpiDmTableInfoTcpaHdr);
593 if (ACPI_FAILURE (Status))
594 {
595 return;
596 }
597
598 /*
599 * Examine the PlatformClass field to determine the table type.
600 * Either a client or server table. Only one.
601 */
602 switch (CommonHeader->PlatformClass)
603 {
604 case ACPI_TCPA_CLIENT_TABLE:
605
606 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
607 Table->Length - Offset, AcpiDmTableInfoTcpaClient);
608 break;
609
610 case ACPI_TCPA_SERVER_TABLE:
611
612 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
613 Table->Length - Offset, AcpiDmTableInfoTcpaServer);
614 break;
615
616 default:
617
618 AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
619 CommonHeader->PlatformClass);
620 Status = AE_ERROR;
621 break;
622 }
623
624 if (ACPI_FAILURE (Status))
625 {
626 AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
627 }
628 }
629
630
631 /*******************************************************************************
632 *
633 * FUNCTION: AcpiDmDumpTpm2
634 *
635 * PARAMETERS: Table - A TPM2 table
636 *
637 * RETURN: None
638 *
639 * DESCRIPTION: Format the contents of a TPM2.
640 *
641 ******************************************************************************/
642
643 static void
AcpiDmDumpTpm2Rev3(ACPI_TABLE_HEADER * Table)644 AcpiDmDumpTpm2Rev3 (
645 ACPI_TABLE_HEADER *Table)
646 {
647 UINT32 Offset = sizeof (ACPI_TABLE_TPM23);
648 ACPI_TABLE_TPM23 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
649 ACPI_TPM23_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
650 ACPI_STATUS Status;
651
652
653 /* Main table */
654
655 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
656 if (ACPI_FAILURE (Status))
657 {
658 return;
659 }
660
661 /* Optional subtable if start method is ACPI start method */
662
663 switch (CommonHeader->StartMethod)
664 {
665 case ACPI_TPM23_ACPI_START_METHOD:
666
667 (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
668 Table->Length - Offset, AcpiDmTableInfoTpm23a);
669 break;
670
671 default:
672 break;
673 }
674 }
675
676
677 /*******************************************************************************
678 *
679 * FUNCTION: AcpiDmDumpTpm2
680 *
681 * PARAMETERS: Table - A TPM2 table
682 *
683 * RETURN: None
684 *
685 * DESCRIPTION: Format the contents of a TPM2.
686 *
687 ******************************************************************************/
688
689 void
AcpiDmDumpTpm2(ACPI_TABLE_HEADER * Table)690 AcpiDmDumpTpm2 (
691 ACPI_TABLE_HEADER *Table)
692 {
693 UINT32 Offset = sizeof (ACPI_TABLE_TPM2);
694 ACPI_TABLE_TPM2 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);
695 ACPI_TPM2_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
696 ACPI_TPM2_ARM_SMC *ArmSubtable;
697 ACPI_STATUS Status;
698
699
700 if (Table->Revision == 3)
701 {
702 AcpiDmDumpTpm2Rev3(Table);
703 return;
704 }
705
706 /* Main table */
707
708 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
709
710 if (ACPI_FAILURE (Status))
711 {
712 return;
713 }
714
715 AcpiOsPrintf ("\n");
716 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
717 Table->Length - Offset, AcpiDmTableInfoTpm2a);
718 if (ACPI_FAILURE (Status))
719 {
720 return;
721 }
722
723 switch (CommonHeader->StartMethod)
724 {
725 case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
726
727 ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,
728 sizeof (ACPI_TPM2_TRAILER));
729 Offset += sizeof (ACPI_TPM2_TRAILER);
730
731 AcpiOsPrintf ("\n");
732 (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
733 Table->Length - Offset, AcpiDmTableInfoTpm211);
734 break;
735
736 default:
737 break;
738 }
739 }
740
741
742 /*******************************************************************************
743 *
744 * FUNCTION: AcpiDmDumpViot
745 *
746 * PARAMETERS: Table - A VIOT table
747 *
748 * RETURN: None
749 *
750 * DESCRIPTION: Format the contents of a VIOT
751 *
752 ******************************************************************************/
753
754 void
AcpiDmDumpViot(ACPI_TABLE_HEADER * Table)755 AcpiDmDumpViot (
756 ACPI_TABLE_HEADER *Table)
757 {
758 ACPI_STATUS Status;
759 ACPI_TABLE_VIOT *Viot;
760 ACPI_VIOT_HEADER *ViotHeader;
761 UINT16 Length;
762 UINT32 Offset;
763 ACPI_DMTABLE_INFO *InfoTable;
764
765 /* Main table */
766
767 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoViot);
768 if (ACPI_FAILURE (Status))
769 {
770 return;
771 }
772
773 Viot = ACPI_CAST_PTR (ACPI_TABLE_VIOT, Table);
774
775 Offset = Viot->NodeOffset;
776 while (Offset < Table->Length)
777 {
778 /* Common subtable header */
779 ViotHeader = ACPI_ADD_PTR (ACPI_VIOT_HEADER, Table, Offset);
780 AcpiOsPrintf ("\n");
781
782 Length = sizeof (ACPI_VIOT_HEADER);
783 Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
784 AcpiDmTableInfoViotHeader);
785 if (ACPI_FAILURE (Status))
786 {
787 return;
788 }
789
790 Length = ViotHeader->Length;
791 switch (ViotHeader->Type)
792 {
793 case ACPI_VIOT_NODE_PCI_RANGE:
794
795 InfoTable = AcpiDmTableInfoViot1;
796 break;
797
798 case ACPI_VIOT_NODE_MMIO:
799
800 InfoTable = AcpiDmTableInfoViot2;
801 break;
802
803 case ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI:
804
805 InfoTable = AcpiDmTableInfoViot3;
806 break;
807
808 case ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO:
809
810 InfoTable = AcpiDmTableInfoViot4;
811 break;
812
813 default:
814
815 AcpiOsPrintf ("\n*** Unknown VIOT node type 0x%X\n",
816 ViotHeader->Type);
817
818 /* Attempt to continue */
819
820 if (!Length)
821 {
822 AcpiOsPrintf ("Invalid zero length VIOT node\n");
823 return;
824 }
825 goto NextSubtable;
826 }
827
828 AcpiOsPrintf ("\n");
829 Status = AcpiDmDumpTable (Table->Length, Offset, ViotHeader, Length,
830 InfoTable);
831 if (ACPI_FAILURE (Status))
832 {
833 return;
834 }
835
836 NextSubtable:
837 Offset += Length;
838 }
839 }
840
841
842 /*******************************************************************************
843 *
844 * FUNCTION: AcpiDmDumpWdat
845 *
846 * PARAMETERS: Table - A WDAT table
847 *
848 * RETURN: None
849 *
850 * DESCRIPTION: Format the contents of a WDAT
851 *
852 ******************************************************************************/
853
854 void
AcpiDmDumpWdat(ACPI_TABLE_HEADER * Table)855 AcpiDmDumpWdat (
856 ACPI_TABLE_HEADER *Table)
857 {
858 ACPI_STATUS Status;
859 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
860 ACPI_WDAT_ENTRY *Subtable;
861
862
863 /* Main table */
864
865 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
866 if (ACPI_FAILURE (Status))
867 {
868 return;
869 }
870
871 /* Subtables */
872
873 Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
874 while (Offset < Table->Length)
875 {
876 /* Common subtable header */
877
878 AcpiOsPrintf ("\n");
879 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
880 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
881 if (ACPI_FAILURE (Status))
882 {
883 return;
884 }
885
886 /* Point to next subtable */
887
888 Offset += sizeof (ACPI_WDAT_ENTRY);
889 Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,
890 sizeof (ACPI_WDAT_ENTRY));
891 }
892 }
893
894
895 /*******************************************************************************
896 *
897 * FUNCTION: AcpiDmDumpWpbt
898 *
899 * PARAMETERS: Table - A WPBT table
900 *
901 * RETURN: None
902 *
903 * DESCRIPTION: Format the contents of a WPBT. This table type consists
904 * of an open-ended arguments buffer at the end of the table.
905 *
906 ******************************************************************************/
907
908 void
AcpiDmDumpWpbt(ACPI_TABLE_HEADER * Table)909 AcpiDmDumpWpbt (
910 ACPI_TABLE_HEADER *Table)
911 {
912 ACPI_STATUS Status;
913 ACPI_TABLE_WPBT *Subtable;
914 UINT16 ArgumentsLength;
915
916
917 /* Dump the main table */
918
919 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWpbt);
920 if (ACPI_FAILURE (Status))
921 {
922 return;
923 }
924
925 /* Extract the arguments buffer length from the main table */
926
927 Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
928 ArgumentsLength = Subtable->ArgumentsLength;
929
930 /* Dump the arguments buffer if present */
931
932 if (ArgumentsLength)
933 {
934 (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
935 AcpiDmTableInfoWpbt0);
936 }
937 }
938