xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump2.c (revision bc7512cc58af2e8bbe5bbf5ca0059b1daa1da897)
1 /******************************************************************************
2  *
3  * Module Name: dmtbdump2 - Dump ACPI data tables that contain no AML code
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2022, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acdisasm.h>
155 #include <contrib/dev/acpica/include/actables.h>
156 #include <contrib/dev/acpica/compiler/aslcompiler.h>
157 
158 /* This module used for application-level code only */
159 
160 #define _COMPONENT          ACPI_CA_DISASSEMBLER
161         ACPI_MODULE_NAME    ("dmtbdump2")
162 
163 
164 /*******************************************************************************
165  *
166  * FUNCTION:    AcpiDmDumpIort
167  *
168  * PARAMETERS:  Table               - A IORT table
169  *
170  * RETURN:      None
171  *
172  * DESCRIPTION: Format the contents of a IORT
173  *
174  ******************************************************************************/
175 
176 void
177 AcpiDmDumpIort (
178     ACPI_TABLE_HEADER       *Table)
179 {
180     ACPI_STATUS             Status;
181     ACPI_TABLE_IORT         *Iort;
182     ACPI_IORT_NODE          *IortNode;
183     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
184     ACPI_IORT_SMMU          *IortSmmu = NULL;
185     ACPI_IORT_RMR           *IortRmr = NULL;
186     UINT32                  Offset;
187     UINT32                  NodeOffset;
188     UINT32                  Length;
189     ACPI_DMTABLE_INFO       *InfoTable;
190     char                    *String;
191     UINT32                  i;
192     UINT32                  MappingByteLength;
193     UINT8                   Revision;
194 
195 
196     /* Main table */
197 
198     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
199     if (ACPI_FAILURE (Status))
200     {
201         return;
202     }
203 
204     Revision = Table->Revision;
205 
206     /* IORT Revisions E, E.a and E.c have known issues and are not supported */
207 
208     if (Revision == 1 || Revision == 2 || Revision == 4)
209     {
210         AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n",
211                       Revision);
212         return;
213     }
214 
215     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
216     Offset = sizeof (ACPI_TABLE_IORT);
217 
218     /* Dump the OptionalPadding (optional) */
219 
220     if (Iort->NodeOffset > Offset)
221     {
222         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
223             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
224         if (ACPI_FAILURE (Status))
225         {
226             return;
227         }
228     }
229 
230     Offset = Iort->NodeOffset;
231     while (Offset < Table->Length)
232     {
233         /* Common subtable header */
234 
235         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
236         AcpiOsPrintf ("\n");
237         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
238 
239         if (Revision == 0)
240         {
241             Status = AcpiDmDumpTable (Table->Length, Offset,
242                 IortNode, Length, AcpiDmTableInfoIortHdr);
243         }
244         else if (Revision >= 3)
245         {
246             Status = AcpiDmDumpTable (Table->Length, Offset,
247                 IortNode, Length, AcpiDmTableInfoIortHdr3);
248         }
249 
250         if (ACPI_FAILURE (Status))
251         {
252             return;
253         }
254 
255         NodeOffset = Length;
256 
257         switch (IortNode->Type)
258         {
259         case ACPI_IORT_NODE_ITS_GROUP:
260 
261             InfoTable = AcpiDmTableInfoIort0;
262             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
263             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
264             break;
265 
266         case ACPI_IORT_NODE_NAMED_COMPONENT:
267 
268             InfoTable = AcpiDmTableInfoIort1;
269             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
270             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
271             Length += strlen (String) + 1;
272             break;
273 
274         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
275 
276             InfoTable = AcpiDmTableInfoIort2;
277             Length = IortNode->Length - NodeOffset;
278             break;
279 
280         case ACPI_IORT_NODE_SMMU:
281 
282             InfoTable = AcpiDmTableInfoIort3;
283             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
284             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
285             break;
286 
287         case ACPI_IORT_NODE_SMMU_V3:
288 
289             InfoTable = AcpiDmTableInfoIort4;
290             Length = IortNode->Length - NodeOffset;
291             break;
292 
293         case ACPI_IORT_NODE_PMCG:
294 
295             InfoTable = AcpiDmTableInfoIort5;
296             Length = IortNode->Length - NodeOffset;
297             break;
298 
299         case ACPI_IORT_NODE_RMR:
300 
301             InfoTable = AcpiDmTableInfoIort6;
302             Length = IortNode->Length - NodeOffset;
303             IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset);
304             break;
305 
306         default:
307 
308             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
309                 IortNode->Type);
310 
311             /* Attempt to continue */
312 
313             if (!IortNode->Length)
314             {
315                 AcpiOsPrintf ("Invalid zero length IORT node\n");
316                 return;
317             }
318             goto NextSubtable;
319         }
320 
321         /* Dump the node subtable header */
322 
323         AcpiOsPrintf ("\n");
324         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
325             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
326             Length, InfoTable);
327         if (ACPI_FAILURE (Status))
328         {
329             return;
330         }
331 
332         NodeOffset += Length;
333 
334         /* Dump the node specific data */
335 
336         switch (IortNode->Type)
337         {
338         case ACPI_IORT_NODE_ITS_GROUP:
339 
340             /* Validate IortItsGroup to avoid compiler warnings */
341 
342             if (IortItsGroup)
343             {
344                 for (i = 0; i < IortItsGroup->ItsCount; i++)
345                 {
346                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
347                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
348                         4, AcpiDmTableInfoIort0a);
349                     if (ACPI_FAILURE (Status))
350                     {
351                         return;
352                     }
353 
354                     NodeOffset += 4;
355                 }
356             }
357             break;
358 
359         case ACPI_IORT_NODE_NAMED_COMPONENT:
360 
361             /* Dump the Padding (optional) */
362 
363             if (IortNode->Length > NodeOffset)
364             {
365                 MappingByteLength =
366                     IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
367                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
368                     Table, IortNode->Length - NodeOffset - MappingByteLength,
369                     AcpiDmTableInfoIort1a);
370                 if (ACPI_FAILURE (Status))
371                 {
372                     return;
373                 }
374             }
375             break;
376 
377         case ACPI_IORT_NODE_SMMU:
378 
379             AcpiOsPrintf ("\n");
380 
381             /* Validate IortSmmu to avoid compiler warnings */
382 
383             if (IortSmmu)
384             {
385                 Length = 2 * sizeof (UINT64);
386                 NodeOffset = IortSmmu->GlobalInterruptOffset;
387                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
388                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
389                     Length, AcpiDmTableInfoIort3a);
390                 if (ACPI_FAILURE (Status))
391                 {
392                     return;
393                 }
394 
395                 NodeOffset = IortSmmu->ContextInterruptOffset;
396                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
397                 {
398                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
399                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
400                         8, AcpiDmTableInfoIort3b);
401                     if (ACPI_FAILURE (Status))
402                     {
403                         return;
404                     }
405 
406                     NodeOffset += 8;
407                 }
408 
409                 NodeOffset = IortSmmu->PmuInterruptOffset;
410                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
411                 {
412                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
413                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
414                         8, AcpiDmTableInfoIort3c);
415                     if (ACPI_FAILURE (Status))
416                     {
417                         return;
418                     }
419 
420                     NodeOffset += 8;
421                 }
422             }
423             break;
424 
425         case ACPI_IORT_NODE_RMR:
426 
427             /* Validate IortRmr to avoid compiler warnings */
428             if (IortRmr)
429             {
430                 NodeOffset = IortRmr->RmrOffset;
431                 Length = sizeof (ACPI_IORT_RMR_DESC);
432                 for (i = 0; i < IortRmr->RmrCount; i++)
433                 {
434                     AcpiOsPrintf ("\n");
435                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
436                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
437                         Length, AcpiDmTableInfoIort6a);
438                     if (ACPI_FAILURE (Status))
439                     {
440                         return;
441                     }
442 
443                     NodeOffset += Length;
444                 }
445             }
446             break;
447 
448         default:
449 
450             break;
451         }
452 
453         /* Dump the ID mappings */
454 
455         NodeOffset = IortNode->MappingOffset;
456         for (i = 0; i < IortNode->MappingCount; i++)
457         {
458             AcpiOsPrintf ("\n");
459             Length = sizeof (ACPI_IORT_ID_MAPPING);
460             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
461                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
462                 Length, AcpiDmTableInfoIortMap);
463             if (ACPI_FAILURE (Status))
464             {
465                 return;
466             }
467 
468             NodeOffset += Length;
469         }
470 
471 NextSubtable:
472         /* Point to next node subtable */
473 
474         Offset += IortNode->Length;
475     }
476 }
477 
478 
479 /*******************************************************************************
480  *
481  * FUNCTION:    AcpiDmDumpIvrs
482  *
483  * PARAMETERS:  Table               - A IVRS table
484  *
485  * RETURN:      None
486  *
487  * DESCRIPTION: Format the contents of a IVRS. Notes:
488  *              The IVRS is essentially a flat table, with the following
489  *              structure:
490  *              <Main ACPI Table Header>
491  *              <Main subtable - virtualization info>
492  *              <IVHD>
493  *                  <Device Entries>
494  *              ...
495  *              <IVHD>
496  *                  <Device Entries>
497  *              <IVMD>
498  *              ...
499  *
500  ******************************************************************************/
501 
502 void
503 AcpiDmDumpIvrs (
504     ACPI_TABLE_HEADER       *Table)
505 {
506     ACPI_STATUS             Status;
507     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
508     UINT32                  EntryOffset;
509     UINT32                  EntryLength;
510     UINT32                  EntryType;
511     ACPI_IVRS_DEVICE_HID    *HidSubtable;
512     ACPI_IVRS_DE_HEADER     *DeviceEntry;
513     ACPI_IVRS_HEADER        *Subtable;
514     ACPI_DMTABLE_INFO       *InfoTable;
515 
516 
517     /* Main table */
518 
519     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
520     if (ACPI_FAILURE (Status))
521     {
522         return;
523     }
524 
525     /* Subtables */
526 
527     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
528 
529     while (Offset < Table->Length)
530     {
531         switch (Subtable->Type)
532         {
533         /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */
534 
535         case ACPI_IVRS_TYPE_HARDWARE1:
536 
537             AcpiOsPrintf ("\n");
538             InfoTable = AcpiDmTableInfoIvrsHware1;
539             break;
540 
541         /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */
542 
543         case ACPI_IVRS_TYPE_HARDWARE2:
544         case ACPI_IVRS_TYPE_HARDWARE3:
545 
546             AcpiOsPrintf ("\n");
547             InfoTable = AcpiDmTableInfoIvrsHware23;
548             break;
549 
550         /* Types 20h-22h, IVMD (I/O Virtualization Memory Definition Block) */
551 
552         case ACPI_IVRS_TYPE_MEMORY1:
553         case ACPI_IVRS_TYPE_MEMORY2:
554         case ACPI_IVRS_TYPE_MEMORY3:
555 
556             AcpiOsPrintf ("\n");
557             InfoTable = AcpiDmTableInfoIvrsMemory;
558             break;
559 
560         default:
561 
562             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
563                 Subtable->Type);
564 
565             /* Attempt to continue */
566 
567             if (!Subtable->Length)
568             {
569                 AcpiOsPrintf ("Invalid zero length subtable\n");
570                 return;
571             }
572             goto NextSubtable;
573         }
574 
575         /* Dump the subtable */
576 
577         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
578             Subtable->Length, InfoTable);
579         if (ACPI_FAILURE (Status))
580         {
581             return;
582         }
583 
584         /* The hardware subtables (IVHD) can contain multiple device entries */
585 
586         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
587             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 ||
588             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3)
589         {
590             if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
591             {
592                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
593                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
594                     sizeof (ACPI_IVRS_HARDWARE1));
595             }
596             else
597             {
598                 /* ACPI_IVRS_TYPE_HARDWARE2, HARDWARE3 subtable types */
599 
600                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
601                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
602                     sizeof (ACPI_IVRS_HARDWARE2));
603             }
604 
605             /* Process all of the Device Entries */
606 
607             while (EntryOffset < (Offset + Subtable->Length))
608             {
609                 AcpiOsPrintf ("\n");
610 
611                 /*
612                  * Upper 2 bits of Type encode the length of the device entry
613                  *
614                  * 00 = 4 byte
615                  * 01 = 8 byte
616                  * 1x = variable length
617                  */
618                 EntryType = DeviceEntry->Type;
619                 EntryLength = EntryType >> 6 == 1 ? 8 : 4;
620 
621                 switch (EntryType)
622                 {
623                 /* 4-byte device entries */
624 
625                 case ACPI_IVRS_TYPE_PAD4:
626                 case ACPI_IVRS_TYPE_ALL:
627                 case ACPI_IVRS_TYPE_SELECT:
628                 case ACPI_IVRS_TYPE_START:
629                 case ACPI_IVRS_TYPE_END:
630 
631                     InfoTable = AcpiDmTableInfoIvrs4;
632                     break;
633 
634                 /* 8-byte entries, type A */
635 
636                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
637                 case ACPI_IVRS_TYPE_ALIAS_START:
638 
639                     InfoTable = AcpiDmTableInfoIvrs8a;
640                     break;
641 
642                 /* 8-byte entries, type B */
643 
644                 case ACPI_IVRS_TYPE_PAD8:
645                 case ACPI_IVRS_TYPE_EXT_SELECT:
646                 case ACPI_IVRS_TYPE_EXT_START:
647 
648                     InfoTable = AcpiDmTableInfoIvrs8b;
649                     break;
650 
651                 /* 8-byte entries, type C */
652 
653                 case ACPI_IVRS_TYPE_SPECIAL:
654 
655                     InfoTable = AcpiDmTableInfoIvrs8c;
656                     break;
657 
658                 /* Variable-length entries */
659 
660                 case ACPI_IVRS_TYPE_HID:
661 
662                     EntryLength = 4;
663                     InfoTable = AcpiDmTableInfoIvrsHid;
664                     break;
665 
666                 default:
667                     InfoTable = AcpiDmTableInfoIvrs4;
668                     AcpiOsPrintf (
669                         "\n**** Unknown IVRS device entry type/length: "
670                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
671                         EntryType, EntryLength, EntryOffset);
672                     break;
673                 }
674 
675                 /* Dump the Device Entry */
676 
677                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
678                     DeviceEntry, EntryLength, InfoTable);
679                 if (ACPI_FAILURE (Status))
680                 {
681                     return;
682                 }
683 
684                 HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry);
685                 EntryOffset += EntryLength;
686                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, HidSubtable,
687                     EntryLength);
688 
689                 if (EntryType == ACPI_IVRS_TYPE_HID)
690                 {
691                     /*
692                      * Determine if the HID is an integer or a string.
693                      * An integer is defined to be 32 bits, with the upper 32 bits
694                      * set to zero. (from the ACPI Spec): "The HID can be a 32-bit
695                      * integer or a character string. If an integer, the lower
696                      * 4 bytes of the field contain the integer and the upper
697                      * 4 bytes are padded with 0".
698                      */
699                     if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid))
700                     {
701                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
702                             &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger);
703                     }
704                     else
705                     {
706                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
707                             &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString);
708                     }
709                     if (ACPI_FAILURE (Status))
710                     {
711                         return;
712                     }
713 
714                     EntryOffset += 8;
715 
716                     /*
717                      * Determine if the CID is an integer or a string. The format
718                      * of the CID is the same as the HID above. From ACPI Spec:
719                      * "If present, CID must be a single Compatible Device ID
720                      * following the same format as the HID field."
721                      */
722                     if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid))
723                     {
724                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
725                             &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger);
726                     }
727                     else
728                     {
729                         Status = AcpiDmDumpTable (Table->Length, EntryOffset,
730                             &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString);
731                     }
732                     if (ACPI_FAILURE (Status))
733                     {
734                         return;
735                     }
736 
737                     EntryOffset += 8;
738                     EntryLength = HidSubtable->UidLength;
739 
740                     if (EntryLength > ACPI_IVRS_UID_NOT_PRESENT)
741                     {
742                         /* Dump the UID based upon the UidType field (String or Integer) */
743 
744                         if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING)
745                         {
746                             Status = AcpiDmDumpTable (Table->Length, EntryOffset,
747                                 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString);
748                             if (ACPI_FAILURE (Status))
749                             {
750                                 return;
751                             }
752                         }
753                         else /* ACPI_IVRS_UID_IS_INTEGER */
754                         {
755                             Status = AcpiDmDumpTable (Table->Length, EntryOffset,
756                                 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger);
757                             if (ACPI_FAILURE (Status))
758                             {
759                                 return;
760                             }
761                         }
762                     }
763 
764                     EntryOffset += EntryLength+2;
765                     DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER,
766                         Table, EntryOffset);
767                 }
768             }
769         }
770 
771 NextSubtable:
772         /* Point to next subtable */
773 
774         Offset += Subtable->Length;
775         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
776     }
777 }
778 
779 
780 /*******************************************************************************
781  *
782  * FUNCTION:    AcpiDmDumpLpit
783  *
784  * PARAMETERS:  Table               - A LPIT table
785  *
786  * RETURN:      None
787  *
788  * DESCRIPTION: Format the contents of a LPIT. This table type consists
789  *              of an open-ended number of subtables. Note: There are no
790  *              entries in the main table. An LPIT consists of the table
791  *              header and then subtables only.
792  *
793  ******************************************************************************/
794 
795 void
796 AcpiDmDumpLpit (
797     ACPI_TABLE_HEADER       *Table)
798 {
799     ACPI_STATUS             Status;
800     ACPI_LPIT_HEADER        *Subtable;
801     UINT32                  Length = Table->Length;
802     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
803     ACPI_DMTABLE_INFO       *InfoTable;
804     UINT32                  SubtableLength;
805 
806 
807     /* Subtables */
808 
809     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
810     while (Offset < Table->Length)
811     {
812         /* Common subtable header */
813 
814         Status = AcpiDmDumpTable (Length, Offset, Subtable,
815             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
816         if (ACPI_FAILURE (Status))
817         {
818             return;
819         }
820 
821         switch (Subtable->Type)
822         {
823         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
824 
825             InfoTable = AcpiDmTableInfoLpit0;
826             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
827             break;
828 
829         default:
830 
831             /* Cannot continue on unknown type - no length */
832 
833             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
834                 Subtable->Type);
835             return;
836         }
837 
838         Status = AcpiDmDumpTable (Length, Offset, Subtable,
839             SubtableLength, InfoTable);
840         if (ACPI_FAILURE (Status))
841         {
842             return;
843         }
844 
845         AcpiOsPrintf ("\n");
846 
847         /* Point to next subtable */
848 
849         Offset += SubtableLength;
850         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
851     }
852 }
853 
854 
855 /*******************************************************************************
856  *
857  * FUNCTION:    AcpiDmDumpMadt
858  *
859  * PARAMETERS:  Table               - A MADT table
860  *
861  * RETURN:      None
862  *
863  * DESCRIPTION: Format the contents of a MADT. This table type consists
864  *              of an open-ended number of subtables.
865  *
866  ******************************************************************************/
867 
868 void
869 AcpiDmDumpMadt (
870     ACPI_TABLE_HEADER       *Table)
871 {
872     ACPI_STATUS             Status;
873     ACPI_SUBTABLE_HEADER    *Subtable;
874     UINT32                  Length = Table->Length;
875     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
876     ACPI_DMTABLE_INFO       *InfoTable;
877 
878 
879     /* Main table */
880 
881     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
882     if (ACPI_FAILURE (Status))
883     {
884         return;
885     }
886 
887     /* Subtables */
888 
889     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
890     DbgPrint (ASL_PARSE_OUTPUT, "//0B) Offset %X, from table start: 0x%8.8X%8.8X\n",
891         Offset, ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
892     while (Offset < Table->Length)
893     {
894         /* Common subtable header */
895 
896         AcpiOsPrintf ("\n");
897         Status = AcpiDmDumpTable (Length, Offset, Subtable,
898             Subtable->Length, AcpiDmTableInfoMadtHdr);
899         if (ACPI_FAILURE (Status))
900         {
901             return;
902         }
903 
904         DbgPrint (ASL_PARSE_OUTPUT, "subtableType: %X\n", Subtable->Type);
905         switch (Subtable->Type)
906         {
907         case ACPI_MADT_TYPE_LOCAL_APIC:
908 
909             InfoTable = AcpiDmTableInfoMadt0;
910             break;
911 
912         case ACPI_MADT_TYPE_IO_APIC:
913 
914             InfoTable = AcpiDmTableInfoMadt1;
915             break;
916 
917         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
918 
919             InfoTable = AcpiDmTableInfoMadt2;
920             break;
921 
922         case ACPI_MADT_TYPE_NMI_SOURCE:
923 
924             InfoTable = AcpiDmTableInfoMadt3;
925             break;
926 
927         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
928 
929             InfoTable = AcpiDmTableInfoMadt4;
930             break;
931 
932         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
933 
934             InfoTable = AcpiDmTableInfoMadt5;
935             break;
936 
937         case ACPI_MADT_TYPE_IO_SAPIC:
938 
939             InfoTable = AcpiDmTableInfoMadt6;
940             break;
941 
942         case ACPI_MADT_TYPE_LOCAL_SAPIC:
943 
944             InfoTable = AcpiDmTableInfoMadt7;
945             break;
946 
947         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
948 
949             InfoTable = AcpiDmTableInfoMadt8;
950             break;
951 
952         case ACPI_MADT_TYPE_LOCAL_X2APIC:
953 
954             InfoTable = AcpiDmTableInfoMadt9;
955             break;
956 
957         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
958 
959             InfoTable = AcpiDmTableInfoMadt10;
960             break;
961 
962         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
963 
964             InfoTable = AcpiDmTableInfoMadt11;
965             break;
966 
967         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
968 
969             InfoTable = AcpiDmTableInfoMadt12;
970             break;
971 
972         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
973 
974             InfoTable = AcpiDmTableInfoMadt13;
975             break;
976 
977         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
978 
979             InfoTable = AcpiDmTableInfoMadt14;
980             break;
981 
982         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
983 
984             InfoTable = AcpiDmTableInfoMadt15;
985             break;
986 
987         case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
988 
989             InfoTable = AcpiDmTableInfoMadt16;
990             break;
991 
992         default:
993 
994             if ((Subtable->Type >= ACPI_MADT_TYPE_RESERVED) &&
995                 (Subtable->Type < ACPI_MADT_TYPE_OEM_RESERVED))
996             {
997                 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
998                     Subtable->Type);
999                 goto NextSubtable;
1000             }
1001             else if (Subtable->Type >= ACPI_MADT_TYPE_OEM_RESERVED)
1002             {
1003                 DbgPrint (ASL_PARSE_OUTPUT, "//[Found an OEM structure, type = %0x]\n",
1004                     Subtable->Type);
1005                 Offset += sizeof (ACPI_SUBTABLE_HEADER);
1006                 DbgPrint (ASL_PARSE_OUTPUT, "//[0) Subtable->Length = %X, Subtable = %p, Offset = %X]\n",
1007                     Subtable->Length, Subtable, Offset);
1008                 DbgPrint (ASL_PARSE_OUTPUT, "//[0A) Offset from table start: 0x%8.8X%8.8X]\n",
1009                     ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
1010             }
1011 
1012             /* Attempt to continue */
1013 
1014             if (!Subtable->Length)
1015             {
1016                 AcpiOsPrintf ("Invalid zero length subtable\n");
1017                 return;
1018             }
1019 
1020             /* Dump the OEM data */
1021 
1022             Status = AcpiDmDumpTable (Length, Offset, ACPI_CAST_PTR (UINT8, Table) + Offset,
1023                 Subtable->Length - sizeof (ACPI_SUBTABLE_HEADER), AcpiDmTableInfoMadt17);
1024             if (ACPI_FAILURE (Status))
1025             {
1026                 return;
1027             }
1028 
1029             DbgPrint (ASL_PARSE_OUTPUT, "//[1) Subtable->Length = %X, Offset = %X]\n",
1030                 Subtable->Length, Offset);
1031             Offset -= sizeof (ACPI_SUBTABLE_HEADER);
1032 
1033             goto NextSubtable;
1034         }
1035 
1036         DbgPrint (ASL_PARSE_OUTPUT, "//[2) Subtable->Length = %X, Offset = %X]\n",
1037             Subtable->Length, Offset);
1038         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1039             Subtable->Length, InfoTable);
1040         if (ACPI_FAILURE (Status))
1041         {
1042             return;
1043         }
1044 
1045 NextSubtable:
1046         /* Point to next subtable */
1047 
1048         DbgPrint (ASL_PARSE_OUTPUT, "//[3) Subtable->Length = %X, Offset = %X]\n",
1049             Subtable->Length, Offset);
1050         DbgPrint (ASL_PARSE_OUTPUT, "//[4) Offset from table start: 0x%8.8X%8.8X (%p) %p]\n",
1051             ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (UINT8, Subtable) - ACPI_CAST_PTR (UINT8, Table)), Subtable, Table);
1052         if (Offset > Table->Length)
1053         {
1054             return;
1055         }
1056 
1057         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
1058             Subtable->Length);
1059 
1060         DbgPrint (ASL_PARSE_OUTPUT, "//[5) Next Subtable %p, length %X]\n",
1061             Subtable, Subtable->Length);
1062         DbgPrint (ASL_PARSE_OUTPUT, "//[5B) Offset from table start: 0x%8.8X%8.8X (%p)]\n",
1063             ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)), Subtable);
1064 
1065         Offset = ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table);
1066         if (Offset >= Table->Length)
1067         {
1068             return;
1069         }
1070     }
1071 }
1072 
1073 
1074 /*******************************************************************************
1075  *
1076  * FUNCTION:    AcpiDmDumpMcfg
1077  *
1078  * PARAMETERS:  Table               - A MCFG Table
1079  *
1080  * RETURN:      None
1081  *
1082  * DESCRIPTION: Format the contents of a MCFG table
1083  *
1084  ******************************************************************************/
1085 
1086 void
1087 AcpiDmDumpMcfg (
1088     ACPI_TABLE_HEADER       *Table)
1089 {
1090     ACPI_STATUS             Status;
1091     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
1092     ACPI_MCFG_ALLOCATION    *Subtable;
1093 
1094 
1095     /* Main table */
1096 
1097     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1098     if (ACPI_FAILURE (Status))
1099     {
1100         return;
1101     }
1102 
1103     /* Subtables */
1104 
1105     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1106     while (Offset < Table->Length)
1107     {
1108         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1109         {
1110             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1111                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1112             return;
1113         }
1114 
1115         AcpiOsPrintf ("\n");
1116         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1117             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1118         if (ACPI_FAILURE (Status))
1119         {
1120             return;
1121         }
1122 
1123         /* Point to next subtable (each subtable is of fixed length) */
1124 
1125         Offset += sizeof (ACPI_MCFG_ALLOCATION);
1126         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
1127             sizeof (ACPI_MCFG_ALLOCATION));
1128     }
1129 }
1130 
1131 
1132 /*******************************************************************************
1133  *
1134  * FUNCTION:    AcpiDmDumpMpst
1135  *
1136  * PARAMETERS:  Table               - A MPST Table
1137  *
1138  * RETURN:      None
1139  *
1140  * DESCRIPTION: Format the contents of a MPST table
1141  *
1142  ******************************************************************************/
1143 
1144 void
1145 AcpiDmDumpMpst (
1146     ACPI_TABLE_HEADER       *Table)
1147 {
1148     ACPI_STATUS             Status;
1149     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
1150     ACPI_MPST_POWER_NODE    *Subtable0;
1151     ACPI_MPST_POWER_STATE   *Subtable0A;
1152     ACPI_MPST_COMPONENT     *Subtable0B;
1153     ACPI_MPST_DATA_HDR      *Subtable1;
1154     ACPI_MPST_POWER_DATA    *Subtable2;
1155     UINT16                  SubtableCount;
1156     UINT32                  PowerStateCount;
1157     UINT32                  ComponentCount;
1158 
1159 
1160     /* Main table */
1161 
1162     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1163     if (ACPI_FAILURE (Status))
1164     {
1165         return;
1166     }
1167 
1168     /* Subtable: Memory Power Node(s) */
1169 
1170     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1171     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1172 
1173     while ((Offset < Table->Length) && SubtableCount)
1174     {
1175         AcpiOsPrintf ("\n");
1176         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
1177             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1178         if (ACPI_FAILURE (Status))
1179         {
1180             return;
1181         }
1182 
1183         /* Extract the sub-subtable counts */
1184 
1185         PowerStateCount = Subtable0->NumPowerStates;
1186         ComponentCount = Subtable0->NumPhysicalComponents;
1187         Offset += sizeof (ACPI_MPST_POWER_NODE);
1188 
1189         /* Sub-subtables - Memory Power State Structure(s) */
1190 
1191         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
1192             sizeof (ACPI_MPST_POWER_NODE));
1193 
1194         while (PowerStateCount)
1195         {
1196             AcpiOsPrintf ("\n");
1197             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
1198                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1199             if (ACPI_FAILURE (Status))
1200             {
1201                 return;
1202             }
1203 
1204             Subtable0A++;
1205             PowerStateCount--;
1206             Offset += sizeof (ACPI_MPST_POWER_STATE);
1207        }
1208 
1209         /* Sub-subtables - Physical Component ID Structure(s) */
1210 
1211         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
1212 
1213         if (ComponentCount)
1214         {
1215             AcpiOsPrintf ("\n");
1216         }
1217 
1218         while (ComponentCount)
1219         {
1220             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
1221                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1222             if (ACPI_FAILURE (Status))
1223             {
1224                 return;
1225             }
1226 
1227             Subtable0B++;
1228             ComponentCount--;
1229             Offset += sizeof (ACPI_MPST_COMPONENT);
1230         }
1231 
1232         /* Point to next Memory Power Node subtable */
1233 
1234         SubtableCount--;
1235         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1236             sizeof (ACPI_MPST_POWER_NODE) +
1237             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1238             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1239     }
1240 
1241     /* Subtable: Count of Memory Power State Characteristic structures */
1242 
1243     AcpiOsPrintf ("\n");
1244     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1245     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1246         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1247     if (ACPI_FAILURE (Status))
1248     {
1249         return;
1250     }
1251 
1252     SubtableCount = Subtable1->CharacteristicsCount;
1253     Offset += sizeof (ACPI_MPST_DATA_HDR);
1254 
1255     /* Subtable: Memory Power State Characteristics structure(s) */
1256 
1257     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1258         sizeof (ACPI_MPST_DATA_HDR));
1259 
1260     while ((Offset < Table->Length) && SubtableCount)
1261     {
1262         AcpiOsPrintf ("\n");
1263         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1264             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1265         if (ACPI_FAILURE (Status))
1266         {
1267             return;
1268         }
1269 
1270         Subtable2++;
1271         SubtableCount--;
1272         Offset += sizeof (ACPI_MPST_POWER_DATA);
1273     }
1274 }
1275 
1276 
1277 /*******************************************************************************
1278  *
1279  * FUNCTION:    AcpiDmDumpMsct
1280  *
1281  * PARAMETERS:  Table               - A MSCT table
1282  *
1283  * RETURN:      None
1284  *
1285  * DESCRIPTION: Format the contents of a MSCT
1286  *
1287  ******************************************************************************/
1288 
1289 void
1290 AcpiDmDumpMsct (
1291     ACPI_TABLE_HEADER       *Table)
1292 {
1293     ACPI_STATUS             Status;
1294     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1295     ACPI_MSCT_PROXIMITY     *Subtable;
1296 
1297 
1298     /* Main table */
1299 
1300     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1301     if (ACPI_FAILURE (Status))
1302     {
1303         return;
1304     }
1305 
1306     /* Subtables */
1307 
1308     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1309     while (Offset < Table->Length)
1310     {
1311         /* Common subtable header */
1312 
1313         AcpiOsPrintf ("\n");
1314         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1315             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1316         if (ACPI_FAILURE (Status))
1317         {
1318             return;
1319         }
1320 
1321         /* Point to next subtable */
1322 
1323         Offset += sizeof (ACPI_MSCT_PROXIMITY);
1324         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1325             sizeof (ACPI_MSCT_PROXIMITY));
1326     }
1327 }
1328 
1329 
1330 /*******************************************************************************
1331  *
1332  * FUNCTION:    AcpiDmDumpNfit
1333  *
1334  * PARAMETERS:  Table               - A NFIT table
1335  *
1336  * RETURN:      None
1337  *
1338  * DESCRIPTION: Format the contents of an NFIT.
1339  *
1340  ******************************************************************************/
1341 
1342 void
1343 AcpiDmDumpNfit (
1344     ACPI_TABLE_HEADER       *Table)
1345 {
1346     ACPI_STATUS             Status;
1347     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
1348     UINT32                  FieldOffset = 0;
1349     UINT32                  Length;
1350     ACPI_NFIT_HEADER        *Subtable;
1351     ACPI_DMTABLE_INFO       *InfoTable;
1352     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
1353     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
1354     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1355     UINT32                  i;
1356 
1357 
1358     /* Main table */
1359 
1360     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1361     if (ACPI_FAILURE (Status))
1362     {
1363         return;
1364     }
1365 
1366     /* Subtables */
1367 
1368     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1369     while (Offset < Table->Length)
1370     {
1371         /* NFIT subtable header */
1372 
1373         AcpiOsPrintf ("\n");
1374         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1375             Subtable->Length, AcpiDmTableInfoNfitHdr);
1376         if (ACPI_FAILURE (Status))
1377         {
1378             return;
1379         }
1380 
1381         switch (Subtable->Type)
1382         {
1383         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1384 
1385             InfoTable = AcpiDmTableInfoNfit0;
1386             break;
1387 
1388         case ACPI_NFIT_TYPE_MEMORY_MAP:
1389 
1390             InfoTable = AcpiDmTableInfoNfit1;
1391             break;
1392 
1393         case ACPI_NFIT_TYPE_INTERLEAVE:
1394 
1395             /* Has a variable number of 32-bit values at the end */
1396 
1397             InfoTable = AcpiDmTableInfoNfit2;
1398             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1399             break;
1400 
1401         case ACPI_NFIT_TYPE_SMBIOS:
1402 
1403             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1404             InfoTable = AcpiDmTableInfoNfit3;
1405             break;
1406 
1407         case ACPI_NFIT_TYPE_CONTROL_REGION:
1408 
1409             InfoTable = AcpiDmTableInfoNfit4;
1410             break;
1411 
1412         case ACPI_NFIT_TYPE_DATA_REGION:
1413 
1414             InfoTable = AcpiDmTableInfoNfit5;
1415             break;
1416 
1417         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1418 
1419             /* Has a variable number of 64-bit addresses at the end */
1420 
1421             InfoTable = AcpiDmTableInfoNfit6;
1422             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
1423             break;
1424 
1425         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
1426 
1427             InfoTable = AcpiDmTableInfoNfit7;
1428             break;
1429 
1430         default:
1431             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1432                 Subtable->Type);
1433 
1434             /* Attempt to continue */
1435 
1436             if (!Subtable->Length)
1437             {
1438                 AcpiOsPrintf ("Invalid zero length subtable\n");
1439                 return;
1440             }
1441             goto NextSubtable;
1442         }
1443 
1444         AcpiOsPrintf ("\n");
1445         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1446             Subtable->Length, InfoTable);
1447         if (ACPI_FAILURE (Status))
1448         {
1449             return;
1450         }
1451 
1452         /* Per-subtable variable-length fields */
1453 
1454         switch (Subtable->Type)
1455         {
1456         case ACPI_NFIT_TYPE_INTERLEAVE:
1457 
1458             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1459             for (i = 0; i < Interleave->LineCount; i++)
1460             {
1461                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1462                     &Interleave->LineOffset[i],
1463                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
1464                 if (ACPI_FAILURE (Status))
1465                 {
1466                     return;
1467                 }
1468 
1469                 FieldOffset += sizeof (UINT32);
1470             }
1471             break;
1472 
1473         case ACPI_NFIT_TYPE_SMBIOS:
1474 
1475             Length = Subtable->Length -
1476                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
1477 
1478             if (Length)
1479             {
1480                 Status = AcpiDmDumpTable (Table->Length,
1481                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
1482                     SmbiosInfo,
1483                     Length, AcpiDmTableInfoNfit3a);
1484                 if (ACPI_FAILURE (Status))
1485                 {
1486                     return;
1487                 }
1488             }
1489 
1490             break;
1491 
1492         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1493 
1494             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1495             for (i = 0; i < Hint->HintCount; i++)
1496             {
1497                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1498                     &Hint->HintAddress[i],
1499                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
1500                 if (ACPI_FAILURE (Status))
1501                 {
1502                     return;
1503                 }
1504 
1505                 FieldOffset += sizeof (UINT64);
1506             }
1507             break;
1508 
1509         default:
1510             break;
1511         }
1512 
1513 NextSubtable:
1514         /* Point to next subtable */
1515 
1516         Offset += Subtable->Length;
1517         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1518     }
1519 }
1520 
1521 
1522 /*******************************************************************************
1523  *
1524  * FUNCTION:    AcpiDmDumpNhlt
1525  *
1526  * PARAMETERS:  Table               - A NHLT table
1527  *
1528  * RETURN:      None
1529  *
1530  * DESCRIPTION: Format the contents of an NHLT.
1531  *
1532  ******************************************************************************/
1533 
1534 void
1535 AcpiDmDumpNhlt (
1536     ACPI_TABLE_HEADER       *Table)
1537 {
1538     ACPI_STATUS             Status;
1539     UINT32                  Offset;
1540     UINT32                  TableLength = Table->Length;
1541     UINT32                  EndpointCount;
1542     UINT8                   FormatsCount;
1543     ACPI_NHLT_ENDPOINT      *Subtable;
1544     ACPI_NHLT_FORMAT_CONFIG *FormatSubtable;
1545     ACPI_TABLE_NHLT         *InfoTable;
1546     UINT32                  CapabilitiesSize;
1547     UINT32                  i;
1548     UINT32                  j;
1549     UINT32                  EndpointEndOffset;
1550     UINT8                   ConfigType = 0;
1551     UINT8                   ArrayType;
1552     UINT8                   MicrophoneCount;
1553     ACPI_NHLT_VENDOR_MIC_COUNT          *MicCount;
1554     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A  *DevSpecific;
1555     ACPI_NHLT_FORMATS_CONFIG            *FormatsConfig;
1556     ACPI_NHLT_DEVICE_INFO_COUNT         *Count;
1557     ACPI_NHLT_DEVICE_INFO               *DeviceInfo;
1558     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B  *Capabilities;
1559 
1560 
1561     /* Main table */
1562 
1563     AcpiOsPrintf ("    /* Main table */\n");
1564 
1565     Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNhlt);
1566     if (ACPI_FAILURE (Status))
1567     {
1568         return;
1569     }
1570 
1571     /* Get the Endpoint Descriptor Count */
1572 
1573     InfoTable = ACPI_ADD_PTR (ACPI_TABLE_NHLT, Table, 0);
1574     EndpointCount = InfoTable->EndpointCount;
1575 
1576     /* Subtables */
1577 
1578     Offset = sizeof (ACPI_TABLE_NHLT);
1579 
1580     while (Offset < TableLength)
1581     {
1582         /* A variable number of Endpoint Descriptors - process each */
1583 
1584         for (i = 0; i < EndpointCount; i++)
1585         {
1586             /* Do the Endpoint Descriptor table */
1587 
1588             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1589 
1590             /* Check for endpoint descriptor length beyond end-of-table */
1591 
1592             if (Subtable->DescriptorLength > TableLength)
1593             {
1594                 Offset += 1;
1595                 AcpiOsPrintf ("\n    /* Endpoint Descriptor Length larger than"
1596                     " table size: %X, table %X, adjusting table offset (+1) */\n",
1597                     Subtable->DescriptorLength, TableLength);
1598 
1599                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1600             }
1601 
1602             AcpiOsPrintf ("\n    /* Endpoint Descriptor #%u */\n", i+1);
1603             Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
1604                 Subtable->DescriptorLength, AcpiDmTableInfoNhlt0);
1605             if (ACPI_FAILURE (Status))
1606             {
1607                 return;
1608             }
1609 
1610             EndpointEndOffset = Subtable->DescriptorLength + Offset;
1611 
1612             /* Check for endpoint descriptor beyond end-of-table */
1613 
1614             if (Subtable->DescriptorLength > TableLength)
1615             {
1616                 AcpiOsPrintf ("\n    /* Endpoint Descriptor Length larger than table size: %X, table %X */\n",
1617                     Subtable->DescriptorLength, TableLength);
1618             }
1619 
1620             Offset += sizeof (ACPI_NHLT_ENDPOINT);
1621             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1622 
1623             /* Do the Device Specific table */
1624 
1625             AcpiOsPrintf ("\n    /* Endpoint Device_Specific_Config table */\n");
1626             DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1627             CapabilitiesSize = DevSpecific->CapabilitiesSize;
1628             Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1629                 sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
1630             if (ACPI_FAILURE (Status))
1631             {
1632                 return;
1633             }
1634 
1635             ArrayType = 0;
1636 
1637             /* Different subtables based upon capabilities_size */
1638 
1639             switch (CapabilitiesSize)
1640             {
1641             case 0:
1642                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
1643                 break;
1644 
1645             case 1:
1646                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1647                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C), AcpiDmTableInfoNhlt5c);
1648                 if (ACPI_FAILURE (Status))
1649                 {
1650                     return;
1651                 }
1652                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C);
1653                 break;
1654 
1655             case 2:
1656                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1657                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
1658                 if (ACPI_FAILURE (Status))
1659                 {
1660                     return;
1661                 }
1662                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
1663                 break;
1664 
1665             case 3:
1666             default:
1667                 /* Extract the ConfigType and ArrayType */
1668 
1669                 ConfigType = DevSpecific->ConfigType;
1670                 ArrayType = DevSpecific->ArrayType;
1671 
1672                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1673                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A), AcpiDmTableInfoNhlt5a);
1674                 if (ACPI_FAILURE (Status))
1675                 {
1676                     return;
1677                 }
1678 
1679                 /* Capabilities Size == 3 */
1680                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A);
1681                 break;
1682 
1683             case 7:
1684                 ConfigType = DevSpecific->ConfigType;
1685                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1686                 DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1687 
1688                 AcpiOsPrintf ("\n    /* Render Feedback Device-Specific table */\n");
1689                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1690                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
1691                 if (ACPI_FAILURE (Status))
1692                 {
1693                     return;
1694                 }
1695 
1696                 /* Capabilities Size = 7 */
1697                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
1698 
1699                 if (ConfigType == ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK)
1700                 {
1701                     Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1702                     DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1703 
1704                     Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1705                         sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt6b);
1706                     if (ACPI_FAILURE (Status))
1707                     {
1708                         return;
1709                     }
1710                     Offset += sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG);
1711                 }
1712                 break;
1713            }
1714 
1715             /* Check for a vendor-defined mic array */
1716 
1717             if (ConfigType == ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY)
1718             {
1719                 if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_MASK) == ACPI_NHLT_VENDOR_DEFINED)
1720                 {
1721                     /* Vendor-defined microphone array; get the microphone count first */
1722 
1723                     AcpiOsPrintf ("\n    /* Vendor-defined microphone count */\n");
1724                     MicCount = ACPI_ADD_PTR (ACPI_NHLT_VENDOR_MIC_COUNT, Table, Offset);
1725                     MicrophoneCount = MicCount->MicrophoneCount;
1726 
1727                     Status = AcpiDmDumpTable (TableLength, Offset, MicCount,
1728                         sizeof (ACPI_NHLT_VENDOR_MIC_COUNT), AcpiDmTableInfoNhlt6a);
1729                     Offset += sizeof (ACPI_NHLT_VENDOR_MIC_COUNT);
1730                     if (ACPI_FAILURE (Status))
1731                     {
1732                         return;
1733                     }
1734 
1735                     /* Get the vendor microphone config structure(s) */
1736 
1737                     for (j = 0; j < MicrophoneCount; j++)
1738                     {
1739                         AcpiOsPrintf ("\n    /* Vendor-defined microphone array #%u*/\n", j+1);
1740                         DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
1741 
1742                         Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1743                             sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG), AcpiDmTableInfoNhlt6);
1744                         if (ACPI_FAILURE (Status))
1745                         {
1746                             return;
1747                         }
1748 
1749                         Offset += sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG);
1750                     }
1751 
1752                     /* Check for Microphone SNR and sensitivity extension */
1753 
1754                     if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_EXT_MASK) == ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT)
1755                     {
1756                         AcpiOsPrintf ("\n    /* Microphone SNR and sensitivity array */\n");
1757                         DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
1758 
1759                         Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1760                             sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION), AcpiDmTableInfoNhlt9);
1761                         if (ACPI_FAILURE (Status))
1762                         {
1763                             return;
1764                         }
1765 
1766                         Offset += sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION);
1767                     }
1768                 }
1769             }
1770 
1771             /* Do the Formats_Config table - starts with the FormatsCount field */
1772 
1773             FormatsConfig = ACPI_ADD_PTR (ACPI_NHLT_FORMATS_CONFIG, Table, Offset);
1774             FormatsCount = FormatsConfig->FormatsCount;
1775 
1776             AcpiOsPrintf ("\n    /* Formats_Config table */\n");
1777 
1778             /* Dump the FormatsCount value */
1779 
1780             if (FormatsCount > 0)
1781             {
1782                 Status = AcpiDmDumpTable (TableLength, Offset, FormatsConfig,
1783                     sizeof (ACPI_NHLT_FORMATS_CONFIG), AcpiDmTableInfoNhlt4);
1784                 if (ACPI_FAILURE (Status))
1785                 {
1786                     return;
1787                 }
1788             }
1789             Offset += sizeof (ACPI_NHLT_FORMATS_CONFIG);
1790 
1791             /* A variable number of Format_Config Descriptors - process each */
1792 
1793             for (j = 0; j < FormatsCount; j++)
1794             {
1795                 FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset);
1796                 CapabilitiesSize = FormatSubtable->CapabilitySize;
1797 
1798                 /* Do the Wave_extensible struct */
1799 
1800                 AcpiOsPrintf ("\n    /* Wave_Format_Extensible table #%u */\n", j+1);
1801                 Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable,
1802                     sizeof (ACPI_NHLT_FORMAT_CONFIG), AcpiDmTableInfoNhlt3);
1803                 if (ACPI_FAILURE (Status))
1804                 {
1805                     return;
1806                 }
1807 
1808                 Offset += sizeof (ACPI_NHLT_FORMAT_CONFIG);
1809 
1810                 if (CapabilitiesSize > 0)
1811                 {
1812                     UINT8* CapabilitiesBuf = ACPI_ADD_PTR (UINT8, Table, Offset);
1813                     /* Do the Capabilities array (of bytes) */
1814 
1815                     AcpiOsPrintf ("\n    /* Specific_Config table #%u */\n", j+1);
1816 
1817                     Status = AcpiDmDumpTable (TableLength, Offset, CapabilitiesBuf,
1818                         CapabilitiesSize, AcpiDmTableInfoNhlt3a);
1819                     if (ACPI_FAILURE (Status))
1820                     {
1821                         return;
1822                     }
1823 
1824                     Offset += CapabilitiesSize; /* + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); */
1825                 }
1826 
1827             } /* for (j = 0; j < FormatsCount; j++) */
1828 
1829             /*
1830              * If we are not done with the current Endpoint yet, then there must be
1831              * some non documented structure(s) yet to be processed. First, get
1832              * the count of such structure(s).
1833              */
1834             if (Offset < EndpointEndOffset)
1835             {
1836                 AcpiOsPrintf ("\n    /* Structures that are not part of NHLT spec */\n");
1837                 Count = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO_COUNT, Table, Offset);
1838                 Status = AcpiDmDumpTable (TableLength, Offset, Count,
1839                     sizeof (ACPI_NHLT_DEVICE_INFO_COUNT), AcpiDmTableInfoNhlt7);
1840                 if (ACPI_FAILURE (Status))
1841                 {
1842                     return;
1843                 }
1844                 Offset += sizeof (ACPI_NHLT_DEVICE_INFO_COUNT);
1845 
1846                 /* Variable number of device structures */
1847 
1848                 for (j = 0; j < Count->StructureCount; j++)
1849                 {
1850                     DeviceInfo = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO, Table, Offset);
1851                     AcpiOsPrintf ("\n    /* Device Info structure #%u (not part of NHLT spec) */\n", j+1);
1852 
1853                     /*
1854                      * Dump the following Device Info fields:
1855                      *  1) Device ID
1856                      *  2) Device Instance ID
1857                      *  3) Device Port ID
1858                      */
1859                     Status = AcpiDmDumpTable (TableLength, Offset, DeviceInfo,
1860                         sizeof (ACPI_NHLT_DEVICE_INFO), AcpiDmTableInfoNhlt7a);
1861                     if (ACPI_FAILURE (Status))
1862                     {
1863                         return;
1864                     }
1865 
1866                     Offset += sizeof (ACPI_NHLT_DEVICE_INFO);
1867                 }
1868 
1869                 /*
1870                  * Check that the current offset is not beyond the end of
1871                  * this endpoint descriptor. If it is not, print those
1872                  * undocumented bytes.
1873                  */
1874                 if (Offset < EndpointEndOffset)
1875                 {
1876                     /* Unknown data at the end of the Endpoint */
1877                     UINT32 size = EndpointEndOffset - Offset;
1878                     UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
1879                     AcpiOsPrintf ("\n    /* Unknown data at the end of the Endpoint, size: %X */\n", size);
1880                     Status = AcpiDmDumpTable (TableLength, Offset, buffer,
1881                         size, AcpiDmTableInfoNhlt7b);
1882                     Offset = EndpointEndOffset;
1883                 }
1884 
1885                 /* Should be at the end of the Endpoint structure. */
1886             }
1887 
1888         } /* for (i = 0; i < EndpointCount; i++) */
1889 
1890 
1891         /*
1892          * Done with all of the Endpoint Descriptors, Emit the table terminator
1893          * (if such a legacy structure is present -- not in NHLT specification)
1894          */
1895         if (Offset < TableLength)
1896         {
1897             Capabilities = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Table, Offset);
1898             AcpiOsPrintf ("\n/* Terminating specific config (not part of NHLT spec) */\n");
1899 
1900             Status = AcpiDmDumpTable (TableLength, Offset, Capabilities,
1901                 sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
1902             if (ACPI_FAILURE (Status))
1903             {
1904                 return;
1905             }
1906             Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
1907 
1908             if (Capabilities->CapabilitiesSize > 0)
1909             {
1910                 UINT32 remainingBytes = TableLength - Offset;
1911                 UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
1912 
1913                 if (remainingBytes != Capabilities->CapabilitiesSize)
1914                     AcpiOsPrintf ("\n/* Incorrect config size, should be %X, is %X */\n",
1915                         Capabilities->CapabilitiesSize, remainingBytes);
1916                 Status = AcpiDmDumpTable (TableLength, Offset, buffer,
1917                         remainingBytes, AcpiDmTableInfoNhlt3a);
1918             }
1919         }
1920 
1921         return;
1922     }
1923 }
1924 
1925 
1926 /*******************************************************************************
1927  *
1928  * FUNCTION:    AcpiDmDumpPcct
1929  *
1930  * PARAMETERS:  Table               - A PCCT table
1931  *
1932  * RETURN:      None
1933  *
1934  * DESCRIPTION: Format the contents of a PCCT. This table type consists
1935  *              of an open-ended number of subtables.
1936  *
1937  ******************************************************************************/
1938 
1939 void
1940 AcpiDmDumpPcct (
1941     ACPI_TABLE_HEADER       *Table)
1942 {
1943     ACPI_STATUS             Status;
1944     ACPI_PCCT_SUBSPACE      *Subtable;
1945     ACPI_DMTABLE_INFO       *InfoTable;
1946     UINT32                  Length = Table->Length;
1947     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
1948 
1949 
1950     /* Main table */
1951 
1952     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1953     if (ACPI_FAILURE (Status))
1954     {
1955         return;
1956     }
1957 
1958     /* Subtables */
1959 
1960     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1961     while (Offset < Table->Length)
1962     {
1963         /* Common subtable header */
1964 
1965         AcpiOsPrintf ("\n");
1966         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1967             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
1968         if (ACPI_FAILURE (Status))
1969         {
1970             return;
1971         }
1972 
1973         switch (Subtable->Header.Type)
1974         {
1975         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
1976 
1977             InfoTable = AcpiDmTableInfoPcct0;
1978             break;
1979 
1980         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
1981 
1982             InfoTable = AcpiDmTableInfoPcct1;
1983             break;
1984 
1985         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
1986 
1987             InfoTable = AcpiDmTableInfoPcct2;
1988             break;
1989 
1990         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
1991 
1992             InfoTable = AcpiDmTableInfoPcct3;
1993             break;
1994 
1995         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
1996 
1997             InfoTable = AcpiDmTableInfoPcct4;
1998             break;
1999 
2000         case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
2001 
2002             InfoTable = AcpiDmTableInfoPcct5;
2003             break;
2004 
2005         default:
2006 
2007             AcpiOsPrintf (
2008                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2009                 Subtable->Header.Type);
2010             return;
2011         }
2012 
2013         AcpiOsPrintf ("\n");
2014         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2015             Subtable->Header.Length, InfoTable);
2016         if (ACPI_FAILURE (Status))
2017         {
2018             return;
2019         }
2020 
2021         /* Point to next subtable */
2022 
2023         Offset += Subtable->Header.Length;
2024         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
2025             Subtable->Header.Length);
2026     }
2027 }
2028 
2029 
2030 /*******************************************************************************
2031  *
2032  * FUNCTION:    AcpiDmDumpPdtt
2033  *
2034  * PARAMETERS:  Table               - A PDTT table
2035  *
2036  * RETURN:      None
2037  *
2038  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
2039  *              table that contains an open-ended number of IDs
2040  *              at the end of the table.
2041  *
2042  ******************************************************************************/
2043 
2044 void
2045 AcpiDmDumpPdtt (
2046     ACPI_TABLE_HEADER       *Table)
2047 {
2048     ACPI_STATUS             Status;
2049     ACPI_PDTT_CHANNEL       *Subtable;
2050     UINT32                  Length = Table->Length;
2051     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
2052 
2053 
2054     /* Main table */
2055 
2056     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
2057     if (ACPI_FAILURE (Status))
2058     {
2059         return;
2060     }
2061 
2062     /* Subtables. Currently there is only one type, but can be multiples */
2063 
2064     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
2065     while (Offset < Table->Length)
2066     {
2067         AcpiOsPrintf ("\n");
2068         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2069             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
2070         if (ACPI_FAILURE (Status))
2071         {
2072             return;
2073         }
2074 
2075         /* Point to next subtable */
2076 
2077         Offset += sizeof (ACPI_PDTT_CHANNEL);
2078         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
2079             sizeof (ACPI_PDTT_CHANNEL));
2080     }
2081 }
2082 
2083 
2084 /*******************************************************************************
2085  *
2086  * FUNCTION:    AcpiDmDumpPhat
2087  *
2088  * PARAMETERS:  Table               - A PHAT table
2089  *
2090  * RETURN:      None
2091  *
2092  * DESCRIPTION: Format the contents of a PHAT.
2093  *
2094  ******************************************************************************/
2095 
2096 void
2097 AcpiDmDumpPhat (
2098     ACPI_TABLE_HEADER       *Table)
2099 {
2100     ACPI_STATUS             Status;
2101     ACPI_DMTABLE_INFO       *InfoTable;
2102     ACPI_PHAT_HEADER        *Subtable;
2103     ACPI_PHAT_VERSION_DATA  *VersionData;
2104     UINT32                  RecordCount;
2105     UINT32                  Length = Table->Length;
2106     UINT32                  Offset = sizeof (ACPI_TABLE_PHAT);
2107     UINT32                  SubtableLength;
2108     UINT32                  PathLength;
2109     UINT32                  VendorLength;
2110 
2111 
2112     Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
2113 
2114     while (Offset < Table->Length)
2115     {
2116         /* Common subtable header */
2117 
2118         AcpiOsPrintf ("\n");
2119         Status = AcpiDmDumpTable (Length, 0, Subtable,
2120             sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
2121         if (ACPI_FAILURE (Status))
2122         {
2123             return;
2124         }
2125 
2126         switch (Subtable->Type)
2127         {
2128         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2129 
2130             InfoTable = AcpiDmTableInfoPhat0;
2131             SubtableLength = sizeof (ACPI_PHAT_VERSION_DATA);
2132             break;
2133 
2134         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2135 
2136             InfoTable = AcpiDmTableInfoPhat1;
2137             SubtableLength = sizeof (ACPI_PHAT_HEALTH_DATA);
2138             break;
2139 
2140         default:
2141 
2142             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
2143                 Subtable->Type);
2144 
2145             return;
2146         }
2147 
2148         Status = AcpiDmDumpTable (Length, 0, Subtable,
2149             SubtableLength, InfoTable);
2150         if (ACPI_FAILURE (Status))
2151         {
2152             return;
2153         }
2154 
2155         switch (Subtable->Type)
2156         {
2157         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2158 
2159             VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
2160             RecordCount = VersionData->ElementCount;
2161             while (RecordCount)
2162             {
2163                 Status = AcpiDmDumpTable (Length, Offset,
2164                     ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)),
2165                     sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
2166                 if (ACPI_FAILURE (Status))
2167                 {
2168                     return;
2169                 }
2170 
2171                 RecordCount--;
2172             }
2173 
2174             break;
2175 
2176         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2177 
2178             /* account for the null terminator */
2179 
2180             PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1;
2181             Status = AcpiDmDumpTable (Length, Offset,
2182                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
2183                 PathLength, AcpiDmTableInfoPhat1a);
2184             if (ACPI_FAILURE (Status))
2185             {
2186                 return;
2187             }
2188 
2189             /* Get vendor data - data length is the remaining subtable length */
2190 
2191             VendorLength =
2192                 Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
2193             Status = AcpiDmDumpTable (Length, 0,
2194                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
2195                 VendorLength, AcpiDmTableInfoPhat1b);
2196             if (ACPI_FAILURE (Status))
2197             {
2198                 return;
2199             }
2200             break;
2201 
2202         default:
2203 
2204             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
2205                 Subtable->Type);
2206             return;
2207         }
2208 
2209         /* Next subtable */
2210 
2211         Offset += Subtable->Length;
2212         Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable,
2213             Subtable->Length);
2214     }
2215 }
2216 
2217 
2218 /*******************************************************************************
2219  *
2220  * FUNCTION:    AcpiDmDumpPmtt
2221  *
2222  * PARAMETERS:  Table               - A PMTT table
2223  *
2224  * RETURN:      None
2225  *
2226  * DESCRIPTION: Format the contents of a PMTT. This table type consists
2227  *              of an open-ended number of subtables.
2228  *
2229  ******************************************************************************/
2230 
2231 void
2232 AcpiDmDumpPmtt (
2233     ACPI_TABLE_HEADER       *Table)
2234 {
2235     ACPI_STATUS             Status;
2236     ACPI_PMTT_HEADER        *Subtable;
2237     UINT32                  Length = Table->Length;
2238     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
2239 
2240 
2241     /* Main table */
2242 
2243     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2244     if (ACPI_FAILURE (Status))
2245     {
2246         return;
2247     }
2248 
2249     /* Subtables */
2250 
2251     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2252     while (Offset < Table->Length)
2253     {
2254         /* Each of the types below contain the common subtable header */
2255 
2256         AcpiOsPrintf ("\n");
2257         switch (Subtable->Type)
2258         {
2259         case ACPI_PMTT_TYPE_SOCKET:
2260 
2261             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2262                 Subtable->Length, AcpiDmTableInfoPmtt0);
2263             if (ACPI_FAILURE (Status))
2264             {
2265                 return;
2266             }
2267             break;
2268 
2269         case ACPI_PMTT_TYPE_CONTROLLER:
2270             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2271                 Subtable->Length, AcpiDmTableInfoPmtt1);
2272             if (ACPI_FAILURE (Status))
2273             {
2274                 return;
2275             }
2276             break;
2277 
2278        case ACPI_PMTT_TYPE_DIMM:
2279             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2280                 Subtable->Length, AcpiDmTableInfoPmtt2);
2281             if (ACPI_FAILURE (Status))
2282             {
2283                 return;
2284             }
2285             break;
2286 
2287         case ACPI_PMTT_TYPE_VENDOR:
2288             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2289                 Subtable->Length, AcpiDmTableInfoPmttVendor);
2290             if (ACPI_FAILURE (Status))
2291             {
2292                 return;
2293             }
2294             break;
2295 
2296         default:
2297             AcpiOsPrintf (
2298                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2299                 Subtable->Type);
2300             return;
2301         }
2302 
2303         /* Point to next subtable */
2304 
2305         Offset += Subtable->Length;
2306         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2307             Subtable, Subtable->Length);
2308     }
2309 }
2310 
2311 
2312 /*******************************************************************************
2313  *
2314  * FUNCTION:    AcpiDmDumpPptt
2315  *
2316  * PARAMETERS:  Table               - A PMTT table
2317  *
2318  * RETURN:      None
2319  *
2320  * DESCRIPTION: Format the contents of a PPTT. This table type consists
2321  *              of an open-ended number of subtables.
2322  *
2323  ******************************************************************************/
2324 
2325 void
2326 AcpiDmDumpPptt (
2327     ACPI_TABLE_HEADER       *Table)
2328 {
2329     ACPI_STATUS             Status;
2330     ACPI_SUBTABLE_HEADER    *Subtable;
2331     ACPI_PPTT_PROCESSOR     *PpttProcessor;
2332     UINT8                   Length;
2333     UINT8                   SubtableOffset;
2334     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
2335     ACPI_DMTABLE_INFO       *InfoTable;
2336     UINT32                  i;
2337 
2338 
2339     /* There is no main table (other than the standard ACPI header) */
2340 
2341     /* Subtables */
2342 
2343     Offset = sizeof (ACPI_TABLE_HEADER);
2344     while (Offset < Table->Length)
2345     {
2346         AcpiOsPrintf ("\n");
2347 
2348         /* Common subtable header */
2349 
2350         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2351         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
2352         {
2353             AcpiOsPrintf ("Invalid subtable length\n");
2354             return;
2355         }
2356         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2357             Subtable->Length, AcpiDmTableInfoPpttHdr);
2358         if (ACPI_FAILURE (Status))
2359         {
2360             return;
2361         }
2362 
2363         switch (Subtable->Type)
2364         {
2365         case ACPI_PPTT_TYPE_PROCESSOR:
2366 
2367             InfoTable = AcpiDmTableInfoPptt0;
2368             Length = sizeof (ACPI_PPTT_PROCESSOR);
2369             break;
2370 
2371         case ACPI_PPTT_TYPE_CACHE:
2372 
2373             InfoTable = AcpiDmTableInfoPptt1;
2374             Length = sizeof (ACPI_PPTT_CACHE);
2375             break;
2376 
2377         case ACPI_PPTT_TYPE_ID:
2378 
2379             InfoTable = AcpiDmTableInfoPptt2;
2380             Length = sizeof (ACPI_PPTT_ID);
2381             break;
2382 
2383         default:
2384 
2385             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
2386                 Subtable->Type);
2387 
2388             /* Attempt to continue */
2389 
2390             goto NextSubtable;
2391         }
2392 
2393         if (Subtable->Length < Length)
2394         {
2395             AcpiOsPrintf ("Invalid subtable length\n");
2396             return;
2397         }
2398         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2399             Subtable->Length, InfoTable);
2400         if (ACPI_FAILURE (Status))
2401         {
2402             return;
2403         }
2404         SubtableOffset = Length;
2405 
2406         switch (Subtable->Type)
2407         {
2408         case ACPI_PPTT_TYPE_PROCESSOR:
2409 
2410             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
2411 
2412             /* Dump SMBIOS handles */
2413 
2414             if ((UINT8)(Subtable->Length - SubtableOffset) <
2415                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
2416             {
2417                 AcpiOsPrintf ("Invalid private resource number\n");
2418                 return;
2419             }
2420             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
2421             {
2422                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2423                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2424                     4, AcpiDmTableInfoPptt0a);
2425                 if (ACPI_FAILURE (Status))
2426                 {
2427                     return;
2428                 }
2429 
2430                 SubtableOffset += 4;
2431             }
2432             break;
2433 
2434         case ACPI_PPTT_TYPE_CACHE:
2435 
2436             if (Table->Revision < 3)
2437             {
2438                 break;
2439             }
2440             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2441                 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2442                 sizeof (ACPI_PPTT_CACHE_V1), AcpiDmTableInfoPptt1a);
2443             if (ACPI_FAILURE (Status))
2444             {
2445                 return;
2446             }
2447             break;
2448 
2449         default:
2450 
2451             break;
2452         }
2453 
2454 NextSubtable:
2455         /* Point to next subtable */
2456 
2457         Offset += Subtable->Length;
2458     }
2459 }
2460 
2461 
2462 /*******************************************************************************
2463  *
2464  * FUNCTION:    AcpiDmDumpPrmt
2465  *
2466  * PARAMETERS:  Table               - A PRMT table
2467  *
2468  * RETURN:      None
2469  *
2470  * DESCRIPTION: Format the contents of a PRMT. This table type consists
2471  *              of an open-ended number of subtables.
2472  *
2473  ******************************************************************************/
2474 
2475 void
2476 AcpiDmDumpPrmt (
2477     ACPI_TABLE_HEADER       *Table)
2478 {
2479     UINT32                  CurrentOffset = sizeof (ACPI_TABLE_HEADER);
2480     ACPI_TABLE_PRMT_HEADER  *PrmtHeader;
2481     ACPI_PRMT_MODULE_INFO   *PrmtModuleInfo;
2482     ACPI_PRMT_HANDLER_INFO  *PrmtHandlerInfo;
2483     ACPI_STATUS             Status;
2484     UINT32                  i, j;
2485 
2486 
2487     /* Main table header */
2488 
2489     PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
2490     Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
2491         sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
2492     if (ACPI_FAILURE (Status))
2493     {
2494         AcpiOsPrintf ("Invalid PRMT header\n");
2495         return;
2496     }
2497 
2498     CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER);
2499 
2500     /* PRM Module Information Structure array */
2501 
2502     for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
2503     {
2504         PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
2505         Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
2506             sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
2507 
2508         CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
2509 
2510         /* PRM handler information structure array */
2511 
2512         for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
2513         {
2514             PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
2515             Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
2516                 sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
2517 
2518             CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
2519         }
2520     }
2521 }
2522 
2523 
2524 /*******************************************************************************
2525  *
2526  * FUNCTION:    AcpiDmDumpRgrt
2527  *
2528  * PARAMETERS:  Table               - A RGRT table
2529  *
2530  * RETURN:      None
2531  *
2532  * DESCRIPTION: Format the contents of a RGRT
2533  *
2534  ******************************************************************************/
2535 
2536 void
2537 AcpiDmDumpRgrt (
2538     ACPI_TABLE_HEADER       *Table)
2539 {
2540     ACPI_STATUS             Status;
2541     ACPI_TABLE_RGRT         *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table);
2542     UINT32                  Offset = sizeof (ACPI_TABLE_RGRT);
2543 
2544 
2545     /* Main table */
2546 
2547     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt);
2548     if (ACPI_FAILURE (Status))
2549     {
2550         return;
2551     }
2552 
2553     /* Dump the binary image as a subtable */
2554 
2555     Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image,
2556         Table->Length - Offset, AcpiDmTableInfoRgrt0);
2557     if (ACPI_FAILURE (Status))
2558     {
2559         return;
2560     }
2561 }
2562 
2563 
2564 /*******************************************************************************
2565  *
2566  * FUNCTION:    AcpiDmDumpS3pt
2567  *
2568  * PARAMETERS:  Table               - A S3PT table
2569  *
2570  * RETURN:      Length of the table
2571  *
2572  * DESCRIPTION: Format the contents of a S3PT
2573  *
2574  ******************************************************************************/
2575 
2576 UINT32
2577 AcpiDmDumpS3pt (
2578     ACPI_TABLE_HEADER       *Tables)
2579 {
2580     ACPI_STATUS             Status;
2581     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
2582     ACPI_FPDT_HEADER        *Subtable;
2583     ACPI_DMTABLE_INFO       *InfoTable;
2584     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2585 
2586 
2587     /* Main table */
2588 
2589     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2590     if (ACPI_FAILURE (Status))
2591     {
2592         return 0;
2593     }
2594 
2595     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
2596     while (Offset < S3ptTable->Length)
2597     {
2598         /* Common subtable header */
2599 
2600         AcpiOsPrintf ("\n");
2601         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2602             Subtable->Length, AcpiDmTableInfoS3ptHdr);
2603         if (ACPI_FAILURE (Status))
2604         {
2605             return 0;
2606         }
2607 
2608         switch (Subtable->Type)
2609         {
2610         case ACPI_S3PT_TYPE_RESUME:
2611 
2612             InfoTable = AcpiDmTableInfoS3pt0;
2613             break;
2614 
2615         case ACPI_S3PT_TYPE_SUSPEND:
2616 
2617             InfoTable = AcpiDmTableInfoS3pt1;
2618             break;
2619 
2620         default:
2621 
2622             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
2623                 Subtable->Type);
2624 
2625             /* Attempt to continue */
2626 
2627             if (!Subtable->Length)
2628             {
2629                 AcpiOsPrintf ("Invalid zero length subtable\n");
2630                 return 0;
2631             }
2632             goto NextSubtable;
2633         }
2634 
2635         AcpiOsPrintf ("\n");
2636         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2637             Subtable->Length, InfoTable);
2638         if (ACPI_FAILURE (Status))
2639         {
2640             return 0;
2641         }
2642 
2643 NextSubtable:
2644         /* Point to next subtable */
2645 
2646         Offset += Subtable->Length;
2647         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
2648     }
2649 
2650     return (S3ptTable->Length);
2651 }
2652 
2653 
2654 /*******************************************************************************
2655  *
2656  * FUNCTION:    AcpiDmDumpSdev
2657  *
2658  * PARAMETERS:  Table               - A SDEV table
2659  *
2660  * RETURN:      None
2661  *
2662  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
2663  *              table that contains variable strings and vendor data.
2664  *
2665  ******************************************************************************/
2666 
2667 void
2668 AcpiDmDumpSdev (
2669     ACPI_TABLE_HEADER       *Table)
2670 {
2671     ACPI_STATUS                 Status;
2672     ACPI_SDEV_HEADER            *Subtable;
2673     ACPI_SDEV_PCIE              *Pcie;
2674     ACPI_SDEV_NAMESPACE         *Namesp;
2675     ACPI_DMTABLE_INFO           *InfoTable;
2676     ACPI_DMTABLE_INFO           *SecureComponentInfoTable;
2677     UINT32                      Length = Table->Length;
2678     UINT32                      Offset = sizeof (ACPI_TABLE_SDEV);
2679     UINT16                      PathOffset;
2680     UINT16                      PathLength;
2681     UINT16                      VendorDataOffset;
2682     UINT16                      VendorDataLength;
2683     ACPI_SDEV_SECURE_COMPONENT  *SecureComponent = NULL;
2684     UINT32                      CurrentOffset = 0;
2685 
2686 
2687     /* Main table */
2688 
2689     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
2690     if (ACPI_FAILURE (Status))
2691     {
2692         return;
2693     }
2694 
2695     /* Subtables */
2696 
2697     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
2698     while (Offset < Table->Length)
2699     {
2700         /* Common subtable header */
2701 
2702         AcpiOsPrintf ("\n");
2703         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2704             Subtable->Length, AcpiDmTableInfoSdevHdr);
2705         if (ACPI_FAILURE (Status))
2706         {
2707             return;
2708         }
2709 
2710         switch (Subtable->Type)
2711         {
2712         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2713 
2714             InfoTable = AcpiDmTableInfoSdev0;
2715             break;
2716 
2717         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2718 
2719             InfoTable = AcpiDmTableInfoSdev1;
2720             break;
2721 
2722         default:
2723             goto NextSubtable;
2724         }
2725 
2726         AcpiOsPrintf ("\n");
2727         Status = AcpiDmDumpTable (Table->Length, 0, Subtable,
2728             Subtable->Length, InfoTable);
2729         if (ACPI_FAILURE (Status))
2730         {
2731             return;
2732         }
2733 
2734         switch (Subtable->Type)
2735         {
2736         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2737 
2738             CurrentOffset = sizeof (ACPI_SDEV_NAMESPACE);
2739             if (Subtable->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
2740             {
2741                 SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
2742                     ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)));
2743 
2744                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2745                     ACPI_ADD_PTR(UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)),
2746                     sizeof (ACPI_SDEV_SECURE_COMPONENT), AcpiDmTableInfoSdev0b);
2747                 if (ACPI_FAILURE (Status))
2748                 {
2749                     return;
2750                 }
2751                 CurrentOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
2752 
2753                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2754                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
2755                     sizeof (ACPI_SDEV_HEADER), AcpiDmTableInfoSdevSecCompHdr);
2756                 if (ACPI_FAILURE (Status))
2757                 {
2758                     return;
2759                 }
2760                 CurrentOffset += sizeof (ACPI_SDEV_HEADER);
2761 
2762                 switch (Subtable->Type)
2763                 {
2764                 case ACPI_SDEV_TYPE_ID_COMPONENT:
2765 
2766                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
2767                     break;
2768 
2769                 case ACPI_SDEV_TYPE_MEM_COMPONENT:
2770 
2771                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
2772                     break;
2773 
2774                 default:
2775                     goto NextSubtable;
2776                 }
2777 
2778                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2779                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
2780                     SecureComponent->SecureComponentLength, SecureComponentInfoTable);
2781                 CurrentOffset += SecureComponent->SecureComponentLength;
2782             }
2783 
2784             /* Dump the PCIe device ID(s) */
2785 
2786             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
2787             PathOffset = Namesp->DeviceIdOffset;
2788             PathLength = Namesp->DeviceIdLength;
2789 
2790             if (PathLength)
2791             {
2792                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2793                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
2794                     PathLength, AcpiDmTableInfoSdev0a);
2795                 if (ACPI_FAILURE (Status))
2796                 {
2797                     return;
2798                 }
2799                 CurrentOffset += PathLength;
2800             }
2801 
2802             /* Dump the vendor-specific data */
2803 
2804             VendorDataLength =
2805                 Namesp->VendorDataLength;
2806             VendorDataOffset =
2807                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
2808 
2809             if (VendorDataLength)
2810             {
2811                 Status = AcpiDmDumpTable (Table->Length, 0,
2812                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
2813                     VendorDataLength, AcpiDmTableInfoSdev1b);
2814                 if (ACPI_FAILURE (Status))
2815                 {
2816                     return;
2817                 }
2818             }
2819             break;
2820 
2821         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2822 
2823             /* PCI path substructures */
2824 
2825             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
2826             PathOffset = Pcie->PathOffset;
2827             PathLength = Pcie->PathLength;
2828 
2829             while (PathLength)
2830             {
2831                 Status = AcpiDmDumpTable (Table->Length,
2832                     PathOffset + Offset,
2833                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
2834                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
2835                 if (ACPI_FAILURE (Status))
2836                 {
2837                     return;
2838                 }
2839 
2840                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
2841                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
2842             }
2843 
2844             /* VendorData */
2845 
2846             VendorDataLength = Pcie->VendorDataLength;
2847             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
2848 
2849             if (VendorDataLength)
2850             {
2851                 Status = AcpiDmDumpTable (Table->Length, 0,
2852                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
2853                     VendorDataLength, AcpiDmTableInfoSdev1b);
2854                 if (ACPI_FAILURE (Status))
2855                 {
2856                     return;
2857                 }
2858             }
2859             break;
2860 
2861         default:
2862             goto NextSubtable;
2863         }
2864 
2865 NextSubtable:
2866         /* Point to next subtable */
2867 
2868         Offset += Subtable->Length;
2869         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
2870             Subtable->Length);
2871     }
2872 }
2873