xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump2.c (revision 62cfcf62f627e5093fb37026a6d8c98e4d2ef04c)
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 - 2020, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acdisasm.h>
155 #include <contrib/dev/acpica/include/actables.h>
156 
157 /* This module used for application-level code only */
158 
159 #define _COMPONENT          ACPI_CA_DISASSEMBLER
160         ACPI_MODULE_NAME    ("dmtbdump2")
161 
162 
163 /*******************************************************************************
164  *
165  * FUNCTION:    AcpiDmDumpIort
166  *
167  * PARAMETERS:  Table               - A IORT table
168  *
169  * RETURN:      None
170  *
171  * DESCRIPTION: Format the contents of a IORT
172  *
173  ******************************************************************************/
174 
175 void
176 AcpiDmDumpIort (
177     ACPI_TABLE_HEADER       *Table)
178 {
179     ACPI_STATUS             Status;
180     ACPI_TABLE_IORT         *Iort;
181     ACPI_IORT_NODE          *IortNode;
182     ACPI_IORT_ITS_GROUP     *IortItsGroup = NULL;
183     ACPI_IORT_SMMU          *IortSmmu = NULL;
184     UINT32                  Offset;
185     UINT32                  NodeOffset;
186     UINT32                  Length;
187     ACPI_DMTABLE_INFO       *InfoTable;
188     char                    *String;
189     UINT32                  i;
190     UINT32                  MappingByteLength;
191 
192 
193     /* Main table */
194 
195     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
196     if (ACPI_FAILURE (Status))
197     {
198         return;
199     }
200 
201     Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
202     Offset = sizeof (ACPI_TABLE_IORT);
203 
204     /* Dump the OptionalPadding (optional) */
205 
206     if (Iort->NodeOffset > Offset)
207     {
208         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
209             Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
210         if (ACPI_FAILURE (Status))
211         {
212             return;
213         }
214     }
215 
216     Offset = Iort->NodeOffset;
217     while (Offset < Table->Length)
218     {
219         /* Common subtable header */
220 
221         IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
222         AcpiOsPrintf ("\n");
223         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
224         Status = AcpiDmDumpTable (Table->Length, Offset,
225             IortNode, Length, AcpiDmTableInfoIortHdr);
226         if (ACPI_FAILURE (Status))
227         {
228             return;
229         }
230 
231         NodeOffset = Length;
232 
233         switch (IortNode->Type)
234         {
235         case ACPI_IORT_NODE_ITS_GROUP:
236 
237             InfoTable = AcpiDmTableInfoIort0;
238             Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
239             IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
240             break;
241 
242         case ACPI_IORT_NODE_NAMED_COMPONENT:
243 
244             InfoTable = AcpiDmTableInfoIort1;
245             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
246             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
247             Length += strlen (String) + 1;
248             break;
249 
250         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
251 
252             InfoTable = AcpiDmTableInfoIort2;
253             Length = IortNode->Length - NodeOffset;
254             break;
255 
256         case ACPI_IORT_NODE_SMMU:
257 
258             InfoTable = AcpiDmTableInfoIort3;
259             Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
260             IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
261             break;
262 
263         case ACPI_IORT_NODE_SMMU_V3:
264 
265             InfoTable = AcpiDmTableInfoIort4;
266             Length = IortNode->Length - NodeOffset;
267             break;
268 
269         case ACPI_IORT_NODE_PMCG:
270 
271             InfoTable = AcpiDmTableInfoIort5;
272             Length = IortNode->Length - NodeOffset;
273             break;
274 
275         default:
276 
277             AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
278                 IortNode->Type);
279 
280             /* Attempt to continue */
281 
282             if (!IortNode->Length)
283             {
284                 AcpiOsPrintf ("Invalid zero length IORT node\n");
285                 return;
286             }
287             goto NextSubtable;
288         }
289 
290         /* Dump the node subtable header */
291 
292         AcpiOsPrintf ("\n");
293         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
294             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
295             Length, InfoTable);
296         if (ACPI_FAILURE (Status))
297         {
298             return;
299         }
300 
301         NodeOffset += Length;
302 
303         /* Dump the node specific data */
304 
305         switch (IortNode->Type)
306         {
307         case ACPI_IORT_NODE_ITS_GROUP:
308 
309             /* Validate IortItsGroup to avoid compiler warnings */
310 
311             if (IortItsGroup)
312             {
313                 for (i = 0; i < IortItsGroup->ItsCount; i++)
314                 {
315                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
316                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
317                         4, AcpiDmTableInfoIort0a);
318                     if (ACPI_FAILURE (Status))
319                     {
320                         return;
321                     }
322 
323                     NodeOffset += 4;
324                 }
325             }
326             break;
327 
328         case ACPI_IORT_NODE_NAMED_COMPONENT:
329 
330             /* Dump the Padding (optional) */
331 
332             if (IortNode->Length > NodeOffset)
333             {
334                 MappingByteLength =
335                     IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
336                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
337                     Table, IortNode->Length - NodeOffset - MappingByteLength,
338                     AcpiDmTableInfoIort1a);
339                 if (ACPI_FAILURE (Status))
340                 {
341                     return;
342                 }
343             }
344             break;
345 
346         case ACPI_IORT_NODE_SMMU:
347 
348             AcpiOsPrintf ("\n");
349 
350             /* Validate IortSmmu to avoid compiler warnings */
351 
352             if (IortSmmu)
353             {
354                 Length = 2 * sizeof (UINT64);
355                 NodeOffset = IortSmmu->GlobalInterruptOffset;
356                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
357                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
358                     Length, AcpiDmTableInfoIort3a);
359                 if (ACPI_FAILURE (Status))
360                 {
361                     return;
362                 }
363 
364                 NodeOffset = IortSmmu->ContextInterruptOffset;
365                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
366                 {
367                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
368                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
369                         8, AcpiDmTableInfoIort3b);
370                     if (ACPI_FAILURE (Status))
371                     {
372                         return;
373                     }
374 
375                     NodeOffset += 8;
376                 }
377 
378                 NodeOffset = IortSmmu->PmuInterruptOffset;
379                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
380                 {
381                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
382                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
383                         8, AcpiDmTableInfoIort3c);
384                     if (ACPI_FAILURE (Status))
385                     {
386                         return;
387                     }
388 
389                     NodeOffset += 8;
390                 }
391             }
392             break;
393 
394         default:
395 
396             break;
397         }
398 
399         /* Dump the ID mappings */
400 
401         NodeOffset = IortNode->MappingOffset;
402         for (i = 0; i < IortNode->MappingCount; i++)
403         {
404             AcpiOsPrintf ("\n");
405             Length = sizeof (ACPI_IORT_ID_MAPPING);
406             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
407                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
408                 Length, AcpiDmTableInfoIortMap);
409             if (ACPI_FAILURE (Status))
410             {
411                 return;
412             }
413 
414             NodeOffset += Length;
415         }
416 
417 NextSubtable:
418         /* Point to next node subtable */
419 
420         Offset += IortNode->Length;
421     }
422 }
423 
424 
425 /*******************************************************************************
426  *
427  * FUNCTION:    AcpiDmDumpIvrs
428  *
429  * PARAMETERS:  Table               - A IVRS table
430  *
431  * RETURN:      None
432  *
433  * DESCRIPTION: Format the contents of a IVRS
434  *
435  ******************************************************************************/
436 
437 static UINT8 EntrySizes[] = {4,8,16,32};
438 
439 void
440 AcpiDmDumpIvrs (
441     ACPI_TABLE_HEADER       *Table)
442 {
443     ACPI_STATUS             Status;
444     UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
445     UINT32                  EntryOffset;
446     UINT32                  EntryLength;
447     UINT32                  EntryType;
448     ACPI_IVRS_DE_HEADER     *DeviceEntry;
449     ACPI_IVRS_HEADER        *Subtable;
450     ACPI_DMTABLE_INFO       *InfoTable;
451 
452 
453     /* Main table */
454 
455     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
456     if (ACPI_FAILURE (Status))
457     {
458         return;
459     }
460 
461     /* Subtables */
462 
463     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
464     while (Offset < Table->Length)
465     {
466         /* Common subtable header */
467 
468         AcpiOsPrintf ("\n");
469         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
470             Subtable->Length, AcpiDmTableInfoIvrsHdr);
471         if (ACPI_FAILURE (Status))
472         {
473             return;
474         }
475 
476         switch (Subtable->Type)
477         {
478         case ACPI_IVRS_TYPE_HARDWARE1:
479 
480             InfoTable = AcpiDmTableInfoIvrs0;
481             break;
482 
483         case ACPI_IVRS_TYPE_HARDWARE2:
484 
485             InfoTable = AcpiDmTableInfoIvrs01;
486             break;
487 
488         case ACPI_IVRS_TYPE_MEMORY1:
489         case ACPI_IVRS_TYPE_MEMORY2:
490         case ACPI_IVRS_TYPE_MEMORY3:
491 
492             InfoTable = AcpiDmTableInfoIvrs1;
493             break;
494 
495         default:
496 
497             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
498                 Subtable->Type);
499 
500             /* Attempt to continue */
501 
502             if (!Subtable->Length)
503             {
504                 AcpiOsPrintf ("Invalid zero length subtable\n");
505                 return;
506             }
507             goto NextSubtable;
508         }
509 
510         /* Dump the subtable */
511 
512         AcpiOsPrintf ("\n");
513         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
514             Subtable->Length, InfoTable);
515         if (ACPI_FAILURE (Status))
516         {
517             return;
518         }
519 
520         /* The hardware subtable can contain multiple device entries */
521 
522         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
523             Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2)
524         {
525             if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
526             {
527                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
528                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
529                     sizeof (ACPI_IVRS_HARDWARE1));
530             }
531             else
532             {
533                 /* ACPI_IVRS_TYPE_HARDWARE2 subtable type */
534 
535                 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
536                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
537                     sizeof (ACPI_IVRS_HARDWARE2));
538             }
539 
540             while (EntryOffset < (Offset + Subtable->Length))
541             {
542                 AcpiOsPrintf ("\n");
543                 /*
544                  * Upper 2 bits of Type encode the length of the device entry
545                  *
546                  * 00 = 4 byte
547                  * 01 = 8 byte
548                  * 10 = 16 byte - currently no entries defined
549                  * 11 = 32 byte - currently no entries defined
550                  */
551                 EntryType = DeviceEntry->Type;
552                 EntryLength = EntrySizes [EntryType >> 6];
553 
554                 switch (EntryType)
555                 {
556                 /* 4-byte device entries */
557 
558                 case ACPI_IVRS_TYPE_PAD4:
559                 case ACPI_IVRS_TYPE_ALL:
560                 case ACPI_IVRS_TYPE_SELECT:
561                 case ACPI_IVRS_TYPE_START:
562                 case ACPI_IVRS_TYPE_END:
563 
564                     InfoTable = AcpiDmTableInfoIvrs4;
565                     break;
566 
567                 /* 8-byte entries, type A */
568 
569                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
570                 case ACPI_IVRS_TYPE_ALIAS_START:
571 
572                     InfoTable = AcpiDmTableInfoIvrs8a;
573                     break;
574 
575                 /* 8-byte entries, type B */
576 
577                 case ACPI_IVRS_TYPE_PAD8:
578                 case ACPI_IVRS_TYPE_EXT_SELECT:
579                 case ACPI_IVRS_TYPE_EXT_START:
580 
581                     InfoTable = AcpiDmTableInfoIvrs8b;
582                     break;
583 
584                 /* 8-byte entries, type C */
585 
586                 case ACPI_IVRS_TYPE_SPECIAL:
587 
588                     InfoTable = AcpiDmTableInfoIvrs8c;
589                     break;
590 
591                 default:
592                     InfoTable = AcpiDmTableInfoIvrs4;
593                     AcpiOsPrintf (
594                         "\n**** Unknown IVRS device entry type/length: "
595                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
596                         EntryType, EntryLength, EntryOffset);
597                     break;
598                 }
599 
600                 /* Dump the Device Entry */
601 
602                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
603                     DeviceEntry, EntryLength, InfoTable);
604                 if (ACPI_FAILURE (Status))
605                 {
606                     return;
607                 }
608 
609                 EntryOffset += EntryLength;
610                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
611                     EntryLength);
612             }
613         }
614 
615 NextSubtable:
616         /* Point to next subtable */
617 
618         Offset += Subtable->Length;
619         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
620     }
621 }
622 
623 
624 /*******************************************************************************
625  *
626  * FUNCTION:    AcpiDmDumpLpit
627  *
628  * PARAMETERS:  Table               - A LPIT table
629  *
630  * RETURN:      None
631  *
632  * DESCRIPTION: Format the contents of a LPIT. This table type consists
633  *              of an open-ended number of subtables. Note: There are no
634  *              entries in the main table. An LPIT consists of the table
635  *              header and then subtables only.
636  *
637  ******************************************************************************/
638 
639 void
640 AcpiDmDumpLpit (
641     ACPI_TABLE_HEADER       *Table)
642 {
643     ACPI_STATUS             Status;
644     ACPI_LPIT_HEADER        *Subtable;
645     UINT32                  Length = Table->Length;
646     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
647     ACPI_DMTABLE_INFO       *InfoTable;
648     UINT32                  SubtableLength;
649 
650 
651     /* Subtables */
652 
653     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
654     while (Offset < Table->Length)
655     {
656         /* Common subtable header */
657 
658         Status = AcpiDmDumpTable (Length, Offset, Subtable,
659             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
660         if (ACPI_FAILURE (Status))
661         {
662             return;
663         }
664 
665         switch (Subtable->Type)
666         {
667         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
668 
669             InfoTable = AcpiDmTableInfoLpit0;
670             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
671             break;
672 
673         default:
674 
675             /* Cannot continue on unknown type - no length */
676 
677             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
678                 Subtable->Type);
679             return;
680         }
681 
682         Status = AcpiDmDumpTable (Length, Offset, Subtable,
683             SubtableLength, InfoTable);
684         if (ACPI_FAILURE (Status))
685         {
686             return;
687         }
688 
689         AcpiOsPrintf ("\n");
690 
691         /* Point to next subtable */
692 
693         Offset += SubtableLength;
694         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
695     }
696 }
697 
698 
699 /*******************************************************************************
700  *
701  * FUNCTION:    AcpiDmDumpMadt
702  *
703  * PARAMETERS:  Table               - A MADT table
704  *
705  * RETURN:      None
706  *
707  * DESCRIPTION: Format the contents of a MADT. This table type consists
708  *              of an open-ended number of subtables.
709  *
710  ******************************************************************************/
711 
712 void
713 AcpiDmDumpMadt (
714     ACPI_TABLE_HEADER       *Table)
715 {
716     ACPI_STATUS             Status;
717     ACPI_SUBTABLE_HEADER    *Subtable;
718     UINT32                  Length = Table->Length;
719     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
720     ACPI_DMTABLE_INFO       *InfoTable;
721 
722 
723     /* Main table */
724 
725     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
726     if (ACPI_FAILURE (Status))
727     {
728         return;
729     }
730 
731     /* Subtables */
732 
733     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
734     while (Offset < Table->Length)
735     {
736         /* Common subtable header */
737 
738         AcpiOsPrintf ("\n");
739         Status = AcpiDmDumpTable (Length, Offset, Subtable,
740             Subtable->Length, AcpiDmTableInfoMadtHdr);
741         if (ACPI_FAILURE (Status))
742         {
743             return;
744         }
745 
746         switch (Subtable->Type)
747         {
748         case ACPI_MADT_TYPE_LOCAL_APIC:
749 
750             InfoTable = AcpiDmTableInfoMadt0;
751             break;
752 
753         case ACPI_MADT_TYPE_IO_APIC:
754 
755             InfoTable = AcpiDmTableInfoMadt1;
756             break;
757 
758         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
759 
760             InfoTable = AcpiDmTableInfoMadt2;
761             break;
762 
763         case ACPI_MADT_TYPE_NMI_SOURCE:
764 
765             InfoTable = AcpiDmTableInfoMadt3;
766             break;
767 
768         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
769 
770             InfoTable = AcpiDmTableInfoMadt4;
771             break;
772 
773         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
774 
775             InfoTable = AcpiDmTableInfoMadt5;
776             break;
777 
778         case ACPI_MADT_TYPE_IO_SAPIC:
779 
780             InfoTable = AcpiDmTableInfoMadt6;
781             break;
782 
783         case ACPI_MADT_TYPE_LOCAL_SAPIC:
784 
785             InfoTable = AcpiDmTableInfoMadt7;
786             break;
787 
788         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
789 
790             InfoTable = AcpiDmTableInfoMadt8;
791             break;
792 
793         case ACPI_MADT_TYPE_LOCAL_X2APIC:
794 
795             InfoTable = AcpiDmTableInfoMadt9;
796             break;
797 
798         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
799 
800             InfoTable = AcpiDmTableInfoMadt10;
801             break;
802 
803         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
804 
805             InfoTable = AcpiDmTableInfoMadt11;
806             break;
807 
808         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
809 
810             InfoTable = AcpiDmTableInfoMadt12;
811             break;
812 
813         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
814 
815             InfoTable = AcpiDmTableInfoMadt13;
816             break;
817 
818         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
819 
820             InfoTable = AcpiDmTableInfoMadt14;
821             break;
822 
823         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
824 
825             InfoTable = AcpiDmTableInfoMadt15;
826             break;
827 
828         default:
829 
830             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
831                 Subtable->Type);
832 
833             /* Attempt to continue */
834 
835             if (!Subtable->Length)
836             {
837                 AcpiOsPrintf ("Invalid zero length subtable\n");
838                 return;
839             }
840 
841             goto NextSubtable;
842         }
843 
844         Status = AcpiDmDumpTable (Length, Offset, Subtable,
845             Subtable->Length, InfoTable);
846         if (ACPI_FAILURE (Status))
847         {
848             return;
849         }
850 
851 NextSubtable:
852         /* Point to next subtable */
853 
854         Offset += Subtable->Length;
855         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
856             Subtable->Length);
857     }
858 }
859 
860 
861 /*******************************************************************************
862  *
863  * FUNCTION:    AcpiDmDumpMcfg
864  *
865  * PARAMETERS:  Table               - A MCFG Table
866  *
867  * RETURN:      None
868  *
869  * DESCRIPTION: Format the contents of a MCFG table
870  *
871  ******************************************************************************/
872 
873 void
874 AcpiDmDumpMcfg (
875     ACPI_TABLE_HEADER       *Table)
876 {
877     ACPI_STATUS             Status;
878     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
879     ACPI_MCFG_ALLOCATION    *Subtable;
880 
881 
882     /* Main table */
883 
884     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
885     if (ACPI_FAILURE (Status))
886     {
887         return;
888     }
889 
890     /* Subtables */
891 
892     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
893     while (Offset < Table->Length)
894     {
895         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
896         {
897             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
898                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
899             return;
900         }
901 
902         AcpiOsPrintf ("\n");
903         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
904             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
905         if (ACPI_FAILURE (Status))
906         {
907             return;
908         }
909 
910         /* Point to next subtable (each subtable is of fixed length) */
911 
912         Offset += sizeof (ACPI_MCFG_ALLOCATION);
913         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
914             sizeof (ACPI_MCFG_ALLOCATION));
915     }
916 }
917 
918 
919 /*******************************************************************************
920  *
921  * FUNCTION:    AcpiDmDumpMpst
922  *
923  * PARAMETERS:  Table               - A MPST Table
924  *
925  * RETURN:      None
926  *
927  * DESCRIPTION: Format the contents of a MPST table
928  *
929  ******************************************************************************/
930 
931 void
932 AcpiDmDumpMpst (
933     ACPI_TABLE_HEADER       *Table)
934 {
935     ACPI_STATUS             Status;
936     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
937     ACPI_MPST_POWER_NODE    *Subtable0;
938     ACPI_MPST_POWER_STATE   *Subtable0A;
939     ACPI_MPST_COMPONENT     *Subtable0B;
940     ACPI_MPST_DATA_HDR      *Subtable1;
941     ACPI_MPST_POWER_DATA    *Subtable2;
942     UINT16                  SubtableCount;
943     UINT32                  PowerStateCount;
944     UINT32                  ComponentCount;
945 
946 
947     /* Main table */
948 
949     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
950     if (ACPI_FAILURE (Status))
951     {
952         return;
953     }
954 
955     /* Subtable: Memory Power Node(s) */
956 
957     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
958     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
959 
960     while ((Offset < Table->Length) && SubtableCount)
961     {
962         AcpiOsPrintf ("\n");
963         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
964             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
965         if (ACPI_FAILURE (Status))
966         {
967             return;
968         }
969 
970         /* Extract the sub-subtable counts */
971 
972         PowerStateCount = Subtable0->NumPowerStates;
973         ComponentCount = Subtable0->NumPhysicalComponents;
974         Offset += sizeof (ACPI_MPST_POWER_NODE);
975 
976         /* Sub-subtables - Memory Power State Structure(s) */
977 
978         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
979             sizeof (ACPI_MPST_POWER_NODE));
980 
981         while (PowerStateCount)
982         {
983             AcpiOsPrintf ("\n");
984             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
985                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
986             if (ACPI_FAILURE (Status))
987             {
988                 return;
989             }
990 
991             Subtable0A++;
992             PowerStateCount--;
993             Offset += sizeof (ACPI_MPST_POWER_STATE);
994        }
995 
996         /* Sub-subtables - Physical Component ID Structure(s) */
997 
998         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
999 
1000         if (ComponentCount)
1001         {
1002             AcpiOsPrintf ("\n");
1003         }
1004 
1005         while (ComponentCount)
1006         {
1007             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
1008                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1009             if (ACPI_FAILURE (Status))
1010             {
1011                 return;
1012             }
1013 
1014             Subtable0B++;
1015             ComponentCount--;
1016             Offset += sizeof (ACPI_MPST_COMPONENT);
1017         }
1018 
1019         /* Point to next Memory Power Node subtable */
1020 
1021         SubtableCount--;
1022         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1023             sizeof (ACPI_MPST_POWER_NODE) +
1024             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1025             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1026     }
1027 
1028     /* Subtable: Count of Memory Power State Characteristic structures */
1029 
1030     AcpiOsPrintf ("\n");
1031     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1032     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1033         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1034     if (ACPI_FAILURE (Status))
1035     {
1036         return;
1037     }
1038 
1039     SubtableCount = Subtable1->CharacteristicsCount;
1040     Offset += sizeof (ACPI_MPST_DATA_HDR);
1041 
1042     /* Subtable: Memory Power State Characteristics structure(s) */
1043 
1044     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1045         sizeof (ACPI_MPST_DATA_HDR));
1046 
1047     while ((Offset < Table->Length) && SubtableCount)
1048     {
1049         AcpiOsPrintf ("\n");
1050         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1051             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1052         if (ACPI_FAILURE (Status))
1053         {
1054             return;
1055         }
1056 
1057         Subtable2++;
1058         SubtableCount--;
1059         Offset += sizeof (ACPI_MPST_POWER_DATA);
1060     }
1061 }
1062 
1063 
1064 /*******************************************************************************
1065  *
1066  * FUNCTION:    AcpiDmDumpMsct
1067  *
1068  * PARAMETERS:  Table               - A MSCT table
1069  *
1070  * RETURN:      None
1071  *
1072  * DESCRIPTION: Format the contents of a MSCT
1073  *
1074  ******************************************************************************/
1075 
1076 void
1077 AcpiDmDumpMsct (
1078     ACPI_TABLE_HEADER       *Table)
1079 {
1080     ACPI_STATUS             Status;
1081     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1082     ACPI_MSCT_PROXIMITY     *Subtable;
1083 
1084 
1085     /* Main table */
1086 
1087     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1088     if (ACPI_FAILURE (Status))
1089     {
1090         return;
1091     }
1092 
1093     /* Subtables */
1094 
1095     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1096     while (Offset < Table->Length)
1097     {
1098         /* Common subtable header */
1099 
1100         AcpiOsPrintf ("\n");
1101         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1102             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1103         if (ACPI_FAILURE (Status))
1104         {
1105             return;
1106         }
1107 
1108         /* Point to next subtable */
1109 
1110         Offset += sizeof (ACPI_MSCT_PROXIMITY);
1111         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1112             sizeof (ACPI_MSCT_PROXIMITY));
1113     }
1114 }
1115 
1116 
1117 /*******************************************************************************
1118  *
1119  * FUNCTION:    AcpiDmDumpMtmr
1120  *
1121  * PARAMETERS:  Table               - A MTMR table
1122  *
1123  * RETURN:      None
1124  *
1125  * DESCRIPTION: Format the contents of a MTMR
1126  *
1127  ******************************************************************************/
1128 
1129 void
1130 AcpiDmDumpMtmr (
1131     ACPI_TABLE_HEADER       *Table)
1132 {
1133     ACPI_STATUS             Status;
1134     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
1135     ACPI_MTMR_ENTRY         *Subtable;
1136 
1137 
1138     /* Main table */
1139 
1140     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
1141     if (ACPI_FAILURE (Status))
1142     {
1143         return;
1144     }
1145 
1146     /* Subtables */
1147 
1148     Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
1149     while (Offset < Table->Length)
1150     {
1151         /* Common subtable header */
1152 
1153         AcpiOsPrintf ("\n");
1154         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1155             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
1156         if (ACPI_FAILURE (Status))
1157         {
1158             return;
1159         }
1160 
1161         /* Point to next subtable */
1162 
1163         Offset += sizeof (ACPI_MTMR_ENTRY);
1164         Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable,
1165             sizeof (ACPI_MTMR_ENTRY));
1166     }
1167 }
1168 
1169 
1170 /*******************************************************************************
1171  *
1172  * FUNCTION:    AcpiDmDumpNfit
1173  *
1174  * PARAMETERS:  Table               - A NFIT table
1175  *
1176  * RETURN:      None
1177  *
1178  * DESCRIPTION: Format the contents of an NFIT.
1179  *
1180  ******************************************************************************/
1181 
1182 void
1183 AcpiDmDumpNfit (
1184     ACPI_TABLE_HEADER       *Table)
1185 {
1186     ACPI_STATUS             Status;
1187     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
1188     UINT32                  FieldOffset = 0;
1189     UINT32                  Length;
1190     ACPI_NFIT_HEADER        *Subtable;
1191     ACPI_DMTABLE_INFO       *InfoTable;
1192     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
1193     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
1194     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1195     UINT32                  i;
1196 
1197 
1198     /* Main table */
1199 
1200     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1201     if (ACPI_FAILURE (Status))
1202     {
1203         return;
1204     }
1205 
1206     /* Subtables */
1207 
1208     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1209     while (Offset < Table->Length)
1210     {
1211         /* NFIT subtable header */
1212 
1213         AcpiOsPrintf ("\n");
1214         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1215             Subtable->Length, AcpiDmTableInfoNfitHdr);
1216         if (ACPI_FAILURE (Status))
1217         {
1218             return;
1219         }
1220 
1221         switch (Subtable->Type)
1222         {
1223         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1224 
1225             InfoTable = AcpiDmTableInfoNfit0;
1226             break;
1227 
1228         case ACPI_NFIT_TYPE_MEMORY_MAP:
1229 
1230             InfoTable = AcpiDmTableInfoNfit1;
1231             break;
1232 
1233         case ACPI_NFIT_TYPE_INTERLEAVE:
1234 
1235             /* Has a variable number of 32-bit values at the end */
1236 
1237             InfoTable = AcpiDmTableInfoNfit2;
1238             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1239             break;
1240 
1241         case ACPI_NFIT_TYPE_SMBIOS:
1242 
1243             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1244             InfoTable = AcpiDmTableInfoNfit3;
1245             break;
1246 
1247         case ACPI_NFIT_TYPE_CONTROL_REGION:
1248 
1249             InfoTable = AcpiDmTableInfoNfit4;
1250             break;
1251 
1252         case ACPI_NFIT_TYPE_DATA_REGION:
1253 
1254             InfoTable = AcpiDmTableInfoNfit5;
1255             break;
1256 
1257         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1258 
1259             /* Has a variable number of 64-bit addresses at the end */
1260 
1261             InfoTable = AcpiDmTableInfoNfit6;
1262             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
1263             break;
1264 
1265         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
1266 
1267             InfoTable = AcpiDmTableInfoNfit7;
1268             break;
1269 
1270         default:
1271             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1272                 Subtable->Type);
1273 
1274             /* Attempt to continue */
1275 
1276             if (!Subtable->Length)
1277             {
1278                 AcpiOsPrintf ("Invalid zero length subtable\n");
1279                 return;
1280             }
1281             goto NextSubtable;
1282         }
1283 
1284         AcpiOsPrintf ("\n");
1285         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1286             Subtable->Length, InfoTable);
1287         if (ACPI_FAILURE (Status))
1288         {
1289             return;
1290         }
1291 
1292         /* Per-subtable variable-length fields */
1293 
1294         switch (Subtable->Type)
1295         {
1296         case ACPI_NFIT_TYPE_INTERLEAVE:
1297 
1298             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1299             for (i = 0; i < Interleave->LineCount; i++)
1300             {
1301                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1302                     &Interleave->LineOffset[i],
1303                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
1304                 if (ACPI_FAILURE (Status))
1305                 {
1306                     return;
1307                 }
1308 
1309                 FieldOffset += sizeof (UINT32);
1310             }
1311             break;
1312 
1313         case ACPI_NFIT_TYPE_SMBIOS:
1314 
1315             Length = Subtable->Length -
1316                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
1317 
1318             if (Length)
1319             {
1320                 Status = AcpiDmDumpTable (Table->Length,
1321                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
1322                     SmbiosInfo,
1323                     Length, AcpiDmTableInfoNfit3a);
1324                 if (ACPI_FAILURE (Status))
1325                 {
1326                     return;
1327                 }
1328             }
1329 
1330             break;
1331 
1332         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1333 
1334             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1335             for (i = 0; i < Hint->HintCount; i++)
1336             {
1337                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1338                     &Hint->HintAddress[i],
1339                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
1340                 if (ACPI_FAILURE (Status))
1341                 {
1342                     return;
1343                 }
1344 
1345                 FieldOffset += sizeof (UINT64);
1346             }
1347             break;
1348 
1349         default:
1350             break;
1351         }
1352 
1353 NextSubtable:
1354         /* Point to next subtable */
1355 
1356         Offset += Subtable->Length;
1357         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1358     }
1359 }
1360 
1361 
1362 /*******************************************************************************
1363  *
1364  * FUNCTION:    AcpiDmDumpPcct
1365  *
1366  * PARAMETERS:  Table               - A PCCT table
1367  *
1368  * RETURN:      None
1369  *
1370  * DESCRIPTION: Format the contents of a PCCT. This table type consists
1371  *              of an open-ended number of subtables.
1372  *
1373  ******************************************************************************/
1374 
1375 void
1376 AcpiDmDumpPcct (
1377     ACPI_TABLE_HEADER       *Table)
1378 {
1379     ACPI_STATUS             Status;
1380     ACPI_PCCT_SUBSPACE      *Subtable;
1381     ACPI_DMTABLE_INFO       *InfoTable;
1382     UINT32                  Length = Table->Length;
1383     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
1384 
1385 
1386     /* Main table */
1387 
1388     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1389     if (ACPI_FAILURE (Status))
1390     {
1391         return;
1392     }
1393 
1394     /* Subtables */
1395 
1396     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1397     while (Offset < Table->Length)
1398     {
1399         /* Common subtable header */
1400 
1401         AcpiOsPrintf ("\n");
1402         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1403             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
1404         if (ACPI_FAILURE (Status))
1405         {
1406             return;
1407         }
1408 
1409         switch (Subtable->Header.Type)
1410         {
1411         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
1412 
1413             InfoTable = AcpiDmTableInfoPcct0;
1414             break;
1415 
1416         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
1417 
1418             InfoTable = AcpiDmTableInfoPcct1;
1419             break;
1420 
1421         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
1422 
1423             InfoTable = AcpiDmTableInfoPcct2;
1424             break;
1425 
1426         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
1427 
1428             InfoTable = AcpiDmTableInfoPcct3;
1429             break;
1430 
1431         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
1432 
1433             InfoTable = AcpiDmTableInfoPcct4;
1434             break;
1435 
1436         default:
1437 
1438             AcpiOsPrintf (
1439                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
1440                 Subtable->Header.Type);
1441             return;
1442         }
1443 
1444         AcpiOsPrintf ("\n");
1445         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1446             Subtable->Header.Length, InfoTable);
1447         if (ACPI_FAILURE (Status))
1448         {
1449             return;
1450         }
1451 
1452         /* Point to next subtable */
1453 
1454         Offset += Subtable->Header.Length;
1455         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
1456             Subtable->Header.Length);
1457     }
1458 }
1459 
1460 
1461 /*******************************************************************************
1462  *
1463  * FUNCTION:    AcpiDmDumpPdtt
1464  *
1465  * PARAMETERS:  Table               - A PDTT table
1466  *
1467  * RETURN:      None
1468  *
1469  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
1470  *              table that contains an open-ended number of IDs
1471  *              at the end of the table.
1472  *
1473  ******************************************************************************/
1474 
1475 void
1476 AcpiDmDumpPdtt (
1477     ACPI_TABLE_HEADER       *Table)
1478 {
1479     ACPI_STATUS             Status;
1480     ACPI_PDTT_CHANNEL       *Subtable;
1481     UINT32                  Length = Table->Length;
1482     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
1483 
1484 
1485     /* Main table */
1486 
1487     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
1488     if (ACPI_FAILURE (Status))
1489     {
1490         return;
1491     }
1492 
1493     /* Subtables. Currently there is only one type, but can be multiples */
1494 
1495     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
1496     while (Offset < Table->Length)
1497     {
1498         AcpiOsPrintf ("\n");
1499         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1500             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
1501         if (ACPI_FAILURE (Status))
1502         {
1503             return;
1504         }
1505 
1506         /* Point to next subtable */
1507 
1508         Offset += sizeof (ACPI_PDTT_CHANNEL);
1509         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
1510             sizeof (ACPI_PDTT_CHANNEL));
1511     }
1512 }
1513 
1514 
1515 /*******************************************************************************
1516  *
1517  * FUNCTION:    AcpiDmDumpPmtt
1518  *
1519  * PARAMETERS:  Table               - A PMTT table
1520  *
1521  * RETURN:      None
1522  *
1523  * DESCRIPTION: Format the contents of a PMTT. This table type consists
1524  *              of an open-ended number of subtables.
1525  *
1526  ******************************************************************************/
1527 
1528 void
1529 AcpiDmDumpPmtt (
1530     ACPI_TABLE_HEADER       *Table)
1531 {
1532     ACPI_STATUS             Status;
1533     ACPI_PMTT_HEADER        *Subtable;
1534     ACPI_PMTT_HEADER        *MemSubtable;
1535     ACPI_PMTT_HEADER        *DimmSubtable;
1536     ACPI_PMTT_DOMAIN        *DomainArray;
1537     UINT32                  Length = Table->Length;
1538     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
1539     UINT32                  MemOffset;
1540     UINT32                  DimmOffset;
1541     UINT32                  DomainOffset;
1542     UINT32                  DomainCount;
1543 
1544 
1545     /* Main table */
1546 
1547     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
1548     if (ACPI_FAILURE (Status))
1549     {
1550         return;
1551     }
1552 
1553     /* Subtables */
1554 
1555     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
1556     while (Offset < Table->Length)
1557     {
1558         /* Common subtable header */
1559 
1560         AcpiOsPrintf ("\n");
1561         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1562             Subtable->Length, AcpiDmTableInfoPmttHdr);
1563         if (ACPI_FAILURE (Status))
1564         {
1565             return;
1566         }
1567 
1568         /* Only Socket subtables are expected at this level */
1569 
1570         if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET)
1571         {
1572             AcpiOsPrintf (
1573                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
1574                 Subtable->Type);
1575             return;
1576         }
1577 
1578         /* Dump the fixed-length portion of the subtable */
1579 
1580         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1581             Subtable->Length, AcpiDmTableInfoPmtt0);
1582         if (ACPI_FAILURE (Status))
1583         {
1584             return;
1585         }
1586 
1587         /* Walk the memory controller subtables */
1588 
1589         MemOffset = sizeof (ACPI_PMTT_SOCKET);
1590         MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
1591             sizeof (ACPI_PMTT_SOCKET));
1592 
1593         while (((Offset + MemOffset) < Table->Length) &&
1594             (MemOffset < Subtable->Length))
1595         {
1596             /* Common subtable header */
1597 
1598             AcpiOsPrintf ("\n");
1599             Status = AcpiDmDumpTable (Length,
1600                 Offset + MemOffset, MemSubtable,
1601                 MemSubtable->Length, AcpiDmTableInfoPmttHdr);
1602             if (ACPI_FAILURE (Status))
1603             {
1604                 return;
1605             }
1606 
1607             /* Only memory controller subtables are expected at this level */
1608 
1609             if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER)
1610             {
1611                 AcpiOsPrintf (
1612                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
1613                     MemSubtable->Type);
1614                 return;
1615             }
1616 
1617             /* Dump the fixed-length portion of the controller subtable */
1618 
1619             Status = AcpiDmDumpTable (Length,
1620                 Offset + MemOffset, MemSubtable,
1621                 MemSubtable->Length, AcpiDmTableInfoPmtt1);
1622             if (ACPI_FAILURE (Status))
1623             {
1624                 return;
1625             }
1626 
1627             /* Walk the variable count of proximity domains */
1628 
1629             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
1630             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
1631             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
1632                 sizeof (ACPI_PMTT_CONTROLLER));
1633 
1634             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
1635                 ((MemOffset + DomainOffset) < Subtable->Length) &&
1636                 DomainCount)
1637             {
1638                 Status = AcpiDmDumpTable (Length,
1639                     Offset + MemOffset + DomainOffset, DomainArray,
1640                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
1641                 if (ACPI_FAILURE (Status))
1642                 {
1643                     return;
1644                 }
1645 
1646                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
1647                 DomainArray++;
1648                 DomainCount--;
1649             }
1650 
1651             if (DomainCount)
1652             {
1653                 AcpiOsPrintf (
1654                     "\n**** DomainCount exceeds subtable length\n\n");
1655             }
1656 
1657             /* Walk the physical component (DIMM) subtables */
1658 
1659             DimmOffset = DomainOffset;
1660             DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
1661                 DomainOffset);
1662 
1663             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
1664                 (DimmOffset < MemSubtable->Length))
1665             {
1666                 /* Common subtable header */
1667 
1668                 AcpiOsPrintf ("\n");
1669                 Status = AcpiDmDumpTable (Length,
1670                     Offset + MemOffset + DimmOffset, DimmSubtable,
1671                     DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
1672                 if (ACPI_FAILURE (Status))
1673                 {
1674                     return;
1675                 }
1676 
1677                 /* Only DIMM subtables are expected at this level */
1678 
1679                 if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM)
1680                 {
1681                     AcpiOsPrintf (
1682                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
1683                         DimmSubtable->Type);
1684                     return;
1685                 }
1686 
1687                 /* Dump the fixed-length DIMM subtable */
1688 
1689                 Status = AcpiDmDumpTable (Length,
1690                     Offset + MemOffset + DimmOffset, DimmSubtable,
1691                     DimmSubtable->Length, AcpiDmTableInfoPmtt2);
1692                 if (ACPI_FAILURE (Status))
1693                 {
1694                     return;
1695                 }
1696 
1697                 /* Point to next DIMM subtable */
1698 
1699                 DimmOffset += DimmSubtable->Length;
1700                 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
1701                     DimmSubtable, DimmSubtable->Length);
1702             }
1703 
1704             /* Point to next Controller subtable */
1705 
1706             MemOffset += MemSubtable->Length;
1707             MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
1708                 MemSubtable, MemSubtable->Length);
1709         }
1710 
1711         /* Point to next Socket subtable */
1712 
1713         Offset += Subtable->Length;
1714         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
1715             Subtable, Subtable->Length);
1716     }
1717 }
1718 
1719 
1720 /*******************************************************************************
1721  *
1722  * FUNCTION:    AcpiDmDumpPptt
1723  *
1724  * PARAMETERS:  Table               - A PMTT table
1725  *
1726  * RETURN:      None
1727  *
1728  * DESCRIPTION: Format the contents of a PPTT. This table type consists
1729  *              of an open-ended number of subtables.
1730  *
1731  ******************************************************************************/
1732 
1733 void
1734 AcpiDmDumpPptt (
1735     ACPI_TABLE_HEADER       *Table)
1736 {
1737     ACPI_STATUS             Status;
1738     ACPI_SUBTABLE_HEADER    *Subtable;
1739     ACPI_PPTT_PROCESSOR     *PpttProcessor;
1740     UINT8                   Length;
1741     UINT8                   SubtableOffset;
1742     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
1743     ACPI_DMTABLE_INFO       *InfoTable;
1744     UINT32                  i;
1745 
1746 
1747     /* There is no main table (other than the standard ACPI header) */
1748 
1749     /* Subtables */
1750 
1751     Offset = sizeof (ACPI_TABLE_HEADER);
1752     while (Offset < Table->Length)
1753     {
1754         AcpiOsPrintf ("\n");
1755 
1756         /* Common subtable header */
1757 
1758         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1759         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
1760         {
1761             AcpiOsPrintf ("Invalid subtable length\n");
1762             return;
1763         }
1764         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1765             Subtable->Length, AcpiDmTableInfoPpttHdr);
1766         if (ACPI_FAILURE (Status))
1767         {
1768             return;
1769         }
1770 
1771         switch (Subtable->Type)
1772         {
1773         case ACPI_PPTT_TYPE_PROCESSOR:
1774 
1775             InfoTable = AcpiDmTableInfoPptt0;
1776             Length = sizeof (ACPI_PPTT_PROCESSOR);
1777             break;
1778 
1779         case ACPI_PPTT_TYPE_CACHE:
1780 
1781             InfoTable = AcpiDmTableInfoPptt1;
1782             Length = sizeof (ACPI_PPTT_CACHE);
1783             break;
1784 
1785         case ACPI_PPTT_TYPE_ID:
1786 
1787             InfoTable = AcpiDmTableInfoPptt2;
1788             Length = sizeof (ACPI_PPTT_ID);
1789             break;
1790 
1791         default:
1792 
1793             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
1794                 Subtable->Type);
1795 
1796             /* Attempt to continue */
1797 
1798             goto NextSubtable;
1799         }
1800 
1801         if (Subtable->Length < Length)
1802         {
1803             AcpiOsPrintf ("Invalid subtable length\n");
1804             return;
1805         }
1806         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1807             Subtable->Length, InfoTable);
1808         if (ACPI_FAILURE (Status))
1809         {
1810             return;
1811         }
1812         SubtableOffset = Length;
1813 
1814         switch (Subtable->Type)
1815         {
1816         case ACPI_PPTT_TYPE_PROCESSOR:
1817 
1818             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
1819 
1820             /* Dump SMBIOS handles */
1821 
1822             if ((UINT8)(Subtable->Length - SubtableOffset) <
1823                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
1824             {
1825                 AcpiOsPrintf ("Invalid private resource number\n");
1826                 return;
1827             }
1828             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
1829             {
1830                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1831                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
1832                     4, AcpiDmTableInfoPptt0a);
1833                 if (ACPI_FAILURE (Status))
1834                 {
1835                     return;
1836                 }
1837 
1838                 SubtableOffset += 4;
1839             }
1840             break;
1841 
1842         default:
1843 
1844             break;
1845         }
1846 
1847 NextSubtable:
1848         /* Point to next subtable */
1849 
1850         Offset += Subtable->Length;
1851     }
1852 }
1853 
1854 
1855 /*******************************************************************************
1856  *
1857  * FUNCTION:    AcpiDmDumpS3pt
1858  *
1859  * PARAMETERS:  Table               - A S3PT table
1860  *
1861  * RETURN:      Length of the table
1862  *
1863  * DESCRIPTION: Format the contents of a S3PT
1864  *
1865  ******************************************************************************/
1866 
1867 UINT32
1868 AcpiDmDumpS3pt (
1869     ACPI_TABLE_HEADER       *Tables)
1870 {
1871     ACPI_STATUS             Status;
1872     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
1873     ACPI_FPDT_HEADER        *Subtable;
1874     ACPI_DMTABLE_INFO       *InfoTable;
1875     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
1876 
1877 
1878     /* Main table */
1879 
1880     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
1881     if (ACPI_FAILURE (Status))
1882     {
1883         return 0;
1884     }
1885 
1886     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
1887     while (Offset < S3ptTable->Length)
1888     {
1889         /* Common subtable header */
1890 
1891         AcpiOsPrintf ("\n");
1892         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
1893             Subtable->Length, AcpiDmTableInfoS3ptHdr);
1894         if (ACPI_FAILURE (Status))
1895         {
1896             return 0;
1897         }
1898 
1899         switch (Subtable->Type)
1900         {
1901         case ACPI_S3PT_TYPE_RESUME:
1902 
1903             InfoTable = AcpiDmTableInfoS3pt0;
1904             break;
1905 
1906         case ACPI_S3PT_TYPE_SUSPEND:
1907 
1908             InfoTable = AcpiDmTableInfoS3pt1;
1909             break;
1910 
1911         default:
1912 
1913             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
1914                 Subtable->Type);
1915 
1916             /* Attempt to continue */
1917 
1918             if (!Subtable->Length)
1919             {
1920                 AcpiOsPrintf ("Invalid zero length subtable\n");
1921                 return 0;
1922             }
1923             goto NextSubtable;
1924         }
1925 
1926         AcpiOsPrintf ("\n");
1927         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
1928             Subtable->Length, InfoTable);
1929         if (ACPI_FAILURE (Status))
1930         {
1931             return 0;
1932         }
1933 
1934 NextSubtable:
1935         /* Point to next subtable */
1936 
1937         Offset += Subtable->Length;
1938         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
1939     }
1940 
1941     return (S3ptTable->Length);
1942 }
1943 
1944 
1945 /*******************************************************************************
1946  *
1947  * FUNCTION:    AcpiDmDumpSdev
1948  *
1949  * PARAMETERS:  Table               - A SDEV table
1950  *
1951  * RETURN:      None
1952  *
1953  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
1954  *              table that contains variable strings and vendor data.
1955  *
1956  ******************************************************************************/
1957 
1958 void
1959 AcpiDmDumpSdev (
1960     ACPI_TABLE_HEADER       *Table)
1961 {
1962     ACPI_STATUS             Status;
1963     ACPI_SDEV_HEADER        *Subtable;
1964     ACPI_SDEV_PCIE          *Pcie;
1965     ACPI_SDEV_NAMESPACE     *Namesp;
1966     ACPI_DMTABLE_INFO       *InfoTable;
1967     UINT32                  Length = Table->Length;
1968     UINT32                  Offset = sizeof (ACPI_TABLE_SDEV);
1969     UINT16                  PathOffset;
1970     UINT16                  PathLength;
1971     UINT16                  VendorDataOffset;
1972     UINT16                  VendorDataLength;
1973 
1974 
1975     /* Main table */
1976 
1977     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
1978     if (ACPI_FAILURE (Status))
1979     {
1980         return;
1981     }
1982 
1983     /* Subtables */
1984 
1985     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
1986     while (Offset < Table->Length)
1987     {
1988         /* Common subtable header */
1989 
1990         AcpiOsPrintf ("\n");
1991         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1992             Subtable->Length, AcpiDmTableInfoSdevHdr);
1993         if (ACPI_FAILURE (Status))
1994         {
1995             return;
1996         }
1997 
1998         switch (Subtable->Type)
1999         {
2000         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2001 
2002             InfoTable = AcpiDmTableInfoSdev0;
2003             break;
2004 
2005         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2006 
2007             InfoTable = AcpiDmTableInfoSdev1;
2008             break;
2009 
2010         default:
2011             goto NextSubtable;
2012         }
2013 
2014         AcpiOsPrintf ("\n");
2015         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2016             Subtable->Length, InfoTable);
2017         if (ACPI_FAILURE (Status))
2018         {
2019             return;
2020         }
2021 
2022         switch (Subtable->Type)
2023         {
2024         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2025 
2026             /* Dump the PCIe device ID(s) */
2027 
2028             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
2029             PathOffset = Namesp->DeviceIdOffset;
2030             PathLength = Namesp->DeviceIdLength;
2031 
2032             if (PathLength)
2033             {
2034                 Status = AcpiDmDumpTable (Table->Length, 0,
2035                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
2036                     PathLength, AcpiDmTableInfoSdev0a);
2037                 if (ACPI_FAILURE (Status))
2038                 {
2039                     return;
2040                 }
2041             }
2042 
2043             /* Dump the vendor-specific data */
2044 
2045             VendorDataLength =
2046                 Namesp->VendorDataLength;
2047             VendorDataOffset =
2048                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
2049 
2050             if (VendorDataLength)
2051             {
2052                 Status = AcpiDmDumpTable (Table->Length, 0,
2053                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
2054                     VendorDataLength, AcpiDmTableInfoSdev1b);
2055                 if (ACPI_FAILURE (Status))
2056                 {
2057                     return;
2058                 }
2059             }
2060             break;
2061 
2062         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2063 
2064             /* PCI path substructures */
2065 
2066             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
2067             PathOffset = Pcie->PathOffset;
2068             PathLength = Pcie->PathLength;
2069 
2070             while (PathLength)
2071             {
2072                 Status = AcpiDmDumpTable (Table->Length,
2073                     PathOffset + Offset,
2074                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
2075                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
2076                 if (ACPI_FAILURE (Status))
2077                 {
2078                     return;
2079                 }
2080 
2081                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
2082                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
2083             }
2084 
2085             /* VendorData */
2086 
2087             VendorDataLength = Pcie->VendorDataLength;
2088             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
2089 
2090             if (VendorDataLength)
2091             {
2092                 Status = AcpiDmDumpTable (Table->Length, 0,
2093                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
2094                     VendorDataLength, AcpiDmTableInfoSdev1b);
2095                 if (ACPI_FAILURE (Status))
2096                 {
2097                     return;
2098                 }
2099             }
2100             break;
2101 
2102         default:
2103             goto NextSubtable;
2104         }
2105 
2106 NextSubtable:
2107         /* Point to next subtable */
2108 
2109         Offset += Subtable->Length;
2110         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
2111             Subtable->Length);
2112     }
2113 }
2114