No empty .Rs/.Re
[netbsd-mini2440.git] / sys / external / intel-public / acpica / dist / common / dmtbdump.c
blobe21e39810eeb1dc27b100e8dfca4fc2e23cfde58
1 /******************************************************************************
3 * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
12 * All rights reserved.
14 * 2. License
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.
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
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;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
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.
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.
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.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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.
80 * 4. Disclaimer and Export Compliance
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.
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.
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.
114 *****************************************************************************/
116 #include "acpi.h"
117 #include "accommon.h"
118 #include "acdisasm.h"
119 #include "actables.h"
121 /* This module used for application-level code only */
123 #define _COMPONENT ACPI_CA_DISASSEMBLER
124 ACPI_MODULE_NAME ("dmtbdump")
127 /*******************************************************************************
129 * FUNCTION: AcpiDmDumpRsdp
131 * PARAMETERS: Table - A RSDP
133 * RETURN: Length of the table (there is no length field, use revision)
135 * DESCRIPTION: Format the contents of a RSDP
137 ******************************************************************************/
139 UINT32
140 AcpiDmDumpRsdp (
141 ACPI_TABLE_HEADER *Table)
143 UINT32 Length = ACPI_RSDP_REV0_SIZE;
146 /* Dump the common ACPI 1.0 portion */
148 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
150 /* ACPI 2.0+ contains more data and has a Length field */
152 if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0)
154 Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length;
155 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
158 return (Length);
162 /*******************************************************************************
164 * FUNCTION: AcpiDmDumpRsdt
166 * PARAMETERS: Table - A RSDT
168 * RETURN: None
170 * DESCRIPTION: Format the contents of a RSDT
172 ******************************************************************************/
174 void
175 AcpiDmDumpRsdt (
176 ACPI_TABLE_HEADER *Table)
178 UINT32 *Array;
179 UINT32 Entries;
180 UINT32 Offset;
181 UINT32 i;
184 /* Point to start of table pointer array */
186 Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
187 Offset = sizeof (ACPI_TABLE_HEADER);
189 /* RSDT uses 32-bit pointers */
191 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
193 for (i = 0; i < Entries; i++)
195 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
196 AcpiOsPrintf ("%8.8X\n", Array[i]);
197 Offset += sizeof (UINT32);
202 /*******************************************************************************
204 * FUNCTION: AcpiDmDumpXsdt
206 * PARAMETERS: Table - A XSDT
208 * RETURN: None
210 * DESCRIPTION: Format the contents of a XSDT
212 ******************************************************************************/
214 void
215 AcpiDmDumpXsdt (
216 ACPI_TABLE_HEADER *Table)
218 UINT64 *Array;
219 UINT32 Entries;
220 UINT32 Offset;
221 UINT32 i;
224 /* Point to start of table pointer array */
226 Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
227 Offset = sizeof (ACPI_TABLE_HEADER);
229 /* XSDT uses 64-bit pointers */
231 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
233 for (i = 0; i < Entries; i++)
235 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
236 AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
237 Offset += sizeof (UINT64);
242 /*******************************************************************************
244 * FUNCTION: AcpiDmDumpFadt
246 * PARAMETERS: Table - A FADT
248 * RETURN: None
250 * DESCRIPTION: Format the contents of a FADT
252 ******************************************************************************/
254 void
255 AcpiDmDumpFadt (
256 ACPI_TABLE_HEADER *Table)
259 /* Common ACPI 1.0 portion of FADT */
261 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
263 /* Check for ACPI 1.0B MS extensions (FADT revision 2) */
265 if (Table->Revision == 2)
267 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
270 /* Check for ACPI 2.0+ extended data (FADT revision 3+) */
272 else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
274 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
277 /* Validate various fields in the FADT, including length */
279 AcpiTbCreateLocalFadt (Table, Table->Length);
283 /*******************************************************************************
285 * FUNCTION: AcpiDmDumpAsf
287 * PARAMETERS: Table - A ASF table
289 * RETURN: None
291 * DESCRIPTION: Format the contents of a ASF table
293 ******************************************************************************/
295 void
296 AcpiDmDumpAsf (
297 ACPI_TABLE_HEADER *Table)
299 ACPI_STATUS Status;
300 UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
301 ACPI_ASF_INFO *SubTable;
302 ACPI_DMTABLE_INFO *InfoTable;
303 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
304 UINT8 *DataTable = NULL;
305 UINT32 DataCount = 0;
306 UINT32 DataLength = 0;
307 UINT32 DataOffset = 0;
308 UINT32 i;
309 UINT8 Type;
312 /* No main table, only sub-tables */
314 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
315 while (Offset < Table->Length)
317 /* Common sub-table header */
319 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
320 SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
321 if (ACPI_FAILURE (Status))
323 return;
326 /* The actual type is the lower 7 bits of Type */
328 Type = (UINT8) (SubTable->Header.Type & 0x7F);
330 switch (Type)
332 case ACPI_ASF_TYPE_INFO:
333 InfoTable = AcpiDmTableInfoAsf0;
334 break;
336 case ACPI_ASF_TYPE_ALERT:
337 InfoTable = AcpiDmTableInfoAsf1;
338 DataInfoTable = AcpiDmTableInfoAsf1a;
339 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
340 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
341 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
342 DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
343 break;
345 case ACPI_ASF_TYPE_CONTROL:
346 InfoTable = AcpiDmTableInfoAsf2;
347 DataInfoTable = AcpiDmTableInfoAsf2a;
348 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
349 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
350 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
351 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
352 break;
354 case ACPI_ASF_TYPE_BOOT:
355 InfoTable = AcpiDmTableInfoAsf3;
356 break;
358 case ACPI_ASF_TYPE_ADDRESS:
359 InfoTable = AcpiDmTableInfoAsf4;
360 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
361 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
362 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
363 break;
365 default:
366 AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type);
367 return;
370 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
371 SubTable->Header.Length, InfoTable);
372 if (ACPI_FAILURE (Status))
374 return;
377 /* Dump variable-length extra data */
379 switch (Type)
381 case ACPI_ASF_TYPE_ALERT:
382 case ACPI_ASF_TYPE_CONTROL:
384 for (i = 0; i < DataCount; i++)
386 AcpiOsPrintf ("\n");
387 Status = AcpiDmDumpTable (Table->Length, DataOffset,
388 DataTable, DataLength, DataInfoTable);
389 if (ACPI_FAILURE (Status))
391 return;
394 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
395 DataOffset += DataLength;
397 break;
399 case ACPI_ASF_TYPE_ADDRESS:
401 for (i = 0; i < DataLength; i++)
403 if (!(i % 16))
405 AcpiDmLineHeader (DataOffset, 1, "Addresses");
408 AcpiOsPrintf ("%2.2X ", *DataTable);
409 DataTable++;
410 DataOffset++;
411 if (DataOffset > Table->Length)
413 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
414 return;
418 AcpiOsPrintf ("\n");
419 break;
421 default:
422 break;
425 AcpiOsPrintf ("\n");
427 /* Point to next sub-table */
429 if (!SubTable->Header.Length)
431 AcpiOsPrintf ("Invalid zero subtable header length\n");
432 return;
435 Offset += SubTable->Header.Length;
436 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
441 /*******************************************************************************
443 * FUNCTION: AcpiDmDumpCpep
445 * PARAMETERS: Table - A CPEP table
447 * RETURN: None
449 * DESCRIPTION: Format the contents of a CPEP. This table type consists
450 * of an open-ended number of subtables.
452 ******************************************************************************/
454 void
455 AcpiDmDumpCpep (
456 ACPI_TABLE_HEADER *Table)
458 ACPI_STATUS Status;
459 ACPI_CPEP_POLLING *SubTable;
460 UINT32 Length = Table->Length;
461 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
464 /* Main table */
466 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
467 if (ACPI_FAILURE (Status))
469 return;
472 /* Sub-tables */
474 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
475 while (Offset < Table->Length)
477 AcpiOsPrintf ("\n");
478 Status = AcpiDmDumpTable (Length, Offset, SubTable,
479 SubTable->Header.Length, AcpiDmTableInfoCpep0);
480 if (ACPI_FAILURE (Status))
482 return;
485 /* Point to next sub-table */
487 Offset += SubTable->Header.Length;
488 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
489 SubTable->Header.Length);
494 /*******************************************************************************
496 * FUNCTION: AcpiDmDumpDmar
498 * PARAMETERS: Table - A DMAR table
500 * RETURN: None
502 * DESCRIPTION: Format the contents of a DMAR. This table type consists
503 * of an open-ended number of subtables.
505 ******************************************************************************/
507 void
508 AcpiDmDumpDmar (
509 ACPI_TABLE_HEADER *Table)
511 ACPI_STATUS Status;
512 ACPI_DMAR_HEADER *SubTable;
513 UINT32 Length = Table->Length;
514 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
515 ACPI_DMTABLE_INFO *InfoTable;
516 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
517 UINT32 ScopeOffset;
518 UINT8 *PciPath;
519 UINT32 PathOffset;
522 /* Main table */
524 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
525 if (ACPI_FAILURE (Status))
527 return;
530 /* Sub-tables */
532 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
533 while (Offset < Table->Length)
535 /* Common sub-table header */
537 AcpiOsPrintf ("\n");
538 Status = AcpiDmDumpTable (Length, Offset, SubTable,
539 SubTable->Length, AcpiDmTableInfoDmarHdr);
540 if (ACPI_FAILURE (Status))
542 return;
545 switch (SubTable->Type)
547 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
548 InfoTable = AcpiDmTableInfoDmar0;
549 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
550 break;
551 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
552 InfoTable = AcpiDmTableInfoDmar1;
553 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
554 break;
555 case ACPI_DMAR_TYPE_ATSR:
556 InfoTable = AcpiDmTableInfoDmar2;
557 ScopeOffset = sizeof (ACPI_DMAR_ATSR);
558 break;
559 case ACPI_DMAR_HARDWARE_AFFINITY:
560 InfoTable = AcpiDmTableInfoDmar3;
561 ScopeOffset = sizeof (ACPI_DMAR_RHSA);
562 break;
563 default:
564 AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
565 return;
568 Status = AcpiDmDumpTable (Length, Offset, SubTable,
569 SubTable->Length, InfoTable);
570 if (ACPI_FAILURE (Status))
572 return;
575 /* Dump the device scope entries (if any) */
577 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
578 while (ScopeOffset < SubTable->Length)
580 AcpiOsPrintf ("\n");
581 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
582 ScopeTable->Length, AcpiDmTableInfoDmarScope);
583 if (ACPI_FAILURE (Status))
585 return;
588 /* Dump the PCI Path entries for this device scope */
590 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
592 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
593 sizeof (ACPI_DMAR_DEVICE_SCOPE));
595 while (PathOffset < ScopeTable->Length)
597 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
598 AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
600 /* Point to next PCI Path entry */
602 PathOffset += 2;
603 PciPath += 2;
606 /* Point to next device scope entry */
608 ScopeOffset += ScopeTable->Length;
609 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
610 ScopeTable, ScopeTable->Length);
613 /* Point to next sub-table */
615 Offset += SubTable->Length;
616 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
621 /*******************************************************************************
623 * FUNCTION: AcpiDmDumpEinj
625 * PARAMETERS: Table - A EINJ table
627 * RETURN: None
629 * DESCRIPTION: Format the contents of a EINJ. This table type consists
630 * of an open-ended number of subtables.
632 ******************************************************************************/
634 void
635 AcpiDmDumpEinj (
636 ACPI_TABLE_HEADER *Table)
638 ACPI_STATUS Status;
639 ACPI_WHEA_HEADER *SubTable;
640 UINT32 Length = Table->Length;
641 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
644 /* Main table */
646 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
647 if (ACPI_FAILURE (Status))
649 return;
652 /* Sub-tables */
654 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
655 while (Offset < Table->Length)
657 AcpiOsPrintf ("\n");
658 Status = AcpiDmDumpTable (Length, Offset, SubTable,
659 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
660 if (ACPI_FAILURE (Status))
662 return;
665 /* Point to next sub-table (each subtable is of fixed length) */
667 Offset += sizeof (ACPI_WHEA_HEADER);
668 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
669 sizeof (ACPI_WHEA_HEADER));
674 /*******************************************************************************
676 * FUNCTION: AcpiDmDumpErst
678 * PARAMETERS: Table - A ERST table
680 * RETURN: None
682 * DESCRIPTION: Format the contents of a ERST. This table type consists
683 * of an open-ended number of subtables.
685 ******************************************************************************/
687 void
688 AcpiDmDumpErst (
689 ACPI_TABLE_HEADER *Table)
691 ACPI_STATUS Status;
692 ACPI_WHEA_HEADER *SubTable;
693 UINT32 Length = Table->Length;
694 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
697 /* Main table */
699 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
700 if (ACPI_FAILURE (Status))
702 return;
705 /* Sub-tables */
707 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
708 while (Offset < Table->Length)
710 AcpiOsPrintf ("\n");
711 Status = AcpiDmDumpTable (Length, Offset, SubTable,
712 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
713 if (ACPI_FAILURE (Status))
715 return;
718 /* Point to next sub-table (each subtable is of fixed length) */
720 Offset += sizeof (ACPI_WHEA_HEADER);
721 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
722 sizeof (ACPI_WHEA_HEADER));
727 /*******************************************************************************
729 * FUNCTION: AcpiDmDumpHest
731 * PARAMETERS: Table - A HEST table
733 * RETURN: None
735 * DESCRIPTION: Format the contents of a HEST. This table type consists
736 * of an open-ended number of subtables.
738 ******************************************************************************/
740 void
741 AcpiDmDumpHest (
742 ACPI_TABLE_HEADER *Table)
744 ACPI_STATUS Status;
745 ACPI_HEST_HEADER *SubTable;
746 UINT32 Length = Table->Length;
747 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
748 ACPI_DMTABLE_INFO *InfoTable;
749 UINT32 SubTableLength;
752 /* Main table */
754 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
755 if (ACPI_FAILURE (Status))
757 return;
760 /* Sub-tables */
762 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
763 while (Offset < Table->Length)
765 switch (SubTable->Type)
767 case ACPI_HEST_TYPE_IA32_CHECK:
768 InfoTable = AcpiDmTableInfoHest0;
769 SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
770 break;
772 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
773 InfoTable = AcpiDmTableInfoHest1;
774 SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
775 break;
777 case ACPI_HEST_TYPE_IA32_NMI:
778 InfoTable = AcpiDmTableInfoHest2;
779 SubTableLength = sizeof (ACPI_HEST_IA_NMI);
780 break;
782 case ACPI_HEST_TYPE_AER_ROOT_PORT:
783 InfoTable = AcpiDmTableInfoHest6;
784 SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
785 break;
787 case ACPI_HEST_TYPE_AER_ENDPOINT:
788 InfoTable = AcpiDmTableInfoHest7;
789 SubTableLength = sizeof (ACPI_HEST_AER);
790 break;
792 case ACPI_HEST_TYPE_AER_BRIDGE:
793 InfoTable = AcpiDmTableInfoHest8;
794 SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
795 break;
797 case ACPI_HEST_TYPE_GENERIC_ERROR:
798 InfoTable = AcpiDmTableInfoHest9;
799 SubTableLength = sizeof (ACPI_HEST_GENERIC);
800 break;
802 default:
803 /* Cannot continue on unknown type - no length */
805 AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type);
806 return;
809 AcpiOsPrintf ("\n");
810 Status = AcpiDmDumpTable (Length, Offset, SubTable,
811 SubTableLength, InfoTable);
812 if (ACPI_FAILURE (Status))
814 return;
817 /* Point to next sub-table (each subtable is of fixed length) */
819 Offset += SubTableLength;
820 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
825 /*******************************************************************************
827 * FUNCTION: AcpiDmDumpIvrs
829 * PARAMETERS: Table - A IVRS table
831 * RETURN: None
833 * DESCRIPTION: Format the contents of a IVRS
835 ******************************************************************************/
837 static UINT8 EntrySizes[] = {4,8,16,32};
839 void
840 AcpiDmDumpIvrs (
841 ACPI_TABLE_HEADER *Table)
843 ACPI_STATUS Status;
844 UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
845 UINT32 EntryOffset;
846 UINT32 EntryLength;
847 UINT32 EntryType;
848 ACPI_IVRS_DE_HEADER *DeviceEntry;
849 ACPI_IVRS_HEADER *SubTable;
850 ACPI_DMTABLE_INFO *InfoTable;
853 /* Main table */
855 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
856 if (ACPI_FAILURE (Status))
858 return;
861 /* Sub-tables */
863 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
864 while (Offset < Table->Length)
866 /* Common sub-table header */
868 AcpiOsPrintf ("\n");
869 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
870 SubTable->Length, AcpiDmTableInfoIvrsHdr);
871 if (ACPI_FAILURE (Status))
873 return;
876 switch (SubTable->Type)
878 case ACPI_IVRS_TYPE_HARDWARE:
879 InfoTable = AcpiDmTableInfoIvrs0;
880 break;
881 case ACPI_IVRS_TYPE_MEMORY1:
882 case ACPI_IVRS_TYPE_MEMORY2:
883 case ACPI_IVRS_TYPE_MEMORY3:
884 InfoTable = AcpiDmTableInfoIvrs1;
885 break;
886 default:
887 AcpiOsPrintf ("\n**** Unknown IVRS sub-table type %X\n",
888 SubTable->Type);
890 /* Attempt to continue */
892 if (!SubTable->Length)
894 AcpiOsPrintf ("Invalid zero length subtable\n");
895 return;
897 goto NextSubTable;
900 /* Dump the subtable */
902 AcpiOsPrintf ("\n");
903 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
904 SubTable->Length, InfoTable);
905 if (ACPI_FAILURE (Status))
907 return;
910 /* The hardware subtable can contain multiple device entries */
912 if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
914 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
915 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
916 sizeof (ACPI_IVRS_HARDWARE));
918 while (EntryOffset < (Offset + SubTable->Length))
920 AcpiOsPrintf ("\n");
922 * Upper 2 bits of Type encode the length of the device entry
924 * 00 = 4 byte
925 * 01 = 8 byte
926 * 10 = 16 byte - currently no entries defined
927 * 11 = 32 byte - currently no entries defined
929 EntryType = DeviceEntry->Type;
930 EntryLength = EntrySizes [EntryType >> 6];
932 switch (EntryType)
934 /* 4-byte device entries */
936 case ACPI_IVRS_TYPE_PAD4:
937 case ACPI_IVRS_TYPE_ALL:
938 case ACPI_IVRS_TYPE_SELECT:
939 case ACPI_IVRS_TYPE_START:
940 case ACPI_IVRS_TYPE_END:
942 InfoTable = AcpiDmTableInfoIvrs4;
943 break;
945 /* 8-byte entries, type A */
947 case ACPI_IVRS_TYPE_ALIAS_SELECT:
948 case ACPI_IVRS_TYPE_ALIAS_START:
950 InfoTable = AcpiDmTableInfoIvrs8a;
951 break;
953 /* 8-byte entries, type B */
955 case ACPI_IVRS_TYPE_PAD8:
956 case ACPI_IVRS_TYPE_EXT_SELECT:
957 case ACPI_IVRS_TYPE_EXT_START:
959 InfoTable = AcpiDmTableInfoIvrs8b;
960 break;
962 /* 8-byte entries, type C */
964 case ACPI_IVRS_TYPE_SPECIAL:
966 InfoTable = AcpiDmTableInfoIvrs8c;
967 break;
969 default:
970 InfoTable = AcpiDmTableInfoIvrs4;
971 AcpiOsPrintf (
972 "\n**** Unknown IVRS device entry type/length: "
973 "%.2X/%X at offset %.4X: (header below)\n",
974 EntryType, EntryLength, EntryOffset);
975 break;
978 /* Dump the Device Entry */
980 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
981 DeviceEntry, EntryLength, InfoTable);
983 EntryOffset += EntryLength;
984 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
985 EntryLength);
989 NextSubTable:
990 /* Point to next sub-table */
992 Offset += SubTable->Length;
993 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
998 /*******************************************************************************
1000 * FUNCTION: AcpiDmDumpMadt
1002 * PARAMETERS: Table - A MADT table
1004 * RETURN: None
1006 * DESCRIPTION: Format the contents of a MADT. This table type consists
1007 * of an open-ended number of subtables.
1009 ******************************************************************************/
1011 void
1012 AcpiDmDumpMadt (
1013 ACPI_TABLE_HEADER *Table)
1015 ACPI_STATUS Status;
1016 ACPI_SUBTABLE_HEADER *SubTable;
1017 UINT32 Length = Table->Length;
1018 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
1019 ACPI_DMTABLE_INFO *InfoTable;
1022 /* Main table */
1024 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
1025 if (ACPI_FAILURE (Status))
1027 return;
1030 /* Sub-tables */
1032 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1033 while (Offset < Table->Length)
1035 /* Common sub-table header */
1037 AcpiOsPrintf ("\n");
1038 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1039 SubTable->Length, AcpiDmTableInfoMadtHdr);
1040 if (ACPI_FAILURE (Status))
1042 return;
1045 switch (SubTable->Type)
1047 case ACPI_MADT_TYPE_LOCAL_APIC:
1048 InfoTable = AcpiDmTableInfoMadt0;
1049 break;
1050 case ACPI_MADT_TYPE_IO_APIC:
1051 InfoTable = AcpiDmTableInfoMadt1;
1052 break;
1053 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
1054 InfoTable = AcpiDmTableInfoMadt2;
1055 break;
1056 case ACPI_MADT_TYPE_NMI_SOURCE:
1057 InfoTable = AcpiDmTableInfoMadt3;
1058 break;
1059 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
1060 InfoTable = AcpiDmTableInfoMadt4;
1061 break;
1062 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
1063 InfoTable = AcpiDmTableInfoMadt5;
1064 break;
1065 case ACPI_MADT_TYPE_IO_SAPIC:
1066 InfoTable = AcpiDmTableInfoMadt6;
1067 break;
1068 case ACPI_MADT_TYPE_LOCAL_SAPIC:
1069 InfoTable = AcpiDmTableInfoMadt7;
1070 break;
1071 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
1072 InfoTable = AcpiDmTableInfoMadt8;
1073 break;
1074 case ACPI_MADT_TYPE_LOCAL_X2APIC:
1075 InfoTable = AcpiDmTableInfoMadt9;
1076 break;
1077 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
1078 InfoTable = AcpiDmTableInfoMadt10;
1079 break;
1080 default:
1081 AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
1083 /* Attempt to continue */
1085 if (!SubTable->Length)
1087 AcpiOsPrintf ("Invalid zero length subtable\n");
1088 return;
1090 goto NextSubTable;
1093 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1094 SubTable->Length, InfoTable);
1095 if (ACPI_FAILURE (Status))
1097 return;
1100 NextSubTable:
1101 /* Point to next sub-table */
1103 Offset += SubTable->Length;
1104 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1109 /*******************************************************************************
1111 * FUNCTION: AcpiDmDumpMcfg
1113 * PARAMETERS: Table - A MCFG Table
1115 * RETURN: None
1117 * DESCRIPTION: Format the contents of a MCFG table
1119 ******************************************************************************/
1121 void
1122 AcpiDmDumpMcfg (
1123 ACPI_TABLE_HEADER *Table)
1125 ACPI_STATUS Status;
1126 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
1127 ACPI_MCFG_ALLOCATION *SubTable;
1130 /* Main table */
1132 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1133 if (ACPI_FAILURE (Status))
1135 return;
1138 /* Sub-tables */
1140 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1141 while (Offset < Table->Length)
1143 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1145 AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n",
1146 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1147 return;
1150 AcpiOsPrintf ("\n");
1151 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1152 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1153 if (ACPI_FAILURE (Status))
1155 return;
1158 /* Point to next sub-table (each subtable is of fixed length) */
1160 Offset += sizeof (ACPI_MCFG_ALLOCATION);
1161 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
1162 sizeof (ACPI_MCFG_ALLOCATION));
1167 /*******************************************************************************
1169 * FUNCTION: AcpiDmDumpMsct
1171 * PARAMETERS: Table - A MSCT table
1173 * RETURN: None
1175 * DESCRIPTION: Format the contents of a MSCT
1177 ******************************************************************************/
1179 void
1180 AcpiDmDumpMsct (
1181 ACPI_TABLE_HEADER *Table)
1183 ACPI_STATUS Status;
1184 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
1185 ACPI_MSCT_PROXIMITY *SubTable;
1188 /* Main table */
1190 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1191 if (ACPI_FAILURE (Status))
1193 return;
1196 /* Sub-tables */
1198 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1199 while (Offset < Table->Length)
1201 /* Common sub-table header */
1203 AcpiOsPrintf ("\n");
1204 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1205 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1206 if (ACPI_FAILURE (Status))
1208 return;
1211 /* Point to next sub-table */
1213 Offset += sizeof (ACPI_MSCT_PROXIMITY);
1214 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
1219 /*******************************************************************************
1221 * FUNCTION: AcpiDmDumpSlit
1223 * PARAMETERS: Table - An SLIT
1225 * RETURN: None
1227 * DESCRIPTION: Format the contents of a SLIT
1229 ******************************************************************************/
1231 void
1232 AcpiDmDumpSlit (
1233 ACPI_TABLE_HEADER *Table)
1235 ACPI_STATUS Status;
1236 UINT32 Offset;
1237 UINT8 *Row;
1238 UINT32 Localities;
1239 UINT32 i;
1240 UINT32 j;
1243 /* Main table */
1245 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
1246 if (ACPI_FAILURE (Status))
1248 return;
1251 /* Display the Locality NxN Matrix */
1253 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
1254 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
1255 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
1257 for (i = 0; i < Localities; i++)
1259 /* Display one row of the matrix */
1261 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
1262 for (j = 0; j < Localities; j++)
1264 /* Check for beyond EOT */
1266 if (Offset >= Table->Length)
1268 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
1269 return;
1272 AcpiOsPrintf ("%2.2X ", Row[j]);
1273 Offset++;
1275 /* Display up to 16 bytes per output row */
1277 if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
1279 AcpiOsPrintf ("\n");
1280 AcpiDmLineHeader (Offset, 0, "");
1284 /* Point to next row */
1286 AcpiOsPrintf ("\n");
1287 Row += Localities;
1292 /*******************************************************************************
1294 * FUNCTION: AcpiDmDumpSrat
1296 * PARAMETERS: Table - A SRAT table
1298 * RETURN: None
1300 * DESCRIPTION: Format the contents of a SRAT
1302 ******************************************************************************/
1304 void
1305 AcpiDmDumpSrat (
1306 ACPI_TABLE_HEADER *Table)
1308 ACPI_STATUS Status;
1309 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
1310 ACPI_SUBTABLE_HEADER *SubTable;
1311 ACPI_DMTABLE_INFO *InfoTable;
1314 /* Main table */
1316 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
1317 if (ACPI_FAILURE (Status))
1319 return;
1322 /* Sub-tables */
1324 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1325 while (Offset < Table->Length)
1327 /* Common sub-table header */
1329 AcpiOsPrintf ("\n");
1330 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1331 SubTable->Length, AcpiDmTableInfoSratHdr);
1332 if (ACPI_FAILURE (Status))
1334 return;
1337 switch (SubTable->Type)
1339 case ACPI_SRAT_TYPE_CPU_AFFINITY:
1340 InfoTable = AcpiDmTableInfoSrat0;
1341 break;
1342 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
1343 InfoTable = AcpiDmTableInfoSrat1;
1344 break;
1345 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
1346 InfoTable = AcpiDmTableInfoSrat2;
1347 break;
1348 default:
1349 AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
1351 /* Attempt to continue */
1353 if (!SubTable->Length)
1355 AcpiOsPrintf ("Invalid zero length subtable\n");
1356 return;
1358 goto NextSubTable;
1361 AcpiOsPrintf ("\n");
1362 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1363 SubTable->Length, InfoTable);
1364 if (ACPI_FAILURE (Status))
1366 return;
1369 NextSubTable:
1370 /* Point to next sub-table */
1372 Offset += SubTable->Length;
1373 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1378 /*******************************************************************************
1380 * FUNCTION: AcpiDmDumpWdat
1382 * PARAMETERS: Table - A WDAT table
1384 * RETURN: None
1386 * DESCRIPTION: Format the contents of a WDAT
1388 ******************************************************************************/
1390 void
1391 AcpiDmDumpWdat (
1392 ACPI_TABLE_HEADER *Table)
1394 ACPI_STATUS Status;
1395 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
1396 ACPI_WDAT_ENTRY *SubTable;
1399 /* Main table */
1401 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
1402 if (ACPI_FAILURE (Status))
1404 return;
1407 /* Sub-tables */
1409 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
1410 while (Offset < Table->Length)
1412 /* Common sub-table header */
1414 AcpiOsPrintf ("\n");
1415 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1416 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
1417 if (ACPI_FAILURE (Status))
1419 return;
1422 /* Point to next sub-table */
1424 Offset += sizeof (ACPI_WDAT_ENTRY);
1425 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));