Import acpica-unix-20061109 from Intel.
[dragonfly.git] / sys / contrib / dev / acpica-unix-20061109 / common / dmtbdump.c
blobc0e0d62b0a1c64790552212db3c8c59fc3ad3c97
1 /******************************************************************************
3 * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
4 * $Revision: 1.14 $
6 *****************************************************************************/
8 /******************************************************************************
10 * 1. Copyright Notice
12 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13 * All rights reserved.
15 * 2. License
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
41 * 3. Conditions
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
117 #include "acpi.h"
118 #include "acdisasm.h"
119 #include "actables.h"
121 /* This module used for application-level code only */
123 #define _COMPONENT ACPI_CA_DISASSEMBLER
124 ACPI_MODULE_NAME ("dmtbdump")
127 /*******************************************************************************
129 * FUNCTION: AcpiDmDumpRsdp
131 * PARAMETERS: Table - A RSDP
133 * RETURN: Length of the table (there is no length field, use revision)
135 * DESCRIPTION: Format the contents of a RSDP
137 ******************************************************************************/
139 UINT32
140 AcpiDmDumpRsdp (
141 ACPI_TABLE_HEADER *Table)
143 UINT32 Length = ACPI_RSDP_REV0_SIZE;
146 /* Dump the common ACPI 1.0 portion */
148 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
150 /* ACPI 2.0+ contains more data and has a Length field */
152 if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0)
154 Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length;
155 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
158 return (Length);
162 /*******************************************************************************
164 * FUNCTION: AcpiDmDumpRsdt
166 * PARAMETERS: Table - A RSDT
168 * RETURN: None
170 * DESCRIPTION: Format the contents of a RSDT
172 ******************************************************************************/
174 void
175 AcpiDmDumpRsdt (
176 ACPI_TABLE_HEADER *Table)
178 UINT32 *Array;
179 UINT32 Entries;
180 UINT32 Offset;
181 UINT32 i;
184 /* Point to start of table pointer array */
186 Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
187 Offset = sizeof (ACPI_TABLE_HEADER);
189 /* RSDT uses 32-bit pointers */
191 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
193 for (i = 0; i < Entries; i++)
195 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
196 AcpiOsPrintf ("%8.8X\n", Array[i]);
197 Offset += sizeof (UINT32);
202 /*******************************************************************************
204 * FUNCTION: AcpiDmDumpXsdt
206 * PARAMETERS: Table - A XSDT
208 * RETURN: None
210 * DESCRIPTION: Format the contents of a XSDT
212 ******************************************************************************/
214 void
215 AcpiDmDumpXsdt (
216 ACPI_TABLE_HEADER *Table)
218 UINT64 *Array;
219 UINT32 Entries;
220 UINT32 Offset;
221 UINT32 i;
224 /* Point to start of table pointer array */
226 Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
227 Offset = sizeof (ACPI_TABLE_HEADER);
229 /* XSDT uses 64-bit pointers */
231 Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
233 for (i = 0; i < Entries; i++)
235 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
236 AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
237 Offset += sizeof (UINT64);
242 /*******************************************************************************
244 * FUNCTION: AcpiDmDumpFadt
246 * PARAMETERS: Table - A FADT
248 * RETURN: None
250 * DESCRIPTION: Format the contents of a FADT
252 ******************************************************************************/
254 void
255 AcpiDmDumpFadt (
256 ACPI_TABLE_HEADER *Table)
259 /* Common ACPI 1.0 portion of FADT */
261 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
263 /* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */
265 if (Table->Length >= sizeof (ACPI_TABLE_FADT))
267 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
270 /* Validate various fields in the FADT, including length */
272 AcpiTbCreateLocalFadt (Table, Table->Length);
276 /*******************************************************************************
278 * FUNCTION: AcpiDmDumpAsf
280 * PARAMETERS: Table - A ASF table
282 * RETURN: None
284 * DESCRIPTION: Format the contents of a ASF table
286 ******************************************************************************/
288 void
289 AcpiDmDumpAsf (
290 ACPI_TABLE_HEADER *Table)
292 UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
293 ACPI_ASF_INFO *SubTable;
294 ACPI_DMTABLE_INFO *InfoTable;
295 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
296 UINT8 *DataTable = NULL;
297 ACPI_NATIVE_UINT DataCount = 0;
298 ACPI_NATIVE_UINT DataLength = 0;
299 ACPI_NATIVE_UINT DataOffset = 0;
300 ACPI_NATIVE_UINT i;
303 /* No main table, only sub-tables */
305 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
306 while (Offset < Table->Length)
308 /* Common sub-table header */
310 AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr);
312 switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
314 case ACPI_ASF_TYPE_INFO:
315 InfoTable = AcpiDmTableInfoAsf0;
316 break;
318 case ACPI_ASF_TYPE_ALERT:
319 InfoTable = AcpiDmTableInfoAsf1;
320 DataInfoTable = AcpiDmTableInfoAsf1a;
321 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
322 DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts;
323 DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength;
324 DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
325 break;
327 case ACPI_ASF_TYPE_CONTROL:
328 InfoTable = AcpiDmTableInfoAsf2;
329 DataInfoTable = AcpiDmTableInfoAsf2a;
330 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
331 DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls;
332 DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength;
333 DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
334 break;
336 case ACPI_ASF_TYPE_BOOT:
337 InfoTable = AcpiDmTableInfoAsf3;
338 break;
340 case ACPI_ASF_TYPE_ADDRESS:
341 InfoTable = AcpiDmTableInfoAsf4;
342 DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
343 DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices;
344 DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
345 break;
347 default:
348 AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type);
349 return;
352 AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable);
355 /* Dump variable-length extra data */
357 switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
359 case ACPI_ASF_TYPE_ALERT:
360 case ACPI_ASF_TYPE_CONTROL:
362 for (i = 0; i < DataCount; i++)
364 AcpiOsPrintf ("\n");
365 AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable);
367 DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
368 DataOffset += DataLength;
370 break;
372 case ACPI_ASF_TYPE_ADDRESS:
374 for (i = 0; i < DataLength; i++)
376 if (!(i % 16))
378 AcpiDmLineHeader (DataOffset, 1, "Addresses");
381 AcpiOsPrintf ("%2.2X ", *DataTable);
382 DataTable++;
383 DataOffset++;
386 AcpiOsPrintf ("\n");
387 break;
390 AcpiOsPrintf ("\n");
392 /* Point to next sub-table */
394 Offset += SubTable->Header.Length;
395 SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
400 /*******************************************************************************
402 * FUNCTION: AcpiDmDumpCpep
404 * PARAMETERS: Table - A CPEP table
406 * RETURN: None
408 * DESCRIPTION: Format the contents of a CPEP. This table type consists
409 * of an open-ended number of subtables.
411 ******************************************************************************/
413 void
414 AcpiDmDumpCpep (
415 ACPI_TABLE_HEADER *Table)
417 ACPI_CPEP_POLLING *SubTable;
418 UINT32 Length = Table->Length;
419 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
422 /* Main table */
424 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
426 /* Sub-tables */
428 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
429 while (Offset < Table->Length)
431 AcpiOsPrintf ("\n");
432 AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0);
434 /* Point to next sub-table */
436 Offset += SubTable->Length;
437 SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);
442 /*******************************************************************************
444 * FUNCTION: AcpiDmDumpDmar
446 * PARAMETERS: Table - A DMAR table
448 * RETURN: None
450 * DESCRIPTION: Format the contents of a DMAR. This table type consists
451 * of an open-ended number of subtables.
453 ******************************************************************************/
455 void
456 AcpiDmDumpDmar (
457 ACPI_TABLE_HEADER *Table)
459 ACPI_DMAR_HEADER *SubTable;
460 UINT32 Length = Table->Length;
461 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
462 ACPI_DMTABLE_INFO *InfoTable;
463 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
464 UINT32 ScopeOffset;
465 UINT8 *PciPath;
466 UINT32 PathOffset;
469 /* Main table */
471 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
473 /* Sub-tables */
475 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
476 while (Offset < Table->Length)
478 /* Common sub-table header */
480 AcpiOsPrintf ("\n");
481 AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr);
483 switch (SubTable->Type)
485 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
486 InfoTable = AcpiDmTableInfoDmar0;
487 ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
488 break;
489 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
490 InfoTable = AcpiDmTableInfoDmar1;
491 ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
492 break;
493 default:
494 AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
495 return;
498 AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
501 * Currently, a common flag indicates whether there are any
502 * device scope entries present at the end of the subtable.
504 if ((SubTable->Flags & ACPI_DMAR_INCLUDE_ALL) == 0)
506 /* Dump the device scope entries */
508 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
509 while (ScopeOffset < SubTable->Length)
511 AcpiOsPrintf ("\n");
512 AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
513 ScopeTable->Length, AcpiDmTableInfoDmarScope);
515 /* Dump the PCI Path entries for this device scope */
517 PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
519 PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
520 sizeof (ACPI_DMAR_DEVICE_SCOPE));
522 while (PathOffset < ScopeTable->Length)
524 AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
525 AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
527 /* Point to next PCI Path entry */
529 PathOffset += 2;
530 PciPath += 2;
533 /* Point to next device scope entry */
535 ScopeOffset += ScopeTable->Length;
536 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
537 ScopeTable, ScopeTable->Length);
541 /* Point to next sub-table */
543 Offset += SubTable->Length;
544 SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
549 /*******************************************************************************
551 * FUNCTION: AcpiDmDumpMadt
553 * PARAMETERS: Table - A MADT table
555 * RETURN: None
557 * DESCRIPTION: Format the contents of a MADT. This table type consists
558 * of an open-ended number of subtables.
560 ******************************************************************************/
562 void
563 AcpiDmDumpMadt (
564 ACPI_TABLE_HEADER *Table)
566 ACPI_SUBTABLE_HEADER *SubTable;
567 UINT32 Length = Table->Length;
568 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
569 ACPI_DMTABLE_INFO *InfoTable;
572 /* Main table */
574 AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
576 /* Sub-tables */
578 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
579 while (Offset < Table->Length)
581 /* Common sub-table header */
583 AcpiOsPrintf ("\n");
584 AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr);
586 switch (SubTable->Type)
588 case ACPI_MADT_TYPE_LOCAL_APIC:
589 InfoTable = AcpiDmTableInfoMadt0;
590 break;
591 case ACPI_MADT_TYPE_IO_APIC:
592 InfoTable = AcpiDmTableInfoMadt1;
593 break;
594 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
595 InfoTable = AcpiDmTableInfoMadt2;
596 break;
597 case ACPI_MADT_TYPE_NMI_SOURCE:
598 InfoTable = AcpiDmTableInfoMadt3;
599 break;
600 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
601 InfoTable = AcpiDmTableInfoMadt4;
602 break;
603 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
604 InfoTable = AcpiDmTableInfoMadt5;
605 break;
606 case ACPI_MADT_TYPE_IO_SAPIC:
607 InfoTable = AcpiDmTableInfoMadt6;
608 break;
609 case ACPI_MADT_TYPE_LOCAL_SAPIC:
610 InfoTable = AcpiDmTableInfoMadt7;
611 break;
612 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
613 InfoTable = AcpiDmTableInfoMadt8;
614 break;
615 default:
616 AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
617 return;
620 AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
622 /* Point to next sub-table */
624 Offset += SubTable->Length;
625 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
630 /*******************************************************************************
632 * FUNCTION: AcpiDmDumpMcfg
634 * PARAMETERS: Table - A MCFG Table
636 * RETURN: None
638 * DESCRIPTION: Format the contents of a MCFG table
640 ******************************************************************************/
642 void
643 AcpiDmDumpMcfg (
644 ACPI_TABLE_HEADER *Table)
646 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
647 ACPI_MCFG_ALLOCATION *SubTable;
650 /* Main table */
652 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
654 /* Sub-tables */
656 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
657 while (Offset < Table->Length)
659 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
661 AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n",
662 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
663 return;
666 AcpiOsPrintf ("\n");
667 AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0);
669 /* Point to next sub-table (each subtable is of fixed length) */
671 Offset += sizeof (ACPI_MCFG_ALLOCATION);
672 SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
673 sizeof (ACPI_MCFG_ALLOCATION));
678 /*******************************************************************************
680 * FUNCTION: AcpiDmDumpSlit
682 * PARAMETERS: Table - An SLIT
684 * RETURN: None
686 * DESCRIPTION: Format the contents of a SLIT
688 ******************************************************************************/
690 void
691 AcpiDmDumpSlit (
692 ACPI_TABLE_HEADER *Table)
694 UINT32 Offset;
695 UINT8 *Row;
696 UINT32 Localities;
697 UINT32 i;
698 UINT32 j;
701 /* Main table */
703 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
705 /* Display the Locality NxN Matrix */
707 Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
708 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
709 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
711 for (i = 0; i < Localities; i++)
713 /* Display one row of the matrix */
715 AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
716 for (j = 0; j < Localities; j++)
718 /* Check for beyond EOT */
720 if (Offset >= Table->Length)
722 AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
723 return;
726 AcpiOsPrintf ("%2.2X ", Row[j]);
727 Offset++;
729 /* Display up to 16 bytes per output row */
731 if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
733 AcpiOsPrintf ("\n");
734 AcpiDmLineHeader (Offset, 0, "");
738 /* Point to next row */
740 AcpiOsPrintf ("\n");
741 Row += Localities;
746 /*******************************************************************************
748 * FUNCTION: AcpiDmDumpSrat
750 * PARAMETERS: Table - A SRAT table
752 * RETURN: None
754 * DESCRIPTION: Format the contents of a SRAT
756 ******************************************************************************/
758 void
759 AcpiDmDumpSrat (
760 ACPI_TABLE_HEADER *Table)
762 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
763 ACPI_SUBTABLE_HEADER *SubTable;
764 ACPI_DMTABLE_INFO *InfoTable;
767 /* Main table */
769 AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
771 /* Sub-tables */
773 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
774 while (Offset < Table->Length)
776 switch (SubTable->Type)
778 case ACPI_SRAT_TYPE_CPU_AFFINITY:
779 InfoTable = AcpiDmTableInfoSrat0;
780 break;
781 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
782 InfoTable = AcpiDmTableInfoSrat1;
783 break;
784 default:
785 AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
786 return;
789 AcpiOsPrintf ("\n");
790 AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable);
792 /* Point to next sub-table */
794 Offset += SubTable->Length;
795 SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);