xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump2.c (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
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 - 2023, 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 
879 
880     /* Main table */
881 
882     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
883     if (ACPI_FAILURE (Status))
884     {
885         return;
886     }
887 
888     /* Subtables */
889 
890     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
891     DbgPrint (ASL_PARSE_OUTPUT, "//0B) Offset %X, from table start: 0x%8.8X%8.8X\n",
892         Offset, ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
893     while (Offset < Table->Length)
894     {
895         /* Common subtable header */
896 
897         AcpiOsPrintf ("\n");
898         Status = AcpiDmDumpTable (Length, Offset, Subtable,
899             Subtable->Length, AcpiDmTableInfoMadtHdr);
900         if (ACPI_FAILURE (Status))
901         {
902             return;
903         }
904 
905         DbgPrint (ASL_PARSE_OUTPUT, "subtableType: %X\n", Subtable->Type);
906         switch (Subtable->Type)
907         {
908         case ACPI_MADT_TYPE_LOCAL_APIC:
909 
910             InfoTable = AcpiDmTableInfoMadt0;
911             break;
912 
913         case ACPI_MADT_TYPE_IO_APIC:
914 
915             InfoTable = AcpiDmTableInfoMadt1;
916             break;
917 
918         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
919 
920             InfoTable = AcpiDmTableInfoMadt2;
921             break;
922 
923         case ACPI_MADT_TYPE_NMI_SOURCE:
924 
925             InfoTable = AcpiDmTableInfoMadt3;
926             break;
927 
928         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
929 
930             InfoTable = AcpiDmTableInfoMadt4;
931             break;
932 
933         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
934 
935             InfoTable = AcpiDmTableInfoMadt5;
936             break;
937 
938         case ACPI_MADT_TYPE_IO_SAPIC:
939 
940             InfoTable = AcpiDmTableInfoMadt6;
941             break;
942 
943         case ACPI_MADT_TYPE_LOCAL_SAPIC:
944 
945             InfoTable = AcpiDmTableInfoMadt7;
946             break;
947 
948         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
949 
950             InfoTable = AcpiDmTableInfoMadt8;
951             break;
952 
953         case ACPI_MADT_TYPE_LOCAL_X2APIC:
954 
955             InfoTable = AcpiDmTableInfoMadt9;
956             break;
957 
958         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
959 
960             InfoTable = AcpiDmTableInfoMadt10;
961             break;
962 
963         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
964 
965             InfoTable = AcpiDmTableInfoMadt11;
966             break;
967 
968         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
969 
970             InfoTable = AcpiDmTableInfoMadt12;
971             break;
972 
973         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
974 
975             InfoTable = AcpiDmTableInfoMadt13;
976             break;
977 
978         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
979 
980             InfoTable = AcpiDmTableInfoMadt14;
981             break;
982 
983         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
984 
985             InfoTable = AcpiDmTableInfoMadt15;
986             break;
987 
988         case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
989 
990             InfoTable = AcpiDmTableInfoMadt16;
991             break;
992 
993         case ACPI_MADT_TYPE_CORE_PIC:
994 
995             InfoTable = AcpiDmTableInfoMadt17;
996             break;
997 
998         case ACPI_MADT_TYPE_LIO_PIC:
999 
1000             InfoTable = AcpiDmTableInfoMadt18;
1001             break;
1002 
1003         case ACPI_MADT_TYPE_HT_PIC:
1004 
1005             InfoTable = AcpiDmTableInfoMadt19;
1006             break;
1007 
1008         case ACPI_MADT_TYPE_EIO_PIC:
1009 
1010             InfoTable = AcpiDmTableInfoMadt20;
1011             break;
1012 
1013         case ACPI_MADT_TYPE_MSI_PIC:
1014 
1015             InfoTable = AcpiDmTableInfoMadt21;
1016             break;
1017 
1018         case ACPI_MADT_TYPE_BIO_PIC:
1019 
1020             InfoTable = AcpiDmTableInfoMadt22;
1021             break;
1022 
1023         case ACPI_MADT_TYPE_LPC_PIC:
1024 
1025             InfoTable = AcpiDmTableInfoMadt23;
1026             break;
1027 
1028         case ACPI_MADT_TYPE_RINTC:
1029 
1030             InfoTable = AcpiDmTableInfoMadt24;
1031             break;
1032 
1033         case ACPI_MADT_TYPE_IMSIC:
1034 
1035             InfoTable = AcpiDmTableInfoMadt25;
1036             break;
1037 
1038         case ACPI_MADT_TYPE_APLIC:
1039 
1040             InfoTable = AcpiDmTableInfoMadt26;
1041             break;
1042 
1043         case ACPI_MADT_TYPE_PLIC:
1044 
1045             InfoTable = AcpiDmTableInfoMadt27;
1046             break;
1047 
1048         default:
1049 
1050             if ((Subtable->Type >= ACPI_MADT_TYPE_RESERVED) &&
1051                 (Subtable->Type < ACPI_MADT_TYPE_OEM_RESERVED))
1052             {
1053                 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
1054                     Subtable->Type);
1055                 goto NextSubtable;
1056             }
1057             else if (Subtable->Type >= ACPI_MADT_TYPE_OEM_RESERVED)
1058             {
1059                 DbgPrint (ASL_PARSE_OUTPUT, "//[Found an OEM structure, type = %0x]\n",
1060                     Subtable->Type);
1061                 Offset += sizeof (ACPI_SUBTABLE_HEADER);
1062                 DbgPrint (ASL_PARSE_OUTPUT, "//[0) Subtable->Length = %X, Subtable = %p, Offset = %X]\n",
1063                     Subtable->Length, Subtable, Offset);
1064                 DbgPrint (ASL_PARSE_OUTPUT, "//[0A) Offset from table start: 0x%8.8X%8.8X]\n",
1065                     ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
1066             }
1067 
1068             /* Attempt to continue */
1069 
1070             if (!Subtable->Length)
1071             {
1072                 AcpiOsPrintf ("Invalid zero length subtable\n");
1073                 return;
1074             }
1075 
1076             /* Dump the OEM data */
1077 
1078             Status = AcpiDmDumpTable (Length, Offset, ACPI_CAST_PTR (UINT8, Table) + Offset,
1079                 Subtable->Length - sizeof (ACPI_SUBTABLE_HEADER), AcpiDmTableInfoMadt128);
1080             if (ACPI_FAILURE (Status))
1081             {
1082                 return;
1083             }
1084 
1085             DbgPrint (ASL_PARSE_OUTPUT, "//[1) Subtable->Length = %X, Offset = %X]\n",
1086                 Subtable->Length, Offset);
1087             Offset -= sizeof (ACPI_SUBTABLE_HEADER);
1088 
1089             goto NextSubtable;
1090         }
1091 
1092         DbgPrint (ASL_PARSE_OUTPUT, "//[2) Subtable->Length = %X, Offset = %X]\n",
1093             Subtable->Length, Offset);
1094         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1095             Subtable->Length, InfoTable);
1096         if (ACPI_FAILURE (Status))
1097         {
1098             return;
1099         }
1100 
1101 NextSubtable:
1102         /* Point to next subtable */
1103 
1104         DbgPrint (ASL_PARSE_OUTPUT, "//[3) Subtable->Length = %X, Offset = %X]\n",
1105             Subtable->Length, Offset);
1106         DbgPrint (ASL_PARSE_OUTPUT, "//[4) Offset from table start: 0x%8.8X%8.8X (%p) %p]\n",
1107             ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (UINT8, Subtable) - ACPI_CAST_PTR (UINT8, Table)), Subtable, Table);
1108         if (Offset > Table->Length)
1109         {
1110             return;
1111         }
1112 
1113         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
1114             Subtable->Length);
1115 
1116         Offset = ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table);
1117         if (Offset >= Table->Length)
1118         {
1119             return;
1120         }
1121 
1122         DbgPrint (ASL_PARSE_OUTPUT, "//[5) Next Subtable %p, length %X]\n",
1123             Subtable, Subtable->Length);
1124         DbgPrint (ASL_PARSE_OUTPUT, "//[5B) Offset from table start: 0x%8.8X%8.8X (%p)]\n",
1125             ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)), Subtable);
1126     }
1127 }
1128 
1129 
1130 /*******************************************************************************
1131  *
1132  * FUNCTION:    AcpiDmDumpMcfg
1133  *
1134  * PARAMETERS:  Table               - A MCFG Table
1135  *
1136  * RETURN:      None
1137  *
1138  * DESCRIPTION: Format the contents of a MCFG table
1139  *
1140  ******************************************************************************/
1141 
1142 void
1143 AcpiDmDumpMcfg (
1144     ACPI_TABLE_HEADER       *Table)
1145 {
1146     ACPI_STATUS             Status;
1147     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
1148     ACPI_MCFG_ALLOCATION    *Subtable;
1149 
1150 
1151     /* Main table */
1152 
1153     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1154     if (ACPI_FAILURE (Status))
1155     {
1156         return;
1157     }
1158 
1159     /* Subtables */
1160 
1161     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1162     while (Offset < Table->Length)
1163     {
1164         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1165         {
1166             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1167                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1168             return;
1169         }
1170 
1171         AcpiOsPrintf ("\n");
1172         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1173             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1174         if (ACPI_FAILURE (Status))
1175         {
1176             return;
1177         }
1178 
1179         /* Point to next subtable (each subtable is of fixed length) */
1180 
1181         Offset += sizeof (ACPI_MCFG_ALLOCATION);
1182         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
1183             sizeof (ACPI_MCFG_ALLOCATION));
1184     }
1185 }
1186 
1187 /*******************************************************************************
1188  *
1189  * FUNCTION:    AcpiDmDumpMpam
1190  *
1191  * PARAMETERS:  Table               - A MPAM table
1192  *
1193  * RETURN:      None
1194  *
1195  * DESCRIPTION: Format the contents of a MPAM table
1196  *
1197  ******************************************************************************/
1198 
1199 void
1200 AcpiDmDumpMpam (
1201     ACPI_TABLE_HEADER          *Table)
1202 {
1203     ACPI_STATUS                Status;
1204     ACPI_MPAM_MSC_NODE         *MpamMscNode;
1205     ACPI_MPAM_RESOURCE_NODE    *MpamResourceNode;
1206     ACPI_DMTABLE_INFO          *InfoTable;
1207     UINT32                     Offset = sizeof(ACPI_TABLE_HEADER);
1208     UINT32                     MpamResourceNodeLength = 0;
1209 
1210     while (Offset < Table->Length)
1211     {
1212         MpamMscNode = ACPI_ADD_PTR (ACPI_MPAM_MSC_NODE, Table, Offset);
1213 
1214         /* Subtable: MSC */
1215         Status = AcpiDmDumpTable (MpamMscNode->Length, 0, MpamMscNode, 0,
1216             AcpiDmTableInfoMpam0);
1217         if (ACPI_FAILURE (Status))
1218         {
1219             return;
1220         }
1221 
1222         /* Offset the start of the array of resources */
1223         Offset += sizeof(ACPI_MPAM_MSC_NODE);
1224 
1225         /* Subtable: MSC RIS(es) */
1226         for (UINT32 ResourceIdx = 0; ResourceIdx < MpamMscNode->NumResouceNodes; ResourceIdx++)
1227         {
1228             MpamResourceNode = ACPI_ADD_PTR (ACPI_MPAM_RESOURCE_NODE, Table, Offset);
1229 
1230             MpamResourceNodeLength = sizeof(ACPI_MPAM_RESOURCE_NODE) +
1231                 MpamResourceNode->NumFunctionalDeps * sizeof(ACPI_MPAM_FUNC_DEPS);
1232 
1233             Offset += MpamResourceNodeLength;
1234 
1235             /* Subtable: MSC RIS */
1236             Status = AcpiDmDumpTable (MpamResourceNodeLength, 0, MpamResourceNode, 0,
1237                 AcpiDmTableInfoMpam1);
1238             if (ACPI_FAILURE (Status))
1239             {
1240                 return;
1241             }
1242 
1243             switch (MpamResourceNode->LocatorType)
1244             {
1245                 case ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE:
1246                     InfoTable = AcpiDmTableInfoMpam1A;
1247                     break;
1248                 case ACPI_MPAM_LOCATION_TYPE_MEMORY:
1249                     InfoTable = AcpiDmTableInfoMpam1B;
1250                     break;
1251                 case ACPI_MPAM_LOCATION_TYPE_SMMU:
1252                     InfoTable = AcpiDmTableInfoMpam1C;
1253                     break;
1254                 case ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE:
1255                     InfoTable = AcpiDmTableInfoMpam1D;
1256                     break;
1257                 case ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE:
1258                     InfoTable = AcpiDmTableInfoMpam1E;
1259                     break;
1260                 case ACPI_MPAM_LOCATION_TYPE_INTERCONNECT:
1261                     InfoTable = AcpiDmTableInfoMpam1F;
1262                     break;
1263                 case ACPI_MPAM_LOCATION_TYPE_UNKNOWN:
1264                     InfoTable = AcpiDmTableInfoMpam1G;
1265                 default:
1266                     AcpiOsPrintf ("\n**** Unknown MPAM locator type 0x%X\n",
1267                         MpamResourceNode->LocatorType);
1268                     return;
1269             }
1270 
1271             /* Subtable: MSC Resource Locator(s) */
1272             Status = AcpiDmDumpTable (sizeof(ACPI_MPAM_RESOURCE_LOCATOR), 0,
1273                 &MpamResourceNode->Locator, 0, InfoTable);
1274             if (ACPI_FAILURE (Status))
1275             {
1276                 return;
1277             }
1278 
1279             /* Get the number of functional dependencies of an RIS */
1280             Status = AcpiDmDumpTable (sizeof(UINT32), 0, &MpamResourceNode->NumFunctionalDeps, 0,
1281                 AcpiDmTableInfoMpam1Deps);
1282             if (ACPI_FAILURE (Status))
1283             {
1284                 return;
1285             }
1286 
1287             /* Subtable: MSC functional dependencies */
1288             for (UINT32 funcDep = 0; funcDep < MpamResourceNode->NumFunctionalDeps; funcDep++)
1289             {
1290                 Status = AcpiDmDumpTable (sizeof(ACPI_MPAM_FUNC_DEPS), 0,
1291                     &MpamResourceNode->NumFunctionalDeps, 0, AcpiDmTableInfoMpam2);
1292                 if (ACPI_FAILURE (Status))
1293                 {
1294                     return;
1295                 }
1296             }
1297 
1298             AcpiOsPrintf ("\n\n");
1299         }
1300 
1301     }
1302 
1303     return;
1304 }
1305 
1306 /*******************************************************************************
1307  *
1308  * FUNCTION:    AcpiDmDumpMpst
1309  *
1310  * PARAMETERS:  Table               - A MPST Table
1311  *
1312  * RETURN:      None
1313  *
1314  * DESCRIPTION: Format the contents of a MPST table
1315  *
1316  ******************************************************************************/
1317 
1318 void
1319 AcpiDmDumpMpst (
1320     ACPI_TABLE_HEADER       *Table)
1321 {
1322     ACPI_STATUS             Status;
1323     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
1324     ACPI_MPST_POWER_NODE    *Subtable0;
1325     ACPI_MPST_POWER_STATE   *Subtable0A;
1326     ACPI_MPST_COMPONENT     *Subtable0B;
1327     ACPI_MPST_DATA_HDR      *Subtable1;
1328     ACPI_MPST_POWER_DATA    *Subtable2;
1329     UINT16                  SubtableCount;
1330     UINT32                  PowerStateCount;
1331     UINT32                  ComponentCount;
1332 
1333 
1334     /* Main table */
1335 
1336     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1337     if (ACPI_FAILURE (Status))
1338     {
1339         return;
1340     }
1341 
1342     /* Subtable: Memory Power Node(s) */
1343 
1344     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1345     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1346 
1347     while ((Offset < Table->Length) && SubtableCount)
1348     {
1349         AcpiOsPrintf ("\n");
1350         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
1351             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1352         if (ACPI_FAILURE (Status))
1353         {
1354             return;
1355         }
1356 
1357         /* Extract the sub-subtable counts */
1358 
1359         PowerStateCount = Subtable0->NumPowerStates;
1360         ComponentCount = Subtable0->NumPhysicalComponents;
1361         Offset += sizeof (ACPI_MPST_POWER_NODE);
1362 
1363         /* Sub-subtables - Memory Power State Structure(s) */
1364 
1365         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
1366             sizeof (ACPI_MPST_POWER_NODE));
1367 
1368         while (PowerStateCount)
1369         {
1370             AcpiOsPrintf ("\n");
1371             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
1372                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1373             if (ACPI_FAILURE (Status))
1374             {
1375                 return;
1376             }
1377 
1378             Subtable0A++;
1379             PowerStateCount--;
1380             Offset += sizeof (ACPI_MPST_POWER_STATE);
1381        }
1382 
1383         /* Sub-subtables - Physical Component ID Structure(s) */
1384 
1385         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
1386 
1387         if (ComponentCount)
1388         {
1389             AcpiOsPrintf ("\n");
1390         }
1391 
1392         while (ComponentCount)
1393         {
1394             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
1395                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1396             if (ACPI_FAILURE (Status))
1397             {
1398                 return;
1399             }
1400 
1401             Subtable0B++;
1402             ComponentCount--;
1403             Offset += sizeof (ACPI_MPST_COMPONENT);
1404         }
1405 
1406         /* Point to next Memory Power Node subtable */
1407 
1408         SubtableCount--;
1409         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1410             sizeof (ACPI_MPST_POWER_NODE) +
1411             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1412             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1413     }
1414 
1415     /* Subtable: Count of Memory Power State Characteristic structures */
1416 
1417     AcpiOsPrintf ("\n");
1418     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1419     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1420         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1421     if (ACPI_FAILURE (Status))
1422     {
1423         return;
1424     }
1425 
1426     SubtableCount = Subtable1->CharacteristicsCount;
1427     Offset += sizeof (ACPI_MPST_DATA_HDR);
1428 
1429     /* Subtable: Memory Power State Characteristics structure(s) */
1430 
1431     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1432         sizeof (ACPI_MPST_DATA_HDR));
1433 
1434     while ((Offset < Table->Length) && SubtableCount)
1435     {
1436         AcpiOsPrintf ("\n");
1437         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1438             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1439         if (ACPI_FAILURE (Status))
1440         {
1441             return;
1442         }
1443 
1444         Subtable2++;
1445         SubtableCount--;
1446         Offset += sizeof (ACPI_MPST_POWER_DATA);
1447     }
1448 }
1449 
1450 
1451 /*******************************************************************************
1452  *
1453  * FUNCTION:    AcpiDmDumpMsct
1454  *
1455  * PARAMETERS:  Table               - A MSCT table
1456  *
1457  * RETURN:      None
1458  *
1459  * DESCRIPTION: Format the contents of a MSCT
1460  *
1461  ******************************************************************************/
1462 
1463 void
1464 AcpiDmDumpMsct (
1465     ACPI_TABLE_HEADER       *Table)
1466 {
1467     ACPI_STATUS             Status;
1468     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1469     ACPI_MSCT_PROXIMITY     *Subtable;
1470 
1471 
1472     /* Main table */
1473 
1474     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1475     if (ACPI_FAILURE (Status))
1476     {
1477         return;
1478     }
1479 
1480     /* Subtables */
1481 
1482     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1483     while (Offset < Table->Length)
1484     {
1485         /* Common subtable header */
1486 
1487         AcpiOsPrintf ("\n");
1488         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1489             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1490         if (ACPI_FAILURE (Status))
1491         {
1492             return;
1493         }
1494 
1495         /* Point to next subtable */
1496 
1497         Offset += sizeof (ACPI_MSCT_PROXIMITY);
1498         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1499             sizeof (ACPI_MSCT_PROXIMITY));
1500     }
1501 }
1502 
1503 
1504 /*******************************************************************************
1505  *
1506  * FUNCTION:    AcpiDmDumpNfit
1507  *
1508  * PARAMETERS:  Table               - A NFIT table
1509  *
1510  * RETURN:      None
1511  *
1512  * DESCRIPTION: Format the contents of an NFIT.
1513  *
1514  ******************************************************************************/
1515 
1516 void
1517 AcpiDmDumpNfit (
1518     ACPI_TABLE_HEADER       *Table)
1519 {
1520     ACPI_STATUS             Status;
1521     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
1522     UINT32                  FieldOffset = 0;
1523     UINT32                  Length;
1524     ACPI_NFIT_HEADER        *Subtable;
1525     ACPI_DMTABLE_INFO       *InfoTable;
1526     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
1527     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
1528     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1529     UINT32                  i;
1530 
1531 
1532     /* Main table */
1533 
1534     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1535     if (ACPI_FAILURE (Status))
1536     {
1537         return;
1538     }
1539 
1540     /* Subtables */
1541 
1542     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1543     while (Offset < Table->Length)
1544     {
1545         /* NFIT subtable header */
1546 
1547         AcpiOsPrintf ("\n");
1548         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1549             Subtable->Length, AcpiDmTableInfoNfitHdr);
1550         if (ACPI_FAILURE (Status))
1551         {
1552             return;
1553         }
1554 
1555         switch (Subtable->Type)
1556         {
1557         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1558 
1559             InfoTable = AcpiDmTableInfoNfit0;
1560             break;
1561 
1562         case ACPI_NFIT_TYPE_MEMORY_MAP:
1563 
1564             InfoTable = AcpiDmTableInfoNfit1;
1565             break;
1566 
1567         case ACPI_NFIT_TYPE_INTERLEAVE:
1568 
1569             /* Has a variable number of 32-bit values at the end */
1570 
1571             InfoTable = AcpiDmTableInfoNfit2;
1572             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1573             break;
1574 
1575         case ACPI_NFIT_TYPE_SMBIOS:
1576 
1577             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1578             InfoTable = AcpiDmTableInfoNfit3;
1579             break;
1580 
1581         case ACPI_NFIT_TYPE_CONTROL_REGION:
1582 
1583             InfoTable = AcpiDmTableInfoNfit4;
1584             break;
1585 
1586         case ACPI_NFIT_TYPE_DATA_REGION:
1587 
1588             InfoTable = AcpiDmTableInfoNfit5;
1589             break;
1590 
1591         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1592 
1593             /* Has a variable number of 64-bit addresses at the end */
1594 
1595             InfoTable = AcpiDmTableInfoNfit6;
1596             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS);
1597             break;
1598 
1599         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
1600 
1601             InfoTable = AcpiDmTableInfoNfit7;
1602             break;
1603 
1604         default:
1605             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1606                 Subtable->Type);
1607 
1608             /* Attempt to continue */
1609 
1610             if (!Subtable->Length)
1611             {
1612                 AcpiOsPrintf ("Invalid zero length subtable\n");
1613                 return;
1614             }
1615             goto NextSubtable;
1616         }
1617 
1618         AcpiOsPrintf ("\n");
1619         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1620             Subtable->Length, InfoTable);
1621         if (ACPI_FAILURE (Status))
1622         {
1623             return;
1624         }
1625 
1626         /* Per-subtable variable-length fields */
1627 
1628         switch (Subtable->Type)
1629         {
1630         case ACPI_NFIT_TYPE_INTERLEAVE:
1631 
1632             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1633             for (i = 0; i < Interleave->LineCount; i++)
1634             {
1635                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1636                     &Interleave->LineOffset[i],
1637                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
1638                 if (ACPI_FAILURE (Status))
1639                 {
1640                     return;
1641                 }
1642 
1643                 FieldOffset += sizeof (UINT32);
1644             }
1645             break;
1646 
1647         case ACPI_NFIT_TYPE_SMBIOS:
1648 
1649             Length = Subtable->Length -
1650                 sizeof (ACPI_NFIT_SMBIOS);
1651 
1652             if (Length)
1653             {
1654                 Status = AcpiDmDumpTable (Table->Length,
1655                     sizeof (ACPI_NFIT_SMBIOS),
1656                     SmbiosInfo,
1657                     Length, AcpiDmTableInfoNfit3a);
1658                 if (ACPI_FAILURE (Status))
1659                 {
1660                     return;
1661                 }
1662             }
1663 
1664             break;
1665 
1666         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1667 
1668             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1669             for (i = 0; i < Hint->HintCount; i++)
1670             {
1671                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1672                     &Hint->HintAddress[i],
1673                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
1674                 if (ACPI_FAILURE (Status))
1675                 {
1676                     return;
1677                 }
1678 
1679                 FieldOffset += sizeof (UINT64);
1680             }
1681             break;
1682 
1683         default:
1684             break;
1685         }
1686 
1687 NextSubtable:
1688         /* Point to next subtable */
1689 
1690         Offset += Subtable->Length;
1691         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1692     }
1693 }
1694 
1695 
1696 /*******************************************************************************
1697  *
1698  * FUNCTION:    AcpiDmDumpNhlt
1699  *
1700  * PARAMETERS:  Table               - A NHLT table
1701  *
1702  * RETURN:      None
1703  *
1704  * DESCRIPTION: Format the contents of an NHLT.
1705  *
1706  ******************************************************************************/
1707 
1708 void
1709 AcpiDmDumpNhlt (
1710     ACPI_TABLE_HEADER       *Table)
1711 {
1712     ACPI_STATUS             Status;
1713     UINT32                  Offset;
1714     UINT32                  TableLength = Table->Length;
1715     UINT32                  EndpointCount;
1716     UINT8                   FormatsCount;
1717     ACPI_NHLT_ENDPOINT      *Subtable;
1718     ACPI_NHLT_FORMAT_CONFIG *FormatSubtable;
1719     ACPI_TABLE_NHLT         *InfoTable;
1720     UINT32                  CapabilitiesSize;
1721     UINT32                  i;
1722     UINT32                  j;
1723     UINT32                  EndpointEndOffset;
1724     UINT8                   ConfigType = 0;
1725     UINT8                   ArrayType;
1726     UINT8                   MicrophoneCount;
1727     ACPI_NHLT_VENDOR_MIC_COUNT          *MicCount;
1728     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A  *DevSpecific;
1729     ACPI_NHLT_FORMATS_CONFIG            *FormatsConfig;
1730     ACPI_NHLT_DEVICE_INFO_COUNT         *Count;
1731     ACPI_NHLT_DEVICE_INFO               *DeviceInfo;
1732     ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B  *Capabilities;
1733 
1734 
1735     /* Main table */
1736 
1737     AcpiOsPrintf ("    /* Main table */\n");
1738 
1739     Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNhlt);
1740     if (ACPI_FAILURE (Status))
1741     {
1742         return;
1743     }
1744 
1745     /* Get the Endpoint Descriptor Count */
1746 
1747     InfoTable = ACPI_ADD_PTR (ACPI_TABLE_NHLT, Table, 0);
1748     EndpointCount = InfoTable->EndpointCount;
1749 
1750     /* Subtables */
1751 
1752     Offset = sizeof (ACPI_TABLE_NHLT);
1753 
1754     while (Offset < TableLength)
1755     {
1756         /* A variable number of Endpoint Descriptors - process each */
1757 
1758         for (i = 0; i < EndpointCount; i++)
1759         {
1760             /* Do the Endpoint Descriptor table */
1761 
1762             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1763 
1764             /* Check for endpoint descriptor length beyond end-of-table */
1765 
1766             if (Subtable->DescriptorLength > TableLength)
1767             {
1768                 Offset += 1;
1769                 AcpiOsPrintf ("\n    /* Endpoint Descriptor Length larger than"
1770                     " table size: %X, table %X, adjusting table offset (+1) */\n",
1771                     Subtable->DescriptorLength, TableLength);
1772 
1773                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1774             }
1775 
1776             AcpiOsPrintf ("\n    /* Endpoint Descriptor #%u */\n", i+1);
1777             Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
1778                 Subtable->DescriptorLength, AcpiDmTableInfoNhlt0);
1779             if (ACPI_FAILURE (Status))
1780             {
1781                 return;
1782             }
1783 
1784             EndpointEndOffset = Subtable->DescriptorLength + Offset;
1785 
1786             /* Check for endpoint descriptor beyond end-of-table */
1787 
1788             if (Subtable->DescriptorLength > TableLength)
1789             {
1790                 AcpiOsPrintf ("\n    /* Endpoint Descriptor Length larger than table size: %X, table %X */\n",
1791                     Subtable->DescriptorLength, TableLength);
1792             }
1793 
1794             Offset += sizeof (ACPI_NHLT_ENDPOINT);
1795             Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1796 
1797             /* Do the Device Specific table */
1798 
1799             AcpiOsPrintf ("\n    /* Endpoint Device_Specific_Config table */\n");
1800             DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1801             CapabilitiesSize = DevSpecific->CapabilitiesSize;
1802             Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1803                 sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
1804             if (ACPI_FAILURE (Status))
1805             {
1806                 return;
1807             }
1808 
1809             ArrayType = 0;
1810 
1811             /* Different subtables based upon capabilities_size */
1812 
1813             switch (CapabilitiesSize)
1814             {
1815             case 0:
1816                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
1817                 break;
1818 
1819             case 1:
1820                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1821                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C), AcpiDmTableInfoNhlt5c);
1822                 if (ACPI_FAILURE (Status))
1823                 {
1824                     return;
1825                 }
1826                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C);
1827                 break;
1828 
1829             case 2:
1830                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1831                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
1832                 if (ACPI_FAILURE (Status))
1833                 {
1834                     return;
1835                 }
1836                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
1837                 break;
1838 
1839             case 3:
1840             default:
1841                 /* Extract the ConfigType and ArrayType */
1842 
1843                 ConfigType = DevSpecific->ConfigType;
1844                 ArrayType = DevSpecific->ArrayType;
1845 
1846                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1847                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A), AcpiDmTableInfoNhlt5a);
1848                 if (ACPI_FAILURE (Status))
1849                 {
1850                     return;
1851                 }
1852 
1853                 /* Capabilities Size == 3 */
1854                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A);
1855                 break;
1856 
1857             case 7:
1858                 ConfigType = DevSpecific->ConfigType;
1859                 Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1860                 DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1861 
1862                 AcpiOsPrintf ("\n    /* Render Feedback Device-Specific table */\n");
1863                 Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1864                     sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5);
1865                 if (ACPI_FAILURE (Status))
1866                 {
1867                     return;
1868                 }
1869 
1870                 /* Capabilities Size = 7 */
1871                 Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG);
1872 
1873                 if (ConfigType == ACPI_NHLT_CONFIG_TYPE_RENDER_FEEDBACK)
1874                 {
1875                     Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset);
1876                     DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable);
1877 
1878                     Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1879                         sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt6b);
1880                     if (ACPI_FAILURE (Status))
1881                     {
1882                         return;
1883                     }
1884                     Offset += sizeof (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG);
1885                 }
1886                 break;
1887            }
1888 
1889             /* Check for a vendor-defined mic array */
1890 
1891             if (ConfigType == ACPI_NHLT_CONFIG_TYPE_MIC_ARRAY)
1892             {
1893                 if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_MASK) == ACPI_NHLT_VENDOR_DEFINED)
1894                 {
1895                     /* Vendor-defined microphone array; get the microphone count first */
1896 
1897                     AcpiOsPrintf ("\n    /* Vendor-defined microphone count */\n");
1898                     MicCount = ACPI_ADD_PTR (ACPI_NHLT_VENDOR_MIC_COUNT, Table, Offset);
1899                     MicrophoneCount = MicCount->MicrophoneCount;
1900 
1901                     Status = AcpiDmDumpTable (TableLength, Offset, MicCount,
1902                         sizeof (ACPI_NHLT_VENDOR_MIC_COUNT), AcpiDmTableInfoNhlt6a);
1903                     Offset += sizeof (ACPI_NHLT_VENDOR_MIC_COUNT);
1904                     if (ACPI_FAILURE (Status))
1905                     {
1906                         return;
1907                     }
1908 
1909                     /* Get the vendor microphone config structure(s) */
1910 
1911                     for (j = 0; j < MicrophoneCount; j++)
1912                     {
1913                         AcpiOsPrintf ("\n    /* Vendor-defined microphone array #%u*/\n", j+1);
1914                         DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
1915 
1916                         Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1917                             sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG), AcpiDmTableInfoNhlt6);
1918                         if (ACPI_FAILURE (Status))
1919                         {
1920                             return;
1921                         }
1922 
1923                         Offset += sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG);
1924                     }
1925 
1926                     /* Check for Microphone SNR and sensitivity extension */
1927 
1928                     if ((ArrayType & ACPI_NHLT_ARRAY_TYPE_EXT_MASK) == ACPI_NHLT_MIC_SNR_SENSITIVITY_EXT)
1929                     {
1930                         AcpiOsPrintf ("\n    /* Microphone SNR and sensitivity array */\n");
1931                         DevSpecific = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Table, Offset);
1932 
1933                         Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific,
1934                             sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION), AcpiDmTableInfoNhlt9);
1935                         if (ACPI_FAILURE (Status))
1936                         {
1937                             return;
1938                         }
1939 
1940                         Offset += sizeof (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION);
1941                     }
1942                 }
1943             }
1944 
1945             /* Do the Formats_Config table - starts with the FormatsCount field */
1946 
1947             FormatsConfig = ACPI_ADD_PTR (ACPI_NHLT_FORMATS_CONFIG, Table, Offset);
1948             FormatsCount = FormatsConfig->FormatsCount;
1949 
1950             AcpiOsPrintf ("\n    /* Formats_Config table */\n");
1951 
1952             /* Dump the FormatsCount value */
1953 
1954             if (FormatsCount > 0)
1955             {
1956                 Status = AcpiDmDumpTable (TableLength, Offset, FormatsConfig,
1957                     sizeof (ACPI_NHLT_FORMATS_CONFIG), AcpiDmTableInfoNhlt4);
1958                 if (ACPI_FAILURE (Status))
1959                 {
1960                     return;
1961                 }
1962             }
1963             Offset += sizeof (ACPI_NHLT_FORMATS_CONFIG);
1964 
1965             /* A variable number of Format_Config Descriptors - process each */
1966 
1967             for (j = 0; j < FormatsCount; j++)
1968             {
1969                 FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset);
1970                 CapabilitiesSize = FormatSubtable->CapabilitySize;
1971 
1972                 /* Do the Wave_extensible struct */
1973 
1974                 AcpiOsPrintf ("\n    /* Wave_Format_Extensible table #%u */\n", j+1);
1975                 Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable,
1976                     sizeof (ACPI_NHLT_FORMAT_CONFIG), AcpiDmTableInfoNhlt3);
1977                 if (ACPI_FAILURE (Status))
1978                 {
1979                     return;
1980                 }
1981 
1982                 Offset += sizeof (ACPI_NHLT_FORMAT_CONFIG);
1983 
1984                 if (CapabilitiesSize > 0)
1985                 {
1986                     UINT8* CapabilitiesBuf = ACPI_ADD_PTR (UINT8, Table, Offset);
1987                     /* Do the Capabilities array (of bytes) */
1988 
1989                     AcpiOsPrintf ("\n    /* Specific_Config table #%u */\n", j+1);
1990 
1991                     Status = AcpiDmDumpTable (TableLength, Offset, CapabilitiesBuf,
1992                         CapabilitiesSize, AcpiDmTableInfoNhlt3a);
1993                     if (ACPI_FAILURE (Status))
1994                     {
1995                         return;
1996                     }
1997 
1998                     Offset += CapabilitiesSize; /* + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); */
1999                 }
2000 
2001             } /* for (j = 0; j < FormatsCount; j++) */
2002 
2003             /*
2004              * If we are not done with the current Endpoint yet, then there must be
2005              * some non documented structure(s) yet to be processed. First, get
2006              * the count of such structure(s).
2007              */
2008             if (Offset < EndpointEndOffset)
2009             {
2010                 AcpiOsPrintf ("\n    /* Structures that are not part of NHLT spec */\n");
2011                 Count = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO_COUNT, Table, Offset);
2012                 Status = AcpiDmDumpTable (TableLength, Offset, Count,
2013                     sizeof (ACPI_NHLT_DEVICE_INFO_COUNT), AcpiDmTableInfoNhlt7);
2014                 if (ACPI_FAILURE (Status))
2015                 {
2016                     return;
2017                 }
2018                 Offset += sizeof (ACPI_NHLT_DEVICE_INFO_COUNT);
2019 
2020                 /* Variable number of device structures */
2021 
2022                 for (j = 0; j < Count->StructureCount; j++)
2023                 {
2024                     DeviceInfo = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO, Table, Offset);
2025                     AcpiOsPrintf ("\n    /* Device Info structure #%u (not part of NHLT spec) */\n", j+1);
2026 
2027                     /*
2028                      * Dump the following Device Info fields:
2029                      *  1) Device ID
2030                      *  2) Device Instance ID
2031                      *  3) Device Port ID
2032                      */
2033                     Status = AcpiDmDumpTable (TableLength, Offset, DeviceInfo,
2034                         sizeof (ACPI_NHLT_DEVICE_INFO), AcpiDmTableInfoNhlt7a);
2035                     if (ACPI_FAILURE (Status))
2036                     {
2037                         return;
2038                     }
2039 
2040                     Offset += sizeof (ACPI_NHLT_DEVICE_INFO);
2041                 }
2042 
2043                 /*
2044                  * Check that the current offset is not beyond the end of
2045                  * this endpoint descriptor. If it is not, print those
2046                  * undocumented bytes.
2047                  */
2048                 if (Offset < EndpointEndOffset)
2049                 {
2050                     /* Unknown data at the end of the Endpoint */
2051                     UINT32 size = EndpointEndOffset - Offset;
2052                     UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
2053                     AcpiOsPrintf ("\n    /* Unknown data at the end of the Endpoint, size: %X */\n", size);
2054                     Status = AcpiDmDumpTable (TableLength, Offset, buffer,
2055                         size, AcpiDmTableInfoNhlt7b);
2056                     Offset = EndpointEndOffset;
2057                 }
2058 
2059                 /* Should be at the end of the Endpoint structure. */
2060             }
2061 
2062         } /* for (i = 0; i < EndpointCount; i++) */
2063 
2064 
2065         /*
2066          * Done with all of the Endpoint Descriptors, Emit the table terminator
2067          * (if such a legacy structure is present -- not in NHLT specification)
2068          */
2069         if (Offset < TableLength)
2070         {
2071             Capabilities = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Table, Offset);
2072             AcpiOsPrintf ("\n/* Terminating specific config (not part of NHLT spec) */\n");
2073 
2074             Status = AcpiDmDumpTable (TableLength, Offset, Capabilities,
2075                 sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b);
2076             if (ACPI_FAILURE (Status))
2077             {
2078                 return;
2079             }
2080             Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
2081 
2082             if (Capabilities->CapabilitiesSize > 0)
2083             {
2084                 UINT32 remainingBytes = TableLength - Offset;
2085                 UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
2086 
2087                 if (remainingBytes != Capabilities->CapabilitiesSize)
2088                     AcpiOsPrintf ("\n/* Incorrect config size, should be %X, is %X */\n",
2089                         Capabilities->CapabilitiesSize, remainingBytes);
2090                 Status = AcpiDmDumpTable (TableLength, Offset, buffer,
2091                         remainingBytes, AcpiDmTableInfoNhlt3a);
2092             }
2093         }
2094 
2095         return;
2096     }
2097 }
2098 
2099 
2100 /*******************************************************************************
2101  *
2102  * FUNCTION:    AcpiDmDumpPcct
2103  *
2104  * PARAMETERS:  Table               - A PCCT table
2105  *
2106  * RETURN:      None
2107  *
2108  * DESCRIPTION: Format the contents of a PCCT. This table type consists
2109  *              of an open-ended number of subtables.
2110  *
2111  ******************************************************************************/
2112 
2113 void
2114 AcpiDmDumpPcct (
2115     ACPI_TABLE_HEADER       *Table)
2116 {
2117     ACPI_STATUS             Status;
2118     ACPI_PCCT_SUBSPACE      *Subtable;
2119     ACPI_DMTABLE_INFO       *InfoTable;
2120     UINT32                  Length = Table->Length;
2121     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
2122 
2123 
2124     /* Main table */
2125 
2126     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
2127     if (ACPI_FAILURE (Status))
2128     {
2129         return;
2130     }
2131 
2132     /* Subtables */
2133 
2134     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
2135     while (Offset < Table->Length)
2136     {
2137         /* Common subtable header */
2138 
2139         AcpiOsPrintf ("\n");
2140         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2141             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
2142         if (ACPI_FAILURE (Status))
2143         {
2144             return;
2145         }
2146 
2147         switch (Subtable->Header.Type)
2148         {
2149         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
2150 
2151             InfoTable = AcpiDmTableInfoPcct0;
2152             break;
2153 
2154         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
2155 
2156             InfoTable = AcpiDmTableInfoPcct1;
2157             break;
2158 
2159         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
2160 
2161             InfoTable = AcpiDmTableInfoPcct2;
2162             break;
2163 
2164         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
2165 
2166             InfoTable = AcpiDmTableInfoPcct3;
2167             break;
2168 
2169         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
2170 
2171             InfoTable = AcpiDmTableInfoPcct4;
2172             break;
2173 
2174         case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
2175 
2176             InfoTable = AcpiDmTableInfoPcct5;
2177             break;
2178 
2179         default:
2180 
2181             AcpiOsPrintf (
2182                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2183                 Subtable->Header.Type);
2184             return;
2185         }
2186 
2187         AcpiOsPrintf ("\n");
2188         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2189             Subtable->Header.Length, InfoTable);
2190         if (ACPI_FAILURE (Status))
2191         {
2192             return;
2193         }
2194 
2195         /* Point to next subtable */
2196 
2197         Offset += Subtable->Header.Length;
2198         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
2199             Subtable->Header.Length);
2200     }
2201 }
2202 
2203 
2204 /*******************************************************************************
2205  *
2206  * FUNCTION:    AcpiDmDumpPdtt
2207  *
2208  * PARAMETERS:  Table               - A PDTT table
2209  *
2210  * RETURN:      None
2211  *
2212  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
2213  *              table that contains an open-ended number of IDs
2214  *              at the end of the table.
2215  *
2216  ******************************************************************************/
2217 
2218 void
2219 AcpiDmDumpPdtt (
2220     ACPI_TABLE_HEADER       *Table)
2221 {
2222     ACPI_STATUS             Status;
2223     ACPI_PDTT_CHANNEL       *Subtable;
2224     UINT32                  Length = Table->Length;
2225     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
2226 
2227 
2228     /* Main table */
2229 
2230     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
2231     if (ACPI_FAILURE (Status))
2232     {
2233         return;
2234     }
2235 
2236     /* Subtables. Currently there is only one type, but can be multiples */
2237 
2238     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
2239     while (Offset < Table->Length)
2240     {
2241         AcpiOsPrintf ("\n");
2242         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2243             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
2244         if (ACPI_FAILURE (Status))
2245         {
2246             return;
2247         }
2248 
2249         /* Point to next subtable */
2250 
2251         Offset += sizeof (ACPI_PDTT_CHANNEL);
2252         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
2253             sizeof (ACPI_PDTT_CHANNEL));
2254     }
2255 }
2256 
2257 
2258 /*******************************************************************************
2259  *
2260  * FUNCTION:    AcpiDmDumpPhat
2261  *
2262  * PARAMETERS:  Table               - A PHAT table
2263  *
2264  * RETURN:      None
2265  *
2266  * DESCRIPTION: Format the contents of a PHAT.
2267  *
2268  ******************************************************************************/
2269 
2270 void
2271 AcpiDmDumpPhat (
2272     ACPI_TABLE_HEADER       *Table)
2273 {
2274     ACPI_STATUS             Status;
2275     ACPI_DMTABLE_INFO       *InfoTable;
2276     ACPI_PHAT_HEADER        *Subtable;
2277     ACPI_PHAT_VERSION_DATA  *VersionData;
2278     UINT32                  RecordCount;
2279     UINT32                  Length = Table->Length;
2280     UINT32                  Offset = sizeof (ACPI_TABLE_PHAT);
2281     UINT32                  OriginalOffset;
2282     UINT32                  SubtableLength;
2283     UINT32                  PathLength;
2284     UINT32                  VendorLength;
2285     UINT16                  RecordType;
2286     const wchar_t           *WideString;
2287 
2288 
2289     Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
2290 
2291     while (Offset < Table->Length)
2292     {
2293         /* Common subtable header */
2294 
2295         AcpiOsPrintf ("\n");
2296         Status = AcpiDmDumpTable (Length, Offset, Subtable,
2297             sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
2298         if (ACPI_FAILURE (Status))
2299         {
2300             return;
2301         }
2302 
2303         DbgPrint (ASL_DEBUG_OUTPUT, "\n/* %u, Subtable->Type %X */\n",
2304             __LINE__, Subtable->Type);
2305 
2306         switch (Subtable->Type)
2307         {
2308         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2309 
2310             InfoTable = AcpiDmTableInfoPhat0;
2311             SubtableLength = Offset += sizeof (ACPI_PHAT_VERSION_DATA);
2312             break;
2313 
2314         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2315 
2316             InfoTable = AcpiDmTableInfoPhat1;
2317             SubtableLength = Offset += sizeof (ACPI_PHAT_TYPE_FW_HEALTH_DATA);
2318             break;
2319 
2320         default:
2321 
2322             DbgPrint (ASL_DEBUG_OUTPUT, "\n**** Unknown PHAT subtable type 0x%X\n\n",
2323                 Subtable->Type);
2324 
2325             return;
2326         }
2327 
2328         Status = AcpiDmDumpTable (Length, SubtableLength, Subtable,
2329             SubtableLength, InfoTable);
2330         if (ACPI_FAILURE (Status))
2331         {
2332             return;
2333         }
2334 
2335         OriginalOffset = Offset;
2336         switch (Subtable->Type)
2337         {
2338         case ACPI_PHAT_TYPE_FW_VERSION_DATA:
2339 
2340             VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
2341             RecordCount = VersionData->ElementCount;
2342             RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
2343 
2344             /*
2345              * Skip past a zero-valued block (not part of the ACPI PHAT specification).
2346              * First, check for a zero length record and a zero element count
2347              */
2348             if (!VersionData->Header.Length && !VersionData->ElementCount)
2349             {
2350                 while (RecordType == 0)
2351                 {
2352                     Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
2353                     RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
2354                     RecordCount = VersionData->ElementCount;
2355                     Offset += 1;
2356                 }
2357 
2358                 Offset -= 1;
2359                 AcpiOsPrintf ("\n/* Warning: Block of zeros found above starting at Offset %X Length %X */\n"
2360                     "/* (not compliant to PHAT specification -- ignoring block) */\n",
2361                     OriginalOffset - 12, Offset - OriginalOffset + 12);
2362             }
2363 
2364             DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, RecordCount: %X, Offset %X, SubtableLength %X */\n",
2365                 __LINE__, RecordCount, Offset, SubtableLength);
2366 
2367             /* Emit each of the version elements */
2368 
2369             while (RecordCount && VersionData->Header.Length)
2370             {
2371                 AcpiOsPrintf ("\n/* Version Element #%Xh Offset %Xh */\n\n",
2372                     VersionData->ElementCount - RecordCount + 1, Offset);
2373 
2374                 Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
2375                 Status = AcpiDmDumpTable (Length, Offset, Subtable,
2376                     sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
2377                 if (ACPI_FAILURE (Status))
2378                 {
2379                     return;
2380                 }
2381 
2382                 Offset += sizeof (ACPI_PHAT_VERSION_ELEMENT);
2383                 RecordCount--;
2384             }
2385 
2386             break;
2387 
2388         case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
2389 
2390             /*
2391              * Get the length of the Device Path (UEFI wide string).
2392              * Include the wide null terminator (+2),
2393              */
2394             WideString = ACPI_ADD_PTR (wchar_t, Subtable,
2395                 sizeof (ACPI_PHAT_HEALTH_DATA));
2396 
2397             PathLength = (wcslen (WideString) * 2) + 2;
2398             DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, PathLength %X, Offset %X, Table->Length %X */\n",
2399                 __LINE__, PathLength, Offset, Length);
2400 
2401             Status = AcpiDmDumpTable (Length, Offset,
2402                 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
2403                 PathLength, AcpiDmTableInfoPhat1a);
2404             Offset += PathLength;
2405             if (ACPI_FAILURE (Status))
2406             {
2407                 return;
2408             }
2409 
2410             /* Get Device-Specific Data - length of which is the remaining subtable length. */
2411 
2412             VendorLength =
2413                 Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
2414             DbgPrint (ASL_DEBUG_OUTPUT, "%u, Subtable->Length %X, VendorLength %X, Offset %X PathLength: %X\n",
2415                 __LINE__, Subtable->Length, VendorLength, Offset, PathLength);
2416 
2417             if (VendorLength)
2418             {
2419                 /* Point past the Device Path, Compile the Device-Specific Data */
2420 
2421                 Status = AcpiDmDumpTable (Length, Offset,
2422                     ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
2423                     VendorLength, AcpiDmTableInfoPhat1b);
2424                 if (ACPI_FAILURE (Status))
2425                 {
2426                     return;
2427                 }
2428 
2429                 Offset += VendorLength;
2430             }
2431 
2432             if (ACPI_FAILURE (Status))
2433             {
2434                 return;
2435             }
2436             break;
2437 
2438         default:
2439 
2440             AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
2441                 Subtable->Type);
2442             return;
2443         }
2444 
2445         /* Next subtable */
2446 
2447         DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, Bottom of main loop: Offset %X, "
2448             "Subtable->Length %X, Table->Length %X */\n",
2449             __LINE__, Offset, Subtable->Length, Table->Length);
2450 
2451         Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table,
2452             Offset);
2453     }
2454 }
2455 
2456 
2457 /*******************************************************************************
2458  *
2459  * FUNCTION:    AcpiDmDumpPmtt
2460  *
2461  * PARAMETERS:  Table               - A PMTT table
2462  *
2463  * RETURN:      None
2464  *
2465  * DESCRIPTION: Format the contents of a PMTT. This table type consists
2466  *              of an open-ended number of subtables.
2467  *
2468  ******************************************************************************/
2469 
2470 void
2471 AcpiDmDumpPmtt (
2472     ACPI_TABLE_HEADER       *Table)
2473 {
2474     ACPI_STATUS             Status;
2475     ACPI_PMTT_HEADER        *Subtable;
2476     UINT32                  Length = Table->Length;
2477     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
2478 
2479 
2480     /* Main table */
2481 
2482     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2483     if (ACPI_FAILURE (Status))
2484     {
2485         return;
2486     }
2487 
2488     /* Subtables */
2489 
2490     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2491     while (Offset < Table->Length)
2492     {
2493         /* Each of the types below contain the common subtable header */
2494 
2495         AcpiOsPrintf ("\n");
2496         switch (Subtable->Type)
2497         {
2498         case ACPI_PMTT_TYPE_SOCKET:
2499 
2500             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2501                 Subtable->Length, AcpiDmTableInfoPmtt0);
2502             if (ACPI_FAILURE (Status))
2503             {
2504                 return;
2505             }
2506             break;
2507 
2508         case ACPI_PMTT_TYPE_CONTROLLER:
2509             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2510                 Subtable->Length, AcpiDmTableInfoPmtt1);
2511             if (ACPI_FAILURE (Status))
2512             {
2513                 return;
2514             }
2515             break;
2516 
2517        case ACPI_PMTT_TYPE_DIMM:
2518             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2519                 Subtable->Length, AcpiDmTableInfoPmtt2);
2520             if (ACPI_FAILURE (Status))
2521             {
2522                 return;
2523             }
2524             break;
2525 
2526         case ACPI_PMTT_TYPE_VENDOR:
2527             Status = AcpiDmDumpTable (Length, Offset, Subtable,
2528                 Subtable->Length, AcpiDmTableInfoPmttVendor);
2529             if (ACPI_FAILURE (Status))
2530             {
2531                 return;
2532             }
2533             break;
2534 
2535         default:
2536             AcpiOsPrintf (
2537                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2538                 Subtable->Type);
2539             return;
2540         }
2541 
2542         /* Point to next subtable */
2543 
2544         Offset += Subtable->Length;
2545         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2546             Subtable, Subtable->Length);
2547     }
2548 }
2549 
2550 
2551 /*******************************************************************************
2552  *
2553  * FUNCTION:    AcpiDmDumpPptt
2554  *
2555  * PARAMETERS:  Table               - A PMTT table
2556  *
2557  * RETURN:      None
2558  *
2559  * DESCRIPTION: Format the contents of a PPTT. This table type consists
2560  *              of an open-ended number of subtables.
2561  *
2562  ******************************************************************************/
2563 
2564 void
2565 AcpiDmDumpPptt (
2566     ACPI_TABLE_HEADER       *Table)
2567 {
2568     ACPI_STATUS             Status;
2569     ACPI_SUBTABLE_HEADER    *Subtable;
2570     ACPI_PPTT_PROCESSOR     *PpttProcessor;
2571     UINT8                   Length;
2572     UINT8                   SubtableOffset;
2573     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
2574     ACPI_DMTABLE_INFO       *InfoTable;
2575     UINT32                  i;
2576 
2577 
2578     /* There is no main table (other than the standard ACPI header) */
2579 
2580     /* Subtables */
2581 
2582     Offset = sizeof (ACPI_TABLE_HEADER);
2583     while (Offset < Table->Length)
2584     {
2585         AcpiOsPrintf ("\n");
2586 
2587         /* Common subtable header */
2588 
2589         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2590         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
2591         {
2592             AcpiOsPrintf ("Invalid subtable length\n");
2593             return;
2594         }
2595         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2596             Subtable->Length, AcpiDmTableInfoPpttHdr);
2597         if (ACPI_FAILURE (Status))
2598         {
2599             return;
2600         }
2601 
2602         switch (Subtable->Type)
2603         {
2604         case ACPI_PPTT_TYPE_PROCESSOR:
2605 
2606             InfoTable = AcpiDmTableInfoPptt0;
2607             Length = sizeof (ACPI_PPTT_PROCESSOR);
2608             break;
2609 
2610         case ACPI_PPTT_TYPE_CACHE:
2611 
2612             InfoTable = AcpiDmTableInfoPptt1;
2613             Length = sizeof (ACPI_PPTT_CACHE);
2614             break;
2615 
2616         case ACPI_PPTT_TYPE_ID:
2617 
2618             InfoTable = AcpiDmTableInfoPptt2;
2619             Length = sizeof (ACPI_PPTT_ID);
2620             break;
2621 
2622         default:
2623 
2624             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
2625                 Subtable->Type);
2626 
2627             /* Attempt to continue */
2628 
2629             goto NextSubtable;
2630         }
2631 
2632         if (Subtable->Length < Length)
2633         {
2634             AcpiOsPrintf ("Invalid subtable length\n");
2635             return;
2636         }
2637         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2638             Subtable->Length, InfoTable);
2639         if (ACPI_FAILURE (Status))
2640         {
2641             return;
2642         }
2643         SubtableOffset = Length;
2644 
2645         switch (Subtable->Type)
2646         {
2647         case ACPI_PPTT_TYPE_PROCESSOR:
2648 
2649             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
2650 
2651             /* Dump SMBIOS handles */
2652 
2653             if ((UINT8)(Subtable->Length - SubtableOffset) <
2654                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
2655             {
2656                 AcpiOsPrintf ("Invalid private resource number\n");
2657                 return;
2658             }
2659             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
2660             {
2661                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2662                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2663                     4, AcpiDmTableInfoPptt0a);
2664                 if (ACPI_FAILURE (Status))
2665                 {
2666                     return;
2667                 }
2668 
2669                 SubtableOffset += 4;
2670             }
2671             break;
2672 
2673         case ACPI_PPTT_TYPE_CACHE:
2674 
2675             if (Table->Revision < 3)
2676             {
2677                 break;
2678             }
2679             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2680                 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2681                 sizeof (ACPI_PPTT_CACHE_V1), AcpiDmTableInfoPptt1a);
2682             if (ACPI_FAILURE (Status))
2683             {
2684                 return;
2685             }
2686             break;
2687 
2688         default:
2689 
2690             break;
2691         }
2692 
2693 NextSubtable:
2694         /* Point to next subtable */
2695 
2696         Offset += Subtable->Length;
2697     }
2698 }
2699 
2700 
2701 /*******************************************************************************
2702  *
2703  * FUNCTION:    AcpiDmDumpPrmt
2704  *
2705  * PARAMETERS:  Table               - A PRMT table
2706  *
2707  * RETURN:      None
2708  *
2709  * DESCRIPTION: Format the contents of a PRMT. This table type consists
2710  *              of an open-ended number of subtables.
2711  *
2712  ******************************************************************************/
2713 
2714 void
2715 AcpiDmDumpPrmt (
2716     ACPI_TABLE_HEADER       *Table)
2717 {
2718     UINT32                  CurrentOffset = sizeof (ACPI_TABLE_HEADER);
2719     ACPI_TABLE_PRMT_HEADER  *PrmtHeader;
2720     ACPI_PRMT_MODULE_INFO   *PrmtModuleInfo;
2721     ACPI_PRMT_HANDLER_INFO  *PrmtHandlerInfo;
2722     ACPI_STATUS             Status;
2723     UINT32                  i, j;
2724 
2725 
2726     /* Main table header */
2727 
2728     PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
2729     Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
2730         sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
2731     if (ACPI_FAILURE (Status))
2732     {
2733         AcpiOsPrintf ("Invalid PRMT header\n");
2734         return;
2735     }
2736 
2737     CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER);
2738 
2739     /* PRM Module Information Structure array */
2740 
2741     for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
2742     {
2743         PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
2744         Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
2745             sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
2746 
2747         CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
2748 
2749         /* PRM handler information structure array */
2750 
2751         for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
2752         {
2753             PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
2754             Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
2755                 sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
2756 
2757             CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
2758         }
2759     }
2760 }
2761 
2762 
2763 /*******************************************************************************
2764  *
2765  * FUNCTION:    AcpiDmDumpRgrt
2766  *
2767  * PARAMETERS:  Table               - A RGRT table
2768  *
2769  * RETURN:      None
2770  *
2771  * DESCRIPTION: Format the contents of a RGRT
2772  *
2773  ******************************************************************************/
2774 
2775 void
2776 AcpiDmDumpRgrt (
2777     ACPI_TABLE_HEADER       *Table)
2778 {
2779     ACPI_STATUS             Status;
2780     ACPI_TABLE_RGRT         *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table);
2781     UINT32                  Offset = sizeof (ACPI_TABLE_RGRT);
2782 
2783 
2784     /* Main table */
2785 
2786     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt);
2787     if (ACPI_FAILURE (Status))
2788     {
2789         return;
2790     }
2791 
2792     /* Dump the binary image as a subtable */
2793 
2794     Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image,
2795         Table->Length - Offset, AcpiDmTableInfoRgrt0);
2796     if (ACPI_FAILURE (Status))
2797     {
2798         return;
2799     }
2800 }
2801 
2802 
2803 /*******************************************************************************
2804  *
2805  * FUNCTION:    AcpiDmDumpRhct
2806  *
2807  * PARAMETERS:  Table               - A RHCT table
2808  *
2809  * RETURN:      None
2810  *
2811  * DESCRIPTION: Format the contents of a RHCT.
2812  *
2813  ******************************************************************************/
2814 
2815 void
2816 AcpiDmDumpRhct (
2817     ACPI_TABLE_HEADER       *Table)
2818 {
2819     ACPI_STATUS             Status;
2820     ACPI_RHCT_NODE_HEADER   *Subtable;
2821     ACPI_RHCT_HART_INFO     *RhctHartInfo;
2822     ACPI_RHCT_ISA_STRING    *RhctIsaString;
2823     ACPI_RHCT_CMO_NODE      *RhctCmoNode;
2824     ACPI_RHCT_MMU_NODE      *RhctMmuNode;
2825     UINT32                  Length = Table->Length;
2826     UINT8                   SubtableOffset, IsaPadOffset;
2827     UINT32                  Offset = sizeof (ACPI_TABLE_RHCT);
2828     UINT32                  i;
2829 
2830     /* Main table */
2831 
2832     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRhct);
2833     if (ACPI_FAILURE (Status))
2834     {
2835         return;
2836     }
2837 
2838     /* Subtables */
2839 
2840     while (Offset < Table->Length)
2841     {
2842         AcpiOsPrintf ("\n");
2843 
2844         /* Common subtable header */
2845 
2846         Subtable = ACPI_ADD_PTR (ACPI_RHCT_NODE_HEADER, Table, Offset);
2847         if (Subtable->Length < sizeof (ACPI_RHCT_NODE_HEADER))
2848         {
2849             AcpiOsPrintf ("Invalid subtable length\n");
2850             return;
2851         }
2852         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2853             Subtable->Length, AcpiDmTableInfoRhctNodeHdr);
2854         if (ACPI_FAILURE (Status))
2855         {
2856             return;
2857         }
2858 
2859         Length = sizeof (ACPI_RHCT_NODE_HEADER);
2860 
2861         if (Subtable->Length < Length)
2862         {
2863             AcpiOsPrintf ("Invalid subtable length\n");
2864             return;
2865         }
2866         SubtableOffset = (UINT8) Length;
2867 
2868         switch (Subtable->Type)
2869         {
2870         case ACPI_RHCT_NODE_TYPE_HART_INFO:
2871             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2872                     ACPI_ADD_PTR (ACPI_RHCT_HART_INFO, Subtable, SubtableOffset),
2873                     sizeof (ACPI_RHCT_HART_INFO), AcpiDmTableInfoRhctHartInfo1);
2874 
2875             RhctHartInfo = ACPI_ADD_PTR (ACPI_RHCT_HART_INFO, Subtable, SubtableOffset);
2876 
2877             if ((UINT16)(Subtable->Length - SubtableOffset) <
2878                 (UINT16)(RhctHartInfo->NumOffsets * 4))
2879             {
2880                 AcpiOsPrintf ("Invalid number of offsets\n");
2881                 return;
2882             }
2883             SubtableOffset += sizeof (ACPI_RHCT_HART_INFO);
2884             for (i = 0; i < RhctHartInfo->NumOffsets; i++)
2885             {
2886                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2887                     ACPI_ADD_PTR (UINT32, Subtable, SubtableOffset),
2888                     4, AcpiDmTableInfoRhctHartInfo2);
2889                 if (ACPI_FAILURE (Status))
2890                 {
2891                     return;
2892                 }
2893 
2894                 SubtableOffset += 4;
2895             }
2896             break;
2897 
2898         case ACPI_RHCT_NODE_TYPE_ISA_STRING:
2899             RhctIsaString = ACPI_ADD_PTR (ACPI_RHCT_ISA_STRING, Subtable, SubtableOffset);
2900             IsaPadOffset = (UINT8) (SubtableOffset + 2 + RhctIsaString->IsaLength);
2901             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2902                     RhctIsaString, RhctIsaString->IsaLength, AcpiDmTableInfoRhctIsa1);
2903             if (Subtable->Length > IsaPadOffset)
2904             {
2905                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2906                          ACPI_ADD_PTR (UINT8, Subtable, IsaPadOffset),
2907                          (Subtable->Length - IsaPadOffset), AcpiDmTableInfoRhctIsaPad);
2908             }
2909 
2910             break;
2911 
2912         case ACPI_RHCT_NODE_TYPE_CMO:
2913             RhctCmoNode = ACPI_ADD_PTR (ACPI_RHCT_CMO_NODE, Subtable, SubtableOffset);
2914             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2915                                       RhctCmoNode, 4, AcpiDmTableInfoRhctCmo1);
2916             break;
2917 
2918         case ACPI_RHCT_NODE_TYPE_MMU:
2919             RhctMmuNode = ACPI_ADD_PTR (ACPI_RHCT_MMU_NODE, Subtable, SubtableOffset);
2920             Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2921                                       RhctMmuNode, 2, AcpiDmTableInfoRhctMmu1);
2922             break;
2923 
2924         default:
2925             break;
2926         }
2927 
2928         /* Point to next subtable */
2929 
2930         Offset += Subtable->Length;
2931     }
2932 }
2933 
2934 
2935 /*******************************************************************************
2936  *
2937  * FUNCTION:    AcpiDmDumpS3pt
2938  *
2939  * PARAMETERS:  Table               - A S3PT table
2940  *
2941  * RETURN:      Length of the table
2942  *
2943  * DESCRIPTION: Format the contents of a S3PT
2944  *
2945  ******************************************************************************/
2946 
2947 UINT32
2948 AcpiDmDumpS3pt (
2949     ACPI_TABLE_HEADER       *Tables)
2950 {
2951     ACPI_STATUS             Status;
2952     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
2953     ACPI_FPDT_HEADER        *Subtable;
2954     ACPI_DMTABLE_INFO       *InfoTable;
2955     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2956 
2957 
2958     /* Main table */
2959 
2960     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2961     if (ACPI_FAILURE (Status))
2962     {
2963         return 0;
2964     }
2965 
2966     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
2967     while (Offset < S3ptTable->Length)
2968     {
2969         /* Common subtable header */
2970 
2971         AcpiOsPrintf ("\n");
2972         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2973             Subtable->Length, AcpiDmTableInfoS3ptHdr);
2974         if (ACPI_FAILURE (Status))
2975         {
2976             return 0;
2977         }
2978 
2979         switch (Subtable->Type)
2980         {
2981         case ACPI_S3PT_TYPE_RESUME:
2982 
2983             InfoTable = AcpiDmTableInfoS3pt0;
2984             break;
2985 
2986         case ACPI_S3PT_TYPE_SUSPEND:
2987 
2988             InfoTable = AcpiDmTableInfoS3pt1;
2989             break;
2990 
2991         default:
2992 
2993             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
2994                 Subtable->Type);
2995 
2996             /* Attempt to continue */
2997 
2998             if (!Subtable->Length)
2999             {
3000                 AcpiOsPrintf ("Invalid zero length subtable\n");
3001                 return 0;
3002             }
3003             goto NextSubtable;
3004         }
3005 
3006         AcpiOsPrintf ("\n");
3007         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
3008             Subtable->Length, InfoTable);
3009         if (ACPI_FAILURE (Status))
3010         {
3011             return 0;
3012         }
3013 
3014 NextSubtable:
3015         /* Point to next subtable */
3016 
3017         Offset += Subtable->Length;
3018         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
3019     }
3020 
3021     return (S3ptTable->Length);
3022 }
3023 
3024 
3025 /*******************************************************************************
3026  *
3027  * FUNCTION:    AcpiDmDumpSdev
3028  *
3029  * PARAMETERS:  Table               - A SDEV table
3030  *
3031  * RETURN:      None
3032  *
3033  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
3034  *              table that contains variable strings and vendor data.
3035  *
3036  ******************************************************************************/
3037 
3038 void
3039 AcpiDmDumpSdev (
3040     ACPI_TABLE_HEADER       *Table)
3041 {
3042     ACPI_STATUS                 Status;
3043     ACPI_SDEV_HEADER            *Subtable;
3044     ACPI_SDEV_PCIE              *Pcie;
3045     ACPI_SDEV_NAMESPACE         *Namesp;
3046     ACPI_DMTABLE_INFO           *InfoTable;
3047     ACPI_DMTABLE_INFO           *SecureComponentInfoTable;
3048     UINT32                      Length = Table->Length;
3049     UINT32                      Offset = sizeof (ACPI_TABLE_SDEV);
3050     UINT16                      PathOffset;
3051     UINT16                      PathLength;
3052     UINT16                      VendorDataOffset;
3053     UINT16                      VendorDataLength;
3054     ACPI_SDEV_SECURE_COMPONENT  *SecureComponent = NULL;
3055     UINT32                      CurrentOffset = 0;
3056 
3057 
3058     /* Main table */
3059 
3060     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
3061     if (ACPI_FAILURE (Status))
3062     {
3063         return;
3064     }
3065 
3066     /* Subtables */
3067 
3068     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
3069     while (Offset < Table->Length)
3070     {
3071         /* Common subtable header */
3072 
3073         AcpiOsPrintf ("\n");
3074         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
3075             Subtable->Length, AcpiDmTableInfoSdevHdr);
3076         if (ACPI_FAILURE (Status))
3077         {
3078             return;
3079         }
3080 
3081         switch (Subtable->Type)
3082         {
3083         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
3084 
3085             InfoTable = AcpiDmTableInfoSdev0;
3086             break;
3087 
3088         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
3089 
3090             InfoTable = AcpiDmTableInfoSdev1;
3091             break;
3092 
3093         default:
3094             goto NextSubtable;
3095         }
3096 
3097         AcpiOsPrintf ("\n");
3098         Status = AcpiDmDumpTable (Table->Length, 0, Subtable,
3099             Subtable->Length, InfoTable);
3100         if (ACPI_FAILURE (Status))
3101         {
3102             return;
3103         }
3104 
3105         switch (Subtable->Type)
3106         {
3107         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
3108 
3109             CurrentOffset = sizeof (ACPI_SDEV_NAMESPACE);
3110             if (Subtable->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
3111             {
3112                 SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
3113                     ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)));
3114 
3115                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3116                     ACPI_ADD_PTR(UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)),
3117                     sizeof (ACPI_SDEV_SECURE_COMPONENT), AcpiDmTableInfoSdev0b);
3118                 if (ACPI_FAILURE (Status))
3119                 {
3120                     return;
3121                 }
3122                 CurrentOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
3123 
3124                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3125                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
3126                     sizeof (ACPI_SDEV_HEADER), AcpiDmTableInfoSdevSecCompHdr);
3127                 if (ACPI_FAILURE (Status))
3128                 {
3129                     return;
3130                 }
3131                 CurrentOffset += sizeof (ACPI_SDEV_HEADER);
3132 
3133                 switch (Subtable->Type)
3134                 {
3135                 case ACPI_SDEV_TYPE_ID_COMPONENT:
3136 
3137                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
3138                     break;
3139 
3140                 case ACPI_SDEV_TYPE_MEM_COMPONENT:
3141 
3142                     SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
3143                     break;
3144 
3145                 default:
3146                     goto NextSubtable;
3147                 }
3148 
3149                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3150                     ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
3151                     SecureComponent->SecureComponentLength, SecureComponentInfoTable);
3152                 CurrentOffset += SecureComponent->SecureComponentLength;
3153             }
3154 
3155             /* Dump the PCIe device ID(s) */
3156 
3157             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
3158             PathOffset = Namesp->DeviceIdOffset;
3159             PathLength = Namesp->DeviceIdLength;
3160 
3161             if (PathLength)
3162             {
3163                 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
3164                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
3165                     PathLength, AcpiDmTableInfoSdev0a);
3166                 if (ACPI_FAILURE (Status))
3167                 {
3168                     return;
3169                 }
3170                 CurrentOffset += PathLength;
3171             }
3172 
3173             /* Dump the vendor-specific data */
3174 
3175             VendorDataLength =
3176                 Namesp->VendorDataLength;
3177             VendorDataOffset =
3178                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
3179 
3180             if (VendorDataLength)
3181             {
3182                 Status = AcpiDmDumpTable (Table->Length, 0,
3183                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
3184                     VendorDataLength, AcpiDmTableInfoSdev1b);
3185                 if (ACPI_FAILURE (Status))
3186                 {
3187                     return;
3188                 }
3189             }
3190             break;
3191 
3192         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
3193 
3194             /* PCI path substructures */
3195 
3196             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
3197             PathOffset = Pcie->PathOffset;
3198             PathLength = Pcie->PathLength;
3199 
3200             while (PathLength)
3201             {
3202                 Status = AcpiDmDumpTable (Table->Length,
3203                     PathOffset + Offset,
3204                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
3205                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
3206                 if (ACPI_FAILURE (Status))
3207                 {
3208                     return;
3209                 }
3210 
3211                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
3212                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
3213             }
3214 
3215             /* VendorData */
3216 
3217             VendorDataLength = Pcie->VendorDataLength;
3218             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
3219 
3220             if (VendorDataLength)
3221             {
3222                 Status = AcpiDmDumpTable (Table->Length, 0,
3223                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
3224                     VendorDataLength, AcpiDmTableInfoSdev1b);
3225                 if (ACPI_FAILURE (Status))
3226                 {
3227                     return;
3228                 }
3229             }
3230             break;
3231 
3232         default:
3233             goto NextSubtable;
3234         }
3235 
3236 NextSubtable:
3237         /* Point to next subtable */
3238 
3239         Offset += Subtable->Length;
3240         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
3241             Subtable->Length);
3242     }
3243 }
3244