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