xref: /freebsd/sys/contrib/dev/acpica/common/dmtbdump1.c (revision 19261079b74319502c6ffa1249920079f0f69a72)
1 /******************************************************************************
2  *
3  * Module Name: dmtbdump1 - 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 - 2021, 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    ("dmtbdump1")
161 
162 
163 /*******************************************************************************
164  *
165  * FUNCTION:    AcpiDmDumpAest
166  *
167  * PARAMETERS:  Table               - A AEST table
168  *
169  * RETURN:      None
170  *
171  * DESCRIPTION: Format the contents of a AEST table
172  *
173  * NOTE: Assumes the following table structure:
174  *      For all AEST Error Nodes:
175  *          1) An AEST Error Node, followed immediately by:
176  *          2) Any node-specific data
177  *          3) An Interface Structure (one)
178  *          4) A list (array) of Interrupt Structures
179  *
180  * AEST - ARM Error Source table. Conforms to:
181  * ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document Sep 2020
182  *
183  ******************************************************************************/
184 
185 void
186 AcpiDmDumpAest (
187     ACPI_TABLE_HEADER       *Table)
188 {
189     ACPI_STATUS             Status;
190     UINT32                  Offset = sizeof (ACPI_TABLE_HEADER);
191     ACPI_AEST_HEADER        *Subtable;
192     ACPI_AEST_HEADER        *NodeHeader;
193     ACPI_AEST_PROCESSOR     *ProcessorSubtable;
194     ACPI_DMTABLE_INFO       *InfoTable;
195     ACPI_SIZE               Length;
196     UINT8                   Type;
197 
198 
199     /* Very small, generic main table. AEST consists of mostly subtables */
200 
201     while (Offset < Table->Length)
202     {
203         NodeHeader = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset);
204 
205         /* Dump the common error node (subtable) header */
206 
207         Status = AcpiDmDumpTable (Table->Length, Offset, NodeHeader,
208             NodeHeader->Length, AcpiDmTableInfoAestHdr);
209         if (ACPI_FAILURE (Status))
210         {
211             return;
212         }
213 
214         Type = NodeHeader->Type;
215 
216         /* Setup the node-specific subtable based on the header Type field */
217 
218         switch (Type)
219         {
220         case ACPI_AEST_PROCESSOR_ERROR_NODE:
221             InfoTable = AcpiDmTableInfoAestProcError;
222             Length = sizeof (ACPI_AEST_PROCESSOR);
223             break;
224 
225         case ACPI_AEST_MEMORY_ERROR_NODE:
226             InfoTable = AcpiDmTableInfoAestMemError;
227             Length = sizeof (ACPI_AEST_MEMORY);
228             break;
229 
230         case ACPI_AEST_SMMU_ERROR_NODE:
231             InfoTable = AcpiDmTableInfoAestSmmuError;
232             Length = sizeof (ACPI_AEST_SMMU);
233             break;
234 
235         case ACPI_AEST_VENDOR_ERROR_NODE:
236             InfoTable = AcpiDmTableInfoAestVendorError;
237             Length = sizeof (ACPI_AEST_VENDOR);
238             break;
239 
240         case ACPI_AEST_GIC_ERROR_NODE:
241             InfoTable = AcpiDmTableInfoAestGicError;
242             Length = sizeof (ACPI_AEST_GIC);
243             break;
244 
245         /* Error case below */
246         default:
247 
248             AcpiOsPrintf ("\n**** Unknown AEST Error Subtable type 0x%X\n",
249                 Type);
250             return;
251         }
252 
253         /* Point past the common header (to the node-specific data) */
254 
255         Offset += sizeof (ACPI_AEST_HEADER);
256         Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset);
257         AcpiOsPrintf ("\n");
258 
259         /* Dump the node-specific subtable */
260 
261         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, Length,
262             InfoTable);
263         if (ACPI_FAILURE (Status))
264         {
265             return;
266         }
267         AcpiOsPrintf ("\n");
268 
269         if (Type == ACPI_AEST_PROCESSOR_ERROR_NODE)
270         {
271             /*
272              * Special handling for PROCESSOR_ERROR_NODE subtables
273              * (to handle the Resource Substructure via the ResourceType
274              * field).
275              */
276 
277             /* Point past the node-specific data */
278 
279             Offset += Length;
280             ProcessorSubtable = ACPI_CAST_PTR (ACPI_AEST_PROCESSOR, Subtable);
281 
282             switch (ProcessorSubtable->ResourceType)
283             {
284             /* Setup the Resource Substructure subtable */
285 
286             case ACPI_AEST_CACHE_RESOURCE:
287                 InfoTable = AcpiDmTableInfoAestCacheRsrc;
288                 Length = sizeof (ACPI_AEST_PROCESSOR_CACHE);
289                 break;
290 
291             case ACPI_AEST_TLB_RESOURCE:
292                 InfoTable = AcpiDmTableInfoAestTlbRsrc;
293                 Length = sizeof (ACPI_AEST_PROCESSOR_TLB);
294                 break;
295 
296             case ACPI_AEST_GENERIC_RESOURCE:
297                 InfoTable = AcpiDmTableInfoAestGenRsrc;
298                 Length = sizeof (ACPI_AEST_PROCESSOR_GENERIC);
299                 AcpiOsPrintf ("Generic Resource Type (%X) is not supported at this time\n",
300                     ProcessorSubtable->ResourceType);
301                 break;
302 
303             /* Error case below */
304             default:
305                 AcpiOsPrintf ("\n**** Unknown AEST Processor Resource type 0x%X\n",
306                     ProcessorSubtable->ResourceType);
307                 return;
308             }
309 
310             ProcessorSubtable = ACPI_ADD_PTR (ACPI_AEST_PROCESSOR, Table,
311                 Offset);
312 
313             /* Dump the resource substructure subtable */
314 
315             Status = AcpiDmDumpTable (Table->Length, Offset, ProcessorSubtable,
316                 Length, InfoTable);
317             if (ACPI_FAILURE (Status))
318             {
319                 return;
320             }
321 
322             AcpiOsPrintf ("\n");
323         }
324 
325         /* Point past the resource substructure or the node-specific data */
326 
327         Offset += Length;
328 
329         /* Dump the interface structure, required to be present */
330 
331         Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset);
332         if (Subtable->Type >= ACPI_AEST_XFACE_RESERVED)
333         {
334             AcpiOsPrintf ("\n**** Unknown AEST Node Interface type 0x%X\n",
335                 Subtable->Type);
336             return;
337         }
338 
339         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
340             sizeof (ACPI_AEST_NODE_INTERFACE), AcpiDmTableInfoAestXface);
341         if (ACPI_FAILURE (Status))
342         {
343             return;
344         }
345 
346         /* Point past the interface structure */
347 
348         AcpiOsPrintf ("\n");
349         Offset += sizeof (ACPI_AEST_NODE_INTERFACE);
350 
351         /* Dump the entire interrupt structure array, if present */
352 
353         if (NodeHeader->NodeInterruptOffset)
354         {
355             Length = NodeHeader->NodeInterruptCount;
356             Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset);
357 
358             while (Length)
359             {
360                 /* Dump the interrupt structure */
361 
362                 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
363                     sizeof (ACPI_AEST_NODE_INTERRUPT),
364                     AcpiDmTableInfoAestXrupt);
365                 if (ACPI_FAILURE (Status))
366                 {
367                     return;
368                 }
369 
370                 /* Point to the next interrupt structure */
371 
372                 Offset += sizeof (ACPI_AEST_NODE_INTERRUPT);
373                 Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset);
374                 Length--;
375                 AcpiOsPrintf ("\n");
376             }
377         }
378     }
379 }
380 
381 
382 /*******************************************************************************
383  *
384  * FUNCTION:    AcpiDmDumpAsf
385  *
386  * PARAMETERS:  Table               - A ASF table
387  *
388  * RETURN:      None
389  *
390  * DESCRIPTION: Format the contents of a ASF table
391  *
392  ******************************************************************************/
393 
394 void
395 AcpiDmDumpAsf (
396     ACPI_TABLE_HEADER       *Table)
397 {
398     ACPI_STATUS             Status;
399     UINT32                  Offset = sizeof (ACPI_TABLE_HEADER);
400     ACPI_ASF_INFO           *Subtable;
401     ACPI_DMTABLE_INFO       *InfoTable;
402     ACPI_DMTABLE_INFO       *DataInfoTable = NULL;
403     UINT8                   *DataTable = NULL;
404     UINT32                  DataCount = 0;
405     UINT32                  DataLength = 0;
406     UINT32                  DataOffset = 0;
407     UINT32                  i;
408     UINT8                   Type;
409 
410 
411     /* No main table, only subtables */
412 
413     Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
414     while (Offset < Table->Length)
415     {
416         /* Common subtable header */
417 
418         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
419             Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
420         if (ACPI_FAILURE (Status))
421         {
422             return;
423         }
424 
425         /* The actual type is the lower 7 bits of Type */
426 
427         Type = (UINT8) (Subtable->Header.Type & 0x7F);
428 
429         switch (Type)
430         {
431         case ACPI_ASF_TYPE_INFO:
432 
433             InfoTable = AcpiDmTableInfoAsf0;
434             break;
435 
436         case ACPI_ASF_TYPE_ALERT:
437 
438             InfoTable = AcpiDmTableInfoAsf1;
439             DataInfoTable = AcpiDmTableInfoAsf1a;
440             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT));
441             DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts;
442             DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength;
443             DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
444             break;
445 
446         case ACPI_ASF_TYPE_CONTROL:
447 
448             InfoTable = AcpiDmTableInfoAsf2;
449             DataInfoTable = AcpiDmTableInfoAsf2a;
450             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE));
451             DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls;
452             DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength;
453             DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
454             break;
455 
456         case ACPI_ASF_TYPE_BOOT:
457 
458             InfoTable = AcpiDmTableInfoAsf3;
459             break;
460 
461         case ACPI_ASF_TYPE_ADDRESS:
462 
463             InfoTable = AcpiDmTableInfoAsf4;
464             DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS));
465             DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices;
466             DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
467             break;
468 
469         default:
470 
471             AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n",
472                 Subtable->Header.Type);
473             return;
474         }
475 
476         Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
477             Subtable->Header.Length, InfoTable);
478         if (ACPI_FAILURE (Status))
479         {
480             return;
481         }
482 
483         /* Dump variable-length extra data */
484 
485         switch (Type)
486         {
487         case ACPI_ASF_TYPE_ALERT:
488         case ACPI_ASF_TYPE_CONTROL:
489 
490             for (i = 0; i < DataCount; i++)
491             {
492                 AcpiOsPrintf ("\n");
493                 Status = AcpiDmDumpTable (Table->Length, DataOffset,
494                     DataTable, DataLength, DataInfoTable);
495                 if (ACPI_FAILURE (Status))
496                 {
497                     return;
498                 }
499 
500                 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
501                 DataOffset += DataLength;
502             }
503             break;
504 
505         case ACPI_ASF_TYPE_ADDRESS:
506 
507             for (i = 0; i < DataLength; i++)
508             {
509                 if (!(i % 16))
510                 {
511                     AcpiDmLineHeader (DataOffset, 1, "Addresses");
512                 }
513 
514                 AcpiOsPrintf ("%2.2X ", *DataTable);
515                 DataTable++;
516                 DataOffset++;
517 
518                 if (DataOffset > Table->Length)
519                 {
520                     AcpiOsPrintf (
521                         "**** ACPI table terminates in the middle of a "
522                         "data structure! (ASF! table)\n");
523                     return;
524                 }
525             }
526 
527             AcpiOsPrintf ("\n");
528             break;
529 
530         default:
531 
532             break;
533         }
534 
535         AcpiOsPrintf ("\n");
536 
537         /* Point to next subtable */
538 
539         if (!Subtable->Header.Length)
540         {
541             AcpiOsPrintf ("Invalid zero subtable header length\n");
542             return;
543         }
544 
545         Offset += Subtable->Header.Length;
546         Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
547             Subtable->Header.Length);
548     }
549 }
550 
551 /*******************************************************************************
552  *
553  * FUNCTION:    AcpiDmDumpCedt
554  *
555  * PARAMETERS:  Table               - A CEDT table
556  *
557  * RETURN:      None
558  *
559  * DESCRIPTION: Format the contents of a CEDT. This table type consists
560  *              of an open-ended number of subtables.
561  *
562  ******************************************************************************/
563 
564 void
565 AcpiDmDumpCedt (
566     ACPI_TABLE_HEADER       *Table)
567 {
568     ACPI_STATUS             Status;
569     ACPI_CEDT_HEADER        *Subtable;
570     UINT32                  Length = Table->Length;
571     UINT32                  Offset = sizeof (ACPI_TABLE_CEDT);
572     ACPI_DMTABLE_INFO       *InfoTable;
573 
574 
575     /* There is no main table (other than the standard ACPI header) */
576 
577     Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset);
578     while (Offset < Table->Length)
579     {
580         /* Common subtable header */
581 
582         AcpiOsPrintf ("\n");
583         Status = AcpiDmDumpTable (Length, Offset, Subtable,
584             Subtable->Length, AcpiDmTableInfoCedtHdr);
585         if (ACPI_FAILURE (Status))
586         {
587             return;
588         }
589 
590         switch (Subtable->Type)
591         {
592         case ACPI_CEDT_TYPE_CHBS:
593 
594             InfoTable = AcpiDmTableInfoCedt0;
595             break;
596 
597         default:
598 
599             AcpiOsPrintf ("\n**** Unknown CEDT subtable type 0x%X\n\n",
600                 Subtable->Type);
601 
602             /* Attempt to continue */
603 
604             if (!Subtable->Length)
605             {
606                 AcpiOsPrintf ("Invalid zero length subtable\n");
607                 return;
608             }
609             goto NextSubtable;
610         }
611 
612         Status = AcpiDmDumpTable (Length, Offset, Subtable,
613             Subtable->Length, InfoTable);
614         if (ACPI_FAILURE (Status))
615         {
616             return;
617         }
618 
619 NextSubtable:
620         /* Point to next subtable */
621 
622         Offset += Subtable->Length;
623         Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable,
624             Subtable->Length);
625     }
626 }
627 
628 /*******************************************************************************
629  *
630  * FUNCTION:    AcpiDmDumpCpep
631  *
632  * PARAMETERS:  Table               - A CPEP table
633  *
634  * RETURN:      None
635  *
636  * DESCRIPTION: Format the contents of a CPEP. This table type consists
637  *              of an open-ended number of subtables.
638  *
639  ******************************************************************************/
640 
641 void
642 AcpiDmDumpCpep (
643     ACPI_TABLE_HEADER       *Table)
644 {
645     ACPI_STATUS             Status;
646     ACPI_CPEP_POLLING       *Subtable;
647     UINT32                  Length = Table->Length;
648     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
649 
650 
651     /* Main table */
652 
653     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
654     if (ACPI_FAILURE (Status))
655     {
656         return;
657     }
658 
659     /* Subtables */
660 
661     Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
662     while (Offset < Table->Length)
663     {
664         AcpiOsPrintf ("\n");
665         Status = AcpiDmDumpTable (Length, Offset, Subtable,
666             Subtable->Header.Length, AcpiDmTableInfoCpep0);
667         if (ACPI_FAILURE (Status))
668         {
669             return;
670         }
671 
672         /* Point to next subtable */
673 
674         Offset += Subtable->Header.Length;
675         Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable,
676             Subtable->Header.Length);
677     }
678 }
679 
680 
681 /*******************************************************************************
682  *
683  * FUNCTION:    AcpiDmDumpCsrt
684  *
685  * PARAMETERS:  Table               - A CSRT table
686  *
687  * RETURN:      None
688  *
689  * DESCRIPTION: Format the contents of a CSRT. This table type consists
690  *              of an open-ended number of subtables.
691  *
692  ******************************************************************************/
693 
694 void
695 AcpiDmDumpCsrt (
696     ACPI_TABLE_HEADER       *Table)
697 {
698     ACPI_STATUS             Status;
699     ACPI_CSRT_GROUP         *Subtable;
700     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
701     ACPI_CSRT_DESCRIPTOR    *SubSubtable;
702     UINT32                  Length = Table->Length;
703     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
704     UINT32                  SubOffset;
705     UINT32                  SubSubOffset;
706     UINT32                  InfoLength;
707 
708 
709     /* The main table only contains the ACPI header, thus already handled */
710 
711     /* Subtables (Resource Groups) */
712 
713     Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
714     while (Offset < Table->Length)
715     {
716         /* Resource group subtable */
717 
718         AcpiOsPrintf ("\n");
719         Status = AcpiDmDumpTable (Length, Offset, Subtable,
720             Subtable->Length, AcpiDmTableInfoCsrt0);
721         if (ACPI_FAILURE (Status))
722         {
723             return;
724         }
725 
726         /* Shared info subtable (One per resource group) */
727 
728         SubOffset = sizeof (ACPI_CSRT_GROUP);
729         SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
730             Offset + SubOffset);
731 
732         AcpiOsPrintf ("\n");
733         Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
734             sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
735         if (ACPI_FAILURE (Status))
736         {
737             return;
738         }
739 
740         SubOffset += Subtable->SharedInfoLength;
741 
742         /* Sub-Subtables (Resource Descriptors) */
743 
744         SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
745             Offset + SubOffset);
746 
747         while ((SubOffset < Subtable->Length) &&
748               ((Offset + SubOffset) < Table->Length))
749         {
750             AcpiOsPrintf ("\n");
751             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
752                 SubSubtable->Length, AcpiDmTableInfoCsrt2);
753             if (ACPI_FAILURE (Status))
754             {
755                 return;
756             }
757 
758             SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
759 
760             /* Resource-specific info buffer */
761 
762             InfoLength = SubSubtable->Length - SubSubOffset;
763             if (InfoLength)
764             {
765                 Status = AcpiDmDumpTable (Length,
766                     Offset + SubOffset + SubSubOffset, Table,
767                     InfoLength, AcpiDmTableInfoCsrt2a);
768                 if (ACPI_FAILURE (Status))
769                 {
770                     return;
771                 }
772             }
773 
774             /* Point to next sub-subtable */
775 
776             SubOffset += SubSubtable->Length;
777             SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
778                 SubSubtable->Length);
779         }
780 
781         /* Point to next subtable */
782 
783         Offset += Subtable->Length;
784         Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable,
785             Subtable->Length);
786     }
787 }
788 
789 
790 /*******************************************************************************
791  *
792  * FUNCTION:    AcpiDmDumpDbg2
793  *
794  * PARAMETERS:  Table               - A DBG2 table
795  *
796  * RETURN:      None
797  *
798  * DESCRIPTION: Format the contents of a DBG2. This table type consists
799  *              of an open-ended number of subtables.
800  *
801  ******************************************************************************/
802 
803 void
804 AcpiDmDumpDbg2 (
805     ACPI_TABLE_HEADER       *Table)
806 {
807     ACPI_STATUS             Status;
808     ACPI_DBG2_DEVICE        *Subtable;
809     UINT32                  Length = Table->Length;
810     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
811     UINT32                  i;
812     UINT32                  ArrayOffset;
813     UINT32                  AbsoluteOffset;
814     UINT8                   *Array;
815 
816 
817     /* Main table */
818 
819     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
820     if (ACPI_FAILURE (Status))
821     {
822         return;
823     }
824 
825     /* Subtables */
826 
827     Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
828     while (Offset < Table->Length)
829     {
830         AcpiOsPrintf ("\n");
831         Status = AcpiDmDumpTable (Length, Offset, Subtable,
832             Subtable->Length, AcpiDmTableInfoDbg2Device);
833         if (ACPI_FAILURE (Status))
834         {
835             return;
836         }
837 
838         /* Dump the BaseAddress array */
839 
840         for (i = 0; i < Subtable->RegisterCount; i++)
841         {
842             ArrayOffset = Subtable->BaseAddressOffset +
843                 (sizeof (ACPI_GENERIC_ADDRESS) * i);
844             AbsoluteOffset = Offset + ArrayOffset;
845             Array = (UINT8 *) Subtable + ArrayOffset;
846 
847             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
848                 Subtable->Length, AcpiDmTableInfoDbg2Addr);
849             if (ACPI_FAILURE (Status))
850             {
851                 return;
852             }
853         }
854 
855         /* Dump the AddressSize array */
856 
857         for (i = 0; i < Subtable->RegisterCount; i++)
858         {
859             ArrayOffset = Subtable->AddressSizeOffset +
860                 (sizeof (UINT32) * i);
861             AbsoluteOffset = Offset + ArrayOffset;
862             Array = (UINT8 *) Subtable + ArrayOffset;
863 
864             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
865                 Subtable->Length, AcpiDmTableInfoDbg2Size);
866             if (ACPI_FAILURE (Status))
867             {
868                 return;
869             }
870         }
871 
872         /* Dump the Namestring (required) */
873 
874         AcpiOsPrintf ("\n");
875         ArrayOffset = Subtable->NamepathOffset;
876         AbsoluteOffset = Offset + ArrayOffset;
877         Array = (UINT8 *) Subtable + ArrayOffset;
878 
879         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
880             Subtable->Length, AcpiDmTableInfoDbg2Name);
881         if (ACPI_FAILURE (Status))
882         {
883             return;
884         }
885 
886         /* Dump the OemData (optional) */
887 
888         if (Subtable->OemDataOffset)
889         {
890             Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
891                 Table, Subtable->OemDataLength,
892                 AcpiDmTableInfoDbg2OemData);
893             if (ACPI_FAILURE (Status))
894             {
895                 return;
896             }
897         }
898 
899         /* Point to next subtable */
900 
901         Offset += Subtable->Length;
902         Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
903             Subtable->Length);
904     }
905 }
906 
907 
908 /*******************************************************************************
909  *
910  * FUNCTION:    AcpiDmDumpDmar
911  *
912  * PARAMETERS:  Table               - A DMAR table
913  *
914  * RETURN:      None
915  *
916  * DESCRIPTION: Format the contents of a DMAR. This table type consists
917  *              of an open-ended number of subtables.
918  *
919  ******************************************************************************/
920 
921 void
922 AcpiDmDumpDmar (
923     ACPI_TABLE_HEADER       *Table)
924 {
925     ACPI_STATUS             Status;
926     ACPI_DMAR_HEADER        *Subtable;
927     UINT32                  Length = Table->Length;
928     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
929     ACPI_DMTABLE_INFO       *InfoTable;
930     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
931     UINT32                  ScopeOffset;
932     UINT8                   *PciPath;
933     UINT32                  PathOffset;
934 
935 
936     /* Main table */
937 
938     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
939     if (ACPI_FAILURE (Status))
940     {
941         return;
942     }
943 
944     /* Subtables */
945 
946     Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
947     while (Offset < Table->Length)
948     {
949         /* Common subtable header */
950 
951         AcpiOsPrintf ("\n");
952         Status = AcpiDmDumpTable (Length, Offset, Subtable,
953             Subtable->Length, AcpiDmTableInfoDmarHdr);
954         if (ACPI_FAILURE (Status))
955         {
956             return;
957         }
958 
959         AcpiOsPrintf ("\n");
960 
961         switch (Subtable->Type)
962         {
963         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
964 
965             InfoTable = AcpiDmTableInfoDmar0;
966             ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
967             break;
968 
969         case ACPI_DMAR_TYPE_RESERVED_MEMORY:
970 
971             InfoTable = AcpiDmTableInfoDmar1;
972             ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
973             break;
974 
975         case ACPI_DMAR_TYPE_ROOT_ATS:
976 
977             InfoTable = AcpiDmTableInfoDmar2;
978             ScopeOffset = sizeof (ACPI_DMAR_ATSR);
979             break;
980 
981         case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
982 
983             InfoTable = AcpiDmTableInfoDmar3;
984             ScopeOffset = sizeof (ACPI_DMAR_RHSA);
985             break;
986 
987         case ACPI_DMAR_TYPE_NAMESPACE:
988 
989             InfoTable = AcpiDmTableInfoDmar4;
990             ScopeOffset = sizeof (ACPI_DMAR_ANDD);
991             break;
992 
993         default:
994 
995             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
996                 Subtable->Type);
997             return;
998         }
999 
1000         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1001             Subtable->Length, InfoTable);
1002         if (ACPI_FAILURE (Status))
1003         {
1004             return;
1005         }
1006 
1007         /*
1008          * Dump the optional device scope entries
1009          */
1010         if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1011             (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
1012         {
1013             /* These types do not support device scopes */
1014 
1015             goto NextSubtable;
1016         }
1017 
1018         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
1019         while (ScopeOffset < Subtable->Length)
1020         {
1021             AcpiOsPrintf ("\n");
1022             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
1023                 ScopeTable->Length, AcpiDmTableInfoDmarScope);
1024             if (ACPI_FAILURE (Status))
1025             {
1026                 return;
1027             }
1028             AcpiOsPrintf ("\n");
1029 
1030             /* Dump the PCI Path entries for this device scope */
1031 
1032             PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
1033 
1034             PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
1035                 sizeof (ACPI_DMAR_DEVICE_SCOPE));
1036 
1037             while (PathOffset < ScopeTable->Length)
1038             {
1039                 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2,
1040                     "PCI Path");
1041                 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
1042 
1043                 /* Point to next PCI Path entry */
1044 
1045                 PathOffset += 2;
1046                 PciPath += 2;
1047                 AcpiOsPrintf ("\n");
1048             }
1049 
1050             /* Point to next device scope entry */
1051 
1052             ScopeOffset += ScopeTable->Length;
1053             ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
1054                 ScopeTable, ScopeTable->Length);
1055         }
1056 
1057 NextSubtable:
1058         /* Point to next subtable */
1059 
1060         Offset += Subtable->Length;
1061         Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
1062             Subtable->Length);
1063     }
1064 }
1065 
1066 
1067 /*******************************************************************************
1068  *
1069  * FUNCTION:    AcpiDmDumpDrtm
1070  *
1071  * PARAMETERS:  Table               - A DRTM table
1072  *
1073  * RETURN:      None
1074  *
1075  * DESCRIPTION: Format the contents of a DRTM.
1076  *
1077  ******************************************************************************/
1078 
1079 void
1080 AcpiDmDumpDrtm (
1081     ACPI_TABLE_HEADER       *Table)
1082 {
1083     ACPI_STATUS             Status;
1084     UINT32                  Offset;
1085     ACPI_DRTM_VTABLE_LIST   *DrtmVtl;
1086     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
1087     ACPI_DRTM_DPS_ID        *DrtmDps;
1088     UINT32                  Count;
1089 
1090 
1091     /* Main table */
1092 
1093     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
1094         AcpiDmTableInfoDrtm);
1095     if (ACPI_FAILURE (Status))
1096     {
1097         return;
1098     }
1099 
1100     Offset = sizeof (ACPI_TABLE_DRTM);
1101 
1102     /* Sub-tables */
1103 
1104     /* Dump ValidatedTable length */
1105 
1106     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
1107     AcpiOsPrintf ("\n");
1108     Status = AcpiDmDumpTable (Table->Length, Offset,
1109         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
1110         AcpiDmTableInfoDrtm0);
1111     if (ACPI_FAILURE (Status))
1112     {
1113             return;
1114     }
1115 
1116     Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
1117 
1118     /* Dump Validated table addresses */
1119 
1120     Count = 0;
1121     while ((Offset < Table->Length) &&
1122             (DrtmVtl->ValidatedTableCount > Count))
1123     {
1124         Status = AcpiDmDumpTable (Table->Length, Offset,
1125             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
1126             AcpiDmTableInfoDrtm0a);
1127         if (ACPI_FAILURE (Status))
1128         {
1129             return;
1130         }
1131 
1132         Offset += sizeof (UINT64);
1133         Count++;
1134     }
1135 
1136     /* Dump ResourceList length */
1137 
1138     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
1139     AcpiOsPrintf ("\n");
1140     Status = AcpiDmDumpTable (Table->Length, Offset,
1141         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
1142         AcpiDmTableInfoDrtm1);
1143     if (ACPI_FAILURE (Status))
1144     {
1145         return;
1146     }
1147 
1148     Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
1149 
1150     /* Dump the Resource List */
1151 
1152     Count = 0;
1153     while ((Offset < Table->Length) &&
1154            (DrtmRl->ResourceCount > Count))
1155     {
1156         Status = AcpiDmDumpTable (Table->Length, Offset,
1157             ACPI_ADD_PTR (void, Table, Offset),
1158             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
1159         if (ACPI_FAILURE (Status))
1160         {
1161             return;
1162         }
1163 
1164         Offset += sizeof (ACPI_DRTM_RESOURCE);
1165         Count++;
1166     }
1167 
1168     /* Dump DPS */
1169 
1170     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
1171     AcpiOsPrintf ("\n");
1172     (void) AcpiDmDumpTable (Table->Length, Offset,
1173         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
1174 }
1175 
1176 
1177 /*******************************************************************************
1178  *
1179  * FUNCTION:    AcpiDmDumpEinj
1180  *
1181  * PARAMETERS:  Table               - A EINJ table
1182  *
1183  * RETURN:      None
1184  *
1185  * DESCRIPTION: Format the contents of a EINJ. This table type consists
1186  *              of an open-ended number of subtables.
1187  *
1188  ******************************************************************************/
1189 
1190 void
1191 AcpiDmDumpEinj (
1192     ACPI_TABLE_HEADER       *Table)
1193 {
1194     ACPI_STATUS             Status;
1195     ACPI_WHEA_HEADER        *Subtable;
1196     UINT32                  Length = Table->Length;
1197     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
1198 
1199 
1200     /* Main table */
1201 
1202     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
1203     if (ACPI_FAILURE (Status))
1204     {
1205         return;
1206     }
1207 
1208     /* Subtables */
1209 
1210     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1211     while (Offset < Table->Length)
1212     {
1213         AcpiOsPrintf ("\n");
1214         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1215             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1216         if (ACPI_FAILURE (Status))
1217         {
1218             return;
1219         }
1220 
1221         /* Point to next subtable (each subtable is of fixed length) */
1222 
1223         Offset += sizeof (ACPI_WHEA_HEADER);
1224         Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable,
1225             sizeof (ACPI_WHEA_HEADER));
1226     }
1227 }
1228 
1229 
1230 /*******************************************************************************
1231  *
1232  * FUNCTION:    AcpiDmDumpErst
1233  *
1234  * PARAMETERS:  Table               - A ERST table
1235  *
1236  * RETURN:      None
1237  *
1238  * DESCRIPTION: Format the contents of a ERST. This table type consists
1239  *              of an open-ended number of subtables.
1240  *
1241  ******************************************************************************/
1242 
1243 void
1244 AcpiDmDumpErst (
1245     ACPI_TABLE_HEADER       *Table)
1246 {
1247     ACPI_STATUS             Status;
1248     ACPI_WHEA_HEADER        *Subtable;
1249     UINT32                  Length = Table->Length;
1250     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
1251 
1252 
1253     /* Main table */
1254 
1255     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1256     if (ACPI_FAILURE (Status))
1257     {
1258         return;
1259     }
1260 
1261     /* Subtables */
1262 
1263     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1264     while (Offset < Table->Length)
1265     {
1266         AcpiOsPrintf ("\n");
1267         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1268             sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1269         if (ACPI_FAILURE (Status))
1270         {
1271             return;
1272         }
1273 
1274         /* Point to next subtable (each subtable is of fixed length) */
1275 
1276         Offset += sizeof (ACPI_WHEA_HEADER);
1277         Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable,
1278             sizeof (ACPI_WHEA_HEADER));
1279     }
1280 }
1281 
1282 
1283 /*******************************************************************************
1284  *
1285  * FUNCTION:    AcpiDmDumpFpdt
1286  *
1287  * PARAMETERS:  Table               - A FPDT table
1288  *
1289  * RETURN:      None
1290  *
1291  * DESCRIPTION: Format the contents of a FPDT. This table type consists
1292  *              of an open-ended number of subtables.
1293  *
1294  ******************************************************************************/
1295 
1296 void
1297 AcpiDmDumpFpdt (
1298     ACPI_TABLE_HEADER       *Table)
1299 {
1300     ACPI_STATUS             Status;
1301     ACPI_FPDT_HEADER        *Subtable;
1302     UINT32                  Length = Table->Length;
1303     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
1304     ACPI_DMTABLE_INFO       *InfoTable;
1305 
1306 
1307     /* There is no main table (other than the standard ACPI header) */
1308 
1309     /* Subtables */
1310 
1311     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1312     while (Offset < Table->Length)
1313     {
1314         /* Common subtable header */
1315 
1316         AcpiOsPrintf ("\n");
1317         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1318             Subtable->Length, AcpiDmTableInfoFpdtHdr);
1319         if (ACPI_FAILURE (Status))
1320         {
1321             return;
1322         }
1323 
1324         switch (Subtable->Type)
1325         {
1326         case ACPI_FPDT_TYPE_BOOT:
1327 
1328             InfoTable = AcpiDmTableInfoFpdt0;
1329             break;
1330 
1331         case ACPI_FPDT_TYPE_S3PERF:
1332 
1333             InfoTable = AcpiDmTableInfoFpdt1;
1334             break;
1335 
1336         default:
1337 
1338             AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
1339                 Subtable->Type);
1340 
1341             /* Attempt to continue */
1342 
1343             if (!Subtable->Length)
1344             {
1345                 AcpiOsPrintf ("Invalid zero length subtable\n");
1346                 return;
1347             }
1348             goto NextSubtable;
1349         }
1350 
1351         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1352             Subtable->Length, InfoTable);
1353         if (ACPI_FAILURE (Status))
1354         {
1355             return;
1356         }
1357 
1358 NextSubtable:
1359         /* Point to next subtable */
1360 
1361         Offset += Subtable->Length;
1362         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable,
1363             Subtable->Length);
1364     }
1365 }
1366 
1367 
1368 /*******************************************************************************
1369  *
1370  * FUNCTION:    AcpiDmDumpGtdt
1371  *
1372  * PARAMETERS:  Table               - A GTDT table
1373  *
1374  * RETURN:      None
1375  *
1376  * DESCRIPTION: Format the contents of a GTDT. This table type consists
1377  *              of an open-ended number of subtables.
1378  *
1379  ******************************************************************************/
1380 
1381 void
1382 AcpiDmDumpGtdt (
1383     ACPI_TABLE_HEADER       *Table)
1384 {
1385     ACPI_STATUS             Status;
1386     ACPI_GTDT_HEADER        *Subtable;
1387     UINT32                  Length = Table->Length;
1388     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
1389     ACPI_DMTABLE_INFO       *InfoTable;
1390     UINT32                  SubtableLength;
1391     UINT32                  GtCount;
1392     ACPI_GTDT_TIMER_ENTRY   *GtxTable;
1393 
1394 
1395     /* Main table */
1396 
1397     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
1398     if (ACPI_FAILURE (Status))
1399     {
1400         return;
1401     }
1402 
1403     /* Rev 3 fields */
1404 
1405     Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1406 
1407     if (Table->Revision > 2)
1408     {
1409         SubtableLength = sizeof (ACPI_GTDT_EL2);
1410         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1411             SubtableLength, AcpiDmTableInfoGtdtEl2);
1412         if (ACPI_FAILURE (Status))
1413         {
1414             return;
1415         }
1416         Offset += SubtableLength;
1417     }
1418 
1419     Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1420 
1421     /* Subtables */
1422 
1423     while (Offset < Table->Length)
1424     {
1425         /* Common subtable header */
1426 
1427         AcpiOsPrintf ("\n");
1428         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1429             Subtable->Length, AcpiDmTableInfoGtdtHdr);
1430         if (ACPI_FAILURE (Status))
1431         {
1432             return;
1433         }
1434 
1435         GtCount = 0;
1436         switch (Subtable->Type)
1437         {
1438         case ACPI_GTDT_TYPE_TIMER_BLOCK:
1439 
1440             SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
1441             GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1442                 Subtable))->TimerCount;
1443 
1444             InfoTable = AcpiDmTableInfoGtdt0;
1445             break;
1446 
1447         case ACPI_GTDT_TYPE_WATCHDOG:
1448 
1449             SubtableLength = sizeof (ACPI_GTDT_WATCHDOG);
1450 
1451             InfoTable = AcpiDmTableInfoGtdt1;
1452             break;
1453 
1454         default:
1455 
1456             /* Cannot continue on unknown type - no length */
1457 
1458             AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n",
1459                 Subtable->Type);
1460             return;
1461         }
1462 
1463         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1464             Subtable->Length, InfoTable);
1465         if (ACPI_FAILURE (Status))
1466         {
1467             return;
1468         }
1469 
1470         /* Point to end of current subtable (each subtable above is of fixed length) */
1471 
1472         Offset += SubtableLength;
1473 
1474         /* If there are any Gt Timer Blocks from above, dump them now */
1475 
1476         if (GtCount)
1477         {
1478             GtxTable = ACPI_ADD_PTR (
1479                 ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength);
1480             SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
1481 
1482             while (GtCount)
1483             {
1484                 AcpiOsPrintf ("\n");
1485                 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
1486                     sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
1487                 if (ACPI_FAILURE (Status))
1488                 {
1489                     return;
1490                 }
1491                 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
1492                 GtxTable++;
1493                 GtCount--;
1494             }
1495         }
1496 
1497         /* Point to next subtable */
1498 
1499         Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength);
1500     }
1501 }
1502 
1503 
1504 /*******************************************************************************
1505  *
1506  * FUNCTION:    AcpiDmDumpHest
1507  *
1508  * PARAMETERS:  Table               - A HEST table
1509  *
1510  * RETURN:      None
1511  *
1512  * DESCRIPTION: Format the contents of a HEST. This table type consists
1513  *              of an open-ended number of subtables.
1514  *
1515  ******************************************************************************/
1516 
1517 void
1518 AcpiDmDumpHest (
1519     ACPI_TABLE_HEADER       *Table)
1520 {
1521     ACPI_STATUS             Status;
1522     ACPI_HEST_HEADER        *Subtable;
1523     UINT32                  Length = Table->Length;
1524     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
1525     ACPI_DMTABLE_INFO       *InfoTable;
1526     UINT32                  SubtableLength;
1527     UINT32                  BankCount;
1528     ACPI_HEST_IA_ERROR_BANK *BankTable;
1529 
1530 
1531     /* Main table */
1532 
1533     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1534     if (ACPI_FAILURE (Status))
1535     {
1536         return;
1537     }
1538 
1539     /* Subtables */
1540 
1541     Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1542     while (Offset < Table->Length)
1543     {
1544         BankCount = 0;
1545         switch (Subtable->Type)
1546         {
1547         case ACPI_HEST_TYPE_IA32_CHECK:
1548 
1549             InfoTable = AcpiDmTableInfoHest0;
1550             SubtableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1551             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1552                 Subtable))->NumHardwareBanks;
1553             break;
1554 
1555         case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1556 
1557             InfoTable = AcpiDmTableInfoHest1;
1558             SubtableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1559             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1560                 Subtable))->NumHardwareBanks;
1561             break;
1562 
1563         case ACPI_HEST_TYPE_IA32_NMI:
1564 
1565             InfoTable = AcpiDmTableInfoHest2;
1566             SubtableLength = sizeof (ACPI_HEST_IA_NMI);
1567             break;
1568 
1569         case ACPI_HEST_TYPE_AER_ROOT_PORT:
1570 
1571             InfoTable = AcpiDmTableInfoHest6;
1572             SubtableLength = sizeof (ACPI_HEST_AER_ROOT);
1573             break;
1574 
1575         case ACPI_HEST_TYPE_AER_ENDPOINT:
1576 
1577             InfoTable = AcpiDmTableInfoHest7;
1578             SubtableLength = sizeof (ACPI_HEST_AER);
1579             break;
1580 
1581         case ACPI_HEST_TYPE_AER_BRIDGE:
1582 
1583             InfoTable = AcpiDmTableInfoHest8;
1584             SubtableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1585             break;
1586 
1587         case ACPI_HEST_TYPE_GENERIC_ERROR:
1588 
1589             InfoTable = AcpiDmTableInfoHest9;
1590             SubtableLength = sizeof (ACPI_HEST_GENERIC);
1591             break;
1592 
1593         case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1594 
1595             InfoTable = AcpiDmTableInfoHest10;
1596             SubtableLength = sizeof (ACPI_HEST_GENERIC_V2);
1597             break;
1598 
1599         case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1600 
1601             InfoTable = AcpiDmTableInfoHest11;
1602             SubtableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK);
1603             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK,
1604                 Subtable))->NumHardwareBanks;
1605             break;
1606 
1607         default:
1608 
1609             /* Cannot continue on unknown type - no length */
1610 
1611             AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
1612                 Subtable->Type);
1613             return;
1614         }
1615 
1616         AcpiOsPrintf ("\n");
1617         Status = AcpiDmDumpTable (Length, Offset, Subtable,
1618             SubtableLength, InfoTable);
1619         if (ACPI_FAILURE (Status))
1620         {
1621             return;
1622         }
1623 
1624         /* Point to end of current subtable (each subtable above is of fixed length) */
1625 
1626         Offset += SubtableLength;
1627 
1628         /* If there are any (fixed-length) Error Banks from above, dump them now */
1629 
1630         if (BankCount)
1631         {
1632             BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, Subtable,
1633                 SubtableLength);
1634             SubtableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1635 
1636             while (BankCount)
1637             {
1638                 AcpiOsPrintf ("\n");
1639                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1640                     sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1641                 if (ACPI_FAILURE (Status))
1642                 {
1643                     return;
1644                 }
1645 
1646                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1647                 BankTable++;
1648                 BankCount--;
1649             }
1650         }
1651 
1652         /* Point to next subtable */
1653 
1654         Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Subtable, SubtableLength);
1655     }
1656 }
1657 
1658 
1659 /*******************************************************************************
1660  *
1661  * FUNCTION:    AcpiDmDumpHmat
1662  *
1663  * PARAMETERS:  Table               - A HMAT table
1664  *
1665  * RETURN:      None
1666  *
1667  * DESCRIPTION: Format the contents of a HMAT.
1668  *
1669  ******************************************************************************/
1670 
1671 void
1672 AcpiDmDumpHmat (
1673     ACPI_TABLE_HEADER       *Table)
1674 {
1675     ACPI_STATUS             Status;
1676     ACPI_HMAT_STRUCTURE     *HmatStruct;
1677     ACPI_HMAT_LOCALITY      *HmatLocality;
1678     ACPI_HMAT_CACHE         *HmatCache;
1679     UINT32                  Offset;
1680     UINT32                  SubtableOffset;
1681     UINT32                  Length;
1682     ACPI_DMTABLE_INFO       *InfoTable;
1683     UINT32                  i, j;
1684 
1685 
1686     /* Main table */
1687 
1688     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat);
1689     if (ACPI_FAILURE (Status))
1690     {
1691         return;
1692     }
1693     Offset = sizeof (ACPI_TABLE_HMAT);
1694 
1695     while (Offset < Table->Length)
1696     {
1697         AcpiOsPrintf ("\n");
1698 
1699         /* Dump HMAT structure header */
1700 
1701         HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset);
1702         if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE))
1703         {
1704             AcpiOsPrintf ("Invalid HMAT structure length\n");
1705             return;
1706         }
1707         Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
1708             HmatStruct->Length, AcpiDmTableInfoHmatHdr);
1709         if (ACPI_FAILURE (Status))
1710         {
1711             return;
1712         }
1713 
1714         switch (HmatStruct->Type)
1715         {
1716         case ACPI_HMAT_TYPE_ADDRESS_RANGE:
1717 
1718             InfoTable = AcpiDmTableInfoHmat0;
1719             Length = sizeof (ACPI_HMAT_PROXIMITY_DOMAIN);
1720             break;
1721 
1722         case ACPI_HMAT_TYPE_LOCALITY:
1723 
1724             InfoTable = AcpiDmTableInfoHmat1;
1725             Length = sizeof (ACPI_HMAT_LOCALITY);
1726             break;
1727 
1728         case ACPI_HMAT_TYPE_CACHE:
1729 
1730             InfoTable = AcpiDmTableInfoHmat2;
1731             Length = sizeof (ACPI_HMAT_CACHE);
1732             break;
1733 
1734         default:
1735 
1736             AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n",
1737                 HmatStruct->Type);
1738 
1739             /* Attempt to continue */
1740 
1741             goto NextSubtable;
1742         }
1743 
1744         /* Dump HMAT structure body */
1745 
1746         if (HmatStruct->Length < Length)
1747         {
1748             AcpiOsPrintf ("Invalid HMAT structure length\n");
1749             return;
1750         }
1751         Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
1752             HmatStruct->Length, InfoTable);
1753         if (ACPI_FAILURE (Status))
1754         {
1755             return;
1756         }
1757 
1758         /* Dump HMAT structure additionals */
1759 
1760         switch (HmatStruct->Type)
1761         {
1762         case ACPI_HMAT_TYPE_LOCALITY:
1763 
1764             HmatLocality = ACPI_CAST_PTR (ACPI_HMAT_LOCALITY, HmatStruct);
1765             SubtableOffset = sizeof (ACPI_HMAT_LOCALITY);
1766 
1767             /* Dump initiator proximity domains */
1768 
1769             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1770                 (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4))
1771             {
1772                 AcpiOsPrintf ("Invalid initiator proximity domain number\n");
1773                 return;
1774             }
1775             for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
1776             {
1777                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1778                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1779                     4, AcpiDmTableInfoHmat1a);
1780                 if (ACPI_FAILURE (Status))
1781                 {
1782                     return;
1783                 }
1784 
1785                 SubtableOffset += 4;
1786             }
1787 
1788             /* Dump target proximity domains */
1789 
1790             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1791                 (UINT32)(HmatLocality->NumberOfTargetPDs * 4))
1792             {
1793                 AcpiOsPrintf ("Invalid target proximity domain number\n");
1794                 return;
1795             }
1796             for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++)
1797             {
1798                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1799                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1800                     4, AcpiDmTableInfoHmat1b);
1801                 if (ACPI_FAILURE (Status))
1802                 {
1803                     return;
1804                 }
1805 
1806                 SubtableOffset += 4;
1807             }
1808 
1809             /* Dump latency/bandwidth entris */
1810 
1811             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1812                 (UINT32)(HmatLocality->NumberOfInitiatorPDs *
1813                          HmatLocality->NumberOfTargetPDs * 2))
1814             {
1815                 AcpiOsPrintf ("Invalid latency/bandwidth entry number\n");
1816                 return;
1817             }
1818             for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
1819             {
1820                 for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++)
1821                 {
1822                     Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1823                         ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1824                         2, AcpiDmTableInfoHmat1c);
1825                     if (ACPI_FAILURE(Status))
1826                     {
1827                         return;
1828                     }
1829 
1830                     SubtableOffset += 2;
1831                 }
1832             }
1833             break;
1834 
1835         case ACPI_HMAT_TYPE_CACHE:
1836 
1837             HmatCache = ACPI_CAST_PTR (ACPI_HMAT_CACHE, HmatStruct);
1838             SubtableOffset = sizeof (ACPI_HMAT_CACHE);
1839 
1840             /* Dump SMBIOS handles */
1841 
1842             if ((UINT32)(HmatStruct->Length - SubtableOffset) <
1843                 (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2))
1844             {
1845                 AcpiOsPrintf ("Invalid SMBIOS handle number\n");
1846                 return;
1847             }
1848             for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++)
1849             {
1850                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
1851                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
1852                     2, AcpiDmTableInfoHmat2a);
1853                 if (ACPI_FAILURE (Status))
1854                 {
1855                     return;
1856                 }
1857 
1858                 SubtableOffset += 2;
1859             }
1860             break;
1861 
1862         default:
1863 
1864             break;
1865         }
1866 
1867 NextSubtable:
1868         /* Point to next HMAT structure subtable */
1869 
1870         Offset += (HmatStruct->Length);
1871     }
1872 }
1873