Indentation fix, cleanup.
[AROS.git] / arch / all-pc / acpica / source / common / dmtbdump.c
blob5b98191fa2405f65f544e6eed645bdb82101d7f4
1 /******************************************************************************
3 * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, 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);
62 static void
63 AcpiDmDumpBuffer (
64 void *Table,
65 UINT32 BufferOffset,
66 UINT32 Length,
67 UINT32 AbsoluteOffset,
68 char *Header);
71 /*******************************************************************************
73 * FUNCTION: AcpiDmDumpBuffer
75 * PARAMETERS: Table - ACPI Table or subtable
76 * BufferOffset - Offset of buffer from Table above
77 * Length - Length of the buffer
78 * AbsoluteOffset - Offset of buffer in the main ACPI table
79 * Header - Name of the buffer field (printed on the
80 * first line only.)
82 * RETURN: None
84 * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
85 * disassembler output format.)
87 ******************************************************************************/
89 static void
90 AcpiDmDumpBuffer (
91 void *Table,
92 UINT32 BufferOffset,
93 UINT32 Length,
94 UINT32 AbsoluteOffset,
95 char *Header)
97 UINT8 *Buffer;
98 UINT32 i;
101 if (!Length)
103 return;
106 Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
107 i = 0;
109 while (i < Length)
111 if (!(i % 16))
113 AcpiOsPrintf ("\n");
114 AcpiDmLineHeader (AbsoluteOffset,
115 ((Length - i) > 16) ? 16 : (Length - i), Header);
116 Header = NULL;
119 AcpiOsPrintf ("%.02X ", *Buffer);
120 i++;
121 Buffer++;
122 AbsoluteOffset++;
125 AcpiOsPrintf ("\n");
129 /*******************************************************************************
131 * FUNCTION: AcpiDmDumpRsdp
133 * PARAMETERS: Table - A RSDP
135 * RETURN: Length of the table (there is not always a length field,
136 * use revision or length if available (ACPI 2.0+))
138 * DESCRIPTION: Format the contents of a RSDP
140 ******************************************************************************/
142 UINT32
143 AcpiDmDumpRsdp (
144 ACPI_TABLE_HEADER *Table)
146 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
147 UINT32 Length = sizeof (ACPI_RSDP_COMMON);
148 UINT8 Checksum;
151 /* Dump the common ACPI 1.0 portion */
153 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
155 /* Validate the first checksum */
157 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
158 Rsdp->Checksum);
159 if (Checksum != Rsdp->Checksum)
161 AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
162 Checksum);
165 /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
167 if (Rsdp->Revision > 0)
169 Length = Rsdp->Length;
170 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
172 /* Validate the extended checksum over entire RSDP */
174 Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
175 Rsdp->ExtendedChecksum);
176 if (Checksum != Rsdp->ExtendedChecksum)
178 AcpiOsPrintf (
179 "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
180 Checksum);
184 return (Length);
188 /*******************************************************************************
190 * FUNCTION: AcpiDmDumpRsdt
192 * PARAMETERS: Table - A RSDT
194 * RETURN: None
196 * DESCRIPTION: Format the contents of a RSDT
198 ******************************************************************************/
200 void
201 AcpiDmDumpRsdt (
202 ACPI_TABLE_HEADER *Table)
204 UINT32 *Array;
205 UINT32 Entries;
206 UINT32 Offset;
207 UINT32 i;
210 /* Point to start of table pointer array */
212 Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
213 Offset = sizeof (ACPI_TABLE_HEADER);
215 /* RSDT uses 32-bit pointers */
217 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
219 for (i = 0; i < Entries; i++)
221 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
222 AcpiOsPrintf ("%8.8X\n", Array[i]);
223 Offset += sizeof (UINT32);
228 /*******************************************************************************
230 * FUNCTION: AcpiDmDumpXsdt
232 * PARAMETERS: Table - A XSDT
234 * RETURN: None
236 * DESCRIPTION: Format the contents of a XSDT
238 ******************************************************************************/
240 void
241 AcpiDmDumpXsdt (
242 ACPI_TABLE_HEADER *Table)
244 UINT64 *Array;
245 UINT32 Entries;
246 UINT32 Offset;
247 UINT32 i;
250 /* Point to start of table pointer array */
252 Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
253 Offset = sizeof (ACPI_TABLE_HEADER);
255 /* XSDT uses 64-bit pointers */
257 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
259 for (i = 0; i < Entries; i++)
261 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
262 AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
263 Offset += sizeof (UINT64);
268 /*******************************************************************************
270 * FUNCTION: AcpiDmDumpFadt
272 * PARAMETERS: Table - A FADT
274 * RETURN: None
276 * DESCRIPTION: Format the contents of a FADT
278 * NOTE: We cannot depend on the FADT version to indicate the actual
279 * contents of the FADT because of BIOS bugs. The table length
280 * is the only reliable indicator.
282 ******************************************************************************/
284 void
285 AcpiDmDumpFadt (
286 ACPI_TABLE_HEADER *Table)
289 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
291 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
293 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
295 if ((Table->Length > ACPI_FADT_V1_SIZE) &&
296 (Table->Length <= ACPI_FADT_V2_SIZE))
298 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
301 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
303 else if (Table->Length > ACPI_FADT_V2_SIZE)
305 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
307 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
309 if (Table->Length > ACPI_FADT_V3_SIZE)
311 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5);
315 /* Validate various fields in the FADT, including length */
317 AcpiTbCreateLocalFadt (Table, Table->Length);
319 /* Validate FADT length against the revision */
321 AcpiDmValidateFadtLength (Table->Revision, Table->Length);
325 /*******************************************************************************
327 * FUNCTION: AcpiDmValidateFadtLength
329 * PARAMETERS: Revision - FADT revision (Header->Revision)
330 * Length - FADT length (Header->Length
332 * RETURN: None
334 * DESCRIPTION: Check the FADT revision against the expected table length for
335 * that revision. Issue a warning if the length is not what was
336 * expected. This seems to be such a common BIOS bug that the
337 * FADT revision has been rendered virtually meaningless.
339 ******************************************************************************/
341 static void
342 AcpiDmValidateFadtLength (
343 UINT32 Revision,
344 UINT32 Length)
346 UINT32 ExpectedLength;
349 switch (Revision)
351 case 0:
353 AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
354 return;
356 case 1:
358 ExpectedLength = ACPI_FADT_V1_SIZE;
359 break;
361 case 2:
363 ExpectedLength = ACPI_FADT_V2_SIZE;
364 break;
366 case 3:
367 case 4:
369 ExpectedLength = ACPI_FADT_V3_SIZE;
370 break;
372 case 5:
374 ExpectedLength = ACPI_FADT_V5_SIZE;
375 break;
377 default:
379 return;
382 if (Length == ExpectedLength)
384 return;
387 AcpiOsPrintf (
388 "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n",
389 Revision, Length, ExpectedLength);
393 /*******************************************************************************
395 * FUNCTION: AcpiDmDumpAsf
397 * PARAMETERS: Table - A ASF table
399 * RETURN: None
401 * DESCRIPTION: Format the contents of a ASF table
403 ******************************************************************************/
405 void
406 AcpiDmDumpAsf (
407 ACPI_TABLE_HEADER *Table)
409 ACPI_STATUS Status;
410 UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
411 ACPI_ASF_INFO *SubTable;
412 ACPI_DMTABLE_INFO *InfoTable;
413 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
414 UINT8 *DataTable = NULL;
415 UINT32 DataCount = 0;
416 UINT32 DataLength = 0;
417 UINT32 DataOffset = 0;
418 UINT32 i;
419 UINT8 Type;
422 /* No main table, only sub-tables */
424 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
425 while (Offset < Table->Length)
427 /* Common sub-table header */
429 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
430 SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
431 if (ACPI_FAILURE (Status))
433 return;
436 /* The actual type is the lower 7 bits of Type */
438 Type = (UINT8) (SubTable->Header.Type & 0x7F);
440 switch (Type)
442 case ACPI_ASF_TYPE_INFO:
444 InfoTable = AcpiDmTableInfoAsf0;
445 break;
447 case ACPI_ASF_TYPE_ALERT:
449 InfoTable = AcpiDmTableInfoAsf1;
450 DataInfoTable = AcpiDmTableInfoAsf1a;
451 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
452 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
453 DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
454 DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
455 break;
457 case ACPI_ASF_TYPE_CONTROL:
459 InfoTable = AcpiDmTableInfoAsf2;
460 DataInfoTable = AcpiDmTableInfoAsf2a;
461 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
462 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
463 DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
464 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
465 break;
467 case ACPI_ASF_TYPE_BOOT:
469 InfoTable = AcpiDmTableInfoAsf3;
470 break;
472 case ACPI_ASF_TYPE_ADDRESS:
474 InfoTable = AcpiDmTableInfoAsf4;
475 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
476 DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
477 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
478 break;
480 default:
482 AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type);
483 return;
486 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
487 SubTable->Header.Length, InfoTable);
488 if (ACPI_FAILURE (Status))
490 return;
493 /* Dump variable-length extra data */
495 switch (Type)
497 case ACPI_ASF_TYPE_ALERT:
498 case ACPI_ASF_TYPE_CONTROL:
500 for (i = 0; i < DataCount; i++)
502 AcpiOsPrintf ("\n");
503 Status = AcpiDmDumpTable (Table->Length, DataOffset,
504 DataTable, DataLength, DataInfoTable);
505 if (ACPI_FAILURE (Status))
507 return;
510 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
511 DataOffset += DataLength;
513 break;
515 case ACPI_ASF_TYPE_ADDRESS:
517 for (i = 0; i < DataLength; i++)
519 if (!(i % 16))
521 AcpiDmLineHeader (DataOffset, 1, "Addresses");
524 AcpiOsPrintf ("%2.2X ", *DataTable);
525 DataTable++;
526 DataOffset++;
527 if (DataOffset > Table->Length)
529 AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
530 return;
534 AcpiOsPrintf ("\n");
535 break;
537 default:
539 break;
542 AcpiOsPrintf ("\n");
544 /* Point to next sub-table */
546 if (!SubTable->Header.Length)
548 AcpiOsPrintf ("Invalid zero subtable header length\n");
549 return;
552 Offset += SubTable->Header.Length;
553 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
558 /*******************************************************************************
560 * FUNCTION: AcpiDmDumpCpep
562 * PARAMETERS: Table - A CPEP table
564 * RETURN: None
566 * DESCRIPTION: Format the contents of a CPEP. This table type consists
567 * of an open-ended number of subtables.
569 ******************************************************************************/
571 void
572 AcpiDmDumpCpep (
573 ACPI_TABLE_HEADER *Table)
575 ACPI_STATUS Status;
576 ACPI_CPEP_POLLING *SubTable;
577 UINT32 Length = Table->Length;
578 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
581 /* Main table */
583 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
584 if (ACPI_FAILURE (Status))
586 return;
589 /* Sub-tables */
591 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
592 while (Offset < Table->Length)
594 AcpiOsPrintf ("\n");
595 Status = AcpiDmDumpTable (Length, Offset, SubTable,
596 SubTable->Header.Length, AcpiDmTableInfoCpep0);
597 if (ACPI_FAILURE (Status))
599 return;
602 /* Point to next sub-table */
604 Offset += SubTable->Header.Length;
605 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
606 SubTable->Header.Length);
611 /*******************************************************************************
613 * FUNCTION: AcpiDmDumpCsrt
615 * PARAMETERS: Table - A CSRT table
617 * RETURN: None
619 * DESCRIPTION: Format the contents of a CSRT. This table type consists
620 * of an open-ended number of subtables.
622 ******************************************************************************/
624 void
625 AcpiDmDumpCsrt (
626 ACPI_TABLE_HEADER *Table)
628 ACPI_STATUS Status;
629 ACPI_CSRT_GROUP *SubTable;
630 ACPI_CSRT_SHARED_INFO *SharedInfoTable;
631 ACPI_CSRT_DESCRIPTOR *SubSubTable;
632 UINT32 Length = Table->Length;
633 UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
634 UINT32 SubOffset;
635 UINT32 SubSubOffset;
636 UINT32 InfoLength;
639 /* The main table only contains the ACPI header, thus already handled */
641 /* Sub-tables (Resource Groups) */
643 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
644 while (Offset < Table->Length)
646 /* Resource group subtable */
648 AcpiOsPrintf ("\n");
649 Status = AcpiDmDumpTable (Length, Offset, SubTable,
650 SubTable->Length, AcpiDmTableInfoCsrt0);
651 if (ACPI_FAILURE (Status))
653 return;
656 /* Shared info subtable (One per resource group) */
658 SubOffset = sizeof (ACPI_CSRT_GROUP);
659 SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
660 Offset + SubOffset);
662 AcpiOsPrintf ("\n");
663 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
664 sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
665 if (ACPI_FAILURE (Status))
667 return;
670 SubOffset += SubTable->SharedInfoLength;
672 /* Sub-Subtables (Resource Descriptors) */
674 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
675 Offset + SubOffset);
677 while ((SubOffset < SubTable->Length) &&
678 ((Offset + SubOffset) < Table->Length))
680 AcpiOsPrintf ("\n");
681 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
682 SubSubTable->Length, AcpiDmTableInfoCsrt2);
683 if (ACPI_FAILURE (Status))
685 return;
688 SubSubOffset = sizeof (ACPI_CSRT_DESCRIPTOR);
690 /* Resource-specific info buffer */
692 InfoLength = SubSubTable->Length - SubSubOffset;
694 AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength,
695 Offset + SubOffset + SubSubOffset, "ResourceInfo");
696 SubSubOffset += InfoLength;
698 /* Point to next sub-subtable */
700 SubOffset += SubSubTable->Length;
701 SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
702 SubSubTable->Length);
705 /* Point to next sub-table */
707 Offset += SubTable->Length;
708 SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
709 SubTable->Length);
714 /*******************************************************************************
716 * FUNCTION: AcpiDmDumpDbg2
718 * PARAMETERS: Table - A DBG2 table
720 * RETURN: None
722 * DESCRIPTION: Format the contents of a DBG2. This table type consists
723 * of an open-ended number of subtables.
725 ******************************************************************************/
727 void
728 AcpiDmDumpDbg2 (
729 ACPI_TABLE_HEADER *Table)
731 ACPI_STATUS Status;
732 ACPI_DBG2_DEVICE *SubTable;
733 UINT32 Length = Table->Length;
734 UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
735 UINT32 i;
736 UINT32 ArrayOffset;
737 UINT32 AbsoluteOffset;
738 UINT8 *Array;
741 /* Main table */
743 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
744 if (ACPI_FAILURE (Status))
746 return;
749 /* Sub-tables */
751 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
752 while (Offset < Table->Length)
754 AcpiOsPrintf ("\n");
755 Status = AcpiDmDumpTable (Length, Offset, SubTable,
756 SubTable->Length, AcpiDmTableInfoDbg2Device);
757 if (ACPI_FAILURE (Status))
759 return;
762 /* Dump the BaseAddress array */
764 for (i = 0; i < SubTable->RegisterCount; i++)
766 ArrayOffset = SubTable->BaseAddressOffset +
767 (sizeof (ACPI_GENERIC_ADDRESS) * i);
768 AbsoluteOffset = Offset + ArrayOffset;
769 Array = (UINT8 *) SubTable + ArrayOffset;
771 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
772 SubTable->Length, AcpiDmTableInfoDbg2Addr);
773 if (ACPI_FAILURE (Status))
775 return;
779 /* Dump the AddressSize array */
781 for (i = 0; i < SubTable->RegisterCount; i++)
783 ArrayOffset = SubTable->AddressSizeOffset +
784 (sizeof (UINT32) * i);
785 AbsoluteOffset = Offset + ArrayOffset;
786 Array = (UINT8 *) SubTable + ArrayOffset;
788 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
789 SubTable->Length, AcpiDmTableInfoDbg2Size);
790 if (ACPI_FAILURE (Status))
792 return;
796 /* Dump the Namestring (required) */
798 AcpiOsPrintf ("\n");
799 ArrayOffset = SubTable->NamepathOffset;
800 AbsoluteOffset = Offset + ArrayOffset;
801 Array = (UINT8 *) SubTable + ArrayOffset;
803 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
804 SubTable->Length, AcpiDmTableInfoDbg2Name);
805 if (ACPI_FAILURE (Status))
807 return;
810 /* Dump the OemData (optional) */
812 AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength,
813 Offset + SubTable->OemDataOffset, "OEM Data");
815 /* Point to next sub-table */
817 Offset += SubTable->Length;
818 SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
819 SubTable->Length);
824 /*******************************************************************************
826 * FUNCTION: AcpiDmDumpDmar
828 * PARAMETERS: Table - A DMAR table
830 * RETURN: None
832 * DESCRIPTION: Format the contents of a DMAR. This table type consists
833 * of an open-ended number of subtables.
835 ******************************************************************************/
838 void
839 AcpiDmDumpDmar (
840 ACPI_TABLE_HEADER *Table)
842 ACPI_STATUS Status;
843 ACPI_DMAR_HEADER *SubTable;
844 UINT32 Length = Table->Length;
845 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
846 ACPI_DMTABLE_INFO *InfoTable;
847 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
848 UINT32 ScopeOffset;
849 UINT8 *PciPath;
850 UINT32 PathOffset;
853 /* Main table */
855 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
856 if (ACPI_FAILURE (Status))
858 return;
861 /* Sub-tables */
863 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
864 while (Offset < Table->Length)
866 /* Common sub-table header */
868 AcpiOsPrintf ("\n");
869 Status = AcpiDmDumpTable (Length, Offset, SubTable,
870 SubTable->Length, AcpiDmTableInfoDmarHdr);
871 if (ACPI_FAILURE (Status))
873 return;
875 AcpiOsPrintf ("\n");
877 switch (SubTable->Type)
879 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
881 InfoTable = AcpiDmTableInfoDmar0;
882 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
883 break;
885 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
887 InfoTable = AcpiDmTableInfoDmar1;
888 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
889 break;
891 case ACPI_DMAR_TYPE_ATSR:
893 InfoTable = AcpiDmTableInfoDmar2;
894 ScopeOffset = sizeof (ACPI_DMAR_ATSR);
895 break;
897 case ACPI_DMAR_HARDWARE_AFFINITY:
899 InfoTable = AcpiDmTableInfoDmar3;
900 ScopeOffset = sizeof (ACPI_DMAR_RHSA);
901 break;
903 default:
905 AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type);
906 return;
909 Status = AcpiDmDumpTable (Length, Offset, SubTable,
910 SubTable->Length, InfoTable);
911 if (ACPI_FAILURE (Status))
913 return;
916 /* Dump the device scope entries (if any) */
918 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
919 while (ScopeOffset < SubTable->Length)
921 AcpiOsPrintf ("\n");
922 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
923 ScopeTable->Length, AcpiDmTableInfoDmarScope);
924 if (ACPI_FAILURE (Status))
926 return;
928 AcpiOsPrintf ("\n");
930 /* Dump the PCI Path entries for this device scope */
932 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
934 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
935 sizeof (ACPI_DMAR_DEVICE_SCOPE));
937 while (PathOffset < ScopeTable->Length)
939 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
940 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
942 /* Point to next PCI Path entry */
944 PathOffset += 2;
945 PciPath += 2;
946 AcpiOsPrintf ("\n");
949 /* Point to next device scope entry */
951 ScopeOffset += ScopeTable->Length;
952 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
953 ScopeTable, ScopeTable->Length);
956 /* Point to next sub-table */
958 Offset += SubTable->Length;
959 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
964 /*******************************************************************************
966 * FUNCTION: AcpiDmDumpEinj
968 * PARAMETERS: Table - A EINJ table
970 * RETURN: None
972 * DESCRIPTION: Format the contents of a EINJ. This table type consists
973 * of an open-ended number of subtables.
975 ******************************************************************************/
977 void
978 AcpiDmDumpEinj (
979 ACPI_TABLE_HEADER *Table)
981 ACPI_STATUS Status;
982 ACPI_WHEA_HEADER *SubTable;
983 UINT32 Length = Table->Length;
984 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
987 /* Main table */
989 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
990 if (ACPI_FAILURE (Status))
992 return;
995 /* Sub-tables */
997 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
998 while (Offset < Table->Length)
1000 AcpiOsPrintf ("\n");
1001 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1002 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
1003 if (ACPI_FAILURE (Status))
1005 return;
1008 /* Point to next sub-table (each subtable is of fixed length) */
1010 Offset += sizeof (ACPI_WHEA_HEADER);
1011 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1012 sizeof (ACPI_WHEA_HEADER));
1017 /*******************************************************************************
1019 * FUNCTION: AcpiDmDumpErst
1021 * PARAMETERS: Table - A ERST table
1023 * RETURN: None
1025 * DESCRIPTION: Format the contents of a ERST. This table type consists
1026 * of an open-ended number of subtables.
1028 ******************************************************************************/
1030 void
1031 AcpiDmDumpErst (
1032 ACPI_TABLE_HEADER *Table)
1034 ACPI_STATUS Status;
1035 ACPI_WHEA_HEADER *SubTable;
1036 UINT32 Length = Table->Length;
1037 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
1040 /* Main table */
1042 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
1043 if (ACPI_FAILURE (Status))
1045 return;
1048 /* Sub-tables */
1050 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
1051 while (Offset < Table->Length)
1053 AcpiOsPrintf ("\n");
1054 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1055 sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
1056 if (ACPI_FAILURE (Status))
1058 return;
1061 /* Point to next sub-table (each subtable is of fixed length) */
1063 Offset += sizeof (ACPI_WHEA_HEADER);
1064 SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
1065 sizeof (ACPI_WHEA_HEADER));
1070 /*******************************************************************************
1072 * FUNCTION: AcpiDmDumpFpdt
1074 * PARAMETERS: Table - A FPDT table
1076 * RETURN: None
1078 * DESCRIPTION: Format the contents of a FPDT. This table type consists
1079 * of an open-ended number of subtables.
1081 ******************************************************************************/
1083 void
1084 AcpiDmDumpFpdt (
1085 ACPI_TABLE_HEADER *Table)
1087 ACPI_STATUS Status;
1088 ACPI_FPDT_HEADER *SubTable;
1089 UINT32 Length = Table->Length;
1090 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
1091 ACPI_DMTABLE_INFO *InfoTable;
1094 /* There is no main table (other than the standard ACPI header) */
1096 /* Sub-tables */
1098 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
1099 while (Offset < Table->Length)
1101 /* Common sub-table header */
1103 AcpiOsPrintf ("\n");
1104 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1105 SubTable->Length, AcpiDmTableInfoFpdtHdr);
1106 if (ACPI_FAILURE (Status))
1108 return;
1111 switch (SubTable->Type)
1113 case ACPI_FPDT_TYPE_BOOT:
1115 InfoTable = AcpiDmTableInfoFpdt0;
1116 break;
1118 case ACPI_FPDT_TYPE_S3PERF:
1120 InfoTable = AcpiDmTableInfoFpdt1;
1121 break;
1123 default:
1125 AcpiOsPrintf ("\n**** Unknown FPDT sub-table type 0x%X\n\n", SubTable->Type);
1127 /* Attempt to continue */
1129 if (!SubTable->Length)
1131 AcpiOsPrintf ("Invalid zero length subtable\n");
1132 return;
1134 goto NextSubTable;
1137 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1138 SubTable->Length, InfoTable);
1139 if (ACPI_FAILURE (Status))
1141 return;
1144 NextSubTable:
1145 /* Point to next sub-table */
1147 Offset += SubTable->Length;
1148 SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
1153 /*******************************************************************************
1155 * FUNCTION: AcpiDmDumpHest
1157 * PARAMETERS: Table - A HEST table
1159 * RETURN: None
1161 * DESCRIPTION: Format the contents of a HEST. This table type consists
1162 * of an open-ended number of subtables.
1164 ******************************************************************************/
1166 void
1167 AcpiDmDumpHest (
1168 ACPI_TABLE_HEADER *Table)
1170 ACPI_STATUS Status;
1171 ACPI_HEST_HEADER *SubTable;
1172 UINT32 Length = Table->Length;
1173 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
1174 ACPI_DMTABLE_INFO *InfoTable;
1175 UINT32 SubTableLength;
1176 UINT32 BankCount;
1177 ACPI_HEST_IA_ERROR_BANK *BankTable;
1180 /* Main table */
1182 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
1183 if (ACPI_FAILURE (Status))
1185 return;
1188 /* Sub-tables */
1190 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
1191 while (Offset < Table->Length)
1193 BankCount = 0;
1194 switch (SubTable->Type)
1196 case ACPI_HEST_TYPE_IA32_CHECK:
1198 InfoTable = AcpiDmTableInfoHest0;
1199 SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
1200 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1201 SubTable))->NumHardwareBanks;
1202 break;
1204 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1206 InfoTable = AcpiDmTableInfoHest1;
1207 SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
1208 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1209 SubTable))->NumHardwareBanks;
1210 break;
1212 case ACPI_HEST_TYPE_IA32_NMI:
1214 InfoTable = AcpiDmTableInfoHest2;
1215 SubTableLength = sizeof (ACPI_HEST_IA_NMI);
1216 break;
1218 case ACPI_HEST_TYPE_AER_ROOT_PORT:
1220 InfoTable = AcpiDmTableInfoHest6;
1221 SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
1222 break;
1224 case ACPI_HEST_TYPE_AER_ENDPOINT:
1226 InfoTable = AcpiDmTableInfoHest7;
1227 SubTableLength = sizeof (ACPI_HEST_AER);
1228 break;
1230 case ACPI_HEST_TYPE_AER_BRIDGE:
1232 InfoTable = AcpiDmTableInfoHest8;
1233 SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
1234 break;
1236 case ACPI_HEST_TYPE_GENERIC_ERROR:
1238 InfoTable = AcpiDmTableInfoHest9;
1239 SubTableLength = sizeof (ACPI_HEST_GENERIC);
1240 break;
1242 default:
1244 /* Cannot continue on unknown type - no length */
1246 AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type);
1247 return;
1250 AcpiOsPrintf ("\n");
1251 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1252 SubTableLength, InfoTable);
1253 if (ACPI_FAILURE (Status))
1255 return;
1258 /* Point to end of current subtable (each subtable above is of fixed length) */
1260 Offset += SubTableLength;
1262 /* If there are any (fixed-length) Error Banks from above, dump them now */
1264 if (BankCount)
1266 BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
1267 SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
1269 while (BankCount)
1271 AcpiOsPrintf ("\n");
1272 Status = AcpiDmDumpTable (Length, Offset, BankTable,
1273 sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
1274 if (ACPI_FAILURE (Status))
1276 return;
1278 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
1279 BankTable++;
1280 BankCount--;
1284 /* Point to next sub-table */
1286 SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
1291 /*******************************************************************************
1293 * FUNCTION: AcpiDmDumpIvrs
1295 * PARAMETERS: Table - A IVRS table
1297 * RETURN: None
1299 * DESCRIPTION: Format the contents of a IVRS
1301 ******************************************************************************/
1303 static UINT8 EntrySizes[] = {4,8,16,32};
1305 void
1306 AcpiDmDumpIvrs (
1307 ACPI_TABLE_HEADER *Table)
1309 ACPI_STATUS Status;
1310 UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
1311 UINT32 EntryOffset;
1312 UINT32 EntryLength;
1313 UINT32 EntryType;
1314 ACPI_IVRS_DE_HEADER *DeviceEntry;
1315 ACPI_IVRS_HEADER *SubTable;
1316 ACPI_DMTABLE_INFO *InfoTable;
1319 /* Main table */
1321 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
1322 if (ACPI_FAILURE (Status))
1324 return;
1327 /* Sub-tables */
1329 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
1330 while (Offset < Table->Length)
1332 /* Common sub-table header */
1334 AcpiOsPrintf ("\n");
1335 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1336 SubTable->Length, AcpiDmTableInfoIvrsHdr);
1337 if (ACPI_FAILURE (Status))
1339 return;
1342 switch (SubTable->Type)
1344 case ACPI_IVRS_TYPE_HARDWARE:
1346 InfoTable = AcpiDmTableInfoIvrs0;
1347 break;
1349 case ACPI_IVRS_TYPE_MEMORY1:
1350 case ACPI_IVRS_TYPE_MEMORY2:
1351 case ACPI_IVRS_TYPE_MEMORY3:
1353 InfoTable = AcpiDmTableInfoIvrs1;
1354 break;
1356 default:
1358 AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n",
1359 SubTable->Type);
1361 /* Attempt to continue */
1363 if (!SubTable->Length)
1365 AcpiOsPrintf ("Invalid zero length subtable\n");
1366 return;
1368 goto NextSubTable;
1371 /* Dump the subtable */
1373 AcpiOsPrintf ("\n");
1374 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1375 SubTable->Length, InfoTable);
1376 if (ACPI_FAILURE (Status))
1378 return;
1381 /* The hardware subtable can contain multiple device entries */
1383 if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
1385 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
1386 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
1387 sizeof (ACPI_IVRS_HARDWARE));
1389 while (EntryOffset < (Offset + SubTable->Length))
1391 AcpiOsPrintf ("\n");
1393 * Upper 2 bits of Type encode the length of the device entry
1395 * 00 = 4 byte
1396 * 01 = 8 byte
1397 * 10 = 16 byte - currently no entries defined
1398 * 11 = 32 byte - currently no entries defined
1400 EntryType = DeviceEntry->Type;
1401 EntryLength = EntrySizes [EntryType >> 6];
1403 switch (EntryType)
1405 /* 4-byte device entries */
1407 case ACPI_IVRS_TYPE_PAD4:
1408 case ACPI_IVRS_TYPE_ALL:
1409 case ACPI_IVRS_TYPE_SELECT:
1410 case ACPI_IVRS_TYPE_START:
1411 case ACPI_IVRS_TYPE_END:
1413 InfoTable = AcpiDmTableInfoIvrs4;
1414 break;
1416 /* 8-byte entries, type A */
1418 case ACPI_IVRS_TYPE_ALIAS_SELECT:
1419 case ACPI_IVRS_TYPE_ALIAS_START:
1421 InfoTable = AcpiDmTableInfoIvrs8a;
1422 break;
1424 /* 8-byte entries, type B */
1426 case ACPI_IVRS_TYPE_PAD8:
1427 case ACPI_IVRS_TYPE_EXT_SELECT:
1428 case ACPI_IVRS_TYPE_EXT_START:
1430 InfoTable = AcpiDmTableInfoIvrs8b;
1431 break;
1433 /* 8-byte entries, type C */
1435 case ACPI_IVRS_TYPE_SPECIAL:
1437 InfoTable = AcpiDmTableInfoIvrs8c;
1438 break;
1440 default:
1441 InfoTable = AcpiDmTableInfoIvrs4;
1442 AcpiOsPrintf (
1443 "\n**** Unknown IVRS device entry type/length: "
1444 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
1445 EntryType, EntryLength, EntryOffset);
1446 break;
1449 /* Dump the Device Entry */
1451 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
1452 DeviceEntry, EntryLength, InfoTable);
1454 EntryOffset += EntryLength;
1455 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
1456 EntryLength);
1460 NextSubTable:
1461 /* Point to next sub-table */
1463 Offset += SubTable->Length;
1464 SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
1469 /*******************************************************************************
1471 * FUNCTION: AcpiDmDumpMadt
1473 * PARAMETERS: Table - A MADT table
1475 * RETURN: None
1477 * DESCRIPTION: Format the contents of a MADT. This table type consists
1478 * of an open-ended number of subtables.
1480 ******************************************************************************/
1482 void
1483 AcpiDmDumpMadt (
1484 ACPI_TABLE_HEADER *Table)
1486 ACPI_STATUS Status;
1487 ACPI_SUBTABLE_HEADER *SubTable;
1488 UINT32 Length = Table->Length;
1489 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
1490 ACPI_DMTABLE_INFO *InfoTable;
1493 /* Main table */
1495 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
1496 if (ACPI_FAILURE (Status))
1498 return;
1501 /* Sub-tables */
1503 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
1504 while (Offset < Table->Length)
1506 /* Common sub-table header */
1508 AcpiOsPrintf ("\n");
1509 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1510 SubTable->Length, AcpiDmTableInfoMadtHdr);
1511 if (ACPI_FAILURE (Status))
1513 return;
1516 switch (SubTable->Type)
1518 case ACPI_MADT_TYPE_LOCAL_APIC:
1520 InfoTable = AcpiDmTableInfoMadt0;
1521 break;
1523 case ACPI_MADT_TYPE_IO_APIC:
1525 InfoTable = AcpiDmTableInfoMadt1;
1526 break;
1528 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
1530 InfoTable = AcpiDmTableInfoMadt2;
1531 break;
1533 case ACPI_MADT_TYPE_NMI_SOURCE:
1535 InfoTable = AcpiDmTableInfoMadt3;
1536 break;
1538 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
1540 InfoTable = AcpiDmTableInfoMadt4;
1541 break;
1543 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
1545 InfoTable = AcpiDmTableInfoMadt5;
1546 break;
1548 case ACPI_MADT_TYPE_IO_SAPIC:
1550 InfoTable = AcpiDmTableInfoMadt6;
1551 break;
1553 case ACPI_MADT_TYPE_LOCAL_SAPIC:
1555 InfoTable = AcpiDmTableInfoMadt7;
1556 break;
1558 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
1560 InfoTable = AcpiDmTableInfoMadt8;
1561 break;
1563 case ACPI_MADT_TYPE_LOCAL_X2APIC:
1565 InfoTable = AcpiDmTableInfoMadt9;
1566 break;
1568 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
1570 InfoTable = AcpiDmTableInfoMadt10;
1571 break;
1573 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
1575 InfoTable = AcpiDmTableInfoMadt11;
1576 break;
1578 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
1580 InfoTable = AcpiDmTableInfoMadt12;
1581 break;
1583 default:
1585 AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type);
1587 /* Attempt to continue */
1589 if (!SubTable->Length)
1591 AcpiOsPrintf ("Invalid zero length subtable\n");
1592 return;
1594 goto NextSubTable;
1597 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1598 SubTable->Length, InfoTable);
1599 if (ACPI_FAILURE (Status))
1601 return;
1604 NextSubTable:
1605 /* Point to next sub-table */
1607 Offset += SubTable->Length;
1608 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
1613 /*******************************************************************************
1615 * FUNCTION: AcpiDmDumpMcfg
1617 * PARAMETERS: Table - A MCFG Table
1619 * RETURN: None
1621 * DESCRIPTION: Format the contents of a MCFG table
1623 ******************************************************************************/
1625 void
1626 AcpiDmDumpMcfg (
1627 ACPI_TABLE_HEADER *Table)
1629 ACPI_STATUS Status;
1630 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
1631 ACPI_MCFG_ALLOCATION *SubTable;
1634 /* Main table */
1636 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1637 if (ACPI_FAILURE (Status))
1639 return;
1642 /* Sub-tables */
1644 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1645 while (Offset < Table->Length)
1647 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1649 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1650 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1651 return;
1654 AcpiOsPrintf ("\n");
1655 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1656 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1657 if (ACPI_FAILURE (Status))
1659 return;
1662 /* Point to next sub-table (each subtable is of fixed length) */
1664 Offset += sizeof (ACPI_MCFG_ALLOCATION);
1665 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
1666 sizeof (ACPI_MCFG_ALLOCATION));
1671 /*******************************************************************************
1673 * FUNCTION: AcpiDmDumpMpst
1675 * PARAMETERS: Table - A MPST Table
1677 * RETURN: None
1679 * DESCRIPTION: Format the contents of a MPST table
1681 ******************************************************************************/
1683 void
1684 AcpiDmDumpMpst (
1685 ACPI_TABLE_HEADER *Table)
1687 ACPI_STATUS Status;
1688 UINT32 Offset = sizeof (ACPI_TABLE_MPST);
1689 ACPI_MPST_POWER_NODE *SubTable0;
1690 ACPI_MPST_POWER_STATE *SubTable0A;
1691 ACPI_MPST_COMPONENT *SubTable0B;
1692 ACPI_MPST_DATA_HDR *SubTable1;
1693 ACPI_MPST_POWER_DATA *SubTable2;
1694 UINT16 SubtableCount;
1695 UINT32 PowerStateCount;
1696 UINT32 ComponentCount;
1699 /* Main table */
1701 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1702 if (ACPI_FAILURE (Status))
1704 return;
1707 /* Subtable: Memory Power Node(s) */
1709 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1710 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1712 while ((Offset < Table->Length) && SubtableCount)
1714 AcpiOsPrintf ("\n");
1715 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
1716 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1717 if (ACPI_FAILURE (Status))
1719 return;
1722 /* Extract the sub-subtable counts */
1724 PowerStateCount = SubTable0->NumPowerStates;
1725 ComponentCount = SubTable0->NumPhysicalComponents;
1726 Offset += sizeof (ACPI_MPST_POWER_NODE);
1728 /* Sub-subtables - Memory Power State Structure(s) */
1730 SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0,
1731 sizeof (ACPI_MPST_POWER_NODE));
1733 while (PowerStateCount)
1735 AcpiOsPrintf ("\n");
1736 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
1737 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1738 if (ACPI_FAILURE (Status))
1740 return;
1743 SubTable0A++;
1744 PowerStateCount--;
1745 Offset += sizeof (ACPI_MPST_POWER_STATE);
1748 /* Sub-subtables - Physical Component ID Structure(s) */
1750 SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A);
1752 if (ComponentCount)
1754 AcpiOsPrintf ("\n");
1757 while (ComponentCount)
1759 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
1760 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1761 if (ACPI_FAILURE (Status))
1763 return;
1766 SubTable0B++;
1767 ComponentCount--;
1768 Offset += sizeof (ACPI_MPST_COMPONENT);
1771 /* Point to next Memory Power Node subtable */
1773 SubtableCount--;
1774 SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
1775 sizeof (ACPI_MPST_POWER_NODE) +
1776 (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
1777 (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
1780 /* Subtable: Count of Memory Power State Characteristic structures */
1782 AcpiOsPrintf ("\n");
1783 SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
1784 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
1785 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1786 if (ACPI_FAILURE (Status))
1788 return;
1791 SubtableCount = SubTable1->CharacteristicsCount;
1792 Offset += sizeof (ACPI_MPST_DATA_HDR);
1794 /* Subtable: Memory Power State Characteristics structure(s) */
1796 SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR));
1798 while ((Offset < Table->Length) && SubtableCount)
1800 AcpiOsPrintf ("\n");
1801 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
1802 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1803 if (ACPI_FAILURE (Status))
1805 return;
1808 SubTable2++;
1809 SubtableCount--;
1810 Offset += sizeof (ACPI_MPST_POWER_DATA);
1815 /*******************************************************************************
1817 * FUNCTION: AcpiDmDumpMsct
1819 * PARAMETERS: Table - A MSCT table
1821 * RETURN: None
1823 * DESCRIPTION: Format the contents of a MSCT
1825 ******************************************************************************/
1827 void
1828 AcpiDmDumpMsct (
1829 ACPI_TABLE_HEADER *Table)
1831 ACPI_STATUS Status;
1832 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
1833 ACPI_MSCT_PROXIMITY *SubTable;
1836 /* Main table */
1838 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1839 if (ACPI_FAILURE (Status))
1841 return;
1844 /* Sub-tables */
1846 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1847 while (Offset < Table->Length)
1849 /* Common sub-table header */
1851 AcpiOsPrintf ("\n");
1852 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1853 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1854 if (ACPI_FAILURE (Status))
1856 return;
1859 /* Point to next sub-table */
1861 Offset += sizeof (ACPI_MSCT_PROXIMITY);
1862 SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
1867 /*******************************************************************************
1869 * FUNCTION: AcpiDmDumpMtmr
1871 * PARAMETERS: Table - A MTMR table
1873 * RETURN: None
1875 * DESCRIPTION: Format the contents of a MTMR
1877 ******************************************************************************/
1879 void
1880 AcpiDmDumpMtmr (
1881 ACPI_TABLE_HEADER *Table)
1883 ACPI_STATUS Status;
1884 UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
1885 ACPI_MTMR_ENTRY *SubTable;
1888 /* Main table */
1890 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
1891 if (ACPI_FAILURE (Status))
1893 return;
1896 /* Sub-tables */
1898 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
1899 while (Offset < Table->Length)
1901 /* Common sub-table header */
1903 AcpiOsPrintf ("\n");
1904 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
1905 sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
1906 if (ACPI_FAILURE (Status))
1908 return;
1911 /* Point to next sub-table */
1913 Offset += sizeof (ACPI_MTMR_ENTRY);
1914 SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
1919 /*******************************************************************************
1921 * FUNCTION: AcpiDmDumpPcct
1923 * PARAMETERS: Table - A PCCT table
1925 * RETURN: None
1927 * DESCRIPTION: Format the contents of a PCCT. This table type consists
1928 * of an open-ended number of subtables.
1930 ******************************************************************************/
1932 void
1933 AcpiDmDumpPcct (
1934 ACPI_TABLE_HEADER *Table)
1936 ACPI_STATUS Status;
1937 ACPI_PCCT_SUBSPACE *SubTable;
1938 UINT32 Length = Table->Length;
1939 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
1942 /* Main table */
1944 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1945 if (ACPI_FAILURE (Status))
1947 return;
1950 /* Sub-tables */
1952 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1953 while (Offset < Table->Length)
1955 AcpiOsPrintf ("\n");
1956 Status = AcpiDmDumpTable (Length, Offset, SubTable,
1957 SubTable->Header.Length, AcpiDmTableInfoPcct0);
1958 if (ACPI_FAILURE (Status))
1960 return;
1963 /* Point to next sub-table */
1965 Offset += SubTable->Header.Length;
1966 SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
1967 SubTable->Header.Length);
1972 /*******************************************************************************
1974 * FUNCTION: AcpiDmDumpPmtt
1976 * PARAMETERS: Table - A PMTT table
1978 * RETURN: None
1980 * DESCRIPTION: Format the contents of a PMTT. This table type consists
1981 * of an open-ended number of subtables.
1983 ******************************************************************************/
1985 void
1986 AcpiDmDumpPmtt (
1987 ACPI_TABLE_HEADER *Table)
1989 ACPI_STATUS Status;
1990 ACPI_PMTT_HEADER *SubTable;
1991 ACPI_PMTT_HEADER *MemSubTable;
1992 ACPI_PMTT_HEADER *DimmSubTable;
1993 ACPI_PMTT_DOMAIN *DomainArray;
1994 UINT32 Length = Table->Length;
1995 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
1996 UINT32 MemOffset;
1997 UINT32 DimmOffset;
1998 UINT32 DomainOffset;
1999 UINT32 DomainCount;
2002 /* Main table */
2004 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2005 if (ACPI_FAILURE (Status))
2007 return;
2010 /* Subtables */
2012 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2013 while (Offset < Table->Length)
2015 /* Common subtable header */
2017 AcpiOsPrintf ("\n");
2018 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2019 SubTable->Length, AcpiDmTableInfoPmttHdr);
2020 if (ACPI_FAILURE (Status))
2022 return;
2025 /* Only Socket subtables are expected at this level */
2027 if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET)
2029 AcpiOsPrintf (
2030 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2031 SubTable->Type);
2032 return;
2035 /* Dump the fixed-length portion of the subtable */
2037 Status = AcpiDmDumpTable (Length, Offset, SubTable,
2038 SubTable->Length, AcpiDmTableInfoPmtt0);
2039 if (ACPI_FAILURE (Status))
2041 return;
2044 /* Walk the memory controller subtables */
2046 MemOffset = sizeof (ACPI_PMTT_SOCKET);
2047 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
2048 sizeof (ACPI_PMTT_SOCKET));
2050 while (((Offset + MemOffset) < Table->Length) &&
2051 (MemOffset < SubTable->Length))
2053 /* Common subtable header */
2055 AcpiOsPrintf ("\n");
2056 Status = AcpiDmDumpTable (Length,
2057 Offset + MemOffset, MemSubTable,
2058 MemSubTable->Length, AcpiDmTableInfoPmttHdr);
2059 if (ACPI_FAILURE (Status))
2061 return;
2064 /* Only memory controller subtables are expected at this level */
2066 if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER)
2068 AcpiOsPrintf (
2069 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2070 MemSubTable->Type);
2071 return;
2074 /* Dump the fixed-length portion of the controller subtable */
2076 Status = AcpiDmDumpTable (Length,
2077 Offset + MemOffset, MemSubTable,
2078 MemSubTable->Length, AcpiDmTableInfoPmtt1);
2079 if (ACPI_FAILURE (Status))
2081 return;
2084 /* Walk the variable count of proximity domains */
2086 DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
2087 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
2088 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
2089 sizeof (ACPI_PMTT_CONTROLLER));
2091 while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
2092 ((MemOffset + DomainOffset) < SubTable->Length) &&
2093 DomainCount)
2095 Status = AcpiDmDumpTable (Length,
2096 Offset + MemOffset + DomainOffset, DomainArray,
2097 sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
2098 if (ACPI_FAILURE (Status))
2100 return;
2103 DomainOffset += sizeof (ACPI_PMTT_DOMAIN);
2104 DomainArray++;
2105 DomainCount--;
2108 if (DomainCount)
2110 AcpiOsPrintf (
2111 "\n**** DomainCount exceeds subtable length\n\n",
2112 MemSubTable->Type);
2115 /* Walk the physical component (DIMM) subtables */
2117 DimmOffset = DomainOffset;
2118 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
2119 DomainOffset);
2121 while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
2122 (DimmOffset < MemSubTable->Length))
2124 /* Common subtable header */
2126 AcpiOsPrintf ("\n");
2127 Status = AcpiDmDumpTable (Length,
2128 Offset + MemOffset + DimmOffset, DimmSubTable,
2129 DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
2130 if (ACPI_FAILURE (Status))
2132 return;
2135 /* Only DIMM subtables are expected at this level */
2137 if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM)
2139 AcpiOsPrintf (
2140 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2141 DimmSubTable->Type);
2142 return;
2145 /* Dump the fixed-length DIMM subtable */
2147 Status = AcpiDmDumpTable (Length,
2148 Offset + MemOffset + DimmOffset, DimmSubTable,
2149 DimmSubTable->Length, AcpiDmTableInfoPmtt2);
2150 if (ACPI_FAILURE (Status))
2152 return;
2155 /* Point to next DIMM subtable */
2157 DimmOffset += DimmSubTable->Length;
2158 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2159 DimmSubTable, DimmSubTable->Length);
2162 /* Point to next Controller subtable */
2164 MemOffset += MemSubTable->Length;
2165 MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2166 MemSubTable, MemSubTable->Length);
2169 /* Point to next Socket subtable */
2171 Offset += SubTable->Length;
2172 SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2173 SubTable, SubTable->Length);
2178 /*******************************************************************************
2180 * FUNCTION: AcpiDmDumpS3pt
2182 * PARAMETERS: Table - A S3PT table
2184 * RETURN: Length of the table
2186 * DESCRIPTION: Format the contents of a S3PT
2188 ******************************************************************************/
2190 UINT32
2191 AcpiDmDumpS3pt (
2192 ACPI_TABLE_HEADER *Tables)
2194 ACPI_STATUS Status;
2195 UINT32 Offset = sizeof (ACPI_TABLE_S3PT);
2196 ACPI_S3PT_HEADER *SubTable;
2197 ACPI_DMTABLE_INFO *InfoTable;
2198 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2201 /* Main table */
2203 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2204 if (ACPI_FAILURE (Status))
2206 return 0;
2209 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset);
2210 while (Offset < S3ptTable->Length)
2212 /* Common sub-table header */
2214 AcpiOsPrintf ("\n");
2215 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
2216 SubTable->Length, AcpiDmTableInfoS3ptHdr);
2217 if (ACPI_FAILURE (Status))
2219 return 0;
2222 switch (SubTable->Type)
2224 case ACPI_S3PT_TYPE_RESUME:
2226 InfoTable = AcpiDmTableInfoS3pt0;
2227 break;
2229 case ACPI_S3PT_TYPE_SUSPEND:
2231 InfoTable = AcpiDmTableInfoS3pt1;
2232 break;
2234 default:
2236 AcpiOsPrintf ("\n**** Unknown S3PT sub-table type 0x%X\n", SubTable->Type);
2238 /* Attempt to continue */
2240 if (!SubTable->Length)
2242 AcpiOsPrintf ("Invalid zero length subtable\n");
2243 return 0;
2245 goto NextSubTable;
2248 AcpiOsPrintf ("\n");
2249 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
2250 SubTable->Length, InfoTable);
2251 if (ACPI_FAILURE (Status))
2253 return 0;
2256 NextSubTable:
2257 /* Point to next sub-table */
2259 Offset += SubTable->Length;
2260 SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length);
2263 return (S3ptTable->Length);
2267 /*******************************************************************************
2269 * FUNCTION: AcpiDmDumpSlic
2271 * PARAMETERS: Table - A SLIC table
2273 * RETURN: None
2275 * DESCRIPTION: Format the contents of a SLIC
2277 ******************************************************************************/
2279 void
2280 AcpiDmDumpSlic (
2281 ACPI_TABLE_HEADER *Table)
2283 ACPI_STATUS Status;
2284 UINT32 Offset = sizeof (ACPI_TABLE_SLIC);
2285 ACPI_SLIC_HEADER *SubTable;
2286 ACPI_DMTABLE_INFO *InfoTable;
2289 /* There is no main SLIC table, only subtables */
2291 SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset);
2292 while (Offset < Table->Length)
2294 /* Common sub-table header */
2296 AcpiOsPrintf ("\n");
2297 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2298 SubTable->Length, AcpiDmTableInfoSlicHdr);
2299 if (ACPI_FAILURE (Status))
2301 return;
2304 switch (SubTable->Type)
2306 case ACPI_SLIC_TYPE_PUBLIC_KEY:
2308 InfoTable = AcpiDmTableInfoSlic0;
2309 break;
2311 case ACPI_SLIC_TYPE_WINDOWS_MARKER:
2313 InfoTable = AcpiDmTableInfoSlic1;
2314 break;
2316 default:
2318 AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type);
2320 /* Attempt to continue */
2322 if (!SubTable->Length)
2324 AcpiOsPrintf ("Invalid zero length subtable\n");
2325 return;
2327 goto NextSubTable;
2330 AcpiOsPrintf ("\n");
2331 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2332 SubTable->Length, InfoTable);
2333 if (ACPI_FAILURE (Status))
2335 return;
2338 NextSubTable:
2339 /* Point to next sub-table */
2341 Offset += SubTable->Length;
2342 SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length);
2347 /*******************************************************************************
2349 * FUNCTION: AcpiDmDumpSlit
2351 * PARAMETERS: Table - An SLIT
2353 * RETURN: None
2355 * DESCRIPTION: Format the contents of a SLIT
2357 ******************************************************************************/
2359 void
2360 AcpiDmDumpSlit (
2361 ACPI_TABLE_HEADER *Table)
2363 ACPI_STATUS Status;
2364 UINT32 Offset;
2365 UINT8 *Row;
2366 UINT32 Localities;
2367 UINT32 i;
2368 UINT32 j;
2371 /* Main table */
2373 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
2374 if (ACPI_FAILURE (Status))
2376 return;
2379 /* Display the Locality NxN Matrix */
2381 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
2382 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
2383 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
2385 for (i = 0; i < Localities; i++)
2387 /* Display one row of the matrix */
2389 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
2390 for (j = 0; j < Localities; j++)
2392 /* Check for beyond EOT */
2394 if (Offset >= Table->Length)
2396 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
2397 return;
2400 AcpiOsPrintf ("%2.2X", Row[j]);
2401 Offset++;
2403 /* Display up to 16 bytes per output row */
2405 if ((j+1) < Localities)
2407 AcpiOsPrintf (" ");
2409 if (j && (((j+1) % 16) == 0))
2411 AcpiOsPrintf ("\\\n"); /* With line continuation char */
2412 AcpiDmLineHeader (Offset, 0, NULL);
2417 /* Point to next row */
2419 AcpiOsPrintf ("\n");
2420 Row += Localities;
2425 /*******************************************************************************
2427 * FUNCTION: AcpiDmDumpSrat
2429 * PARAMETERS: Table - A SRAT table
2431 * RETURN: None
2433 * DESCRIPTION: Format the contents of a SRAT
2435 ******************************************************************************/
2437 void
2438 AcpiDmDumpSrat (
2439 ACPI_TABLE_HEADER *Table)
2441 ACPI_STATUS Status;
2442 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
2443 ACPI_SUBTABLE_HEADER *SubTable;
2444 ACPI_DMTABLE_INFO *InfoTable;
2447 /* Main table */
2449 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
2450 if (ACPI_FAILURE (Status))
2452 return;
2455 /* Sub-tables */
2457 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2458 while (Offset < Table->Length)
2460 /* Common sub-table header */
2462 AcpiOsPrintf ("\n");
2463 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2464 SubTable->Length, AcpiDmTableInfoSratHdr);
2465 if (ACPI_FAILURE (Status))
2467 return;
2470 switch (SubTable->Type)
2472 case ACPI_SRAT_TYPE_CPU_AFFINITY:
2474 InfoTable = AcpiDmTableInfoSrat0;
2475 break;
2477 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
2479 InfoTable = AcpiDmTableInfoSrat1;
2480 break;
2482 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
2484 InfoTable = AcpiDmTableInfoSrat2;
2485 break;
2487 default:
2488 AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type);
2490 /* Attempt to continue */
2492 if (!SubTable->Length)
2494 AcpiOsPrintf ("Invalid zero length subtable\n");
2495 return;
2497 goto NextSubTable;
2500 AcpiOsPrintf ("\n");
2501 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2502 SubTable->Length, InfoTable);
2503 if (ACPI_FAILURE (Status))
2505 return;
2508 NextSubTable:
2509 /* Point to next sub-table */
2511 Offset += SubTable->Length;
2512 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
2517 /*******************************************************************************
2519 * FUNCTION: AcpiDmDumpVrtc
2521 * PARAMETERS: Table - A VRTC table
2523 * RETURN: None
2525 * DESCRIPTION: Format the contents of a VRTC
2527 ******************************************************************************/
2529 void
2530 AcpiDmDumpVrtc (
2531 ACPI_TABLE_HEADER *Table)
2533 ACPI_STATUS Status;
2534 UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
2535 ACPI_VRTC_ENTRY *SubTable;
2538 /* Main table */
2540 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
2541 if (ACPI_FAILURE (Status))
2543 return;
2546 /* Sub-tables */
2548 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
2549 while (Offset < Table->Length)
2551 /* Common sub-table header */
2553 AcpiOsPrintf ("\n");
2554 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2555 sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
2556 if (ACPI_FAILURE (Status))
2558 return;
2561 /* Point to next sub-table */
2563 Offset += sizeof (ACPI_VRTC_ENTRY);
2564 SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
2569 /*******************************************************************************
2571 * FUNCTION: AcpiDmDumpWdat
2573 * PARAMETERS: Table - A WDAT table
2575 * RETURN: None
2577 * DESCRIPTION: Format the contents of a WDAT
2579 ******************************************************************************/
2581 void
2582 AcpiDmDumpWdat (
2583 ACPI_TABLE_HEADER *Table)
2585 ACPI_STATUS Status;
2586 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
2587 ACPI_WDAT_ENTRY *SubTable;
2590 /* Main table */
2592 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
2593 if (ACPI_FAILURE (Status))
2595 return;
2598 /* Sub-tables */
2600 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
2601 while (Offset < Table->Length)
2603 /* Common sub-table header */
2605 AcpiOsPrintf ("\n");
2606 Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
2607 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
2608 if (ACPI_FAILURE (Status))
2610 return;
2613 /* Point to next sub-table */
2615 Offset += sizeof (ACPI_WDAT_ENTRY);
2616 SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));