BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / bus_managers / acpi / acpica / common / dmtbdump.c
blobb0ae9058a4ae941bdbba8483e9d0b06dbbf10c9c
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 - 2014, 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 /* Local prototypes */
129 static void
130 AcpiDmValidateFadtLength (
131 UINT32 Revision,
132 UINT32 Length);
134 static void
135 AcpiDmDumpBuffer (
136 void *Table,
137 UINT32 BufferOffset,
138 UINT32 Length,
139 UINT32 AbsoluteOffset,
140 char *Header);
143 /*******************************************************************************
145 * FUNCTION: AcpiDmDumpBuffer
147 * PARAMETERS: Table - ACPI Table or subtable
148 * BufferOffset - Offset of buffer from Table above
149 * Length - Length of the buffer
150 * AbsoluteOffset - Offset of buffer in the main ACPI table
151 * Header - Name of the buffer field (printed on the
152 * first line only.)
154 * RETURN: None
156 * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
157 * disassembler output format.)
159 ******************************************************************************/
161 static void
162 AcpiDmDumpBuffer (
163 void *Table,
164 UINT32 BufferOffset,
165 UINT32 Length,
166 UINT32 AbsoluteOffset,
167 char *Header)
169 UINT8 *Buffer;
170 UINT32 i;
173 if (!Length)
175 return;
178 Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
179 i = 0;
181 while (i < Length)
183 if (!(i % 16))
185 AcpiOsPrintf ("\n");
186 AcpiDmLineHeader (AbsoluteOffset,
187 ((Length - i) > 16) ? 16 : (Length - i), Header);
188 Header = NULL;
191 AcpiOsPrintf ("%.02X ", *Buffer);
192 i++;
193 Buffer++;
194 AbsoluteOffset++;
197 AcpiOsPrintf ("\n");
201 /*******************************************************************************
203 * FUNCTION: AcpiDmDumpRsdp
205 * PARAMETERS: Table - A RSDP
207 * RETURN: Length of the table (there is not always a length field,
208 * use revision or length if available (ACPI 2.0+))
210 * DESCRIPTION: Format the contents of a RSDP
212 ******************************************************************************/
214 UINT32
215 AcpiDmDumpRsdp (
216 ACPI_TABLE_HEADER *Table)
218 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
219 UINT32 Length = sizeof (ACPI_RSDP_COMMON);
220 UINT8 Checksum;
223 /* Dump the common ACPI 1.0 portion */
225 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
227 /* Validate the first checksum */
229 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
230 Rsdp->Checksum);
231 if (Checksum != Rsdp->Checksum)
233 AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
234 Checksum);
237 /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
239 if (Rsdp->Revision > 0)
241 Length = Rsdp->Length;
242 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
244 /* Validate the extended checksum over entire RSDP */
246 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
247 Rsdp->ExtendedChecksum);
248 if (Checksum != Rsdp->ExtendedChecksum)
250 AcpiOsPrintf (
251 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
252 Checksum);
256 return (Length);
260 /*******************************************************************************
262 * FUNCTION: AcpiDmDumpRsdt
264 * PARAMETERS: Table - A RSDT
266 * RETURN: None
268 * DESCRIPTION: Format the contents of a RSDT
270 ******************************************************************************/
272 void
273 AcpiDmDumpRsdt (
274 ACPI_TABLE_HEADER *Table)
276 UINT32 *Array;
277 UINT32 Entries;
278 UINT32 Offset;
279 UINT32 i;
282 /* Point to start of table pointer array */
284 Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
285 Offset = sizeof (ACPI_TABLE_HEADER);
287 /* RSDT uses 32-bit pointers */
289 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
291 for (i = 0; i < Entries; i++)
293 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
294 AcpiOsPrintf ("%8.8X\n", Array[i]);
295 Offset += sizeof (UINT32);
300 /*******************************************************************************
302 * FUNCTION: AcpiDmDumpXsdt
304 * PARAMETERS: Table - A XSDT
306 * RETURN: None
308 * DESCRIPTION: Format the contents of a XSDT
310 ******************************************************************************/
312 void
313 AcpiDmDumpXsdt (
314 ACPI_TABLE_HEADER *Table)
316 UINT64 *Array;
317 UINT32 Entries;
318 UINT32 Offset;
319 UINT32 i;
322 /* Point to start of table pointer array */
324 Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
325 Offset = sizeof (ACPI_TABLE_HEADER);
327 /* XSDT uses 64-bit pointers */
329 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
331 for (i = 0; i < Entries; i++)
333 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
334 AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
335 Offset += sizeof (UINT64);
340 /*******************************************************************************
342 * FUNCTION: AcpiDmDumpFadt
344 * PARAMETERS: Table - A FADT
346 * RETURN: None
348 * DESCRIPTION: Format the contents of a FADT
350 * NOTE: We cannot depend on the FADT version to indicate the actual
351 * contents of the FADT because of BIOS bugs. The table length
352 * is the only reliable indicator.
354 ******************************************************************************/
356 void
357 AcpiDmDumpFadt (
358 ACPI_TABLE_HEADER *Table)
361 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
363 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
365 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
367 if ((Table->Length > ACPI_FADT_V1_SIZE) &&
368 (Table->Length <= ACPI_FADT_V2_SIZE))
370 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
373 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
375 else if (Table->Length > ACPI_FADT_V2_SIZE)
377 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
379 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
381 if (Table->Length > ACPI_FADT_V3_SIZE)
383 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5);
387 /* Validate various fields in the FADT, including length */
389 AcpiTbCreateLocalFadt (Table, Table->Length);
391 /* Validate FADT length against the revision */
393 AcpiDmValidateFadtLength (Table->Revision, Table->Length);
397 /*******************************************************************************
399 * FUNCTION: AcpiDmValidateFadtLength
401 * PARAMETERS: Revision - FADT revision (Header->Revision)
402 * Length - FADT length (Header->Length
404 * RETURN: None
406 * DESCRIPTION: Check the FADT revision against the expected table length for
407 * that revision. Issue a warning if the length is not what was
408 * expected. This seems to be such a common BIOS bug that the
409 * FADT revision has been rendered virtually meaningless.
411 ******************************************************************************/
413 static void
414 AcpiDmValidateFadtLength (
415 UINT32 Revision,
416 UINT32 Length)
418 UINT32 ExpectedLength;
421 switch (Revision)
423 case 0:
425 AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
426 return;
428 case 1:
430 ExpectedLength = ACPI_FADT_V1_SIZE;
431 break;
433 case 2:
435 ExpectedLength = ACPI_FADT_V2_SIZE;
436 break;
438 case 3:
439 case 4:
441 ExpectedLength = ACPI_FADT_V3_SIZE;
442 break;
444 case 5:
446 ExpectedLength = ACPI_FADT_V5_SIZE;
447 break;
449 default:
451 return;
454 if (Length == ExpectedLength)
456 return;
459 AcpiOsPrintf (
460 "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n",
461 Revision, Length, ExpectedLength);
465 /*******************************************************************************
467 * FUNCTION: AcpiDmDumpAsf
469 * PARAMETERS: Table - A ASF table
471 * RETURN: None
473 * DESCRIPTION: Format the contents of a ASF table
475 ******************************************************************************/
477 void
478 AcpiDmDumpAsf (
479 ACPI_TABLE_HEADER *Table)
481 ACPI_STATUS Status;
482 UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
483 ACPI_ASF_INFO *SubTable;
484 ACPI_DMTABLE_INFO *InfoTable;
485 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
486 UINT8 *DataTable = NULL;
487 UINT32 DataCount = 0;
488 UINT32 DataLength = 0;
489 UINT32 DataOffset = 0;
490 UINT32 i;
491 UINT8 Type;
494 /* No main table, only subtables */
496 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
497 while (Offset < Table->Length)
499 /* Common subtable header */
501 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
502 SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
503 if (ACPI_FAILURE (Status))
505 return;
508 /* The actual type is the lower 7 bits of Type */
510 Type = (UINT8) (SubTable->Header.Type & 0x7F);
512 switch (Type)
514 case ACPI_ASF_TYPE_INFO:
516 InfoTable = AcpiDmTableInfoAsf0;
517 break;
519 case ACPI_ASF_TYPE_ALERT:
521 InfoTable = AcpiDmTableInfoAsf1;
522 DataInfoTable = AcpiDmTableInfoAsf1a;
523 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
524 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
525 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
526 DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
527 break;
529 case ACPI_ASF_TYPE_CONTROL:
531 InfoTable = AcpiDmTableInfoAsf2;
532 DataInfoTable = AcpiDmTableInfoAsf2a;
533 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
534 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
535 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
536 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
537 break;
539 case ACPI_ASF_TYPE_BOOT:
541 InfoTable = AcpiDmTableInfoAsf3;
542 break;
544 case ACPI_ASF_TYPE_ADDRESS:
546 InfoTable = AcpiDmTableInfoAsf4;
547 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
548 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
549 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
550 break;
552 default:
554 AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", SubTable->Header.Type);
555 return;
558 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
559 SubTable->Header.Length, InfoTable);
560 if (ACPI_FAILURE (Status))
562 return;
565 /* Dump variable-length extra data */
567 switch (Type)
569 case ACPI_ASF_TYPE_ALERT:
570 case ACPI_ASF_TYPE_CONTROL:
572 for (i = 0; i < DataCount; i++)
574 AcpiOsPrintf ("\n");
575 Status = AcpiDmDumpTable (Table->Length, DataOffset,
576 DataTable, DataLength, DataInfoTable);
577 if (ACPI_FAILURE (Status))
579 return;
582 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
583 DataOffset += DataLength;
585 break;
587 case ACPI_ASF_TYPE_ADDRESS:
589 for (i = 0; i < DataLength; i++)
591 if (!(i % 16))
593 AcpiDmLineHeader (DataOffset, 1, "Addresses");
596 AcpiOsPrintf ("%2.2X ", *DataTable);
597 DataTable++;
598 DataOffset++;
599 if (DataOffset > Table->Length)
601 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
602 return;
606 AcpiOsPrintf ("\n");
607 break;
609 default:
611 break;
614 AcpiOsPrintf ("\n");
616 /* Point to next subtable */
618 if (!SubTable->Header.Length)
620 AcpiOsPrintf ("Invalid zero subtable header length\n");
621 return;
624 Offset += SubTable->Header.Length;
625 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
630 /*******************************************************************************
632 * FUNCTION: AcpiDmDumpCpep
634 * PARAMETERS: Table - A CPEP table
636 * RETURN: None
638 * DESCRIPTION: Format the contents of a CPEP. This table type consists
639 * of an open-ended number of subtables.
641 ******************************************************************************/
643 void
644 AcpiDmDumpCpep (
645 ACPI_TABLE_HEADER *Table)
647 ACPI_STATUS Status;
648 ACPI_CPEP_POLLING *SubTable;
649 UINT32 Length = Table->Length;
650 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
653 /* Main table */
655 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
656 if (ACPI_FAILURE (Status))
658 return;
661 /* Subtables */
663 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
664 while (Offset < Table->Length)
666 AcpiOsPrintf ("\n");
667 Status = AcpiDmDumpTable (Length, Offset, SubTable,
668 SubTable->Header.Length, AcpiDmTableInfoCpep0);
669 if (ACPI_FAILURE (Status))
671 return;
674 /* Point to next subtable */
676 Offset += SubTable->Header.Length;
677 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
678 SubTable->Header.Length);
683 /*******************************************************************************
685 * FUNCTION: AcpiDmDumpCsrt
687 * PARAMETERS: Table - A CSRT table
689 * RETURN: None
691 * DESCRIPTION: Format the contents of a CSRT. This table type consists
692 * of an open-ended number of subtables.
694 ******************************************************************************/
696 void
697 AcpiDmDumpCsrt (
698 ACPI_TABLE_HEADER *Table)
700 ACPI_STATUS Status;
701 ACPI_CSRT_GROUP *SubTable;
702 ACPI_CSRT_SHARED_INFO *SharedInfoTable;
703 ACPI_CSRT_DESCRIPTOR *SubSubTable;
704 UINT32 Length = Table->Length;
705 UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
706 UINT32 SubOffset;
707 UINT32 SubSubOffset;
708 UINT32 InfoLength;
711 /* The main table only contains the ACPI header, thus already handled */
713 /* Subtables (Resource Groups) */
715 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
716 while (Offset < Table->Length)
718 /* Resource group subtable */
720 AcpiOsPrintf ("\n");
721 Status = AcpiDmDumpTable (Length, Offset, SubTable,
722 SubTable->Length, AcpiDmTableInfoCsrt0);
723 if (ACPI_FAILURE (Status))
725 return;
728 /* Shared info subtable (One per resource group) */
730 SubOffset = sizeof (ACPI_CSRT_GROUP);
731 SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
732 Offset + SubOffset);
734 AcpiOsPrintf ("\n");
735 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
736 sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
737 if (ACPI_FAILURE (Status))
739 return;
742 SubOffset += SubTable->SharedInfoLength;
744 /* Sub-Subtables (Resource Descriptors) */
746 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
747 Offset + SubOffset);
749 while ((SubOffset < SubTable->Length) &&
750 ((Offset + SubOffset) < Table->Length))
752 AcpiOsPrintf ("\n");
753 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
754 SubSubTable->Length, AcpiDmTableInfoCsrt2);
755 if (ACPI_FAILURE (Status))
757 return;
760 SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
762 /* Resource-specific info buffer */
764 InfoLength = SubSubTable->Length - SubSubOffset;
766 AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength,
767 Offset + SubOffset + SubSubOffset, "ResourceInfo");
768 SubSubOffset += InfoLength;
770 /* Point to next sub-subtable */
772 SubOffset += SubSubTable->Length;
773 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
774 SubSubTable->Length);
777 /* Point to next subtable */
779 Offset += SubTable->Length;
780 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
781 SubTable->Length);
786 /*******************************************************************************
788 * FUNCTION: AcpiDmDumpDbg2
790 * PARAMETERS: Table - A DBG2 table
792 * RETURN: None
794 * DESCRIPTION: Format the contents of a DBG2. This table type consists
795 * of an open-ended number of subtables.
797 ******************************************************************************/
799 void
800 AcpiDmDumpDbg2 (
801 ACPI_TABLE_HEADER *Table)
803 ACPI_STATUS Status;
804 ACPI_DBG2_DEVICE *SubTable;
805 UINT32 Length = Table->Length;
806 UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
807 UINT32 i;
808 UINT32 ArrayOffset;
809 UINT32 AbsoluteOffset;
810 UINT8 *Array;
813 /* Main table */
815 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
816 if (ACPI_FAILURE (Status))
818 return;
821 /* Subtables */
823 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
824 while (Offset < Table->Length)
826 AcpiOsPrintf ("\n");
827 Status = AcpiDmDumpTable (Length, Offset, SubTable,
828 SubTable->Length, AcpiDmTableInfoDbg2Device);
829 if (ACPI_FAILURE (Status))
831 return;
834 /* Dump the BaseAddress array */
836 for (i = 0; i < SubTable->RegisterCount; i++)
838 ArrayOffset = SubTable->BaseAddressOffset +
839 (sizeof (ACPI_GENERIC_ADDRESS) * i);
840 AbsoluteOffset = Offset + ArrayOffset;
841 Array = (UINT8 *) SubTable + ArrayOffset;
843 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
844 SubTable->Length, AcpiDmTableInfoDbg2Addr);
845 if (ACPI_FAILURE (Status))
847 return;
851 /* Dump the AddressSize array */
853 for (i = 0; i < SubTable->RegisterCount; i++)
855 ArrayOffset = SubTable->AddressSizeOffset +
856 (sizeof (UINT32) * i);
857 AbsoluteOffset = Offset + ArrayOffset;
858 Array = (UINT8 *) SubTable + ArrayOffset;
860 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
861 SubTable->Length, AcpiDmTableInfoDbg2Size);
862 if (ACPI_FAILURE (Status))
864 return;
868 /* Dump the Namestring (required) */
870 AcpiOsPrintf ("\n");
871 ArrayOffset = SubTable->NamepathOffset;
872 AbsoluteOffset = Offset + ArrayOffset;
873 Array = (UINT8 *) SubTable + ArrayOffset;
875 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
876 SubTable->Length, AcpiDmTableInfoDbg2Name);
877 if (ACPI_FAILURE (Status))
879 return;
882 /* Dump the OemData (optional) */
884 if (SubTable->OemDataOffset)
886 AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength,
887 Offset + SubTable->OemDataOffset, "OEM Data");
890 /* Point to next subtable */
892 Offset += SubTable->Length;
893 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
894 SubTable->Length);
899 /*******************************************************************************
901 * FUNCTION: AcpiDmDumpDmar
903 * PARAMETERS: Table - A DMAR table
905 * RETURN: None
907 * DESCRIPTION: Format the contents of a DMAR. This table type consists
908 * of an open-ended number of subtables.
910 ******************************************************************************/
913 void
914 AcpiDmDumpDmar (
915 ACPI_TABLE_HEADER *Table)
917 ACPI_STATUS Status;
918 ACPI_DMAR_HEADER *SubTable;
919 UINT32 Length = Table->Length;
920 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
921 ACPI_DMTABLE_INFO *InfoTable;
922 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
923 UINT32 ScopeOffset;
924 UINT8 *PciPath;
925 UINT32 PathOffset;
928 /* Main table */
930 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
931 if (ACPI_FAILURE (Status))
933 return;
936 /* Subtables */
938 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
939 while (Offset < Table->Length)
941 /* Common subtable header */
943 AcpiOsPrintf ("\n");
944 Status = AcpiDmDumpTable (Length, Offset, SubTable,
945 SubTable->Length, AcpiDmTableInfoDmarHdr);
946 if (ACPI_FAILURE (Status))
948 return;
950 AcpiOsPrintf ("\n");
952 switch (SubTable->Type)
954 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
956 InfoTable = AcpiDmTableInfoDmar0;
957 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
958 break;
960 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
962 InfoTable = AcpiDmTableInfoDmar1;
963 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
964 break;
966 case ACPI_DMAR_TYPE_ROOT_ATS:
968 InfoTable = AcpiDmTableInfoDmar2;
969 ScopeOffset = sizeof (ACPI_DMAR_ATSR);
970 break;
972 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
974 InfoTable = AcpiDmTableInfoDmar3;
975 ScopeOffset = sizeof (ACPI_DMAR_RHSA);
976 break;
978 case ACPI_DMAR_TYPE_NAMESPACE:
980 InfoTable = AcpiDmTableInfoDmar4;
981 ScopeOffset = sizeof (ACPI_DMAR_ANDD);
982 break;
984 default:
986 AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", SubTable->Type);
987 return;
990 Status = AcpiDmDumpTable (Length, Offset, SubTable,
991 SubTable->Length, InfoTable);
992 if (ACPI_FAILURE (Status))
994 return;
998 * Dump the optional device scope entries
1000 if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1001 (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE))
1003 /* These types do not support device scopes */
1005 goto NextSubtable;
1008 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
1009 while (ScopeOffset < SubTable->Length)
1011 AcpiOsPrintf ("\n");
1012 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
1013 ScopeTable->Length, AcpiDmTableInfoDmarScope);
1014 if (ACPI_FAILURE (Status))
1016 return;
1018 AcpiOsPrintf ("\n");
1020 /* Dump the PCI Path entries for this device scope */
1022 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
1024 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
1025 sizeof (ACPI_DMAR_DEVICE_SCOPE));
1027 while (PathOffset < ScopeTable->Length)
1029 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
1030 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
1032 /* Point to next PCI Path entry */
1034 PathOffset += 2;
1035 PciPath += 2;
1036 AcpiOsPrintf ("\n");
1039 /* Point to next device scope entry */
1041 ScopeOffset += ScopeTable->Length;
1042 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
1043 ScopeTable, ScopeTable->Length);
1046 NextSubtable:
1047 /* Point to next subtable */
1049 Offset += SubTable->Length;
1050 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
1055 /*******************************************************************************
1057 * FUNCTION: AcpiDmDumpEinj
1059 * PARAMETERS: Table - A EINJ table
1061 * RETURN: None
1063 * DESCRIPTION: Format the contents of a EINJ. This table type consists
1064 * of an open-ended number of subtables.
1066 ******************************************************************************/
1068 void
1069 AcpiDmDumpEinj (
1070 ACPI_TABLE_HEADER *Table)
1072 ACPI_STATUS Status;
1073 ACPI_WHEA_HEADER *SubTable;
1074 UINT32 Length = Table->Length;
1075 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
1078 /* Main table */
1080 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
1081 if (ACPI_FAILURE (Status))
1083 return;
1086 /* Subtables */
1088 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1089 while (Offset < Table->Length)
1091 AcpiOsPrintf ("\n");
1092 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1093 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1094 if (ACPI_FAILURE (Status))
1096 return;
1099 /* Point to next subtable (each subtable is of fixed length) */
1101 Offset += sizeof (ACPI_WHEA_HEADER);
1102 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1103 sizeof (ACPI_WHEA_HEADER));
1108 /*******************************************************************************
1110 * FUNCTION: AcpiDmDumpErst
1112 * PARAMETERS: Table - A ERST table
1114 * RETURN: None
1116 * DESCRIPTION: Format the contents of a ERST. This table type consists
1117 * of an open-ended number of subtables.
1119 ******************************************************************************/
1121 void
1122 AcpiDmDumpErst (
1123 ACPI_TABLE_HEADER *Table)
1125 ACPI_STATUS Status;
1126 ACPI_WHEA_HEADER *SubTable;
1127 UINT32 Length = Table->Length;
1128 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
1131 /* Main table */
1133 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1134 if (ACPI_FAILURE (Status))
1136 return;
1139 /* Subtables */
1141 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1142 while (Offset < Table->Length)
1144 AcpiOsPrintf ("\n");
1145 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1146 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1147 if (ACPI_FAILURE (Status))
1149 return;
1152 /* Point to next subtable (each subtable is of fixed length) */
1154 Offset += sizeof (ACPI_WHEA_HEADER);
1155 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1156 sizeof (ACPI_WHEA_HEADER));
1161 /*******************************************************************************
1163 * FUNCTION: AcpiDmDumpFpdt
1165 * PARAMETERS: Table - A FPDT table
1167 * RETURN: None
1169 * DESCRIPTION: Format the contents of a FPDT. This table type consists
1170 * of an open-ended number of subtables.
1172 ******************************************************************************/
1174 void
1175 AcpiDmDumpFpdt (
1176 ACPI_TABLE_HEADER *Table)
1178 ACPI_STATUS Status;
1179 ACPI_FPDT_HEADER *SubTable;
1180 UINT32 Length = Table->Length;
1181 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
1182 ACPI_DMTABLE_INFO *InfoTable;
1185 /* There is no main table (other than the standard ACPI header) */
1187 /* Subtables */
1189 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1190 while (Offset < Table->Length)
1192 /* Common subtable header */
1194 AcpiOsPrintf ("\n");
1195 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1196 SubTable->Length, AcpiDmTableInfoFpdtHdr);
1197 if (ACPI_FAILURE (Status))
1199 return;
1202 switch (SubTable->Type)
1204 case ACPI_FPDT_TYPE_BOOT:
1206 InfoTable = AcpiDmTableInfoFpdt0;
1207 break;
1209 case ACPI_FPDT_TYPE_S3PERF:
1211 InfoTable = AcpiDmTableInfoFpdt1;
1212 break;
1214 default:
1216 AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", SubTable->Type);
1218 /* Attempt to continue */
1220 if (!SubTable->Length)
1222 AcpiOsPrintf ("Invalid zero length subtable\n");
1223 return;
1225 goto NextSubTable;
1228 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1229 SubTable->Length, InfoTable);
1230 if (ACPI_FAILURE (Status))
1232 return;
1235 NextSubTable:
1236 /* Point to next subtable */
1238 Offset += SubTable->Length;
1239 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
1244 /*******************************************************************************
1246 * FUNCTION: AcpiDmDumpGtdt
1248 * PARAMETERS: Table - A GTDT table
1250 * RETURN: None
1252 * DESCRIPTION: Format the contents of a GTDT. This table type consists
1253 * of an open-ended number of subtables.
1255 ******************************************************************************/
1257 void
1258 AcpiDmDumpGtdt (
1259 ACPI_TABLE_HEADER *Table)
1261 ACPI_STATUS Status;
1262 ACPI_GTDT_HEADER *SubTable;
1263 UINT32 Length = Table->Length;
1264 UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
1265 ACPI_DMTABLE_INFO *InfoTable;
1266 UINT32 SubTableLength;
1267 UINT32 GtCount;
1268 ACPI_GTDT_TIMER_ENTRY *GtxTable;
1271 /* Main table */
1273 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
1274 if (ACPI_FAILURE (Status))
1276 return;
1279 /* Subtables */
1281 SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1282 while (Offset < Table->Length)
1284 /* Common subtable header */
1286 AcpiOsPrintf ("\n");
1287 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1288 SubTable->Length, AcpiDmTableInfoGtdtHdr);
1289 if (ACPI_FAILURE (Status))
1291 return;
1294 GtCount = 0;
1295 switch (SubTable->Type)
1297 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1299 SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
1300 GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1301 SubTable))->TimerCount;
1303 InfoTable = AcpiDmTableInfoGtdt0;
1304 break;
1306 case ACPI_GTDT_TYPE_WATCHDOG:
1308 SubTableLength = sizeof (ACPI_GTDT_WATCHDOG);
1310 InfoTable = AcpiDmTableInfoGtdt1;
1311 break;
1313 default:
1315 /* Cannot continue on unknown type - no length */
1317 AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", SubTable->Type);
1318 return;
1321 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1322 SubTable->Length, InfoTable);
1323 if (ACPI_FAILURE (Status))
1325 return;
1328 /* Point to end of current subtable (each subtable above is of fixed length) */
1330 Offset += SubTableLength;
1332 /* If there are any Gt Timer Blocks from above, dump them now */
1334 if (GtCount)
1336 GtxTable = ACPI_ADD_PTR (ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
1337 SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
1339 while (GtCount)
1341 AcpiOsPrintf ("\n");
1342 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
1343 sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
1344 if (ACPI_FAILURE (Status))
1346 return;
1348 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
1349 GtxTable++;
1350 GtCount--;
1354 /* Point to next subtable */
1356 SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength);
1361 /*******************************************************************************
1363 * FUNCTION: AcpiDmDumpHest
1365 * PARAMETERS: Table - A HEST table
1367 * RETURN: None
1369 * DESCRIPTION: Format the contents of a HEST. This table type consists
1370 * of an open-ended number of subtables.
1372 ******************************************************************************/
1374 void
1375 AcpiDmDumpHest (
1376 ACPI_TABLE_HEADER *Table)
1378 ACPI_STATUS Status;
1379 ACPI_HEST_HEADER *SubTable;
1380 UINT32 Length = Table->Length;
1381 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
1382 ACPI_DMTABLE_INFO *InfoTable;
1383 UINT32 SubTableLength;
1384 UINT32 BankCount;
1385 ACPI_HEST_IA_ERROR_BANK *BankTable;
1388 /* Main table */
1390 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1391 if (ACPI_FAILURE (Status))
1393 return;
1396 /* Subtables */
1398 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1399 while (Offset < Table->Length)
1401 BankCount = 0;
1402 switch (SubTable->Type)
1404 case ACPI_HEST_TYPE_IA32_CHECK:
1406 InfoTable = AcpiDmTableInfoHest0;
1407 SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1408 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1409 SubTable))->NumHardwareBanks;
1410 break;
1412 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1414 InfoTable = AcpiDmTableInfoHest1;
1415 SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1416 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1417 SubTable))->NumHardwareBanks;
1418 break;
1420 case ACPI_HEST_TYPE_IA32_NMI:
1422 InfoTable = AcpiDmTableInfoHest2;
1423 SubTableLength = sizeof (ACPI_HEST_IA_NMI);
1424 break;
1426 case ACPI_HEST_TYPE_AER_ROOT_PORT:
1428 InfoTable = AcpiDmTableInfoHest6;
1429 SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
1430 break;
1432 case ACPI_HEST_TYPE_AER_ENDPOINT:
1434 InfoTable = AcpiDmTableInfoHest7;
1435 SubTableLength = sizeof (ACPI_HEST_AER);
1436 break;
1438 case ACPI_HEST_TYPE_AER_BRIDGE:
1440 InfoTable = AcpiDmTableInfoHest8;
1441 SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1442 break;
1444 case ACPI_HEST_TYPE_GENERIC_ERROR:
1446 InfoTable = AcpiDmTableInfoHest9;
1447 SubTableLength = sizeof (ACPI_HEST_GENERIC);
1448 break;
1450 default:
1452 /* Cannot continue on unknown type - no length */
1454 AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", SubTable->Type);
1455 return;
1458 AcpiOsPrintf ("\n");
1459 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1460 SubTableLength, InfoTable);
1461 if (ACPI_FAILURE (Status))
1463 return;
1466 /* Point to end of current subtable (each subtable above is of fixed length) */
1468 Offset += SubTableLength;
1470 /* If there are any (fixed-length) Error Banks from above, dump them now */
1472 if (BankCount)
1474 BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
1475 SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1477 while (BankCount)
1479 AcpiOsPrintf ("\n");
1480 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1481 sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1482 if (ACPI_FAILURE (Status))
1484 return;
1486 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1487 BankTable++;
1488 BankCount--;
1492 /* Point to next subtable */
1494 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
1499 /*******************************************************************************
1501 * FUNCTION: AcpiDmDumpIvrs
1503 * PARAMETERS: Table - A IVRS table
1505 * RETURN: None
1507 * DESCRIPTION: Format the contents of a IVRS
1509 ******************************************************************************/
1511 static UINT8 EntrySizes[] = {4,8,16,32};
1513 void
1514 AcpiDmDumpIvrs (
1515 ACPI_TABLE_HEADER *Table)
1517 ACPI_STATUS Status;
1518 UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
1519 UINT32 EntryOffset;
1520 UINT32 EntryLength;
1521 UINT32 EntryType;
1522 ACPI_IVRS_DE_HEADER *DeviceEntry;
1523 ACPI_IVRS_HEADER *SubTable;
1524 ACPI_DMTABLE_INFO *InfoTable;
1527 /* Main table */
1529 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
1530 if (ACPI_FAILURE (Status))
1532 return;
1535 /* Subtables */
1537 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
1538 while (Offset < Table->Length)
1540 /* Common subtable header */
1542 AcpiOsPrintf ("\n");
1543 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1544 SubTable->Length, AcpiDmTableInfoIvrsHdr);
1545 if (ACPI_FAILURE (Status))
1547 return;
1550 switch (SubTable->Type)
1552 case ACPI_IVRS_TYPE_HARDWARE:
1554 InfoTable = AcpiDmTableInfoIvrs0;
1555 break;
1557 case ACPI_IVRS_TYPE_MEMORY1:
1558 case ACPI_IVRS_TYPE_MEMORY2:
1559 case ACPI_IVRS_TYPE_MEMORY3:
1561 InfoTable = AcpiDmTableInfoIvrs1;
1562 break;
1564 default:
1566 AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
1567 SubTable->Type);
1569 /* Attempt to continue */
1571 if (!SubTable->Length)
1573 AcpiOsPrintf ("Invalid zero length subtable\n");
1574 return;
1576 goto NextSubTable;
1579 /* Dump the subtable */
1581 AcpiOsPrintf ("\n");
1582 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1583 SubTable->Length, InfoTable);
1584 if (ACPI_FAILURE (Status))
1586 return;
1589 /* The hardware subtable can contain multiple device entries */
1591 if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
1593 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
1594 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
1595 sizeof (ACPI_IVRS_HARDWARE));
1597 while (EntryOffset < (Offset + SubTable->Length))
1599 AcpiOsPrintf ("\n");
1601 * Upper 2 bits of Type encode the length of the device entry
1603 * 00 = 4 byte
1604 * 01 = 8 byte
1605 * 10 = 16 byte - currently no entries defined
1606 * 11 = 32 byte - currently no entries defined
1608 EntryType = DeviceEntry->Type;
1609 EntryLength = EntrySizes [EntryType >> 6];
1611 switch (EntryType)
1613 /* 4-byte device entries */
1615 case ACPI_IVRS_TYPE_PAD4:
1616 case ACPI_IVRS_TYPE_ALL:
1617 case ACPI_IVRS_TYPE_SELECT:
1618 case ACPI_IVRS_TYPE_START:
1619 case ACPI_IVRS_TYPE_END:
1621 InfoTable = AcpiDmTableInfoIvrs4;
1622 break;
1624 /* 8-byte entries, type A */
1626 case ACPI_IVRS_TYPE_ALIAS_SELECT:
1627 case ACPI_IVRS_TYPE_ALIAS_START:
1629 InfoTable = AcpiDmTableInfoIvrs8a;
1630 break;
1632 /* 8-byte entries, type B */
1634 case ACPI_IVRS_TYPE_PAD8:
1635 case ACPI_IVRS_TYPE_EXT_SELECT:
1636 case ACPI_IVRS_TYPE_EXT_START:
1638 InfoTable = AcpiDmTableInfoIvrs8b;
1639 break;
1641 /* 8-byte entries, type C */
1643 case ACPI_IVRS_TYPE_SPECIAL:
1645 InfoTable = AcpiDmTableInfoIvrs8c;
1646 break;
1648 default:
1649 InfoTable = AcpiDmTableInfoIvrs4;
1650 AcpiOsPrintf (
1651 "\n**** Unknown IVRS device entry type/length: "
1652 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
1653 EntryType, EntryLength, EntryOffset);
1654 break;
1657 /* Dump the Device Entry */
1659 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
1660 DeviceEntry, EntryLength, InfoTable);
1662 EntryOffset += EntryLength;
1663 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
1664 EntryLength);
1668 NextSubTable:
1669 /* Point to next subtable */
1671 Offset += SubTable->Length;
1672 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
1677 /*******************************************************************************
1679 * FUNCTION: AcpiDmDumpLpit
1681 * PARAMETERS: Table - A LPIT table
1683 * RETURN: None
1685 * DESCRIPTION: Format the contents of a LPIT. This table type consists
1686 * of an open-ended number of subtables. Note: There are no
1687 * entries in the main table. An LPIT consists of the table
1688 * header and then subtables only.
1690 ******************************************************************************/
1692 void
1693 AcpiDmDumpLpit (
1694 ACPI_TABLE_HEADER *Table)
1696 ACPI_STATUS Status;
1697 ACPI_LPIT_HEADER *SubTable;
1698 UINT32 Length = Table->Length;
1699 UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
1700 ACPI_DMTABLE_INFO *InfoTable;
1701 UINT32 SubTableLength;
1704 /* Subtables */
1706 SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
1707 while (Offset < Table->Length)
1709 /* Common subtable header */
1711 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1712 sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
1713 if (ACPI_FAILURE (Status))
1715 return;
1718 switch (SubTable->Type)
1720 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
1722 InfoTable = AcpiDmTableInfoLpit0;
1723 SubTableLength = sizeof (ACPI_LPIT_NATIVE);
1724 break;
1726 case ACPI_LPIT_TYPE_SIMPLE_IO:
1728 InfoTable = AcpiDmTableInfoLpit1;
1729 SubTableLength = sizeof (ACPI_LPIT_IO);
1730 break;
1732 default:
1734 /* Cannot continue on unknown type - no length */
1736 AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", SubTable->Type);
1737 return;
1740 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1741 SubTableLength, InfoTable);
1742 if (ACPI_FAILURE (Status))
1744 return;
1746 AcpiOsPrintf ("\n");
1748 /* Point to next subtable */
1750 Offset += SubTableLength;
1751 SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength);
1756 /*******************************************************************************
1758 * FUNCTION: AcpiDmDumpMadt
1760 * PARAMETERS: Table - A MADT table
1762 * RETURN: None
1764 * DESCRIPTION: Format the contents of a MADT. This table type consists
1765 * of an open-ended number of subtables.
1767 ******************************************************************************/
1769 void
1770 AcpiDmDumpMadt (
1771 ACPI_TABLE_HEADER *Table)
1773 ACPI_STATUS Status;
1774 ACPI_SUBTABLE_HEADER *SubTable;
1775 UINT32 Length = Table->Length;
1776 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
1777 ACPI_DMTABLE_INFO *InfoTable;
1780 /* Main table */
1782 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
1783 if (ACPI_FAILURE (Status))
1785 return;
1788 /* Subtables */
1790 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1791 while (Offset < Table->Length)
1793 /* Common subtable header */
1795 AcpiOsPrintf ("\n");
1796 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1797 SubTable->Length, AcpiDmTableInfoMadtHdr);
1798 if (ACPI_FAILURE (Status))
1800 return;
1803 switch (SubTable->Type)
1805 case ACPI_MADT_TYPE_LOCAL_APIC:
1807 InfoTable = AcpiDmTableInfoMadt0;
1808 break;
1810 case ACPI_MADT_TYPE_IO_APIC:
1812 InfoTable = AcpiDmTableInfoMadt1;
1813 break;
1815 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
1817 InfoTable = AcpiDmTableInfoMadt2;
1818 break;
1820 case ACPI_MADT_TYPE_NMI_SOURCE:
1822 InfoTable = AcpiDmTableInfoMadt3;
1823 break;
1825 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
1827 InfoTable = AcpiDmTableInfoMadt4;
1828 break;
1830 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
1832 InfoTable = AcpiDmTableInfoMadt5;
1833 break;
1835 case ACPI_MADT_TYPE_IO_SAPIC:
1837 InfoTable = AcpiDmTableInfoMadt6;
1838 break;
1840 case ACPI_MADT_TYPE_LOCAL_SAPIC:
1842 InfoTable = AcpiDmTableInfoMadt7;
1843 break;
1845 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
1847 InfoTable = AcpiDmTableInfoMadt8;
1848 break;
1850 case ACPI_MADT_TYPE_LOCAL_X2APIC:
1852 InfoTable = AcpiDmTableInfoMadt9;
1853 break;
1855 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
1857 InfoTable = AcpiDmTableInfoMadt10;
1858 break;
1860 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
1862 InfoTable = AcpiDmTableInfoMadt11;
1863 break;
1865 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
1867 InfoTable = AcpiDmTableInfoMadt12;
1868 break;
1870 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
1872 InfoTable = AcpiDmTableInfoMadt13;
1873 break;
1875 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
1877 InfoTable = AcpiDmTableInfoMadt14;
1878 break;
1880 default:
1882 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type);
1884 /* Attempt to continue */
1886 if (!SubTable->Length)
1888 AcpiOsPrintf ("Invalid zero length subtable\n");
1889 return;
1891 goto NextSubTable;
1894 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1895 SubTable->Length, InfoTable);
1896 if (ACPI_FAILURE (Status))
1898 return;
1901 NextSubTable:
1902 /* Point to next subtable */
1904 Offset += SubTable->Length;
1905 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1910 /*******************************************************************************
1912 * FUNCTION: AcpiDmDumpMcfg
1914 * PARAMETERS: Table - A MCFG Table
1916 * RETURN: None
1918 * DESCRIPTION: Format the contents of a MCFG table
1920 ******************************************************************************/
1922 void
1923 AcpiDmDumpMcfg (
1924 ACPI_TABLE_HEADER *Table)
1926 ACPI_STATUS Status;
1927 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
1928 ACPI_MCFG_ALLOCATION *SubTable;
1931 /* Main table */
1933 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1934 if (ACPI_FAILURE (Status))
1936 return;
1939 /* Subtables */
1941 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1942 while (Offset < Table->Length)
1944 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1946 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1947 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1948 return;
1951 AcpiOsPrintf ("\n");
1952 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1953 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1954 if (ACPI_FAILURE (Status))
1956 return;
1959 /* Point to next subtable (each subtable is of fixed length) */
1961 Offset += sizeof (ACPI_MCFG_ALLOCATION);
1962 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
1963 sizeof (ACPI_MCFG_ALLOCATION));
1968 /*******************************************************************************
1970 * FUNCTION: AcpiDmDumpMpst
1972 * PARAMETERS: Table - A MPST Table
1974 * RETURN: None
1976 * DESCRIPTION: Format the contents of a MPST table
1978 ******************************************************************************/
1980 void
1981 AcpiDmDumpMpst (
1982 ACPI_TABLE_HEADER *Table)
1984 ACPI_STATUS Status;
1985 UINT32 Offset = sizeof (ACPI_TABLE_MPST);
1986 ACPI_MPST_POWER_NODE *SubTable0;
1987 ACPI_MPST_POWER_STATE *SubTable0A;
1988 ACPI_MPST_COMPONENT *SubTable0B;
1989 ACPI_MPST_DATA_HDR *SubTable1;
1990 ACPI_MPST_POWER_DATA *SubTable2;
1991 UINT16 SubtableCount;
1992 UINT32 PowerStateCount;
1993 UINT32 ComponentCount;
1996 /* Main table */
1998 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1999 if (ACPI_FAILURE (Status))
2001 return;
2004 /* Subtable: Memory Power Node(s) */
2006 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
2007 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
2009 while ((Offset < Table->Length) && SubtableCount)
2011 AcpiOsPrintf ("\n");
2012 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
2013 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
2014 if (ACPI_FAILURE (Status))
2016 return;
2019 /* Extract the sub-subtable counts */
2021 PowerStateCount = SubTable0->NumPowerStates;
2022 ComponentCount = SubTable0->NumPhysicalComponents;
2023 Offset += sizeof (ACPI_MPST_POWER_NODE);
2025 /* Sub-subtables - Memory Power State Structure(s) */
2027 SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
2028 sizeof (ACPI_MPST_POWER_NODE));
2030 while (PowerStateCount)
2032 AcpiOsPrintf ("\n");
2033 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
2034 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
2035 if (ACPI_FAILURE (Status))
2037 return;
2040 SubTable0A++;
2041 PowerStateCount--;
2042 Offset += sizeof (ACPI_MPST_POWER_STATE);
2045 /* Sub-subtables - Physical Component ID Structure(s) */
2047 SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
2049 if (ComponentCount)
2051 AcpiOsPrintf ("\n");
2054 while (ComponentCount)
2056 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
2057 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
2058 if (ACPI_FAILURE (Status))
2060 return;
2063 SubTable0B++;
2064 ComponentCount--;
2065 Offset += sizeof (ACPI_MPST_COMPONENT);
2068 /* Point to next Memory Power Node subtable */
2070 SubtableCount--;
2071 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
2072 sizeof (ACPI_MPST_POWER_NODE) +
2073 (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
2074 (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
2077 /* Subtable: Count of Memory Power State Characteristic structures */
2079 AcpiOsPrintf ("\n");
2080 SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
2081 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
2082 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
2083 if (ACPI_FAILURE (Status))
2085 return;
2088 SubtableCount = SubTable1->CharacteristicsCount;
2089 Offset += sizeof (ACPI_MPST_DATA_HDR);
2091 /* Subtable: Memory Power State Characteristics structure(s) */
2093 SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR));
2095 while ((Offset < Table->Length) && SubtableCount)
2097 AcpiOsPrintf ("\n");
2098 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
2099 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
2100 if (ACPI_FAILURE (Status))
2102 return;
2105 SubTable2++;
2106 SubtableCount--;
2107 Offset += sizeof (ACPI_MPST_POWER_DATA);
2112 /*******************************************************************************
2114 * FUNCTION: AcpiDmDumpMsct
2116 * PARAMETERS: Table - A MSCT table
2118 * RETURN: None
2120 * DESCRIPTION: Format the contents of a MSCT
2122 ******************************************************************************/
2124 void
2125 AcpiDmDumpMsct (
2126 ACPI_TABLE_HEADER *Table)
2128 ACPI_STATUS Status;
2129 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
2130 ACPI_MSCT_PROXIMITY *SubTable;
2133 /* Main table */
2135 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
2136 if (ACPI_FAILURE (Status))
2138 return;
2141 /* Subtables */
2143 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
2144 while (Offset < Table->Length)
2146 /* Common subtable header */
2148 AcpiOsPrintf ("\n");
2149 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2150 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
2151 if (ACPI_FAILURE (Status))
2153 return;
2156 /* Point to next subtable */
2158 Offset += sizeof (ACPI_MSCT_PROXIMITY);
2159 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
2164 /*******************************************************************************
2166 * FUNCTION: AcpiDmDumpMtmr
2168 * PARAMETERS: Table - A MTMR table
2170 * RETURN: None
2172 * DESCRIPTION: Format the contents of a MTMR
2174 ******************************************************************************/
2176 void
2177 AcpiDmDumpMtmr (
2178 ACPI_TABLE_HEADER *Table)
2180 ACPI_STATUS Status;
2181 UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
2182 ACPI_MTMR_ENTRY *SubTable;
2185 /* Main table */
2187 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
2188 if (ACPI_FAILURE (Status))
2190 return;
2193 /* Subtables */
2195 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
2196 while (Offset < Table->Length)
2198 /* Common subtable header */
2200 AcpiOsPrintf ("\n");
2201 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2202 sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
2203 if (ACPI_FAILURE (Status))
2205 return;
2208 /* Point to next subtable */
2210 Offset += sizeof (ACPI_MTMR_ENTRY);
2211 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
2216 /*******************************************************************************
2218 * FUNCTION: AcpiDmDumpPcct
2220 * PARAMETERS: Table - A PCCT table
2222 * RETURN: None
2224 * DESCRIPTION: Format the contents of a PCCT. This table type consists
2225 * of an open-ended number of subtables.
2227 ******************************************************************************/
2229 void
2230 AcpiDmDumpPcct (
2231 ACPI_TABLE_HEADER *Table)
2233 ACPI_STATUS Status;
2234 ACPI_PCCT_SUBSPACE *SubTable;
2235 ACPI_DMTABLE_INFO *InfoTable;
2236 UINT32 Length = Table->Length;
2237 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
2240 /* Main table */
2242 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
2243 if (ACPI_FAILURE (Status))
2245 return;
2248 /* Subtables */
2250 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
2251 while (Offset < Table->Length)
2253 /* Common subtable header */
2255 AcpiOsPrintf ("\n");
2256 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2257 SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
2258 if (ACPI_FAILURE (Status))
2260 return;
2263 switch (SubTable->Header.Type)
2265 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
2267 InfoTable = AcpiDmTableInfoPcct0;
2268 break;
2270 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
2272 InfoTable = AcpiDmTableInfoPcct1;
2273 break;
2275 default:
2277 AcpiOsPrintf (
2278 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2279 SubTable->Header.Type);
2280 return;
2283 AcpiOsPrintf ("\n");
2284 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2285 SubTable->Header.Length, InfoTable);
2286 if (ACPI_FAILURE (Status))
2288 return;
2291 /* Point to next subtable */
2293 Offset += SubTable->Header.Length;
2294 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
2295 SubTable->Header.Length);
2300 /*******************************************************************************
2302 * FUNCTION: AcpiDmDumpPmtt
2304 * PARAMETERS: Table - A PMTT table
2306 * RETURN: None
2308 * DESCRIPTION: Format the contents of a PMTT. This table type consists
2309 * of an open-ended number of subtables.
2311 ******************************************************************************/
2313 void
2314 AcpiDmDumpPmtt (
2315 ACPI_TABLE_HEADER *Table)
2317 ACPI_STATUS Status;
2318 ACPI_PMTT_HEADER *SubTable;
2319 ACPI_PMTT_HEADER *MemSubTable;
2320 ACPI_PMTT_HEADER *DimmSubTable;
2321 ACPI_PMTT_DOMAIN *DomainArray;
2322 UINT32 Length = Table->Length;
2323 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
2324 UINT32 MemOffset;
2325 UINT32 DimmOffset;
2326 UINT32 DomainOffset;
2327 UINT32 DomainCount;
2330 /* Main table */
2332 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2333 if (ACPI_FAILURE (Status))
2335 return;
2338 /* Subtables */
2340 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2341 while (Offset < Table->Length)
2343 /* Common subtable header */
2345 AcpiOsPrintf ("\n");
2346 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2347 SubTable->Length, AcpiDmTableInfoPmttHdr);
2348 if (ACPI_FAILURE (Status))
2350 return;
2353 /* Only Socket subtables are expected at this level */
2355 if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
2357 AcpiOsPrintf (
2358 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2359 SubTable->Type);
2360 return;
2363 /* Dump the fixed-length portion of the subtable */
2365 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2366 SubTable->Length, AcpiDmTableInfoPmtt0);
2367 if (ACPI_FAILURE (Status))
2369 return;
2372 /* Walk the memory controller subtables */
2374 MemOffset = sizeof (ACPI_PMTT_SOCKET);
2375 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
2376 sizeof (ACPI_PMTT_SOCKET));
2378 while (((Offset + MemOffset) < Table->Length) &&
2379 (MemOffset < SubTable->Length))
2381 /* Common subtable header */
2383 AcpiOsPrintf ("\n");
2384 Status = AcpiDmDumpTable (Length,
2385 Offset + MemOffset, MemSubTable,
2386 MemSubTable->Length, AcpiDmTableInfoPmttHdr);
2387 if (ACPI_FAILURE (Status))
2389 return;
2392 /* Only memory controller subtables are expected at this level */
2394 if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
2396 AcpiOsPrintf (
2397 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2398 MemSubTable->Type);
2399 return;
2402 /* Dump the fixed-length portion of the controller subtable */
2404 Status = AcpiDmDumpTable (Length,
2405 Offset + MemOffset, MemSubTable,
2406 MemSubTable->Length, AcpiDmTableInfoPmtt1);
2407 if (ACPI_FAILURE (Status))
2409 return;
2412 /* Walk the variable count of proximity domains */
2414 DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
2415 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
2416 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
2417 sizeof (ACPI_PMTT_CONTROLLER));
2419 while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
2420 ((MemOffset + DomainOffset) < SubTable->Length) &&
2421 DomainCount)
2423 Status = AcpiDmDumpTable (Length,
2424 Offset + MemOffset + DomainOffset, DomainArray,
2425 sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
2426 if (ACPI_FAILURE (Status))
2428 return;
2431 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
2432 DomainArray++;
2433 DomainCount--;
2436 if (DomainCount)
2438 AcpiOsPrintf (
2439 "\n**** DomainCount exceeds subtable length\n\n");
2442 /* Walk the physical component (DIMM) subtables */
2444 DimmOffset = DomainOffset;
2445 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
2446 DomainOffset);
2448 while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
2449 (DimmOffset < MemSubTable->Length))
2451 /* Common subtable header */
2453 AcpiOsPrintf ("\n");
2454 Status = AcpiDmDumpTable (Length,
2455 Offset + MemOffset + DimmOffset, DimmSubTable,
2456 DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
2457 if (ACPI_FAILURE (Status))
2459 return;
2462 /* Only DIMM subtables are expected at this level */
2464 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
2466 AcpiOsPrintf (
2467 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2468 DimmSubTable->Type);
2469 return;
2472 /* Dump the fixed-length DIMM subtable */
2474 Status = AcpiDmDumpTable (Length,
2475 Offset + MemOffset + DimmOffset, DimmSubTable,
2476 DimmSubTable->Length, AcpiDmTableInfoPmtt2);
2477 if (ACPI_FAILURE (Status))
2479 return;
2482 /* Point to next DIMM subtable */
2484 DimmOffset += DimmSubTable->Length;
2485 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2486 DimmSubTable, DimmSubTable->Length);
2489 /* Point to next Controller subtable */
2491 MemOffset += MemSubTable->Length;
2492 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2493 MemSubTable, MemSubTable->Length);
2496 /* Point to next Socket subtable */
2498 Offset += SubTable->Length;
2499 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2500 SubTable, SubTable->Length);
2505 /*******************************************************************************
2507 * FUNCTION: AcpiDmDumpS3pt
2509 * PARAMETERS: Table - A S3PT table
2511 * RETURN: Length of the table
2513 * DESCRIPTION: Format the contents of a S3PT
2515 ******************************************************************************/
2517 UINT32
2518 AcpiDmDumpS3pt (
2519 ACPI_TABLE_HEADER *Tables)
2521 ACPI_STATUS Status;
2522 UINT32 Offset = sizeof (ACPI_TABLE_S3PT);
2523 ACPI_S3PT_HEADER *SubTable;
2524 ACPI_DMTABLE_INFO *InfoTable;
2525 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2528 /* Main table */
2530 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2531 if (ACPI_FAILURE (Status))
2533 return 0;
2536 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset);
2537 while (Offset < S3ptTable->Length)
2539 /* Common subtable header */
2541 AcpiOsPrintf ("\n");
2542 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
2543 SubTable->Length, AcpiDmTableInfoS3ptHdr);
2544 if (ACPI_FAILURE (Status))
2546 return 0;
2549 switch (SubTable->Type)
2551 case ACPI_S3PT_TYPE_RESUME:
2553 InfoTable = AcpiDmTableInfoS3pt0;
2554 break;
2556 case ACPI_S3PT_TYPE_SUSPEND:
2558 InfoTable = AcpiDmTableInfoS3pt1;
2559 break;
2561 default:
2563 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", SubTable->Type);
2565 /* Attempt to continue */
2567 if (!SubTable->Length)
2569 AcpiOsPrintf ("Invalid zero length subtable\n");
2570 return 0;
2572 goto NextSubTable;
2575 AcpiOsPrintf ("\n");
2576 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
2577 SubTable->Length, InfoTable);
2578 if (ACPI_FAILURE (Status))
2580 return 0;
2583 NextSubTable:
2584 /* Point to next subtable */
2586 Offset += SubTable->Length;
2587 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length);
2590 return (S3ptTable->Length);
2594 /*******************************************************************************
2596 * FUNCTION: AcpiDmDumpSlic
2598 * PARAMETERS: Table - A SLIC table
2600 * RETURN: None
2602 * DESCRIPTION: Format the contents of a SLIC
2604 ******************************************************************************/
2606 void
2607 AcpiDmDumpSlic (
2608 ACPI_TABLE_HEADER *Table)
2610 ACPI_STATUS Status;
2611 UINT32 Offset = sizeof (ACPI_TABLE_SLIC);
2612 ACPI_SLIC_HEADER *SubTable;
2613 ACPI_DMTABLE_INFO *InfoTable;
2616 /* There is no main SLIC table, only subtables */
2618 SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset);
2619 while (Offset < Table->Length)
2621 /* Common subtable header */
2623 AcpiOsPrintf ("\n");
2624 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2625 SubTable->Length, AcpiDmTableInfoSlicHdr);
2626 if (ACPI_FAILURE (Status))
2628 return;
2631 switch (SubTable->Type)
2633 case ACPI_SLIC_TYPE_PUBLIC_KEY:
2635 InfoTable = AcpiDmTableInfoSlic0;
2636 break;
2638 case ACPI_SLIC_TYPE_WINDOWS_MARKER:
2640 InfoTable = AcpiDmTableInfoSlic1;
2641 break;
2643 default:
2645 AcpiOsPrintf ("\n**** Unknown SLIC subtable type 0x%X\n", SubTable->Type);
2647 /* Attempt to continue */
2649 if (!SubTable->Length)
2651 AcpiOsPrintf ("Invalid zero length subtable\n");
2652 return;
2654 goto NextSubTable;
2657 AcpiOsPrintf ("\n");
2658 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2659 SubTable->Length, InfoTable);
2660 if (ACPI_FAILURE (Status))
2662 return;
2665 NextSubTable:
2666 /* Point to next subtable */
2668 Offset += SubTable->Length;
2669 SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length);
2674 /*******************************************************************************
2676 * FUNCTION: AcpiDmDumpSlit
2678 * PARAMETERS: Table - An SLIT
2680 * RETURN: None
2682 * DESCRIPTION: Format the contents of a SLIT
2684 ******************************************************************************/
2686 void
2687 AcpiDmDumpSlit (
2688 ACPI_TABLE_HEADER *Table)
2690 ACPI_STATUS Status;
2691 UINT32 Offset;
2692 UINT8 *Row;
2693 UINT32 Localities;
2694 UINT32 i;
2695 UINT32 j;
2698 /* Main table */
2700 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
2701 if (ACPI_FAILURE (Status))
2703 return;
2706 /* Display the Locality NxN Matrix */
2708 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
2709 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
2710 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
2712 for (i = 0; i < Localities; i++)
2714 /* Display one row of the matrix */
2716 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
2717 for (j = 0; j < Localities; j++)
2719 /* Check for beyond EOT */
2721 if (Offset >= Table->Length)
2723 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
2724 return;
2727 AcpiOsPrintf ("%2.2X", Row[j]);
2728 Offset++;
2730 /* Display up to 16 bytes per output row */
2732 if ((j+1) < Localities)
2734 AcpiOsPrintf (" ");
2736 if (j && (((j+1) % 16) == 0))
2738 AcpiOsPrintf ("\\\n"); /* With line continuation char */
2739 AcpiDmLineHeader (Offset, 0, NULL);
2744 /* Point to next row */
2746 AcpiOsPrintf ("\n");
2747 Row += Localities;
2752 /*******************************************************************************
2754 * FUNCTION: AcpiDmDumpSrat
2756 * PARAMETERS: Table - A SRAT table
2758 * RETURN: None
2760 * DESCRIPTION: Format the contents of a SRAT
2762 ******************************************************************************/
2764 void
2765 AcpiDmDumpSrat (
2766 ACPI_TABLE_HEADER *Table)
2768 ACPI_STATUS Status;
2769 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
2770 ACPI_SUBTABLE_HEADER *SubTable;
2771 ACPI_DMTABLE_INFO *InfoTable;
2774 /* Main table */
2776 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
2777 if (ACPI_FAILURE (Status))
2779 return;
2782 /* Subtables */
2784 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2785 while (Offset < Table->Length)
2787 /* Common subtable header */
2789 AcpiOsPrintf ("\n");
2790 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2791 SubTable->Length, AcpiDmTableInfoSratHdr);
2792 if (ACPI_FAILURE (Status))
2794 return;
2797 switch (SubTable->Type)
2799 case ACPI_SRAT_TYPE_CPU_AFFINITY:
2801 InfoTable = AcpiDmTableInfoSrat0;
2802 break;
2804 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
2806 InfoTable = AcpiDmTableInfoSrat1;
2807 break;
2809 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
2811 InfoTable = AcpiDmTableInfoSrat2;
2812 break;
2814 default:
2815 AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type);
2817 /* Attempt to continue */
2819 if (!SubTable->Length)
2821 AcpiOsPrintf ("Invalid zero length subtable\n");
2822 return;
2824 goto NextSubTable;
2827 AcpiOsPrintf ("\n");
2828 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2829 SubTable->Length, InfoTable);
2830 if (ACPI_FAILURE (Status))
2832 return;
2835 NextSubTable:
2836 /* Point to next subtable */
2838 Offset += SubTable->Length;
2839 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
2844 /*******************************************************************************
2846 * FUNCTION: AcpiDmDumpVrtc
2848 * PARAMETERS: Table - A VRTC table
2850 * RETURN: None
2852 * DESCRIPTION: Format the contents of a VRTC
2854 ******************************************************************************/
2856 void
2857 AcpiDmDumpVrtc (
2858 ACPI_TABLE_HEADER *Table)
2860 ACPI_STATUS Status;
2861 UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
2862 ACPI_VRTC_ENTRY *SubTable;
2865 /* Main table */
2867 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
2868 if (ACPI_FAILURE (Status))
2870 return;
2873 /* Subtables */
2875 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
2876 while (Offset < Table->Length)
2878 /* Common subtable header */
2880 AcpiOsPrintf ("\n");
2881 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2882 sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
2883 if (ACPI_FAILURE (Status))
2885 return;
2888 /* Point to next subtable */
2890 Offset += sizeof (ACPI_VRTC_ENTRY);
2891 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
2896 /*******************************************************************************
2898 * FUNCTION: AcpiDmDumpWdat
2900 * PARAMETERS: Table - A WDAT table
2902 * RETURN: None
2904 * DESCRIPTION: Format the contents of a WDAT
2906 ******************************************************************************/
2908 void
2909 AcpiDmDumpWdat (
2910 ACPI_TABLE_HEADER *Table)
2912 ACPI_STATUS Status;
2913 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
2914 ACPI_WDAT_ENTRY *SubTable;
2917 /* Main table */
2919 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
2920 if (ACPI_FAILURE (Status))
2922 return;
2925 /* Subtables */
2927 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
2928 while (Offset < Table->Length)
2930 /* Common subtable header */
2932 AcpiOsPrintf ("\n");
2933 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2934 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
2935 if (ACPI_FAILURE (Status))
2937 return;
2940 /* Point to next subtable */
2942 Offset += sizeof (ACPI_WDAT_ENTRY);
2943 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));