dmtbdump.c revision 209746
1193323Sed/******************************************************************************
2193323Sed *
3193323Sed * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
4193323Sed *
5193323Sed *****************************************************************************/
6193323Sed
7193323Sed/******************************************************************************
8193323Sed *
9193323Sed * 1. Copyright Notice
10193323Sed *
11193323Sed * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12193323Sed * All rights reserved.
13193323Sed *
14193323Sed * 2. License
15193323Sed *
16193323Sed * 2.1. This is your license from Intel Corp. under its intellectual property
17193323Sed * rights.  You may have additional license terms from the party that provided
18195340Sed * you this software, covering your right to use that party's intellectual
19193323Sed * property rights.
20193323Sed *
21193323Sed * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22193323Sed * copy of the source code appearing in this file ("Covered Code") an
23193323Sed * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24193323Sed * base code distributed originally by Intel ("Original Intel Code") to copy,
25193323Sed * make derivatives, distribute, use and display any portion of the Covered
26195340Sed * Code in any form, with the right to sublicense such rights; and
27193323Sed *
28218885Sdim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29218885Sdim * license (with the right to sublicense), under only those claims of Intel
30193323Sed * patents that are infringed by the Original Intel Code, to make, use, sell,
31193323Sed * offer to sell, and import the Covered Code and derivative works thereof
32193323Sed * solely to the minimum extent necessary to exercise the above copyright
33193323Sed * license, and in no event shall the patent license extend to any additions
34193323Sed * to or modifications of the Original Intel Code.  No other license or right
35193323Sed * is granted directly or by implication, estoppel or otherwise;
36193323Sed *
37193323Sed * The above copyright and patent license is granted only if the following
38193323Sed * conditions are met:
39193323Sed *
40193323Sed * 3. Conditions
41198090Srdivacky *
42193323Sed * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43193323Sed * Redistribution of source code of any substantial portion of the Covered
44193323Sed * Code or modification with rights to further distribute source must include
45193323Sed * the above Copyright Notice, the above License, this list of Conditions,
46193323Sed * and the following Disclaimer and Export Compliance provision.  In addition,
47193323Sed * Licensee must cause all Covered Code to which Licensee contributes to
48193323Sed * contain a file documenting the changes Licensee made to create that Covered
49193323Sed * Code and the date of any change.  Licensee must include in that file the
50193323Sed * documentation of any changes made by any predecessor Licensee.  Licensee
51193323Sed * must include a prominent statement that the modification is derived,
52193323Sed * directly or indirectly, from Original Intel Code.
53198396Srdivacky *
54198090Srdivacky * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55198090Srdivacky * Redistribution of source code of any substantial portion of the Covered
56198090Srdivacky * Code or modification without rights to further distribute source must
57198090Srdivacky * include the following Disclaimer and Export Compliance provision in the
58193323Sed * documentation and/or other materials provided with distribution.  In
59198090Srdivacky * addition, Licensee may not authorize further sublicense of source of any
60198090Srdivacky * portion of the Covered Code, and must include terms to the effect that the
61198090Srdivacky * license from Licensee to its licensee is limited to the intellectual
62198090Srdivacky * property embodied in the software Licensee provides to its licensee, and
63198090Srdivacky * not to intellectual property embodied in modifications its licensee may
64193323Sed * make.
65198090Srdivacky *
66193323Sed * 3.3. Redistribution of Executable. Redistribution in executable form of any
67198090Srdivacky * substantial portion of the Covered Code or modification must reproduce the
68193323Sed * above Copyright Notice, and the following Disclaimer and Export Compliance
69198090Srdivacky * provision in the documentation and/or other materials provided with the
70193323Sed * distribution.
71198090Srdivacky *
72212793Sdim * 3.4. Intel retains all right, title, and interest in and to the Original
73212793Sdim * Intel Code.
74212793Sdim *
75198090Srdivacky * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76198090Srdivacky * Intel shall be used in advertising or otherwise to promote the sale, use or
77198396Srdivacky * other dealings in products derived from or relating to the Covered Code
78198396Srdivacky * without prior written authorization from Intel.
79198396Srdivacky *
80212793Sdim * 4. Disclaimer and Export Compliance
81212793Sdim *
82212793Sdim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83212793Sdim * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84212793Sdim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85198396Srdivacky * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86198396Srdivacky * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87198396Srdivacky * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88198396Srdivacky * PARTICULAR PURPOSE.
89198396Srdivacky *
90198396Srdivacky * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91198396Srdivacky * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92198396Srdivacky * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93198396Srdivacky * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94198396Srdivacky * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95198396Srdivacky * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96198396Srdivacky * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97198396Srdivacky * LIMITED REMEDY.
98198396Srdivacky *
99198396Srdivacky * 4.3. Licensee shall not export, either directly or indirectly, any of this
100198090Srdivacky * software or system incorporating such software without first obtaining any
101193323Sed * required license or other approval from the U. S. Department of Commerce or
102193323Sed * any other agency or department of the United States Government.  In the
103198396Srdivacky * event Licensee exports any such software from the United States or
104198396Srdivacky * re-exports any such software from a foreign destination, Licensee shall
105198396Srdivacky * ensure that the distribution and export/re-export of the software is in
106198396Srdivacky * compliance with all laws, regulations, orders, or other restrictions of the
107198396Srdivacky * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108198396Srdivacky * any of its subsidiaries will export/re-export any technical data, process,
109198396Srdivacky * software, or service, directly or indirectly, to any country for which the
110198396Srdivacky * United States government or any agency thereof requires an export license,
111198396Srdivacky * other governmental approval, or letter of assurance, without first obtaining
112198396Srdivacky * such license, approval or letter.
113198396Srdivacky *
114198396Srdivacky *****************************************************************************/
115198090Srdivacky
116198396Srdivacky#include <contrib/dev/acpica/include/acpi.h>
117198396Srdivacky#include <contrib/dev/acpica/include/accommon.h>
118198090Srdivacky#include <contrib/dev/acpica/include/acdisasm.h>
119193323Sed#include <contrib/dev/acpica/include/actables.h>
120
121/* This module used for application-level code only */
122
123#define _COMPONENT          ACPI_CA_DISASSEMBLER
124        ACPI_MODULE_NAME    ("dmtbdump")
125
126
127/*******************************************************************************
128 *
129 * FUNCTION:    AcpiDmDumpRsdp
130 *
131 * PARAMETERS:  Table               - A RSDP
132 *
133 * RETURN:      Length of the table (there is not always a length field,
134 *              use revision or length if available (ACPI 2.0+))
135 *
136 * DESCRIPTION: Format the contents of a RSDP
137 *
138 ******************************************************************************/
139
140UINT32
141AcpiDmDumpRsdp (
142    ACPI_TABLE_HEADER       *Table)
143{
144    ACPI_TABLE_RSDP         *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
145    UINT32                  Length = sizeof (ACPI_RSDP_COMMON);
146    UINT8                   Checksum;
147
148
149    /* Dump the common ACPI 1.0 portion */
150
151    AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
152
153    /* Validate the first checksum */
154
155    Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
156                Rsdp->Checksum);
157    if (Checksum != Rsdp->Checksum)
158    {
159        AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
160            Checksum);
161    }
162
163    /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
164
165    if (Rsdp->Revision > 0)
166    {
167        Length = Rsdp->Length;
168        AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
169
170        /* Validate the extended checksum over entire RSDP */
171
172        Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
173                    Rsdp->ExtendedChecksum);
174        if (Checksum != Rsdp->ExtendedChecksum)
175        {
176            AcpiOsPrintf (
177                "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
178                Checksum);
179        }
180    }
181
182    return (Length);
183}
184
185
186/*******************************************************************************
187 *
188 * FUNCTION:    AcpiDmDumpRsdt
189 *
190 * PARAMETERS:  Table               - A RSDT
191 *
192 * RETURN:      None
193 *
194 * DESCRIPTION: Format the contents of a RSDT
195 *
196 ******************************************************************************/
197
198void
199AcpiDmDumpRsdt (
200    ACPI_TABLE_HEADER       *Table)
201{
202    UINT32                  *Array;
203    UINT32                  Entries;
204    UINT32                  Offset;
205    UINT32                  i;
206
207
208    /* Point to start of table pointer array */
209
210    Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
211    Offset = sizeof (ACPI_TABLE_HEADER);
212
213    /* RSDT uses 32-bit pointers */
214
215    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
216
217    for (i = 0; i < Entries; i++)
218    {
219        AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
220        AcpiOsPrintf ("%8.8X\n", Array[i]);
221        Offset += sizeof (UINT32);
222    }
223}
224
225
226/*******************************************************************************
227 *
228 * FUNCTION:    AcpiDmDumpXsdt
229 *
230 * PARAMETERS:  Table               - A XSDT
231 *
232 * RETURN:      None
233 *
234 * DESCRIPTION: Format the contents of a XSDT
235 *
236 ******************************************************************************/
237
238void
239AcpiDmDumpXsdt (
240    ACPI_TABLE_HEADER       *Table)
241{
242    UINT64                  *Array;
243    UINT32                  Entries;
244    UINT32                  Offset;
245    UINT32                  i;
246
247
248    /* Point to start of table pointer array */
249
250    Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
251    Offset = sizeof (ACPI_TABLE_HEADER);
252
253    /* XSDT uses 64-bit pointers */
254
255    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
256
257    for (i = 0; i < Entries; i++)
258    {
259        AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
260        AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
261        Offset += sizeof (UINT64);
262    }
263}
264
265
266/*******************************************************************************
267 *
268 * FUNCTION:    AcpiDmDumpFadt
269 *
270 * PARAMETERS:  Table               - A FADT
271 *
272 * RETURN:      None
273 *
274 * DESCRIPTION: Format the contents of a FADT
275 *
276 ******************************************************************************/
277
278void
279AcpiDmDumpFadt (
280    ACPI_TABLE_HEADER       *Table)
281{
282
283    /* Common ACPI 1.0 portion of FADT */
284
285    AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
286
287    /* Check for ACPI 1.0B MS extensions (FADT revision 2) */
288
289    if (Table->Revision == 2)
290    {
291        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
292    }
293
294    /* Check for ACPI 2.0+ extended data (FADT revision 3+) */
295
296    else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
297    {
298        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
299    }
300
301    /* Validate various fields in the FADT, including length */
302
303    AcpiTbCreateLocalFadt (Table, Table->Length);
304}
305
306
307/*******************************************************************************
308 *
309 * FUNCTION:    AcpiDmDumpAsf
310 *
311 * PARAMETERS:  Table               - A ASF table
312 *
313 * RETURN:      None
314 *
315 * DESCRIPTION: Format the contents of a ASF table
316 *
317 ******************************************************************************/
318
319void
320AcpiDmDumpAsf (
321    ACPI_TABLE_HEADER       *Table)
322{
323    ACPI_STATUS             Status;
324    UINT32                  Offset = sizeof (ACPI_TABLE_HEADER);
325    ACPI_ASF_INFO           *SubTable;
326    ACPI_DMTABLE_INFO       *InfoTable;
327    ACPI_DMTABLE_INFO       *DataInfoTable = NULL;
328    UINT8                   *DataTable = NULL;
329    UINT32                  DataCount = 0;
330    UINT32                  DataLength = 0;
331    UINT32                  DataOffset = 0;
332    UINT32                  i;
333    UINT8                   Type;
334
335
336    /* No main table, only sub-tables */
337
338    SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
339    while (Offset < Table->Length)
340    {
341        /* Common sub-table header */
342
343        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
344                    SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
345        if (ACPI_FAILURE (Status))
346        {
347            return;
348        }
349
350        /* The actual type is the lower 7 bits of Type */
351
352        Type = (UINT8) (SubTable->Header.Type & 0x7F);
353
354        switch (Type)
355        {
356        case ACPI_ASF_TYPE_INFO:
357            InfoTable = AcpiDmTableInfoAsf0;
358            break;
359
360        case ACPI_ASF_TYPE_ALERT:
361            InfoTable = AcpiDmTableInfoAsf1;
362            DataInfoTable = AcpiDmTableInfoAsf1a;
363            DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
364            DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
365            DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
366            DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
367            break;
368
369        case ACPI_ASF_TYPE_CONTROL:
370            InfoTable = AcpiDmTableInfoAsf2;
371            DataInfoTable = AcpiDmTableInfoAsf2a;
372            DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
373            DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
374            DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
375            DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
376            break;
377
378        case ACPI_ASF_TYPE_BOOT:
379            InfoTable = AcpiDmTableInfoAsf3;
380            break;
381
382        case ACPI_ASF_TYPE_ADDRESS:
383            InfoTable = AcpiDmTableInfoAsf4;
384            DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
385            DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
386            DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
387            break;
388
389        default:
390            AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type);
391            return;
392        }
393
394        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
395                    SubTable->Header.Length, InfoTable);
396        if (ACPI_FAILURE (Status))
397        {
398            return;
399        }
400
401        /* Dump variable-length extra data */
402
403        switch (Type)
404        {
405        case ACPI_ASF_TYPE_ALERT:
406        case ACPI_ASF_TYPE_CONTROL:
407
408            for (i = 0; i < DataCount; i++)
409            {
410                AcpiOsPrintf ("\n");
411                Status = AcpiDmDumpTable (Table->Length, DataOffset,
412                            DataTable, DataLength, DataInfoTable);
413                if (ACPI_FAILURE (Status))
414                {
415                    return;
416                }
417
418                DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
419                DataOffset += DataLength;
420            }
421            break;
422
423        case ACPI_ASF_TYPE_ADDRESS:
424
425            for (i = 0; i < DataLength; i++)
426            {
427                if (!(i % 16))
428                {
429                    AcpiDmLineHeader (DataOffset, 1, "Addresses");
430                }
431
432                AcpiOsPrintf ("%2.2X ", *DataTable);
433                DataTable++;
434                DataOffset++;
435                if (DataOffset > Table->Length)
436                {
437                    AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
438                    return;
439                }
440            }
441
442            AcpiOsPrintf ("\n");
443            break;
444
445        default:
446            break;
447        }
448
449        AcpiOsPrintf ("\n");
450
451        /* Point to next sub-table */
452
453        if (!SubTable->Header.Length)
454        {
455            AcpiOsPrintf ("Invalid zero subtable header length\n");
456            return;
457        }
458
459        Offset += SubTable->Header.Length;
460        SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
461    }
462}
463
464
465/*******************************************************************************
466 *
467 * FUNCTION:    AcpiDmDumpCpep
468 *
469 * PARAMETERS:  Table               - A CPEP table
470 *
471 * RETURN:      None
472 *
473 * DESCRIPTION: Format the contents of a CPEP. This table type consists
474 *              of an open-ended number of subtables.
475 *
476 ******************************************************************************/
477
478void
479AcpiDmDumpCpep (
480    ACPI_TABLE_HEADER       *Table)
481{
482    ACPI_STATUS             Status;
483    ACPI_CPEP_POLLING       *SubTable;
484    UINT32                  Length = Table->Length;
485    UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
486
487
488    /* Main table */
489
490    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
491    if (ACPI_FAILURE (Status))
492    {
493        return;
494    }
495
496    /* Sub-tables */
497
498    SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
499    while (Offset < Table->Length)
500    {
501        AcpiOsPrintf ("\n");
502        Status = AcpiDmDumpTable (Length, Offset, SubTable,
503                    SubTable->Header.Length, AcpiDmTableInfoCpep0);
504        if (ACPI_FAILURE (Status))
505        {
506            return;
507        }
508
509        /* Point to next sub-table */
510
511        Offset += SubTable->Header.Length;
512        SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
513                    SubTable->Header.Length);
514    }
515}
516
517
518/*******************************************************************************
519 *
520 * FUNCTION:    AcpiDmDumpDmar
521 *
522 * PARAMETERS:  Table               - A DMAR table
523 *
524 * RETURN:      None
525 *
526 * DESCRIPTION: Format the contents of a DMAR. This table type consists
527 *              of an open-ended number of subtables.
528 *
529 ******************************************************************************/
530
531void
532AcpiDmDumpDmar (
533    ACPI_TABLE_HEADER       *Table)
534{
535    ACPI_STATUS             Status;
536    ACPI_DMAR_HEADER        *SubTable;
537    UINT32                  Length = Table->Length;
538    UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
539    ACPI_DMTABLE_INFO       *InfoTable;
540    ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
541    UINT32                  ScopeOffset;
542    UINT8                   *PciPath;
543    UINT32                  PathOffset;
544
545
546    /* Main table */
547
548    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
549    if (ACPI_FAILURE (Status))
550    {
551        return;
552    }
553
554    /* Sub-tables */
555
556    SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
557    while (Offset < Table->Length)
558    {
559        /* Common sub-table header */
560
561        AcpiOsPrintf ("\n");
562        Status = AcpiDmDumpTable (Length, Offset, SubTable,
563                    SubTable->Length, AcpiDmTableInfoDmarHdr);
564        if (ACPI_FAILURE (Status))
565        {
566            return;
567        }
568
569        switch (SubTable->Type)
570        {
571        case ACPI_DMAR_TYPE_HARDWARE_UNIT:
572            InfoTable = AcpiDmTableInfoDmar0;
573            ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
574            break;
575        case ACPI_DMAR_TYPE_RESERVED_MEMORY:
576            InfoTable = AcpiDmTableInfoDmar1;
577            ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
578            break;
579        case ACPI_DMAR_TYPE_ATSR:
580            InfoTable = AcpiDmTableInfoDmar2;
581            ScopeOffset = sizeof (ACPI_DMAR_ATSR);
582            break;
583        case ACPI_DMAR_HARDWARE_AFFINITY:
584            InfoTable = AcpiDmTableInfoDmar3;
585            ScopeOffset = sizeof (ACPI_DMAR_RHSA);
586            break;
587        default:
588            AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type);
589            return;
590        }
591
592        Status = AcpiDmDumpTable (Length, Offset, SubTable,
593                    SubTable->Length, InfoTable);
594        if (ACPI_FAILURE (Status))
595        {
596            return;
597        }
598
599        /* Dump the device scope entries (if any) */
600
601        ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
602        while (ScopeOffset < SubTable->Length)
603        {
604            AcpiOsPrintf ("\n");
605            Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
606                        ScopeTable->Length, AcpiDmTableInfoDmarScope);
607            if (ACPI_FAILURE (Status))
608            {
609                return;
610            }
611
612            /* Dump the PCI Path entries for this device scope */
613
614            PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
615
616            PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
617                sizeof (ACPI_DMAR_DEVICE_SCOPE));
618
619            while (PathOffset < ScopeTable->Length)
620            {
621                AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
622                AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
623
624                /* Point to next PCI Path entry */
625
626                PathOffset += 2;
627                PciPath += 2;
628            }
629
630            /* Point to next device scope entry */
631
632            ScopeOffset += ScopeTable->Length;
633            ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
634                ScopeTable, ScopeTable->Length);
635        }
636
637        /* Point to next sub-table */
638
639        Offset += SubTable->Length;
640        SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
641    }
642}
643
644
645/*******************************************************************************
646 *
647 * FUNCTION:    AcpiDmDumpEinj
648 *
649 * PARAMETERS:  Table               - A EINJ table
650 *
651 * RETURN:      None
652 *
653 * DESCRIPTION: Format the contents of a EINJ. This table type consists
654 *              of an open-ended number of subtables.
655 *
656 ******************************************************************************/
657
658void
659AcpiDmDumpEinj (
660    ACPI_TABLE_HEADER       *Table)
661{
662    ACPI_STATUS             Status;
663    ACPI_WHEA_HEADER        *SubTable;
664    UINT32                  Length = Table->Length;
665    UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
666
667
668    /* Main table */
669
670    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
671    if (ACPI_FAILURE (Status))
672    {
673        return;
674    }
675
676    /* Sub-tables */
677
678    SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
679    while (Offset < Table->Length)
680    {
681        AcpiOsPrintf ("\n");
682        Status = AcpiDmDumpTable (Length, Offset, SubTable,
683                    sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
684        if (ACPI_FAILURE (Status))
685        {
686            return;
687        }
688
689        /* Point to next sub-table (each subtable is of fixed length) */
690
691        Offset += sizeof (ACPI_WHEA_HEADER);
692        SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
693                        sizeof (ACPI_WHEA_HEADER));
694    }
695}
696
697
698/*******************************************************************************
699 *
700 * FUNCTION:    AcpiDmDumpErst
701 *
702 * PARAMETERS:  Table               - A ERST table
703 *
704 * RETURN:      None
705 *
706 * DESCRIPTION: Format the contents of a ERST. This table type consists
707 *              of an open-ended number of subtables.
708 *
709 ******************************************************************************/
710
711void
712AcpiDmDumpErst (
713    ACPI_TABLE_HEADER       *Table)
714{
715    ACPI_STATUS             Status;
716    ACPI_WHEA_HEADER        *SubTable;
717    UINT32                  Length = Table->Length;
718    UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
719
720
721    /* Main table */
722
723    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
724    if (ACPI_FAILURE (Status))
725    {
726        return;
727    }
728
729    /* Sub-tables */
730
731    SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
732    while (Offset < Table->Length)
733    {
734        AcpiOsPrintf ("\n");
735        Status = AcpiDmDumpTable (Length, Offset, SubTable,
736                    sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
737        if (ACPI_FAILURE (Status))
738        {
739            return;
740        }
741
742        /* Point to next sub-table (each subtable is of fixed length) */
743
744        Offset += sizeof (ACPI_WHEA_HEADER);
745        SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
746                        sizeof (ACPI_WHEA_HEADER));
747    }
748}
749
750
751/*******************************************************************************
752 *
753 * FUNCTION:    AcpiDmDumpHest
754 *
755 * PARAMETERS:  Table               - A HEST table
756 *
757 * RETURN:      None
758 *
759 * DESCRIPTION: Format the contents of a HEST. This table type consists
760 *              of an open-ended number of subtables.
761 *
762 ******************************************************************************/
763
764void
765AcpiDmDumpHest (
766    ACPI_TABLE_HEADER       *Table)
767{
768    ACPI_STATUS             Status;
769    ACPI_HEST_HEADER        *SubTable;
770    UINT32                  Length = Table->Length;
771    UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
772    ACPI_DMTABLE_INFO       *InfoTable;
773    UINT32                  SubTableLength;
774    UINT32                  BankCount;
775    ACPI_HEST_IA_ERROR_BANK *BankTable;
776
777
778    /* Main table */
779
780    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
781    if (ACPI_FAILURE (Status))
782    {
783        return;
784    }
785
786    /* Sub-tables */
787
788    SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
789    while (Offset < Table->Length)
790    {
791        BankCount = 0;
792        switch (SubTable->Type)
793        {
794        case ACPI_HEST_TYPE_IA32_CHECK:
795            InfoTable = AcpiDmTableInfoHest0;
796            SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
797            BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
798                            SubTable))->NumHardwareBanks;
799            break;
800
801        case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
802            InfoTable = AcpiDmTableInfoHest1;
803            SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
804            BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
805                            SubTable))->NumHardwareBanks;
806            break;
807
808        case ACPI_HEST_TYPE_IA32_NMI:
809            InfoTable = AcpiDmTableInfoHest2;
810            SubTableLength = sizeof (ACPI_HEST_IA_NMI);
811            break;
812
813        case ACPI_HEST_TYPE_AER_ROOT_PORT:
814            InfoTable = AcpiDmTableInfoHest6;
815            SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
816            break;
817
818        case ACPI_HEST_TYPE_AER_ENDPOINT:
819            InfoTable = AcpiDmTableInfoHest7;
820            SubTableLength = sizeof (ACPI_HEST_AER);
821            break;
822
823        case ACPI_HEST_TYPE_AER_BRIDGE:
824            InfoTable = AcpiDmTableInfoHest8;
825            SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
826            break;
827
828        case ACPI_HEST_TYPE_GENERIC_ERROR:
829            InfoTable = AcpiDmTableInfoHest9;
830            SubTableLength = sizeof (ACPI_HEST_GENERIC);
831            break;
832
833        default:
834            /* Cannot continue on unknown type - no length */
835
836            AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type);
837            return;
838        }
839
840        AcpiOsPrintf ("\n");
841        Status = AcpiDmDumpTable (Length, Offset, SubTable,
842                    SubTableLength, InfoTable);
843        if (ACPI_FAILURE (Status))
844        {
845            return;
846        }
847
848        /* Point to end of current subtable (each subtable above is of fixed length) */
849
850        Offset += SubTableLength;
851
852        /* If there are any (fixed-length) Error Banks from above, dump them now */
853
854        if (BankCount)
855        {
856            BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
857            SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
858
859            while (BankCount)
860            {
861                AcpiOsPrintf ("\n");
862                Status = AcpiDmDumpTable (Length, Offset, BankTable,
863                            sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
864                if (ACPI_FAILURE (Status))
865                {
866                    return;
867                }
868                Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
869                BankTable++;
870                BankCount--;
871            }
872        }
873
874        /* Point to next sub-table */
875
876        SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
877    }
878}
879
880
881/*******************************************************************************
882 *
883 * FUNCTION:    AcpiDmDumpIvrs
884 *
885 * PARAMETERS:  Table               - A IVRS table
886 *
887 * RETURN:      None
888 *
889 * DESCRIPTION: Format the contents of a IVRS
890 *
891 ******************************************************************************/
892
893static UINT8 EntrySizes[] = {4,8,16,32};
894
895void
896AcpiDmDumpIvrs (
897    ACPI_TABLE_HEADER       *Table)
898{
899    ACPI_STATUS             Status;
900    UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
901    UINT32                  EntryOffset;
902    UINT32                  EntryLength;
903    UINT32                  EntryType;
904    ACPI_IVRS_DE_HEADER     *DeviceEntry;
905    ACPI_IVRS_HEADER        *SubTable;
906    ACPI_DMTABLE_INFO       *InfoTable;
907
908
909    /* Main table */
910
911    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
912    if (ACPI_FAILURE (Status))
913    {
914        return;
915    }
916
917    /* Sub-tables */
918
919    SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
920    while (Offset < Table->Length)
921    {
922        /* Common sub-table header */
923
924        AcpiOsPrintf ("\n");
925        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
926                    SubTable->Length, AcpiDmTableInfoIvrsHdr);
927        if (ACPI_FAILURE (Status))
928        {
929            return;
930        }
931
932        switch (SubTable->Type)
933        {
934        case ACPI_IVRS_TYPE_HARDWARE:
935            InfoTable = AcpiDmTableInfoIvrs0;
936            break;
937        case ACPI_IVRS_TYPE_MEMORY1:
938        case ACPI_IVRS_TYPE_MEMORY2:
939        case ACPI_IVRS_TYPE_MEMORY3:
940            InfoTable = AcpiDmTableInfoIvrs1;
941            break;
942        default:
943            AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n",
944                SubTable->Type);
945
946            /* Attempt to continue */
947
948            if (!SubTable->Length)
949            {
950                AcpiOsPrintf ("Invalid zero length subtable\n");
951                return;
952            }
953            goto NextSubTable;
954        }
955
956        /* Dump the subtable */
957
958        AcpiOsPrintf ("\n");
959        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
960                    SubTable->Length, InfoTable);
961        if (ACPI_FAILURE (Status))
962        {
963            return;
964        }
965
966        /* The hardware subtable can contain multiple device entries */
967
968        if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
969        {
970            EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
971            DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
972                            sizeof (ACPI_IVRS_HARDWARE));
973
974            while (EntryOffset < (Offset + SubTable->Length))
975            {
976                AcpiOsPrintf ("\n");
977                /*
978                 * Upper 2 bits of Type encode the length of the device entry
979                 *
980                 * 00 = 4 byte
981                 * 01 = 8 byte
982                 * 10 = 16 byte - currently no entries defined
983                 * 11 = 32 byte - currently no entries defined
984                 */
985                EntryType = DeviceEntry->Type;
986                EntryLength = EntrySizes [EntryType >> 6];
987
988                switch (EntryType)
989                {
990                /* 4-byte device entries */
991
992                case ACPI_IVRS_TYPE_PAD4:
993                case ACPI_IVRS_TYPE_ALL:
994                case ACPI_IVRS_TYPE_SELECT:
995                case ACPI_IVRS_TYPE_START:
996                case ACPI_IVRS_TYPE_END:
997
998                    InfoTable = AcpiDmTableInfoIvrs4;
999                    break;
1000
1001                /* 8-byte entries, type A */
1002
1003                case ACPI_IVRS_TYPE_ALIAS_SELECT:
1004                case ACPI_IVRS_TYPE_ALIAS_START:
1005
1006                    InfoTable = AcpiDmTableInfoIvrs8a;
1007                    break;
1008
1009                /* 8-byte entries, type B */
1010
1011                case ACPI_IVRS_TYPE_PAD8:
1012                case ACPI_IVRS_TYPE_EXT_SELECT:
1013                case ACPI_IVRS_TYPE_EXT_START:
1014
1015                    InfoTable = AcpiDmTableInfoIvrs8b;
1016                    break;
1017
1018                /* 8-byte entries, type C */
1019
1020                case ACPI_IVRS_TYPE_SPECIAL:
1021
1022                    InfoTable = AcpiDmTableInfoIvrs8c;
1023                    break;
1024
1025                default:
1026                    InfoTable = AcpiDmTableInfoIvrs4;
1027                    AcpiOsPrintf (
1028                        "\n**** Unknown IVRS device entry type/length: "
1029                        "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
1030                        EntryType, EntryLength, EntryOffset);
1031                    break;
1032                }
1033
1034                /* Dump the Device Entry */
1035
1036                Status = AcpiDmDumpTable (Table->Length, EntryOffset,
1037                            DeviceEntry, EntryLength, InfoTable);
1038
1039                EntryOffset += EntryLength;
1040                DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
1041                                EntryLength);
1042            }
1043        }
1044
1045NextSubTable:
1046        /* Point to next sub-table */
1047
1048        Offset += SubTable->Length;
1049        SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
1050    }
1051}
1052
1053
1054/*******************************************************************************
1055 *
1056 * FUNCTION:    AcpiDmDumpMadt
1057 *
1058 * PARAMETERS:  Table               - A MADT table
1059 *
1060 * RETURN:      None
1061 *
1062 * DESCRIPTION: Format the contents of a MADT. This table type consists
1063 *              of an open-ended number of subtables.
1064 *
1065 ******************************************************************************/
1066
1067void
1068AcpiDmDumpMadt (
1069    ACPI_TABLE_HEADER       *Table)
1070{
1071    ACPI_STATUS             Status;
1072    ACPI_SUBTABLE_HEADER    *SubTable;
1073    UINT32                  Length = Table->Length;
1074    UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
1075    ACPI_DMTABLE_INFO       *InfoTable;
1076
1077
1078    /* Main table */
1079
1080    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
1081    if (ACPI_FAILURE (Status))
1082    {
1083        return;
1084    }
1085
1086    /* Sub-tables */
1087
1088    SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1089    while (Offset < Table->Length)
1090    {
1091        /* Common sub-table header */
1092
1093        AcpiOsPrintf ("\n");
1094        Status = AcpiDmDumpTable (Length, Offset, SubTable,
1095                    SubTable->Length, AcpiDmTableInfoMadtHdr);
1096        if (ACPI_FAILURE (Status))
1097        {
1098            return;
1099        }
1100
1101        switch (SubTable->Type)
1102        {
1103        case ACPI_MADT_TYPE_LOCAL_APIC:
1104            InfoTable = AcpiDmTableInfoMadt0;
1105            break;
1106        case ACPI_MADT_TYPE_IO_APIC:
1107            InfoTable = AcpiDmTableInfoMadt1;
1108            break;
1109        case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
1110            InfoTable = AcpiDmTableInfoMadt2;
1111            break;
1112        case ACPI_MADT_TYPE_NMI_SOURCE:
1113            InfoTable = AcpiDmTableInfoMadt3;
1114            break;
1115        case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
1116            InfoTable = AcpiDmTableInfoMadt4;
1117            break;
1118        case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
1119            InfoTable = AcpiDmTableInfoMadt5;
1120            break;
1121        case ACPI_MADT_TYPE_IO_SAPIC:
1122            InfoTable = AcpiDmTableInfoMadt6;
1123            break;
1124        case ACPI_MADT_TYPE_LOCAL_SAPIC:
1125            InfoTable = AcpiDmTableInfoMadt7;
1126            break;
1127        case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
1128            InfoTable = AcpiDmTableInfoMadt8;
1129            break;
1130        case ACPI_MADT_TYPE_LOCAL_X2APIC:
1131            InfoTable = AcpiDmTableInfoMadt9;
1132            break;
1133        case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
1134            InfoTable = AcpiDmTableInfoMadt10;
1135            break;
1136        default:
1137            AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type);
1138
1139            /* Attempt to continue */
1140
1141            if (!SubTable->Length)
1142            {
1143                AcpiOsPrintf ("Invalid zero length subtable\n");
1144                return;
1145            }
1146            goto NextSubTable;
1147        }
1148
1149        Status = AcpiDmDumpTable (Length, Offset, SubTable,
1150                    SubTable->Length, InfoTable);
1151        if (ACPI_FAILURE (Status))
1152        {
1153            return;
1154        }
1155
1156NextSubTable:
1157        /* Point to next sub-table */
1158
1159        Offset += SubTable->Length;
1160        SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1161    }
1162}
1163
1164
1165/*******************************************************************************
1166 *
1167 * FUNCTION:    AcpiDmDumpMcfg
1168 *
1169 * PARAMETERS:  Table               - A MCFG Table
1170 *
1171 * RETURN:      None
1172 *
1173 * DESCRIPTION: Format the contents of a MCFG table
1174 *
1175 ******************************************************************************/
1176
1177void
1178AcpiDmDumpMcfg (
1179    ACPI_TABLE_HEADER       *Table)
1180{
1181    ACPI_STATUS             Status;
1182    UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
1183    ACPI_MCFG_ALLOCATION    *SubTable;
1184
1185
1186    /* Main table */
1187
1188    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1189    if (ACPI_FAILURE (Status))
1190    {
1191        return;
1192    }
1193
1194    /* Sub-tables */
1195
1196    SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1197    while (Offset < Table->Length)
1198    {
1199        if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1200        {
1201            AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1202                sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1203            return;
1204        }
1205
1206        AcpiOsPrintf ("\n");
1207        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1208                    sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1209        if (ACPI_FAILURE (Status))
1210        {
1211            return;
1212        }
1213
1214        /* Point to next sub-table (each subtable is of fixed length) */
1215
1216        Offset += sizeof (ACPI_MCFG_ALLOCATION);
1217        SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
1218                        sizeof (ACPI_MCFG_ALLOCATION));
1219    }
1220}
1221
1222
1223/*******************************************************************************
1224 *
1225 * FUNCTION:    AcpiDmDumpMsct
1226 *
1227 * PARAMETERS:  Table               - A MSCT table
1228 *
1229 * RETURN:      None
1230 *
1231 * DESCRIPTION: Format the contents of a MSCT
1232 *
1233 ******************************************************************************/
1234
1235void
1236AcpiDmDumpMsct (
1237    ACPI_TABLE_HEADER       *Table)
1238{
1239    ACPI_STATUS             Status;
1240    UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
1241    ACPI_MSCT_PROXIMITY     *SubTable;
1242
1243
1244    /* Main table */
1245
1246    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1247    if (ACPI_FAILURE (Status))
1248    {
1249        return;
1250    }
1251
1252    /* Sub-tables */
1253
1254    SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1255    while (Offset < Table->Length)
1256    {
1257        /* Common sub-table header */
1258
1259        AcpiOsPrintf ("\n");
1260        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1261                    sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1262        if (ACPI_FAILURE (Status))
1263        {
1264            return;
1265        }
1266
1267        /* Point to next sub-table */
1268
1269        Offset += sizeof (ACPI_MSCT_PROXIMITY);
1270        SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
1271    }
1272}
1273
1274
1275/*******************************************************************************
1276 *
1277 * FUNCTION:    AcpiDmDumpSlit
1278 *
1279 * PARAMETERS:  Table               - An SLIT
1280 *
1281 * RETURN:      None
1282 *
1283 * DESCRIPTION: Format the contents of a SLIT
1284 *
1285 ******************************************************************************/
1286
1287void
1288AcpiDmDumpSlit (
1289    ACPI_TABLE_HEADER       *Table)
1290{
1291    ACPI_STATUS             Status;
1292    UINT32                  Offset;
1293    UINT8                   *Row;
1294    UINT32                  Localities;
1295    UINT32                  i;
1296    UINT32                  j;
1297
1298
1299    /* Main table */
1300
1301    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
1302    if (ACPI_FAILURE (Status))
1303    {
1304        return;
1305    }
1306
1307    /* Display the Locality NxN Matrix */
1308
1309    Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
1310    Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
1311    Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
1312
1313    for (i = 0; i < Localities; i++)
1314    {
1315        /* Display one row of the matrix */
1316
1317        AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
1318        for  (j = 0; j < Localities; j++)
1319        {
1320            /* Check for beyond EOT */
1321
1322            if (Offset >= Table->Length)
1323            {
1324                AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
1325                return;
1326            }
1327
1328            AcpiOsPrintf ("%2.2X", Row[j]);
1329            Offset++;
1330
1331            /* Display up to 16 bytes per output row */
1332
1333            if ((j+1) < Localities)
1334            {
1335                AcpiOsPrintf (",");
1336
1337                if (j && (((j+1) % 16) == 0))
1338                {
1339                    AcpiOsPrintf ("\n");
1340                    AcpiDmLineHeader (Offset, 0, "");
1341                }
1342            }
1343        }
1344
1345        /* Point to next row */
1346
1347        AcpiOsPrintf ("\n");
1348        Row += Localities;
1349    }
1350}
1351
1352
1353/*******************************************************************************
1354 *
1355 * FUNCTION:    AcpiDmDumpSrat
1356 *
1357 * PARAMETERS:  Table               - A SRAT table
1358 *
1359 * RETURN:      None
1360 *
1361 * DESCRIPTION: Format the contents of a SRAT
1362 *
1363 ******************************************************************************/
1364
1365void
1366AcpiDmDumpSrat (
1367    ACPI_TABLE_HEADER       *Table)
1368{
1369    ACPI_STATUS             Status;
1370    UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
1371    ACPI_SUBTABLE_HEADER    *SubTable;
1372    ACPI_DMTABLE_INFO       *InfoTable;
1373
1374
1375    /* Main table */
1376
1377    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
1378    if (ACPI_FAILURE (Status))
1379    {
1380        return;
1381    }
1382
1383    /* Sub-tables */
1384
1385    SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1386    while (Offset < Table->Length)
1387    {
1388        /* Common sub-table header */
1389
1390        AcpiOsPrintf ("\n");
1391        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1392                    SubTable->Length, AcpiDmTableInfoSratHdr);
1393        if (ACPI_FAILURE (Status))
1394        {
1395            return;
1396        }
1397
1398        switch (SubTable->Type)
1399        {
1400        case ACPI_SRAT_TYPE_CPU_AFFINITY:
1401            InfoTable = AcpiDmTableInfoSrat0;
1402            break;
1403        case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1404            InfoTable = AcpiDmTableInfoSrat1;
1405            break;
1406        case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1407            InfoTable = AcpiDmTableInfoSrat2;
1408            break;
1409        default:
1410            AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type);
1411
1412            /* Attempt to continue */
1413
1414            if (!SubTable->Length)
1415            {
1416                AcpiOsPrintf ("Invalid zero length subtable\n");
1417                return;
1418            }
1419            goto NextSubTable;
1420        }
1421
1422        AcpiOsPrintf ("\n");
1423        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1424                    SubTable->Length, InfoTable);
1425        if (ACPI_FAILURE (Status))
1426        {
1427            return;
1428        }
1429
1430NextSubTable:
1431        /* Point to next sub-table */
1432
1433        Offset += SubTable->Length;
1434        SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1435    }
1436}
1437
1438
1439/*******************************************************************************
1440 *
1441 * FUNCTION:    AcpiDmDumpWdat
1442 *
1443 * PARAMETERS:  Table               - A WDAT table
1444 *
1445 * RETURN:      None
1446 *
1447 * DESCRIPTION: Format the contents of a WDAT
1448 *
1449 ******************************************************************************/
1450
1451void
1452AcpiDmDumpWdat (
1453    ACPI_TABLE_HEADER       *Table)
1454{
1455    ACPI_STATUS             Status;
1456    UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
1457    ACPI_WDAT_ENTRY         *SubTable;
1458
1459
1460    /* Main table */
1461
1462    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
1463    if (ACPI_FAILURE (Status))
1464    {
1465        return;
1466    }
1467
1468    /* Sub-tables */
1469
1470    SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
1471    while (Offset < Table->Length)
1472    {
1473        /* Common sub-table header */
1474
1475        AcpiOsPrintf ("\n");
1476        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1477                    sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
1478        if (ACPI_FAILURE (Status))
1479        {
1480            return;
1481        }
1482
1483        /* Point to next sub-table */
1484
1485        Offset += sizeof (ACPI_WDAT_ENTRY);
1486        SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));
1487    }
1488}
1489