xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump2.c (revision 2f513db72b034fd5ef7f080b11be5c711c15186a)
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_HARDWARE:
479 
480             InfoTable = AcpiDmTableInfoIvrs0;
481             break;
482 
483         case ACPI_IVRS_TYPE_MEMORY1:
484         case ACPI_IVRS_TYPE_MEMORY2:
485         case ACPI_IVRS_TYPE_MEMORY3:
486 
487             InfoTable = AcpiDmTableInfoIvrs1;
488             break;
489 
490         default:
491 
492             AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
493                 Subtable->Type);
494 
495             /* Attempt to continue */
496 
497             if (!Subtable->Length)
498             {
499                 AcpiOsPrintf ("Invalid zero length subtable\n");
500                 return;
501             }
502             goto NextSubtable;
503         }
504 
505         /* Dump the subtable */
506 
507         AcpiOsPrintf ("\n");
508         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
509             Subtable->Length, InfoTable);
510         if (ACPI_FAILURE (Status))
511         {
512             return;
513         }
514 
515         /* The hardware subtable can contain multiple device entries */
516 
517         if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE)
518         {
519             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
520             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
521                 sizeof (ACPI_IVRS_HARDWARE));
522 
523             while (EntryOffset < (Offset + Subtable->Length))
524             {
525                 AcpiOsPrintf ("\n");
526                 /*
527                  * Upper 2 bits of Type encode the length of the device entry
528                  *
529                  * 00 = 4 byte
530                  * 01 = 8 byte
531                  * 10 = 16 byte - currently no entries defined
532                  * 11 = 32 byte - currently no entries defined
533                  */
534                 EntryType = DeviceEntry->Type;
535                 EntryLength = EntrySizes [EntryType >> 6];
536 
537                 switch (EntryType)
538                 {
539                 /* 4-byte device entries */
540 
541                 case ACPI_IVRS_TYPE_PAD4:
542                 case ACPI_IVRS_TYPE_ALL:
543                 case ACPI_IVRS_TYPE_SELECT:
544                 case ACPI_IVRS_TYPE_START:
545                 case ACPI_IVRS_TYPE_END:
546 
547                     InfoTable = AcpiDmTableInfoIvrs4;
548                     break;
549 
550                 /* 8-byte entries, type A */
551 
552                 case ACPI_IVRS_TYPE_ALIAS_SELECT:
553                 case ACPI_IVRS_TYPE_ALIAS_START:
554 
555                     InfoTable = AcpiDmTableInfoIvrs8a;
556                     break;
557 
558                 /* 8-byte entries, type B */
559 
560                 case ACPI_IVRS_TYPE_PAD8:
561                 case ACPI_IVRS_TYPE_EXT_SELECT:
562                 case ACPI_IVRS_TYPE_EXT_START:
563 
564                     InfoTable = AcpiDmTableInfoIvrs8b;
565                     break;
566 
567                 /* 8-byte entries, type C */
568 
569                 case ACPI_IVRS_TYPE_SPECIAL:
570 
571                     InfoTable = AcpiDmTableInfoIvrs8c;
572                     break;
573 
574                 default:
575                     InfoTable = AcpiDmTableInfoIvrs4;
576                     AcpiOsPrintf (
577                         "\n**** Unknown IVRS device entry type/length: "
578                         "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
579                         EntryType, EntryLength, EntryOffset);
580                     break;
581                 }
582 
583                 /* Dump the Device Entry */
584 
585                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
586                     DeviceEntry, EntryLength, InfoTable);
587                 if (ACPI_FAILURE (Status))
588                 {
589                     return;
590                 }
591 
592                 EntryOffset += EntryLength;
593                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
594                     EntryLength);
595             }
596         }
597 
598 NextSubtable:
599         /* Point to next subtable */
600 
601         Offset += Subtable->Length;
602         Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
603     }
604 }
605 
606 
607 /*******************************************************************************
608  *
609  * FUNCTION:    AcpiDmDumpLpit
610  *
611  * PARAMETERS:  Table               - A LPIT table
612  *
613  * RETURN:      None
614  *
615  * DESCRIPTION: Format the contents of a LPIT. This table type consists
616  *              of an open-ended number of subtables. Note: There are no
617  *              entries in the main table. An LPIT consists of the table
618  *              header and then subtables only.
619  *
620  ******************************************************************************/
621 
622 void
623 AcpiDmDumpLpit (
624     ACPI_TABLE_HEADER       *Table)
625 {
626     ACPI_STATUS             Status;
627     ACPI_LPIT_HEADER        *Subtable;
628     UINT32                  Length = Table->Length;
629     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
630     ACPI_DMTABLE_INFO       *InfoTable;
631     UINT32                  SubtableLength;
632 
633 
634     /* Subtables */
635 
636     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
637     while (Offset < Table->Length)
638     {
639         /* Common subtable header */
640 
641         Status = AcpiDmDumpTable (Length, Offset, Subtable,
642             sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
643         if (ACPI_FAILURE (Status))
644         {
645             return;
646         }
647 
648         switch (Subtable->Type)
649         {
650         case ACPI_LPIT_TYPE_NATIVE_CSTATE:
651 
652             InfoTable = AcpiDmTableInfoLpit0;
653             SubtableLength = sizeof (ACPI_LPIT_NATIVE);
654             break;
655 
656         default:
657 
658             /* Cannot continue on unknown type - no length */
659 
660             AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
661                 Subtable->Type);
662             return;
663         }
664 
665         Status = AcpiDmDumpTable (Length, Offset, Subtable,
666             SubtableLength, InfoTable);
667         if (ACPI_FAILURE (Status))
668         {
669             return;
670         }
671 
672         AcpiOsPrintf ("\n");
673 
674         /* Point to next subtable */
675 
676         Offset += SubtableLength;
677         Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
678     }
679 }
680 
681 
682 /*******************************************************************************
683  *
684  * FUNCTION:    AcpiDmDumpMadt
685  *
686  * PARAMETERS:  Table               - A MADT table
687  *
688  * RETURN:      None
689  *
690  * DESCRIPTION: Format the contents of a MADT. This table type consists
691  *              of an open-ended number of subtables.
692  *
693  ******************************************************************************/
694 
695 void
696 AcpiDmDumpMadt (
697     ACPI_TABLE_HEADER       *Table)
698 {
699     ACPI_STATUS             Status;
700     ACPI_SUBTABLE_HEADER    *Subtable;
701     UINT32                  Length = Table->Length;
702     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
703     ACPI_DMTABLE_INFO       *InfoTable;
704 
705 
706     /* Main table */
707 
708     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
709     if (ACPI_FAILURE (Status))
710     {
711         return;
712     }
713 
714     /* Subtables */
715 
716     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
717     while (Offset < Table->Length)
718     {
719         /* Common subtable header */
720 
721         AcpiOsPrintf ("\n");
722         Status = AcpiDmDumpTable (Length, Offset, Subtable,
723             Subtable->Length, AcpiDmTableInfoMadtHdr);
724         if (ACPI_FAILURE (Status))
725         {
726             return;
727         }
728 
729         switch (Subtable->Type)
730         {
731         case ACPI_MADT_TYPE_LOCAL_APIC:
732 
733             InfoTable = AcpiDmTableInfoMadt0;
734             break;
735 
736         case ACPI_MADT_TYPE_IO_APIC:
737 
738             InfoTable = AcpiDmTableInfoMadt1;
739             break;
740 
741         case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
742 
743             InfoTable = AcpiDmTableInfoMadt2;
744             break;
745 
746         case ACPI_MADT_TYPE_NMI_SOURCE:
747 
748             InfoTable = AcpiDmTableInfoMadt3;
749             break;
750 
751         case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
752 
753             InfoTable = AcpiDmTableInfoMadt4;
754             break;
755 
756         case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
757 
758             InfoTable = AcpiDmTableInfoMadt5;
759             break;
760 
761         case ACPI_MADT_TYPE_IO_SAPIC:
762 
763             InfoTable = AcpiDmTableInfoMadt6;
764             break;
765 
766         case ACPI_MADT_TYPE_LOCAL_SAPIC:
767 
768             InfoTable = AcpiDmTableInfoMadt7;
769             break;
770 
771         case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
772 
773             InfoTable = AcpiDmTableInfoMadt8;
774             break;
775 
776         case ACPI_MADT_TYPE_LOCAL_X2APIC:
777 
778             InfoTable = AcpiDmTableInfoMadt9;
779             break;
780 
781         case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
782 
783             InfoTable = AcpiDmTableInfoMadt10;
784             break;
785 
786         case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
787 
788             InfoTable = AcpiDmTableInfoMadt11;
789             break;
790 
791         case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
792 
793             InfoTable = AcpiDmTableInfoMadt12;
794             break;
795 
796         case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
797 
798             InfoTable = AcpiDmTableInfoMadt13;
799             break;
800 
801         case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
802 
803             InfoTable = AcpiDmTableInfoMadt14;
804             break;
805 
806         case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
807 
808             InfoTable = AcpiDmTableInfoMadt15;
809             break;
810 
811         default:
812 
813             AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
814                 Subtable->Type);
815 
816             /* Attempt to continue */
817 
818             if (!Subtable->Length)
819             {
820                 AcpiOsPrintf ("Invalid zero length subtable\n");
821                 return;
822             }
823 
824             goto NextSubtable;
825         }
826 
827         Status = AcpiDmDumpTable (Length, Offset, Subtable,
828             Subtable->Length, InfoTable);
829         if (ACPI_FAILURE (Status))
830         {
831             return;
832         }
833 
834 NextSubtable:
835         /* Point to next subtable */
836 
837         Offset += Subtable->Length;
838         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
839             Subtable->Length);
840     }
841 }
842 
843 
844 /*******************************************************************************
845  *
846  * FUNCTION:    AcpiDmDumpMcfg
847  *
848  * PARAMETERS:  Table               - A MCFG Table
849  *
850  * RETURN:      None
851  *
852  * DESCRIPTION: Format the contents of a MCFG table
853  *
854  ******************************************************************************/
855 
856 void
857 AcpiDmDumpMcfg (
858     ACPI_TABLE_HEADER       *Table)
859 {
860     ACPI_STATUS             Status;
861     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
862     ACPI_MCFG_ALLOCATION    *Subtable;
863 
864 
865     /* Main table */
866 
867     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
868     if (ACPI_FAILURE (Status))
869     {
870         return;
871     }
872 
873     /* Subtables */
874 
875     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
876     while (Offset < Table->Length)
877     {
878         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
879         {
880             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
881                 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
882             return;
883         }
884 
885         AcpiOsPrintf ("\n");
886         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
887             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
888         if (ACPI_FAILURE (Status))
889         {
890             return;
891         }
892 
893         /* Point to next subtable (each subtable is of fixed length) */
894 
895         Offset += sizeof (ACPI_MCFG_ALLOCATION);
896         Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
897             sizeof (ACPI_MCFG_ALLOCATION));
898     }
899 }
900 
901 
902 /*******************************************************************************
903  *
904  * FUNCTION:    AcpiDmDumpMpst
905  *
906  * PARAMETERS:  Table               - A MPST Table
907  *
908  * RETURN:      None
909  *
910  * DESCRIPTION: Format the contents of a MPST table
911  *
912  ******************************************************************************/
913 
914 void
915 AcpiDmDumpMpst (
916     ACPI_TABLE_HEADER       *Table)
917 {
918     ACPI_STATUS             Status;
919     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
920     ACPI_MPST_POWER_NODE    *Subtable0;
921     ACPI_MPST_POWER_STATE   *Subtable0A;
922     ACPI_MPST_COMPONENT     *Subtable0B;
923     ACPI_MPST_DATA_HDR      *Subtable1;
924     ACPI_MPST_POWER_DATA    *Subtable2;
925     UINT16                  SubtableCount;
926     UINT32                  PowerStateCount;
927     UINT32                  ComponentCount;
928 
929 
930     /* Main table */
931 
932     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
933     if (ACPI_FAILURE (Status))
934     {
935         return;
936     }
937 
938     /* Subtable: Memory Power Node(s) */
939 
940     SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
941     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
942 
943     while ((Offset < Table->Length) && SubtableCount)
944     {
945         AcpiOsPrintf ("\n");
946         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
947             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
948         if (ACPI_FAILURE (Status))
949         {
950             return;
951         }
952 
953         /* Extract the sub-subtable counts */
954 
955         PowerStateCount = Subtable0->NumPowerStates;
956         ComponentCount = Subtable0->NumPhysicalComponents;
957         Offset += sizeof (ACPI_MPST_POWER_NODE);
958 
959         /* Sub-subtables - Memory Power State Structure(s) */
960 
961         Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
962             sizeof (ACPI_MPST_POWER_NODE));
963 
964         while (PowerStateCount)
965         {
966             AcpiOsPrintf ("\n");
967             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
968                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
969             if (ACPI_FAILURE (Status))
970             {
971                 return;
972             }
973 
974             Subtable0A++;
975             PowerStateCount--;
976             Offset += sizeof (ACPI_MPST_POWER_STATE);
977        }
978 
979         /* Sub-subtables - Physical Component ID Structure(s) */
980 
981         Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
982 
983         if (ComponentCount)
984         {
985             AcpiOsPrintf ("\n");
986         }
987 
988         while (ComponentCount)
989         {
990             Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
991                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
992             if (ACPI_FAILURE (Status))
993             {
994                 return;
995             }
996 
997             Subtable0B++;
998             ComponentCount--;
999             Offset += sizeof (ACPI_MPST_COMPONENT);
1000         }
1001 
1002         /* Point to next Memory Power Node subtable */
1003 
1004         SubtableCount--;
1005         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1006             sizeof (ACPI_MPST_POWER_NODE) +
1007             (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1008             (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1009     }
1010 
1011     /* Subtable: Count of Memory Power State Characteristic structures */
1012 
1013     AcpiOsPrintf ("\n");
1014     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1015     Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1016         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1017     if (ACPI_FAILURE (Status))
1018     {
1019         return;
1020     }
1021 
1022     SubtableCount = Subtable1->CharacteristicsCount;
1023     Offset += sizeof (ACPI_MPST_DATA_HDR);
1024 
1025     /* Subtable: Memory Power State Characteristics structure(s) */
1026 
1027     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1028         sizeof (ACPI_MPST_DATA_HDR));
1029 
1030     while ((Offset < Table->Length) && SubtableCount)
1031     {
1032         AcpiOsPrintf ("\n");
1033         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1034             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1035         if (ACPI_FAILURE (Status))
1036         {
1037             return;
1038         }
1039 
1040         Subtable2++;
1041         SubtableCount--;
1042         Offset += sizeof (ACPI_MPST_POWER_DATA);
1043     }
1044 }
1045 
1046 
1047 /*******************************************************************************
1048  *
1049  * FUNCTION:    AcpiDmDumpMsct
1050  *
1051  * PARAMETERS:  Table               - A MSCT table
1052  *
1053  * RETURN:      None
1054  *
1055  * DESCRIPTION: Format the contents of a MSCT
1056  *
1057  ******************************************************************************/
1058 
1059 void
1060 AcpiDmDumpMsct (
1061     ACPI_TABLE_HEADER       *Table)
1062 {
1063     ACPI_STATUS             Status;
1064     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1065     ACPI_MSCT_PROXIMITY     *Subtable;
1066 
1067 
1068     /* Main table */
1069 
1070     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1071     if (ACPI_FAILURE (Status))
1072     {
1073         return;
1074     }
1075 
1076     /* Subtables */
1077 
1078     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1079     while (Offset < Table->Length)
1080     {
1081         /* Common subtable header */
1082 
1083         AcpiOsPrintf ("\n");
1084         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1085             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1086         if (ACPI_FAILURE (Status))
1087         {
1088             return;
1089         }
1090 
1091         /* Point to next subtable */
1092 
1093         Offset += sizeof (ACPI_MSCT_PROXIMITY);
1094         Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1095             sizeof (ACPI_MSCT_PROXIMITY));
1096     }
1097 }
1098 
1099 
1100 /*******************************************************************************
1101  *
1102  * FUNCTION:    AcpiDmDumpMtmr
1103  *
1104  * PARAMETERS:  Table               - A MTMR table
1105  *
1106  * RETURN:      None
1107  *
1108  * DESCRIPTION: Format the contents of a MTMR
1109  *
1110  ******************************************************************************/
1111 
1112 void
1113 AcpiDmDumpMtmr (
1114     ACPI_TABLE_HEADER       *Table)
1115 {
1116     ACPI_STATUS             Status;
1117     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
1118     ACPI_MTMR_ENTRY         *Subtable;
1119 
1120 
1121     /* Main table */
1122 
1123     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
1124     if (ACPI_FAILURE (Status))
1125     {
1126         return;
1127     }
1128 
1129     /* Subtables */
1130 
1131     Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
1132     while (Offset < Table->Length)
1133     {
1134         /* Common subtable header */
1135 
1136         AcpiOsPrintf ("\n");
1137         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1138             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
1139         if (ACPI_FAILURE (Status))
1140         {
1141             return;
1142         }
1143 
1144         /* Point to next subtable */
1145 
1146         Offset += sizeof (ACPI_MTMR_ENTRY);
1147         Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable,
1148             sizeof (ACPI_MTMR_ENTRY));
1149     }
1150 }
1151 
1152 
1153 /*******************************************************************************
1154  *
1155  * FUNCTION:    AcpiDmDumpNfit
1156  *
1157  * PARAMETERS:  Table               - A NFIT table
1158  *
1159  * RETURN:      None
1160  *
1161  * DESCRIPTION: Format the contents of an NFIT.
1162  *
1163  ******************************************************************************/
1164 
1165 void
1166 AcpiDmDumpNfit (
1167     ACPI_TABLE_HEADER       *Table)
1168 {
1169     ACPI_STATUS             Status;
1170     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
1171     UINT32                  FieldOffset = 0;
1172     UINT32                  Length;
1173     ACPI_NFIT_HEADER        *Subtable;
1174     ACPI_DMTABLE_INFO       *InfoTable;
1175     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
1176     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
1177     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1178     UINT32                  i;
1179 
1180 
1181     /* Main table */
1182 
1183     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1184     if (ACPI_FAILURE (Status))
1185     {
1186         return;
1187     }
1188 
1189     /* Subtables */
1190 
1191     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1192     while (Offset < Table->Length)
1193     {
1194         /* NFIT subtable header */
1195 
1196         AcpiOsPrintf ("\n");
1197         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1198             Subtable->Length, AcpiDmTableInfoNfitHdr);
1199         if (ACPI_FAILURE (Status))
1200         {
1201             return;
1202         }
1203 
1204         switch (Subtable->Type)
1205         {
1206         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1207 
1208             InfoTable = AcpiDmTableInfoNfit0;
1209             break;
1210 
1211         case ACPI_NFIT_TYPE_MEMORY_MAP:
1212 
1213             InfoTable = AcpiDmTableInfoNfit1;
1214             break;
1215 
1216         case ACPI_NFIT_TYPE_INTERLEAVE:
1217 
1218             /* Has a variable number of 32-bit values at the end */
1219 
1220             InfoTable = AcpiDmTableInfoNfit2;
1221             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1222             break;
1223 
1224         case ACPI_NFIT_TYPE_SMBIOS:
1225 
1226             SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1227             InfoTable = AcpiDmTableInfoNfit3;
1228             break;
1229 
1230         case ACPI_NFIT_TYPE_CONTROL_REGION:
1231 
1232             InfoTable = AcpiDmTableInfoNfit4;
1233             break;
1234 
1235         case ACPI_NFIT_TYPE_DATA_REGION:
1236 
1237             InfoTable = AcpiDmTableInfoNfit5;
1238             break;
1239 
1240         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1241 
1242             /* Has a variable number of 64-bit addresses at the end */
1243 
1244             InfoTable = AcpiDmTableInfoNfit6;
1245             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
1246             break;
1247 
1248         case ACPI_NFIT_TYPE_CAPABILITIES:    /* ACPI 6.0A */
1249 
1250             InfoTable = AcpiDmTableInfoNfit7;
1251             break;
1252 
1253         default:
1254             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1255                 Subtable->Type);
1256 
1257             /* Attempt to continue */
1258 
1259             if (!Subtable->Length)
1260             {
1261                 AcpiOsPrintf ("Invalid zero length subtable\n");
1262                 return;
1263             }
1264             goto NextSubtable;
1265         }
1266 
1267         AcpiOsPrintf ("\n");
1268         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1269             Subtable->Length, InfoTable);
1270         if (ACPI_FAILURE (Status))
1271         {
1272             return;
1273         }
1274 
1275         /* Per-subtable variable-length fields */
1276 
1277         switch (Subtable->Type)
1278         {
1279         case ACPI_NFIT_TYPE_INTERLEAVE:
1280 
1281             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1282             for (i = 0; i < Interleave->LineCount; i++)
1283             {
1284                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1285                     &Interleave->LineOffset[i],
1286                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
1287                 if (ACPI_FAILURE (Status))
1288                 {
1289                     return;
1290                 }
1291 
1292                 FieldOffset += sizeof (UINT32);
1293             }
1294             break;
1295 
1296         case ACPI_NFIT_TYPE_SMBIOS:
1297 
1298             Length = Subtable->Length -
1299                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
1300 
1301             if (Length)
1302             {
1303                 Status = AcpiDmDumpTable (Table->Length,
1304                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
1305                     SmbiosInfo,
1306                     Length, AcpiDmTableInfoNfit3a);
1307                 if (ACPI_FAILURE (Status))
1308                 {
1309                     return;
1310                 }
1311             }
1312 
1313             break;
1314 
1315         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1316 
1317             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1318             for (i = 0; i < Hint->HintCount; i++)
1319             {
1320                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1321                     &Hint->HintAddress[i],
1322                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
1323                 if (ACPI_FAILURE (Status))
1324                 {
1325                     return;
1326                 }
1327 
1328                 FieldOffset += sizeof (UINT64);
1329             }
1330             break;
1331 
1332         default:
1333             break;
1334         }
1335 
1336 NextSubtable:
1337         /* Point to next subtable */
1338 
1339         Offset += Subtable->Length;
1340         Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1341     }
1342 }
1343 
1344 
1345 /*******************************************************************************
1346  *
1347  * FUNCTION:    AcpiDmDumpPcct
1348  *
1349  * PARAMETERS:  Table               - A PCCT table
1350  *
1351  * RETURN:      None
1352  *
1353  * DESCRIPTION: Format the contents of a PCCT. This table type consists
1354  *              of an open-ended number of subtables.
1355  *
1356  ******************************************************************************/
1357 
1358 void
1359 AcpiDmDumpPcct (
1360     ACPI_TABLE_HEADER       *Table)
1361 {
1362     ACPI_STATUS             Status;
1363     ACPI_PCCT_SUBSPACE      *Subtable;
1364     ACPI_DMTABLE_INFO       *InfoTable;
1365     UINT32                  Length = Table->Length;
1366     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
1367 
1368 
1369     /* Main table */
1370 
1371     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1372     if (ACPI_FAILURE (Status))
1373     {
1374         return;
1375     }
1376 
1377     /* Subtables */
1378 
1379     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1380     while (Offset < Table->Length)
1381     {
1382         /* Common subtable header */
1383 
1384         AcpiOsPrintf ("\n");
1385         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1386             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
1387         if (ACPI_FAILURE (Status))
1388         {
1389             return;
1390         }
1391 
1392         switch (Subtable->Header.Type)
1393         {
1394         case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
1395 
1396             InfoTable = AcpiDmTableInfoPcct0;
1397             break;
1398 
1399         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
1400 
1401             InfoTable = AcpiDmTableInfoPcct1;
1402             break;
1403 
1404         case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
1405 
1406             InfoTable = AcpiDmTableInfoPcct2;
1407             break;
1408 
1409         case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
1410 
1411             InfoTable = AcpiDmTableInfoPcct3;
1412             break;
1413 
1414         case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
1415 
1416             InfoTable = AcpiDmTableInfoPcct4;
1417             break;
1418 
1419         default:
1420 
1421             AcpiOsPrintf (
1422                 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
1423                 Subtable->Header.Type);
1424             return;
1425         }
1426 
1427         AcpiOsPrintf ("\n");
1428         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1429             Subtable->Header.Length, InfoTable);
1430         if (ACPI_FAILURE (Status))
1431         {
1432             return;
1433         }
1434 
1435         /* Point to next subtable */
1436 
1437         Offset += Subtable->Header.Length;
1438         Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
1439             Subtable->Header.Length);
1440     }
1441 }
1442 
1443 
1444 /*******************************************************************************
1445  *
1446  * FUNCTION:    AcpiDmDumpPdtt
1447  *
1448  * PARAMETERS:  Table               - A PDTT table
1449  *
1450  * RETURN:      None
1451  *
1452  * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
1453  *              table that contains an open-ended number of IDs
1454  *              at the end of the table.
1455  *
1456  ******************************************************************************/
1457 
1458 void
1459 AcpiDmDumpPdtt (
1460     ACPI_TABLE_HEADER       *Table)
1461 {
1462     ACPI_STATUS             Status;
1463     ACPI_PDTT_CHANNEL       *Subtable;
1464     UINT32                  Length = Table->Length;
1465     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
1466 
1467 
1468     /* Main table */
1469 
1470     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
1471     if (ACPI_FAILURE (Status))
1472     {
1473         return;
1474     }
1475 
1476     /* Subtables. Currently there is only one type, but can be multiples */
1477 
1478     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
1479     while (Offset < Table->Length)
1480     {
1481         AcpiOsPrintf ("\n");
1482         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1483             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
1484         if (ACPI_FAILURE (Status))
1485         {
1486             return;
1487         }
1488 
1489         /* Point to next subtable */
1490 
1491         Offset += sizeof (ACPI_PDTT_CHANNEL);
1492         Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
1493             sizeof (ACPI_PDTT_CHANNEL));
1494     }
1495 }
1496 
1497 
1498 /*******************************************************************************
1499  *
1500  * FUNCTION:    AcpiDmDumpPmtt
1501  *
1502  * PARAMETERS:  Table               - A PMTT table
1503  *
1504  * RETURN:      None
1505  *
1506  * DESCRIPTION: Format the contents of a PMTT. This table type consists
1507  *              of an open-ended number of subtables.
1508  *
1509  ******************************************************************************/
1510 
1511 void
1512 AcpiDmDumpPmtt (
1513     ACPI_TABLE_HEADER       *Table)
1514 {
1515     ACPI_STATUS             Status;
1516     ACPI_PMTT_HEADER        *Subtable;
1517     ACPI_PMTT_HEADER        *MemSubtable;
1518     ACPI_PMTT_HEADER        *DimmSubtable;
1519     ACPI_PMTT_DOMAIN        *DomainArray;
1520     UINT32                  Length = Table->Length;
1521     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
1522     UINT32                  MemOffset;
1523     UINT32                  DimmOffset;
1524     UINT32                  DomainOffset;
1525     UINT32                  DomainCount;
1526 
1527 
1528     /* Main table */
1529 
1530     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
1531     if (ACPI_FAILURE (Status))
1532     {
1533         return;
1534     }
1535 
1536     /* Subtables */
1537 
1538     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
1539     while (Offset < Table->Length)
1540     {
1541         /* Common subtable header */
1542 
1543         AcpiOsPrintf ("\n");
1544         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1545             Subtable->Length, AcpiDmTableInfoPmttHdr);
1546         if (ACPI_FAILURE (Status))
1547         {
1548             return;
1549         }
1550 
1551         /* Only Socket subtables are expected at this level */
1552 
1553         if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET)
1554         {
1555             AcpiOsPrintf (
1556                 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
1557                 Subtable->Type);
1558             return;
1559         }
1560 
1561         /* Dump the fixed-length portion of the subtable */
1562 
1563         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1564             Subtable->Length, AcpiDmTableInfoPmtt0);
1565         if (ACPI_FAILURE (Status))
1566         {
1567             return;
1568         }
1569 
1570         /* Walk the memory controller subtables */
1571 
1572         MemOffset = sizeof (ACPI_PMTT_SOCKET);
1573         MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
1574             sizeof (ACPI_PMTT_SOCKET));
1575 
1576         while (((Offset + MemOffset) < Table->Length) &&
1577             (MemOffset < Subtable->Length))
1578         {
1579             /* Common subtable header */
1580 
1581             AcpiOsPrintf ("\n");
1582             Status = AcpiDmDumpTable (Length,
1583                 Offset + MemOffset, MemSubtable,
1584                 MemSubtable->Length, AcpiDmTableInfoPmttHdr);
1585             if (ACPI_FAILURE (Status))
1586             {
1587                 return;
1588             }
1589 
1590             /* Only memory controller subtables are expected at this level */
1591 
1592             if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER)
1593             {
1594                 AcpiOsPrintf (
1595                     "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
1596                     MemSubtable->Type);
1597                 return;
1598             }
1599 
1600             /* Dump the fixed-length portion of the controller subtable */
1601 
1602             Status = AcpiDmDumpTable (Length,
1603                 Offset + MemOffset, MemSubtable,
1604                 MemSubtable->Length, AcpiDmTableInfoPmtt1);
1605             if (ACPI_FAILURE (Status))
1606             {
1607                 return;
1608             }
1609 
1610             /* Walk the variable count of proximity domains */
1611 
1612             DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
1613             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
1614             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
1615                 sizeof (ACPI_PMTT_CONTROLLER));
1616 
1617             while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
1618                 ((MemOffset + DomainOffset) < Subtable->Length) &&
1619                 DomainCount)
1620             {
1621                 Status = AcpiDmDumpTable (Length,
1622                     Offset + MemOffset + DomainOffset, DomainArray,
1623                     sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
1624                 if (ACPI_FAILURE (Status))
1625                 {
1626                     return;
1627                 }
1628 
1629                 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
1630                 DomainArray++;
1631                 DomainCount--;
1632             }
1633 
1634             if (DomainCount)
1635             {
1636                 AcpiOsPrintf (
1637                     "\n**** DomainCount exceeds subtable length\n\n");
1638             }
1639 
1640             /* Walk the physical component (DIMM) subtables */
1641 
1642             DimmOffset = DomainOffset;
1643             DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
1644                 DomainOffset);
1645 
1646             while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
1647                 (DimmOffset < MemSubtable->Length))
1648             {
1649                 /* Common subtable header */
1650 
1651                 AcpiOsPrintf ("\n");
1652                 Status = AcpiDmDumpTable (Length,
1653                     Offset + MemOffset + DimmOffset, DimmSubtable,
1654                     DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
1655                 if (ACPI_FAILURE (Status))
1656                 {
1657                     return;
1658                 }
1659 
1660                 /* Only DIMM subtables are expected at this level */
1661 
1662                 if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM)
1663                 {
1664                     AcpiOsPrintf (
1665                         "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
1666                         DimmSubtable->Type);
1667                     return;
1668                 }
1669 
1670                 /* Dump the fixed-length DIMM subtable */
1671 
1672                 Status = AcpiDmDumpTable (Length,
1673                     Offset + MemOffset + DimmOffset, DimmSubtable,
1674                     DimmSubtable->Length, AcpiDmTableInfoPmtt2);
1675                 if (ACPI_FAILURE (Status))
1676                 {
1677                     return;
1678                 }
1679 
1680                 /* Point to next DIMM subtable */
1681 
1682                 DimmOffset += DimmSubtable->Length;
1683                 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
1684                     DimmSubtable, DimmSubtable->Length);
1685             }
1686 
1687             /* Point to next Controller subtable */
1688 
1689             MemOffset += MemSubtable->Length;
1690             MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
1691                 MemSubtable, MemSubtable->Length);
1692         }
1693 
1694         /* Point to next Socket subtable */
1695 
1696         Offset += Subtable->Length;
1697         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
1698             Subtable, Subtable->Length);
1699     }
1700 }
1701 
1702 
1703 /*******************************************************************************
1704  *
1705  * FUNCTION:    AcpiDmDumpPptt
1706  *
1707  * PARAMETERS:  Table               - A PMTT table
1708  *
1709  * RETURN:      None
1710  *
1711  * DESCRIPTION: Format the contents of a PPTT. This table type consists
1712  *              of an open-ended number of subtables.
1713  *
1714  ******************************************************************************/
1715 
1716 void
1717 AcpiDmDumpPptt (
1718     ACPI_TABLE_HEADER       *Table)
1719 {
1720     ACPI_STATUS             Status;
1721     ACPI_SUBTABLE_HEADER    *Subtable;
1722     ACPI_PPTT_PROCESSOR     *PpttProcessor;
1723     UINT8                   Length;
1724     UINT8                   SubtableOffset;
1725     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
1726     ACPI_DMTABLE_INFO       *InfoTable;
1727     UINT32                  i;
1728 
1729 
1730     /* There is no main table (other than the standard ACPI header) */
1731 
1732     /* Subtables */
1733 
1734     Offset = sizeof (ACPI_TABLE_HEADER);
1735     while (Offset < Table->Length)
1736     {
1737         AcpiOsPrintf ("\n");
1738 
1739         /* Common subtable header */
1740 
1741         Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1742         if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
1743         {
1744             AcpiOsPrintf ("Invalid subtable length\n");
1745             return;
1746         }
1747         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1748             Subtable->Length, AcpiDmTableInfoPpttHdr);
1749         if (ACPI_FAILURE (Status))
1750         {
1751             return;
1752         }
1753 
1754         switch (Subtable->Type)
1755         {
1756         case ACPI_PPTT_TYPE_PROCESSOR:
1757 
1758             InfoTable = AcpiDmTableInfoPptt0;
1759             Length = sizeof (ACPI_PPTT_PROCESSOR);
1760             break;
1761 
1762         case ACPI_PPTT_TYPE_CACHE:
1763 
1764             InfoTable = AcpiDmTableInfoPptt1;
1765             Length = sizeof (ACPI_PPTT_CACHE);
1766             break;
1767 
1768         case ACPI_PPTT_TYPE_ID:
1769 
1770             InfoTable = AcpiDmTableInfoPptt2;
1771             Length = sizeof (ACPI_PPTT_ID);
1772             break;
1773 
1774         default:
1775 
1776             AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
1777                 Subtable->Type);
1778 
1779             /* Attempt to continue */
1780 
1781             goto NextSubtable;
1782         }
1783 
1784         if (Subtable->Length < Length)
1785         {
1786             AcpiOsPrintf ("Invalid subtable length\n");
1787             return;
1788         }
1789         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1790             Subtable->Length, InfoTable);
1791         if (ACPI_FAILURE (Status))
1792         {
1793             return;
1794         }
1795         SubtableOffset = Length;
1796 
1797         switch (Subtable->Type)
1798         {
1799         case ACPI_PPTT_TYPE_PROCESSOR:
1800 
1801             PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
1802 
1803             /* Dump SMBIOS handles */
1804 
1805             if ((UINT8)(Subtable->Length - SubtableOffset) <
1806                 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
1807             {
1808                 AcpiOsPrintf ("Invalid private resource number\n");
1809                 return;
1810             }
1811             for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
1812             {
1813                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1814                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
1815                     4, AcpiDmTableInfoPptt0a);
1816                 if (ACPI_FAILURE (Status))
1817                 {
1818                     return;
1819                 }
1820 
1821                 SubtableOffset += 4;
1822             }
1823             break;
1824 
1825         default:
1826 
1827             break;
1828         }
1829 
1830 NextSubtable:
1831         /* Point to next subtable */
1832 
1833         Offset += Subtable->Length;
1834     }
1835 }
1836 
1837 
1838 /*******************************************************************************
1839  *
1840  * FUNCTION:    AcpiDmDumpS3pt
1841  *
1842  * PARAMETERS:  Table               - A S3PT table
1843  *
1844  * RETURN:      Length of the table
1845  *
1846  * DESCRIPTION: Format the contents of a S3PT
1847  *
1848  ******************************************************************************/
1849 
1850 UINT32
1851 AcpiDmDumpS3pt (
1852     ACPI_TABLE_HEADER       *Tables)
1853 {
1854     ACPI_STATUS             Status;
1855     UINT32                  Offset = sizeof (ACPI_TABLE_S3PT);
1856     ACPI_FPDT_HEADER        *Subtable;
1857     ACPI_DMTABLE_INFO       *InfoTable;
1858     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
1859 
1860 
1861     /* Main table */
1862 
1863     Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
1864     if (ACPI_FAILURE (Status))
1865     {
1866         return 0;
1867     }
1868 
1869     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
1870     while (Offset < S3ptTable->Length)
1871     {
1872         /* Common subtable header */
1873 
1874         AcpiOsPrintf ("\n");
1875         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
1876             Subtable->Length, AcpiDmTableInfoS3ptHdr);
1877         if (ACPI_FAILURE (Status))
1878         {
1879             return 0;
1880         }
1881 
1882         switch (Subtable->Type)
1883         {
1884         case ACPI_S3PT_TYPE_RESUME:
1885 
1886             InfoTable = AcpiDmTableInfoS3pt0;
1887             break;
1888 
1889         case ACPI_S3PT_TYPE_SUSPEND:
1890 
1891             InfoTable = AcpiDmTableInfoS3pt1;
1892             break;
1893 
1894         default:
1895 
1896             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
1897                 Subtable->Type);
1898 
1899             /* Attempt to continue */
1900 
1901             if (!Subtable->Length)
1902             {
1903                 AcpiOsPrintf ("Invalid zero length subtable\n");
1904                 return 0;
1905             }
1906             goto NextSubtable;
1907         }
1908 
1909         AcpiOsPrintf ("\n");
1910         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
1911             Subtable->Length, InfoTable);
1912         if (ACPI_FAILURE (Status))
1913         {
1914             return 0;
1915         }
1916 
1917 NextSubtable:
1918         /* Point to next subtable */
1919 
1920         Offset += Subtable->Length;
1921         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
1922     }
1923 
1924     return (S3ptTable->Length);
1925 }
1926 
1927 
1928 /*******************************************************************************
1929  *
1930  * FUNCTION:    AcpiDmDumpSdev
1931  *
1932  * PARAMETERS:  Table               - A SDEV table
1933  *
1934  * RETURN:      None
1935  *
1936  * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
1937  *              table that contains variable strings and vendor data.
1938  *
1939  ******************************************************************************/
1940 
1941 void
1942 AcpiDmDumpSdev (
1943     ACPI_TABLE_HEADER       *Table)
1944 {
1945     ACPI_STATUS             Status;
1946     ACPI_SDEV_HEADER        *Subtable;
1947     ACPI_SDEV_PCIE          *Pcie;
1948     ACPI_SDEV_NAMESPACE     *Namesp;
1949     ACPI_DMTABLE_INFO       *InfoTable;
1950     UINT32                  Length = Table->Length;
1951     UINT32                  Offset = sizeof (ACPI_TABLE_SDEV);
1952     UINT16                  PathOffset;
1953     UINT16                  PathLength;
1954     UINT16                  VendorDataOffset;
1955     UINT16                  VendorDataLength;
1956 
1957 
1958     /* Main table */
1959 
1960     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
1961     if (ACPI_FAILURE (Status))
1962     {
1963         return;
1964     }
1965 
1966     /* Subtables */
1967 
1968     Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
1969     while (Offset < Table->Length)
1970     {
1971         /* Common subtable header */
1972 
1973         AcpiOsPrintf ("\n");
1974         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1975             Subtable->Length, AcpiDmTableInfoSdevHdr);
1976         if (ACPI_FAILURE (Status))
1977         {
1978             return;
1979         }
1980 
1981         switch (Subtable->Type)
1982         {
1983         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
1984 
1985             InfoTable = AcpiDmTableInfoSdev0;
1986             break;
1987 
1988         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
1989 
1990             InfoTable = AcpiDmTableInfoSdev1;
1991             break;
1992 
1993         default:
1994             goto NextSubtable;
1995         }
1996 
1997         AcpiOsPrintf ("\n");
1998         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1999             Subtable->Length, InfoTable);
2000         if (ACPI_FAILURE (Status))
2001         {
2002             return;
2003         }
2004 
2005         switch (Subtable->Type)
2006         {
2007         case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2008 
2009             /* Dump the PCIe device ID(s) */
2010 
2011             Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
2012             PathOffset = Namesp->DeviceIdOffset;
2013             PathLength = Namesp->DeviceIdLength;
2014 
2015             if (PathLength)
2016             {
2017                 Status = AcpiDmDumpTable (Table->Length, 0,
2018                     ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
2019                     PathLength, AcpiDmTableInfoSdev0a);
2020                 if (ACPI_FAILURE (Status))
2021                 {
2022                     return;
2023                 }
2024             }
2025 
2026             /* Dump the vendor-specific data */
2027 
2028             VendorDataLength =
2029                 Namesp->VendorDataLength;
2030             VendorDataOffset =
2031                 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
2032 
2033             if (VendorDataLength)
2034             {
2035                 Status = AcpiDmDumpTable (Table->Length, 0,
2036                     ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
2037                     VendorDataLength, AcpiDmTableInfoSdev1b);
2038                 if (ACPI_FAILURE (Status))
2039                 {
2040                     return;
2041                 }
2042             }
2043             break;
2044 
2045         case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2046 
2047             /* PCI path substructures */
2048 
2049             Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
2050             PathOffset = Pcie->PathOffset;
2051             PathLength = Pcie->PathLength;
2052 
2053             while (PathLength)
2054             {
2055                 Status = AcpiDmDumpTable (Table->Length,
2056                     PathOffset + Offset,
2057                     ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
2058                     sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
2059                 if (ACPI_FAILURE (Status))
2060                 {
2061                     return;
2062                 }
2063 
2064                 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
2065                 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
2066             }
2067 
2068             /* VendorData */
2069 
2070             VendorDataLength = Pcie->VendorDataLength;
2071             VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
2072 
2073             if (VendorDataLength)
2074             {
2075                 Status = AcpiDmDumpTable (Table->Length, 0,
2076                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
2077                     VendorDataLength, AcpiDmTableInfoSdev1b);
2078                 if (ACPI_FAILURE (Status))
2079                 {
2080                     return;
2081                 }
2082             }
2083             break;
2084 
2085         default:
2086             goto NextSubtable;
2087         }
2088 
2089 NextSubtable:
2090         /* Point to next subtable */
2091 
2092         Offset += Subtable->Length;
2093         Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
2094             Subtable->Length);
2095     }
2096 }
2097