xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump.c (revision b37f6c9805edb4b89f0a8c2b78f78a3dcfc0647b)
1 /******************************************************************************
2  *
3  * Module Name: dmtbdump - 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 - 2018, 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    ("dmtbdump")
161 
162 
163 /* Local prototypes */
164 
165 static void
166 AcpiDmValidateFadtLength (
167     UINT32                  Revision,
168     UINT32                  Length);
169 
170 
171 /*******************************************************************************
172  *
173  * FUNCTION:    AcpiDmDumpBuffer
174  *
175  * PARAMETERS:  Table               - ACPI Table or subtable
176  *              BufferOffset        - Offset of buffer from Table above
177  *              Length              - Length of the buffer
178  *              AbsoluteOffset      - Offset of buffer in the main ACPI table
179  *              Header              - Name of the buffer field (printed on the
180  *                                    first line only.)
181  *
182  * RETURN:      None
183  *
184  * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
185  *              disassembler output format.)
186  *
187  ******************************************************************************/
188 
189 void
190 AcpiDmDumpBuffer (
191     void                    *Table,
192     UINT32                  BufferOffset,
193     UINT32                  Length,
194     UINT32                  AbsoluteOffset,
195     char                    *Header)
196 {
197     UINT8                   *Buffer;
198     UINT32                  i;
199 
200 
201     if (!Length)
202     {
203         return;
204     }
205 
206     Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
207     i = 0;
208 
209     while (i < Length)
210     {
211         if (!(i % 16))
212         {
213             /* Insert a backslash - line continuation character */
214 
215             if (Length > 16)
216             {
217                 AcpiOsPrintf ("\\\n    ");
218             }
219         }
220 
221         AcpiOsPrintf ("%.02X ", *Buffer);
222         i++;
223         Buffer++;
224         AbsoluteOffset++;
225     }
226 
227     AcpiOsPrintf ("\n");
228 }
229 
230 
231 /*******************************************************************************
232  *
233  * FUNCTION:    AcpiDmDumpUnicode
234  *
235  * PARAMETERS:  Table               - ACPI Table or subtable
236  *              BufferOffset        - Offset of buffer from Table above
237  *              ByteLength          - Length of the buffer
238  *
239  * RETURN:      None
240  *
241  * DESCRIPTION: Validate and dump the contents of a buffer that contains
242  *              unicode data. The output is a standard ASCII string. If it
243  *              appears that the data is not unicode, the buffer is dumped
244  *              as hex characters.
245  *
246  ******************************************************************************/
247 
248 void
249 AcpiDmDumpUnicode (
250     void                    *Table,
251     UINT32                  BufferOffset,
252     UINT32                  ByteLength)
253 {
254     UINT8                   *Buffer;
255     UINT32                  Length;
256     UINT32                  i;
257 
258 
259     Buffer = ((UINT8 *) Table) + BufferOffset;
260     Length = ByteLength - 2; /* Last two bytes are the null terminator */
261 
262     /* Ensure all low bytes are entirely printable ASCII */
263 
264     for (i = 0; i < Length; i += 2)
265     {
266         if (!isprint (Buffer[i]))
267         {
268             goto DumpRawBuffer;
269         }
270     }
271 
272     /* Ensure all high bytes are zero */
273 
274     for (i = 1; i < Length; i += 2)
275     {
276         if (Buffer[i])
277         {
278             goto DumpRawBuffer;
279         }
280     }
281 
282     /* Dump the buffer as a normal string */
283 
284     AcpiOsPrintf ("\"");
285     for (i = 0; i < Length; i += 2)
286     {
287         AcpiOsPrintf ("%c", Buffer[i]);
288     }
289 
290     AcpiOsPrintf ("\"\n");
291     return;
292 
293 DumpRawBuffer:
294     AcpiDmDumpBuffer (Table, BufferOffset, ByteLength,
295         BufferOffset, NULL);
296     AcpiOsPrintf ("\n");
297 }
298 
299 
300 /*******************************************************************************
301  *
302  * FUNCTION:    AcpiDmDumpRsdp
303  *
304  * PARAMETERS:  Table               - A RSDP
305  *
306  * RETURN:      Length of the table (there is not always a length field,
307  *              use revision or length if available (ACPI 2.0+))
308  *
309  * DESCRIPTION: Format the contents of a RSDP
310  *
311  ******************************************************************************/
312 
313 UINT32
314 AcpiDmDumpRsdp (
315     ACPI_TABLE_HEADER       *Table)
316 {
317     ACPI_TABLE_RSDP         *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
318     UINT32                  Length = sizeof (ACPI_RSDP_COMMON);
319     UINT8                   Checksum;
320     ACPI_STATUS             Status;
321 
322 
323     /* Dump the common ACPI 1.0 portion */
324 
325     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
326     if (ACPI_FAILURE (Status))
327     {
328         return (Length);
329     }
330 
331     /* Validate the first checksum */
332 
333     Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
334         Rsdp->Checksum);
335     if (Checksum != Rsdp->Checksum)
336     {
337         AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
338             Checksum);
339     }
340 
341     /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
342 
343     if (Rsdp->Revision > 0)
344     {
345         Length = Rsdp->Length;
346         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
347         if (ACPI_FAILURE (Status))
348         {
349             return (Length);
350         }
351 
352         /* Validate the extended checksum over entire RSDP */
353 
354         Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
355             Rsdp->ExtendedChecksum);
356         if (Checksum != Rsdp->ExtendedChecksum)
357         {
358             AcpiOsPrintf (
359                 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
360                 Checksum);
361         }
362     }
363 
364     return (Length);
365 }
366 
367 
368 /*******************************************************************************
369  *
370  * FUNCTION:    AcpiDmDumpRsdt
371  *
372  * PARAMETERS:  Table               - A RSDT
373  *
374  * RETURN:      None
375  *
376  * DESCRIPTION: Format the contents of a RSDT
377  *
378  ******************************************************************************/
379 
380 void
381 AcpiDmDumpRsdt (
382     ACPI_TABLE_HEADER       *Table)
383 {
384     UINT32                  *Array;
385     UINT32                  Entries;
386     UINT32                  Offset;
387     UINT32                  i;
388 
389 
390     /* Point to start of table pointer array */
391 
392     Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
393     Offset = sizeof (ACPI_TABLE_HEADER);
394 
395     /* RSDT uses 32-bit pointers */
396 
397     Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
398 
399     for (i = 0; i < Entries; i++)
400     {
401         AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
402         AcpiOsPrintf ("%8.8X\n", Array[i]);
403         Offset += sizeof (UINT32);
404     }
405 }
406 
407 
408 /*******************************************************************************
409  *
410  * FUNCTION:    AcpiDmDumpXsdt
411  *
412  * PARAMETERS:  Table               - A XSDT
413  *
414  * RETURN:      None
415  *
416  * DESCRIPTION: Format the contents of a XSDT
417  *
418  ******************************************************************************/
419 
420 void
421 AcpiDmDumpXsdt (
422     ACPI_TABLE_HEADER       *Table)
423 {
424     UINT64                  *Array;
425     UINT32                  Entries;
426     UINT32                  Offset;
427     UINT32                  i;
428 
429 
430     /* Point to start of table pointer array */
431 
432     Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
433     Offset = sizeof (ACPI_TABLE_HEADER);
434 
435     /* XSDT uses 64-bit pointers */
436 
437     Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
438 
439     for (i = 0; i < Entries; i++)
440     {
441         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
442         AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
443         Offset += sizeof (UINT64);
444     }
445 }
446 
447 
448 /*******************************************************************************
449  *
450  * FUNCTION:    AcpiDmDumpFadt
451  *
452  * PARAMETERS:  Table               - A FADT
453  *
454  * RETURN:      None
455  *
456  * DESCRIPTION: Format the contents of a FADT
457  *
458  * NOTE:        We cannot depend on the FADT version to indicate the actual
459  *              contents of the FADT because of BIOS bugs. The table length
460  *              is the only reliable indicator.
461  *
462  ******************************************************************************/
463 
464 void
465 AcpiDmDumpFadt (
466     ACPI_TABLE_HEADER       *Table)
467 {
468     ACPI_STATUS             Status;
469 
470 
471     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
472 
473     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
474         AcpiDmTableInfoFadt1);
475     if (ACPI_FAILURE (Status))
476     {
477         return;
478     }
479 
480     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
481 
482     if ((Table->Length > ACPI_FADT_V1_SIZE) &&
483         (Table->Length <= ACPI_FADT_V2_SIZE))
484     {
485         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
486             AcpiDmTableInfoFadt2);
487         if (ACPI_FAILURE (Status))
488         {
489             return;
490         }
491     }
492 
493     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
494 
495     else if (Table->Length > ACPI_FADT_V2_SIZE)
496     {
497         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
498             AcpiDmTableInfoFadt3);
499         if (ACPI_FAILURE (Status))
500         {
501             return;
502         }
503 
504         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
505 
506         if (Table->Length > ACPI_FADT_V3_SIZE)
507         {
508             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
509                 AcpiDmTableInfoFadt5);
510             if (ACPI_FAILURE (Status))
511             {
512                 return;
513             }
514         }
515 
516         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
517 
518         if (Table->Length > ACPI_FADT_V3_SIZE)
519         {
520             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
521                 AcpiDmTableInfoFadt6);
522             if (ACPI_FAILURE (Status))
523             {
524                 return;
525             }
526         }
527     }
528 
529     /* Validate various fields in the FADT, including length */
530 
531     AcpiTbCreateLocalFadt (Table, Table->Length);
532 
533     /* Validate FADT length against the revision */
534 
535     AcpiDmValidateFadtLength (Table->Revision, Table->Length);
536 }
537 
538 
539 /*******************************************************************************
540  *
541  * FUNCTION:    AcpiDmValidateFadtLength
542  *
543  * PARAMETERS:  Revision            - FADT revision (Header->Revision)
544  *              Length              - FADT length (Header->Length
545  *
546  * RETURN:      None
547  *
548  * DESCRIPTION: Check the FADT revision against the expected table length for
549  *              that revision. Issue a warning if the length is not what was
550  *              expected. This seems to be such a common BIOS bug that the
551  *              FADT revision has been rendered virtually meaningless.
552  *
553  ******************************************************************************/
554 
555 static void
556 AcpiDmValidateFadtLength (
557     UINT32                  Revision,
558     UINT32                  Length)
559 {
560     UINT32                  ExpectedLength;
561 
562 
563     switch (Revision)
564     {
565     case 0:
566 
567         AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
568         return;
569 
570     case 1:
571 
572         ExpectedLength = ACPI_FADT_V1_SIZE;
573         break;
574 
575     case 2:
576 
577         ExpectedLength = ACPI_FADT_V2_SIZE;
578         break;
579 
580     case 3:
581     case 4:
582 
583         ExpectedLength = ACPI_FADT_V3_SIZE;
584         break;
585 
586     case 5:
587 
588         ExpectedLength = ACPI_FADT_V5_SIZE;
589         break;
590 
591     default:
592 
593         return;
594     }
595 
596     if (Length == ExpectedLength)
597     {
598         return;
599     }
600 
601     AcpiOsPrintf (
602         "\n// ACPI Warning: FADT revision %X does not match length: "
603         "found %X expected %X\n",
604         Revision, Length, ExpectedLength);
605 }
606 
607 
608 /*******************************************************************************
609  *
610  * FUNCTION:    AcpiDmDumpAsf
611  *
612  * PARAMETERS:  Table               - A ASF table
613  *
614  * RETURN:      None
615  *
616  * DESCRIPTION: Format the contents of a ASF table
617  *
618  ******************************************************************************/
619 
620 void
621 AcpiDmDumpAsf (
622     ACPI_TABLE_HEADER       *Table)
623 {
624     ACPI_STATUS             Status;
625     UINT32                  Offset = sizeof (ACPI_TABLE_HEADER);
626     ACPI_ASF_INFO           *Subtable;
627     ACPI_DMTABLE_INFO       *InfoTable;
628     ACPI_DMTABLE_INFO       *DataInfoTable = NULL;
629     UINT8                   *DataTable = NULL;
630     UINT32                  DataCount = 0;
631     UINT32                  DataLength = 0;
632     UINT32                  DataOffset = 0;
633     UINT32                  i;
634     UINT8                   Type;
635 
636 
637     /* No main table, only subtables */
638 
639     Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
640     while (Offset < Table->Length)
641     {
642         /* Common subtable header */
643 
644         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
645             Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
646         if (ACPI_FAILURE (Status))
647         {
648             return;
649         }
650 
651         /* The actual type is the lower 7 bits of Type */
652 
653         Type = (UINT8) (Subtable->Header.Type & 0x7F);
654 
655         switch (Type)
656         {
657         case ACPI_ASF_TYPE_INFO:
658 
659             InfoTable = AcpiDmTableInfoAsf0;
660             break;
661 
662         case ACPI_ASF_TYPE_ALERT:
663 
664             InfoTable = AcpiDmTableInfoAsf1;
665             DataInfoTable = AcpiDmTableInfoAsf1a;
666             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT));
667             DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts;
668             DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength;
669             DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
670             break;
671 
672         case ACPI_ASF_TYPE_CONTROL:
673 
674             InfoTable = AcpiDmTableInfoAsf2;
675             DataInfoTable = AcpiDmTableInfoAsf2a;
676             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE));
677             DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls;
678             DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength;
679             DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
680             break;
681 
682         case ACPI_ASF_TYPE_BOOT:
683 
684             InfoTable = AcpiDmTableInfoAsf3;
685             break;
686 
687         case ACPI_ASF_TYPE_ADDRESS:
688 
689             InfoTable = AcpiDmTableInfoAsf4;
690             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS));
691             DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices;
692             DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
693             break;
694 
695         default:
696 
697             AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n",
698                 Subtable->Header.Type);
699             return;
700         }
701 
702         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
703             Subtable->Header.Length, InfoTable);
704         if (ACPI_FAILURE (Status))
705         {
706             return;
707         }
708 
709         /* Dump variable-length extra data */
710 
711         switch (Type)
712         {
713         case ACPI_ASF_TYPE_ALERT:
714         case ACPI_ASF_TYPE_CONTROL:
715 
716             for (i = 0; i < DataCount; i++)
717             {
718                 AcpiOsPrintf ("\n");
719                 Status = AcpiDmDumpTable (Table->Length, DataOffset,
720                     DataTable, DataLength, DataInfoTable);
721                 if (ACPI_FAILURE (Status))
722                 {
723                     return;
724                 }
725 
726                 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
727                 DataOffset += DataLength;
728             }
729             break;
730 
731         case ACPI_ASF_TYPE_ADDRESS:
732 
733             for (i = 0; i < DataLength; i++)
734             {
735                 if (!(i % 16))
736                 {
737                     AcpiDmLineHeader (DataOffset, 1, "Addresses");
738                 }
739 
740                 AcpiOsPrintf ("%2.2X ", *DataTable);
741                 DataTable++;
742                 DataOffset++;
743 
744                 if (DataOffset > Table->Length)
745                 {
746                     AcpiOsPrintf (
747                         "**** ACPI table terminates in the middle of a "
748                         "data structure! (ASF! table)\n");
749                     return;
750                 }
751             }
752 
753             AcpiOsPrintf ("\n");
754             break;
755 
756         default:
757 
758             break;
759         }
760 
761         AcpiOsPrintf ("\n");
762 
763         /* Point to next subtable */
764 
765         if (!Subtable->Header.Length)
766         {
767             AcpiOsPrintf ("Invalid zero subtable header length\n");
768             return;
769         }
770 
771         Offset += Subtable->Header.Length;
772         Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
773             Subtable->Header.Length);
774     }
775 }
776 
777 
778 /*******************************************************************************
779  *
780  * FUNCTION:    AcpiDmDumpCpep
781  *
782  * PARAMETERS:  Table               - A CPEP table
783  *
784  * RETURN:      None
785  *
786  * DESCRIPTION: Format the contents of a CPEP. This table type consists
787  *              of an open-ended number of subtables.
788  *
789  ******************************************************************************/
790 
791 void
792 AcpiDmDumpCpep (
793     ACPI_TABLE_HEADER       *Table)
794 {
795     ACPI_STATUS             Status;
796     ACPI_CPEP_POLLING       *Subtable;
797     UINT32                  Length = Table->Length;
798     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
799 
800 
801     /* Main table */
802 
803     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
804     if (ACPI_FAILURE (Status))
805     {
806         return;
807     }
808 
809     /* Subtables */
810 
811     Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
812     while (Offset < Table->Length)
813     {
814         AcpiOsPrintf ("\n");
815         Status = AcpiDmDumpTable (Length, Offset, Subtable,
816             Subtable->Header.Length, AcpiDmTableInfoCpep0);
817         if (ACPI_FAILURE (Status))
818         {
819             return;
820         }
821 
822         /* Point to next subtable */
823 
824         Offset += Subtable->Header.Length;
825         Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable,
826             Subtable->Header.Length);
827     }
828 }
829 
830 
831 /*******************************************************************************
832  *
833  * FUNCTION:    AcpiDmDumpCsrt
834  *
835  * PARAMETERS:  Table               - A CSRT table
836  *
837  * RETURN:      None
838  *
839  * DESCRIPTION: Format the contents of a CSRT. This table type consists
840  *              of an open-ended number of subtables.
841  *
842  ******************************************************************************/
843 
844 void
845 AcpiDmDumpCsrt (
846     ACPI_TABLE_HEADER       *Table)
847 {
848     ACPI_STATUS             Status;
849     ACPI_CSRT_GROUP         *Subtable;
850     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
851     ACPI_CSRT_DESCRIPTOR    *SubSubtable;
852     UINT32                  Length = Table->Length;
853     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
854     UINT32                  SubOffset;
855     UINT32                  SubSubOffset;
856     UINT32                  InfoLength;
857 
858 
859     /* The main table only contains the ACPI header, thus already handled */
860 
861     /* Subtables (Resource Groups) */
862 
863     Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
864     while (Offset < Table->Length)
865     {
866         /* Resource group subtable */
867 
868         AcpiOsPrintf ("\n");
869         Status = AcpiDmDumpTable (Length, Offset, Subtable,
870             Subtable->Length, AcpiDmTableInfoCsrt0);
871         if (ACPI_FAILURE (Status))
872         {
873             return;
874         }
875 
876         /* Shared info subtable (One per resource group) */
877 
878         SubOffset = sizeof (ACPI_CSRT_GROUP);
879         SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
880             Offset + SubOffset);
881 
882         AcpiOsPrintf ("\n");
883         Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
884             sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
885         if (ACPI_FAILURE (Status))
886         {
887             return;
888         }
889 
890         SubOffset += Subtable->SharedInfoLength;
891 
892         /* Sub-Subtables (Resource Descriptors) */
893 
894         SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
895             Offset + SubOffset);
896 
897         while ((SubOffset < Subtable->Length) &&
898               ((Offset + SubOffset) < Table->Length))
899         {
900             AcpiOsPrintf ("\n");
901             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
902                 SubSubtable->Length, AcpiDmTableInfoCsrt2);
903             if (ACPI_FAILURE (Status))
904             {
905                 return;
906             }
907 
908             SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
909 
910             /* Resource-specific info buffer */
911 
912             InfoLength = SubSubtable->Length - SubSubOffset;
913             if (InfoLength)
914             {
915                 Status = AcpiDmDumpTable (Length,
916                     Offset + SubOffset + SubSubOffset, Table,
917                     InfoLength, AcpiDmTableInfoCsrt2a);
918                 if (ACPI_FAILURE (Status))
919                 {
920                     return;
921                 }
922                 SubSubOffset += InfoLength;
923             }
924 
925             /* Point to next sub-subtable */
926 
927             SubOffset += SubSubtable->Length;
928             SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
929                 SubSubtable->Length);
930         }
931 
932         /* Point to next subtable */
933 
934         Offset += Subtable->Length;
935         Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable,
936             Subtable->Length);
937     }
938 }
939 
940 
941 /*******************************************************************************
942  *
943  * FUNCTION:    AcpiDmDumpDbg2
944  *
945  * PARAMETERS:  Table               - A DBG2 table
946  *
947  * RETURN:      None
948  *
949  * DESCRIPTION: Format the contents of a DBG2. This table type consists
950  *              of an open-ended number of subtables.
951  *
952  ******************************************************************************/
953 
954 void
955 AcpiDmDumpDbg2 (
956     ACPI_TABLE_HEADER       *Table)
957 {
958     ACPI_STATUS             Status;
959     ACPI_DBG2_DEVICE        *Subtable;
960     UINT32                  Length = Table->Length;
961     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
962     UINT32                  i;
963     UINT32                  ArrayOffset;
964     UINT32                  AbsoluteOffset;
965     UINT8                   *Array;
966 
967 
968     /* Main table */
969 
970     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
971     if (ACPI_FAILURE (Status))
972     {
973         return;
974     }
975 
976     /* Subtables */
977 
978     Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
979     while (Offset < Table->Length)
980     {
981         AcpiOsPrintf ("\n");
982         Status = AcpiDmDumpTable (Length, Offset, Subtable,
983             Subtable->Length, AcpiDmTableInfoDbg2Device);
984         if (ACPI_FAILURE (Status))
985         {
986             return;
987         }
988 
989         /* Dump the BaseAddress array */
990 
991         for (i = 0; i < Subtable->RegisterCount; i++)
992         {
993             ArrayOffset = Subtable->BaseAddressOffset +
994                 (sizeof (ACPI_GENERIC_ADDRESS) * i);
995             AbsoluteOffset = Offset + ArrayOffset;
996             Array = (UINT8 *) Subtable + ArrayOffset;
997 
998             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
999                 Subtable->Length, AcpiDmTableInfoDbg2Addr);
1000             if (ACPI_FAILURE (Status))
1001             {
1002                 return;
1003             }
1004         }
1005 
1006         /* Dump the AddressSize array */
1007 
1008         for (i = 0; i < Subtable->RegisterCount; i++)
1009         {
1010             ArrayOffset = Subtable->AddressSizeOffset +
1011                 (sizeof (UINT32) * i);
1012             AbsoluteOffset = Offset + ArrayOffset;
1013             Array = (UINT8 *) Subtable + ArrayOffset;
1014 
1015             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
1016                 Subtable->Length, AcpiDmTableInfoDbg2Size);
1017             if (ACPI_FAILURE (Status))
1018             {
1019                 return;
1020             }
1021         }
1022 
1023         /* Dump the Namestring (required) */
1024 
1025         AcpiOsPrintf ("\n");
1026         ArrayOffset = Subtable->NamepathOffset;
1027         AbsoluteOffset = Offset + ArrayOffset;
1028         Array = (UINT8 *) Subtable + ArrayOffset;
1029 
1030         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
1031             Subtable->Length, AcpiDmTableInfoDbg2Name);
1032         if (ACPI_FAILURE (Status))
1033         {
1034             return;
1035         }
1036 
1037         /* Dump the OemData (optional) */
1038 
1039         if (Subtable->OemDataOffset)
1040         {
1041             Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
1042                 Table, Subtable->OemDataLength,
1043                 AcpiDmTableInfoDbg2OemData);
1044             if (ACPI_FAILURE (Status))
1045             {
1046                 return;
1047             }
1048         }
1049 
1050         /* Point to next subtable */
1051 
1052         Offset += Subtable->Length;
1053         Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
1054             Subtable->Length);
1055     }
1056 }
1057 
1058 
1059 /*******************************************************************************
1060  *
1061  * FUNCTION:    AcpiDmDumpDmar
1062  *
1063  * PARAMETERS:  Table               - A DMAR table
1064  *
1065  * RETURN:      None
1066  *
1067  * DESCRIPTION: Format the contents of a DMAR. This table type consists
1068  *              of an open-ended number of subtables.
1069  *
1070  ******************************************************************************/
1071 
1072 void
1073 AcpiDmDumpDmar (
1074     ACPI_TABLE_HEADER       *Table)
1075 {
1076     ACPI_STATUS             Status;
1077     ACPI_DMAR_HEADER        *Subtable;
1078     UINT32                  Length = Table->Length;
1079     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
1080     ACPI_DMTABLE_INFO       *InfoTable;
1081     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
1082     UINT32                  ScopeOffset;
1083     UINT8                   *PciPath;
1084     UINT32                  PathOffset;
1085 
1086 
1087     /* Main table */
1088 
1089     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
1090     if (ACPI_FAILURE (Status))
1091     {
1092         return;
1093     }
1094 
1095     /* Subtables */
1096 
1097     Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
1098     while (Offset < Table->Length)
1099     {
1100         /* Common subtable header */
1101 
1102         AcpiOsPrintf ("\n");
1103         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1104             Subtable->Length, AcpiDmTableInfoDmarHdr);
1105         if (ACPI_FAILURE (Status))
1106         {
1107             return;
1108         }
1109 
1110         AcpiOsPrintf ("\n");
1111 
1112         switch (Subtable->Type)
1113         {
1114         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
1115 
1116             InfoTable = AcpiDmTableInfoDmar0;
1117             ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
1118             break;
1119 
1120         case ACPI_DMAR_TYPE_RESERVED_MEMORY:
1121 
1122             InfoTable = AcpiDmTableInfoDmar1;
1123             ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
1124             break;
1125 
1126         case ACPI_DMAR_TYPE_ROOT_ATS:
1127 
1128             InfoTable = AcpiDmTableInfoDmar2;
1129             ScopeOffset = sizeof (ACPI_DMAR_ATSR);
1130             break;
1131 
1132         case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
1133 
1134             InfoTable = AcpiDmTableInfoDmar3;
1135             ScopeOffset = sizeof (ACPI_DMAR_RHSA);
1136             break;
1137 
1138         case ACPI_DMAR_TYPE_NAMESPACE:
1139 
1140             InfoTable = AcpiDmTableInfoDmar4;
1141             ScopeOffset = sizeof (ACPI_DMAR_ANDD);
1142             break;
1143 
1144         default:
1145 
1146             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
1147                 Subtable->Type);
1148             return;
1149         }
1150 
1151         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1152             Subtable->Length, InfoTable);
1153         if (ACPI_FAILURE (Status))
1154         {
1155             return;
1156         }
1157 
1158         /*
1159          * Dump the optional device scope entries
1160          */
1161         if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1162             (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
1163         {
1164             /* These types do not support device scopes */
1165 
1166             goto NextSubtable;
1167         }
1168 
1169         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
1170         while (ScopeOffset < Subtable->Length)
1171         {
1172             AcpiOsPrintf ("\n");
1173             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
1174                 ScopeTable->Length, AcpiDmTableInfoDmarScope);
1175             if (ACPI_FAILURE (Status))
1176             {
1177                 return;
1178             }
1179             AcpiOsPrintf ("\n");
1180 
1181             /* Dump the PCI Path entries for this device scope */
1182 
1183             PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
1184 
1185             PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
1186                 sizeof (ACPI_DMAR_DEVICE_SCOPE));
1187 
1188             while (PathOffset < ScopeTable->Length)
1189             {
1190                 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2,
1191                     "PCI Path");
1192                 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
1193 
1194                 /* Point to next PCI Path entry */
1195 
1196                 PathOffset += 2;
1197                 PciPath += 2;
1198                 AcpiOsPrintf ("\n");
1199             }
1200 
1201             /* Point to next device scope entry */
1202 
1203             ScopeOffset += ScopeTable->Length;
1204             ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
1205                 ScopeTable, ScopeTable->Length);
1206         }
1207 
1208 NextSubtable:
1209         /* Point to next subtable */
1210 
1211         Offset += Subtable->Length;
1212         Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
1213             Subtable->Length);
1214     }
1215 }
1216 
1217 
1218 /*******************************************************************************
1219  *
1220  * FUNCTION:    AcpiDmDumpDrtm
1221  *
1222  * PARAMETERS:  Table               - A DRTM table
1223  *
1224  * RETURN:      None
1225  *
1226  * DESCRIPTION: Format the contents of a DRTM.
1227  *
1228  ******************************************************************************/
1229 
1230 void
1231 AcpiDmDumpDrtm (
1232     ACPI_TABLE_HEADER       *Table)
1233 {
1234     ACPI_STATUS             Status;
1235     UINT32                  Offset;
1236     ACPI_DRTM_VTABLE_LIST   *DrtmVtl;
1237     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
1238     ACPI_DRTM_DPS_ID        *DrtmDps;
1239     UINT32                  Count;
1240 
1241 
1242     /* Main table */
1243 
1244     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
1245         AcpiDmTableInfoDrtm);
1246     if (ACPI_FAILURE (Status))
1247     {
1248         return;
1249     }
1250 
1251     Offset = sizeof (ACPI_TABLE_DRTM);
1252 
1253     /* Sub-tables */
1254 
1255     /* Dump ValidatedTable length */
1256 
1257     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
1258     AcpiOsPrintf ("\n");
1259     Status = AcpiDmDumpTable (Table->Length, Offset,
1260         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
1261         AcpiDmTableInfoDrtm0);
1262     if (ACPI_FAILURE (Status))
1263     {
1264             return;
1265     }
1266 
1267     Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
1268 
1269     /* Dump Validated table addresses */
1270 
1271     Count = 0;
1272     while ((Offset < Table->Length) &&
1273             (DrtmVtl->ValidatedTableCount > Count))
1274     {
1275         Status = AcpiDmDumpTable (Table->Length, Offset,
1276             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
1277             AcpiDmTableInfoDrtm0a);
1278         if (ACPI_FAILURE (Status))
1279         {
1280             return;
1281         }
1282 
1283         Offset += sizeof (UINT64);
1284         Count++;
1285     }
1286 
1287     /* Dump ResourceList length */
1288 
1289     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
1290     AcpiOsPrintf ("\n");
1291     Status = AcpiDmDumpTable (Table->Length, Offset,
1292         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
1293         AcpiDmTableInfoDrtm1);
1294     if (ACPI_FAILURE (Status))
1295     {
1296         return;
1297     }
1298 
1299     Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
1300 
1301     /* Dump the Resource List */
1302 
1303     Count = 0;
1304     while ((Offset < Table->Length) &&
1305            (DrtmRl->ResourceCount > Count))
1306     {
1307         Status = AcpiDmDumpTable (Table->Length, Offset,
1308             ACPI_ADD_PTR (void, Table, Offset),
1309             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
1310         if (ACPI_FAILURE (Status))
1311         {
1312             return;
1313         }
1314 
1315         Offset += sizeof (ACPI_DRTM_RESOURCE);
1316         Count++;
1317     }
1318 
1319     /* Dump DPS */
1320 
1321     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
1322     AcpiOsPrintf ("\n");
1323     (void) AcpiDmDumpTable (Table->Length, Offset,
1324         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
1325 }
1326 
1327 
1328 /*******************************************************************************
1329  *
1330  * FUNCTION:    AcpiDmDumpEinj
1331  *
1332  * PARAMETERS:  Table               - A EINJ table
1333  *
1334  * RETURN:      None
1335  *
1336  * DESCRIPTION: Format the contents of a EINJ. This table type consists
1337  *              of an open-ended number of subtables.
1338  *
1339  ******************************************************************************/
1340 
1341 void
1342 AcpiDmDumpEinj (
1343     ACPI_TABLE_HEADER       *Table)
1344 {
1345     ACPI_STATUS             Status;
1346     ACPI_WHEA_HEADER        *Subtable;
1347     UINT32                  Length = Table->Length;
1348     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
1349 
1350 
1351     /* Main table */
1352 
1353     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
1354     if (ACPI_FAILURE (Status))
1355     {
1356         return;
1357     }
1358 
1359     /* Subtables */
1360 
1361     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1362     while (Offset < Table->Length)
1363     {
1364         AcpiOsPrintf ("\n");
1365         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1366             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1367         if (ACPI_FAILURE (Status))
1368         {
1369             return;
1370         }
1371 
1372         /* Point to next subtable (each subtable is of fixed length) */
1373 
1374         Offset += sizeof (ACPI_WHEA_HEADER);
1375         Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable,
1376             sizeof (ACPI_WHEA_HEADER));
1377     }
1378 }
1379 
1380 
1381 /*******************************************************************************
1382  *
1383  * FUNCTION:    AcpiDmDumpErst
1384  *
1385  * PARAMETERS:  Table               - A ERST table
1386  *
1387  * RETURN:      None
1388  *
1389  * DESCRIPTION: Format the contents of a ERST. This table type consists
1390  *              of an open-ended number of subtables.
1391  *
1392  ******************************************************************************/
1393 
1394 void
1395 AcpiDmDumpErst (
1396     ACPI_TABLE_HEADER       *Table)
1397 {
1398     ACPI_STATUS             Status;
1399     ACPI_WHEA_HEADER        *Subtable;
1400     UINT32                  Length = Table->Length;
1401     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
1402 
1403 
1404     /* Main table */
1405 
1406     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1407     if (ACPI_FAILURE (Status))
1408     {
1409         return;
1410     }
1411 
1412     /* Subtables */
1413 
1414     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1415     while (Offset < Table->Length)
1416     {
1417         AcpiOsPrintf ("\n");
1418         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1419             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1420         if (ACPI_FAILURE (Status))
1421         {
1422             return;
1423         }
1424 
1425         /* Point to next subtable (each subtable is of fixed length) */
1426 
1427         Offset += sizeof (ACPI_WHEA_HEADER);
1428         Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable,
1429             sizeof (ACPI_WHEA_HEADER));
1430     }
1431 }
1432 
1433 
1434 /*******************************************************************************
1435  *
1436  * FUNCTION:    AcpiDmDumpFpdt
1437  *
1438  * PARAMETERS:  Table               - A FPDT table
1439  *
1440  * RETURN:      None
1441  *
1442  * DESCRIPTION: Format the contents of a FPDT. This table type consists
1443  *              of an open-ended number of subtables.
1444  *
1445  ******************************************************************************/
1446 
1447 void
1448 AcpiDmDumpFpdt (
1449     ACPI_TABLE_HEADER       *Table)
1450 {
1451     ACPI_STATUS             Status;
1452     ACPI_FPDT_HEADER        *Subtable;
1453     UINT32                  Length = Table->Length;
1454     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
1455     ACPI_DMTABLE_INFO       *InfoTable;
1456 
1457 
1458     /* There is no main table (other than the standard ACPI header) */
1459 
1460     /* Subtables */
1461 
1462     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1463     while (Offset < Table->Length)
1464     {
1465         /* Common subtable header */
1466 
1467         AcpiOsPrintf ("\n");
1468         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1469             Subtable->Length, AcpiDmTableInfoFpdtHdr);
1470         if (ACPI_FAILURE (Status))
1471         {
1472             return;
1473         }
1474 
1475         switch (Subtable->Type)
1476         {
1477         case ACPI_FPDT_TYPE_BOOT:
1478 
1479             InfoTable = AcpiDmTableInfoFpdt0;
1480             break;
1481 
1482         case ACPI_FPDT_TYPE_S3PERF:
1483 
1484             InfoTable = AcpiDmTableInfoFpdt1;
1485             break;
1486 
1487         default:
1488 
1489             AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
1490                 Subtable->Type);
1491 
1492             /* Attempt to continue */
1493 
1494             if (!Subtable->Length)
1495             {
1496                 AcpiOsPrintf ("Invalid zero length subtable\n");
1497                 return;
1498             }
1499             goto NextSubtable;
1500         }
1501 
1502         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1503             Subtable->Length, InfoTable);
1504         if (ACPI_FAILURE (Status))
1505         {
1506             return;
1507         }
1508 
1509 NextSubtable:
1510         /* Point to next subtable */
1511 
1512         Offset += Subtable->Length;
1513         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable,
1514             Subtable->Length);
1515     }
1516 }
1517 
1518 
1519 /*******************************************************************************
1520  *
1521  * FUNCTION:    AcpiDmDumpGtdt
1522  *
1523  * PARAMETERS:  Table               - A GTDT table
1524  *
1525  * RETURN:      None
1526  *
1527  * DESCRIPTION: Format the contents of a GTDT. This table type consists
1528  *              of an open-ended number of subtables.
1529  *
1530  ******************************************************************************/
1531 
1532 void
1533 AcpiDmDumpGtdt (
1534     ACPI_TABLE_HEADER       *Table)
1535 {
1536     ACPI_STATUS             Status;
1537     ACPI_GTDT_HEADER        *Subtable;
1538     UINT32                  Length = Table->Length;
1539     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
1540     ACPI_DMTABLE_INFO       *InfoTable;
1541     UINT32                  SubtableLength;
1542     UINT32                  GtCount;
1543     ACPI_GTDT_TIMER_ENTRY   *GtxTable;
1544 
1545 
1546     /* Main table */
1547 
1548     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
1549     if (ACPI_FAILURE (Status))
1550     {
1551         return;
1552     }
1553 
1554     /* Subtables */
1555 
1556     Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1557     while (Offset < Table->Length)
1558     {
1559         /* Common subtable header */
1560 
1561         AcpiOsPrintf ("\n");
1562         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1563             Subtable->Length, AcpiDmTableInfoGtdtHdr);
1564         if (ACPI_FAILURE (Status))
1565         {
1566             return;
1567         }
1568 
1569         GtCount = 0;
1570         switch (Subtable->Type)
1571         {
1572         case ACPI_GTDT_TYPE_TIMER_BLOCK:
1573 
1574             SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
1575             GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1576                 Subtable))->TimerCount;
1577 
1578             InfoTable = AcpiDmTableInfoGtdt0;
1579             break;
1580 
1581         case ACPI_GTDT_TYPE_WATCHDOG:
1582 
1583             SubtableLength = sizeof (ACPI_GTDT_WATCHDOG);
1584 
1585             InfoTable = AcpiDmTableInfoGtdt1;
1586             break;
1587 
1588         default:
1589 
1590             /* Cannot continue on unknown type - no length */
1591 
1592             AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n",
1593                 Subtable->Type);
1594             return;
1595         }
1596 
1597         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1598             Subtable->Length, InfoTable);
1599         if (ACPI_FAILURE (Status))
1600         {
1601             return;
1602         }
1603 
1604         /* Point to end of current subtable (each subtable above is of fixed length) */
1605 
1606         Offset += SubtableLength;
1607 
1608         /* If there are any Gt Timer Blocks from above, dump them now */
1609 
1610         if (GtCount)
1611         {
1612             GtxTable = ACPI_ADD_PTR (
1613                 ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength);
1614             SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
1615 
1616             while (GtCount)
1617             {
1618                 AcpiOsPrintf ("\n");
1619                 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
1620                     sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
1621                 if (ACPI_FAILURE (Status))
1622                 {
1623                     return;
1624                 }
1625                 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
1626                 GtxTable++;
1627                 GtCount--;
1628             }
1629         }
1630 
1631         /* Point to next subtable */
1632 
1633         Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength);
1634     }
1635 }
1636 
1637 
1638 /*******************************************************************************
1639  *
1640  * FUNCTION:    AcpiDmDumpHest
1641  *
1642  * PARAMETERS:  Table               - A HEST table
1643  *
1644  * RETURN:      None
1645  *
1646  * DESCRIPTION: Format the contents of a HEST. This table type consists
1647  *              of an open-ended number of subtables.
1648  *
1649  ******************************************************************************/
1650 
1651 void
1652 AcpiDmDumpHest (
1653     ACPI_TABLE_HEADER       *Table)
1654 {
1655     ACPI_STATUS             Status;
1656     ACPI_HEST_HEADER        *Subtable;
1657     UINT32                  Length = Table->Length;
1658     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
1659     ACPI_DMTABLE_INFO       *InfoTable;
1660     UINT32                  SubtableLength;
1661     UINT32                  BankCount;
1662     ACPI_HEST_IA_ERROR_BANK *BankTable;
1663 
1664 
1665     /* Main table */
1666 
1667     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1668     if (ACPI_FAILURE (Status))
1669     {
1670         return;
1671     }
1672 
1673     /* Subtables */
1674 
1675     Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1676     while (Offset < Table->Length)
1677     {
1678         BankCount = 0;
1679         switch (Subtable->Type)
1680         {
1681         case ACPI_HEST_TYPE_IA32_CHECK:
1682 
1683             InfoTable = AcpiDmTableInfoHest0;
1684             SubtableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1685             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1686                 Subtable))->NumHardwareBanks;
1687             break;
1688 
1689         case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1690 
1691             InfoTable = AcpiDmTableInfoHest1;
1692             SubtableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1693             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1694                 Subtable))->NumHardwareBanks;
1695             break;
1696 
1697         case ACPI_HEST_TYPE_IA32_NMI:
1698 
1699             InfoTable = AcpiDmTableInfoHest2;
1700             SubtableLength = sizeof (ACPI_HEST_IA_NMI);
1701             break;
1702 
1703         case ACPI_HEST_TYPE_AER_ROOT_PORT:
1704 
1705             InfoTable = AcpiDmTableInfoHest6;
1706             SubtableLength = sizeof (ACPI_HEST_AER_ROOT);
1707             break;
1708 
1709         case ACPI_HEST_TYPE_AER_ENDPOINT:
1710 
1711             InfoTable = AcpiDmTableInfoHest7;
1712             SubtableLength = sizeof (ACPI_HEST_AER);
1713             break;
1714 
1715         case ACPI_HEST_TYPE_AER_BRIDGE:
1716 
1717             InfoTable = AcpiDmTableInfoHest8;
1718             SubtableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1719             break;
1720 
1721         case ACPI_HEST_TYPE_GENERIC_ERROR:
1722 
1723             InfoTable = AcpiDmTableInfoHest9;
1724             SubtableLength = sizeof (ACPI_HEST_GENERIC);
1725             break;
1726 
1727         case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1728 
1729             InfoTable = AcpiDmTableInfoHest10;
1730             SubtableLength = sizeof (ACPI_HEST_GENERIC_V2);
1731             break;
1732 
1733         case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1734 
1735             InfoTable = AcpiDmTableInfoHest11;
1736             SubtableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK);
1737             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK,
1738                 Subtable))->NumHardwareBanks;
1739             break;
1740 
1741         default:
1742 
1743             /* Cannot continue on unknown type - no length */
1744 
1745             AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
1746                 Subtable->Type);
1747             return;
1748         }
1749 
1750         AcpiOsPrintf ("\n");
1751         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1752             SubtableLength, InfoTable);
1753         if (ACPI_FAILURE (Status))
1754         {
1755             return;
1756         }
1757 
1758         /* Point to end of current subtable (each subtable above is of fixed length) */
1759 
1760         Offset += SubtableLength;
1761 
1762         /* If there are any (fixed-length) Error Banks from above, dump them now */
1763 
1764         if (BankCount)
1765         {
1766             BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, Subtable,
1767                 SubtableLength);
1768             SubtableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1769 
1770             while (BankCount)
1771             {
1772                 AcpiOsPrintf ("\n");
1773                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1774                     sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1775                 if (ACPI_FAILURE (Status))
1776                 {
1777                     return;
1778                 }
1779 
1780                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1781                 BankTable++;
1782                 BankCount--;
1783             }
1784         }
1785 
1786         /* Point to next subtable */
1787 
1788         Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Subtable, SubtableLength);
1789     }
1790 }
1791 
1792 
1793 /*******************************************************************************
1794  *
1795  * FUNCTION:    AcpiDmDumpHmat
1796  *
1797  * PARAMETERS:  Table               - A HMAT table
1798  *
1799  * RETURN:      None
1800  *
1801  * DESCRIPTION: Format the contents of a HMAT.
1802  *
1803  ******************************************************************************/
1804 
1805 void
1806 AcpiDmDumpHmat (
1807     ACPI_TABLE_HEADER       *Table)
1808 {
1809     ACPI_STATUS             Status;
1810     ACPI_HMAT_STRUCTURE     *HmatStruct;
1811     ACPI_HMAT_LOCALITY      *HmatLocality;
1812     ACPI_HMAT_CACHE         *HmatCache;
1813     UINT32                  Offset;
1814     UINT32                  SubtableOffset;
1815     UINT32                  Length;
1816     ACPI_DMTABLE_INFO       *InfoTable;
1817     UINT32                  i, j;
1818 
1819 
1820     /* Main table */
1821 
1822     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat);
1823     if (ACPI_FAILURE (Status))
1824     {
1825         return;
1826     }
1827     Offset = sizeof (ACPI_TABLE_HMAT);
1828 
1829     while (Offset < Table->Length)
1830     {
1831         AcpiOsPrintf ("\n");
1832         SubtableOffset = 0;
1833 
1834         /* Dump HMAT structure header */
1835 
1836         HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset);
1837         if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE))
1838         {
1839             AcpiOsPrintf ("Invalid HMAT structure length\n");
1840             return;
1841         }
1842         Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
1843             HmatStruct->Length, AcpiDmTableInfoHmatHdr);
1844         if (ACPI_FAILURE (Status))
1845         {
1846             return;
1847         }
1848 
1849         switch (HmatStruct->Type)
1850         {
1851         case ACPI_HMAT_TYPE_ADDRESS_RANGE:
1852 
1853             InfoTable = AcpiDmTableInfoHmat0;
1854             Length = sizeof (ACPI_HMAT_ADDRESS_RANGE);
1855             break;
1856 
1857         case ACPI_HMAT_TYPE_LOCALITY:
1858 
1859             InfoTable = AcpiDmTableInfoHmat1;
1860             Length = sizeof (ACPI_HMAT_LOCALITY);
1861             break;
1862 
1863         case ACPI_HMAT_TYPE_CACHE:
1864 
1865             InfoTable = AcpiDmTableInfoHmat2;
1866             Length = sizeof (ACPI_HMAT_CACHE);
1867             break;
1868 
1869         default:
1870 
1871             AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n",
1872                 HmatStruct->Type);
1873 
1874             /* Attempt to continue */
1875 
1876             goto NextSubtable;
1877         }
1878 
1879         /* Dump HMAT structure body */
1880 
1881         if (HmatStruct->Length < Length)
1882         {
1883             AcpiOsPrintf ("Invalid HMAT structure length\n");
1884             return;
1885         }
1886         Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
1887             HmatStruct->Length, InfoTable);
1888         if (ACPI_FAILURE (Status))
1889         {
1890             return;
1891         }
1892 
1893         /* Dump HMAT structure additionals */
1894 
1895         switch (HmatStruct->Type)
1896         {
1897         case ACPI_HMAT_TYPE_LOCALITY:
1898 
1899             HmatLocality = ACPI_CAST_PTR (ACPI_HMAT_LOCALITY, HmatStruct);
1900             SubtableOffset = sizeof (ACPI_HMAT_LOCALITY);
1901 
1902             /* Dump initiator proximity domains */
1903 
1904             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1905                 (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4))
1906             {
1907                 AcpiOsPrintf ("Invalid initiator proximity domain number\n");
1908                 return;
1909             }
1910             for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
1911             {
1912                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1913                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1914                     4, AcpiDmTableInfoHmat1a);
1915                 SubtableOffset += 4;
1916             }
1917 
1918             /* Dump target proximity domains */
1919 
1920             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1921                 (UINT32)(HmatLocality->NumberOfTargetPDs * 4))
1922             {
1923                 AcpiOsPrintf ("Invalid target proximity domain number\n");
1924                 return;
1925             }
1926             for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++)
1927             {
1928                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1929                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1930                     4, AcpiDmTableInfoHmat1b);
1931                 SubtableOffset += 4;
1932             }
1933 
1934             /* Dump latency/bandwidth entris */
1935 
1936             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1937                 (UINT32)(HmatLocality->NumberOfInitiatorPDs *
1938                          HmatLocality->NumberOfTargetPDs * 2))
1939             {
1940                 AcpiOsPrintf ("Invalid latency/bandwidth entry number\n");
1941                 return;
1942             }
1943             for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
1944             {
1945                 for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++)
1946                 {
1947                     Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1948                         ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1949                         2, AcpiDmTableInfoHmat1c);
1950                     SubtableOffset += 2;
1951                 }
1952             }
1953             break;
1954 
1955         case ACPI_HMAT_TYPE_CACHE:
1956 
1957             HmatCache = ACPI_CAST_PTR (ACPI_HMAT_CACHE, HmatStruct);
1958             SubtableOffset = sizeof (ACPI_HMAT_CACHE);
1959 
1960             /* Dump SMBIOS handles */
1961 
1962             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1963                 (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2))
1964             {
1965                 AcpiOsPrintf ("Invalid SMBIOS handle number\n");
1966                 return;
1967             }
1968             for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++)
1969             {
1970                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1971                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1972                     2, AcpiDmTableInfoHmat2a);
1973                 SubtableOffset += 2;
1974             }
1975             break;
1976 
1977         default:
1978 
1979             break;
1980         }
1981 
1982 NextSubtable:
1983         /* Point to next HMAT structure subtable */
1984 
1985         Offset += (HmatStruct->Length);
1986     }
1987 }
1988 
1989 
1990 /*******************************************************************************
1991  *
1992  * FUNCTION:    AcpiDmDumpIort
1993  *
1994  * PARAMETERS:  Table               - A IORT table
1995  *
1996  * RETURN:      None
1997  *
1998  * DESCRIPTION: Format the contents of a IORT
1999  *
2000  ******************************************************************************/
2001 
2002 void
2003 AcpiDmDumpIort (
2004     ACPI_TABLE_HEADER       *Table)
2005 {
2006     ACPI_STATUS             Status;
2007     ACPI_TABLE_IORT         *Iort;
2008     ACPI_IORT_NODE          *IortNode;
2009     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
2010     ACPI_IORT_SMMU          *IortSmmu = NULL;
2011     UINT32                  Offset;
2012     UINT32                  NodeOffset;
2013     UINT32                  Length;
2014     ACPI_DMTABLE_INFO       *InfoTable;
2015     char                    *String;
2016     UINT32                  i;
2017 
2018 
2019     /* Main table */
2020 
2021     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
2022     if (ACPI_FAILURE (Status))
2023     {
2024         return;
2025     }
2026 
2027     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
2028     Offset = sizeof (ACPI_TABLE_IORT);
2029 
2030     /* Dump the OptionalPadding (optional) */
2031 
2032     if (Iort->NodeOffset > Offset)
2033     {
2034         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
2035             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
2036         if (ACPI_FAILURE (Status))
2037         {
2038             return;
2039         }
2040     }
2041 
2042     Offset = Iort->NodeOffset;
2043     while (Offset < Table->Length)
2044     {
2045         /* Common subtable header */
2046 
2047         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
2048         AcpiOsPrintf ("\n");
2049         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
2050         Status = AcpiDmDumpTable (Table->Length, Offset,
2051             IortNode, Length, AcpiDmTableInfoIortHdr);
2052         if (ACPI_FAILURE (Status))
2053         {
2054             return;
2055         }
2056 
2057         NodeOffset = Length;
2058 
2059         switch (IortNode->Type)
2060         {
2061         case ACPI_IORT_NODE_ITS_GROUP:
2062 
2063             InfoTable = AcpiDmTableInfoIort0;
2064             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
2065             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
2066             break;
2067 
2068         case ACPI_IORT_NODE_NAMED_COMPONENT:
2069 
2070             InfoTable = AcpiDmTableInfoIort1;
2071             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
2072             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
2073             Length += strlen (String) + 1;
2074             break;
2075 
2076         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
2077 
2078             InfoTable = AcpiDmTableInfoIort2;
2079             Length = IortNode->Length - NodeOffset;
2080             break;
2081 
2082         case ACPI_IORT_NODE_SMMU:
2083 
2084             InfoTable = AcpiDmTableInfoIort3;
2085             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
2086             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
2087             break;
2088 
2089         case ACPI_IORT_NODE_SMMU_V3:
2090 
2091             InfoTable = AcpiDmTableInfoIort4;
2092             Length = IortNode->Length - NodeOffset;
2093             break;
2094 
2095         default:
2096 
2097             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
2098                 IortNode->Type);
2099 
2100             /* Attempt to continue */
2101 
2102             if (!IortNode->Length)
2103             {
2104                 AcpiOsPrintf ("Invalid zero length IORT node\n");
2105                 return;
2106             }
2107             goto NextSubtable;
2108         }
2109 
2110         /* Dump the node subtable header */
2111 
2112         AcpiOsPrintf ("\n");
2113         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2114             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
2115             Length, InfoTable);
2116         if (ACPI_FAILURE (Status))
2117         {
2118             return;
2119         }
2120 
2121         NodeOffset += Length;
2122 
2123         /* Dump the node specific data */
2124 
2125         switch (IortNode->Type)
2126         {
2127         case ACPI_IORT_NODE_ITS_GROUP:
2128 
2129             /* Validate IortItsGroup to avoid compiler warnings */
2130 
2131             if (IortItsGroup)
2132             {
2133                 for (i = 0; i < IortItsGroup->ItsCount; i++)
2134                 {
2135                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2136                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
2137                         4, AcpiDmTableInfoIort0a);
2138                     NodeOffset += 4;
2139                 }
2140             }
2141             break;
2142 
2143         case ACPI_IORT_NODE_NAMED_COMPONENT:
2144 
2145             /* Dump the Padding (optional) */
2146 
2147             if (IortNode->Length > NodeOffset)
2148             {
2149                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2150                     Table, IortNode->Length - NodeOffset,
2151                     AcpiDmTableInfoIort1a);
2152                 if (ACPI_FAILURE (Status))
2153                 {
2154                     return;
2155                 }
2156             }
2157             break;
2158 
2159         case ACPI_IORT_NODE_SMMU:
2160 
2161             AcpiOsPrintf ("\n");
2162 
2163             /* Validate IortSmmu to avoid compiler warnings */
2164 
2165             if (IortSmmu)
2166             {
2167                 Length = 2 * sizeof (UINT64);
2168                 NodeOffset = IortSmmu->GlobalInterruptOffset;
2169                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2170                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
2171                     Length, AcpiDmTableInfoIort3a);
2172                 if (ACPI_FAILURE (Status))
2173                 {
2174                     return;
2175                 }
2176 
2177                 NodeOffset = IortSmmu->ContextInterruptOffset;
2178                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
2179                 {
2180                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2181                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
2182                         8, AcpiDmTableInfoIort3b);
2183                     if (ACPI_FAILURE (Status))
2184                     {
2185                         return;
2186                     }
2187 
2188                     NodeOffset += 8;
2189                 }
2190 
2191                 NodeOffset = IortSmmu->PmuInterruptOffset;
2192                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
2193                 {
2194                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2195                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
2196                         8, AcpiDmTableInfoIort3c);
2197                     if (ACPI_FAILURE (Status))
2198                     {
2199                         return;
2200                     }
2201 
2202                     NodeOffset += 8;
2203                 }
2204             }
2205             break;
2206 
2207         default:
2208 
2209             break;
2210         }
2211 
2212         /* Dump the ID mappings */
2213 
2214         NodeOffset = IortNode->MappingOffset;
2215         for (i = 0; i < IortNode->MappingCount; i++)
2216         {
2217             AcpiOsPrintf ("\n");
2218             Length = sizeof (ACPI_IORT_ID_MAPPING);
2219             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
2220                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
2221                 Length, AcpiDmTableInfoIortMap);
2222             if (ACPI_FAILURE (Status))
2223             {
2224                 return;
2225             }
2226 
2227             NodeOffset += Length;
2228         }
2229 
2230 NextSubtable:
2231         /* Point to next node subtable */
2232 
2233         Offset += IortNode->Length;
2234         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
2235     }
2236 }
2237 
2238 
2239 /*******************************************************************************
2240  *
2241  * FUNCTION:    AcpiDmDumpIvrs
2242  *
2243  * PARAMETERS:  Table               - A IVRS table
2244  *
2245  * RETURN:      None
2246  *
2247  * DESCRIPTION: Format the contents of a IVRS
2248  *
2249  ******************************************************************************/
2250 
2251 static UINT8 EntrySizes[] = {4,8,16,32};
2252 
2253 void
2254 AcpiDmDumpIvrs (
2255     ACPI_TABLE_HEADER       *Table)
2256 {
2257     ACPI_STATUS             Status;
2258     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
2259     UINT32                  EntryOffset;
2260     UINT32                  EntryLength;
2261     UINT32                  EntryType;
2262     ACPI_IVRS_DE_HEADER     *DeviceEntry;
2263     ACPI_IVRS_HEADER        *Subtable;
2264     ACPI_DMTABLE_INFO       *InfoTable;
2265 
2266 
2267     /* Main table */
2268 
2269     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
2270     if (ACPI_FAILURE (Status))
2271     {
2272         return;
2273     }
2274 
2275     /* Subtables */
2276 
2277     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
2278     while (Offset < Table->Length)
2279     {
2280         /* Common subtable header */
2281 
2282         AcpiOsPrintf ("\n");
2283         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2284             Subtable->Length, AcpiDmTableInfoIvrsHdr);
2285         if (ACPI_FAILURE (Status))
2286         {
2287             return;
2288         }
2289 
2290         switch (Subtable->Type)
2291         {
2292         case ACPI_IVRS_TYPE_HARDWARE:
2293 
2294             InfoTable = AcpiDmTableInfoIvrs0;
2295             break;
2296 
2297         case ACPI_IVRS_TYPE_MEMORY1:
2298         case ACPI_IVRS_TYPE_MEMORY2:
2299         case ACPI_IVRS_TYPE_MEMORY3:
2300 
2301             InfoTable = AcpiDmTableInfoIvrs1;
2302             break;
2303 
2304         default:
2305 
2306             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
2307                 Subtable->Type);
2308 
2309             /* Attempt to continue */
2310 
2311             if (!Subtable->Length)
2312             {
2313                 AcpiOsPrintf ("Invalid zero length subtable\n");
2314                 return;
2315             }
2316             goto NextSubtable;
2317         }
2318 
2319         /* Dump the subtable */
2320 
2321         AcpiOsPrintf ("\n");
2322         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2323             Subtable->Length, InfoTable);
2324         if (ACPI_FAILURE (Status))
2325         {
2326             return;
2327         }
2328 
2329         /* The hardware subtable can contain multiple device entries */
2330 
2331         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE)
2332         {
2333             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
2334             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
2335                 sizeof (ACPI_IVRS_HARDWARE));
2336 
2337             while (EntryOffset < (Offset + Subtable->Length))
2338             {
2339                 AcpiOsPrintf ("\n");
2340                 /*
2341                  * Upper 2 bits of Type encode the length of the device entry
2342                  *
2343                  * 00 = 4 byte
2344                  * 01 = 8 byte
2345                  * 10 = 16 byte - currently no entries defined
2346                  * 11 = 32 byte - currently no entries defined
2347                  */
2348                 EntryType = DeviceEntry->Type;
2349                 EntryLength = EntrySizes [EntryType >> 6];
2350 
2351                 switch (EntryType)
2352                 {
2353                 /* 4-byte device entries */
2354 
2355                 case ACPI_IVRS_TYPE_PAD4:
2356                 case ACPI_IVRS_TYPE_ALL:
2357                 case ACPI_IVRS_TYPE_SELECT:
2358                 case ACPI_IVRS_TYPE_START:
2359                 case ACPI_IVRS_TYPE_END:
2360 
2361                     InfoTable = AcpiDmTableInfoIvrs4;
2362                     break;
2363 
2364                 /* 8-byte entries, type A */
2365 
2366                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
2367                 case ACPI_IVRS_TYPE_ALIAS_START:
2368 
2369                     InfoTable = AcpiDmTableInfoIvrs8a;
2370                     break;
2371 
2372                 /* 8-byte entries, type B */
2373 
2374                 case ACPI_IVRS_TYPE_PAD8:
2375                 case ACPI_IVRS_TYPE_EXT_SELECT:
2376                 case ACPI_IVRS_TYPE_EXT_START:
2377 
2378                     InfoTable = AcpiDmTableInfoIvrs8b;
2379                     break;
2380 
2381                 /* 8-byte entries, type C */
2382 
2383                 case ACPI_IVRS_TYPE_SPECIAL:
2384 
2385                     InfoTable = AcpiDmTableInfoIvrs8c;
2386                     break;
2387 
2388                 default:
2389                     InfoTable = AcpiDmTableInfoIvrs4;
2390                     AcpiOsPrintf (
2391                         "\n**** Unknown IVRS device entry type/length: "
2392                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
2393                         EntryType, EntryLength, EntryOffset);
2394                     break;
2395                 }
2396 
2397                 /* Dump the Device Entry */
2398 
2399                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
2400                     DeviceEntry, EntryLength, InfoTable);
2401                 if (ACPI_FAILURE (Status))
2402                 {
2403                     return;
2404                 }
2405 
2406                 EntryOffset += EntryLength;
2407                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
2408                     EntryLength);
2409             }
2410         }
2411 
2412 NextSubtable:
2413         /* Point to next subtable */
2414 
2415         Offset += Subtable->Length;
2416         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
2417     }
2418 }
2419 
2420 
2421 /*******************************************************************************
2422  *
2423  * FUNCTION:    AcpiDmDumpLpit
2424  *
2425  * PARAMETERS:  Table               - A LPIT table
2426  *
2427  * RETURN:      None
2428  *
2429  * DESCRIPTION: Format the contents of a LPIT. This table type consists
2430  *              of an open-ended number of subtables. Note: There are no
2431  *              entries in the main table. An LPIT consists of the table
2432  *              header and then subtables only.
2433  *
2434  ******************************************************************************/
2435 
2436 void
2437 AcpiDmDumpLpit (
2438     ACPI_TABLE_HEADER       *Table)
2439 {
2440     ACPI_STATUS             Status;
2441     ACPI_LPIT_HEADER        *Subtable;
2442     UINT32                  Length = Table->Length;
2443     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
2444     ACPI_DMTABLE_INFO       *InfoTable;
2445     UINT32                  SubtableLength;
2446 
2447 
2448     /* Subtables */
2449 
2450     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
2451     while (Offset < Table->Length)
2452     {
2453         /* Common subtable header */
2454 
2455         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2456             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
2457         if (ACPI_FAILURE (Status))
2458         {
2459             return;
2460         }
2461 
2462         switch (Subtable->Type)
2463         {
2464         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
2465 
2466             InfoTable = AcpiDmTableInfoLpit0;
2467             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
2468             break;
2469 
2470         default:
2471 
2472             /* Cannot continue on unknown type - no length */
2473 
2474             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
2475                 Subtable->Type);
2476             return;
2477         }
2478 
2479         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2480             SubtableLength, InfoTable);
2481         if (ACPI_FAILURE (Status))
2482         {
2483             return;
2484         }
2485 
2486         AcpiOsPrintf ("\n");
2487 
2488         /* Point to next subtable */
2489 
2490         Offset += SubtableLength;
2491         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
2492     }
2493 }
2494 
2495 
2496 /*******************************************************************************
2497  *
2498  * FUNCTION:    AcpiDmDumpMadt
2499  *
2500  * PARAMETERS:  Table               - A MADT table
2501  *
2502  * RETURN:      None
2503  *
2504  * DESCRIPTION: Format the contents of a MADT. This table type consists
2505  *              of an open-ended number of subtables.
2506  *
2507  ******************************************************************************/
2508 
2509 void
2510 AcpiDmDumpMadt (
2511     ACPI_TABLE_HEADER       *Table)
2512 {
2513     ACPI_STATUS             Status;
2514     ACPI_SUBTABLE_HEADER    *Subtable;
2515     UINT32                  Length = Table->Length;
2516     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
2517     ACPI_DMTABLE_INFO       *InfoTable;
2518 
2519 
2520     /* Main table */
2521 
2522     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
2523     if (ACPI_FAILURE (Status))
2524     {
2525         return;
2526     }
2527 
2528     /* Subtables */
2529 
2530     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2531     while (Offset < Table->Length)
2532     {
2533         /* Common subtable header */
2534 
2535         AcpiOsPrintf ("\n");
2536         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2537             Subtable->Length, AcpiDmTableInfoMadtHdr);
2538         if (ACPI_FAILURE (Status))
2539         {
2540             return;
2541         }
2542 
2543         switch (Subtable->Type)
2544         {
2545         case ACPI_MADT_TYPE_LOCAL_APIC:
2546 
2547             InfoTable = AcpiDmTableInfoMadt0;
2548             break;
2549 
2550         case ACPI_MADT_TYPE_IO_APIC:
2551 
2552             InfoTable = AcpiDmTableInfoMadt1;
2553             break;
2554 
2555         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
2556 
2557             InfoTable = AcpiDmTableInfoMadt2;
2558             break;
2559 
2560         case ACPI_MADT_TYPE_NMI_SOURCE:
2561 
2562             InfoTable = AcpiDmTableInfoMadt3;
2563             break;
2564 
2565         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
2566 
2567             InfoTable = AcpiDmTableInfoMadt4;
2568             break;
2569 
2570         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
2571 
2572             InfoTable = AcpiDmTableInfoMadt5;
2573             break;
2574 
2575         case ACPI_MADT_TYPE_IO_SAPIC:
2576 
2577             InfoTable = AcpiDmTableInfoMadt6;
2578             break;
2579 
2580         case ACPI_MADT_TYPE_LOCAL_SAPIC:
2581 
2582             InfoTable = AcpiDmTableInfoMadt7;
2583             break;
2584 
2585         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
2586 
2587             InfoTable = AcpiDmTableInfoMadt8;
2588             break;
2589 
2590         case ACPI_MADT_TYPE_LOCAL_X2APIC:
2591 
2592             InfoTable = AcpiDmTableInfoMadt9;
2593             break;
2594 
2595         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
2596 
2597             InfoTable = AcpiDmTableInfoMadt10;
2598             break;
2599 
2600         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
2601 
2602             InfoTable = AcpiDmTableInfoMadt11;
2603             break;
2604 
2605         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
2606 
2607             InfoTable = AcpiDmTableInfoMadt12;
2608             break;
2609 
2610         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
2611 
2612             InfoTable = AcpiDmTableInfoMadt13;
2613             break;
2614 
2615         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
2616 
2617             InfoTable = AcpiDmTableInfoMadt14;
2618             break;
2619 
2620         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
2621 
2622             InfoTable = AcpiDmTableInfoMadt15;
2623             break;
2624 
2625         default:
2626 
2627             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
2628                 Subtable->Type);
2629 
2630             /* Attempt to continue */
2631 
2632             if (!Subtable->Length)
2633             {
2634                 AcpiOsPrintf ("Invalid zero length subtable\n");
2635                 return;
2636             }
2637 
2638             goto NextSubtable;
2639         }
2640 
2641         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2642             Subtable->Length, InfoTable);
2643         if (ACPI_FAILURE (Status))
2644         {
2645             return;
2646         }
2647 
2648 NextSubtable:
2649         /* Point to next subtable */
2650 
2651         Offset += Subtable->Length;
2652         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
2653             Subtable->Length);
2654     }
2655 }
2656 
2657 
2658 /*******************************************************************************
2659  *
2660  * FUNCTION:    AcpiDmDumpMcfg
2661  *
2662  * PARAMETERS:  Table               - A MCFG Table
2663  *
2664  * RETURN:      None
2665  *
2666  * DESCRIPTION: Format the contents of a MCFG table
2667  *
2668  ******************************************************************************/
2669 
2670 void
2671 AcpiDmDumpMcfg (
2672     ACPI_TABLE_HEADER       *Table)
2673 {
2674     ACPI_STATUS             Status;
2675     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
2676     ACPI_MCFG_ALLOCATION    *Subtable;
2677 
2678 
2679     /* Main table */
2680 
2681     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
2682     if (ACPI_FAILURE (Status))
2683     {
2684         return;
2685     }
2686 
2687     /* Subtables */
2688 
2689     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
2690     while (Offset < Table->Length)
2691     {
2692         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
2693         {
2694             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
2695                 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
2696             return;
2697         }
2698 
2699         AcpiOsPrintf ("\n");
2700         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2701             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
2702         if (ACPI_FAILURE (Status))
2703         {
2704             return;
2705         }
2706 
2707         /* Point to next subtable (each subtable is of fixed length) */
2708 
2709         Offset += sizeof (ACPI_MCFG_ALLOCATION);
2710         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
2711             sizeof (ACPI_MCFG_ALLOCATION));
2712     }
2713 }
2714 
2715 
2716 /*******************************************************************************
2717  *
2718  * FUNCTION:    AcpiDmDumpMpst
2719  *
2720  * PARAMETERS:  Table               - A MPST Table
2721  *
2722  * RETURN:      None
2723  *
2724  * DESCRIPTION: Format the contents of a MPST table
2725  *
2726  ******************************************************************************/
2727 
2728 void
2729 AcpiDmDumpMpst (
2730     ACPI_TABLE_HEADER       *Table)
2731 {
2732     ACPI_STATUS             Status;
2733     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
2734     ACPI_MPST_POWER_NODE    *Subtable0;
2735     ACPI_MPST_POWER_STATE   *Subtable0A;
2736     ACPI_MPST_COMPONENT     *Subtable0B;
2737     ACPI_MPST_DATA_HDR      *Subtable1;
2738     ACPI_MPST_POWER_DATA    *Subtable2;
2739     UINT16                  SubtableCount;
2740     UINT32                  PowerStateCount;
2741     UINT32                  ComponentCount;
2742 
2743 
2744     /* Main table */
2745 
2746     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
2747     if (ACPI_FAILURE (Status))
2748     {
2749         return;
2750     }
2751 
2752     /* Subtable: Memory Power Node(s) */
2753 
2754     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
2755     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
2756 
2757     while ((Offset < Table->Length) && SubtableCount)
2758     {
2759         AcpiOsPrintf ("\n");
2760         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
2761             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
2762         if (ACPI_FAILURE (Status))
2763         {
2764             return;
2765         }
2766 
2767         /* Extract the sub-subtable counts */
2768 
2769         PowerStateCount = Subtable0->NumPowerStates;
2770         ComponentCount = Subtable0->NumPhysicalComponents;
2771         Offset += sizeof (ACPI_MPST_POWER_NODE);
2772 
2773         /* Sub-subtables - Memory Power State Structure(s) */
2774 
2775         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
2776             sizeof (ACPI_MPST_POWER_NODE));
2777 
2778         while (PowerStateCount)
2779         {
2780             AcpiOsPrintf ("\n");
2781             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
2782                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
2783             if (ACPI_FAILURE (Status))
2784             {
2785                 return;
2786             }
2787 
2788             Subtable0A++;
2789             PowerStateCount--;
2790             Offset += sizeof (ACPI_MPST_POWER_STATE);
2791        }
2792 
2793         /* Sub-subtables - Physical Component ID Structure(s) */
2794 
2795         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
2796 
2797         if (ComponentCount)
2798         {
2799             AcpiOsPrintf ("\n");
2800         }
2801 
2802         while (ComponentCount)
2803         {
2804             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
2805                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
2806             if (ACPI_FAILURE (Status))
2807             {
2808                 return;
2809             }
2810 
2811             Subtable0B++;
2812             ComponentCount--;
2813             Offset += sizeof (ACPI_MPST_COMPONENT);
2814         }
2815 
2816         /* Point to next Memory Power Node subtable */
2817 
2818         SubtableCount--;
2819         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
2820             sizeof (ACPI_MPST_POWER_NODE) +
2821             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
2822             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
2823     }
2824 
2825     /* Subtable: Count of Memory Power State Characteristic structures */
2826 
2827     AcpiOsPrintf ("\n");
2828     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
2829     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
2830         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
2831     if (ACPI_FAILURE (Status))
2832     {
2833         return;
2834     }
2835 
2836     SubtableCount = Subtable1->CharacteristicsCount;
2837     Offset += sizeof (ACPI_MPST_DATA_HDR);
2838 
2839     /* Subtable: Memory Power State Characteristics structure(s) */
2840 
2841     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
2842         sizeof (ACPI_MPST_DATA_HDR));
2843 
2844     while ((Offset < Table->Length) && SubtableCount)
2845     {
2846         AcpiOsPrintf ("\n");
2847         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
2848             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
2849         if (ACPI_FAILURE (Status))
2850         {
2851             return;
2852         }
2853 
2854         Subtable2++;
2855         SubtableCount--;
2856         Offset += sizeof (ACPI_MPST_POWER_DATA);
2857     }
2858 }
2859 
2860 
2861 /*******************************************************************************
2862  *
2863  * FUNCTION:    AcpiDmDumpMsct
2864  *
2865  * PARAMETERS:  Table               - A MSCT table
2866  *
2867  * RETURN:      None
2868  *
2869  * DESCRIPTION: Format the contents of a MSCT
2870  *
2871  ******************************************************************************/
2872 
2873 void
2874 AcpiDmDumpMsct (
2875     ACPI_TABLE_HEADER       *Table)
2876 {
2877     ACPI_STATUS             Status;
2878     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
2879     ACPI_MSCT_PROXIMITY     *Subtable;
2880 
2881 
2882     /* Main table */
2883 
2884     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
2885     if (ACPI_FAILURE (Status))
2886     {
2887         return;
2888     }
2889 
2890     /* Subtables */
2891 
2892     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
2893     while (Offset < Table->Length)
2894     {
2895         /* Common subtable header */
2896 
2897         AcpiOsPrintf ("\n");
2898         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2899             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
2900         if (ACPI_FAILURE (Status))
2901         {
2902             return;
2903         }
2904 
2905         /* Point to next subtable */
2906 
2907         Offset += sizeof (ACPI_MSCT_PROXIMITY);
2908         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
2909             sizeof (ACPI_MSCT_PROXIMITY));
2910     }
2911 }
2912 
2913 
2914 /*******************************************************************************
2915  *
2916  * FUNCTION:    AcpiDmDumpMtmr
2917  *
2918  * PARAMETERS:  Table               - A MTMR table
2919  *
2920  * RETURN:      None
2921  *
2922  * DESCRIPTION: Format the contents of a MTMR
2923  *
2924  ******************************************************************************/
2925 
2926 void
2927 AcpiDmDumpMtmr (
2928     ACPI_TABLE_HEADER       *Table)
2929 {
2930     ACPI_STATUS             Status;
2931     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
2932     ACPI_MTMR_ENTRY         *Subtable;
2933 
2934 
2935     /* Main table */
2936 
2937     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
2938     if (ACPI_FAILURE (Status))
2939     {
2940         return;
2941     }
2942 
2943     /* Subtables */
2944 
2945     Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
2946     while (Offset < Table->Length)
2947     {
2948         /* Common subtable header */
2949 
2950         AcpiOsPrintf ("\n");
2951         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2952             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
2953         if (ACPI_FAILURE (Status))
2954         {
2955             return;
2956         }
2957 
2958         /* Point to next subtable */
2959 
2960         Offset += sizeof (ACPI_MTMR_ENTRY);
2961         Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable,
2962             sizeof (ACPI_MTMR_ENTRY));
2963     }
2964 }
2965 
2966 
2967 /*******************************************************************************
2968  *
2969  * FUNCTION:    AcpiDmDumpNfit
2970  *
2971  * PARAMETERS:  Table               - A NFIT table
2972  *
2973  * RETURN:      None
2974  *
2975  * DESCRIPTION: Format the contents of an NFIT.
2976  *
2977  ******************************************************************************/
2978 
2979 void
2980 AcpiDmDumpNfit (
2981     ACPI_TABLE_HEADER       *Table)
2982 {
2983     ACPI_STATUS             Status;
2984     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
2985     UINT32                  FieldOffset = 0;
2986     UINT32                  Length;
2987     ACPI_NFIT_HEADER        *Subtable;
2988     ACPI_DMTABLE_INFO       *InfoTable;
2989     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
2990     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
2991     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
2992     UINT32                  i;
2993 
2994 
2995     /* Main table */
2996 
2997     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
2998     if (ACPI_FAILURE (Status))
2999     {
3000         return;
3001     }
3002 
3003     /* Subtables */
3004 
3005     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
3006     while (Offset < Table->Length)
3007     {
3008         /* NFIT subtable header */
3009 
3010         AcpiOsPrintf ("\n");
3011         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3012             Subtable->Length, AcpiDmTableInfoNfitHdr);
3013         if (ACPI_FAILURE (Status))
3014         {
3015             return;
3016         }
3017 
3018         switch (Subtable->Type)
3019         {
3020         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
3021 
3022             InfoTable = AcpiDmTableInfoNfit0;
3023             break;
3024 
3025         case ACPI_NFIT_TYPE_MEMORY_MAP:
3026 
3027             InfoTable = AcpiDmTableInfoNfit1;
3028             break;
3029 
3030         case ACPI_NFIT_TYPE_INTERLEAVE:
3031 
3032             /* Has a variable number of 32-bit values at the end */
3033 
3034             InfoTable = AcpiDmTableInfoNfit2;
3035             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
3036             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
3037             break;
3038 
3039         case ACPI_NFIT_TYPE_SMBIOS:
3040 
3041             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
3042             InfoTable = AcpiDmTableInfoNfit3;
3043             break;
3044 
3045         case ACPI_NFIT_TYPE_CONTROL_REGION:
3046 
3047             InfoTable = AcpiDmTableInfoNfit4;
3048             break;
3049 
3050         case ACPI_NFIT_TYPE_DATA_REGION:
3051 
3052             InfoTable = AcpiDmTableInfoNfit5;
3053             break;
3054 
3055         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
3056 
3057             /* Has a variable number of 64-bit addresses at the end */
3058 
3059             InfoTable = AcpiDmTableInfoNfit6;
3060             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
3061             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
3062             break;
3063 
3064         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
3065 
3066             InfoTable = AcpiDmTableInfoNfit7;
3067             break;
3068 
3069         default:
3070             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
3071                 Subtable->Type);
3072 
3073             /* Attempt to continue */
3074 
3075             if (!Subtable->Length)
3076             {
3077                 AcpiOsPrintf ("Invalid zero length subtable\n");
3078                 return;
3079             }
3080             goto NextSubtable;
3081         }
3082 
3083         AcpiOsPrintf ("\n");
3084         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3085             Subtable->Length, InfoTable);
3086         if (ACPI_FAILURE (Status))
3087         {
3088             return;
3089         }
3090 
3091         /* Per-subtable variable-length fields */
3092 
3093         switch (Subtable->Type)
3094         {
3095         case ACPI_NFIT_TYPE_INTERLEAVE:
3096 
3097             for (i = 0; i < Interleave->LineCount; i++)
3098             {
3099                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
3100                     &Interleave->LineOffset[i],
3101                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
3102                 if (ACPI_FAILURE (Status))
3103                 {
3104                     return;
3105                 }
3106 
3107                 FieldOffset += sizeof (UINT32);
3108             }
3109             break;
3110 
3111         case ACPI_NFIT_TYPE_SMBIOS:
3112 
3113             Length = Subtable->Length -
3114                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
3115 
3116             if (Length)
3117             {
3118                 Status = AcpiDmDumpTable (Table->Length,
3119                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
3120                     SmbiosInfo,
3121                     Length, AcpiDmTableInfoNfit3a);
3122                 if (ACPI_FAILURE (Status))
3123                 {
3124                     return;
3125                 }
3126             }
3127 
3128             break;
3129 
3130         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
3131 
3132             for (i = 0; i < Hint->HintCount; i++)
3133             {
3134                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
3135                     &Hint->HintAddress[i],
3136                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
3137                 if (ACPI_FAILURE (Status))
3138                 {
3139                     return;
3140                 }
3141 
3142                 FieldOffset += sizeof (UINT64);
3143             }
3144             break;
3145 
3146         default:
3147             break;
3148         }
3149 
3150 NextSubtable:
3151         /* Point to next subtable */
3152 
3153         Offset += Subtable->Length;
3154         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
3155     }
3156 }
3157 
3158 
3159 /*******************************************************************************
3160  *
3161  * FUNCTION:    AcpiDmDumpPcct
3162  *
3163  * PARAMETERS:  Table               - A PCCT table
3164  *
3165  * RETURN:      None
3166  *
3167  * DESCRIPTION: Format the contents of a PCCT. This table type consists
3168  *              of an open-ended number of subtables.
3169  *
3170  ******************************************************************************/
3171 
3172 void
3173 AcpiDmDumpPcct (
3174     ACPI_TABLE_HEADER       *Table)
3175 {
3176     ACPI_STATUS             Status;
3177     ACPI_PCCT_SUBSPACE      *Subtable;
3178     ACPI_DMTABLE_INFO       *InfoTable;
3179     UINT32                  Length = Table->Length;
3180     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
3181 
3182 
3183     /* Main table */
3184 
3185     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
3186     if (ACPI_FAILURE (Status))
3187     {
3188         return;
3189     }
3190 
3191     /* Subtables */
3192 
3193     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
3194     while (Offset < Table->Length)
3195     {
3196         /* Common subtable header */
3197 
3198         AcpiOsPrintf ("\n");
3199         Status = AcpiDmDumpTable (Length, Offset, Subtable,
3200             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
3201         if (ACPI_FAILURE (Status))
3202         {
3203             return;
3204         }
3205 
3206         switch (Subtable->Header.Type)
3207         {
3208         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
3209 
3210             InfoTable = AcpiDmTableInfoPcct0;
3211             break;
3212 
3213         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
3214 
3215             InfoTable = AcpiDmTableInfoPcct1;
3216             break;
3217 
3218         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
3219 
3220             InfoTable = AcpiDmTableInfoPcct2;
3221             break;
3222 
3223         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
3224 
3225             InfoTable = AcpiDmTableInfoPcct3;
3226             break;
3227 
3228         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
3229 
3230             InfoTable = AcpiDmTableInfoPcct4;
3231             break;
3232 
3233         default:
3234 
3235             AcpiOsPrintf (
3236                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
3237                 Subtable->Header.Type);
3238             return;
3239         }
3240 
3241         AcpiOsPrintf ("\n");
3242         Status = AcpiDmDumpTable (Length, Offset, Subtable,
3243             Subtable->Header.Length, InfoTable);
3244         if (ACPI_FAILURE (Status))
3245         {
3246             return;
3247         }
3248 
3249         /* Point to next subtable */
3250 
3251         Offset += Subtable->Header.Length;
3252         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
3253             Subtable->Header.Length);
3254     }
3255 }
3256 
3257 
3258 /*******************************************************************************
3259  *
3260  * FUNCTION:    AcpiDmDumpPdtt
3261  *
3262  * PARAMETERS:  Table               - A PDTT table
3263  *
3264  * RETURN:      None
3265  *
3266  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
3267  *              table that contains an open-ended number of IDs
3268  *              at the end of the table.
3269  *
3270  ******************************************************************************/
3271 
3272 void
3273 AcpiDmDumpPdtt (
3274     ACPI_TABLE_HEADER       *Table)
3275 {
3276     ACPI_STATUS             Status;
3277     ACPI_PDTT_CHANNEL       *Subtable;
3278     UINT32                  Length = Table->Length;
3279     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
3280 
3281 
3282     /* Main table */
3283 
3284     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
3285     if (ACPI_FAILURE (Status))
3286     {
3287         return;
3288     }
3289 
3290     /* Subtables. Currently there is only one type, but can be multiples */
3291 
3292     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
3293     while (Offset < Table->Length)
3294     {
3295         AcpiOsPrintf ("\n");
3296         Status = AcpiDmDumpTable (Length, Offset, Subtable,
3297             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
3298         if (ACPI_FAILURE (Status))
3299         {
3300             return;
3301         }
3302 
3303         /* Point to next subtable */
3304 
3305         Offset += sizeof (ACPI_PDTT_CHANNEL);
3306         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
3307             sizeof (ACPI_PDTT_CHANNEL));
3308     }
3309 }
3310 
3311 
3312 /*******************************************************************************
3313  *
3314  * FUNCTION:    AcpiDmDumpPmtt
3315  *
3316  * PARAMETERS:  Table               - A PMTT table
3317  *
3318  * RETURN:      None
3319  *
3320  * DESCRIPTION: Format the contents of a PMTT. This table type consists
3321  *              of an open-ended number of subtables.
3322  *
3323  ******************************************************************************/
3324 
3325 void
3326 AcpiDmDumpPmtt (
3327     ACPI_TABLE_HEADER       *Table)
3328 {
3329     ACPI_STATUS             Status;
3330     ACPI_PMTT_HEADER        *Subtable;
3331     ACPI_PMTT_HEADER        *MemSubtable;
3332     ACPI_PMTT_HEADER        *DimmSubtable;
3333     ACPI_PMTT_DOMAIN        *DomainArray;
3334     UINT32                  Length = Table->Length;
3335     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
3336     UINT32                  MemOffset;
3337     UINT32                  DimmOffset;
3338     UINT32                  DomainOffset;
3339     UINT32                  DomainCount;
3340 
3341 
3342     /* Main table */
3343 
3344     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
3345     if (ACPI_FAILURE (Status))
3346     {
3347         return;
3348     }
3349 
3350     /* Subtables */
3351 
3352     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
3353     while (Offset < Table->Length)
3354     {
3355         /* Common subtable header */
3356 
3357         AcpiOsPrintf ("\n");
3358         Status = AcpiDmDumpTable (Length, Offset, Subtable,
3359             Subtable->Length, AcpiDmTableInfoPmttHdr);
3360         if (ACPI_FAILURE (Status))
3361         {
3362             return;
3363         }
3364 
3365         /* Only Socket subtables are expected at this level */
3366 
3367         if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET)
3368         {
3369             AcpiOsPrintf (
3370                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3371                 Subtable->Type);
3372             return;
3373         }
3374 
3375         /* Dump the fixed-length portion of the subtable */
3376 
3377         Status = AcpiDmDumpTable (Length, Offset, Subtable,
3378             Subtable->Length, AcpiDmTableInfoPmtt0);
3379         if (ACPI_FAILURE (Status))
3380         {
3381             return;
3382         }
3383 
3384         /* Walk the memory controller subtables */
3385 
3386         MemOffset = sizeof (ACPI_PMTT_SOCKET);
3387         MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
3388             sizeof (ACPI_PMTT_SOCKET));
3389 
3390         while (((Offset + MemOffset) < Table->Length) &&
3391             (MemOffset < Subtable->Length))
3392         {
3393             /* Common subtable header */
3394 
3395             AcpiOsPrintf ("\n");
3396             Status = AcpiDmDumpTable (Length,
3397                 Offset + MemOffset, MemSubtable,
3398                 MemSubtable->Length, AcpiDmTableInfoPmttHdr);
3399             if (ACPI_FAILURE (Status))
3400             {
3401                 return;
3402             }
3403 
3404             /* Only memory controller subtables are expected at this level */
3405 
3406             if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER)
3407             {
3408                 AcpiOsPrintf (
3409                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3410                     MemSubtable->Type);
3411                 return;
3412             }
3413 
3414             /* Dump the fixed-length portion of the controller subtable */
3415 
3416             Status = AcpiDmDumpTable (Length,
3417                 Offset + MemOffset, MemSubtable,
3418                 MemSubtable->Length, AcpiDmTableInfoPmtt1);
3419             if (ACPI_FAILURE (Status))
3420             {
3421                 return;
3422             }
3423 
3424             /* Walk the variable count of proximity domains */
3425 
3426             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
3427             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
3428             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
3429                 sizeof (ACPI_PMTT_CONTROLLER));
3430 
3431             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
3432                 ((MemOffset + DomainOffset) < Subtable->Length) &&
3433                 DomainCount)
3434             {
3435                 Status = AcpiDmDumpTable (Length,
3436                     Offset + MemOffset + DomainOffset, DomainArray,
3437                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
3438                 if (ACPI_FAILURE (Status))
3439                 {
3440                     return;
3441                 }
3442 
3443                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
3444                 DomainArray++;
3445                 DomainCount--;
3446             }
3447 
3448             if (DomainCount)
3449             {
3450                 AcpiOsPrintf (
3451                     "\n**** DomainCount exceeds subtable length\n\n");
3452             }
3453 
3454             /* Walk the physical component (DIMM) subtables */
3455 
3456             DimmOffset = DomainOffset;
3457             DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
3458                 DomainOffset);
3459 
3460             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
3461                 (DimmOffset < MemSubtable->Length))
3462             {
3463                 /* Common subtable header */
3464 
3465                 AcpiOsPrintf ("\n");
3466                 Status = AcpiDmDumpTable (Length,
3467                     Offset + MemOffset + DimmOffset, DimmSubtable,
3468                     DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
3469                 if (ACPI_FAILURE (Status))
3470                 {
3471                     return;
3472                 }
3473 
3474                 /* Only DIMM subtables are expected at this level */
3475 
3476                 if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM)
3477                 {
3478                     AcpiOsPrintf (
3479                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3480                         DimmSubtable->Type);
3481                     return;
3482                 }
3483 
3484                 /* Dump the fixed-length DIMM subtable */
3485 
3486                 Status = AcpiDmDumpTable (Length,
3487                     Offset + MemOffset + DimmOffset, DimmSubtable,
3488                     DimmSubtable->Length, AcpiDmTableInfoPmtt2);
3489                 if (ACPI_FAILURE (Status))
3490                 {
3491                     return;
3492                 }
3493 
3494                 /* Point to next DIMM subtable */
3495 
3496                 DimmOffset += DimmSubtable->Length;
3497                 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3498                     DimmSubtable, DimmSubtable->Length);
3499             }
3500 
3501             /* Point to next Controller subtable */
3502 
3503             MemOffset += MemSubtable->Length;
3504             MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3505                 MemSubtable, MemSubtable->Length);
3506         }
3507 
3508         /* Point to next Socket subtable */
3509 
3510         Offset += Subtable->Length;
3511         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3512             Subtable, Subtable->Length);
3513     }
3514 }
3515 
3516 
3517 /*******************************************************************************
3518  *
3519  * FUNCTION:    AcpiDmDumpPptt
3520  *
3521  * PARAMETERS:  Table               - A PMTT table
3522  *
3523  * RETURN:      None
3524  *
3525  * DESCRIPTION: Format the contents of a PPTT. This table type consists
3526  *              of an open-ended number of subtables.
3527  *
3528  ******************************************************************************/
3529 
3530 void
3531 AcpiDmDumpPptt (
3532     ACPI_TABLE_HEADER       *Table)
3533 {
3534     ACPI_STATUS             Status;
3535     ACPI_SUBTABLE_HEADER    *Subtable;
3536     ACPI_PPTT_PROCESSOR     *PpttProcessor;
3537     UINT8                   Length;
3538     UINT8                   SubtableOffset;
3539     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
3540     ACPI_DMTABLE_INFO       *InfoTable;
3541     UINT32                  i;
3542 
3543 
3544     /* There is no main table (other than the standard ACPI header) */
3545 
3546     /* Subtables */
3547 
3548     Offset = sizeof (ACPI_TABLE_HEADER);
3549     while (Offset < Table->Length)
3550     {
3551         AcpiOsPrintf ("\n");
3552 
3553         /* Common subtable header */
3554 
3555         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
3556         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
3557         {
3558             AcpiOsPrintf ("Invalid subtable length\n");
3559             return;
3560         }
3561         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3562             Subtable->Length, AcpiDmTableInfoPpttHdr);
3563         if (ACPI_FAILURE (Status))
3564         {
3565             return;
3566         }
3567 
3568         switch (Subtable->Type)
3569         {
3570         case ACPI_PPTT_TYPE_PROCESSOR:
3571 
3572             InfoTable = AcpiDmTableInfoPptt0;
3573             Length = sizeof (ACPI_PPTT_PROCESSOR);
3574             break;
3575 
3576         case ACPI_PPTT_TYPE_CACHE:
3577 
3578             InfoTable = AcpiDmTableInfoPptt1;
3579             Length = sizeof (ACPI_PPTT_CACHE);
3580             break;
3581 
3582         case ACPI_PPTT_TYPE_ID:
3583 
3584             InfoTable = AcpiDmTableInfoPptt2;
3585             Length = sizeof (ACPI_PPTT_ID);
3586             break;
3587 
3588         default:
3589 
3590             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
3591                 Subtable->Type);
3592 
3593             /* Attempt to continue */
3594 
3595             goto NextSubtable;
3596         }
3597 
3598         if (Subtable->Length < Length)
3599         {
3600             AcpiOsPrintf ("Invalid subtable length\n");
3601             return;
3602         }
3603         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3604             Subtable->Length, InfoTable);
3605         if (ACPI_FAILURE (Status))
3606         {
3607             return;
3608         }
3609         SubtableOffset = Length;
3610 
3611         switch (Subtable->Type)
3612         {
3613         case ACPI_PPTT_TYPE_PROCESSOR:
3614 
3615             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
3616 
3617             /* Dump SMBIOS handles */
3618 
3619             if ((UINT8)(Subtable->Length - SubtableOffset) <
3620                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
3621             {
3622                 AcpiOsPrintf ("Invalid private resource number\n");
3623                 return;
3624             }
3625             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
3626             {
3627                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
3628                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
3629                     4, AcpiDmTableInfoPptt0a);
3630                 SubtableOffset += 4;
3631             }
3632             break;
3633 
3634         default:
3635 
3636             break;
3637         }
3638 
3639 NextSubtable:
3640         /* Point to next subtable */
3641 
3642         Offset += Subtable->Length;
3643     }
3644 }
3645 
3646 
3647 /*******************************************************************************
3648  *
3649  * FUNCTION:    AcpiDmDumpS3pt
3650  *
3651  * PARAMETERS:  Table               - A S3PT table
3652  *
3653  * RETURN:      Length of the table
3654  *
3655  * DESCRIPTION: Format the contents of a S3PT
3656  *
3657  ******************************************************************************/
3658 
3659 UINT32
3660 AcpiDmDumpS3pt (
3661     ACPI_TABLE_HEADER       *Tables)
3662 {
3663     ACPI_STATUS             Status;
3664     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
3665     ACPI_FPDT_HEADER        *Subtable;
3666     ACPI_DMTABLE_INFO       *InfoTable;
3667     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
3668 
3669 
3670     /* Main table */
3671 
3672     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
3673     if (ACPI_FAILURE (Status))
3674     {
3675         return 0;
3676     }
3677 
3678     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
3679     while (Offset < S3ptTable->Length)
3680     {
3681         /* Common subtable header */
3682 
3683         AcpiOsPrintf ("\n");
3684         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
3685             Subtable->Length, AcpiDmTableInfoS3ptHdr);
3686         if (ACPI_FAILURE (Status))
3687         {
3688             return 0;
3689         }
3690 
3691         switch (Subtable->Type)
3692         {
3693         case ACPI_S3PT_TYPE_RESUME:
3694 
3695             InfoTable = AcpiDmTableInfoS3pt0;
3696             break;
3697 
3698         case ACPI_S3PT_TYPE_SUSPEND:
3699 
3700             InfoTable = AcpiDmTableInfoS3pt1;
3701             break;
3702 
3703         default:
3704 
3705             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
3706                 Subtable->Type);
3707 
3708             /* Attempt to continue */
3709 
3710             if (!Subtable->Length)
3711             {
3712                 AcpiOsPrintf ("Invalid zero length subtable\n");
3713                 return 0;
3714             }
3715             goto NextSubtable;
3716         }
3717 
3718         AcpiOsPrintf ("\n");
3719         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
3720             Subtable->Length, InfoTable);
3721         if (ACPI_FAILURE (Status))
3722         {
3723             return 0;
3724         }
3725 
3726 NextSubtable:
3727         /* Point to next subtable */
3728 
3729         Offset += Subtable->Length;
3730         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
3731     }
3732 
3733     return (S3ptTable->Length);
3734 }
3735 
3736 
3737 /*******************************************************************************
3738  *
3739  * FUNCTION:    AcpiDmDumpSdev
3740  *
3741  * PARAMETERS:  Table               - A SDEV table
3742  *
3743  * RETURN:      None
3744  *
3745  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
3746  *              table that contains variable strings and vendor data.
3747  *
3748  ******************************************************************************/
3749 
3750 void
3751 AcpiDmDumpSdev (
3752     ACPI_TABLE_HEADER       *Table)
3753 {
3754     ACPI_STATUS             Status;
3755     ACPI_SDEV_HEADER        *Subtable;
3756     ACPI_SDEV_PCIE          *Pcie;
3757     ACPI_SDEV_NAMESPACE     *Namesp;
3758     ACPI_DMTABLE_INFO       *InfoTable;
3759     UINT32                  Length = Table->Length;
3760     UINT32                  Offset = sizeof (ACPI_TABLE_SDEV);
3761     UINT16                  PathOffset;
3762     UINT16                  PathLength;
3763     UINT16                  VendorDataOffset;
3764     UINT16                  VendorDataLength;
3765 
3766 
3767     /* Main table */
3768 
3769     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
3770     if (ACPI_FAILURE (Status))
3771     {
3772         return;
3773     }
3774 
3775     /* Subtables */
3776 
3777     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
3778     while (Offset < Table->Length)
3779     {
3780         /* Common subtable header */
3781 
3782         AcpiOsPrintf ("\n");
3783         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3784             Subtable->Length, AcpiDmTableInfoSdevHdr);
3785         if (ACPI_FAILURE (Status))
3786         {
3787             return;
3788         }
3789 
3790         switch (Subtable->Type)
3791         {
3792         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
3793 
3794             InfoTable = AcpiDmTableInfoSdev0;
3795             break;
3796 
3797         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
3798 
3799             InfoTable = AcpiDmTableInfoSdev1;
3800             break;
3801 
3802         default:
3803             goto NextSubtable;
3804         }
3805 
3806         AcpiOsPrintf ("\n");
3807         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3808             Subtable->Length, InfoTable);
3809         if (ACPI_FAILURE (Status))
3810         {
3811             return;
3812         }
3813 
3814         switch (Subtable->Type)
3815         {
3816         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
3817 
3818             /* Dump the PCIe device ID(s) */
3819 
3820             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
3821             PathOffset = Namesp->DeviceIdOffset;
3822             PathLength = Namesp->DeviceIdLength;
3823 
3824             if (PathLength)
3825             {
3826                 Status = AcpiDmDumpTable (Table->Length, 0,
3827                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
3828                     PathLength, AcpiDmTableInfoSdev0a);
3829                 if (ACPI_FAILURE (Status))
3830                 {
3831                     return;
3832                 }
3833             }
3834 
3835             /* Dump the vendor-specific data */
3836 
3837             VendorDataLength =
3838                 Namesp->VendorDataLength;
3839             VendorDataOffset =
3840                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
3841 
3842             if (VendorDataLength)
3843             {
3844                 Status = AcpiDmDumpTable (Table->Length, 0,
3845                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
3846                     VendorDataLength, AcpiDmTableInfoSdev1b);
3847                 if (ACPI_FAILURE (Status))
3848                 {
3849                     return;
3850                 }
3851             }
3852             break;
3853 
3854         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
3855 
3856             /* PCI path substructures */
3857 
3858             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
3859             PathOffset = Pcie->PathOffset;
3860             PathLength = Pcie->PathLength;
3861 
3862             while (PathLength)
3863             {
3864                 Status = AcpiDmDumpTable (Table->Length,
3865                     PathOffset + Offset,
3866                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
3867                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
3868                 if (ACPI_FAILURE (Status))
3869                 {
3870                     return;
3871                 }
3872 
3873                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
3874                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
3875             }
3876 
3877             /* VendorData */
3878 
3879             VendorDataLength = Pcie->VendorDataLength;
3880             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
3881 
3882             if (VendorDataLength)
3883             {
3884                 Status = AcpiDmDumpTable (Table->Length, 0,
3885                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
3886                     VendorDataLength, AcpiDmTableInfoSdev1b);
3887             }
3888             break;
3889 
3890         default:
3891             goto NextSubtable;
3892         }
3893 
3894 NextSubtable:
3895         /* Point to next subtable */
3896 
3897         Offset += Subtable->Length;
3898         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
3899             Subtable->Length);
3900     }
3901 }
3902 
3903 
3904 /*******************************************************************************
3905  *
3906  * FUNCTION:    AcpiDmDumpSlic
3907  *
3908  * PARAMETERS:  Table               - A SLIC table
3909  *
3910  * RETURN:      None
3911  *
3912  * DESCRIPTION: Format the contents of a SLIC
3913  *
3914  ******************************************************************************/
3915 
3916 void
3917 AcpiDmDumpSlic (
3918     ACPI_TABLE_HEADER       *Table)
3919 {
3920 
3921     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
3922         Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
3923 }
3924 
3925 
3926 /*******************************************************************************
3927  *
3928  * FUNCTION:    AcpiDmDumpSlit
3929  *
3930  * PARAMETERS:  Table               - An SLIT
3931  *
3932  * RETURN:      None
3933  *
3934  * DESCRIPTION: Format the contents of a SLIT
3935  *
3936  ******************************************************************************/
3937 
3938 void
3939 AcpiDmDumpSlit (
3940     ACPI_TABLE_HEADER       *Table)
3941 {
3942     ACPI_STATUS             Status;
3943     UINT32                  Offset;
3944     UINT8                   *Row;
3945     UINT32                  Localities;
3946     UINT32                  i;
3947     UINT32                  j;
3948 
3949 
3950     /* Main table */
3951 
3952     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
3953     if (ACPI_FAILURE (Status))
3954     {
3955         return;
3956     }
3957 
3958     /* Display the Locality NxN Matrix */
3959 
3960     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
3961     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
3962     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
3963 
3964     for (i = 0; i < Localities; i++)
3965     {
3966         /* Display one row of the matrix */
3967 
3968         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
3969         for  (j = 0; j < Localities; j++)
3970         {
3971             /* Check for beyond EOT */
3972 
3973             if (Offset >= Table->Length)
3974             {
3975                 AcpiOsPrintf (
3976                     "\n**** Not enough room in table for all localities\n");
3977                 return;
3978             }
3979 
3980             AcpiOsPrintf ("%2.2X", Row[j]);
3981             Offset++;
3982 
3983             /* Display up to 16 bytes per output row */
3984 
3985             if ((j+1) < Localities)
3986             {
3987                 AcpiOsPrintf (" ");
3988 
3989                 if (j && (((j+1) % 16) == 0))
3990                 {
3991                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
3992                     AcpiDmLineHeader (Offset, 0, NULL);
3993                 }
3994             }
3995         }
3996 
3997         /* Point to next row */
3998 
3999         AcpiOsPrintf ("\n");
4000         Row += Localities;
4001     }
4002 }
4003 
4004 
4005 /*******************************************************************************
4006  *
4007  * FUNCTION:    AcpiDmDumpSrat
4008  *
4009  * PARAMETERS:  Table               - A SRAT table
4010  *
4011  * RETURN:      None
4012  *
4013  * DESCRIPTION: Format the contents of a SRAT
4014  *
4015  ******************************************************************************/
4016 
4017 void
4018 AcpiDmDumpSrat (
4019     ACPI_TABLE_HEADER       *Table)
4020 {
4021     ACPI_STATUS             Status;
4022     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
4023     ACPI_SUBTABLE_HEADER    *Subtable;
4024     ACPI_DMTABLE_INFO       *InfoTable;
4025 
4026 
4027     /* Main table */
4028 
4029     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
4030     if (ACPI_FAILURE (Status))
4031     {
4032         return;
4033     }
4034 
4035     /* Subtables */
4036 
4037     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
4038     while (Offset < Table->Length)
4039     {
4040         /* Common subtable header */
4041 
4042         AcpiOsPrintf ("\n");
4043         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4044             Subtable->Length, AcpiDmTableInfoSratHdr);
4045         if (ACPI_FAILURE (Status))
4046         {
4047             return;
4048         }
4049 
4050         switch (Subtable->Type)
4051         {
4052         case ACPI_SRAT_TYPE_CPU_AFFINITY:
4053 
4054             InfoTable = AcpiDmTableInfoSrat0;
4055             break;
4056 
4057         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
4058 
4059             InfoTable = AcpiDmTableInfoSrat1;
4060             break;
4061 
4062         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
4063 
4064             InfoTable = AcpiDmTableInfoSrat2;
4065             break;
4066 
4067         case ACPI_SRAT_TYPE_GICC_AFFINITY:
4068 
4069             InfoTable = AcpiDmTableInfoSrat3;
4070             break;
4071 
4072         case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY:
4073 
4074             InfoTable = AcpiDmTableInfoSrat4;
4075             break;
4076 
4077         default:
4078             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
4079                 Subtable->Type);
4080 
4081             /* Attempt to continue */
4082 
4083             if (!Subtable->Length)
4084             {
4085                 AcpiOsPrintf ("Invalid zero length subtable\n");
4086                 return;
4087             }
4088             goto NextSubtable;
4089         }
4090 
4091         AcpiOsPrintf ("\n");
4092         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4093             Subtable->Length, InfoTable);
4094         if (ACPI_FAILURE (Status))
4095         {
4096             return;
4097         }
4098 
4099 NextSubtable:
4100         /* Point to next subtable */
4101 
4102         Offset += Subtable->Length;
4103         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
4104             Subtable->Length);
4105     }
4106 }
4107 
4108 
4109 /*******************************************************************************
4110  *
4111  * FUNCTION:    AcpiDmDumpStao
4112  *
4113  * PARAMETERS:  Table               - A STAO table
4114  *
4115  * RETURN:      None
4116  *
4117  * DESCRIPTION: Format the contents of a STAO. This is a variable-length
4118  *              table that contains an open-ended number of ASCII strings
4119  *              at the end of the table.
4120  *
4121  ******************************************************************************/
4122 
4123 void
4124 AcpiDmDumpStao (
4125     ACPI_TABLE_HEADER       *Table)
4126 {
4127     ACPI_STATUS             Status;
4128     char                    *Namepath;
4129     UINT32                  Length = Table->Length;
4130     UINT32                  StringLength;
4131     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
4132 
4133 
4134     /* Main table */
4135 
4136     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
4137     if (ACPI_FAILURE (Status))
4138     {
4139         return;
4140     }
4141 
4142     /* The rest of the table consists of Namepath strings */
4143 
4144     while (Offset < Table->Length)
4145     {
4146         Namepath = ACPI_ADD_PTR (char, Table, Offset);
4147         StringLength = strlen (Namepath) + 1;
4148 
4149         AcpiDmLineHeader (Offset, StringLength, "Namestring");
4150         AcpiOsPrintf ("\"%s\"\n", Namepath);
4151 
4152         /* Point to next namepath */
4153 
4154         Offset += StringLength;
4155     }
4156 }
4157 
4158 
4159 /*******************************************************************************
4160  *
4161  * FUNCTION:    AcpiDmDumpTcpa
4162  *
4163  * PARAMETERS:  Table               - A TCPA table
4164  *
4165  * RETURN:      None
4166  *
4167  * DESCRIPTION: Format the contents of a TCPA.
4168  *
4169  * NOTE:        There are two versions of the table with the same signature:
4170  *              the client version and the server version. The common
4171  *              PlatformClass field is used to differentiate the two types of
4172  *              tables.
4173  *
4174  ******************************************************************************/
4175 
4176 void
4177 AcpiDmDumpTcpa (
4178     ACPI_TABLE_HEADER       *Table)
4179 {
4180     UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);
4181     ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (
4182                                 ACPI_TABLE_TCPA_HDR, Table);
4183     ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (
4184                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
4185     ACPI_STATUS             Status;
4186 
4187 
4188     /* Main table */
4189 
4190     Status = AcpiDmDumpTable (Table->Length, 0, Table,
4191         0, AcpiDmTableInfoTcpaHdr);
4192     if (ACPI_FAILURE (Status))
4193     {
4194         return;
4195     }
4196 
4197     /*
4198      * Examine the PlatformClass field to determine the table type.
4199      * Either a client or server table. Only one.
4200      */
4201     switch (CommonHeader->PlatformClass)
4202     {
4203     case ACPI_TCPA_CLIENT_TABLE:
4204 
4205         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4206             Table->Length - Offset, AcpiDmTableInfoTcpaClient);
4207         break;
4208 
4209     case ACPI_TCPA_SERVER_TABLE:
4210 
4211         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4212             Table->Length - Offset, AcpiDmTableInfoTcpaServer);
4213         break;
4214 
4215     default:
4216 
4217         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
4218             CommonHeader->PlatformClass);
4219         Status = AE_ERROR;
4220         break;
4221     }
4222 
4223     if (ACPI_FAILURE (Status))
4224     {
4225         AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
4226     }
4227 }
4228 
4229 
4230 /*******************************************************************************
4231  *
4232  * FUNCTION:    AcpiDmDumpTpm2
4233  *
4234  * PARAMETERS:  Table               - A TPM2 table
4235  *
4236  * RETURN:      None
4237  *
4238  * DESCRIPTION: Format the contents of a TPM2.
4239  *
4240  ******************************************************************************/
4241 
4242 void
4243 AcpiDmDumpTpm2 (
4244     ACPI_TABLE_HEADER       *Table)
4245 {
4246     UINT32                  Offset = sizeof (ACPI_TABLE_TPM2);
4247     ACPI_TABLE_TPM2         *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);
4248     ACPI_TPM2_TRAILER       *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
4249     ACPI_TPM2_ARM_SMC       *ArmSubtable;
4250     ACPI_STATUS             Status;
4251 
4252 
4253     /* Main table */
4254 
4255     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
4256     if (ACPI_FAILURE (Status))
4257     {
4258         return;
4259     }
4260 
4261     AcpiOsPrintf ("\n");
4262     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4263         Table->Length - Offset, AcpiDmTableInfoTpm2a);
4264     if (ACPI_FAILURE (Status))
4265     {
4266         return;
4267     }
4268 
4269     switch (CommonHeader->StartMethod)
4270     {
4271     case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
4272 
4273         ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,
4274             sizeof (ACPI_TPM2_TRAILER));
4275         Offset += sizeof (ACPI_TPM2_TRAILER);
4276 
4277         AcpiOsPrintf ("\n");
4278         Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
4279             Table->Length - Offset, AcpiDmTableInfoTpm211);
4280         break;
4281 
4282     default:
4283         break;
4284     }
4285 }
4286 
4287 
4288 /*******************************************************************************
4289  *
4290  * FUNCTION:    AcpiDmDumpVrtc
4291  *
4292  * PARAMETERS:  Table               - A VRTC table
4293  *
4294  * RETURN:      None
4295  *
4296  * DESCRIPTION: Format the contents of a VRTC
4297  *
4298  ******************************************************************************/
4299 
4300 void
4301 AcpiDmDumpVrtc (
4302     ACPI_TABLE_HEADER       *Table)
4303 {
4304     ACPI_STATUS             Status;
4305     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
4306     ACPI_VRTC_ENTRY         *Subtable;
4307 
4308 
4309     /* Main table */
4310 
4311     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
4312     if (ACPI_FAILURE (Status))
4313     {
4314         return;
4315     }
4316 
4317     /* Subtables */
4318 
4319     Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
4320     while (Offset < Table->Length)
4321     {
4322         /* Common subtable header */
4323 
4324         AcpiOsPrintf ("\n");
4325         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4326             sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
4327         if (ACPI_FAILURE (Status))
4328         {
4329             return;
4330         }
4331 
4332         /* Point to next subtable */
4333 
4334         Offset += sizeof (ACPI_VRTC_ENTRY);
4335         Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Subtable,
4336             sizeof (ACPI_VRTC_ENTRY));
4337     }
4338 }
4339 
4340 
4341 /*******************************************************************************
4342  *
4343  * FUNCTION:    AcpiDmDumpWdat
4344  *
4345  * PARAMETERS:  Table               - A WDAT table
4346  *
4347  * RETURN:      None
4348  *
4349  * DESCRIPTION: Format the contents of a WDAT
4350  *
4351  ******************************************************************************/
4352 
4353 void
4354 AcpiDmDumpWdat (
4355     ACPI_TABLE_HEADER       *Table)
4356 {
4357     ACPI_STATUS             Status;
4358     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
4359     ACPI_WDAT_ENTRY         *Subtable;
4360 
4361 
4362     /* Main table */
4363 
4364     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
4365     if (ACPI_FAILURE (Status))
4366     {
4367         return;
4368     }
4369 
4370     /* Subtables */
4371 
4372     Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
4373     while (Offset < Table->Length)
4374     {
4375         /* Common subtable header */
4376 
4377         AcpiOsPrintf ("\n");
4378         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4379             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
4380         if (ACPI_FAILURE (Status))
4381         {
4382             return;
4383         }
4384 
4385         /* Point to next subtable */
4386 
4387         Offset += sizeof (ACPI_WDAT_ENTRY);
4388         Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,
4389             sizeof (ACPI_WDAT_ENTRY));
4390     }
4391 }
4392 
4393 
4394 /*******************************************************************************
4395  *
4396  * FUNCTION:    AcpiDmDumpWpbt
4397  *
4398  * PARAMETERS:  Table               - A WPBT table
4399  *
4400  * RETURN:      None
4401  *
4402  * DESCRIPTION: Format the contents of a WPBT. This table type consists
4403  *              of an open-ended arguments buffer at the end of the table.
4404  *
4405  ******************************************************************************/
4406 
4407 void
4408 AcpiDmDumpWpbt (
4409     ACPI_TABLE_HEADER       *Table)
4410 {
4411     ACPI_STATUS             Status;
4412     ACPI_TABLE_WPBT         *Subtable;
4413     UINT32                  Length = Table->Length;
4414     UINT16                  ArgumentsLength;
4415 
4416 
4417     /* Dump the main table */
4418 
4419     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
4420     if (ACPI_FAILURE (Status))
4421     {
4422         return;
4423     }
4424 
4425     /* Extract the arguments buffer length from the main table */
4426 
4427     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
4428     ArgumentsLength = Subtable->ArgumentsLength;
4429 
4430     /* Dump the arguments buffer */
4431 
4432     (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
4433         AcpiDmTableInfoWpbt0);
4434 }
4435