Sync ACPICA with Intel's version 20150717.
[dragonfly.git] / sys / contrib / dev / acpica / source / common / dmtbdump.c
blob7ec19bc960260a25e454389e947443b179193ef7
1 /******************************************************************************
3 * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acdisasm.h"
47 #include "actables.h"
49 /* This module used for application-level code only */
51 #define _COMPONENT ACPI_CA_DISASSEMBLER
52 ACPI_MODULE_NAME ("dmtbdump")
55 /* Local prototypes */
57 static void
58 AcpiDmValidateFadtLength (
59 UINT32 Revision,
60 UINT32 Length);
63 /*******************************************************************************
65 * FUNCTION: AcpiDmDumpBuffer
67 * PARAMETERS: Table - ACPI Table or subtable
68 * BufferOffset - Offset of buffer from Table above
69 * Length - Length of the buffer
70 * AbsoluteOffset - Offset of buffer in the main ACPI table
71 * Header - Name of the buffer field (printed on the
72 * first line only.)
74 * RETURN: None
76 * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
77 * disassembler output format.)
79 ******************************************************************************/
81 void
82 AcpiDmDumpBuffer (
83 void *Table,
84 UINT32 BufferOffset,
85 UINT32 Length,
86 UINT32 AbsoluteOffset,
87 char *Header)
89 UINT8 *Buffer;
90 UINT32 i;
93 if (!Length)
95 return;
98 Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
99 i = 0;
101 while (i < Length)
103 if (!(i % 16))
105 /* Insert a backslash - line continuation character */
107 if (Length > 16)
109 AcpiOsPrintf ("\\\n ");
113 AcpiOsPrintf ("%.02X ", *Buffer);
114 i++;
115 Buffer++;
116 AbsoluteOffset++;
119 AcpiOsPrintf ("\n");
123 /*******************************************************************************
125 * FUNCTION: AcpiDmDumpUnicode
127 * PARAMETERS: Table - ACPI Table or subtable
128 * BufferOffset - Offset of buffer from Table above
129 * ByteLength - Length of the buffer
131 * RETURN: None
133 * DESCRIPTION: Validate and dump the contents of a buffer that contains
134 * unicode data. The output is a standard ASCII string. If it
135 * appears that the data is not unicode, the buffer is dumped
136 * as hex characters.
138 ******************************************************************************/
140 void
141 AcpiDmDumpUnicode (
142 void *Table,
143 UINT32 BufferOffset,
144 UINT32 ByteLength)
146 UINT8 *Buffer;
147 UINT32 Length;
148 UINT32 i;
151 Buffer = ((UINT8 *) Table) + BufferOffset;
152 Length = ByteLength - 2; /* Last two bytes are the null terminator */
154 /* Ensure all low bytes are entirely printable ASCII */
156 for (i = 0; i < Length; i += 2)
158 if (!isprint (Buffer[i]))
160 goto DumpRawBuffer;
164 /* Ensure all high bytes are zero */
166 for (i = 1; i < Length; i += 2)
168 if (Buffer[i])
170 goto DumpRawBuffer;
174 /* Dump the buffer as a normal string */
176 AcpiOsPrintf ("\"");
177 for (i = 0; i < Length; i += 2)
179 AcpiOsPrintf ("%c", Buffer[i]);
181 AcpiOsPrintf ("\"\n");
182 return;
184 DumpRawBuffer:
185 AcpiDmDumpBuffer (Table, BufferOffset, ByteLength,
186 BufferOffset, NULL);
187 AcpiOsPrintf ("\n");
191 /*******************************************************************************
193 * FUNCTION: AcpiDmDumpRsdp
195 * PARAMETERS: Table - A RSDP
197 * RETURN: Length of the table (there is not always a length field,
198 * use revision or length if available (ACPI 2.0+))
200 * DESCRIPTION: Format the contents of a RSDP
202 ******************************************************************************/
204 UINT32
205 AcpiDmDumpRsdp (
206 ACPI_TABLE_HEADER *Table)
208 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
209 UINT32 Length = sizeof (ACPI_RSDP_COMMON);
210 UINT8 Checksum;
211 ACPI_STATUS Status;
214 /* Dump the common ACPI 1.0 portion */
216 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
217 if (ACPI_FAILURE (Status))
219 return (Length);
222 /* Validate the first checksum */
224 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
225 Rsdp->Checksum);
226 if (Checksum != Rsdp->Checksum)
228 AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
229 Checksum);
232 /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
234 if (Rsdp->Revision > 0)
236 Length = Rsdp->Length;
237 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
238 if (ACPI_FAILURE (Status))
240 return (Length);
243 /* Validate the extended checksum over entire RSDP */
245 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
246 Rsdp->ExtendedChecksum);
247 if (Checksum != Rsdp->ExtendedChecksum)
249 AcpiOsPrintf (
250 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
251 Checksum);
255 return (Length);
259 /*******************************************************************************
261 * FUNCTION: AcpiDmDumpRsdt
263 * PARAMETERS: Table - A RSDT
265 * RETURN: None
267 * DESCRIPTION: Format the contents of a RSDT
269 ******************************************************************************/
271 void
272 AcpiDmDumpRsdt (
273 ACPI_TABLE_HEADER *Table)
275 UINT32 *Array;
276 UINT32 Entries;
277 UINT32 Offset;
278 UINT32 i;
281 /* Point to start of table pointer array */
283 Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
284 Offset = sizeof (ACPI_TABLE_HEADER);
286 /* RSDT uses 32-bit pointers */
288 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
290 for (i = 0; i < Entries; i++)
292 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
293 AcpiOsPrintf ("%8.8X\n", Array[i]);
294 Offset += sizeof (UINT32);
299 /*******************************************************************************
301 * FUNCTION: AcpiDmDumpXsdt
303 * PARAMETERS: Table - A XSDT
305 * RETURN: None
307 * DESCRIPTION: Format the contents of a XSDT
309 ******************************************************************************/
311 void
312 AcpiDmDumpXsdt (
313 ACPI_TABLE_HEADER *Table)
315 UINT64 *Array;
316 UINT32 Entries;
317 UINT32 Offset;
318 UINT32 i;
321 /* Point to start of table pointer array */
323 Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
324 Offset = sizeof (ACPI_TABLE_HEADER);
326 /* XSDT uses 64-bit pointers */
328 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
330 for (i = 0; i < Entries; i++)
332 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
333 AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
334 Offset += sizeof (UINT64);
339 /*******************************************************************************
341 * FUNCTION: AcpiDmDumpFadt
343 * PARAMETERS: Table - A FADT
345 * RETURN: None
347 * DESCRIPTION: Format the contents of a FADT
349 * NOTE: We cannot depend on the FADT version to indicate the actual
350 * contents of the FADT because of BIOS bugs. The table length
351 * is the only reliable indicator.
353 ******************************************************************************/
355 void
356 AcpiDmDumpFadt (
357 ACPI_TABLE_HEADER *Table)
359 ACPI_STATUS Status;
362 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
364 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
365 if (ACPI_FAILURE (Status))
367 return;
370 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
372 if ((Table->Length > ACPI_FADT_V1_SIZE) &&
373 (Table->Length <= ACPI_FADT_V2_SIZE))
375 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
376 if (ACPI_FAILURE (Status))
378 return;
382 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
384 else if (Table->Length > ACPI_FADT_V2_SIZE)
386 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
387 if (ACPI_FAILURE (Status))
389 return;
392 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
394 if (Table->Length > ACPI_FADT_V3_SIZE)
396 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5);
397 if (ACPI_FAILURE (Status))
399 return;
403 /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
405 if (Table->Length > ACPI_FADT_V3_SIZE)
407 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6);
408 if (ACPI_FAILURE (Status))
410 return;
415 /* Validate various fields in the FADT, including length */
417 AcpiTbCreateLocalFadt (Table, Table->Length);
419 /* Validate FADT length against the revision */
421 AcpiDmValidateFadtLength (Table->Revision, Table->Length);
425 /*******************************************************************************
427 * FUNCTION: AcpiDmValidateFadtLength
429 * PARAMETERS: Revision - FADT revision (Header->Revision)
430 * Length - FADT length (Header->Length
432 * RETURN: None
434 * DESCRIPTION: Check the FADT revision against the expected table length for
435 * that revision. Issue a warning if the length is not what was
436 * expected. This seems to be such a common BIOS bug that the
437 * FADT revision has been rendered virtually meaningless.
439 ******************************************************************************/
441 static void
442 AcpiDmValidateFadtLength (
443 UINT32 Revision,
444 UINT32 Length)
446 UINT32 ExpectedLength;
449 switch (Revision)
451 case 0:
453 AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
454 return;
456 case 1:
458 ExpectedLength = ACPI_FADT_V1_SIZE;
459 break;
461 case 2:
463 ExpectedLength = ACPI_FADT_V2_SIZE;
464 break;
466 case 3:
467 case 4:
469 ExpectedLength = ACPI_FADT_V3_SIZE;
470 break;
472 case 5:
474 ExpectedLength = ACPI_FADT_V5_SIZE;
475 break;
477 default:
479 return;
482 if (Length == ExpectedLength)
484 return;
487 AcpiOsPrintf (
488 "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n",
489 Revision, Length, ExpectedLength);
493 /*******************************************************************************
495 * FUNCTION: AcpiDmDumpAsf
497 * PARAMETERS: Table - A ASF table
499 * RETURN: None
501 * DESCRIPTION: Format the contents of a ASF table
503 ******************************************************************************/
505 void
506 AcpiDmDumpAsf (
507 ACPI_TABLE_HEADER *Table)
509 ACPI_STATUS Status;
510 UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
511 ACPI_ASF_INFO *SubTable;
512 ACPI_DMTABLE_INFO *InfoTable;
513 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
514 UINT8 *DataTable = NULL;
515 UINT32 DataCount = 0;
516 UINT32 DataLength = 0;
517 UINT32 DataOffset = 0;
518 UINT32 i;
519 UINT8 Type;
522 /* No main table, only subtables */
524 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
525 while (Offset < Table->Length)
527 /* Common subtable header */
529 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
530 SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
531 if (ACPI_FAILURE (Status))
533 return;
536 /* The actual type is the lower 7 bits of Type */
538 Type = (UINT8) (SubTable->Header.Type & 0x7F);
540 switch (Type)
542 case ACPI_ASF_TYPE_INFO:
544 InfoTable = AcpiDmTableInfoAsf0;
545 break;
547 case ACPI_ASF_TYPE_ALERT:
549 InfoTable = AcpiDmTableInfoAsf1;
550 DataInfoTable = AcpiDmTableInfoAsf1a;
551 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
552 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
553 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
554 DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
555 break;
557 case ACPI_ASF_TYPE_CONTROL:
559 InfoTable = AcpiDmTableInfoAsf2;
560 DataInfoTable = AcpiDmTableInfoAsf2a;
561 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
562 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
563 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
564 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
565 break;
567 case ACPI_ASF_TYPE_BOOT:
569 InfoTable = AcpiDmTableInfoAsf3;
570 break;
572 case ACPI_ASF_TYPE_ADDRESS:
574 InfoTable = AcpiDmTableInfoAsf4;
575 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
576 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
577 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
578 break;
580 default:
582 AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", SubTable->Header.Type);
583 return;
586 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
587 SubTable->Header.Length, InfoTable);
588 if (ACPI_FAILURE (Status))
590 return;
593 /* Dump variable-length extra data */
595 switch (Type)
597 case ACPI_ASF_TYPE_ALERT:
598 case ACPI_ASF_TYPE_CONTROL:
600 for (i = 0; i < DataCount; i++)
602 AcpiOsPrintf ("\n");
603 Status = AcpiDmDumpTable (Table->Length, DataOffset,
604 DataTable, DataLength, DataInfoTable);
605 if (ACPI_FAILURE (Status))
607 return;
610 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
611 DataOffset += DataLength;
613 break;
615 case ACPI_ASF_TYPE_ADDRESS:
617 for (i = 0; i < DataLength; i++)
619 if (!(i % 16))
621 AcpiDmLineHeader (DataOffset, 1, "Addresses");
624 AcpiOsPrintf ("%2.2X ", *DataTable);
625 DataTable++;
626 DataOffset++;
627 if (DataOffset > Table->Length)
629 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure! (ASF! table)\n");
630 return;
634 AcpiOsPrintf ("\n");
635 break;
637 default:
639 break;
642 AcpiOsPrintf ("\n");
644 /* Point to next subtable */
646 if (!SubTable->Header.Length)
648 AcpiOsPrintf ("Invalid zero subtable header length\n");
649 return;
652 Offset += SubTable->Header.Length;
653 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
658 /*******************************************************************************
660 * FUNCTION: AcpiDmDumpCpep
662 * PARAMETERS: Table - A CPEP table
664 * RETURN: None
666 * DESCRIPTION: Format the contents of a CPEP. This table type consists
667 * of an open-ended number of subtables.
669 ******************************************************************************/
671 void
672 AcpiDmDumpCpep (
673 ACPI_TABLE_HEADER *Table)
675 ACPI_STATUS Status;
676 ACPI_CPEP_POLLING *SubTable;
677 UINT32 Length = Table->Length;
678 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
681 /* Main table */
683 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
684 if (ACPI_FAILURE (Status))
686 return;
689 /* Subtables */
691 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
692 while (Offset < Table->Length)
694 AcpiOsPrintf ("\n");
695 Status = AcpiDmDumpTable (Length, Offset, SubTable,
696 SubTable->Header.Length, AcpiDmTableInfoCpep0);
697 if (ACPI_FAILURE (Status))
699 return;
702 /* Point to next subtable */
704 Offset += SubTable->Header.Length;
705 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
706 SubTable->Header.Length);
711 /*******************************************************************************
713 * FUNCTION: AcpiDmDumpCsrt
715 * PARAMETERS: Table - A CSRT table
717 * RETURN: None
719 * DESCRIPTION: Format the contents of a CSRT. This table type consists
720 * of an open-ended number of subtables.
722 ******************************************************************************/
724 void
725 AcpiDmDumpCsrt (
726 ACPI_TABLE_HEADER *Table)
728 ACPI_STATUS Status;
729 ACPI_CSRT_GROUP *SubTable;
730 ACPI_CSRT_SHARED_INFO *SharedInfoTable;
731 ACPI_CSRT_DESCRIPTOR *SubSubTable;
732 UINT32 Length = Table->Length;
733 UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
734 UINT32 SubOffset;
735 UINT32 SubSubOffset;
736 UINT32 InfoLength;
739 /* The main table only contains the ACPI header, thus already handled */
741 /* Subtables (Resource Groups) */
743 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
744 while (Offset < Table->Length)
746 /* Resource group subtable */
748 AcpiOsPrintf ("\n");
749 Status = AcpiDmDumpTable (Length, Offset, SubTable,
750 SubTable->Length, AcpiDmTableInfoCsrt0);
751 if (ACPI_FAILURE (Status))
753 return;
756 /* Shared info subtable (One per resource group) */
758 SubOffset = sizeof (ACPI_CSRT_GROUP);
759 SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
760 Offset + SubOffset);
762 AcpiOsPrintf ("\n");
763 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
764 sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
765 if (ACPI_FAILURE (Status))
767 return;
770 SubOffset += SubTable->SharedInfoLength;
772 /* Sub-Subtables (Resource Descriptors) */
774 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
775 Offset + SubOffset);
777 while ((SubOffset < SubTable->Length) &&
778 ((Offset + SubOffset) < Table->Length))
780 AcpiOsPrintf ("\n");
781 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
782 SubSubTable->Length, AcpiDmTableInfoCsrt2);
783 if (ACPI_FAILURE (Status))
785 return;
788 SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
790 /* Resource-specific info buffer */
792 InfoLength = SubSubTable->Length - SubSubOffset;
793 if (InfoLength)
795 Status = AcpiDmDumpTable (Length,
796 Offset + SubOffset + SubSubOffset, Table,
797 InfoLength, AcpiDmTableInfoCsrt2a);
798 if (ACPI_FAILURE (Status))
800 return;
802 SubSubOffset += InfoLength;
805 /* Point to next sub-subtable */
807 SubOffset += SubSubTable->Length;
808 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
809 SubSubTable->Length);
812 /* Point to next subtable */
814 Offset += SubTable->Length;
815 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
816 SubTable->Length);
821 /*******************************************************************************
823 * FUNCTION: AcpiDmDumpDbg2
825 * PARAMETERS: Table - A DBG2 table
827 * RETURN: None
829 * DESCRIPTION: Format the contents of a DBG2. This table type consists
830 * of an open-ended number of subtables.
832 ******************************************************************************/
834 void
835 AcpiDmDumpDbg2 (
836 ACPI_TABLE_HEADER *Table)
838 ACPI_STATUS Status;
839 ACPI_DBG2_DEVICE *SubTable;
840 UINT32 Length = Table->Length;
841 UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
842 UINT32 i;
843 UINT32 ArrayOffset;
844 UINT32 AbsoluteOffset;
845 UINT8 *Array;
848 /* Main table */
850 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
851 if (ACPI_FAILURE (Status))
853 return;
856 /* Subtables */
858 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
859 while (Offset < Table->Length)
861 AcpiOsPrintf ("\n");
862 Status = AcpiDmDumpTable (Length, Offset, SubTable,
863 SubTable->Length, AcpiDmTableInfoDbg2Device);
864 if (ACPI_FAILURE (Status))
866 return;
869 /* Dump the BaseAddress array */
871 for (i = 0; i < SubTable->RegisterCount; i++)
873 ArrayOffset = SubTable->BaseAddressOffset +
874 (sizeof (ACPI_GENERIC_ADDRESS) * i);
875 AbsoluteOffset = Offset + ArrayOffset;
876 Array = (UINT8 *) SubTable + ArrayOffset;
878 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
879 SubTable->Length, AcpiDmTableInfoDbg2Addr);
880 if (ACPI_FAILURE (Status))
882 return;
886 /* Dump the AddressSize array */
888 for (i = 0; i < SubTable->RegisterCount; i++)
890 ArrayOffset = SubTable->AddressSizeOffset +
891 (sizeof (UINT32) * i);
892 AbsoluteOffset = Offset + ArrayOffset;
893 Array = (UINT8 *) SubTable + ArrayOffset;
895 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
896 SubTable->Length, AcpiDmTableInfoDbg2Size);
897 if (ACPI_FAILURE (Status))
899 return;
903 /* Dump the Namestring (required) */
905 AcpiOsPrintf ("\n");
906 ArrayOffset = SubTable->NamepathOffset;
907 AbsoluteOffset = Offset + ArrayOffset;
908 Array = (UINT8 *) SubTable + ArrayOffset;
910 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
911 SubTable->Length, AcpiDmTableInfoDbg2Name);
912 if (ACPI_FAILURE (Status))
914 return;
917 /* Dump the OemData (optional) */
919 if (SubTable->OemDataOffset)
921 Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset,
922 Table, SubTable->OemDataLength,
923 AcpiDmTableInfoDbg2OemData);
924 if (ACPI_FAILURE (Status))
926 return;
930 /* Point to next subtable */
932 Offset += SubTable->Length;
933 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
934 SubTable->Length);
939 /*******************************************************************************
941 * FUNCTION: AcpiDmDumpDmar
943 * PARAMETERS: Table - A DMAR table
945 * RETURN: None
947 * DESCRIPTION: Format the contents of a DMAR. This table type consists
948 * of an open-ended number of subtables.
950 ******************************************************************************/
952 void
953 AcpiDmDumpDmar (
954 ACPI_TABLE_HEADER *Table)
956 ACPI_STATUS Status;
957 ACPI_DMAR_HEADER *SubTable;
958 UINT32 Length = Table->Length;
959 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
960 ACPI_DMTABLE_INFO *InfoTable;
961 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
962 UINT32 ScopeOffset;
963 UINT8 *PciPath;
964 UINT32 PathOffset;
967 /* Main table */
969 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
970 if (ACPI_FAILURE (Status))
972 return;
975 /* Subtables */
977 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
978 while (Offset < Table->Length)
980 /* Common subtable header */
982 AcpiOsPrintf ("\n");
983 Status = AcpiDmDumpTable (Length, Offset, SubTable,
984 SubTable->Length, AcpiDmTableInfoDmarHdr);
985 if (ACPI_FAILURE (Status))
987 return;
989 AcpiOsPrintf ("\n");
991 switch (SubTable->Type)
993 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
995 InfoTable = AcpiDmTableInfoDmar0;
996 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
997 break;
999 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
1001 InfoTable = AcpiDmTableInfoDmar1;
1002 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
1003 break;
1005 case ACPI_DMAR_TYPE_ROOT_ATS:
1007 InfoTable = AcpiDmTableInfoDmar2;
1008 ScopeOffset = sizeof (ACPI_DMAR_ATSR);
1009 break;
1011 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
1013 InfoTable = AcpiDmTableInfoDmar3;
1014 ScopeOffset = sizeof (ACPI_DMAR_RHSA);
1015 break;
1017 case ACPI_DMAR_TYPE_NAMESPACE:
1019 InfoTable = AcpiDmTableInfoDmar4;
1020 ScopeOffset = sizeof (ACPI_DMAR_ANDD);
1021 break;
1023 default:
1025 AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", SubTable->Type);
1026 return;
1029 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1030 SubTable->Length, InfoTable);
1031 if (ACPI_FAILURE (Status))
1033 return;
1037 * Dump the optional device scope entries
1039 if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1040 (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE))
1042 /* These types do not support device scopes */
1044 goto NextSubtable;
1047 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
1048 while (ScopeOffset < SubTable->Length)
1050 AcpiOsPrintf ("\n");
1051 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
1052 ScopeTable->Length, AcpiDmTableInfoDmarScope);
1053 if (ACPI_FAILURE (Status))
1055 return;
1057 AcpiOsPrintf ("\n");
1059 /* Dump the PCI Path entries for this device scope */
1061 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
1063 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
1064 sizeof (ACPI_DMAR_DEVICE_SCOPE));
1066 while (PathOffset < ScopeTable->Length)
1068 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
1069 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
1071 /* Point to next PCI Path entry */
1073 PathOffset += 2;
1074 PciPath += 2;
1075 AcpiOsPrintf ("\n");
1078 /* Point to next device scope entry */
1080 ScopeOffset += ScopeTable->Length;
1081 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
1082 ScopeTable, ScopeTable->Length);
1085 NextSubtable:
1086 /* Point to next subtable */
1088 Offset += SubTable->Length;
1089 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
1094 /*******************************************************************************
1096 * FUNCTION: AcpiDmDumpDrtm
1098 * PARAMETERS: Table - A DRTM table
1100 * RETURN: None
1102 * DESCRIPTION: Format the contents of a DRTM.
1104 ******************************************************************************/
1106 void
1107 AcpiDmDumpDrtm (
1108 ACPI_TABLE_HEADER *Table)
1110 ACPI_STATUS Status;
1111 UINT32 Offset;
1112 ACPI_DRTM_VTABLE_LIST *DrtmVtl;
1113 ACPI_DRTM_RESOURCE_LIST *DrtmRl;
1114 ACPI_DRTM_DPS_ID *DrtmDps;
1115 UINT32 Count;
1118 /* Main table */
1120 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
1121 AcpiDmTableInfoDrtm);
1122 if (ACPI_FAILURE (Status))
1124 return;
1127 Offset = sizeof (ACPI_TABLE_DRTM);
1129 /* Sub-tables */
1131 /* Dump ValidatedTable length */
1133 DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
1134 AcpiOsPrintf ("\n");
1135 Status = AcpiDmDumpTable (Table->Length, Offset,
1136 DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
1137 AcpiDmTableInfoDrtm0);
1138 if (ACPI_FAILURE (Status))
1140 return;
1142 Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
1144 /* Dump Validated table addresses */
1146 Count = 0;
1147 while ((Offset < Table->Length) &&
1148 (DrtmVtl->ValidatedTableCount > Count))
1150 Status = AcpiDmDumpTable (Table->Length, Offset,
1151 ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
1152 AcpiDmTableInfoDrtm0a);
1153 if (ACPI_FAILURE (Status))
1155 return;
1157 Offset += sizeof (UINT64);
1158 Count++;
1161 /* Dump ResourceList length */
1163 DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
1164 AcpiOsPrintf ("\n");
1165 Status = AcpiDmDumpTable (Table->Length, Offset,
1166 DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
1167 AcpiDmTableInfoDrtm1);
1168 if (ACPI_FAILURE (Status))
1170 return;
1173 Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
1175 /* Dump the Resource List */
1177 Count = 0;
1178 while ((Offset < Table->Length) &&
1179 (DrtmRl->ResourceCount > Count))
1181 Status = AcpiDmDumpTable (Table->Length, Offset,
1182 ACPI_ADD_PTR (void, Table, Offset),
1183 sizeof (ACPI_DRTM_RESOURCE),
1184 AcpiDmTableInfoDrtm1a);
1185 if (ACPI_FAILURE (Status))
1187 return;
1190 Offset += sizeof (ACPI_DRTM_RESOURCE);
1191 Count++;
1194 /* Dump DPS */
1196 DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
1197 AcpiOsPrintf ("\n");
1198 (void) AcpiDmDumpTable (Table->Length, Offset,
1199 DrtmDps, sizeof (ACPI_DRTM_DPS_ID),
1200 AcpiDmTableInfoDrtm2);
1204 /*******************************************************************************
1206 * FUNCTION: AcpiDmDumpEinj
1208 * PARAMETERS: Table - A EINJ table
1210 * RETURN: None
1212 * DESCRIPTION: Format the contents of a EINJ. This table type consists
1213 * of an open-ended number of subtables.
1215 ******************************************************************************/
1217 void
1218 AcpiDmDumpEinj (
1219 ACPI_TABLE_HEADER *Table)
1221 ACPI_STATUS Status;
1222 ACPI_WHEA_HEADER *SubTable;
1223 UINT32 Length = Table->Length;
1224 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
1227 /* Main table */
1229 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
1230 if (ACPI_FAILURE (Status))
1232 return;
1235 /* Subtables */
1237 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1238 while (Offset < Table->Length)
1240 AcpiOsPrintf ("\n");
1241 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1242 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1243 if (ACPI_FAILURE (Status))
1245 return;
1248 /* Point to next subtable (each subtable is of fixed length) */
1250 Offset += sizeof (ACPI_WHEA_HEADER);
1251 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1252 sizeof (ACPI_WHEA_HEADER));
1257 /*******************************************************************************
1259 * FUNCTION: AcpiDmDumpErst
1261 * PARAMETERS: Table - A ERST table
1263 * RETURN: None
1265 * DESCRIPTION: Format the contents of a ERST. This table type consists
1266 * of an open-ended number of subtables.
1268 ******************************************************************************/
1270 void
1271 AcpiDmDumpErst (
1272 ACPI_TABLE_HEADER *Table)
1274 ACPI_STATUS Status;
1275 ACPI_WHEA_HEADER *SubTable;
1276 UINT32 Length = Table->Length;
1277 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
1280 /* Main table */
1282 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1283 if (ACPI_FAILURE (Status))
1285 return;
1288 /* Subtables */
1290 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1291 while (Offset < Table->Length)
1293 AcpiOsPrintf ("\n");
1294 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1295 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1296 if (ACPI_FAILURE (Status))
1298 return;
1301 /* Point to next subtable (each subtable is of fixed length) */
1303 Offset += sizeof (ACPI_WHEA_HEADER);
1304 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1305 sizeof (ACPI_WHEA_HEADER));
1310 /*******************************************************************************
1312 * FUNCTION: AcpiDmDumpFpdt
1314 * PARAMETERS: Table - A FPDT table
1316 * RETURN: None
1318 * DESCRIPTION: Format the contents of a FPDT. This table type consists
1319 * of an open-ended number of subtables.
1321 ******************************************************************************/
1323 void
1324 AcpiDmDumpFpdt (
1325 ACPI_TABLE_HEADER *Table)
1327 ACPI_STATUS Status;
1328 ACPI_FPDT_HEADER *SubTable;
1329 UINT32 Length = Table->Length;
1330 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
1331 ACPI_DMTABLE_INFO *InfoTable;
1334 /* There is no main table (other than the standard ACPI header) */
1336 /* Subtables */
1338 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1339 while (Offset < Table->Length)
1341 /* Common subtable header */
1343 AcpiOsPrintf ("\n");
1344 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1345 SubTable->Length, AcpiDmTableInfoFpdtHdr);
1346 if (ACPI_FAILURE (Status))
1348 return;
1351 switch (SubTable->Type)
1353 case ACPI_FPDT_TYPE_BOOT:
1355 InfoTable = AcpiDmTableInfoFpdt0;
1356 break;
1358 case ACPI_FPDT_TYPE_S3PERF:
1360 InfoTable = AcpiDmTableInfoFpdt1;
1361 break;
1363 default:
1365 AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", SubTable->Type);
1367 /* Attempt to continue */
1369 if (!SubTable->Length)
1371 AcpiOsPrintf ("Invalid zero length subtable\n");
1372 return;
1374 goto NextSubTable;
1377 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1378 SubTable->Length, InfoTable);
1379 if (ACPI_FAILURE (Status))
1381 return;
1384 NextSubTable:
1385 /* Point to next subtable */
1387 Offset += SubTable->Length;
1388 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
1393 /*******************************************************************************
1395 * FUNCTION: AcpiDmDumpGtdt
1397 * PARAMETERS: Table - A GTDT table
1399 * RETURN: None
1401 * DESCRIPTION: Format the contents of a GTDT. This table type consists
1402 * of an open-ended number of subtables.
1404 ******************************************************************************/
1406 void
1407 AcpiDmDumpGtdt (
1408 ACPI_TABLE_HEADER *Table)
1410 ACPI_STATUS Status;
1411 ACPI_GTDT_HEADER *SubTable;
1412 UINT32 Length = Table->Length;
1413 UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
1414 ACPI_DMTABLE_INFO *InfoTable;
1415 UINT32 SubTableLength;
1416 UINT32 GtCount;
1417 ACPI_GTDT_TIMER_ENTRY *GtxTable;
1420 /* Main table */
1422 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
1423 if (ACPI_FAILURE (Status))
1425 return;
1428 /* Subtables */
1430 SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1431 while (Offset < Table->Length)
1433 /* Common subtable header */
1435 AcpiOsPrintf ("\n");
1436 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1437 SubTable->Length, AcpiDmTableInfoGtdtHdr);
1438 if (ACPI_FAILURE (Status))
1440 return;
1443 GtCount = 0;
1444 switch (SubTable->Type)
1446 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1448 SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
1449 GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1450 SubTable))->TimerCount;
1452 InfoTable = AcpiDmTableInfoGtdt0;
1453 break;
1455 case ACPI_GTDT_TYPE_WATCHDOG:
1457 SubTableLength = sizeof (ACPI_GTDT_WATCHDOG);
1459 InfoTable = AcpiDmTableInfoGtdt1;
1460 break;
1462 default:
1464 /* Cannot continue on unknown type - no length */
1466 AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", SubTable->Type);
1467 return;
1470 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1471 SubTable->Length, InfoTable);
1472 if (ACPI_FAILURE (Status))
1474 return;
1477 /* Point to end of current subtable (each subtable above is of fixed length) */
1479 Offset += SubTableLength;
1481 /* If there are any Gt Timer Blocks from above, dump them now */
1483 if (GtCount)
1485 GtxTable = ACPI_ADD_PTR (ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
1486 SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
1488 while (GtCount)
1490 AcpiOsPrintf ("\n");
1491 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
1492 sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
1493 if (ACPI_FAILURE (Status))
1495 return;
1497 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
1498 GtxTable++;
1499 GtCount--;
1503 /* Point to next subtable */
1505 SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength);
1510 /*******************************************************************************
1512 * FUNCTION: AcpiDmDumpHest
1514 * PARAMETERS: Table - A HEST table
1516 * RETURN: None
1518 * DESCRIPTION: Format the contents of a HEST. This table type consists
1519 * of an open-ended number of subtables.
1521 ******************************************************************************/
1523 void
1524 AcpiDmDumpHest (
1525 ACPI_TABLE_HEADER *Table)
1527 ACPI_STATUS Status;
1528 ACPI_HEST_HEADER *SubTable;
1529 UINT32 Length = Table->Length;
1530 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
1531 ACPI_DMTABLE_INFO *InfoTable;
1532 UINT32 SubTableLength;
1533 UINT32 BankCount;
1534 ACPI_HEST_IA_ERROR_BANK *BankTable;
1537 /* Main table */
1539 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1540 if (ACPI_FAILURE (Status))
1542 return;
1545 /* Subtables */
1547 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1548 while (Offset < Table->Length)
1550 BankCount = 0;
1551 switch (SubTable->Type)
1553 case ACPI_HEST_TYPE_IA32_CHECK:
1555 InfoTable = AcpiDmTableInfoHest0;
1556 SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1557 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1558 SubTable))->NumHardwareBanks;
1559 break;
1561 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1563 InfoTable = AcpiDmTableInfoHest1;
1564 SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1565 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1566 SubTable))->NumHardwareBanks;
1567 break;
1569 case ACPI_HEST_TYPE_IA32_NMI:
1571 InfoTable = AcpiDmTableInfoHest2;
1572 SubTableLength = sizeof (ACPI_HEST_IA_NMI);
1573 break;
1575 case ACPI_HEST_TYPE_AER_ROOT_PORT:
1577 InfoTable = AcpiDmTableInfoHest6;
1578 SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
1579 break;
1581 case ACPI_HEST_TYPE_AER_ENDPOINT:
1583 InfoTable = AcpiDmTableInfoHest7;
1584 SubTableLength = sizeof (ACPI_HEST_AER);
1585 break;
1587 case ACPI_HEST_TYPE_AER_BRIDGE:
1589 InfoTable = AcpiDmTableInfoHest8;
1590 SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1591 break;
1593 case ACPI_HEST_TYPE_GENERIC_ERROR:
1595 InfoTable = AcpiDmTableInfoHest9;
1596 SubTableLength = sizeof (ACPI_HEST_GENERIC);
1597 break;
1599 default:
1601 /* Cannot continue on unknown type - no length */
1603 AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", SubTable->Type);
1604 return;
1607 AcpiOsPrintf ("\n");
1608 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1609 SubTableLength, InfoTable);
1610 if (ACPI_FAILURE (Status))
1612 return;
1615 /* Point to end of current subtable (each subtable above is of fixed length) */
1617 Offset += SubTableLength;
1619 /* If there are any (fixed-length) Error Banks from above, dump them now */
1621 if (BankCount)
1623 BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
1624 SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1626 while (BankCount)
1628 AcpiOsPrintf ("\n");
1629 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1630 sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1631 if (ACPI_FAILURE (Status))
1633 return;
1635 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1636 BankTable++;
1637 BankCount--;
1641 /* Point to next subtable */
1643 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
1648 /*******************************************************************************
1650 * FUNCTION: AcpiDmDumpIort
1652 * PARAMETERS: Table - A IORT table
1654 * RETURN: None
1656 * DESCRIPTION: Format the contents of a IORT
1658 ******************************************************************************/
1660 void
1661 AcpiDmDumpIort (
1662 ACPI_TABLE_HEADER *Table)
1664 ACPI_STATUS Status;
1665 ACPI_TABLE_IORT *Iort;
1666 ACPI_IORT_NODE *IortNode;
1667 ACPI_IORT_ITS_GROUP *IortItsGroup = NULL;
1668 ACPI_IORT_SMMU *IortSmmu = NULL;
1669 UINT32 Offset;
1670 UINT32 NodeOffset;
1671 UINT32 Length;
1672 ACPI_DMTABLE_INFO *InfoTable;
1673 char *String;
1674 UINT32 i;
1677 /* Main table */
1679 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
1680 if (ACPI_FAILURE (Status))
1682 return;
1685 Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
1686 Offset = sizeof (ACPI_TABLE_IORT);
1688 /* Dump the OptionalPadding (optional) */
1690 if (Iort->NodeOffset > Offset)
1692 Status = AcpiDmDumpTable (Table->Length, Offset, Table,
1693 Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
1694 if (ACPI_FAILURE (Status))
1696 return;
1700 Offset = Iort->NodeOffset;
1701 while (Offset < Table->Length)
1703 /* Common subtable header */
1705 IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
1706 AcpiOsPrintf ("\n");
1707 Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
1708 Status = AcpiDmDumpTable (Table->Length, Offset,
1709 IortNode, Length, AcpiDmTableInfoIortHdr);
1710 if (ACPI_FAILURE (Status))
1712 return;
1715 NodeOffset = Length;
1717 switch (IortNode->Type)
1719 case ACPI_IORT_NODE_ITS_GROUP:
1721 InfoTable = AcpiDmTableInfoIort0;
1722 Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
1723 IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
1724 break;
1726 case ACPI_IORT_NODE_NAMED_COMPONENT:
1728 InfoTable = AcpiDmTableInfoIort1;
1729 Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
1730 String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
1731 Length += strlen (String) + 1;
1732 break;
1734 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
1736 InfoTable = AcpiDmTableInfoIort2;
1737 Length = IortNode->Length - NodeOffset;
1738 break;
1740 case ACPI_IORT_NODE_SMMU:
1742 InfoTable = AcpiDmTableInfoIort3;
1743 Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
1744 IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
1745 break;
1747 default:
1749 AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
1750 IortNode->Type);
1752 /* Attempt to continue */
1754 if (!IortNode->Length)
1756 AcpiOsPrintf ("Invalid zero length IORT node\n");
1757 return;
1759 goto NextSubTable;
1762 /* Dump the node subtable header */
1764 AcpiOsPrintf ("\n");
1765 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1766 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1767 Length, InfoTable);
1768 if (ACPI_FAILURE (Status))
1770 return;
1773 NodeOffset += Length;
1775 /* Dump the node specific data */
1777 switch (IortNode->Type)
1779 case ACPI_IORT_NODE_ITS_GROUP:
1781 /* Validate IortItsGroup to avoid compiler warnings */
1783 if (IortItsGroup)
1785 for (i = 0; i < IortItsGroup->ItsCount; i++)
1787 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1788 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1789 4, AcpiDmTableInfoIort0a);
1790 NodeOffset += 4;
1793 break;
1795 case ACPI_IORT_NODE_NAMED_COMPONENT:
1797 /* Dump the Padding (optional) */
1799 if (IortNode->Length > NodeOffset)
1801 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1802 Table, IortNode->Length - NodeOffset,
1803 AcpiDmTableInfoIort1a);
1804 if (ACPI_FAILURE (Status))
1806 return;
1809 break;
1811 case ACPI_IORT_NODE_SMMU:
1813 AcpiOsPrintf ("\n");
1815 /* Validate IortSmmu to avoid compiler warnings */
1817 if (IortSmmu)
1819 Length = 2 * sizeof (UINT64);
1820 NodeOffset = IortSmmu->GlobalInterruptOffset;
1821 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1822 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1823 Length, AcpiDmTableInfoIort3a);
1824 if (ACPI_FAILURE (Status))
1826 return;
1829 NodeOffset = IortSmmu->ContextInterruptOffset;
1830 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
1832 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1833 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1834 8, AcpiDmTableInfoIort3b);
1835 if (ACPI_FAILURE (Status))
1837 return;
1839 NodeOffset += 8;
1842 NodeOffset = IortSmmu->PmuInterruptOffset;
1843 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
1845 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1846 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1847 8, AcpiDmTableInfoIort3c);
1848 if (ACPI_FAILURE (Status))
1850 return;
1852 NodeOffset += 8;
1855 break;
1857 default:
1859 break;
1862 /* Dump the ID mappings */
1864 NodeOffset = IortNode->MappingOffset;
1865 for (i = 0; i < IortNode->MappingCount; i++)
1867 AcpiOsPrintf ("\n");
1868 Length = sizeof (ACPI_IORT_ID_MAPPING);
1869 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1870 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1871 Length, AcpiDmTableInfoIortMap);
1872 if (ACPI_FAILURE (Status))
1874 return;
1876 NodeOffset += Length;
1879 NextSubTable:
1880 /* Point to next node subtable */
1882 Offset += IortNode->Length;
1883 IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
1888 /*******************************************************************************
1890 * FUNCTION: AcpiDmDumpIvrs
1892 * PARAMETERS: Table - A IVRS table
1894 * RETURN: None
1896 * DESCRIPTION: Format the contents of a IVRS
1898 ******************************************************************************/
1900 static UINT8 EntrySizes[] = {4,8,16,32};
1902 void
1903 AcpiDmDumpIvrs (
1904 ACPI_TABLE_HEADER *Table)
1906 ACPI_STATUS Status;
1907 UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
1908 UINT32 EntryOffset;
1909 UINT32 EntryLength;
1910 UINT32 EntryType;
1911 ACPI_IVRS_DE_HEADER *DeviceEntry;
1912 ACPI_IVRS_HEADER *SubTable;
1913 ACPI_DMTABLE_INFO *InfoTable;
1916 /* Main table */
1918 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
1919 if (ACPI_FAILURE (Status))
1921 return;
1924 /* Subtables */
1926 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
1927 while (Offset < Table->Length)
1929 /* Common subtable header */
1931 AcpiOsPrintf ("\n");
1932 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1933 SubTable->Length, AcpiDmTableInfoIvrsHdr);
1934 if (ACPI_FAILURE (Status))
1936 return;
1939 switch (SubTable->Type)
1941 case ACPI_IVRS_TYPE_HARDWARE:
1943 InfoTable = AcpiDmTableInfoIvrs0;
1944 break;
1946 case ACPI_IVRS_TYPE_MEMORY1:
1947 case ACPI_IVRS_TYPE_MEMORY2:
1948 case ACPI_IVRS_TYPE_MEMORY3:
1950 InfoTable = AcpiDmTableInfoIvrs1;
1951 break;
1953 default:
1955 AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
1956 SubTable->Type);
1958 /* Attempt to continue */
1960 if (!SubTable->Length)
1962 AcpiOsPrintf ("Invalid zero length subtable\n");
1963 return;
1965 goto NextSubTable;
1968 /* Dump the subtable */
1970 AcpiOsPrintf ("\n");
1971 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1972 SubTable->Length, InfoTable);
1973 if (ACPI_FAILURE (Status))
1975 return;
1978 /* The hardware subtable can contain multiple device entries */
1980 if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
1982 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
1983 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
1984 sizeof (ACPI_IVRS_HARDWARE));
1986 while (EntryOffset < (Offset + SubTable->Length))
1988 AcpiOsPrintf ("\n");
1990 * Upper 2 bits of Type encode the length of the device entry
1992 * 00 = 4 byte
1993 * 01 = 8 byte
1994 * 10 = 16 byte - currently no entries defined
1995 * 11 = 32 byte - currently no entries defined
1997 EntryType = DeviceEntry->Type;
1998 EntryLength = EntrySizes [EntryType >> 6];
2000 switch (EntryType)
2002 /* 4-byte device entries */
2004 case ACPI_IVRS_TYPE_PAD4:
2005 case ACPI_IVRS_TYPE_ALL:
2006 case ACPI_IVRS_TYPE_SELECT:
2007 case ACPI_IVRS_TYPE_START:
2008 case ACPI_IVRS_TYPE_END:
2010 InfoTable = AcpiDmTableInfoIvrs4;
2011 break;
2013 /* 8-byte entries, type A */
2015 case ACPI_IVRS_TYPE_ALIAS_SELECT:
2016 case ACPI_IVRS_TYPE_ALIAS_START:
2018 InfoTable = AcpiDmTableInfoIvrs8a;
2019 break;
2021 /* 8-byte entries, type B */
2023 case ACPI_IVRS_TYPE_PAD8:
2024 case ACPI_IVRS_TYPE_EXT_SELECT:
2025 case ACPI_IVRS_TYPE_EXT_START:
2027 InfoTable = AcpiDmTableInfoIvrs8b;
2028 break;
2030 /* 8-byte entries, type C */
2032 case ACPI_IVRS_TYPE_SPECIAL:
2034 InfoTable = AcpiDmTableInfoIvrs8c;
2035 break;
2037 default:
2038 InfoTable = AcpiDmTableInfoIvrs4;
2039 AcpiOsPrintf (
2040 "\n**** Unknown IVRS device entry type/length: "
2041 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
2042 EntryType, EntryLength, EntryOffset);
2043 break;
2046 /* Dump the Device Entry */
2048 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
2049 DeviceEntry, EntryLength, InfoTable);
2050 if (ACPI_FAILURE (Status))
2052 return;
2055 EntryOffset += EntryLength;
2056 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
2057 EntryLength);
2061 NextSubTable:
2062 /* Point to next subtable */
2064 Offset += SubTable->Length;
2065 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
2070 /*******************************************************************************
2072 * FUNCTION: AcpiDmDumpLpit
2074 * PARAMETERS: Table - A LPIT table
2076 * RETURN: None
2078 * DESCRIPTION: Format the contents of a LPIT. This table type consists
2079 * of an open-ended number of subtables. Note: There are no
2080 * entries in the main table. An LPIT consists of the table
2081 * header and then subtables only.
2083 ******************************************************************************/
2085 void
2086 AcpiDmDumpLpit (
2087 ACPI_TABLE_HEADER *Table)
2089 ACPI_STATUS Status;
2090 ACPI_LPIT_HEADER *SubTable;
2091 UINT32 Length = Table->Length;
2092 UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
2093 ACPI_DMTABLE_INFO *InfoTable;
2094 UINT32 SubTableLength;
2097 /* Subtables */
2099 SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
2100 while (Offset < Table->Length)
2102 /* Common subtable header */
2104 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2105 sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
2106 if (ACPI_FAILURE (Status))
2108 return;
2111 switch (SubTable->Type)
2113 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
2115 InfoTable = AcpiDmTableInfoLpit0;
2116 SubTableLength = sizeof (ACPI_LPIT_NATIVE);
2117 break;
2119 default:
2121 /* Cannot continue on unknown type - no length */
2123 AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", SubTable->Type);
2124 return;
2127 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2128 SubTableLength, InfoTable);
2129 if (ACPI_FAILURE (Status))
2131 return;
2133 AcpiOsPrintf ("\n");
2135 /* Point to next subtable */
2137 Offset += SubTableLength;
2138 SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength);
2143 /*******************************************************************************
2145 * FUNCTION: AcpiDmDumpMadt
2147 * PARAMETERS: Table - A MADT table
2149 * RETURN: None
2151 * DESCRIPTION: Format the contents of a MADT. This table type consists
2152 * of an open-ended number of subtables.
2154 ******************************************************************************/
2156 void
2157 AcpiDmDumpMadt (
2158 ACPI_TABLE_HEADER *Table)
2160 ACPI_STATUS Status;
2161 ACPI_SUBTABLE_HEADER *SubTable;
2162 UINT32 Length = Table->Length;
2163 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
2164 ACPI_DMTABLE_INFO *InfoTable;
2167 /* Main table */
2169 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
2170 if (ACPI_FAILURE (Status))
2172 return;
2175 /* Subtables */
2177 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2178 while (Offset < Table->Length)
2180 /* Common subtable header */
2182 AcpiOsPrintf ("\n");
2183 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2184 SubTable->Length, AcpiDmTableInfoMadtHdr);
2185 if (ACPI_FAILURE (Status))
2187 return;
2190 switch (SubTable->Type)
2192 case ACPI_MADT_TYPE_LOCAL_APIC:
2194 InfoTable = AcpiDmTableInfoMadt0;
2195 break;
2197 case ACPI_MADT_TYPE_IO_APIC:
2199 InfoTable = AcpiDmTableInfoMadt1;
2200 break;
2202 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
2204 InfoTable = AcpiDmTableInfoMadt2;
2205 break;
2207 case ACPI_MADT_TYPE_NMI_SOURCE:
2209 InfoTable = AcpiDmTableInfoMadt3;
2210 break;
2212 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
2214 InfoTable = AcpiDmTableInfoMadt4;
2215 break;
2217 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
2219 InfoTable = AcpiDmTableInfoMadt5;
2220 break;
2222 case ACPI_MADT_TYPE_IO_SAPIC:
2224 InfoTable = AcpiDmTableInfoMadt6;
2225 break;
2227 case ACPI_MADT_TYPE_LOCAL_SAPIC:
2229 InfoTable = AcpiDmTableInfoMadt7;
2230 break;
2232 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
2234 InfoTable = AcpiDmTableInfoMadt8;
2235 break;
2237 case ACPI_MADT_TYPE_LOCAL_X2APIC:
2239 InfoTable = AcpiDmTableInfoMadt9;
2240 break;
2242 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
2244 InfoTable = AcpiDmTableInfoMadt10;
2245 break;
2247 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
2249 InfoTable = AcpiDmTableInfoMadt11;
2250 break;
2252 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
2254 InfoTable = AcpiDmTableInfoMadt12;
2255 break;
2257 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
2259 InfoTable = AcpiDmTableInfoMadt13;
2260 break;
2262 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
2264 InfoTable = AcpiDmTableInfoMadt14;
2265 break;
2267 case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
2269 InfoTable = AcpiDmTableInfoMadt15;
2270 break;
2272 default:
2274 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type);
2276 /* Attempt to continue */
2278 if (!SubTable->Length)
2280 AcpiOsPrintf ("Invalid zero length subtable\n");
2281 return;
2283 goto NextSubTable;
2286 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2287 SubTable->Length, InfoTable);
2288 if (ACPI_FAILURE (Status))
2290 return;
2293 NextSubTable:
2294 /* Point to next subtable */
2296 Offset += SubTable->Length;
2297 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
2302 /*******************************************************************************
2304 * FUNCTION: AcpiDmDumpMcfg
2306 * PARAMETERS: Table - A MCFG Table
2308 * RETURN: None
2310 * DESCRIPTION: Format the contents of a MCFG table
2312 ******************************************************************************/
2314 void
2315 AcpiDmDumpMcfg (
2316 ACPI_TABLE_HEADER *Table)
2318 ACPI_STATUS Status;
2319 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
2320 ACPI_MCFG_ALLOCATION *SubTable;
2323 /* Main table */
2325 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
2326 if (ACPI_FAILURE (Status))
2328 return;
2331 /* Subtables */
2333 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
2334 while (Offset < Table->Length)
2336 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
2338 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
2339 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
2340 return;
2343 AcpiOsPrintf ("\n");
2344 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2345 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
2346 if (ACPI_FAILURE (Status))
2348 return;
2351 /* Point to next subtable (each subtable is of fixed length) */
2353 Offset += sizeof (ACPI_MCFG_ALLOCATION);
2354 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
2355 sizeof (ACPI_MCFG_ALLOCATION));
2360 /*******************************************************************************
2362 * FUNCTION: AcpiDmDumpMpst
2364 * PARAMETERS: Table - A MPST Table
2366 * RETURN: None
2368 * DESCRIPTION: Format the contents of a MPST table
2370 ******************************************************************************/
2372 void
2373 AcpiDmDumpMpst (
2374 ACPI_TABLE_HEADER *Table)
2376 ACPI_STATUS Status;
2377 UINT32 Offset = sizeof (ACPI_TABLE_MPST);
2378 ACPI_MPST_POWER_NODE *SubTable0;
2379 ACPI_MPST_POWER_STATE *SubTable0A;
2380 ACPI_MPST_COMPONENT *SubTable0B;
2381 ACPI_MPST_DATA_HDR *SubTable1;
2382 ACPI_MPST_POWER_DATA *SubTable2;
2383 UINT16 SubtableCount;
2384 UINT32 PowerStateCount;
2385 UINT32 ComponentCount;
2388 /* Main table */
2390 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
2391 if (ACPI_FAILURE (Status))
2393 return;
2396 /* Subtable: Memory Power Node(s) */
2398 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
2399 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
2401 while ((Offset < Table->Length) && SubtableCount)
2403 AcpiOsPrintf ("\n");
2404 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
2405 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
2406 if (ACPI_FAILURE (Status))
2408 return;
2411 /* Extract the sub-subtable counts */
2413 PowerStateCount = SubTable0->NumPowerStates;
2414 ComponentCount = SubTable0->NumPhysicalComponents;
2415 Offset += sizeof (ACPI_MPST_POWER_NODE);
2417 /* Sub-subtables - Memory Power State Structure(s) */
2419 SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
2420 sizeof (ACPI_MPST_POWER_NODE));
2422 while (PowerStateCount)
2424 AcpiOsPrintf ("\n");
2425 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
2426 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
2427 if (ACPI_FAILURE (Status))
2429 return;
2432 SubTable0A++;
2433 PowerStateCount--;
2434 Offset += sizeof (ACPI_MPST_POWER_STATE);
2437 /* Sub-subtables - Physical Component ID Structure(s) */
2439 SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
2441 if (ComponentCount)
2443 AcpiOsPrintf ("\n");
2446 while (ComponentCount)
2448 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
2449 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
2450 if (ACPI_FAILURE (Status))
2452 return;
2455 SubTable0B++;
2456 ComponentCount--;
2457 Offset += sizeof (ACPI_MPST_COMPONENT);
2460 /* Point to next Memory Power Node subtable */
2462 SubtableCount--;
2463 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
2464 sizeof (ACPI_MPST_POWER_NODE) +
2465 (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
2466 (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
2469 /* Subtable: Count of Memory Power State Characteristic structures */
2471 AcpiOsPrintf ("\n");
2472 SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
2473 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
2474 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
2475 if (ACPI_FAILURE (Status))
2477 return;
2480 SubtableCount = SubTable1->CharacteristicsCount;
2481 Offset += sizeof (ACPI_MPST_DATA_HDR);
2483 /* Subtable: Memory Power State Characteristics structure(s) */
2485 SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR));
2487 while ((Offset < Table->Length) && SubtableCount)
2489 AcpiOsPrintf ("\n");
2490 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
2491 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
2492 if (ACPI_FAILURE (Status))
2494 return;
2497 SubTable2++;
2498 SubtableCount--;
2499 Offset += sizeof (ACPI_MPST_POWER_DATA);
2504 /*******************************************************************************
2506 * FUNCTION: AcpiDmDumpMsct
2508 * PARAMETERS: Table - A MSCT table
2510 * RETURN: None
2512 * DESCRIPTION: Format the contents of a MSCT
2514 ******************************************************************************/
2516 void
2517 AcpiDmDumpMsct (
2518 ACPI_TABLE_HEADER *Table)
2520 ACPI_STATUS Status;
2521 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
2522 ACPI_MSCT_PROXIMITY *SubTable;
2525 /* Main table */
2527 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
2528 if (ACPI_FAILURE (Status))
2530 return;
2533 /* Subtables */
2535 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
2536 while (Offset < Table->Length)
2538 /* Common subtable header */
2540 AcpiOsPrintf ("\n");
2541 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2542 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
2543 if (ACPI_FAILURE (Status))
2545 return;
2548 /* Point to next subtable */
2550 Offset += sizeof (ACPI_MSCT_PROXIMITY);
2551 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
2556 /*******************************************************************************
2558 * FUNCTION: AcpiDmDumpMtmr
2560 * PARAMETERS: Table - A MTMR table
2562 * RETURN: None
2564 * DESCRIPTION: Format the contents of a MTMR
2566 ******************************************************************************/
2568 void
2569 AcpiDmDumpMtmr (
2570 ACPI_TABLE_HEADER *Table)
2572 ACPI_STATUS Status;
2573 UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
2574 ACPI_MTMR_ENTRY *SubTable;
2577 /* Main table */
2579 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
2580 if (ACPI_FAILURE (Status))
2582 return;
2585 /* Subtables */
2587 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
2588 while (Offset < Table->Length)
2590 /* Common subtable header */
2592 AcpiOsPrintf ("\n");
2593 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2594 sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
2595 if (ACPI_FAILURE (Status))
2597 return;
2600 /* Point to next subtable */
2602 Offset += sizeof (ACPI_MTMR_ENTRY);
2603 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
2608 /*******************************************************************************
2610 * FUNCTION: AcpiDmDumpNfit
2612 * PARAMETERS: Table - A NFIT table
2614 * RETURN: None
2616 * DESCRIPTION: Format the contents of an NFIT.
2618 ******************************************************************************/
2620 void
2621 AcpiDmDumpNfit (
2622 ACPI_TABLE_HEADER *Table)
2624 ACPI_STATUS Status;
2625 UINT32 Offset = sizeof (ACPI_TABLE_NFIT);
2626 UINT32 FieldOffset = 0;
2627 UINT32 Length;
2628 ACPI_NFIT_HEADER *SubTable;
2629 ACPI_DMTABLE_INFO *InfoTable;
2630 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
2631 ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
2632 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
2633 UINT32 i;
2636 /* Main table */
2638 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
2639 if (ACPI_FAILURE (Status))
2641 return;
2644 /* Subtables */
2646 SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
2647 while (Offset < Table->Length)
2649 /* NFIT subtable header */
2651 AcpiOsPrintf ("\n");
2652 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2653 SubTable->Length, AcpiDmTableInfoNfitHdr);
2654 if (ACPI_FAILURE (Status))
2656 return;
2659 switch (SubTable->Type)
2661 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
2663 InfoTable = AcpiDmTableInfoNfit0;
2664 break;
2666 case ACPI_NFIT_TYPE_MEMORY_MAP:
2668 InfoTable = AcpiDmTableInfoNfit1;
2669 break;
2671 case ACPI_NFIT_TYPE_INTERLEAVE:
2673 /* Has a variable number of 32-bit values at the end */
2675 InfoTable = AcpiDmTableInfoNfit2;
2676 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable);
2677 FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
2678 break;
2680 case ACPI_NFIT_TYPE_SMBIOS:
2682 SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable);
2683 InfoTable = AcpiDmTableInfoNfit3;
2684 break;
2686 case ACPI_NFIT_TYPE_CONTROL_REGION:
2688 InfoTable = AcpiDmTableInfoNfit4;
2689 break;
2691 case ACPI_NFIT_TYPE_DATA_REGION:
2693 InfoTable = AcpiDmTableInfoNfit5;
2694 break;
2696 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
2698 /* Has a variable number of 64-bit addresses at the end */
2700 InfoTable = AcpiDmTableInfoNfit6;
2701 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable);
2702 FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
2703 break;
2705 default:
2706 AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", SubTable->Type);
2708 /* Attempt to continue */
2710 if (!SubTable->Length)
2712 AcpiOsPrintf ("Invalid zero length subtable\n");
2713 return;
2715 goto NextSubTable;
2718 AcpiOsPrintf ("\n");
2719 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2720 SubTable->Length, InfoTable);
2721 if (ACPI_FAILURE (Status))
2723 return;
2726 /* Per-subtable variable-length fields */
2728 switch (SubTable->Type)
2730 case ACPI_NFIT_TYPE_INTERLEAVE:
2732 for (i = 0; i < Interleave->LineCount; i++)
2734 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
2735 &Interleave->LineOffset[i],
2736 sizeof (UINT32), AcpiDmTableInfoNfit2a);
2737 if (ACPI_FAILURE (Status))
2739 return;
2742 FieldOffset += sizeof (UINT32);
2744 break;
2746 case ACPI_NFIT_TYPE_SMBIOS:
2748 Length = SubTable->Length - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
2749 if (Length)
2751 Status = AcpiDmDumpTable (Table->Length,
2752 sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
2753 SmbiosInfo,
2754 Length, AcpiDmTableInfoNfit3a);
2755 if (ACPI_FAILURE (Status))
2757 return;
2761 break;
2763 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
2765 for (i = 0; i < Hint->HintCount; i++)
2767 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
2768 &Hint->HintAddress[i],
2769 sizeof (UINT64), AcpiDmTableInfoNfit6a);
2770 if (ACPI_FAILURE (Status))
2772 return;
2775 FieldOffset += sizeof (UINT64);
2777 break;
2779 default:
2780 break;
2783 NextSubTable:
2784 /* Point to next subtable */
2786 Offset += SubTable->Length;
2787 SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length);
2792 /*******************************************************************************
2794 * FUNCTION: AcpiDmDumpPcct
2796 * PARAMETERS: Table - A PCCT table
2798 * RETURN: None
2800 * DESCRIPTION: Format the contents of a PCCT. This table type consists
2801 * of an open-ended number of subtables.
2803 ******************************************************************************/
2805 void
2806 AcpiDmDumpPcct (
2807 ACPI_TABLE_HEADER *Table)
2809 ACPI_STATUS Status;
2810 ACPI_PCCT_SUBSPACE *SubTable;
2811 ACPI_DMTABLE_INFO *InfoTable;
2812 UINT32 Length = Table->Length;
2813 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
2816 /* Main table */
2818 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
2819 if (ACPI_FAILURE (Status))
2821 return;
2824 /* Subtables */
2826 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
2827 while (Offset < Table->Length)
2829 /* Common subtable header */
2831 AcpiOsPrintf ("\n");
2832 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2833 SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
2834 if (ACPI_FAILURE (Status))
2836 return;
2839 switch (SubTable->Header.Type)
2841 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
2843 InfoTable = AcpiDmTableInfoPcct0;
2844 break;
2846 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
2848 InfoTable = AcpiDmTableInfoPcct1;
2849 break;
2851 default:
2853 AcpiOsPrintf (
2854 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2855 SubTable->Header.Type);
2856 return;
2859 AcpiOsPrintf ("\n");
2860 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2861 SubTable->Header.Length, InfoTable);
2862 if (ACPI_FAILURE (Status))
2864 return;
2867 /* Point to next subtable */
2869 Offset += SubTable->Header.Length;
2870 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
2871 SubTable->Header.Length);
2876 /*******************************************************************************
2878 * FUNCTION: AcpiDmDumpPmtt
2880 * PARAMETERS: Table - A PMTT table
2882 * RETURN: None
2884 * DESCRIPTION: Format the contents of a PMTT. This table type consists
2885 * of an open-ended number of subtables.
2887 ******************************************************************************/
2889 void
2890 AcpiDmDumpPmtt (
2891 ACPI_TABLE_HEADER *Table)
2893 ACPI_STATUS Status;
2894 ACPI_PMTT_HEADER *SubTable;
2895 ACPI_PMTT_HEADER *MemSubTable;
2896 ACPI_PMTT_HEADER *DimmSubTable;
2897 ACPI_PMTT_DOMAIN *DomainArray;
2898 UINT32 Length = Table->Length;
2899 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
2900 UINT32 MemOffset;
2901 UINT32 DimmOffset;
2902 UINT32 DomainOffset;
2903 UINT32 DomainCount;
2906 /* Main table */
2908 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2909 if (ACPI_FAILURE (Status))
2911 return;
2914 /* Subtables */
2916 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2917 while (Offset < Table->Length)
2919 /* Common subtable header */
2921 AcpiOsPrintf ("\n");
2922 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2923 SubTable->Length, AcpiDmTableInfoPmttHdr);
2924 if (ACPI_FAILURE (Status))
2926 return;
2929 /* Only Socket subtables are expected at this level */
2931 if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
2933 AcpiOsPrintf (
2934 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2935 SubTable->Type);
2936 return;
2939 /* Dump the fixed-length portion of the subtable */
2941 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2942 SubTable->Length, AcpiDmTableInfoPmtt0);
2943 if (ACPI_FAILURE (Status))
2945 return;
2948 /* Walk the memory controller subtables */
2950 MemOffset = sizeof (ACPI_PMTT_SOCKET);
2951 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
2952 sizeof (ACPI_PMTT_SOCKET));
2954 while (((Offset + MemOffset) < Table->Length) &&
2955 (MemOffset < SubTable->Length))
2957 /* Common subtable header */
2959 AcpiOsPrintf ("\n");
2960 Status = AcpiDmDumpTable (Length,
2961 Offset + MemOffset, MemSubTable,
2962 MemSubTable->Length, AcpiDmTableInfoPmttHdr);
2963 if (ACPI_FAILURE (Status))
2965 return;
2968 /* Only memory controller subtables are expected at this level */
2970 if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
2972 AcpiOsPrintf (
2973 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2974 MemSubTable->Type);
2975 return;
2978 /* Dump the fixed-length portion of the controller subtable */
2980 Status = AcpiDmDumpTable (Length,
2981 Offset + MemOffset, MemSubTable,
2982 MemSubTable->Length, AcpiDmTableInfoPmtt1);
2983 if (ACPI_FAILURE (Status))
2985 return;
2988 /* Walk the variable count of proximity domains */
2990 DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
2991 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
2992 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
2993 sizeof (ACPI_PMTT_CONTROLLER));
2995 while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
2996 ((MemOffset + DomainOffset) < SubTable->Length) &&
2997 DomainCount)
2999 Status = AcpiDmDumpTable (Length,
3000 Offset + MemOffset + DomainOffset, DomainArray,
3001 sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
3002 if (ACPI_FAILURE (Status))
3004 return;
3007 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
3008 DomainArray++;
3009 DomainCount--;
3012 if (DomainCount)
3014 AcpiOsPrintf (
3015 "\n**** DomainCount exceeds subtable length\n\n");
3018 /* Walk the physical component (DIMM) subtables */
3020 DimmOffset = DomainOffset;
3021 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
3022 DomainOffset);
3024 while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
3025 (DimmOffset < MemSubTable->Length))
3027 /* Common subtable header */
3029 AcpiOsPrintf ("\n");
3030 Status = AcpiDmDumpTable (Length,
3031 Offset + MemOffset + DimmOffset, DimmSubTable,
3032 DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
3033 if (ACPI_FAILURE (Status))
3035 return;
3038 /* Only DIMM subtables are expected at this level */
3040 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
3042 AcpiOsPrintf (
3043 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3044 DimmSubTable->Type);
3045 return;
3048 /* Dump the fixed-length DIMM subtable */
3050 Status = AcpiDmDumpTable (Length,
3051 Offset + MemOffset + DimmOffset, DimmSubTable,
3052 DimmSubTable->Length, AcpiDmTableInfoPmtt2);
3053 if (ACPI_FAILURE (Status))
3055 return;
3058 /* Point to next DIMM subtable */
3060 DimmOffset += DimmSubTable->Length;
3061 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3062 DimmSubTable, DimmSubTable->Length);
3065 /* Point to next Controller subtable */
3067 MemOffset += MemSubTable->Length;
3068 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3069 MemSubTable, MemSubTable->Length);
3072 /* Point to next Socket subtable */
3074 Offset += SubTable->Length;
3075 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3076 SubTable, SubTable->Length);
3081 /*******************************************************************************
3083 * FUNCTION: AcpiDmDumpS3pt
3085 * PARAMETERS: Table - A S3PT table
3087 * RETURN: Length of the table
3089 * DESCRIPTION: Format the contents of a S3PT
3091 ******************************************************************************/
3093 UINT32
3094 AcpiDmDumpS3pt (
3095 ACPI_TABLE_HEADER *Tables)
3097 ACPI_STATUS Status;
3098 UINT32 Offset = sizeof (ACPI_TABLE_S3PT);
3099 ACPI_S3PT_HEADER *SubTable;
3100 ACPI_DMTABLE_INFO *InfoTable;
3101 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
3104 /* Main table */
3106 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
3107 if (ACPI_FAILURE (Status))
3109 return 0;
3112 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset);
3113 while (Offset < S3ptTable->Length)
3115 /* Common subtable header */
3117 AcpiOsPrintf ("\n");
3118 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
3119 SubTable->Length, AcpiDmTableInfoS3ptHdr);
3120 if (ACPI_FAILURE (Status))
3122 return 0;
3125 switch (SubTable->Type)
3127 case ACPI_S3PT_TYPE_RESUME:
3129 InfoTable = AcpiDmTableInfoS3pt0;
3130 break;
3132 case ACPI_S3PT_TYPE_SUSPEND:
3134 InfoTable = AcpiDmTableInfoS3pt1;
3135 break;
3137 default:
3139 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", SubTable->Type);
3141 /* Attempt to continue */
3143 if (!SubTable->Length)
3145 AcpiOsPrintf ("Invalid zero length subtable\n");
3146 return 0;
3148 goto NextSubTable;
3151 AcpiOsPrintf ("\n");
3152 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
3153 SubTable->Length, InfoTable);
3154 if (ACPI_FAILURE (Status))
3156 return 0;
3159 NextSubTable:
3160 /* Point to next subtable */
3162 Offset += SubTable->Length;
3163 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length);
3166 return (S3ptTable->Length);
3170 /*******************************************************************************
3172 * FUNCTION: AcpiDmDumpSlic
3174 * PARAMETERS: Table - A SLIC table
3176 * RETURN: None
3178 * DESCRIPTION: Format the contents of a SLIC
3180 ******************************************************************************/
3182 void
3183 AcpiDmDumpSlic (
3184 ACPI_TABLE_HEADER *Table)
3186 (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
3187 Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
3191 /*******************************************************************************
3193 * FUNCTION: AcpiDmDumpSlit
3195 * PARAMETERS: Table - An SLIT
3197 * RETURN: None
3199 * DESCRIPTION: Format the contents of a SLIT
3201 ******************************************************************************/
3203 void
3204 AcpiDmDumpSlit (
3205 ACPI_TABLE_HEADER *Table)
3207 ACPI_STATUS Status;
3208 UINT32 Offset;
3209 UINT8 *Row;
3210 UINT32 Localities;
3211 UINT32 i;
3212 UINT32 j;
3215 /* Main table */
3217 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
3218 if (ACPI_FAILURE (Status))
3220 return;
3223 /* Display the Locality NxN Matrix */
3225 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
3226 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
3227 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
3229 for (i = 0; i < Localities; i++)
3231 /* Display one row of the matrix */
3233 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
3234 for (j = 0; j < Localities; j++)
3236 /* Check for beyond EOT */
3238 if (Offset >= Table->Length)
3240 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
3241 return;
3244 AcpiOsPrintf ("%2.2X", Row[j]);
3245 Offset++;
3247 /* Display up to 16 bytes per output row */
3249 if ((j+1) < Localities)
3251 AcpiOsPrintf (" ");
3253 if (j && (((j+1) % 16) == 0))
3255 AcpiOsPrintf ("\\\n"); /* With line continuation char */
3256 AcpiDmLineHeader (Offset, 0, NULL);
3261 /* Point to next row */
3263 AcpiOsPrintf ("\n");
3264 Row += Localities;
3269 /*******************************************************************************
3271 * FUNCTION: AcpiDmDumpSrat
3273 * PARAMETERS: Table - A SRAT table
3275 * RETURN: None
3277 * DESCRIPTION: Format the contents of a SRAT
3279 ******************************************************************************/
3281 void
3282 AcpiDmDumpSrat (
3283 ACPI_TABLE_HEADER *Table)
3285 ACPI_STATUS Status;
3286 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
3287 ACPI_SUBTABLE_HEADER *SubTable;
3288 ACPI_DMTABLE_INFO *InfoTable;
3291 /* Main table */
3293 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
3294 if (ACPI_FAILURE (Status))
3296 return;
3299 /* Subtables */
3301 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
3302 while (Offset < Table->Length)
3304 /* Common subtable header */
3306 AcpiOsPrintf ("\n");
3307 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3308 SubTable->Length, AcpiDmTableInfoSratHdr);
3309 if (ACPI_FAILURE (Status))
3311 return;
3314 switch (SubTable->Type)
3316 case ACPI_SRAT_TYPE_CPU_AFFINITY:
3318 InfoTable = AcpiDmTableInfoSrat0;
3319 break;
3321 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
3323 InfoTable = AcpiDmTableInfoSrat1;
3324 break;
3326 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
3328 InfoTable = AcpiDmTableInfoSrat2;
3329 break;
3331 case ACPI_SRAT_TYPE_GICC_AFFINITY:
3333 InfoTable = AcpiDmTableInfoSrat3;
3334 break;
3336 default:
3337 AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type);
3339 /* Attempt to continue */
3341 if (!SubTable->Length)
3343 AcpiOsPrintf ("Invalid zero length subtable\n");
3344 return;
3346 goto NextSubTable;
3349 AcpiOsPrintf ("\n");
3350 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3351 SubTable->Length, InfoTable);
3352 if (ACPI_FAILURE (Status))
3354 return;
3357 NextSubTable:
3358 /* Point to next subtable */
3360 Offset += SubTable->Length;
3361 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
3366 /*******************************************************************************
3368 * FUNCTION: AcpiDmDumpStao
3370 * PARAMETERS: Table - A STAO table
3372 * RETURN: None
3374 * DESCRIPTION: Format the contents of a STAO. This is a variable-length
3375 * table that contains an open-ended number of ASCII strings
3376 * at the end of the table.
3378 ******************************************************************************/
3380 void
3381 AcpiDmDumpStao (
3382 ACPI_TABLE_HEADER *Table)
3384 ACPI_STATUS Status;
3385 char *Namepath;
3386 UINT32 Length = Table->Length;
3387 UINT32 StringLength;
3388 UINT32 Offset = sizeof (ACPI_TABLE_STAO);
3391 /* Main table */
3393 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
3394 if (ACPI_FAILURE (Status))
3396 return;
3399 /* The rest of the table consists of Namepath strings */
3401 while (Offset < Table->Length)
3403 Namepath = ACPI_ADD_PTR (char, Table, Offset);
3404 StringLength = strlen (Namepath) + 1;
3406 AcpiDmLineHeader (Offset, StringLength, "Namestring");
3407 AcpiOsPrintf ("\"%s\"\n", Namepath);
3409 /* Point to next namepath */
3411 Offset += StringLength;
3416 /*******************************************************************************
3418 * FUNCTION: AcpiDmDumpTcpa
3420 * PARAMETERS: Table - A TCPA table
3422 * RETURN: None
3424 * DESCRIPTION: Format the contents of a TCPA.
3426 * NOTE: There are two versions of the table with the same signature:
3427 * the client version and the server version. The common
3428 * PlatformClass field is used to differentiate the two types of
3429 * tables.
3431 ******************************************************************************/
3433 void
3434 AcpiDmDumpTcpa (
3435 ACPI_TABLE_HEADER *Table)
3437 UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR);
3438 ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR (
3439 ACPI_TABLE_TCPA_HDR, Table);
3440 ACPI_TABLE_TCPA_HDR *SubTable = ACPI_ADD_PTR (
3441 ACPI_TABLE_TCPA_HDR, Table, Offset);
3442 ACPI_STATUS Status;
3445 /* Main table */
3447 Status = AcpiDmDumpTable (Table->Length, 0, Table,
3448 0, AcpiDmTableInfoTcpaHdr);
3449 if (ACPI_FAILURE (Status))
3451 return;
3455 * Examine the PlatformClass field to determine the table type.
3456 * Either a client or server table. Only one.
3458 switch (CommonHeader->PlatformClass)
3460 case ACPI_TCPA_CLIENT_TABLE:
3462 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3463 Table->Length - Offset, AcpiDmTableInfoTcpaClient);
3464 break;
3466 case ACPI_TCPA_SERVER_TABLE:
3468 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3469 Table->Length - Offset, AcpiDmTableInfoTcpaServer);
3470 break;
3472 default:
3474 AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
3475 CommonHeader->PlatformClass);
3476 Status = AE_ERROR;
3477 break;
3480 if (ACPI_FAILURE (Status))
3482 AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
3487 /*******************************************************************************
3489 * FUNCTION: AcpiDmDumpVrtc
3491 * PARAMETERS: Table - A VRTC table
3493 * RETURN: None
3495 * DESCRIPTION: Format the contents of a VRTC
3497 ******************************************************************************/
3499 void
3500 AcpiDmDumpVrtc (
3501 ACPI_TABLE_HEADER *Table)
3503 ACPI_STATUS Status;
3504 UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
3505 ACPI_VRTC_ENTRY *SubTable;
3508 /* Main table */
3510 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
3511 if (ACPI_FAILURE (Status))
3513 return;
3516 /* Subtables */
3518 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
3519 while (Offset < Table->Length)
3521 /* Common subtable header */
3523 AcpiOsPrintf ("\n");
3524 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3525 sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
3526 if (ACPI_FAILURE (Status))
3528 return;
3531 /* Point to next subtable */
3533 Offset += sizeof (ACPI_VRTC_ENTRY);
3534 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
3539 /*******************************************************************************
3541 * FUNCTION: AcpiDmDumpWdat
3543 * PARAMETERS: Table - A WDAT table
3545 * RETURN: None
3547 * DESCRIPTION: Format the contents of a WDAT
3549 ******************************************************************************/
3551 void
3552 AcpiDmDumpWdat (
3553 ACPI_TABLE_HEADER *Table)
3555 ACPI_STATUS Status;
3556 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
3557 ACPI_WDAT_ENTRY *SubTable;
3560 /* Main table */
3562 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
3563 if (ACPI_FAILURE (Status))
3565 return;
3568 /* Subtables */
3570 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
3571 while (Offset < Table->Length)
3573 /* Common subtable header */
3575 AcpiOsPrintf ("\n");
3576 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3577 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
3578 if (ACPI_FAILURE (Status))
3580 return;
3583 /* Point to next subtable */
3585 Offset += sizeof (ACPI_WDAT_ENTRY);
3586 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));
3590 /*******************************************************************************
3592 * FUNCTION: AcpiDmDumpWpbt
3594 * PARAMETERS: Table - A WPBT table
3596 * RETURN: None
3598 * DESCRIPTION: Format the contents of a WPBT. This table type consists
3599 * of an open-ended arguments buffer at the end of the table.
3601 ******************************************************************************/
3603 void
3604 AcpiDmDumpWpbt (
3605 ACPI_TABLE_HEADER *Table)
3607 ACPI_STATUS Status;
3608 ACPI_TABLE_WPBT *SubTable;
3609 UINT32 Length = Table->Length;
3610 UINT16 ArgumentsLength;
3613 /* Dump the main table */
3615 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
3616 if (ACPI_FAILURE (Status))
3618 return;
3621 /* Extract the arguments buffer length from the main table */
3623 SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
3624 ArgumentsLength = SubTable->ArgumentsLength;
3626 /* Dump the arguments buffer */
3628 (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
3629 AcpiDmTableInfoWpbt0);