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