Sync ACPICA with Intel's version 20161117.
[dragonfly.git] / sys / contrib / dev / acpica / source / common / dmtbdump.c
blob789256c12d3b4a4c114eb2bca817d95e2587d983
1 /******************************************************************************
3 * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2016, 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]);
182 AcpiOsPrintf ("\"\n");
183 return;
185 DumpRawBuffer:
186 AcpiDmDumpBuffer (Table, BufferOffset, ByteLength,
187 BufferOffset, NULL);
188 AcpiOsPrintf ("\n");
192 /*******************************************************************************
194 * FUNCTION: AcpiDmDumpRsdp
196 * PARAMETERS: Table - A RSDP
198 * RETURN: Length of the table (there is not always a length field,
199 * use revision or length if available (ACPI 2.0+))
201 * DESCRIPTION: Format the contents of a RSDP
203 ******************************************************************************/
205 UINT32
206 AcpiDmDumpRsdp (
207 ACPI_TABLE_HEADER *Table)
209 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
210 UINT32 Length = sizeof (ACPI_RSDP_COMMON);
211 UINT8 Checksum;
212 ACPI_STATUS Status;
215 /* Dump the common ACPI 1.0 portion */
217 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
218 if (ACPI_FAILURE (Status))
220 return (Length);
223 /* Validate the first checksum */
225 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
226 Rsdp->Checksum);
227 if (Checksum != Rsdp->Checksum)
229 AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
230 Checksum);
233 /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
235 if (Rsdp->Revision > 0)
237 Length = Rsdp->Length;
238 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
239 if (ACPI_FAILURE (Status))
241 return (Length);
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)
360 ACPI_STATUS Status;
363 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
365 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
366 AcpiDmTableInfoFadt1);
367 if (ACPI_FAILURE (Status))
369 return;
372 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
374 if ((Table->Length > ACPI_FADT_V1_SIZE) &&
375 (Table->Length <= ACPI_FADT_V2_SIZE))
377 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
378 AcpiDmTableInfoFadt2);
379 if (ACPI_FAILURE (Status))
381 return;
385 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
387 else if (Table->Length > ACPI_FADT_V2_SIZE)
389 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
390 AcpiDmTableInfoFadt3);
391 if (ACPI_FAILURE (Status))
393 return;
396 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
398 if (Table->Length > ACPI_FADT_V3_SIZE)
400 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
401 AcpiDmTableInfoFadt5);
402 if (ACPI_FAILURE (Status))
404 return;
408 /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
410 if (Table->Length > ACPI_FADT_V3_SIZE)
412 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
413 AcpiDmTableInfoFadt6);
414 if (ACPI_FAILURE (Status))
416 return;
421 /* Validate various fields in the FADT, including length */
423 AcpiTbCreateLocalFadt (Table, Table->Length);
425 /* Validate FADT length against the revision */
427 AcpiDmValidateFadtLength (Table->Revision, Table->Length);
431 /*******************************************************************************
433 * FUNCTION: AcpiDmValidateFadtLength
435 * PARAMETERS: Revision - FADT revision (Header->Revision)
436 * Length - FADT length (Header->Length
438 * RETURN: None
440 * DESCRIPTION: Check the FADT revision against the expected table length for
441 * that revision. Issue a warning if the length is not what was
442 * expected. This seems to be such a common BIOS bug that the
443 * FADT revision has been rendered virtually meaningless.
445 ******************************************************************************/
447 static void
448 AcpiDmValidateFadtLength (
449 UINT32 Revision,
450 UINT32 Length)
452 UINT32 ExpectedLength;
455 switch (Revision)
457 case 0:
459 AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
460 return;
462 case 1:
464 ExpectedLength = ACPI_FADT_V1_SIZE;
465 break;
467 case 2:
469 ExpectedLength = ACPI_FADT_V2_SIZE;
470 break;
472 case 3:
473 case 4:
475 ExpectedLength = ACPI_FADT_V3_SIZE;
476 break;
478 case 5:
480 ExpectedLength = ACPI_FADT_V5_SIZE;
481 break;
483 default:
485 return;
488 if (Length == ExpectedLength)
490 return;
493 AcpiOsPrintf (
494 "\n// ACPI Warning: FADT revision %X does not match length: "
495 "found %X expected %X\n",
496 Revision, Length, ExpectedLength);
500 /*******************************************************************************
502 * FUNCTION: AcpiDmDumpAsf
504 * PARAMETERS: Table - A ASF table
506 * RETURN: None
508 * DESCRIPTION: Format the contents of a ASF table
510 ******************************************************************************/
512 void
513 AcpiDmDumpAsf (
514 ACPI_TABLE_HEADER *Table)
516 ACPI_STATUS Status;
517 UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
518 ACPI_ASF_INFO *SubTable;
519 ACPI_DMTABLE_INFO *InfoTable;
520 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
521 UINT8 *DataTable = NULL;
522 UINT32 DataCount = 0;
523 UINT32 DataLength = 0;
524 UINT32 DataOffset = 0;
525 UINT32 i;
526 UINT8 Type;
529 /* No main table, only subtables */
531 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
532 while (Offset < Table->Length)
534 /* Common subtable header */
536 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
537 SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
538 if (ACPI_FAILURE (Status))
540 return;
543 /* The actual type is the lower 7 bits of Type */
545 Type = (UINT8) (SubTable->Header.Type & 0x7F);
547 switch (Type)
549 case ACPI_ASF_TYPE_INFO:
551 InfoTable = AcpiDmTableInfoAsf0;
552 break;
554 case ACPI_ASF_TYPE_ALERT:
556 InfoTable = AcpiDmTableInfoAsf1;
557 DataInfoTable = AcpiDmTableInfoAsf1a;
558 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
559 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
560 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
561 DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
562 break;
564 case ACPI_ASF_TYPE_CONTROL:
566 InfoTable = AcpiDmTableInfoAsf2;
567 DataInfoTable = AcpiDmTableInfoAsf2a;
568 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
569 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
570 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
571 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
572 break;
574 case ACPI_ASF_TYPE_BOOT:
576 InfoTable = AcpiDmTableInfoAsf3;
577 break;
579 case ACPI_ASF_TYPE_ADDRESS:
581 InfoTable = AcpiDmTableInfoAsf4;
582 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
583 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
584 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
585 break;
587 default:
589 AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n",
590 SubTable->Header.Type);
591 return;
594 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
595 SubTable->Header.Length, InfoTable);
596 if (ACPI_FAILURE (Status))
598 return;
601 /* Dump variable-length extra data */
603 switch (Type)
605 case ACPI_ASF_TYPE_ALERT:
606 case ACPI_ASF_TYPE_CONTROL:
608 for (i = 0; i < DataCount; i++)
610 AcpiOsPrintf ("\n");
611 Status = AcpiDmDumpTable (Table->Length, DataOffset,
612 DataTable, DataLength, DataInfoTable);
613 if (ACPI_FAILURE (Status))
615 return;
618 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
619 DataOffset += DataLength;
621 break;
623 case ACPI_ASF_TYPE_ADDRESS:
625 for (i = 0; i < DataLength; i++)
627 if (!(i % 16))
629 AcpiDmLineHeader (DataOffset, 1, "Addresses");
632 AcpiOsPrintf ("%2.2X ", *DataTable);
633 DataTable++;
634 DataOffset++;
636 if (DataOffset > Table->Length)
638 AcpiOsPrintf (
639 "**** ACPI table terminates in the middle of a "
640 "data structure! (ASF! table)\n");
641 return;
645 AcpiOsPrintf ("\n");
646 break;
648 default:
650 break;
653 AcpiOsPrintf ("\n");
655 /* Point to next subtable */
657 if (!SubTable->Header.Length)
659 AcpiOsPrintf ("Invalid zero subtable header length\n");
660 return;
663 Offset += SubTable->Header.Length;
664 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable,
665 SubTable->Header.Length);
670 /*******************************************************************************
672 * FUNCTION: AcpiDmDumpCpep
674 * PARAMETERS: Table - A CPEP table
676 * RETURN: None
678 * DESCRIPTION: Format the contents of a CPEP. This table type consists
679 * of an open-ended number of subtables.
681 ******************************************************************************/
683 void
684 AcpiDmDumpCpep (
685 ACPI_TABLE_HEADER *Table)
687 ACPI_STATUS Status;
688 ACPI_CPEP_POLLING *SubTable;
689 UINT32 Length = Table->Length;
690 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
693 /* Main table */
695 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
696 if (ACPI_FAILURE (Status))
698 return;
701 /* Subtables */
703 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
704 while (Offset < Table->Length)
706 AcpiOsPrintf ("\n");
707 Status = AcpiDmDumpTable (Length, Offset, SubTable,
708 SubTable->Header.Length, AcpiDmTableInfoCpep0);
709 if (ACPI_FAILURE (Status))
711 return;
714 /* Point to next subtable */
716 Offset += SubTable->Header.Length;
717 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
718 SubTable->Header.Length);
723 /*******************************************************************************
725 * FUNCTION: AcpiDmDumpCsrt
727 * PARAMETERS: Table - A CSRT table
729 * RETURN: None
731 * DESCRIPTION: Format the contents of a CSRT. This table type consists
732 * of an open-ended number of subtables.
734 ******************************************************************************/
736 void
737 AcpiDmDumpCsrt (
738 ACPI_TABLE_HEADER *Table)
740 ACPI_STATUS Status;
741 ACPI_CSRT_GROUP *SubTable;
742 ACPI_CSRT_SHARED_INFO *SharedInfoTable;
743 ACPI_CSRT_DESCRIPTOR *SubSubTable;
744 UINT32 Length = Table->Length;
745 UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
746 UINT32 SubOffset;
747 UINT32 SubSubOffset;
748 UINT32 InfoLength;
751 /* The main table only contains the ACPI header, thus already handled */
753 /* Subtables (Resource Groups) */
755 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
756 while (Offset < Table->Length)
758 /* Resource group subtable */
760 AcpiOsPrintf ("\n");
761 Status = AcpiDmDumpTable (Length, Offset, SubTable,
762 SubTable->Length, AcpiDmTableInfoCsrt0);
763 if (ACPI_FAILURE (Status))
765 return;
768 /* Shared info subtable (One per resource group) */
770 SubOffset = sizeof (ACPI_CSRT_GROUP);
771 SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
772 Offset + SubOffset);
774 AcpiOsPrintf ("\n");
775 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
776 sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
777 if (ACPI_FAILURE (Status))
779 return;
782 SubOffset += SubTable->SharedInfoLength;
784 /* Sub-Subtables (Resource Descriptors) */
786 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
787 Offset + SubOffset);
789 while ((SubOffset < SubTable->Length) &&
790 ((Offset + SubOffset) < Table->Length))
792 AcpiOsPrintf ("\n");
793 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
794 SubSubTable->Length, AcpiDmTableInfoCsrt2);
795 if (ACPI_FAILURE (Status))
797 return;
800 SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
802 /* Resource-specific info buffer */
804 InfoLength = SubSubTable->Length - SubSubOffset;
805 if (InfoLength)
807 Status = AcpiDmDumpTable (Length,
808 Offset + SubOffset + SubSubOffset, Table,
809 InfoLength, AcpiDmTableInfoCsrt2a);
810 if (ACPI_FAILURE (Status))
812 return;
814 SubSubOffset += InfoLength;
817 /* Point to next sub-subtable */
819 SubOffset += SubSubTable->Length;
820 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
821 SubSubTable->Length);
824 /* Point to next subtable */
826 Offset += SubTable->Length;
827 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
828 SubTable->Length);
833 /*******************************************************************************
835 * FUNCTION: AcpiDmDumpDbg2
837 * PARAMETERS: Table - A DBG2 table
839 * RETURN: None
841 * DESCRIPTION: Format the contents of a DBG2. This table type consists
842 * of an open-ended number of subtables.
844 ******************************************************************************/
846 void
847 AcpiDmDumpDbg2 (
848 ACPI_TABLE_HEADER *Table)
850 ACPI_STATUS Status;
851 ACPI_DBG2_DEVICE *SubTable;
852 UINT32 Length = Table->Length;
853 UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
854 UINT32 i;
855 UINT32 ArrayOffset;
856 UINT32 AbsoluteOffset;
857 UINT8 *Array;
860 /* Main table */
862 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
863 if (ACPI_FAILURE (Status))
865 return;
868 /* Subtables */
870 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
871 while (Offset < Table->Length)
873 AcpiOsPrintf ("\n");
874 Status = AcpiDmDumpTable (Length, Offset, SubTable,
875 SubTable->Length, AcpiDmTableInfoDbg2Device);
876 if (ACPI_FAILURE (Status))
878 return;
881 /* Dump the BaseAddress array */
883 for (i = 0; i < SubTable->RegisterCount; i++)
885 ArrayOffset = SubTable->BaseAddressOffset +
886 (sizeof (ACPI_GENERIC_ADDRESS) * i);
887 AbsoluteOffset = Offset + ArrayOffset;
888 Array = (UINT8 *) SubTable + ArrayOffset;
890 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
891 SubTable->Length, AcpiDmTableInfoDbg2Addr);
892 if (ACPI_FAILURE (Status))
894 return;
898 /* Dump the AddressSize array */
900 for (i = 0; i < SubTable->RegisterCount; i++)
902 ArrayOffset = SubTable->AddressSizeOffset +
903 (sizeof (UINT32) * i);
904 AbsoluteOffset = Offset + ArrayOffset;
905 Array = (UINT8 *) SubTable + ArrayOffset;
907 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
908 SubTable->Length, AcpiDmTableInfoDbg2Size);
909 if (ACPI_FAILURE (Status))
911 return;
915 /* Dump the Namestring (required) */
917 AcpiOsPrintf ("\n");
918 ArrayOffset = SubTable->NamepathOffset;
919 AbsoluteOffset = Offset + ArrayOffset;
920 Array = (UINT8 *) SubTable + ArrayOffset;
922 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
923 SubTable->Length, AcpiDmTableInfoDbg2Name);
924 if (ACPI_FAILURE (Status))
926 return;
929 /* Dump the OemData (optional) */
931 if (SubTable->OemDataOffset)
933 Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset,
934 Table, SubTable->OemDataLength,
935 AcpiDmTableInfoDbg2OemData);
936 if (ACPI_FAILURE (Status))
938 return;
942 /* Point to next subtable */
944 Offset += SubTable->Length;
945 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
946 SubTable->Length);
951 /*******************************************************************************
953 * FUNCTION: AcpiDmDumpDmar
955 * PARAMETERS: Table - A DMAR table
957 * RETURN: None
959 * DESCRIPTION: Format the contents of a DMAR. This table type consists
960 * of an open-ended number of subtables.
962 ******************************************************************************/
964 void
965 AcpiDmDumpDmar (
966 ACPI_TABLE_HEADER *Table)
968 ACPI_STATUS Status;
969 ACPI_DMAR_HEADER *SubTable;
970 UINT32 Length = Table->Length;
971 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
972 ACPI_DMTABLE_INFO *InfoTable;
973 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
974 UINT32 ScopeOffset;
975 UINT8 *PciPath;
976 UINT32 PathOffset;
979 /* Main table */
981 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
982 if (ACPI_FAILURE (Status))
984 return;
987 /* Subtables */
989 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
990 while (Offset < Table->Length)
992 /* Common subtable header */
994 AcpiOsPrintf ("\n");
995 Status = AcpiDmDumpTable (Length, Offset, SubTable,
996 SubTable->Length, AcpiDmTableInfoDmarHdr);
997 if (ACPI_FAILURE (Status))
999 return;
1002 AcpiOsPrintf ("\n");
1004 switch (SubTable->Type)
1006 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
1008 InfoTable = AcpiDmTableInfoDmar0;
1009 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
1010 break;
1012 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
1014 InfoTable = AcpiDmTableInfoDmar1;
1015 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
1016 break;
1018 case ACPI_DMAR_TYPE_ROOT_ATS:
1020 InfoTable = AcpiDmTableInfoDmar2;
1021 ScopeOffset = sizeof (ACPI_DMAR_ATSR);
1022 break;
1024 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
1026 InfoTable = AcpiDmTableInfoDmar3;
1027 ScopeOffset = sizeof (ACPI_DMAR_RHSA);
1028 break;
1030 case ACPI_DMAR_TYPE_NAMESPACE:
1032 InfoTable = AcpiDmTableInfoDmar4;
1033 ScopeOffset = sizeof (ACPI_DMAR_ANDD);
1034 break;
1036 default:
1038 AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
1039 SubTable->Type);
1040 return;
1043 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1044 SubTable->Length, InfoTable);
1045 if (ACPI_FAILURE (Status))
1047 return;
1051 * Dump the optional device scope entries
1053 if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1054 (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE))
1056 /* These types do not support device scopes */
1058 goto NextSubtable;
1061 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
1062 while (ScopeOffset < SubTable->Length)
1064 AcpiOsPrintf ("\n");
1065 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
1066 ScopeTable->Length, AcpiDmTableInfoDmarScope);
1067 if (ACPI_FAILURE (Status))
1069 return;
1071 AcpiOsPrintf ("\n");
1073 /* Dump the PCI Path entries for this device scope */
1075 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
1077 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
1078 sizeof (ACPI_DMAR_DEVICE_SCOPE));
1080 while (PathOffset < ScopeTable->Length)
1082 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2,
1083 "PCI Path");
1084 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
1086 /* Point to next PCI Path entry */
1088 PathOffset += 2;
1089 PciPath += 2;
1090 AcpiOsPrintf ("\n");
1093 /* Point to next device scope entry */
1095 ScopeOffset += ScopeTable->Length;
1096 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
1097 ScopeTable, ScopeTable->Length);
1100 NextSubtable:
1101 /* Point to next subtable */
1103 Offset += SubTable->Length;
1104 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable,
1105 SubTable->Length);
1110 /*******************************************************************************
1112 * FUNCTION: AcpiDmDumpDrtm
1114 * PARAMETERS: Table - A DRTM table
1116 * RETURN: None
1118 * DESCRIPTION: Format the contents of a DRTM.
1120 ******************************************************************************/
1122 void
1123 AcpiDmDumpDrtm (
1124 ACPI_TABLE_HEADER *Table)
1126 ACPI_STATUS Status;
1127 UINT32 Offset;
1128 ACPI_DRTM_VTABLE_LIST *DrtmVtl;
1129 ACPI_DRTM_RESOURCE_LIST *DrtmRl;
1130 ACPI_DRTM_DPS_ID *DrtmDps;
1131 UINT32 Count;
1134 /* Main table */
1136 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
1137 AcpiDmTableInfoDrtm);
1138 if (ACPI_FAILURE (Status))
1140 return;
1143 Offset = sizeof (ACPI_TABLE_DRTM);
1145 /* Sub-tables */
1147 /* Dump ValidatedTable length */
1149 DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
1150 AcpiOsPrintf ("\n");
1151 Status = AcpiDmDumpTable (Table->Length, Offset,
1152 DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
1153 AcpiDmTableInfoDrtm0);
1154 if (ACPI_FAILURE (Status))
1156 return;
1159 Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
1161 /* Dump Validated table addresses */
1163 Count = 0;
1164 while ((Offset < Table->Length) &&
1165 (DrtmVtl->ValidatedTableCount > Count))
1167 Status = AcpiDmDumpTable (Table->Length, Offset,
1168 ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
1169 AcpiDmTableInfoDrtm0a);
1170 if (ACPI_FAILURE (Status))
1172 return;
1175 Offset += sizeof (UINT64);
1176 Count++;
1179 /* Dump ResourceList length */
1181 DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
1182 AcpiOsPrintf ("\n");
1183 Status = AcpiDmDumpTable (Table->Length, Offset,
1184 DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
1185 AcpiDmTableInfoDrtm1);
1186 if (ACPI_FAILURE (Status))
1188 return;
1191 Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
1193 /* Dump the Resource List */
1195 Count = 0;
1196 while ((Offset < Table->Length) &&
1197 (DrtmRl->ResourceCount > Count))
1199 Status = AcpiDmDumpTable (Table->Length, Offset,
1200 ACPI_ADD_PTR (void, Table, Offset),
1201 sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
1202 if (ACPI_FAILURE (Status))
1204 return;
1207 Offset += sizeof (ACPI_DRTM_RESOURCE);
1208 Count++;
1211 /* Dump DPS */
1213 DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
1214 AcpiOsPrintf ("\n");
1215 (void) AcpiDmDumpTable (Table->Length, Offset,
1216 DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
1220 /*******************************************************************************
1222 * FUNCTION: AcpiDmDumpEinj
1224 * PARAMETERS: Table - A EINJ table
1226 * RETURN: None
1228 * DESCRIPTION: Format the contents of a EINJ. This table type consists
1229 * of an open-ended number of subtables.
1231 ******************************************************************************/
1233 void
1234 AcpiDmDumpEinj (
1235 ACPI_TABLE_HEADER *Table)
1237 ACPI_STATUS Status;
1238 ACPI_WHEA_HEADER *SubTable;
1239 UINT32 Length = Table->Length;
1240 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
1243 /* Main table */
1245 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
1246 if (ACPI_FAILURE (Status))
1248 return;
1251 /* Subtables */
1253 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1254 while (Offset < Table->Length)
1256 AcpiOsPrintf ("\n");
1257 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1258 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1259 if (ACPI_FAILURE (Status))
1261 return;
1264 /* Point to next subtable (each subtable is of fixed length) */
1266 Offset += sizeof (ACPI_WHEA_HEADER);
1267 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1268 sizeof (ACPI_WHEA_HEADER));
1273 /*******************************************************************************
1275 * FUNCTION: AcpiDmDumpErst
1277 * PARAMETERS: Table - A ERST table
1279 * RETURN: None
1281 * DESCRIPTION: Format the contents of a ERST. This table type consists
1282 * of an open-ended number of subtables.
1284 ******************************************************************************/
1286 void
1287 AcpiDmDumpErst (
1288 ACPI_TABLE_HEADER *Table)
1290 ACPI_STATUS Status;
1291 ACPI_WHEA_HEADER *SubTable;
1292 UINT32 Length = Table->Length;
1293 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
1296 /* Main table */
1298 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1299 if (ACPI_FAILURE (Status))
1301 return;
1304 /* Subtables */
1306 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1307 while (Offset < Table->Length)
1309 AcpiOsPrintf ("\n");
1310 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1311 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1312 if (ACPI_FAILURE (Status))
1314 return;
1317 /* Point to next subtable (each subtable is of fixed length) */
1319 Offset += sizeof (ACPI_WHEA_HEADER);
1320 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1321 sizeof (ACPI_WHEA_HEADER));
1326 /*******************************************************************************
1328 * FUNCTION: AcpiDmDumpFpdt
1330 * PARAMETERS: Table - A FPDT table
1332 * RETURN: None
1334 * DESCRIPTION: Format the contents of a FPDT. This table type consists
1335 * of an open-ended number of subtables.
1337 ******************************************************************************/
1339 void
1340 AcpiDmDumpFpdt (
1341 ACPI_TABLE_HEADER *Table)
1343 ACPI_STATUS Status;
1344 ACPI_FPDT_HEADER *SubTable;
1345 UINT32 Length = Table->Length;
1346 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
1347 ACPI_DMTABLE_INFO *InfoTable;
1350 /* There is no main table (other than the standard ACPI header) */
1352 /* Subtables */
1354 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1355 while (Offset < Table->Length)
1357 /* Common subtable header */
1359 AcpiOsPrintf ("\n");
1360 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1361 SubTable->Length, AcpiDmTableInfoFpdtHdr);
1362 if (ACPI_FAILURE (Status))
1364 return;
1367 switch (SubTable->Type)
1369 case ACPI_FPDT_TYPE_BOOT:
1371 InfoTable = AcpiDmTableInfoFpdt0;
1372 break;
1374 case ACPI_FPDT_TYPE_S3PERF:
1376 InfoTable = AcpiDmTableInfoFpdt1;
1377 break;
1379 default:
1381 AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
1382 SubTable->Type);
1384 /* Attempt to continue */
1386 if (!SubTable->Length)
1388 AcpiOsPrintf ("Invalid zero length subtable\n");
1389 return;
1391 goto NextSubTable;
1394 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1395 SubTable->Length, InfoTable);
1396 if (ACPI_FAILURE (Status))
1398 return;
1401 NextSubTable:
1402 /* Point to next subtable */
1404 Offset += SubTable->Length;
1405 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable,
1406 SubTable->Length);
1411 /*******************************************************************************
1413 * FUNCTION: AcpiDmDumpGtdt
1415 * PARAMETERS: Table - A GTDT table
1417 * RETURN: None
1419 * DESCRIPTION: Format the contents of a GTDT. This table type consists
1420 * of an open-ended number of subtables.
1422 ******************************************************************************/
1424 void
1425 AcpiDmDumpGtdt (
1426 ACPI_TABLE_HEADER *Table)
1428 ACPI_STATUS Status;
1429 ACPI_GTDT_HEADER *SubTable;
1430 UINT32 Length = Table->Length;
1431 UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
1432 ACPI_DMTABLE_INFO *InfoTable;
1433 UINT32 SubTableLength;
1434 UINT32 GtCount;
1435 ACPI_GTDT_TIMER_ENTRY *GtxTable;
1438 /* Main table */
1440 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
1441 if (ACPI_FAILURE (Status))
1443 return;
1446 /* Subtables */
1448 SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
1449 while (Offset < Table->Length)
1451 /* Common subtable header */
1453 AcpiOsPrintf ("\n");
1454 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1455 SubTable->Length, AcpiDmTableInfoGtdtHdr);
1456 if (ACPI_FAILURE (Status))
1458 return;
1461 GtCount = 0;
1462 switch (SubTable->Type)
1464 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1466 SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
1467 GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1468 SubTable))->TimerCount;
1470 InfoTable = AcpiDmTableInfoGtdt0;
1471 break;
1473 case ACPI_GTDT_TYPE_WATCHDOG:
1475 SubTableLength = sizeof (ACPI_GTDT_WATCHDOG);
1477 InfoTable = AcpiDmTableInfoGtdt1;
1478 break;
1480 default:
1482 /* Cannot continue on unknown type - no length */
1484 AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n",
1485 SubTable->Type);
1486 return;
1489 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1490 SubTable->Length, InfoTable);
1491 if (ACPI_FAILURE (Status))
1493 return;
1496 /* Point to end of current subtable (each subtable above is of fixed length) */
1498 Offset += SubTableLength;
1500 /* If there are any Gt Timer Blocks from above, dump them now */
1502 if (GtCount)
1504 GtxTable = ACPI_ADD_PTR (
1505 ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
1506 SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
1508 while (GtCount)
1510 AcpiOsPrintf ("\n");
1511 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
1512 sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
1513 if (ACPI_FAILURE (Status))
1515 return;
1517 Offset += sizeof (ACPI_GTDT_TIMER_ENTRY);
1518 GtxTable++;
1519 GtCount--;
1523 /* Point to next subtable */
1525 SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength);
1530 /*******************************************************************************
1532 * FUNCTION: AcpiDmDumpHest
1534 * PARAMETERS: Table - A HEST table
1536 * RETURN: None
1538 * DESCRIPTION: Format the contents of a HEST. This table type consists
1539 * of an open-ended number of subtables.
1541 ******************************************************************************/
1543 void
1544 AcpiDmDumpHest (
1545 ACPI_TABLE_HEADER *Table)
1547 ACPI_STATUS Status;
1548 ACPI_HEST_HEADER *SubTable;
1549 UINT32 Length = Table->Length;
1550 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
1551 ACPI_DMTABLE_INFO *InfoTable;
1552 UINT32 SubTableLength;
1553 UINT32 BankCount;
1554 ACPI_HEST_IA_ERROR_BANK *BankTable;
1557 /* Main table */
1559 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1560 if (ACPI_FAILURE (Status))
1562 return;
1565 /* Subtables */
1567 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1568 while (Offset < Table->Length)
1570 BankCount = 0;
1571 switch (SubTable->Type)
1573 case ACPI_HEST_TYPE_IA32_CHECK:
1575 InfoTable = AcpiDmTableInfoHest0;
1576 SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1577 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1578 SubTable))->NumHardwareBanks;
1579 break;
1581 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1583 InfoTable = AcpiDmTableInfoHest1;
1584 SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1585 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1586 SubTable))->NumHardwareBanks;
1587 break;
1589 case ACPI_HEST_TYPE_IA32_NMI:
1591 InfoTable = AcpiDmTableInfoHest2;
1592 SubTableLength = sizeof (ACPI_HEST_IA_NMI);
1593 break;
1595 case ACPI_HEST_TYPE_AER_ROOT_PORT:
1597 InfoTable = AcpiDmTableInfoHest6;
1598 SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
1599 break;
1601 case ACPI_HEST_TYPE_AER_ENDPOINT:
1603 InfoTable = AcpiDmTableInfoHest7;
1604 SubTableLength = sizeof (ACPI_HEST_AER);
1605 break;
1607 case ACPI_HEST_TYPE_AER_BRIDGE:
1609 InfoTable = AcpiDmTableInfoHest8;
1610 SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1611 break;
1613 case ACPI_HEST_TYPE_GENERIC_ERROR:
1615 InfoTable = AcpiDmTableInfoHest9;
1616 SubTableLength = sizeof (ACPI_HEST_GENERIC);
1617 break;
1619 case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1621 InfoTable = AcpiDmTableInfoHest10;
1622 SubTableLength = sizeof (ACPI_HEST_GENERIC_V2);
1623 break;
1625 default:
1627 /* Cannot continue on unknown type - no length */
1629 AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
1630 SubTable->Type);
1631 return;
1634 AcpiOsPrintf ("\n");
1635 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1636 SubTableLength, InfoTable);
1637 if (ACPI_FAILURE (Status))
1639 return;
1642 /* Point to end of current subtable (each subtable above is of fixed length) */
1644 Offset += SubTableLength;
1646 /* If there are any (fixed-length) Error Banks from above, dump them now */
1648 if (BankCount)
1650 BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable,
1651 SubTableLength);
1652 SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1654 while (BankCount)
1656 AcpiOsPrintf ("\n");
1657 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1658 sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1659 if (ACPI_FAILURE (Status))
1661 return;
1664 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1665 BankTable++;
1666 BankCount--;
1670 /* Point to next subtable */
1672 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
1677 /*******************************************************************************
1679 * FUNCTION: AcpiDmDumpIort
1681 * PARAMETERS: Table - A IORT table
1683 * RETURN: None
1685 * DESCRIPTION: Format the contents of a IORT
1687 ******************************************************************************/
1689 void
1690 AcpiDmDumpIort (
1691 ACPI_TABLE_HEADER *Table)
1693 ACPI_STATUS Status;
1694 ACPI_TABLE_IORT *Iort;
1695 ACPI_IORT_NODE *IortNode;
1696 ACPI_IORT_ITS_GROUP *IortItsGroup = NULL;
1697 ACPI_IORT_SMMU *IortSmmu = NULL;
1698 UINT32 Offset;
1699 UINT32 NodeOffset;
1700 UINT32 Length;
1701 ACPI_DMTABLE_INFO *InfoTable;
1702 char *String;
1703 UINT32 i;
1706 /* Main table */
1708 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
1709 if (ACPI_FAILURE (Status))
1711 return;
1714 Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
1715 Offset = sizeof (ACPI_TABLE_IORT);
1717 /* Dump the OptionalPadding (optional) */
1719 if (Iort->NodeOffset > Offset)
1721 Status = AcpiDmDumpTable (Table->Length, Offset, Table,
1722 Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
1723 if (ACPI_FAILURE (Status))
1725 return;
1729 Offset = Iort->NodeOffset;
1730 while (Offset < Table->Length)
1732 /* Common subtable header */
1734 IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
1735 AcpiOsPrintf ("\n");
1736 Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
1737 Status = AcpiDmDumpTable (Table->Length, Offset,
1738 IortNode, Length, AcpiDmTableInfoIortHdr);
1739 if (ACPI_FAILURE (Status))
1741 return;
1744 NodeOffset = Length;
1746 switch (IortNode->Type)
1748 case ACPI_IORT_NODE_ITS_GROUP:
1750 InfoTable = AcpiDmTableInfoIort0;
1751 Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
1752 IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
1753 break;
1755 case ACPI_IORT_NODE_NAMED_COMPONENT:
1757 InfoTable = AcpiDmTableInfoIort1;
1758 Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
1759 String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
1760 Length += strlen (String) + 1;
1761 break;
1763 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
1765 InfoTable = AcpiDmTableInfoIort2;
1766 Length = IortNode->Length - NodeOffset;
1767 break;
1769 case ACPI_IORT_NODE_SMMU:
1771 InfoTable = AcpiDmTableInfoIort3;
1772 Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
1773 IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
1774 break;
1776 case ACPI_IORT_NODE_SMMU_V3:
1778 InfoTable = AcpiDmTableInfoIort4;
1779 Length = IortNode->Length - NodeOffset;
1780 break;
1782 default:
1784 AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
1785 IortNode->Type);
1787 /* Attempt to continue */
1789 if (!IortNode->Length)
1791 AcpiOsPrintf ("Invalid zero length IORT node\n");
1792 return;
1794 goto NextSubTable;
1797 /* Dump the node subtable header */
1799 AcpiOsPrintf ("\n");
1800 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1801 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1802 Length, InfoTable);
1803 if (ACPI_FAILURE (Status))
1805 return;
1808 NodeOffset += Length;
1810 /* Dump the node specific data */
1812 switch (IortNode->Type)
1814 case ACPI_IORT_NODE_ITS_GROUP:
1816 /* Validate IortItsGroup to avoid compiler warnings */
1818 if (IortItsGroup)
1820 for (i = 0; i < IortItsGroup->ItsCount; i++)
1822 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1823 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1824 4, AcpiDmTableInfoIort0a);
1825 NodeOffset += 4;
1828 break;
1830 case ACPI_IORT_NODE_NAMED_COMPONENT:
1832 /* Dump the Padding (optional) */
1834 if (IortNode->Length > NodeOffset)
1836 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1837 Table, IortNode->Length - NodeOffset,
1838 AcpiDmTableInfoIort1a);
1839 if (ACPI_FAILURE (Status))
1841 return;
1844 break;
1846 case ACPI_IORT_NODE_SMMU:
1848 AcpiOsPrintf ("\n");
1850 /* Validate IortSmmu to avoid compiler warnings */
1852 if (IortSmmu)
1854 Length = 2 * sizeof (UINT64);
1855 NodeOffset = IortSmmu->GlobalInterruptOffset;
1856 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1857 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1858 Length, AcpiDmTableInfoIort3a);
1859 if (ACPI_FAILURE (Status))
1861 return;
1864 NodeOffset = IortSmmu->ContextInterruptOffset;
1865 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
1867 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1868 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1869 8, AcpiDmTableInfoIort3b);
1870 if (ACPI_FAILURE (Status))
1872 return;
1875 NodeOffset += 8;
1878 NodeOffset = IortSmmu->PmuInterruptOffset;
1879 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
1881 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1882 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1883 8, AcpiDmTableInfoIort3c);
1884 if (ACPI_FAILURE (Status))
1886 return;
1889 NodeOffset += 8;
1892 break;
1894 default:
1896 break;
1899 /* Dump the ID mappings */
1901 NodeOffset = IortNode->MappingOffset;
1902 for (i = 0; i < IortNode->MappingCount; i++)
1904 AcpiOsPrintf ("\n");
1905 Length = sizeof (ACPI_IORT_ID_MAPPING);
1906 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
1907 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
1908 Length, AcpiDmTableInfoIortMap);
1909 if (ACPI_FAILURE (Status))
1911 return;
1914 NodeOffset += Length;
1917 NextSubTable:
1918 /* Point to next node subtable */
1920 Offset += IortNode->Length;
1921 IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
1926 /*******************************************************************************
1928 * FUNCTION: AcpiDmDumpIvrs
1930 * PARAMETERS: Table - A IVRS table
1932 * RETURN: None
1934 * DESCRIPTION: Format the contents of a IVRS
1936 ******************************************************************************/
1938 static UINT8 EntrySizes[] = {4,8,16,32};
1940 void
1941 AcpiDmDumpIvrs (
1942 ACPI_TABLE_HEADER *Table)
1944 ACPI_STATUS Status;
1945 UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
1946 UINT32 EntryOffset;
1947 UINT32 EntryLength;
1948 UINT32 EntryType;
1949 ACPI_IVRS_DE_HEADER *DeviceEntry;
1950 ACPI_IVRS_HEADER *SubTable;
1951 ACPI_DMTABLE_INFO *InfoTable;
1954 /* Main table */
1956 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
1957 if (ACPI_FAILURE (Status))
1959 return;
1962 /* Subtables */
1964 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
1965 while (Offset < Table->Length)
1967 /* Common subtable header */
1969 AcpiOsPrintf ("\n");
1970 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1971 SubTable->Length, AcpiDmTableInfoIvrsHdr);
1972 if (ACPI_FAILURE (Status))
1974 return;
1977 switch (SubTable->Type)
1979 case ACPI_IVRS_TYPE_HARDWARE:
1981 InfoTable = AcpiDmTableInfoIvrs0;
1982 break;
1984 case ACPI_IVRS_TYPE_MEMORY1:
1985 case ACPI_IVRS_TYPE_MEMORY2:
1986 case ACPI_IVRS_TYPE_MEMORY3:
1988 InfoTable = AcpiDmTableInfoIvrs1;
1989 break;
1991 default:
1993 AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
1994 SubTable->Type);
1996 /* Attempt to continue */
1998 if (!SubTable->Length)
2000 AcpiOsPrintf ("Invalid zero length subtable\n");
2001 return;
2003 goto NextSubTable;
2006 /* Dump the subtable */
2008 AcpiOsPrintf ("\n");
2009 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2010 SubTable->Length, InfoTable);
2011 if (ACPI_FAILURE (Status))
2013 return;
2016 /* The hardware subtable can contain multiple device entries */
2018 if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
2020 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
2021 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
2022 sizeof (ACPI_IVRS_HARDWARE));
2024 while (EntryOffset < (Offset + SubTable->Length))
2026 AcpiOsPrintf ("\n");
2028 * Upper 2 bits of Type encode the length of the device entry
2030 * 00 = 4 byte
2031 * 01 = 8 byte
2032 * 10 = 16 byte - currently no entries defined
2033 * 11 = 32 byte - currently no entries defined
2035 EntryType = DeviceEntry->Type;
2036 EntryLength = EntrySizes [EntryType >> 6];
2038 switch (EntryType)
2040 /* 4-byte device entries */
2042 case ACPI_IVRS_TYPE_PAD4:
2043 case ACPI_IVRS_TYPE_ALL:
2044 case ACPI_IVRS_TYPE_SELECT:
2045 case ACPI_IVRS_TYPE_START:
2046 case ACPI_IVRS_TYPE_END:
2048 InfoTable = AcpiDmTableInfoIvrs4;
2049 break;
2051 /* 8-byte entries, type A */
2053 case ACPI_IVRS_TYPE_ALIAS_SELECT:
2054 case ACPI_IVRS_TYPE_ALIAS_START:
2056 InfoTable = AcpiDmTableInfoIvrs8a;
2057 break;
2059 /* 8-byte entries, type B */
2061 case ACPI_IVRS_TYPE_PAD8:
2062 case ACPI_IVRS_TYPE_EXT_SELECT:
2063 case ACPI_IVRS_TYPE_EXT_START:
2065 InfoTable = AcpiDmTableInfoIvrs8b;
2066 break;
2068 /* 8-byte entries, type C */
2070 case ACPI_IVRS_TYPE_SPECIAL:
2072 InfoTable = AcpiDmTableInfoIvrs8c;
2073 break;
2075 default:
2076 InfoTable = AcpiDmTableInfoIvrs4;
2077 AcpiOsPrintf (
2078 "\n**** Unknown IVRS device entry type/length: "
2079 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
2080 EntryType, EntryLength, EntryOffset);
2081 break;
2084 /* Dump the Device Entry */
2086 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
2087 DeviceEntry, EntryLength, InfoTable);
2088 if (ACPI_FAILURE (Status))
2090 return;
2093 EntryOffset += EntryLength;
2094 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
2095 EntryLength);
2099 NextSubTable:
2100 /* Point to next subtable */
2102 Offset += SubTable->Length;
2103 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
2108 /*******************************************************************************
2110 * FUNCTION: AcpiDmDumpLpit
2112 * PARAMETERS: Table - A LPIT table
2114 * RETURN: None
2116 * DESCRIPTION: Format the contents of a LPIT. This table type consists
2117 * of an open-ended number of subtables. Note: There are no
2118 * entries in the main table. An LPIT consists of the table
2119 * header and then subtables only.
2121 ******************************************************************************/
2123 void
2124 AcpiDmDumpLpit (
2125 ACPI_TABLE_HEADER *Table)
2127 ACPI_STATUS Status;
2128 ACPI_LPIT_HEADER *SubTable;
2129 UINT32 Length = Table->Length;
2130 UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
2131 ACPI_DMTABLE_INFO *InfoTable;
2132 UINT32 SubTableLength;
2135 /* Subtables */
2137 SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
2138 while (Offset < Table->Length)
2140 /* Common subtable header */
2142 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2143 sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
2144 if (ACPI_FAILURE (Status))
2146 return;
2149 switch (SubTable->Type)
2151 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
2153 InfoTable = AcpiDmTableInfoLpit0;
2154 SubTableLength = sizeof (ACPI_LPIT_NATIVE);
2155 break;
2157 default:
2159 /* Cannot continue on unknown type - no length */
2161 AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
2162 SubTable->Type);
2163 return;
2166 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2167 SubTableLength, InfoTable);
2168 if (ACPI_FAILURE (Status))
2170 return;
2173 AcpiOsPrintf ("\n");
2175 /* Point to next subtable */
2177 Offset += SubTableLength;
2178 SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength);
2183 /*******************************************************************************
2185 * FUNCTION: AcpiDmDumpMadt
2187 * PARAMETERS: Table - A MADT table
2189 * RETURN: None
2191 * DESCRIPTION: Format the contents of a MADT. This table type consists
2192 * of an open-ended number of subtables.
2194 ******************************************************************************/
2196 void
2197 AcpiDmDumpMadt (
2198 ACPI_TABLE_HEADER *Table)
2200 ACPI_STATUS Status;
2201 ACPI_SUBTABLE_HEADER *SubTable;
2202 UINT32 Length = Table->Length;
2203 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
2204 ACPI_DMTABLE_INFO *InfoTable;
2207 /* Main table */
2209 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
2210 if (ACPI_FAILURE (Status))
2212 return;
2215 /* Subtables */
2217 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2218 while (Offset < Table->Length)
2220 /* Common subtable header */
2222 AcpiOsPrintf ("\n");
2223 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2224 SubTable->Length, AcpiDmTableInfoMadtHdr);
2225 if (ACPI_FAILURE (Status))
2227 return;
2230 switch (SubTable->Type)
2232 case ACPI_MADT_TYPE_LOCAL_APIC:
2234 InfoTable = AcpiDmTableInfoMadt0;
2235 break;
2237 case ACPI_MADT_TYPE_IO_APIC:
2239 InfoTable = AcpiDmTableInfoMadt1;
2240 break;
2242 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
2244 InfoTable = AcpiDmTableInfoMadt2;
2245 break;
2247 case ACPI_MADT_TYPE_NMI_SOURCE:
2249 InfoTable = AcpiDmTableInfoMadt3;
2250 break;
2252 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
2254 InfoTable = AcpiDmTableInfoMadt4;
2255 break;
2257 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
2259 InfoTable = AcpiDmTableInfoMadt5;
2260 break;
2262 case ACPI_MADT_TYPE_IO_SAPIC:
2264 InfoTable = AcpiDmTableInfoMadt6;
2265 break;
2267 case ACPI_MADT_TYPE_LOCAL_SAPIC:
2269 InfoTable = AcpiDmTableInfoMadt7;
2270 break;
2272 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
2274 InfoTable = AcpiDmTableInfoMadt8;
2275 break;
2277 case ACPI_MADT_TYPE_LOCAL_X2APIC:
2279 InfoTable = AcpiDmTableInfoMadt9;
2280 break;
2282 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
2284 InfoTable = AcpiDmTableInfoMadt10;
2285 break;
2287 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
2289 InfoTable = AcpiDmTableInfoMadt11;
2290 break;
2292 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
2294 InfoTable = AcpiDmTableInfoMadt12;
2295 break;
2297 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
2299 InfoTable = AcpiDmTableInfoMadt13;
2300 break;
2302 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
2304 InfoTable = AcpiDmTableInfoMadt14;
2305 break;
2307 case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
2309 InfoTable = AcpiDmTableInfoMadt15;
2310 break;
2312 default:
2314 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
2315 SubTable->Type);
2317 /* Attempt to continue */
2319 if (!SubTable->Length)
2321 AcpiOsPrintf ("Invalid zero length subtable\n");
2322 return;
2325 goto NextSubTable;
2328 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2329 SubTable->Length, InfoTable);
2330 if (ACPI_FAILURE (Status))
2332 return;
2335 NextSubTable:
2336 /* Point to next subtable */
2338 Offset += SubTable->Length;
2339 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
2340 SubTable->Length);
2345 /*******************************************************************************
2347 * FUNCTION: AcpiDmDumpMcfg
2349 * PARAMETERS: Table - A MCFG Table
2351 * RETURN: None
2353 * DESCRIPTION: Format the contents of a MCFG table
2355 ******************************************************************************/
2357 void
2358 AcpiDmDumpMcfg (
2359 ACPI_TABLE_HEADER *Table)
2361 ACPI_STATUS Status;
2362 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
2363 ACPI_MCFG_ALLOCATION *SubTable;
2366 /* Main table */
2368 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
2369 if (ACPI_FAILURE (Status))
2371 return;
2374 /* Subtables */
2376 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
2377 while (Offset < Table->Length)
2379 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
2381 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
2382 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
2383 return;
2386 AcpiOsPrintf ("\n");
2387 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2388 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
2389 if (ACPI_FAILURE (Status))
2391 return;
2394 /* Point to next subtable (each subtable is of fixed length) */
2396 Offset += sizeof (ACPI_MCFG_ALLOCATION);
2397 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
2398 sizeof (ACPI_MCFG_ALLOCATION));
2403 /*******************************************************************************
2405 * FUNCTION: AcpiDmDumpMpst
2407 * PARAMETERS: Table - A MPST Table
2409 * RETURN: None
2411 * DESCRIPTION: Format the contents of a MPST table
2413 ******************************************************************************/
2415 void
2416 AcpiDmDumpMpst (
2417 ACPI_TABLE_HEADER *Table)
2419 ACPI_STATUS Status;
2420 UINT32 Offset = sizeof (ACPI_TABLE_MPST);
2421 ACPI_MPST_POWER_NODE *SubTable0;
2422 ACPI_MPST_POWER_STATE *SubTable0A;
2423 ACPI_MPST_COMPONENT *SubTable0B;
2424 ACPI_MPST_DATA_HDR *SubTable1;
2425 ACPI_MPST_POWER_DATA *SubTable2;
2426 UINT16 SubtableCount;
2427 UINT32 PowerStateCount;
2428 UINT32 ComponentCount;
2431 /* Main table */
2433 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
2434 if (ACPI_FAILURE (Status))
2436 return;
2439 /* Subtable: Memory Power Node(s) */
2441 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
2442 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
2444 while ((Offset < Table->Length) && SubtableCount)
2446 AcpiOsPrintf ("\n");
2447 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
2448 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
2449 if (ACPI_FAILURE (Status))
2451 return;
2454 /* Extract the sub-subtable counts */
2456 PowerStateCount = SubTable0->NumPowerStates;
2457 ComponentCount = SubTable0->NumPhysicalComponents;
2458 Offset += sizeof (ACPI_MPST_POWER_NODE);
2460 /* Sub-subtables - Memory Power State Structure(s) */
2462 SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
2463 sizeof (ACPI_MPST_POWER_NODE));
2465 while (PowerStateCount)
2467 AcpiOsPrintf ("\n");
2468 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
2469 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
2470 if (ACPI_FAILURE (Status))
2472 return;
2475 SubTable0A++;
2476 PowerStateCount--;
2477 Offset += sizeof (ACPI_MPST_POWER_STATE);
2480 /* Sub-subtables - Physical Component ID Structure(s) */
2482 SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
2484 if (ComponentCount)
2486 AcpiOsPrintf ("\n");
2489 while (ComponentCount)
2491 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
2492 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
2493 if (ACPI_FAILURE (Status))
2495 return;
2498 SubTable0B++;
2499 ComponentCount--;
2500 Offset += sizeof (ACPI_MPST_COMPONENT);
2503 /* Point to next Memory Power Node subtable */
2505 SubtableCount--;
2506 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
2507 sizeof (ACPI_MPST_POWER_NODE) +
2508 (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
2509 (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
2512 /* Subtable: Count of Memory Power State Characteristic structures */
2514 AcpiOsPrintf ("\n");
2515 SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
2516 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
2517 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
2518 if (ACPI_FAILURE (Status))
2520 return;
2523 SubtableCount = SubTable1->CharacteristicsCount;
2524 Offset += sizeof (ACPI_MPST_DATA_HDR);
2526 /* Subtable: Memory Power State Characteristics structure(s) */
2528 SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1,
2529 sizeof (ACPI_MPST_DATA_HDR));
2531 while ((Offset < Table->Length) && SubtableCount)
2533 AcpiOsPrintf ("\n");
2534 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
2535 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
2536 if (ACPI_FAILURE (Status))
2538 return;
2541 SubTable2++;
2542 SubtableCount--;
2543 Offset += sizeof (ACPI_MPST_POWER_DATA);
2548 /*******************************************************************************
2550 * FUNCTION: AcpiDmDumpMsct
2552 * PARAMETERS: Table - A MSCT table
2554 * RETURN: None
2556 * DESCRIPTION: Format the contents of a MSCT
2558 ******************************************************************************/
2560 void
2561 AcpiDmDumpMsct (
2562 ACPI_TABLE_HEADER *Table)
2564 ACPI_STATUS Status;
2565 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
2566 ACPI_MSCT_PROXIMITY *SubTable;
2569 /* Main table */
2571 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
2572 if (ACPI_FAILURE (Status))
2574 return;
2577 /* Subtables */
2579 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
2580 while (Offset < Table->Length)
2582 /* Common subtable header */
2584 AcpiOsPrintf ("\n");
2585 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2586 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
2587 if (ACPI_FAILURE (Status))
2589 return;
2592 /* Point to next subtable */
2594 Offset += sizeof (ACPI_MSCT_PROXIMITY);
2595 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable,
2596 sizeof (ACPI_MSCT_PROXIMITY));
2601 /*******************************************************************************
2603 * FUNCTION: AcpiDmDumpMtmr
2605 * PARAMETERS: Table - A MTMR table
2607 * RETURN: None
2609 * DESCRIPTION: Format the contents of a MTMR
2611 ******************************************************************************/
2613 void
2614 AcpiDmDumpMtmr (
2615 ACPI_TABLE_HEADER *Table)
2617 ACPI_STATUS Status;
2618 UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
2619 ACPI_MTMR_ENTRY *SubTable;
2622 /* Main table */
2624 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
2625 if (ACPI_FAILURE (Status))
2627 return;
2630 /* Subtables */
2632 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
2633 while (Offset < Table->Length)
2635 /* Common subtable header */
2637 AcpiOsPrintf ("\n");
2638 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2639 sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
2640 if (ACPI_FAILURE (Status))
2642 return;
2645 /* Point to next subtable */
2647 Offset += sizeof (ACPI_MTMR_ENTRY);
2648 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable,
2649 sizeof (ACPI_MTMR_ENTRY));
2654 /*******************************************************************************
2656 * FUNCTION: AcpiDmDumpNfit
2658 * PARAMETERS: Table - A NFIT table
2660 * RETURN: None
2662 * DESCRIPTION: Format the contents of an NFIT.
2664 ******************************************************************************/
2666 void
2667 AcpiDmDumpNfit (
2668 ACPI_TABLE_HEADER *Table)
2670 ACPI_STATUS Status;
2671 UINT32 Offset = sizeof (ACPI_TABLE_NFIT);
2672 UINT32 FieldOffset = 0;
2673 UINT32 Length;
2674 ACPI_NFIT_HEADER *SubTable;
2675 ACPI_DMTABLE_INFO *InfoTable;
2676 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
2677 ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
2678 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
2679 UINT32 i;
2682 /* Main table */
2684 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
2685 if (ACPI_FAILURE (Status))
2687 return;
2690 /* Subtables */
2692 SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
2693 while (Offset < Table->Length)
2695 /* NFIT subtable header */
2697 AcpiOsPrintf ("\n");
2698 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2699 SubTable->Length, AcpiDmTableInfoNfitHdr);
2700 if (ACPI_FAILURE (Status))
2702 return;
2705 switch (SubTable->Type)
2707 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
2709 InfoTable = AcpiDmTableInfoNfit0;
2710 break;
2712 case ACPI_NFIT_TYPE_MEMORY_MAP:
2714 InfoTable = AcpiDmTableInfoNfit1;
2715 break;
2717 case ACPI_NFIT_TYPE_INTERLEAVE:
2719 /* Has a variable number of 32-bit values at the end */
2721 InfoTable = AcpiDmTableInfoNfit2;
2722 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable);
2723 FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
2724 break;
2726 case ACPI_NFIT_TYPE_SMBIOS:
2728 SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable);
2729 InfoTable = AcpiDmTableInfoNfit3;
2730 break;
2732 case ACPI_NFIT_TYPE_CONTROL_REGION:
2734 InfoTable = AcpiDmTableInfoNfit4;
2735 break;
2737 case ACPI_NFIT_TYPE_DATA_REGION:
2739 InfoTable = AcpiDmTableInfoNfit5;
2740 break;
2742 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
2744 /* Has a variable number of 64-bit addresses at the end */
2746 InfoTable = AcpiDmTableInfoNfit6;
2747 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable);
2748 FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
2749 break;
2751 default:
2752 AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
2753 SubTable->Type);
2755 /* Attempt to continue */
2757 if (!SubTable->Length)
2759 AcpiOsPrintf ("Invalid zero length subtable\n");
2760 return;
2762 goto NextSubTable;
2765 AcpiOsPrintf ("\n");
2766 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2767 SubTable->Length, InfoTable);
2768 if (ACPI_FAILURE (Status))
2770 return;
2773 /* Per-subtable variable-length fields */
2775 switch (SubTable->Type)
2777 case ACPI_NFIT_TYPE_INTERLEAVE:
2779 for (i = 0; i < Interleave->LineCount; i++)
2781 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
2782 &Interleave->LineOffset[i],
2783 sizeof (UINT32), AcpiDmTableInfoNfit2a);
2784 if (ACPI_FAILURE (Status))
2786 return;
2789 FieldOffset += sizeof (UINT32);
2791 break;
2793 case ACPI_NFIT_TYPE_SMBIOS:
2795 Length = SubTable->Length -
2796 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
2798 if (Length)
2800 Status = AcpiDmDumpTable (Table->Length,
2801 sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
2802 SmbiosInfo,
2803 Length, AcpiDmTableInfoNfit3a);
2804 if (ACPI_FAILURE (Status))
2806 return;
2810 break;
2812 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
2814 for (i = 0; i < Hint->HintCount; i++)
2816 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
2817 &Hint->HintAddress[i],
2818 sizeof (UINT64), AcpiDmTableInfoNfit6a);
2819 if (ACPI_FAILURE (Status))
2821 return;
2824 FieldOffset += sizeof (UINT64);
2826 break;
2828 default:
2829 break;
2832 NextSubTable:
2833 /* Point to next subtable */
2835 Offset += SubTable->Length;
2836 SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length);
2841 /*******************************************************************************
2843 * FUNCTION: AcpiDmDumpPcct
2845 * PARAMETERS: Table - A PCCT table
2847 * RETURN: None
2849 * DESCRIPTION: Format the contents of a PCCT. This table type consists
2850 * of an open-ended number of subtables.
2852 ******************************************************************************/
2854 void
2855 AcpiDmDumpPcct (
2856 ACPI_TABLE_HEADER *Table)
2858 ACPI_STATUS Status;
2859 ACPI_PCCT_SUBSPACE *SubTable;
2860 ACPI_DMTABLE_INFO *InfoTable;
2861 UINT32 Length = Table->Length;
2862 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
2865 /* Main table */
2867 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
2868 if (ACPI_FAILURE (Status))
2870 return;
2873 /* Subtables */
2875 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
2876 while (Offset < Table->Length)
2878 /* Common subtable header */
2880 AcpiOsPrintf ("\n");
2881 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2882 SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
2883 if (ACPI_FAILURE (Status))
2885 return;
2888 switch (SubTable->Header.Type)
2890 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
2892 InfoTable = AcpiDmTableInfoPcct0;
2893 break;
2895 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
2897 InfoTable = AcpiDmTableInfoPcct1;
2898 break;
2900 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
2902 InfoTable = AcpiDmTableInfoPcct2;
2903 break;
2905 default:
2907 AcpiOsPrintf (
2908 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
2909 SubTable->Header.Type);
2910 return;
2913 AcpiOsPrintf ("\n");
2914 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2915 SubTable->Header.Length, InfoTable);
2916 if (ACPI_FAILURE (Status))
2918 return;
2921 /* Point to next subtable */
2923 Offset += SubTable->Header.Length;
2924 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
2925 SubTable->Header.Length);
2930 /*******************************************************************************
2932 * FUNCTION: AcpiDmDumpPmtt
2934 * PARAMETERS: Table - A PMTT table
2936 * RETURN: None
2938 * DESCRIPTION: Format the contents of a PMTT. This table type consists
2939 * of an open-ended number of subtables.
2941 ******************************************************************************/
2943 void
2944 AcpiDmDumpPmtt (
2945 ACPI_TABLE_HEADER *Table)
2947 ACPI_STATUS Status;
2948 ACPI_PMTT_HEADER *SubTable;
2949 ACPI_PMTT_HEADER *MemSubTable;
2950 ACPI_PMTT_HEADER *DimmSubTable;
2951 ACPI_PMTT_DOMAIN *DomainArray;
2952 UINT32 Length = Table->Length;
2953 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
2954 UINT32 MemOffset;
2955 UINT32 DimmOffset;
2956 UINT32 DomainOffset;
2957 UINT32 DomainCount;
2960 /* Main table */
2962 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2963 if (ACPI_FAILURE (Status))
2965 return;
2968 /* Subtables */
2970 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2971 while (Offset < Table->Length)
2973 /* Common subtable header */
2975 AcpiOsPrintf ("\n");
2976 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2977 SubTable->Length, AcpiDmTableInfoPmttHdr);
2978 if (ACPI_FAILURE (Status))
2980 return;
2983 /* Only Socket subtables are expected at this level */
2985 if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
2987 AcpiOsPrintf (
2988 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2989 SubTable->Type);
2990 return;
2993 /* Dump the fixed-length portion of the subtable */
2995 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2996 SubTable->Length, AcpiDmTableInfoPmtt0);
2997 if (ACPI_FAILURE (Status))
2999 return;
3002 /* Walk the memory controller subtables */
3004 MemOffset = sizeof (ACPI_PMTT_SOCKET);
3005 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
3006 sizeof (ACPI_PMTT_SOCKET));
3008 while (((Offset + MemOffset) < Table->Length) &&
3009 (MemOffset < SubTable->Length))
3011 /* Common subtable header */
3013 AcpiOsPrintf ("\n");
3014 Status = AcpiDmDumpTable (Length,
3015 Offset + MemOffset, MemSubTable,
3016 MemSubTable->Length, AcpiDmTableInfoPmttHdr);
3017 if (ACPI_FAILURE (Status))
3019 return;
3022 /* Only memory controller subtables are expected at this level */
3024 if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
3026 AcpiOsPrintf (
3027 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3028 MemSubTable->Type);
3029 return;
3032 /* Dump the fixed-length portion of the controller subtable */
3034 Status = AcpiDmDumpTable (Length,
3035 Offset + MemOffset, MemSubTable,
3036 MemSubTable->Length, AcpiDmTableInfoPmtt1);
3037 if (ACPI_FAILURE (Status))
3039 return;
3042 /* Walk the variable count of proximity domains */
3044 DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
3045 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
3046 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
3047 sizeof (ACPI_PMTT_CONTROLLER));
3049 while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
3050 ((MemOffset + DomainOffset) < SubTable->Length) &&
3051 DomainCount)
3053 Status = AcpiDmDumpTable (Length,
3054 Offset + MemOffset + DomainOffset, DomainArray,
3055 sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
3056 if (ACPI_FAILURE (Status))
3058 return;
3061 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
3062 DomainArray++;
3063 DomainCount--;
3066 if (DomainCount)
3068 AcpiOsPrintf (
3069 "\n**** DomainCount exceeds subtable length\n\n");
3072 /* Walk the physical component (DIMM) subtables */
3074 DimmOffset = DomainOffset;
3075 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
3076 DomainOffset);
3078 while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
3079 (DimmOffset < MemSubTable->Length))
3081 /* Common subtable header */
3083 AcpiOsPrintf ("\n");
3084 Status = AcpiDmDumpTable (Length,
3085 Offset + MemOffset + DimmOffset, DimmSubTable,
3086 DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
3087 if (ACPI_FAILURE (Status))
3089 return;
3092 /* Only DIMM subtables are expected at this level */
3094 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
3096 AcpiOsPrintf (
3097 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
3098 DimmSubTable->Type);
3099 return;
3102 /* Dump the fixed-length DIMM subtable */
3104 Status = AcpiDmDumpTable (Length,
3105 Offset + MemOffset + DimmOffset, DimmSubTable,
3106 DimmSubTable->Length, AcpiDmTableInfoPmtt2);
3107 if (ACPI_FAILURE (Status))
3109 return;
3112 /* Point to next DIMM subtable */
3114 DimmOffset += DimmSubTable->Length;
3115 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3116 DimmSubTable, DimmSubTable->Length);
3119 /* Point to next Controller subtable */
3121 MemOffset += MemSubTable->Length;
3122 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3123 MemSubTable, MemSubTable->Length);
3126 /* Point to next Socket subtable */
3128 Offset += SubTable->Length;
3129 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
3130 SubTable, SubTable->Length);
3135 /*******************************************************************************
3137 * FUNCTION: AcpiDmDumpS3pt
3139 * PARAMETERS: Table - A S3PT table
3141 * RETURN: Length of the table
3143 * DESCRIPTION: Format the contents of a S3PT
3145 ******************************************************************************/
3147 UINT32
3148 AcpiDmDumpS3pt (
3149 ACPI_TABLE_HEADER *Tables)
3151 ACPI_STATUS Status;
3152 UINT32 Offset = sizeof (ACPI_TABLE_S3PT);
3153 ACPI_FPDT_HEADER *SubTable;
3154 ACPI_DMTABLE_INFO *InfoTable;
3155 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
3158 /* Main table */
3160 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
3161 if (ACPI_FAILURE (Status))
3163 return 0;
3166 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
3167 while (Offset < S3ptTable->Length)
3169 /* Common subtable header */
3171 AcpiOsPrintf ("\n");
3172 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
3173 SubTable->Length, AcpiDmTableInfoS3ptHdr);
3174 if (ACPI_FAILURE (Status))
3176 return 0;
3179 switch (SubTable->Type)
3181 case ACPI_S3PT_TYPE_RESUME:
3183 InfoTable = AcpiDmTableInfoS3pt0;
3184 break;
3186 case ACPI_S3PT_TYPE_SUSPEND:
3188 InfoTable = AcpiDmTableInfoS3pt1;
3189 break;
3191 default:
3193 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
3194 SubTable->Type);
3196 /* Attempt to continue */
3198 if (!SubTable->Length)
3200 AcpiOsPrintf ("Invalid zero length subtable\n");
3201 return 0;
3203 goto NextSubTable;
3206 AcpiOsPrintf ("\n");
3207 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
3208 SubTable->Length, InfoTable);
3209 if (ACPI_FAILURE (Status))
3211 return 0;
3214 NextSubTable:
3215 /* Point to next subtable */
3217 Offset += SubTable->Length;
3218 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
3221 return (S3ptTable->Length);
3225 /*******************************************************************************
3227 * FUNCTION: AcpiDmDumpSlic
3229 * PARAMETERS: Table - A SLIC table
3231 * RETURN: None
3233 * DESCRIPTION: Format the contents of a SLIC
3235 ******************************************************************************/
3237 void
3238 AcpiDmDumpSlic (
3239 ACPI_TABLE_HEADER *Table)
3242 (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
3243 Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
3247 /*******************************************************************************
3249 * FUNCTION: AcpiDmDumpSlit
3251 * PARAMETERS: Table - An SLIT
3253 * RETURN: None
3255 * DESCRIPTION: Format the contents of a SLIT
3257 ******************************************************************************/
3259 void
3260 AcpiDmDumpSlit (
3261 ACPI_TABLE_HEADER *Table)
3263 ACPI_STATUS Status;
3264 UINT32 Offset;
3265 UINT8 *Row;
3266 UINT32 Localities;
3267 UINT32 i;
3268 UINT32 j;
3271 /* Main table */
3273 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
3274 if (ACPI_FAILURE (Status))
3276 return;
3279 /* Display the Locality NxN Matrix */
3281 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
3282 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
3283 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
3285 for (i = 0; i < Localities; i++)
3287 /* Display one row of the matrix */
3289 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
3290 for (j = 0; j < Localities; j++)
3292 /* Check for beyond EOT */
3294 if (Offset >= Table->Length)
3296 AcpiOsPrintf (
3297 "\n**** Not enough room in table for all localities\n");
3298 return;
3301 AcpiOsPrintf ("%2.2X", Row[j]);
3302 Offset++;
3304 /* Display up to 16 bytes per output row */
3306 if ((j+1) < Localities)
3308 AcpiOsPrintf (" ");
3310 if (j && (((j+1) % 16) == 0))
3312 AcpiOsPrintf ("\\\n"); /* With line continuation char */
3313 AcpiDmLineHeader (Offset, 0, NULL);
3318 /* Point to next row */
3320 AcpiOsPrintf ("\n");
3321 Row += Localities;
3326 /*******************************************************************************
3328 * FUNCTION: AcpiDmDumpSrat
3330 * PARAMETERS: Table - A SRAT table
3332 * RETURN: None
3334 * DESCRIPTION: Format the contents of a SRAT
3336 ******************************************************************************/
3338 void
3339 AcpiDmDumpSrat (
3340 ACPI_TABLE_HEADER *Table)
3342 ACPI_STATUS Status;
3343 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
3344 ACPI_SUBTABLE_HEADER *SubTable;
3345 ACPI_DMTABLE_INFO *InfoTable;
3348 /* Main table */
3350 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
3351 if (ACPI_FAILURE (Status))
3353 return;
3356 /* Subtables */
3358 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
3359 while (Offset < Table->Length)
3361 /* Common subtable header */
3363 AcpiOsPrintf ("\n");
3364 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3365 SubTable->Length, AcpiDmTableInfoSratHdr);
3366 if (ACPI_FAILURE (Status))
3368 return;
3371 switch (SubTable->Type)
3373 case ACPI_SRAT_TYPE_CPU_AFFINITY:
3375 InfoTable = AcpiDmTableInfoSrat0;
3376 break;
3378 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
3380 InfoTable = AcpiDmTableInfoSrat1;
3381 break;
3383 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
3385 InfoTable = AcpiDmTableInfoSrat2;
3386 break;
3388 case ACPI_SRAT_TYPE_GICC_AFFINITY:
3390 InfoTable = AcpiDmTableInfoSrat3;
3391 break;
3393 default:
3394 AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
3395 SubTable->Type);
3397 /* Attempt to continue */
3399 if (!SubTable->Length)
3401 AcpiOsPrintf ("Invalid zero length subtable\n");
3402 return;
3404 goto NextSubTable;
3407 AcpiOsPrintf ("\n");
3408 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3409 SubTable->Length, InfoTable);
3410 if (ACPI_FAILURE (Status))
3412 return;
3415 NextSubTable:
3416 /* Point to next subtable */
3418 Offset += SubTable->Length;
3419 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
3420 SubTable->Length);
3425 /*******************************************************************************
3427 * FUNCTION: AcpiDmDumpStao
3429 * PARAMETERS: Table - A STAO table
3431 * RETURN: None
3433 * DESCRIPTION: Format the contents of a STAO. This is a variable-length
3434 * table that contains an open-ended number of ASCII strings
3435 * at the end of the table.
3437 ******************************************************************************/
3439 void
3440 AcpiDmDumpStao (
3441 ACPI_TABLE_HEADER *Table)
3443 ACPI_STATUS Status;
3444 char *Namepath;
3445 UINT32 Length = Table->Length;
3446 UINT32 StringLength;
3447 UINT32 Offset = sizeof (ACPI_TABLE_STAO);
3450 /* Main table */
3452 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
3453 if (ACPI_FAILURE (Status))
3455 return;
3458 /* The rest of the table consists of Namepath strings */
3460 while (Offset < Table->Length)
3462 Namepath = ACPI_ADD_PTR (char, Table, Offset);
3463 StringLength = strlen (Namepath) + 1;
3465 AcpiDmLineHeader (Offset, StringLength, "Namestring");
3466 AcpiOsPrintf ("\"%s\"\n", Namepath);
3468 /* Point to next namepath */
3470 Offset += StringLength;
3475 /*******************************************************************************
3477 * FUNCTION: AcpiDmDumpTcpa
3479 * PARAMETERS: Table - A TCPA table
3481 * RETURN: None
3483 * DESCRIPTION: Format the contents of a TCPA.
3485 * NOTE: There are two versions of the table with the same signature:
3486 * the client version and the server version. The common
3487 * PlatformClass field is used to differentiate the two types of
3488 * tables.
3490 ******************************************************************************/
3492 void
3493 AcpiDmDumpTcpa (
3494 ACPI_TABLE_HEADER *Table)
3496 UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR);
3497 ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR (
3498 ACPI_TABLE_TCPA_HDR, Table);
3499 ACPI_TABLE_TCPA_HDR *SubTable = ACPI_ADD_PTR (
3500 ACPI_TABLE_TCPA_HDR, Table, Offset);
3501 ACPI_STATUS Status;
3504 /* Main table */
3506 Status = AcpiDmDumpTable (Table->Length, 0, Table,
3507 0, AcpiDmTableInfoTcpaHdr);
3508 if (ACPI_FAILURE (Status))
3510 return;
3514 * Examine the PlatformClass field to determine the table type.
3515 * Either a client or server table. Only one.
3517 switch (CommonHeader->PlatformClass)
3519 case ACPI_TCPA_CLIENT_TABLE:
3521 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3522 Table->Length - Offset, AcpiDmTableInfoTcpaClient);
3523 break;
3525 case ACPI_TCPA_SERVER_TABLE:
3527 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3528 Table->Length - Offset, AcpiDmTableInfoTcpaServer);
3529 break;
3531 default:
3533 AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
3534 CommonHeader->PlatformClass);
3535 Status = AE_ERROR;
3536 break;
3539 if (ACPI_FAILURE (Status))
3541 AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
3546 /*******************************************************************************
3548 * FUNCTION: AcpiDmDumpVrtc
3550 * PARAMETERS: Table - A VRTC table
3552 * RETURN: None
3554 * DESCRIPTION: Format the contents of a VRTC
3556 ******************************************************************************/
3558 void
3559 AcpiDmDumpVrtc (
3560 ACPI_TABLE_HEADER *Table)
3562 ACPI_STATUS Status;
3563 UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
3564 ACPI_VRTC_ENTRY *SubTable;
3567 /* Main table */
3569 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
3570 if (ACPI_FAILURE (Status))
3572 return;
3575 /* Subtables */
3577 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
3578 while (Offset < Table->Length)
3580 /* Common subtable header */
3582 AcpiOsPrintf ("\n");
3583 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3584 sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
3585 if (ACPI_FAILURE (Status))
3587 return;
3590 /* Point to next subtable */
3592 Offset += sizeof (ACPI_VRTC_ENTRY);
3593 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable,
3594 sizeof (ACPI_VRTC_ENTRY));
3599 /*******************************************************************************
3601 * FUNCTION: AcpiDmDumpWdat
3603 * PARAMETERS: Table - A WDAT table
3605 * RETURN: None
3607 * DESCRIPTION: Format the contents of a WDAT
3609 ******************************************************************************/
3611 void
3612 AcpiDmDumpWdat (
3613 ACPI_TABLE_HEADER *Table)
3615 ACPI_STATUS Status;
3616 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
3617 ACPI_WDAT_ENTRY *SubTable;
3620 /* Main table */
3622 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
3623 if (ACPI_FAILURE (Status))
3625 return;
3628 /* Subtables */
3630 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
3631 while (Offset < Table->Length)
3633 /* Common subtable header */
3635 AcpiOsPrintf ("\n");
3636 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
3637 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
3638 if (ACPI_FAILURE (Status))
3640 return;
3643 /* Point to next subtable */
3645 Offset += sizeof (ACPI_WDAT_ENTRY);
3646 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable,
3647 sizeof (ACPI_WDAT_ENTRY));
3652 /*******************************************************************************
3654 * FUNCTION: AcpiDmDumpWpbt
3656 * PARAMETERS: Table - A WPBT table
3658 * RETURN: None
3660 * DESCRIPTION: Format the contents of a WPBT. This table type consists
3661 * of an open-ended arguments buffer at the end of the table.
3663 ******************************************************************************/
3665 void
3666 AcpiDmDumpWpbt (
3667 ACPI_TABLE_HEADER *Table)
3669 ACPI_STATUS Status;
3670 ACPI_TABLE_WPBT *SubTable;
3671 UINT32 Length = Table->Length;
3672 UINT16 ArgumentsLength;
3675 /* Dump the main table */
3677 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
3678 if (ACPI_FAILURE (Status))
3680 return;
3683 /* Extract the arguments buffer length from the main table */
3685 SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
3686 ArgumentsLength = SubTable->ArgumentsLength;
3688 /* Dump the arguments buffer */
3690 (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
3691 AcpiDmTableInfoWpbt0);