xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump.c (revision 86c9d9918f1db7cdd968b60f8902466887bcd9e9)
1 /******************************************************************************
2  *
3  * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2016, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdisasm.h>
47 #include <contrib/dev/acpica/include/actables.h>
48 
49 /* This module used for application-level code only */
50 
51 #define _COMPONENT          ACPI_CA_DISASSEMBLER
52         ACPI_MODULE_NAME    ("dmtbdump")
53 
54 
55 /* Local prototypes */
56 
57 static void
58 AcpiDmValidateFadtLength (
59     UINT32                  Revision,
60     UINT32                  Length);
61 
62 
63 /*******************************************************************************
64  *
65  * FUNCTION:    AcpiDmDumpBuffer
66  *
67  * PARAMETERS:  Table               - ACPI Table or subtable
68  *              BufferOffset        - Offset of buffer from Table above
69  *              Length              - Length of the buffer
70  *              AbsoluteOffset      - Offset of buffer in the main ACPI table
71  *              Header              - Name of the buffer field (printed on the
72  *                                    first line only.)
73  *
74  * RETURN:      None
75  *
76  * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
77  *              disassembler output format.)
78  *
79  ******************************************************************************/
80 
81 void
82 AcpiDmDumpBuffer (
83     void                    *Table,
84     UINT32                  BufferOffset,
85     UINT32                  Length,
86     UINT32                  AbsoluteOffset,
87     char                    *Header)
88 {
89     UINT8                   *Buffer;
90     UINT32                  i;
91 
92 
93     if (!Length)
94     {
95         return;
96     }
97 
98     Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
99     i = 0;
100 
101     while (i < Length)
102     {
103         if (!(i % 16))
104         {
105             /* Insert a backslash - line continuation character */
106 
107             if (Length > 16)
108             {
109                 AcpiOsPrintf ("\\\n    ");
110             }
111         }
112 
113         AcpiOsPrintf ("%.02X ", *Buffer);
114         i++;
115         Buffer++;
116         AbsoluteOffset++;
117     }
118 
119     AcpiOsPrintf ("\n");
120 }
121 
122 
123 /*******************************************************************************
124  *
125  * FUNCTION:    AcpiDmDumpUnicode
126  *
127  * PARAMETERS:  Table               - ACPI Table or subtable
128  *              BufferOffset        - Offset of buffer from Table above
129  *              ByteLength          - Length of the buffer
130  *
131  * RETURN:      None
132  *
133  * DESCRIPTION: Validate and dump the contents of a buffer that contains
134  *              unicode data. The output is a standard ASCII string. If it
135  *              appears that the data is not unicode, the buffer is dumped
136  *              as hex characters.
137  *
138  ******************************************************************************/
139 
140 void
141 AcpiDmDumpUnicode (
142     void                    *Table,
143     UINT32                  BufferOffset,
144     UINT32                  ByteLength)
145 {
146     UINT8                   *Buffer;
147     UINT32                  Length;
148     UINT32                  i;
149 
150 
151     Buffer = ((UINT8 *) Table) + BufferOffset;
152     Length = ByteLength - 2; /* Last two bytes are the null terminator */
153 
154     /* Ensure all low bytes are entirely printable ASCII */
155 
156     for (i = 0; i < Length; i += 2)
157     {
158         if (!isprint (Buffer[i]))
159         {
160             goto DumpRawBuffer;
161         }
162     }
163 
164     /* Ensure all high bytes are zero */
165 
166     for (i = 1; i < Length; i += 2)
167     {
168         if (Buffer[i])
169         {
170             goto DumpRawBuffer;
171         }
172     }
173 
174     /* Dump the buffer as a normal string */
175 
176     AcpiOsPrintf ("\"");
177     for (i = 0; i < Length; i += 2)
178     {
179         AcpiOsPrintf ("%c", Buffer[i]);
180     }
181 
182     AcpiOsPrintf ("\"\n");
183     return;
184 
185 DumpRawBuffer:
186     AcpiDmDumpBuffer (Table, BufferOffset, ByteLength,
187         BufferOffset, NULL);
188     AcpiOsPrintf ("\n");
189 }
190 
191 
192 /*******************************************************************************
193  *
194  * FUNCTION:    AcpiDmDumpRsdp
195  *
196  * PARAMETERS:  Table               - A RSDP
197  *
198  * RETURN:      Length of the table (there is not always a length field,
199  *              use revision or length if available (ACPI 2.0+))
200  *
201  * DESCRIPTION: Format the contents of a RSDP
202  *
203  ******************************************************************************/
204 
205 UINT32
206 AcpiDmDumpRsdp (
207     ACPI_TABLE_HEADER       *Table)
208 {
209     ACPI_TABLE_RSDP         *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
210     UINT32                  Length = sizeof (ACPI_RSDP_COMMON);
211     UINT8                   Checksum;
212     ACPI_STATUS             Status;
213 
214 
215     /* Dump the common ACPI 1.0 portion */
216 
217     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
218     if (ACPI_FAILURE (Status))
219     {
220         return (Length);
221     }
222 
223     /* Validate the first checksum */
224 
225     Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
226         Rsdp->Checksum);
227     if (Checksum != Rsdp->Checksum)
228     {
229         AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
230             Checksum);
231     }
232 
233     /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
234 
235     if (Rsdp->Revision > 0)
236     {
237         Length = Rsdp->Length;
238         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
239         if (ACPI_FAILURE (Status))
240         {
241             return (Length);
242         }
243 
244         /* Validate the extended checksum over entire RSDP */
245 
246         Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
247             Rsdp->ExtendedChecksum);
248         if (Checksum != Rsdp->ExtendedChecksum)
249         {
250             AcpiOsPrintf (
251                 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
252                 Checksum);
253         }
254     }
255 
256     return (Length);
257 }
258 
259 
260 /*******************************************************************************
261  *
262  * FUNCTION:    AcpiDmDumpRsdt
263  *
264  * PARAMETERS:  Table               - A RSDT
265  *
266  * RETURN:      None
267  *
268  * DESCRIPTION: Format the contents of a RSDT
269  *
270  ******************************************************************************/
271 
272 void
273 AcpiDmDumpRsdt (
274     ACPI_TABLE_HEADER       *Table)
275 {
276     UINT32                  *Array;
277     UINT32                  Entries;
278     UINT32                  Offset;
279     UINT32                  i;
280 
281 
282     /* Point to start of table pointer array */
283 
284     Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
285     Offset = sizeof (ACPI_TABLE_HEADER);
286 
287     /* RSDT uses 32-bit pointers */
288 
289     Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
290 
291     for (i = 0; i < Entries; i++)
292     {
293         AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
294         AcpiOsPrintf ("%8.8X\n", Array[i]);
295         Offset += sizeof (UINT32);
296     }
297 }
298 
299 
300 /*******************************************************************************
301  *
302  * FUNCTION:    AcpiDmDumpXsdt
303  *
304  * PARAMETERS:  Table               - A XSDT
305  *
306  * RETURN:      None
307  *
308  * DESCRIPTION: Format the contents of a XSDT
309  *
310  ******************************************************************************/
311 
312 void
313 AcpiDmDumpXsdt (
314     ACPI_TABLE_HEADER       *Table)
315 {
316     UINT64                  *Array;
317     UINT32                  Entries;
318     UINT32                  Offset;
319     UINT32                  i;
320 
321 
322     /* Point to start of table pointer array */
323 
324     Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
325     Offset = sizeof (ACPI_TABLE_HEADER);
326 
327     /* XSDT uses 64-bit pointers */
328 
329     Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
330 
331     for (i = 0; i < Entries; i++)
332     {
333         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
334         AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
335         Offset += sizeof (UINT64);
336     }
337 }
338 
339 
340 /*******************************************************************************
341  *
342  * FUNCTION:    AcpiDmDumpFadt
343  *
344  * PARAMETERS:  Table               - A FADT
345  *
346  * RETURN:      None
347  *
348  * DESCRIPTION: Format the contents of a FADT
349  *
350  * NOTE:        We cannot depend on the FADT version to indicate the actual
351  *              contents of the FADT because of BIOS bugs. The table length
352  *              is the only reliable indicator.
353  *
354  ******************************************************************************/
355 
356 void
357 AcpiDmDumpFadt (
358     ACPI_TABLE_HEADER       *Table)
359 {
360     ACPI_STATUS             Status;
361 
362 
363     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
364 
365     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
366         AcpiDmTableInfoFadt1);
367     if (ACPI_FAILURE (Status))
368     {
369         return;
370     }
371 
372     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
373 
374     if ((Table->Length > ACPI_FADT_V1_SIZE) &&
375         (Table->Length <= ACPI_FADT_V2_SIZE))
376     {
377         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
378             AcpiDmTableInfoFadt2);
379         if (ACPI_FAILURE (Status))
380         {
381             return;
382         }
383     }
384 
385     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
386 
387     else if (Table->Length > ACPI_FADT_V2_SIZE)
388     {
389         Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
390             AcpiDmTableInfoFadt3);
391         if (ACPI_FAILURE (Status))
392         {
393             return;
394         }
395 
396         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
397 
398         if (Table->Length > ACPI_FADT_V3_SIZE)
399         {
400             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
401                 AcpiDmTableInfoFadt5);
402             if (ACPI_FAILURE (Status))
403             {
404                 return;
405             }
406         }
407 
408         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
409 
410         if (Table->Length > ACPI_FADT_V3_SIZE)
411         {
412             Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
413                 AcpiDmTableInfoFadt6);
414             if (ACPI_FAILURE (Status))
415             {
416                 return;
417             }
418         }
419     }
420 
421     /* Validate various fields in the FADT, including length */
422 
423     AcpiTbCreateLocalFadt (Table, Table->Length);
424 
425     /* Validate FADT length against the revision */
426 
427     AcpiDmValidateFadtLength (Table->Revision, Table->Length);
428 }
429 
430 
431 /*******************************************************************************
432  *
433  * FUNCTION:    AcpiDmValidateFadtLength
434  *
435  * PARAMETERS:  Revision            - FADT revision (Header->Revision)
436  *              Length              - FADT length (Header->Length
437  *
438  * RETURN:      None
439  *
440  * DESCRIPTION: Check the FADT revision against the expected table length for
441  *              that revision. Issue a warning if the length is not what was
442  *              expected. This seems to be such a common BIOS bug that the
443  *              FADT revision has been rendered virtually meaningless.
444  *
445  ******************************************************************************/
446 
447 static void
448 AcpiDmValidateFadtLength (
449     UINT32                  Revision,
450     UINT32                  Length)
451 {
452     UINT32                  ExpectedLength;
453 
454 
455     switch (Revision)
456     {
457     case 0:
458 
459         AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
460         return;
461 
462     case 1:
463 
464         ExpectedLength = ACPI_FADT_V1_SIZE;
465         break;
466 
467     case 2:
468 
469         ExpectedLength = ACPI_FADT_V2_SIZE;
470         break;
471 
472     case 3:
473     case 4:
474 
475         ExpectedLength = ACPI_FADT_V3_SIZE;
476         break;
477 
478     case 5:
479 
480         ExpectedLength = ACPI_FADT_V5_SIZE;
481         break;
482 
483     default:
484 
485         return;
486     }
487 
488     if (Length == ExpectedLength)
489     {
490         return;
491     }
492 
493     AcpiOsPrintf (
494         "\n// ACPI Warning: FADT revision %X does not match length: "
495         "found %X expected %X\n",
496         Revision, Length, ExpectedLength);
497 }
498 
499 
500 /*******************************************************************************
501  *
502  * FUNCTION:    AcpiDmDumpAsf
503  *
504  * PARAMETERS:  Table               - A ASF table
505  *
506  * RETURN:      None
507  *
508  * DESCRIPTION: Format the contents of a ASF table
509  *
510  ******************************************************************************/
511 
512 void
513 AcpiDmDumpAsf (
514     ACPI_TABLE_HEADER       *Table)
515 {
516     ACPI_STATUS             Status;
517     UINT32                  Offset = sizeof (ACPI_TABLE_HEADER);
518     ACPI_ASF_INFO           *SubTable;
519     ACPI_DMTABLE_INFO       *InfoTable;
520     ACPI_DMTABLE_INFO       *DataInfoTable = NULL;
521     UINT8                   *DataTable = NULL;
522     UINT32                  DataCount = 0;
523     UINT32                  DataLength = 0;
524     UINT32                  DataOffset = 0;
525     UINT32                  i;
526     UINT8                   Type;
527 
528 
529     /* No main table, only subtables */
530 
531     SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
532     while (Offset < Table->Length)
533     {
534         /* Common subtable header */
535 
536         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
537             SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
538         if (ACPI_FAILURE (Status))
539         {
540             return;
541         }
542 
543         /* The actual type is the lower 7 bits of Type */
544 
545         Type = (UINT8) (SubTable->Header.Type & 0x7F);
546 
547         switch (Type)
548         {
549         case ACPI_ASF_TYPE_INFO:
550 
551             InfoTable = AcpiDmTableInfoAsf0;
552             break;
553 
554         case ACPI_ASF_TYPE_ALERT:
555 
556             InfoTable = AcpiDmTableInfoAsf1;
557             DataInfoTable = AcpiDmTableInfoAsf1a;
558             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
559             DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
560             DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
561             DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
562             break;
563 
564         case ACPI_ASF_TYPE_CONTROL:
565 
566             InfoTable = AcpiDmTableInfoAsf2;
567             DataInfoTable = AcpiDmTableInfoAsf2a;
568             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
569             DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
570             DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
571             DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
572             break;
573 
574         case ACPI_ASF_TYPE_BOOT:
575 
576             InfoTable = AcpiDmTableInfoAsf3;
577             break;
578 
579         case ACPI_ASF_TYPE_ADDRESS:
580 
581             InfoTable = AcpiDmTableInfoAsf4;
582             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
583             DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
584             DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
585             break;
586 
587         default:
588 
589             AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n",
590                 SubTable->Header.Type);
591             return;
592         }
593 
594         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
595             SubTable->Header.Length, InfoTable);
596         if (ACPI_FAILURE (Status))
597         {
598             return;
599         }
600 
601         /* Dump variable-length extra data */
602 
603         switch (Type)
604         {
605         case ACPI_ASF_TYPE_ALERT:
606         case ACPI_ASF_TYPE_CONTROL:
607 
608             for (i = 0; i < DataCount; i++)
609             {
610                 AcpiOsPrintf ("\n");
611                 Status = AcpiDmDumpTable (Table->Length, DataOffset,
612                     DataTable, DataLength, DataInfoTable);
613                 if (ACPI_FAILURE (Status))
614                 {
615                     return;
616                 }
617 
618                 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
619                 DataOffset += DataLength;
620             }
621             break;
622 
623         case ACPI_ASF_TYPE_ADDRESS:
624 
625             for (i = 0; i < DataLength; i++)
626             {
627                 if (!(i % 16))
628                 {
629                     AcpiDmLineHeader (DataOffset, 1, "Addresses");
630                 }
631 
632                 AcpiOsPrintf ("%2.2X ", *DataTable);
633                 DataTable++;
634                 DataOffset++;
635 
636                 if (DataOffset > Table->Length)
637                 {
638                     AcpiOsPrintf (
639                         "**** ACPI table terminates in the middle of a "
640                         "data structure! (ASF! table)\n");
641                     return;
642                 }
643             }
644 
645             AcpiOsPrintf ("\n");
646             break;
647 
648         default:
649 
650             break;
651         }
652 
653         AcpiOsPrintf ("\n");
654 
655         /* Point to next subtable */
656 
657         if (!SubTable->Header.Length)
658         {
659             AcpiOsPrintf ("Invalid zero subtable header length\n");
660             return;
661         }
662 
663         Offset += SubTable->Header.Length;
664         SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable,
665             SubTable->Header.Length);
666     }
667 }
668 
669 
670 /*******************************************************************************
671  *
672  * FUNCTION:    AcpiDmDumpCpep
673  *
674  * PARAMETERS:  Table               - A CPEP table
675  *
676  * RETURN:      None
677  *
678  * DESCRIPTION: Format the contents of a CPEP. This table type consists
679  *              of an open-ended number of subtables.
680  *
681  ******************************************************************************/
682 
683 void
684 AcpiDmDumpCpep (
685     ACPI_TABLE_HEADER       *Table)
686 {
687     ACPI_STATUS             Status;
688     ACPI_CPEP_POLLING       *SubTable;
689     UINT32                  Length = Table->Length;
690     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
691 
692 
693     /* Main table */
694 
695     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
696     if (ACPI_FAILURE (Status))
697     {
698         return;
699     }
700 
701     /* Subtables */
702 
703     SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
704     while (Offset < Table->Length)
705     {
706         AcpiOsPrintf ("\n");
707         Status = AcpiDmDumpTable (Length, Offset, SubTable,
708             SubTable->Header.Length, AcpiDmTableInfoCpep0);
709         if (ACPI_FAILURE (Status))
710         {
711             return;
712         }
713 
714         /* Point to next subtable */
715 
716         Offset += SubTable->Header.Length;
717         SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
718             SubTable->Header.Length);
719     }
720 }
721 
722 
723 /*******************************************************************************
724  *
725  * FUNCTION:    AcpiDmDumpCsrt
726  *
727  * PARAMETERS:  Table               - A CSRT table
728  *
729  * RETURN:      None
730  *
731  * DESCRIPTION: Format the contents of a CSRT. This table type consists
732  *              of an open-ended number of subtables.
733  *
734  ******************************************************************************/
735 
736 void
737 AcpiDmDumpCsrt (
738     ACPI_TABLE_HEADER       *Table)
739 {
740     ACPI_STATUS             Status;
741     ACPI_CSRT_GROUP         *SubTable;
742     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
743     ACPI_CSRT_DESCRIPTOR    *SubSubTable;
744     UINT32                  Length = Table->Length;
745     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
746     UINT32                  SubOffset;
747     UINT32                  SubSubOffset;
748     UINT32                  InfoLength;
749 
750 
751     /* The main table only contains the ACPI header, thus already handled */
752 
753     /* Subtables (Resource Groups) */
754 
755     SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
756     while (Offset < Table->Length)
757     {
758         /* Resource group subtable */
759 
760         AcpiOsPrintf ("\n");
761         Status = AcpiDmDumpTable (Length, Offset, SubTable,
762             SubTable->Length, AcpiDmTableInfoCsrt0);
763         if (ACPI_FAILURE (Status))
764         {
765             return;
766         }
767 
768         /* Shared info subtable (One per resource group) */
769 
770         SubOffset = sizeof (ACPI_CSRT_GROUP);
771         SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
772             Offset + SubOffset);
773 
774         AcpiOsPrintf ("\n");
775         Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
776             sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
777         if (ACPI_FAILURE (Status))
778         {
779             return;
780         }
781 
782         SubOffset += SubTable->SharedInfoLength;
783 
784         /* Sub-Subtables (Resource Descriptors) */
785 
786         SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
787             Offset + SubOffset);
788 
789         while ((SubOffset < SubTable->Length) &&
790               ((Offset + SubOffset) < Table->Length))
791         {
792             AcpiOsPrintf ("\n");
793             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
794                 SubSubTable->Length, AcpiDmTableInfoCsrt2);
795             if (ACPI_FAILURE (Status))
796             {
797                 return;
798             }
799 
800             SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
801 
802             /* Resource-specific info buffer */
803 
804             InfoLength = SubSubTable->Length - SubSubOffset;
805             if (InfoLength)
806             {
807                 Status = AcpiDmDumpTable (Length,
808                     Offset + SubOffset + SubSubOffset, Table,
809                     InfoLength, AcpiDmTableInfoCsrt2a);
810                 if (ACPI_FAILURE (Status))
811                 {
812                     return;
813                 }
814                 SubSubOffset += InfoLength;
815             }
816 
817             /* Point to next sub-subtable */
818 
819             SubOffset += SubSubTable->Length;
820             SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
821                 SubSubTable->Length);
822         }
823 
824         /* Point to next subtable */
825 
826         Offset += SubTable->Length;
827         SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
828             SubTable->Length);
829     }
830 }
831 
832 
833 /*******************************************************************************
834  *
835  * FUNCTION:    AcpiDmDumpDbg2
836  *
837  * PARAMETERS:  Table               - A DBG2 table
838  *
839  * RETURN:      None
840  *
841  * DESCRIPTION: Format the contents of a DBG2. This table type consists
842  *              of an open-ended number of subtables.
843  *
844  ******************************************************************************/
845 
846 void
847 AcpiDmDumpDbg2 (
848     ACPI_TABLE_HEADER       *Table)
849 {
850     ACPI_STATUS             Status;
851     ACPI_DBG2_DEVICE        *SubTable;
852     UINT32                  Length = Table->Length;
853     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
854     UINT32                  i;
855     UINT32                  ArrayOffset;
856     UINT32                  AbsoluteOffset;
857     UINT8                   *Array;
858 
859 
860     /* Main table */
861 
862     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
863     if (ACPI_FAILURE (Status))
864     {
865         return;
866     }
867 
868     /* Subtables */
869 
870     SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
871     while (Offset < Table->Length)
872     {
873         AcpiOsPrintf ("\n");
874         Status = AcpiDmDumpTable (Length, Offset, SubTable,
875             SubTable->Length, AcpiDmTableInfoDbg2Device);
876         if (ACPI_FAILURE (Status))
877         {
878             return;
879         }
880 
881         /* Dump the BaseAddress array */
882 
883         for (i = 0; i < SubTable->RegisterCount; i++)
884         {
885             ArrayOffset = SubTable->BaseAddressOffset +
886                 (sizeof (ACPI_GENERIC_ADDRESS) * i);
887             AbsoluteOffset = Offset + ArrayOffset;
888             Array = (UINT8 *) SubTable + ArrayOffset;
889 
890             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
891                 SubTable->Length, AcpiDmTableInfoDbg2Addr);
892             if (ACPI_FAILURE (Status))
893             {
894                 return;
895             }
896         }
897 
898         /* Dump the AddressSize array */
899 
900         for (i = 0; i < SubTable->RegisterCount; i++)
901         {
902             ArrayOffset = SubTable->AddressSizeOffset +
903                 (sizeof (UINT32) * i);
904             AbsoluteOffset = Offset + ArrayOffset;
905             Array = (UINT8 *) SubTable + ArrayOffset;
906 
907             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
908                 SubTable->Length, AcpiDmTableInfoDbg2Size);
909             if (ACPI_FAILURE (Status))
910             {
911                 return;
912             }
913         }
914 
915         /* Dump the Namestring (required) */
916 
917         AcpiOsPrintf ("\n");
918         ArrayOffset = SubTable->NamepathOffset;
919         AbsoluteOffset = Offset + ArrayOffset;
920         Array = (UINT8 *) SubTable + ArrayOffset;
921 
922         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
923             SubTable->Length, AcpiDmTableInfoDbg2Name);
924         if (ACPI_FAILURE (Status))
925         {
926             return;
927         }
928 
929         /* Dump the OemData (optional) */
930 
931         if (SubTable->OemDataOffset)
932         {
933             Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset,
934                 Table, SubTable->OemDataLength,
935                 AcpiDmTableInfoDbg2OemData);
936             if (ACPI_FAILURE (Status))
937             {
938                 return;
939             }
940         }
941 
942         /* Point to next subtable */
943 
944         Offset += SubTable->Length;
945         SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
946             SubTable->Length);
947     }
948 }
949 
950 
951 /*******************************************************************************
952  *
953  * FUNCTION:    AcpiDmDumpDmar
954  *
955  * PARAMETERS:  Table               - A DMAR table
956  *
957  * RETURN:      None
958  *
959  * DESCRIPTION: Format the contents of a DMAR. This table type consists
960  *              of an open-ended number of subtables.
961  *
962  ******************************************************************************/
963 
964 void
965 AcpiDmDumpDmar (
966     ACPI_TABLE_HEADER       *Table)
967 {
968     ACPI_STATUS             Status;
969     ACPI_DMAR_HEADER        *SubTable;
970     UINT32                  Length = Table->Length;
971     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
972     ACPI_DMTABLE_INFO       *InfoTable;
973     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
974     UINT32                  ScopeOffset;
975     UINT8                   *PciPath;
976     UINT32                  PathOffset;
977 
978 
979     /* Main table */
980 
981     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
982     if (ACPI_FAILURE (Status))
983     {
984         return;
985     }
986 
987     /* Subtables */
988 
989     SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
990     while (Offset < Table->Length)
991     {
992         /* Common subtable header */
993 
994         AcpiOsPrintf ("\n");
995         Status = AcpiDmDumpTable (Length, Offset, SubTable,
996             SubTable->Length, AcpiDmTableInfoDmarHdr);
997         if (ACPI_FAILURE (Status))
998         {
999             return;
1000         }
1001 
1002         AcpiOsPrintf ("\n");
1003 
1004         switch (SubTable->Type)
1005         {
1006         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
1007 
1008             InfoTable = AcpiDmTableInfoDmar0;
1009             ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
1010             break;
1011 
1012         case ACPI_DMAR_TYPE_RESERVED_MEMORY:
1013 
1014             InfoTable = AcpiDmTableInfoDmar1;
1015             ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
1016             break;
1017 
1018         case ACPI_DMAR_TYPE_ROOT_ATS:
1019 
1020             InfoTable = AcpiDmTableInfoDmar2;
1021             ScopeOffset = sizeof (ACPI_DMAR_ATSR);
1022             break;
1023 
1024         case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
1025 
1026             InfoTable = AcpiDmTableInfoDmar3;
1027             ScopeOffset = sizeof (ACPI_DMAR_RHSA);
1028             break;
1029 
1030         case ACPI_DMAR_TYPE_NAMESPACE:
1031 
1032             InfoTable = AcpiDmTableInfoDmar4;
1033             ScopeOffset = sizeof (ACPI_DMAR_ANDD);
1034             break;
1035 
1036         default:
1037 
1038             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
1039                 SubTable->Type);
1040             return;
1041         }
1042 
1043         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1044             SubTable->Length, InfoTable);
1045         if (ACPI_FAILURE (Status))
1046         {
1047             return;
1048         }
1049 
1050         /*
1051          * Dump the optional device scope entries
1052          */
1053         if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1054             (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE))
1055         {
1056             /* These types do not support device scopes */
1057 
1058             goto NextSubtable;
1059         }
1060 
1061         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
1062         while (ScopeOffset < SubTable->Length)
1063         {
1064             AcpiOsPrintf ("\n");
1065             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
1066                 ScopeTable->Length, AcpiDmTableInfoDmarScope);
1067             if (ACPI_FAILURE (Status))
1068             {
1069                 return;
1070             }
1071             AcpiOsPrintf ("\n");
1072 
1073             /* Dump the PCI Path entries for this device scope */
1074 
1075             PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
1076 
1077             PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
1078                 sizeof (ACPI_DMAR_DEVICE_SCOPE));
1079 
1080             while (PathOffset < ScopeTable->Length)
1081             {
1082                 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2,
1083                     "PCI Path");
1084                 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
1085 
1086                 /* Point to next PCI Path entry */
1087 
1088                 PathOffset += 2;
1089                 PciPath += 2;
1090                 AcpiOsPrintf ("\n");
1091             }
1092 
1093             /* Point to next device scope entry */
1094 
1095             ScopeOffset += ScopeTable->Length;
1096             ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
1097                 ScopeTable, ScopeTable->Length);
1098         }
1099 
1100 NextSubtable:
1101         /* Point to next subtable */
1102 
1103         Offset += SubTable->Length;
1104         SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable,
1105             SubTable->Length);
1106     }
1107 }
1108 
1109 
1110 /*******************************************************************************
1111  *
1112  * FUNCTION:    AcpiDmDumpDrtm
1113  *
1114  * PARAMETERS:  Table               - A DRTM table
1115  *
1116  * RETURN:      None
1117  *
1118  * DESCRIPTION: Format the contents of a DRTM.
1119  *
1120  ******************************************************************************/
1121 
1122 void
1123 AcpiDmDumpDrtm (
1124     ACPI_TABLE_HEADER       *Table)
1125 {
1126     ACPI_STATUS             Status;
1127     UINT32                  Offset;
1128     ACPI_DRTM_VTABLE_LIST   *DrtmVtl;
1129     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
1130     ACPI_DRTM_DPS_ID        *DrtmDps;
1131     UINT32                  Count;
1132 
1133 
1134     /* Main table */
1135 
1136     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
1137         AcpiDmTableInfoDrtm);
1138     if (ACPI_FAILURE (Status))
1139     {
1140         return;
1141     }
1142 
1143     Offset = sizeof (ACPI_TABLE_DRTM);
1144 
1145     /* Sub-tables */
1146 
1147     /* Dump ValidatedTable length */
1148 
1149     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
1150     AcpiOsPrintf ("\n");
1151     Status = AcpiDmDumpTable (Table->Length, Offset,
1152         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
1153         AcpiDmTableInfoDrtm0);
1154     if (ACPI_FAILURE (Status))
1155     {
1156             return;
1157     }
1158 
1159     Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
1160 
1161     /* Dump Validated table addresses */
1162 
1163     Count = 0;
1164     while ((Offset < Table->Length) &&
1165             (DrtmVtl->ValidatedTableCount > Count))
1166     {
1167         Status = AcpiDmDumpTable (Table->Length, Offset,
1168             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
1169             AcpiDmTableInfoDrtm0a);
1170         if (ACPI_FAILURE (Status))
1171         {
1172             return;
1173         }
1174 
1175         Offset += sizeof (UINT64);
1176         Count++;
1177     }
1178 
1179     /* Dump ResourceList length */
1180 
1181     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
1182     AcpiOsPrintf ("\n");
1183     Status = AcpiDmDumpTable (Table->Length, Offset,
1184         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
1185         AcpiDmTableInfoDrtm1);
1186     if (ACPI_FAILURE (Status))
1187     {
1188         return;
1189     }
1190 
1191     Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
1192 
1193     /* Dump the Resource List */
1194 
1195     Count = 0;
1196     while ((Offset < Table->Length) &&
1197            (DrtmRl->ResourceCount > Count))
1198     {
1199         Status = AcpiDmDumpTable (Table->Length, Offset,
1200             ACPI_ADD_PTR (void, Table, Offset),
1201             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
1202         if (ACPI_FAILURE (Status))
1203         {
1204             return;
1205         }
1206 
1207         Offset += sizeof (ACPI_DRTM_RESOURCE);
1208         Count++;
1209     }
1210 
1211     /* Dump DPS */
1212 
1213     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
1214     AcpiOsPrintf ("\n");
1215     (void) AcpiDmDumpTable (Table->Length, Offset,
1216         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
1217 }
1218 
1219 
1220 /*******************************************************************************
1221  *
1222  * FUNCTION:    AcpiDmDumpEinj
1223  *
1224  * PARAMETERS:  Table               - A EINJ table
1225  *
1226  * RETURN:      None
1227  *
1228  * DESCRIPTION: Format the contents of a EINJ. This table type consists
1229  *              of an open-ended number of subtables.
1230  *
1231  ******************************************************************************/
1232 
1233 void
1234 AcpiDmDumpEinj (
1235     ACPI_TABLE_HEADER       *Table)
1236 {
1237     ACPI_STATUS             Status;
1238     ACPI_WHEA_HEADER        *SubTable;
1239     UINT32                  Length = Table->Length;
1240     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
1241 
1242 
1243     /* Main table */
1244 
1245     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
1246     if (ACPI_FAILURE (Status))
1247     {
1248         return;
1249     }
1250 
1251     /* Subtables */
1252 
1253     SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1254     while (Offset < Table->Length)
1255     {
1256         AcpiOsPrintf ("\n");
1257         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1258             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1259         if (ACPI_FAILURE (Status))
1260         {
1261             return;
1262         }
1263 
1264         /* Point to next subtable (each subtable is of fixed length) */
1265 
1266         Offset += sizeof (ACPI_WHEA_HEADER);
1267         SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1268             sizeof (ACPI_WHEA_HEADER));
1269     }
1270 }
1271 
1272 
1273 /*******************************************************************************
1274  *
1275  * FUNCTION:    AcpiDmDumpErst
1276  *
1277  * PARAMETERS:  Table               - A ERST table
1278  *
1279  * RETURN:      None
1280  *
1281  * DESCRIPTION: Format the contents of a ERST. This table type consists
1282  *              of an open-ended number of subtables.
1283  *
1284  ******************************************************************************/
1285 
1286 void
1287 AcpiDmDumpErst (
1288     ACPI_TABLE_HEADER       *Table)
1289 {
1290     ACPI_STATUS             Status;
1291     ACPI_WHEA_HEADER        *SubTable;
1292     UINT32                  Length = Table->Length;
1293     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
1294 
1295 
1296     /* Main table */
1297 
1298     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1299     if (ACPI_FAILURE (Status))
1300     {
1301         return;
1302     }
1303 
1304     /* Subtables */
1305 
1306     SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1307     while (Offset < Table->Length)
1308     {
1309         AcpiOsPrintf ("\n");
1310         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1311             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1312         if (ACPI_FAILURE (Status))
1313         {
1314             return;
1315         }
1316 
1317         /* Point to next subtable (each subtable is of fixed length) */
1318 
1319         Offset += sizeof (ACPI_WHEA_HEADER);
1320         SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1321             sizeof (ACPI_WHEA_HEADER));
1322     }
1323 }
1324 
1325 
1326 /*******************************************************************************
1327  *
1328  * FUNCTION:    AcpiDmDumpFpdt
1329  *
1330  * PARAMETERS:  Table               - A FPDT table
1331  *
1332  * RETURN:      None
1333  *
1334  * DESCRIPTION: Format the contents of a FPDT. This table type consists
1335  *              of an open-ended number of subtables.
1336  *
1337  ******************************************************************************/
1338 
1339 void
1340 AcpiDmDumpFpdt (
1341     ACPI_TABLE_HEADER       *Table)
1342 {
1343     ACPI_STATUS             Status;
1344     ACPI_FPDT_HEADER        *SubTable;
1345     UINT32                  Length = Table->Length;
1346     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
1347     ACPI_DMTABLE_INFO       *InfoTable;
1348 
1349 
1350     /* There is no main table (other than the standard ACPI header) */
1351 
1352     /* Subtables */
1353 
1354     SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1355     while (Offset < Table->Length)
1356     {
1357         /* Common subtable header */
1358 
1359         AcpiOsPrintf ("\n");
1360         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1361             SubTable->Length, AcpiDmTableInfoFpdtHdr);
1362         if (ACPI_FAILURE (Status))
1363         {
1364             return;
1365         }
1366 
1367         switch (SubTable->Type)
1368         {
1369         case ACPI_FPDT_TYPE_BOOT:
1370 
1371             InfoTable = AcpiDmTableInfoFpdt0;
1372             break;
1373 
1374         case ACPI_FPDT_TYPE_S3PERF:
1375 
1376             InfoTable = AcpiDmTableInfoFpdt1;
1377             break;
1378 
1379         default:
1380 
1381             AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
1382                 SubTable->Type);
1383 
1384             /* Attempt to continue */
1385 
1386             if (!SubTable->Length)
1387             {
1388                 AcpiOsPrintf ("Invalid zero length subtable\n");
1389                 return;
1390             }
1391             goto NextSubTable;
1392         }
1393 
1394         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1395             SubTable->Length, InfoTable);
1396         if (ACPI_FAILURE (Status))
1397         {
1398             return;
1399         }
1400 
1401 NextSubTable:
1402         /* Point to next subtable */
1403 
1404         Offset += SubTable->Length;
1405         SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable,
1406             SubTable->Length);
1407     }
1408 }
1409 
1410 
1411 /*******************************************************************************
1412  *
1413  * FUNCTION:    AcpiDmDumpGtdt
1414  *
1415  * PARAMETERS:  Table               - A GTDT table
1416  *
1417  * RETURN:      None
1418  *
1419  * DESCRIPTION: Format the contents of a GTDT. This table type consists
1420  *              of an open-ended number of subtables.
1421  *
1422  ******************************************************************************/
1423 
1424 void
1425 AcpiDmDumpGtdt (
1426     ACPI_TABLE_HEADER       *Table)
1427 {
1428     ACPI_STATUS             Status;
1429     ACPI_GTDT_HEADER        *SubTable;
1430     UINT32                  Length = Table->Length;
1431     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
1432     ACPI_DMTABLE_INFO       *InfoTable;
1433     UINT32                  SubTableLength;
1434     UINT32                  GtCount;
1435     ACPI_GTDT_TIMER_ENTRY   *GtxTable;
1436 
1437 
1438     /* Main table */
1439 
1440     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
1441     if (ACPI_FAILURE (Status))
1442     {
1443         return;
1444     }
1445 
1446     /* Subtables */
1447 
1448     SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1449     while (Offset < Table->Length)
1450     {
1451         /* Common subtable header */
1452 
1453         AcpiOsPrintf ("\n");
1454         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1455             SubTable->Length, AcpiDmTableInfoGtdtHdr);
1456         if (ACPI_FAILURE (Status))
1457         {
1458             return;
1459         }
1460 
1461         GtCount = 0;
1462         switch (SubTable->Type)
1463         {
1464         case ACPI_GTDT_TYPE_TIMER_BLOCK:
1465 
1466             SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
1467             GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1468                 SubTable))->TimerCount;
1469 
1470             InfoTable = AcpiDmTableInfoGtdt0;
1471             break;
1472 
1473         case ACPI_GTDT_TYPE_WATCHDOG:
1474 
1475             SubTableLength = sizeof (ACPI_GTDT_WATCHDOG);
1476 
1477             InfoTable = AcpiDmTableInfoGtdt1;
1478             break;
1479 
1480         default:
1481 
1482             /* Cannot continue on unknown type - no length */
1483 
1484             AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n",
1485                 SubTable->Type);
1486             return;
1487         }
1488 
1489         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1490             SubTable->Length, InfoTable);
1491         if (ACPI_FAILURE (Status))
1492         {
1493             return;
1494         }
1495 
1496         /* Point to end of current subtable (each subtable above is of fixed length) */
1497 
1498         Offset += SubTableLength;
1499 
1500         /* If there are any Gt Timer Blocks from above, dump them now */
1501 
1502         if (GtCount)
1503         {
1504             GtxTable = ACPI_ADD_PTR (
1505                 ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
1506             SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
1507 
1508             while (GtCount)
1509             {
1510                 AcpiOsPrintf ("\n");
1511                 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
1512                     sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
1513                 if (ACPI_FAILURE (Status))
1514                 {
1515                     return;
1516                 }
1517                 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
1518                 GtxTable++;
1519                 GtCount--;
1520             }
1521         }
1522 
1523         /* Point to next subtable */
1524 
1525         SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength);
1526     }
1527 }
1528 
1529 
1530 /*******************************************************************************
1531  *
1532  * FUNCTION:    AcpiDmDumpHest
1533  *
1534  * PARAMETERS:  Table               - A HEST table
1535  *
1536  * RETURN:      None
1537  *
1538  * DESCRIPTION: Format the contents of a HEST. This table type consists
1539  *              of an open-ended number of subtables.
1540  *
1541  ******************************************************************************/
1542 
1543 void
1544 AcpiDmDumpHest (
1545     ACPI_TABLE_HEADER       *Table)
1546 {
1547     ACPI_STATUS             Status;
1548     ACPI_HEST_HEADER        *SubTable;
1549     UINT32                  Length = Table->Length;
1550     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
1551     ACPI_DMTABLE_INFO       *InfoTable;
1552     UINT32                  SubTableLength;
1553     UINT32                  BankCount;
1554     ACPI_HEST_IA_ERROR_BANK *BankTable;
1555 
1556 
1557     /* Main table */
1558 
1559     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1560     if (ACPI_FAILURE (Status))
1561     {
1562         return;
1563     }
1564 
1565     /* Subtables */
1566 
1567     SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1568     while (Offset < Table->Length)
1569     {
1570         BankCount = 0;
1571         switch (SubTable->Type)
1572         {
1573         case ACPI_HEST_TYPE_IA32_CHECK:
1574 
1575             InfoTable = AcpiDmTableInfoHest0;
1576             SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1577             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1578                 SubTable))->NumHardwareBanks;
1579             break;
1580 
1581         case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1582 
1583             InfoTable = AcpiDmTableInfoHest1;
1584             SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1585             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1586                 SubTable))->NumHardwareBanks;
1587             break;
1588 
1589         case ACPI_HEST_TYPE_IA32_NMI:
1590 
1591             InfoTable = AcpiDmTableInfoHest2;
1592             SubTableLength = sizeof (ACPI_HEST_IA_NMI);
1593             break;
1594 
1595         case ACPI_HEST_TYPE_AER_ROOT_PORT:
1596 
1597             InfoTable = AcpiDmTableInfoHest6;
1598             SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
1599             break;
1600 
1601         case ACPI_HEST_TYPE_AER_ENDPOINT:
1602 
1603             InfoTable = AcpiDmTableInfoHest7;
1604             SubTableLength = sizeof (ACPI_HEST_AER);
1605             break;
1606 
1607         case ACPI_HEST_TYPE_AER_BRIDGE:
1608 
1609             InfoTable = AcpiDmTableInfoHest8;
1610             SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1611             break;
1612 
1613         case ACPI_HEST_TYPE_GENERIC_ERROR:
1614 
1615             InfoTable = AcpiDmTableInfoHest9;
1616             SubTableLength = sizeof (ACPI_HEST_GENERIC);
1617             break;
1618 
1619         case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1620 
1621             InfoTable = AcpiDmTableInfoHest10;
1622             SubTableLength = sizeof (ACPI_HEST_GENERIC_V2);
1623             break;
1624 
1625         default:
1626 
1627             /* Cannot continue on unknown type - no length */
1628 
1629             AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
1630                 SubTable->Type);
1631             return;
1632         }
1633 
1634         AcpiOsPrintf ("\n");
1635         Status = AcpiDmDumpTable (Length, Offset, SubTable,
1636             SubTableLength, InfoTable);
1637         if (ACPI_FAILURE (Status))
1638         {
1639             return;
1640         }
1641 
1642         /* Point to end of current subtable (each subtable above is of fixed length) */
1643 
1644         Offset += SubTableLength;
1645 
1646         /* If there are any (fixed-length) Error Banks from above, dump them now */
1647 
1648         if (BankCount)
1649         {
1650             BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable,
1651                 SubTableLength);
1652             SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1653 
1654             while (BankCount)
1655             {
1656                 AcpiOsPrintf ("\n");
1657                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1658                     sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1659                 if (ACPI_FAILURE (Status))
1660                 {
1661                     return;
1662                 }
1663 
1664                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1665                 BankTable++;
1666                 BankCount--;
1667             }
1668         }
1669 
1670         /* Point to next subtable */
1671 
1672         SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
1673     }
1674 }
1675 
1676 
1677 /*******************************************************************************
1678  *
1679  * FUNCTION:    AcpiDmDumpIort
1680  *
1681  * PARAMETERS:  Table               - A IORT table
1682  *
1683  * RETURN:      None
1684  *
1685  * DESCRIPTION: Format the contents of a IORT
1686  *
1687  ******************************************************************************/
1688 
1689 void
1690 AcpiDmDumpIort (
1691     ACPI_TABLE_HEADER       *Table)
1692 {
1693     ACPI_STATUS             Status;
1694     ACPI_TABLE_IORT         *Iort;
1695     ACPI_IORT_NODE          *IortNode;
1696     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
1697     ACPI_IORT_SMMU          *IortSmmu = NULL;
1698     UINT32                  Offset;
1699     UINT32                  NodeOffset;
1700     UINT32                  Length;
1701     ACPI_DMTABLE_INFO       *InfoTable;
1702     char                    *String;
1703     UINT32                  i;
1704 
1705 
1706     /* Main table */
1707 
1708     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
1709     if (ACPI_FAILURE (Status))
1710     {
1711         return;
1712     }
1713 
1714     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
1715     Offset = sizeof (ACPI_TABLE_IORT);
1716 
1717     /* Dump the OptionalPadding (optional) */
1718 
1719     if (Iort->NodeOffset > Offset)
1720     {
1721         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
1722             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
1723         if (ACPI_FAILURE (Status))
1724         {
1725             return;
1726         }
1727     }
1728 
1729     Offset = Iort->NodeOffset;
1730     while (Offset < Table->Length)
1731     {
1732         /* Common subtable header */
1733 
1734         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
1735         AcpiOsPrintf ("\n");
1736         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
1737         Status = AcpiDmDumpTable (Table->Length, Offset,
1738             IortNode, Length, AcpiDmTableInfoIortHdr);
1739         if (ACPI_FAILURE (Status))
1740         {
1741             return;
1742         }
1743 
1744         NodeOffset = Length;
1745 
1746         switch (IortNode->Type)
1747         {
1748         case ACPI_IORT_NODE_ITS_GROUP:
1749 
1750             InfoTable = AcpiDmTableInfoIort0;
1751             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
1752             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
1753             break;
1754 
1755         case ACPI_IORT_NODE_NAMED_COMPONENT:
1756 
1757             InfoTable = AcpiDmTableInfoIort1;
1758             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
1759             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
1760             Length += strlen (String) + 1;
1761             break;
1762 
1763         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
1764 
1765             InfoTable = AcpiDmTableInfoIort2;
1766             Length = IortNode->Length - NodeOffset;
1767             break;
1768 
1769         case ACPI_IORT_NODE_SMMU:
1770 
1771             InfoTable = AcpiDmTableInfoIort3;
1772             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
1773             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
1774             break;
1775 
1776         case ACPI_IORT_NODE_SMMU_V3:
1777 
1778             InfoTable = AcpiDmTableInfoIort4;
1779             Length = IortNode->Length - NodeOffset;
1780             break;
1781 
1782         default:
1783 
1784             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
1785                 IortNode->Type);
1786 
1787             /* Attempt to continue */
1788 
1789             if (!IortNode->Length)
1790             {
1791                 AcpiOsPrintf ("Invalid zero length IORT node\n");
1792                 return;
1793             }
1794             goto NextSubTable;
1795         }
1796 
1797         /* Dump the node subtable header */
1798 
1799         AcpiOsPrintf ("\n");
1800         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1801             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1802             Length, InfoTable);
1803         if (ACPI_FAILURE (Status))
1804         {
1805             return;
1806         }
1807 
1808         NodeOffset += Length;
1809 
1810         /* Dump the node specific data */
1811 
1812         switch (IortNode->Type)
1813         {
1814         case ACPI_IORT_NODE_ITS_GROUP:
1815 
1816             /* Validate IortItsGroup to avoid compiler warnings */
1817 
1818             if (IortItsGroup)
1819             {
1820                 for (i = 0; i < IortItsGroup->ItsCount; i++)
1821                 {
1822                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1823                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1824                         4, AcpiDmTableInfoIort0a);
1825                     NodeOffset += 4;
1826                 }
1827             }
1828             break;
1829 
1830         case ACPI_IORT_NODE_NAMED_COMPONENT:
1831 
1832             /* Dump the Padding (optional) */
1833 
1834             if (IortNode->Length > NodeOffset)
1835             {
1836                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1837                     Table, IortNode->Length - NodeOffset,
1838                     AcpiDmTableInfoIort1a);
1839                 if (ACPI_FAILURE (Status))
1840                 {
1841                     return;
1842                 }
1843             }
1844             break;
1845 
1846         case ACPI_IORT_NODE_SMMU:
1847 
1848             AcpiOsPrintf ("\n");
1849 
1850             /* Validate IortSmmu to avoid compiler warnings */
1851 
1852             if (IortSmmu)
1853             {
1854                 Length = 2 * sizeof (UINT64);
1855                 NodeOffset = IortSmmu->GlobalInterruptOffset;
1856                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1857                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1858                     Length, AcpiDmTableInfoIort3a);
1859                 if (ACPI_FAILURE (Status))
1860                 {
1861                     return;
1862                 }
1863 
1864                 NodeOffset = IortSmmu->ContextInterruptOffset;
1865                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
1866                 {
1867                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1868                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1869                         8, AcpiDmTableInfoIort3b);
1870                     if (ACPI_FAILURE (Status))
1871                     {
1872                         return;
1873                     }
1874 
1875                     NodeOffset += 8;
1876                 }
1877 
1878                 NodeOffset = IortSmmu->PmuInterruptOffset;
1879                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
1880                 {
1881                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1882                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1883                         8, AcpiDmTableInfoIort3c);
1884                     if (ACPI_FAILURE (Status))
1885                     {
1886                         return;
1887                     }
1888 
1889                     NodeOffset += 8;
1890                 }
1891             }
1892             break;
1893 
1894         default:
1895 
1896             break;
1897         }
1898 
1899         /* Dump the ID mappings */
1900 
1901         NodeOffset = IortNode->MappingOffset;
1902         for (i = 0; i < IortNode->MappingCount; i++)
1903         {
1904             AcpiOsPrintf ("\n");
1905             Length = sizeof (ACPI_IORT_ID_MAPPING);
1906             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1907                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1908                 Length, AcpiDmTableInfoIortMap);
1909             if (ACPI_FAILURE (Status))
1910             {
1911                 return;
1912             }
1913 
1914             NodeOffset += Length;
1915         }
1916 
1917 NextSubTable:
1918         /* Point to next node subtable */
1919 
1920         Offset += IortNode->Length;
1921         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
1922     }
1923 }
1924 
1925 
1926 /*******************************************************************************
1927  *
1928  * FUNCTION:    AcpiDmDumpIvrs
1929  *
1930  * PARAMETERS:  Table               - A IVRS table
1931  *
1932  * RETURN:      None
1933  *
1934  * DESCRIPTION: Format the contents of a IVRS
1935  *
1936  ******************************************************************************/
1937 
1938 static UINT8 EntrySizes[] = {4,8,16,32};
1939 
1940 void
1941 AcpiDmDumpIvrs (
1942     ACPI_TABLE_HEADER       *Table)
1943 {
1944     ACPI_STATUS             Status;
1945     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
1946     UINT32                  EntryOffset;
1947     UINT32                  EntryLength;
1948     UINT32                  EntryType;
1949     ACPI_IVRS_DE_HEADER     *DeviceEntry;
1950     ACPI_IVRS_HEADER        *SubTable;
1951     ACPI_DMTABLE_INFO       *InfoTable;
1952 
1953 
1954     /* Main table */
1955 
1956     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
1957     if (ACPI_FAILURE (Status))
1958     {
1959         return;
1960     }
1961 
1962     /* Subtables */
1963 
1964     SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
1965     while (Offset < Table->Length)
1966     {
1967         /* Common subtable header */
1968 
1969         AcpiOsPrintf ("\n");
1970         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1971             SubTable->Length, AcpiDmTableInfoIvrsHdr);
1972         if (ACPI_FAILURE (Status))
1973         {
1974             return;
1975         }
1976 
1977         switch (SubTable->Type)
1978         {
1979         case ACPI_IVRS_TYPE_HARDWARE:
1980 
1981             InfoTable = AcpiDmTableInfoIvrs0;
1982             break;
1983 
1984         case ACPI_IVRS_TYPE_MEMORY1:
1985         case ACPI_IVRS_TYPE_MEMORY2:
1986         case ACPI_IVRS_TYPE_MEMORY3:
1987 
1988             InfoTable = AcpiDmTableInfoIvrs1;
1989             break;
1990 
1991         default:
1992 
1993             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
1994                 SubTable->Type);
1995 
1996             /* Attempt to continue */
1997 
1998             if (!SubTable->Length)
1999             {
2000                 AcpiOsPrintf ("Invalid zero length subtable\n");
2001                 return;
2002             }
2003             goto NextSubTable;
2004         }
2005 
2006         /* Dump the subtable */
2007 
2008         AcpiOsPrintf ("\n");
2009         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2010             SubTable->Length, InfoTable);
2011         if (ACPI_FAILURE (Status))
2012         {
2013             return;
2014         }
2015 
2016         /* The hardware subtable can contain multiple device entries */
2017 
2018         if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
2019         {
2020             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
2021             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
2022                 sizeof (ACPI_IVRS_HARDWARE));
2023 
2024             while (EntryOffset < (Offset + SubTable->Length))
2025             {
2026                 AcpiOsPrintf ("\n");
2027                 /*
2028                  * Upper 2 bits of Type encode the length of the device entry
2029                  *
2030                  * 00 = 4 byte
2031                  * 01 = 8 byte
2032                  * 10 = 16 byte - currently no entries defined
2033                  * 11 = 32 byte - currently no entries defined
2034                  */
2035                 EntryType = DeviceEntry->Type;
2036                 EntryLength = EntrySizes [EntryType >> 6];
2037 
2038                 switch (EntryType)
2039                 {
2040                 /* 4-byte device entries */
2041 
2042                 case ACPI_IVRS_TYPE_PAD4:
2043                 case ACPI_IVRS_TYPE_ALL:
2044                 case ACPI_IVRS_TYPE_SELECT:
2045                 case ACPI_IVRS_TYPE_START:
2046                 case ACPI_IVRS_TYPE_END:
2047 
2048                     InfoTable = AcpiDmTableInfoIvrs4;
2049                     break;
2050 
2051                 /* 8-byte entries, type A */
2052 
2053                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
2054                 case ACPI_IVRS_TYPE_ALIAS_START:
2055 
2056                     InfoTable = AcpiDmTableInfoIvrs8a;
2057                     break;
2058 
2059                 /* 8-byte entries, type B */
2060 
2061                 case ACPI_IVRS_TYPE_PAD8:
2062                 case ACPI_IVRS_TYPE_EXT_SELECT:
2063                 case ACPI_IVRS_TYPE_EXT_START:
2064 
2065                     InfoTable = AcpiDmTableInfoIvrs8b;
2066                     break;
2067 
2068                 /* 8-byte entries, type C */
2069 
2070                 case ACPI_IVRS_TYPE_SPECIAL:
2071 
2072                     InfoTable = AcpiDmTableInfoIvrs8c;
2073                     break;
2074 
2075                 default:
2076                     InfoTable = AcpiDmTableInfoIvrs4;
2077                     AcpiOsPrintf (
2078                         "\n**** Unknown IVRS device entry type/length: "
2079                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
2080                         EntryType, EntryLength, EntryOffset);
2081                     break;
2082                 }
2083 
2084                 /* Dump the Device Entry */
2085 
2086                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
2087                     DeviceEntry, EntryLength, InfoTable);
2088                 if (ACPI_FAILURE (Status))
2089                 {
2090                     return;
2091                 }
2092 
2093                 EntryOffset += EntryLength;
2094                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
2095                     EntryLength);
2096             }
2097         }
2098 
2099 NextSubTable:
2100         /* Point to next subtable */
2101 
2102         Offset += SubTable->Length;
2103         SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
2104     }
2105 }
2106 
2107 
2108 /*******************************************************************************
2109  *
2110  * FUNCTION:    AcpiDmDumpLpit
2111  *
2112  * PARAMETERS:  Table               - A LPIT table
2113  *
2114  * RETURN:      None
2115  *
2116  * DESCRIPTION: Format the contents of a LPIT. This table type consists
2117  *              of an open-ended number of subtables. Note: There are no
2118  *              entries in the main table. An LPIT consists of the table
2119  *              header and then subtables only.
2120  *
2121  ******************************************************************************/
2122 
2123 void
2124 AcpiDmDumpLpit (
2125     ACPI_TABLE_HEADER       *Table)
2126 {
2127     ACPI_STATUS             Status;
2128     ACPI_LPIT_HEADER        *SubTable;
2129     UINT32                  Length = Table->Length;
2130     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
2131     ACPI_DMTABLE_INFO       *InfoTable;
2132     UINT32                  SubTableLength;
2133 
2134 
2135     /* Subtables */
2136 
2137     SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
2138     while (Offset < Table->Length)
2139     {
2140         /* Common subtable header */
2141 
2142         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2143             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
2144         if (ACPI_FAILURE (Status))
2145         {
2146             return;
2147         }
2148 
2149         switch (SubTable->Type)
2150         {
2151         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
2152 
2153             InfoTable = AcpiDmTableInfoLpit0;
2154             SubTableLength = sizeof (ACPI_LPIT_NATIVE);
2155             break;
2156 
2157         default:
2158 
2159             /* Cannot continue on unknown type - no length */
2160 
2161             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
2162                 SubTable->Type);
2163             return;
2164         }
2165 
2166         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2167             SubTableLength, InfoTable);
2168         if (ACPI_FAILURE (Status))
2169         {
2170             return;
2171         }
2172 
2173         AcpiOsPrintf ("\n");
2174 
2175         /* Point to next subtable */
2176 
2177         Offset += SubTableLength;
2178         SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength);
2179     }
2180 }
2181 
2182 
2183 /*******************************************************************************
2184  *
2185  * FUNCTION:    AcpiDmDumpMadt
2186  *
2187  * PARAMETERS:  Table               - A MADT table
2188  *
2189  * RETURN:      None
2190  *
2191  * DESCRIPTION: Format the contents of a MADT. This table type consists
2192  *              of an open-ended number of subtables.
2193  *
2194  ******************************************************************************/
2195 
2196 void
2197 AcpiDmDumpMadt (
2198     ACPI_TABLE_HEADER       *Table)
2199 {
2200     ACPI_STATUS             Status;
2201     ACPI_SUBTABLE_HEADER    *SubTable;
2202     UINT32                  Length = Table->Length;
2203     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
2204     ACPI_DMTABLE_INFO       *InfoTable;
2205 
2206 
2207     /* Main table */
2208 
2209     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
2210     if (ACPI_FAILURE (Status))
2211     {
2212         return;
2213     }
2214 
2215     /* Subtables */
2216 
2217     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2218     while (Offset < Table->Length)
2219     {
2220         /* Common subtable header */
2221 
2222         AcpiOsPrintf ("\n");
2223         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2224             SubTable->Length, AcpiDmTableInfoMadtHdr);
2225         if (ACPI_FAILURE (Status))
2226         {
2227             return;
2228         }
2229 
2230         switch (SubTable->Type)
2231         {
2232         case ACPI_MADT_TYPE_LOCAL_APIC:
2233 
2234             InfoTable = AcpiDmTableInfoMadt0;
2235             break;
2236 
2237         case ACPI_MADT_TYPE_IO_APIC:
2238 
2239             InfoTable = AcpiDmTableInfoMadt1;
2240             break;
2241 
2242         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
2243 
2244             InfoTable = AcpiDmTableInfoMadt2;
2245             break;
2246 
2247         case ACPI_MADT_TYPE_NMI_SOURCE:
2248 
2249             InfoTable = AcpiDmTableInfoMadt3;
2250             break;
2251 
2252         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
2253 
2254             InfoTable = AcpiDmTableInfoMadt4;
2255             break;
2256 
2257         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
2258 
2259             InfoTable = AcpiDmTableInfoMadt5;
2260             break;
2261 
2262         case ACPI_MADT_TYPE_IO_SAPIC:
2263 
2264             InfoTable = AcpiDmTableInfoMadt6;
2265             break;
2266 
2267         case ACPI_MADT_TYPE_LOCAL_SAPIC:
2268 
2269             InfoTable = AcpiDmTableInfoMadt7;
2270             break;
2271 
2272         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
2273 
2274             InfoTable = AcpiDmTableInfoMadt8;
2275             break;
2276 
2277         case ACPI_MADT_TYPE_LOCAL_X2APIC:
2278 
2279             InfoTable = AcpiDmTableInfoMadt9;
2280             break;
2281 
2282         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
2283 
2284             InfoTable = AcpiDmTableInfoMadt10;
2285             break;
2286 
2287         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
2288 
2289             InfoTable = AcpiDmTableInfoMadt11;
2290             break;
2291 
2292         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
2293 
2294             InfoTable = AcpiDmTableInfoMadt12;
2295             break;
2296 
2297         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
2298 
2299             InfoTable = AcpiDmTableInfoMadt13;
2300             break;
2301 
2302         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
2303 
2304             InfoTable = AcpiDmTableInfoMadt14;
2305             break;
2306 
2307         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
2308 
2309             InfoTable = AcpiDmTableInfoMadt15;
2310             break;
2311 
2312         default:
2313 
2314             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
2315                 SubTable->Type);
2316 
2317             /* Attempt to continue */
2318 
2319             if (!SubTable->Length)
2320             {
2321                 AcpiOsPrintf ("Invalid zero length subtable\n");
2322                 return;
2323             }
2324 
2325             goto NextSubTable;
2326         }
2327 
2328         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2329             SubTable->Length, InfoTable);
2330         if (ACPI_FAILURE (Status))
2331         {
2332             return;
2333         }
2334 
2335 NextSubTable:
2336         /* Point to next subtable */
2337 
2338         Offset += SubTable->Length;
2339         SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
2340             SubTable->Length);
2341     }
2342 }
2343 
2344 
2345 /*******************************************************************************
2346  *
2347  * FUNCTION:    AcpiDmDumpMcfg
2348  *
2349  * PARAMETERS:  Table               - A MCFG Table
2350  *
2351  * RETURN:      None
2352  *
2353  * DESCRIPTION: Format the contents of a MCFG table
2354  *
2355  ******************************************************************************/
2356 
2357 void
2358 AcpiDmDumpMcfg (
2359     ACPI_TABLE_HEADER       *Table)
2360 {
2361     ACPI_STATUS             Status;
2362     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
2363     ACPI_MCFG_ALLOCATION    *SubTable;
2364 
2365 
2366     /* Main table */
2367 
2368     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
2369     if (ACPI_FAILURE (Status))
2370     {
2371         return;
2372     }
2373 
2374     /* Subtables */
2375 
2376     SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
2377     while (Offset < Table->Length)
2378     {
2379         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
2380         {
2381             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
2382                 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
2383             return;
2384         }
2385 
2386         AcpiOsPrintf ("\n");
2387         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2388             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
2389         if (ACPI_FAILURE (Status))
2390         {
2391             return;
2392         }
2393 
2394         /* Point to next subtable (each subtable is of fixed length) */
2395 
2396         Offset += sizeof (ACPI_MCFG_ALLOCATION);
2397         SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
2398             sizeof (ACPI_MCFG_ALLOCATION));
2399     }
2400 }
2401 
2402 
2403 /*******************************************************************************
2404  *
2405  * FUNCTION:    AcpiDmDumpMpst
2406  *
2407  * PARAMETERS:  Table               - A MPST Table
2408  *
2409  * RETURN:      None
2410  *
2411  * DESCRIPTION: Format the contents of a MPST table
2412  *
2413  ******************************************************************************/
2414 
2415 void
2416 AcpiDmDumpMpst (
2417     ACPI_TABLE_HEADER       *Table)
2418 {
2419     ACPI_STATUS             Status;
2420     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
2421     ACPI_MPST_POWER_NODE    *SubTable0;
2422     ACPI_MPST_POWER_STATE   *SubTable0A;
2423     ACPI_MPST_COMPONENT     *SubTable0B;
2424     ACPI_MPST_DATA_HDR      *SubTable1;
2425     ACPI_MPST_POWER_DATA    *SubTable2;
2426     UINT16                  SubtableCount;
2427     UINT32                  PowerStateCount;
2428     UINT32                  ComponentCount;
2429 
2430 
2431     /* Main table */
2432 
2433     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
2434     if (ACPI_FAILURE (Status))
2435     {
2436         return;
2437     }
2438 
2439     /* Subtable: Memory Power Node(s) */
2440 
2441     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
2442     SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
2443 
2444     while ((Offset < Table->Length) && SubtableCount)
2445     {
2446         AcpiOsPrintf ("\n");
2447         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
2448             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
2449         if (ACPI_FAILURE (Status))
2450         {
2451             return;
2452         }
2453 
2454         /* Extract the sub-subtable counts */
2455 
2456         PowerStateCount = SubTable0->NumPowerStates;
2457         ComponentCount = SubTable0->NumPhysicalComponents;
2458         Offset += sizeof (ACPI_MPST_POWER_NODE);
2459 
2460         /* Sub-subtables - Memory Power State Structure(s) */
2461 
2462         SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
2463             sizeof (ACPI_MPST_POWER_NODE));
2464 
2465         while (PowerStateCount)
2466         {
2467             AcpiOsPrintf ("\n");
2468             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
2469                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
2470             if (ACPI_FAILURE (Status))
2471             {
2472                 return;
2473             }
2474 
2475             SubTable0A++;
2476             PowerStateCount--;
2477             Offset += sizeof (ACPI_MPST_POWER_STATE);
2478        }
2479 
2480         /* Sub-subtables - Physical Component ID Structure(s) */
2481 
2482         SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
2483 
2484         if (ComponentCount)
2485         {
2486             AcpiOsPrintf ("\n");
2487         }
2488 
2489         while (ComponentCount)
2490         {
2491             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
2492                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
2493             if (ACPI_FAILURE (Status))
2494             {
2495                 return;
2496             }
2497 
2498             SubTable0B++;
2499             ComponentCount--;
2500             Offset += sizeof (ACPI_MPST_COMPONENT);
2501         }
2502 
2503         /* Point to next Memory Power Node subtable */
2504 
2505         SubtableCount--;
2506         SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
2507             sizeof (ACPI_MPST_POWER_NODE) +
2508             (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
2509             (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
2510     }
2511 
2512     /* Subtable: Count of Memory Power State Characteristic structures */
2513 
2514     AcpiOsPrintf ("\n");
2515     SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
2516     Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
2517         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
2518     if (ACPI_FAILURE (Status))
2519     {
2520         return;
2521     }
2522 
2523     SubtableCount = SubTable1->CharacteristicsCount;
2524     Offset += sizeof (ACPI_MPST_DATA_HDR);
2525 
2526     /* Subtable: Memory Power State Characteristics structure(s) */
2527 
2528     SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1,
2529         sizeof (ACPI_MPST_DATA_HDR));
2530 
2531     while ((Offset < Table->Length) && SubtableCount)
2532     {
2533         AcpiOsPrintf ("\n");
2534         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
2535             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
2536         if (ACPI_FAILURE (Status))
2537         {
2538             return;
2539         }
2540 
2541         SubTable2++;
2542         SubtableCount--;
2543         Offset += sizeof (ACPI_MPST_POWER_DATA);
2544     }
2545 }
2546 
2547 
2548 /*******************************************************************************
2549  *
2550  * FUNCTION:    AcpiDmDumpMsct
2551  *
2552  * PARAMETERS:  Table               - A MSCT table
2553  *
2554  * RETURN:      None
2555  *
2556  * DESCRIPTION: Format the contents of a MSCT
2557  *
2558  ******************************************************************************/
2559 
2560 void
2561 AcpiDmDumpMsct (
2562     ACPI_TABLE_HEADER       *Table)
2563 {
2564     ACPI_STATUS             Status;
2565     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
2566     ACPI_MSCT_PROXIMITY     *SubTable;
2567 
2568 
2569     /* Main table */
2570 
2571     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
2572     if (ACPI_FAILURE (Status))
2573     {
2574         return;
2575     }
2576 
2577     /* Subtables */
2578 
2579     SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
2580     while (Offset < Table->Length)
2581     {
2582         /* Common subtable header */
2583 
2584         AcpiOsPrintf ("\n");
2585         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2586             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
2587         if (ACPI_FAILURE (Status))
2588         {
2589             return;
2590         }
2591 
2592         /* Point to next subtable */
2593 
2594         Offset += sizeof (ACPI_MSCT_PROXIMITY);
2595         SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable,
2596             sizeof (ACPI_MSCT_PROXIMITY));
2597     }
2598 }
2599 
2600 
2601 /*******************************************************************************
2602  *
2603  * FUNCTION:    AcpiDmDumpMtmr
2604  *
2605  * PARAMETERS:  Table               - A MTMR table
2606  *
2607  * RETURN:      None
2608  *
2609  * DESCRIPTION: Format the contents of a MTMR
2610  *
2611  ******************************************************************************/
2612 
2613 void
2614 AcpiDmDumpMtmr (
2615     ACPI_TABLE_HEADER       *Table)
2616 {
2617     ACPI_STATUS             Status;
2618     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
2619     ACPI_MTMR_ENTRY         *SubTable;
2620 
2621 
2622     /* Main table */
2623 
2624     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
2625     if (ACPI_FAILURE (Status))
2626     {
2627         return;
2628     }
2629 
2630     /* Subtables */
2631 
2632     SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
2633     while (Offset < Table->Length)
2634     {
2635         /* Common subtable header */
2636 
2637         AcpiOsPrintf ("\n");
2638         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2639             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
2640         if (ACPI_FAILURE (Status))
2641         {
2642             return;
2643         }
2644 
2645         /* Point to next subtable */
2646 
2647         Offset += sizeof (ACPI_MTMR_ENTRY);
2648         SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable,
2649             sizeof (ACPI_MTMR_ENTRY));
2650     }
2651 }
2652 
2653 
2654 /*******************************************************************************
2655  *
2656  * FUNCTION:    AcpiDmDumpNfit
2657  *
2658  * PARAMETERS:  Table               - A NFIT table
2659  *
2660  * RETURN:      None
2661  *
2662  * DESCRIPTION: Format the contents of an NFIT.
2663  *
2664  ******************************************************************************/
2665 
2666 void
2667 AcpiDmDumpNfit (
2668     ACPI_TABLE_HEADER       *Table)
2669 {
2670     ACPI_STATUS             Status;
2671     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
2672     UINT32                  FieldOffset = 0;
2673     UINT32                  Length;
2674     ACPI_NFIT_HEADER        *SubTable;
2675     ACPI_DMTABLE_INFO       *InfoTable;
2676     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
2677     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
2678     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
2679     UINT32                  i;
2680 
2681 
2682     /* Main table */
2683 
2684     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
2685     if (ACPI_FAILURE (Status))
2686     {
2687         return;
2688     }
2689 
2690     /* Subtables */
2691 
2692     SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
2693     while (Offset < Table->Length)
2694     {
2695         /* NFIT subtable header */
2696 
2697         AcpiOsPrintf ("\n");
2698         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2699             SubTable->Length, AcpiDmTableInfoNfitHdr);
2700         if (ACPI_FAILURE (Status))
2701         {
2702             return;
2703         }
2704 
2705         switch (SubTable->Type)
2706         {
2707         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
2708 
2709             InfoTable = AcpiDmTableInfoNfit0;
2710             break;
2711 
2712         case ACPI_NFIT_TYPE_MEMORY_MAP:
2713 
2714             InfoTable = AcpiDmTableInfoNfit1;
2715             break;
2716 
2717         case ACPI_NFIT_TYPE_INTERLEAVE:
2718 
2719             /* Has a variable number of 32-bit values at the end */
2720 
2721             InfoTable = AcpiDmTableInfoNfit2;
2722             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable);
2723             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
2724             break;
2725 
2726         case ACPI_NFIT_TYPE_SMBIOS:
2727 
2728             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable);
2729             InfoTable = AcpiDmTableInfoNfit3;
2730             break;
2731 
2732         case ACPI_NFIT_TYPE_CONTROL_REGION:
2733 
2734             InfoTable = AcpiDmTableInfoNfit4;
2735             break;
2736 
2737         case ACPI_NFIT_TYPE_DATA_REGION:
2738 
2739             InfoTable = AcpiDmTableInfoNfit5;
2740             break;
2741 
2742         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
2743 
2744             /* Has a variable number of 64-bit addresses at the end */
2745 
2746             InfoTable = AcpiDmTableInfoNfit6;
2747             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable);
2748             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
2749             break;
2750 
2751         default:
2752             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
2753                 SubTable->Type);
2754 
2755             /* Attempt to continue */
2756 
2757             if (!SubTable->Length)
2758             {
2759                 AcpiOsPrintf ("Invalid zero length subtable\n");
2760                 return;
2761             }
2762             goto NextSubTable;
2763         }
2764 
2765         AcpiOsPrintf ("\n");
2766         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2767             SubTable->Length, InfoTable);
2768         if (ACPI_FAILURE (Status))
2769         {
2770             return;
2771         }
2772 
2773         /* Per-subtable variable-length fields */
2774 
2775         switch (SubTable->Type)
2776         {
2777         case ACPI_NFIT_TYPE_INTERLEAVE:
2778 
2779             for (i = 0; i < Interleave->LineCount; i++)
2780             {
2781                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
2782                     &Interleave->LineOffset[i],
2783                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
2784                 if (ACPI_FAILURE (Status))
2785                 {
2786                     return;
2787                 }
2788 
2789                 FieldOffset += sizeof (UINT32);
2790             }
2791             break;
2792 
2793         case ACPI_NFIT_TYPE_SMBIOS:
2794 
2795             Length = SubTable->Length -
2796                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
2797 
2798             if (Length)
2799             {
2800                 Status = AcpiDmDumpTable (Table->Length,
2801                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
2802                     SmbiosInfo,
2803                     Length, AcpiDmTableInfoNfit3a);
2804                 if (ACPI_FAILURE (Status))
2805                 {
2806                     return;
2807                 }
2808             }
2809 
2810             break;
2811 
2812         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
2813 
2814             for (i = 0; i < Hint->HintCount; i++)
2815             {
2816                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
2817                     &Hint->HintAddress[i],
2818                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
2819                 if (ACPI_FAILURE (Status))
2820                 {
2821                     return;
2822                 }
2823 
2824                 FieldOffset += sizeof (UINT64);
2825             }
2826             break;
2827 
2828         default:
2829             break;
2830         }
2831 
2832 NextSubTable:
2833         /* Point to next subtable */
2834 
2835         Offset += SubTable->Length;
2836         SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length);
2837     }
2838 }
2839 
2840 
2841 /*******************************************************************************
2842  *
2843  * FUNCTION:    AcpiDmDumpPcct
2844  *
2845  * PARAMETERS:  Table               - A PCCT table
2846  *
2847  * RETURN:      None
2848  *
2849  * DESCRIPTION: Format the contents of a PCCT. This table type consists
2850  *              of an open-ended number of subtables.
2851  *
2852  ******************************************************************************/
2853 
2854 void
2855 AcpiDmDumpPcct (
2856     ACPI_TABLE_HEADER       *Table)
2857 {
2858     ACPI_STATUS             Status;
2859     ACPI_PCCT_SUBSPACE      *SubTable;
2860     ACPI_DMTABLE_INFO       *InfoTable;
2861     UINT32                  Length = Table->Length;
2862     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
2863 
2864 
2865     /* Main table */
2866 
2867     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
2868     if (ACPI_FAILURE (Status))
2869     {
2870         return;
2871     }
2872 
2873     /* Subtables */
2874 
2875     SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
2876     while (Offset < Table->Length)
2877     {
2878         /* Common subtable header */
2879 
2880         AcpiOsPrintf ("\n");
2881         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2882             SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
2883         if (ACPI_FAILURE (Status))
2884         {
2885             return;
2886         }
2887 
2888         switch (SubTable->Header.Type)
2889         {
2890         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
2891 
2892             InfoTable = AcpiDmTableInfoPcct0;
2893             break;
2894 
2895         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
2896 
2897             InfoTable = AcpiDmTableInfoPcct1;
2898             break;
2899 
2900         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
2901 
2902             InfoTable = AcpiDmTableInfoPcct2;
2903             break;
2904 
2905         default:
2906 
2907             AcpiOsPrintf (
2908                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2909                 SubTable->Header.Type);
2910             return;
2911         }
2912 
2913         AcpiOsPrintf ("\n");
2914         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2915             SubTable->Header.Length, InfoTable);
2916         if (ACPI_FAILURE (Status))
2917         {
2918             return;
2919         }
2920 
2921         /* Point to next subtable */
2922 
2923         Offset += SubTable->Header.Length;
2924         SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
2925             SubTable->Header.Length);
2926     }
2927 }
2928 
2929 
2930 /*******************************************************************************
2931  *
2932  * FUNCTION:    AcpiDmDumpPmtt
2933  *
2934  * PARAMETERS:  Table               - A PMTT table
2935  *
2936  * RETURN:      None
2937  *
2938  * DESCRIPTION: Format the contents of a PMTT. This table type consists
2939  *              of an open-ended number of subtables.
2940  *
2941  ******************************************************************************/
2942 
2943 void
2944 AcpiDmDumpPmtt (
2945     ACPI_TABLE_HEADER       *Table)
2946 {
2947     ACPI_STATUS             Status;
2948     ACPI_PMTT_HEADER        *SubTable;
2949     ACPI_PMTT_HEADER        *MemSubTable;
2950     ACPI_PMTT_HEADER        *DimmSubTable;
2951     ACPI_PMTT_DOMAIN        *DomainArray;
2952     UINT32                  Length = Table->Length;
2953     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
2954     UINT32                  MemOffset;
2955     UINT32                  DimmOffset;
2956     UINT32                  DomainOffset;
2957     UINT32                  DomainCount;
2958 
2959 
2960     /* Main table */
2961 
2962     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2963     if (ACPI_FAILURE (Status))
2964     {
2965         return;
2966     }
2967 
2968     /* Subtables */
2969 
2970     SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2971     while (Offset < Table->Length)
2972     {
2973         /* Common subtable header */
2974 
2975         AcpiOsPrintf ("\n");
2976         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2977             SubTable->Length, AcpiDmTableInfoPmttHdr);
2978         if (ACPI_FAILURE (Status))
2979         {
2980             return;
2981         }
2982 
2983         /* Only Socket subtables are expected at this level */
2984 
2985         if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
2986         {
2987             AcpiOsPrintf (
2988                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2989                 SubTable->Type);
2990             return;
2991         }
2992 
2993         /* Dump the fixed-length portion of the subtable */
2994 
2995         Status = AcpiDmDumpTable (Length, Offset, SubTable,
2996             SubTable->Length, AcpiDmTableInfoPmtt0);
2997         if (ACPI_FAILURE (Status))
2998         {
2999             return;
3000         }
3001 
3002         /* Walk the memory controller subtables */
3003 
3004         MemOffset = sizeof (ACPI_PMTT_SOCKET);
3005         MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
3006             sizeof (ACPI_PMTT_SOCKET));
3007 
3008         while (((Offset + MemOffset) < Table->Length) &&
3009             (MemOffset < SubTable->Length))
3010         {
3011             /* Common subtable header */
3012 
3013             AcpiOsPrintf ("\n");
3014             Status = AcpiDmDumpTable (Length,
3015                 Offset + MemOffset, MemSubTable,
3016                 MemSubTable->Length, AcpiDmTableInfoPmttHdr);
3017             if (ACPI_FAILURE (Status))
3018             {
3019                 return;
3020             }
3021 
3022             /* Only memory controller subtables are expected at this level */
3023 
3024             if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
3025             {
3026                 AcpiOsPrintf (
3027                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3028                     MemSubTable->Type);
3029                 return;
3030             }
3031 
3032             /* Dump the fixed-length portion of the controller subtable */
3033 
3034             Status = AcpiDmDumpTable (Length,
3035                 Offset + MemOffset, MemSubTable,
3036                 MemSubTable->Length, AcpiDmTableInfoPmtt1);
3037             if (ACPI_FAILURE (Status))
3038             {
3039                 return;
3040             }
3041 
3042             /* Walk the variable count of proximity domains */
3043 
3044             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
3045             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
3046             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
3047                 sizeof (ACPI_PMTT_CONTROLLER));
3048 
3049             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
3050                 ((MemOffset + DomainOffset) < SubTable->Length) &&
3051                 DomainCount)
3052             {
3053                 Status = AcpiDmDumpTable (Length,
3054                     Offset + MemOffset + DomainOffset, DomainArray,
3055                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
3056                 if (ACPI_FAILURE (Status))
3057                 {
3058                     return;
3059                 }
3060 
3061                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
3062                 DomainArray++;
3063                 DomainCount--;
3064             }
3065 
3066             if (DomainCount)
3067             {
3068                 AcpiOsPrintf (
3069                     "\n**** DomainCount exceeds subtable length\n\n");
3070             }
3071 
3072             /* Walk the physical component (DIMM) subtables */
3073 
3074             DimmOffset = DomainOffset;
3075             DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
3076                 DomainOffset);
3077 
3078             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
3079                 (DimmOffset < MemSubTable->Length))
3080             {
3081                 /* Common subtable header */
3082 
3083                 AcpiOsPrintf ("\n");
3084                 Status = AcpiDmDumpTable (Length,
3085                     Offset + MemOffset + DimmOffset, DimmSubTable,
3086                     DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
3087                 if (ACPI_FAILURE (Status))
3088                 {
3089                     return;
3090                 }
3091 
3092                 /* Only DIMM subtables are expected at this level */
3093 
3094                 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
3095                 {
3096                     AcpiOsPrintf (
3097                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3098                         DimmSubTable->Type);
3099                     return;
3100                 }
3101 
3102                 /* Dump the fixed-length DIMM subtable */
3103 
3104                 Status = AcpiDmDumpTable (Length,
3105                     Offset + MemOffset + DimmOffset, DimmSubTable,
3106                     DimmSubTable->Length, AcpiDmTableInfoPmtt2);
3107                 if (ACPI_FAILURE (Status))
3108                 {
3109                     return;
3110                 }
3111 
3112                 /* Point to next DIMM subtable */
3113 
3114                 DimmOffset += DimmSubTable->Length;
3115                 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3116                     DimmSubTable, DimmSubTable->Length);
3117             }
3118 
3119             /* Point to next Controller subtable */
3120 
3121             MemOffset += MemSubTable->Length;
3122             MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3123                 MemSubTable, MemSubTable->Length);
3124         }
3125 
3126         /* Point to next Socket subtable */
3127 
3128         Offset += SubTable->Length;
3129         SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3130             SubTable, SubTable->Length);
3131     }
3132 }
3133 
3134 
3135 /*******************************************************************************
3136  *
3137  * FUNCTION:    AcpiDmDumpS3pt
3138  *
3139  * PARAMETERS:  Table               - A S3PT table
3140  *
3141  * RETURN:      Length of the table
3142  *
3143  * DESCRIPTION: Format the contents of a S3PT
3144  *
3145  ******************************************************************************/
3146 
3147 UINT32
3148 AcpiDmDumpS3pt (
3149     ACPI_TABLE_HEADER       *Tables)
3150 {
3151     ACPI_STATUS             Status;
3152     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
3153     ACPI_FPDT_HEADER        *SubTable;
3154     ACPI_DMTABLE_INFO       *InfoTable;
3155     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
3156 
3157 
3158     /* Main table */
3159 
3160     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
3161     if (ACPI_FAILURE (Status))
3162     {
3163         return 0;
3164     }
3165 
3166     SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
3167     while (Offset < S3ptTable->Length)
3168     {
3169         /* Common subtable header */
3170 
3171         AcpiOsPrintf ("\n");
3172         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
3173             SubTable->Length, AcpiDmTableInfoS3ptHdr);
3174         if (ACPI_FAILURE (Status))
3175         {
3176             return 0;
3177         }
3178 
3179         switch (SubTable->Type)
3180         {
3181         case ACPI_S3PT_TYPE_RESUME:
3182 
3183             InfoTable = AcpiDmTableInfoS3pt0;
3184             break;
3185 
3186         case ACPI_S3PT_TYPE_SUSPEND:
3187 
3188             InfoTable = AcpiDmTableInfoS3pt1;
3189             break;
3190 
3191         default:
3192 
3193             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
3194                 SubTable->Type);
3195 
3196             /* Attempt to continue */
3197 
3198             if (!SubTable->Length)
3199             {
3200                 AcpiOsPrintf ("Invalid zero length subtable\n");
3201                 return 0;
3202             }
3203             goto NextSubTable;
3204         }
3205 
3206         AcpiOsPrintf ("\n");
3207         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
3208             SubTable->Length, InfoTable);
3209         if (ACPI_FAILURE (Status))
3210         {
3211             return 0;
3212         }
3213 
3214 NextSubTable:
3215         /* Point to next subtable */
3216 
3217         Offset += SubTable->Length;
3218         SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
3219     }
3220 
3221     return (S3ptTable->Length);
3222 }
3223 
3224 
3225 /*******************************************************************************
3226  *
3227  * FUNCTION:    AcpiDmDumpSlic
3228  *
3229  * PARAMETERS:  Table               - A SLIC table
3230  *
3231  * RETURN:      None
3232  *
3233  * DESCRIPTION: Format the contents of a SLIC
3234  *
3235  ******************************************************************************/
3236 
3237 void
3238 AcpiDmDumpSlic (
3239     ACPI_TABLE_HEADER       *Table)
3240 {
3241 
3242     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
3243         Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
3244 }
3245 
3246 
3247 /*******************************************************************************
3248  *
3249  * FUNCTION:    AcpiDmDumpSlit
3250  *
3251  * PARAMETERS:  Table               - An SLIT
3252  *
3253  * RETURN:      None
3254  *
3255  * DESCRIPTION: Format the contents of a SLIT
3256  *
3257  ******************************************************************************/
3258 
3259 void
3260 AcpiDmDumpSlit (
3261     ACPI_TABLE_HEADER       *Table)
3262 {
3263     ACPI_STATUS             Status;
3264     UINT32                  Offset;
3265     UINT8                   *Row;
3266     UINT32                  Localities;
3267     UINT32                  i;
3268     UINT32                  j;
3269 
3270 
3271     /* Main table */
3272 
3273     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
3274     if (ACPI_FAILURE (Status))
3275     {
3276         return;
3277     }
3278 
3279     /* Display the Locality NxN Matrix */
3280 
3281     Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
3282     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
3283     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
3284 
3285     for (i = 0; i < Localities; i++)
3286     {
3287         /* Display one row of the matrix */
3288 
3289         AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
3290         for  (j = 0; j < Localities; j++)
3291         {
3292             /* Check for beyond EOT */
3293 
3294             if (Offset >= Table->Length)
3295             {
3296                 AcpiOsPrintf (
3297                     "\n**** Not enough room in table for all localities\n");
3298                 return;
3299             }
3300 
3301             AcpiOsPrintf ("%2.2X", Row[j]);
3302             Offset++;
3303 
3304             /* Display up to 16 bytes per output row */
3305 
3306             if ((j+1) < Localities)
3307             {
3308                 AcpiOsPrintf (" ");
3309 
3310                 if (j && (((j+1) % 16) == 0))
3311                 {
3312                     AcpiOsPrintf ("\\\n"); /* With line continuation char */
3313                     AcpiDmLineHeader (Offset, 0, NULL);
3314                 }
3315             }
3316         }
3317 
3318         /* Point to next row */
3319 
3320         AcpiOsPrintf ("\n");
3321         Row += Localities;
3322     }
3323 }
3324 
3325 
3326 /*******************************************************************************
3327  *
3328  * FUNCTION:    AcpiDmDumpSrat
3329  *
3330  * PARAMETERS:  Table               - A SRAT table
3331  *
3332  * RETURN:      None
3333  *
3334  * DESCRIPTION: Format the contents of a SRAT
3335  *
3336  ******************************************************************************/
3337 
3338 void
3339 AcpiDmDumpSrat (
3340     ACPI_TABLE_HEADER       *Table)
3341 {
3342     ACPI_STATUS             Status;
3343     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
3344     ACPI_SUBTABLE_HEADER    *SubTable;
3345     ACPI_DMTABLE_INFO       *InfoTable;
3346 
3347 
3348     /* Main table */
3349 
3350     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
3351     if (ACPI_FAILURE (Status))
3352     {
3353         return;
3354     }
3355 
3356     /* Subtables */
3357 
3358     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
3359     while (Offset < Table->Length)
3360     {
3361         /* Common subtable header */
3362 
3363         AcpiOsPrintf ("\n");
3364         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3365             SubTable->Length, AcpiDmTableInfoSratHdr);
3366         if (ACPI_FAILURE (Status))
3367         {
3368             return;
3369         }
3370 
3371         switch (SubTable->Type)
3372         {
3373         case ACPI_SRAT_TYPE_CPU_AFFINITY:
3374 
3375             InfoTable = AcpiDmTableInfoSrat0;
3376             break;
3377 
3378         case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
3379 
3380             InfoTable = AcpiDmTableInfoSrat1;
3381             break;
3382 
3383         case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
3384 
3385             InfoTable = AcpiDmTableInfoSrat2;
3386             break;
3387 
3388         case ACPI_SRAT_TYPE_GICC_AFFINITY:
3389 
3390             InfoTable = AcpiDmTableInfoSrat3;
3391             break;
3392 
3393         default:
3394             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
3395                 SubTable->Type);
3396 
3397             /* Attempt to continue */
3398 
3399             if (!SubTable->Length)
3400             {
3401                 AcpiOsPrintf ("Invalid zero length subtable\n");
3402                 return;
3403             }
3404             goto NextSubTable;
3405         }
3406 
3407         AcpiOsPrintf ("\n");
3408         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3409             SubTable->Length, InfoTable);
3410         if (ACPI_FAILURE (Status))
3411         {
3412             return;
3413         }
3414 
3415 NextSubTable:
3416         /* Point to next subtable */
3417 
3418         Offset += SubTable->Length;
3419         SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
3420             SubTable->Length);
3421     }
3422 }
3423 
3424 
3425 /*******************************************************************************
3426  *
3427  * FUNCTION:    AcpiDmDumpStao
3428  *
3429  * PARAMETERS:  Table               - A STAO table
3430  *
3431  * RETURN:      None
3432  *
3433  * DESCRIPTION: Format the contents of a STAO. This is a variable-length
3434  *              table that contains an open-ended number of ASCII strings
3435  *              at the end of the table.
3436  *
3437  ******************************************************************************/
3438 
3439 void
3440 AcpiDmDumpStao (
3441     ACPI_TABLE_HEADER       *Table)
3442 {
3443     ACPI_STATUS             Status;
3444     char                    *Namepath;
3445     UINT32                  Length = Table->Length;
3446     UINT32                  StringLength;
3447     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
3448 
3449 
3450     /* Main table */
3451 
3452     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
3453     if (ACPI_FAILURE (Status))
3454     {
3455         return;
3456     }
3457 
3458     /* The rest of the table consists of Namepath strings */
3459 
3460     while (Offset < Table->Length)
3461     {
3462         Namepath = ACPI_ADD_PTR (char, Table, Offset);
3463         StringLength = strlen (Namepath) + 1;
3464 
3465         AcpiDmLineHeader (Offset, StringLength, "Namestring");
3466         AcpiOsPrintf ("\"%s\"\n", Namepath);
3467 
3468         /* Point to next namepath */
3469 
3470         Offset += StringLength;
3471     }
3472 }
3473 
3474 
3475 /*******************************************************************************
3476  *
3477  * FUNCTION:    AcpiDmDumpTcpa
3478  *
3479  * PARAMETERS:  Table               - A TCPA table
3480  *
3481  * RETURN:      None
3482  *
3483  * DESCRIPTION: Format the contents of a TCPA.
3484  *
3485  * NOTE:        There are two versions of the table with the same signature:
3486  *              the client version and the server version. The common
3487  *              PlatformClass field is used to differentiate the two types of
3488  *              tables.
3489  *
3490  ******************************************************************************/
3491 
3492 void
3493 AcpiDmDumpTcpa (
3494     ACPI_TABLE_HEADER       *Table)
3495 {
3496     UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);
3497     ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (
3498                                 ACPI_TABLE_TCPA_HDR, Table);
3499     ACPI_TABLE_TCPA_HDR     *SubTable = ACPI_ADD_PTR (
3500                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
3501     ACPI_STATUS             Status;
3502 
3503 
3504     /* Main table */
3505 
3506     Status = AcpiDmDumpTable (Table->Length, 0, Table,
3507         0, AcpiDmTableInfoTcpaHdr);
3508     if (ACPI_FAILURE (Status))
3509     {
3510         return;
3511     }
3512 
3513     /*
3514      * Examine the PlatformClass field to determine the table type.
3515      * Either a client or server table. Only one.
3516      */
3517     switch (CommonHeader->PlatformClass)
3518     {
3519     case ACPI_TCPA_CLIENT_TABLE:
3520 
3521         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3522             Table->Length - Offset, AcpiDmTableInfoTcpaClient);
3523         break;
3524 
3525     case ACPI_TCPA_SERVER_TABLE:
3526 
3527         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3528             Table->Length - Offset, AcpiDmTableInfoTcpaServer);
3529         break;
3530 
3531     default:
3532 
3533         AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
3534             CommonHeader->PlatformClass);
3535         Status = AE_ERROR;
3536         break;
3537     }
3538 
3539     if (ACPI_FAILURE (Status))
3540     {
3541         AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
3542     }
3543 }
3544 
3545 
3546 /*******************************************************************************
3547  *
3548  * FUNCTION:    AcpiDmDumpVrtc
3549  *
3550  * PARAMETERS:  Table               - A VRTC table
3551  *
3552  * RETURN:      None
3553  *
3554  * DESCRIPTION: Format the contents of a VRTC
3555  *
3556  ******************************************************************************/
3557 
3558 void
3559 AcpiDmDumpVrtc (
3560     ACPI_TABLE_HEADER       *Table)
3561 {
3562     ACPI_STATUS             Status;
3563     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
3564     ACPI_VRTC_ENTRY         *SubTable;
3565 
3566 
3567     /* Main table */
3568 
3569     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
3570     if (ACPI_FAILURE (Status))
3571     {
3572         return;
3573     }
3574 
3575     /* Subtables */
3576 
3577     SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
3578     while (Offset < Table->Length)
3579     {
3580         /* Common subtable header */
3581 
3582         AcpiOsPrintf ("\n");
3583         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3584             sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
3585         if (ACPI_FAILURE (Status))
3586         {
3587             return;
3588         }
3589 
3590         /* Point to next subtable */
3591 
3592         Offset += sizeof (ACPI_VRTC_ENTRY);
3593         SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable,
3594             sizeof (ACPI_VRTC_ENTRY));
3595     }
3596 }
3597 
3598 
3599 /*******************************************************************************
3600  *
3601  * FUNCTION:    AcpiDmDumpWdat
3602  *
3603  * PARAMETERS:  Table               - A WDAT table
3604  *
3605  * RETURN:      None
3606  *
3607  * DESCRIPTION: Format the contents of a WDAT
3608  *
3609  ******************************************************************************/
3610 
3611 void
3612 AcpiDmDumpWdat (
3613     ACPI_TABLE_HEADER       *Table)
3614 {
3615     ACPI_STATUS             Status;
3616     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
3617     ACPI_WDAT_ENTRY         *SubTable;
3618 
3619 
3620     /* Main table */
3621 
3622     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
3623     if (ACPI_FAILURE (Status))
3624     {
3625         return;
3626     }
3627 
3628     /* Subtables */
3629 
3630     SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
3631     while (Offset < Table->Length)
3632     {
3633         /* Common subtable header */
3634 
3635         AcpiOsPrintf ("\n");
3636         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3637             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
3638         if (ACPI_FAILURE (Status))
3639         {
3640             return;
3641         }
3642 
3643         /* Point to next subtable */
3644 
3645         Offset += sizeof (ACPI_WDAT_ENTRY);
3646         SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable,
3647             sizeof (ACPI_WDAT_ENTRY));
3648     }
3649 }
3650 
3651 
3652 /*******************************************************************************
3653  *
3654  * FUNCTION:    AcpiDmDumpWpbt
3655  *
3656  * PARAMETERS:  Table               - A WPBT table
3657  *
3658  * RETURN:      None
3659  *
3660  * DESCRIPTION: Format the contents of a WPBT. This table type consists
3661  *              of an open-ended arguments buffer at the end of the table.
3662  *
3663  ******************************************************************************/
3664 
3665 void
3666 AcpiDmDumpWpbt (
3667     ACPI_TABLE_HEADER       *Table)
3668 {
3669     ACPI_STATUS             Status;
3670     ACPI_TABLE_WPBT         *SubTable;
3671     UINT32                  Length = Table->Length;
3672     UINT16                  ArgumentsLength;
3673 
3674 
3675     /* Dump the main table */
3676 
3677     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
3678     if (ACPI_FAILURE (Status))
3679     {
3680         return;
3681     }
3682 
3683     /* Extract the arguments buffer length from the main table */
3684 
3685     SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
3686     ArgumentsLength = SubTable->ArgumentsLength;
3687 
3688     /* Dump the arguments buffer */
3689 
3690     (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
3691         AcpiDmTableInfoWpbt0);
3692 }
3693