1 /******************************************************************************
2 *
3 * Module Name: dmtbdump2 - Dump ACPI data tables that contain no AML code
4 *
5 *****************************************************************************/
6
7 /******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
27 *
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************
115 *
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
118 *
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
133 *
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 *
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
149 *
150 *****************************************************************************/
151
152 #include <wchar.h>
153 #include "acpi.h"
154 #include "accommon.h"
155 #include "acdisasm.h"
156 #include "actables.h"
157 #include "aslcompiler.h"
158
159 /* This module used for application-level code only */
160
161 #define _COMPONENT ACPI_CA_DISASSEMBLER
162 ACPI_MODULE_NAME ("dmtbdump2")
163
164
165 /*******************************************************************************
166 *
167 * FUNCTION: AcpiDmDumpIort
168 *
169 * PARAMETERS: Table - A IORT table
170 *
171 * RETURN: None
172 *
173 * DESCRIPTION: Format the contents of a IORT
174 *
175 ******************************************************************************/
176
177 void
AcpiDmDumpIort(ACPI_TABLE_HEADER * Table)178 AcpiDmDumpIort (
179 ACPI_TABLE_HEADER *Table)
180 {
181 ACPI_STATUS Status;
182 ACPI_TABLE_IORT *Iort;
183 ACPI_IORT_NODE *IortNode;
184 ACPI_IORT_ITS_GROUP *IortItsGroup = NULL;
185 ACPI_IORT_SMMU *IortSmmu = NULL;
186 ACPI_IORT_RMR *IortRmr = NULL;
187 UINT32 Offset;
188 UINT32 NodeOffset;
189 UINT32 Length;
190 ACPI_DMTABLE_INFO *InfoTable;
191 char *String;
192 UINT32 i;
193 UINT32 MappingByteLength;
194 UINT8 Revision;
195
196
197 /* Main table */
198
199 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
200 if (ACPI_FAILURE (Status))
201 {
202 return;
203 }
204
205 Revision = Table->Revision;
206
207 /* IORT Revisions E, E.a and E.c have known issues and are not supported */
208
209 if (Revision == 1 || Revision == 2 || Revision == 4)
210 {
211 AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n",
212 Revision);
213 return;
214 }
215
216 Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table);
217 Offset = sizeof (ACPI_TABLE_IORT);
218
219 /* Dump the OptionalPadding (optional) */
220
221 if (Iort->NodeOffset > Offset)
222 {
223 Status = AcpiDmDumpTable (Table->Length, Offset, Table,
224 Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
225 if (ACPI_FAILURE (Status))
226 {
227 return;
228 }
229 }
230
231 Offset = Iort->NodeOffset;
232 while (Offset < Table->Length)
233 {
234 /* Common subtable header */
235
236 IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
237 AcpiOsPrintf ("\n");
238 Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
239
240 if (Revision == 0)
241 {
242 Status = AcpiDmDumpTable (Table->Length, Offset,
243 IortNode, Length, AcpiDmTableInfoIortHdr);
244 }
245 else if (Revision >= 3)
246 {
247 Status = AcpiDmDumpTable (Table->Length, Offset,
248 IortNode, Length, AcpiDmTableInfoIortHdr3);
249 }
250
251 if (ACPI_FAILURE (Status))
252 {
253 return;
254 }
255
256 NodeOffset = Length;
257
258 switch (IortNode->Type)
259 {
260 case ACPI_IORT_NODE_ITS_GROUP:
261
262 InfoTable = AcpiDmTableInfoIort0;
263 Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers);
264 IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset);
265 break;
266
267 case ACPI_IORT_NODE_NAMED_COMPONENT:
268
269 InfoTable = AcpiDmTableInfoIort1;
270 Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
271 String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
272 Length += strlen (String) + 1;
273 break;
274
275 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
276
277 InfoTable = AcpiDmTableInfoIort2;
278 Length = IortNode->Length - NodeOffset;
279 break;
280
281 case ACPI_IORT_NODE_SMMU:
282
283 InfoTable = AcpiDmTableInfoIort3;
284 Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts);
285 IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
286 break;
287
288 case ACPI_IORT_NODE_SMMU_V3:
289
290 InfoTable = AcpiDmTableInfoIort4;
291 Length = IortNode->Length - NodeOffset;
292 break;
293
294 case ACPI_IORT_NODE_PMCG:
295
296 InfoTable = AcpiDmTableInfoIort5;
297 Length = IortNode->Length - NodeOffset;
298 break;
299
300 case ACPI_IORT_NODE_RMR:
301
302 InfoTable = AcpiDmTableInfoIort6;
303 Length = IortNode->Length - NodeOffset;
304 IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset);
305 break;
306
307 default:
308
309 AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
310 IortNode->Type);
311
312 /* Attempt to continue */
313
314 if (!IortNode->Length)
315 {
316 AcpiOsPrintf ("Invalid zero length IORT node\n");
317 return;
318 }
319 goto NextSubtable;
320 }
321
322 /* Dump the node subtable header */
323
324 AcpiOsPrintf ("\n");
325 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
326 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
327 Length, InfoTable);
328 if (ACPI_FAILURE (Status))
329 {
330 return;
331 }
332
333 NodeOffset += Length;
334
335 /* Dump the node specific data */
336
337 switch (IortNode->Type)
338 {
339 case ACPI_IORT_NODE_ITS_GROUP:
340
341 /* Validate IortItsGroup to avoid compiler warnings */
342
343 if (IortItsGroup)
344 {
345 for (i = 0; i < IortItsGroup->ItsCount; i++)
346 {
347 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
348 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
349 4, AcpiDmTableInfoIort0a);
350 if (ACPI_FAILURE (Status))
351 {
352 return;
353 }
354
355 NodeOffset += 4;
356 }
357 }
358 break;
359
360 case ACPI_IORT_NODE_NAMED_COMPONENT:
361
362 /* Dump the Padding (optional) */
363
364 if (IortNode->Length > NodeOffset)
365 {
366 MappingByteLength =
367 IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
368 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
369 Table, IortNode->Length - NodeOffset - MappingByteLength,
370 AcpiDmTableInfoIort1a);
371 if (ACPI_FAILURE (Status))
372 {
373 return;
374 }
375 }
376 break;
377
378 case ACPI_IORT_NODE_SMMU:
379
380 AcpiOsPrintf ("\n");
381
382 /* Validate IortSmmu to avoid compiler warnings */
383
384 if (IortSmmu)
385 {
386 Length = 2 * sizeof (UINT64);
387 NodeOffset = IortSmmu->GlobalInterruptOffset;
388 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
389 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
390 Length, AcpiDmTableInfoIort3a);
391 if (ACPI_FAILURE (Status))
392 {
393 return;
394 }
395
396 NodeOffset = IortSmmu->ContextInterruptOffset;
397 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
398 {
399 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
400 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
401 8, AcpiDmTableInfoIort3b);
402 if (ACPI_FAILURE (Status))
403 {
404 return;
405 }
406
407 NodeOffset += 8;
408 }
409
410 NodeOffset = IortSmmu->PmuInterruptOffset;
411 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
412 {
413 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
414 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
415 8, AcpiDmTableInfoIort3c);
416 if (ACPI_FAILURE (Status))
417 {
418 return;
419 }
420
421 NodeOffset += 8;
422 }
423 }
424 break;
425
426 case ACPI_IORT_NODE_RMR:
427
428 /* Validate IortRmr to avoid compiler warnings */
429 if (IortRmr)
430 {
431 NodeOffset = IortRmr->RmrOffset;
432 Length = sizeof (ACPI_IORT_RMR_DESC);
433 for (i = 0; i < IortRmr->RmrCount; i++)
434 {
435 AcpiOsPrintf ("\n");
436 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
437 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
438 Length, AcpiDmTableInfoIort6a);
439 if (ACPI_FAILURE (Status))
440 {
441 return;
442 }
443
444 NodeOffset += Length;
445 }
446 }
447 break;
448
449 default:
450
451 break;
452 }
453
454 /* Dump the ID mappings */
455
456 NodeOffset = IortNode->MappingOffset;
457 for (i = 0; i < IortNode->MappingCount; i++)
458 {
459 AcpiOsPrintf ("\n");
460 Length = sizeof (ACPI_IORT_ID_MAPPING);
461 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
462 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
463 Length, AcpiDmTableInfoIortMap);
464 if (ACPI_FAILURE (Status))
465 {
466 return;
467 }
468
469 NodeOffset += Length;
470 }
471
472 NextSubtable:
473 /* Point to next node subtable */
474
475 Offset += IortNode->Length;
476 }
477 }
478
479
480 /*******************************************************************************
481 *
482 * FUNCTION: AcpiDmDumpIvrs
483 *
484 * PARAMETERS: Table - A IVRS table
485 *
486 * RETURN: None
487 *
488 * DESCRIPTION: Format the contents of a IVRS. Notes:
489 * The IVRS is essentially a flat table, with the following
490 * structure:
491 * <Main ACPI Table Header>
492 * <Main subtable - virtualization info>
493 * <IVHD>
494 * <Device Entries>
495 * ...
496 * <IVHD>
497 * <Device Entries>
498 * <IVMD>
499 * ...
500 *
501 ******************************************************************************/
502
503 void
AcpiDmDumpIvrs(ACPI_TABLE_HEADER * Table)504 AcpiDmDumpIvrs (
505 ACPI_TABLE_HEADER *Table)
506 {
507 ACPI_STATUS Status;
508 UINT32 Offset = sizeof (ACPI_TABLE_IVRS);
509 UINT32 EntryOffset;
510 UINT32 EntryLength;
511 UINT32 EntryType;
512 ACPI_IVRS_DEVICE_HID *HidSubtable;
513 ACPI_IVRS_DE_HEADER *DeviceEntry;
514 ACPI_IVRS_HEADER *Subtable;
515 ACPI_DMTABLE_INFO *InfoTable;
516
517
518 /* Main table */
519
520 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
521 if (ACPI_FAILURE (Status))
522 {
523 return;
524 }
525
526 /* Subtables */
527
528 Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
529
530 while (Offset < Table->Length)
531 {
532 switch (Subtable->Type)
533 {
534 /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */
535
536 case ACPI_IVRS_TYPE_HARDWARE1:
537
538 AcpiOsPrintf ("\n");
539 InfoTable = AcpiDmTableInfoIvrsHware1;
540 break;
541
542 /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */
543
544 case ACPI_IVRS_TYPE_HARDWARE2:
545 case ACPI_IVRS_TYPE_HARDWARE3:
546
547 AcpiOsPrintf ("\n");
548 InfoTable = AcpiDmTableInfoIvrsHware23;
549 break;
550
551 /* Types 20h-22h, IVMD (I/O Virtualization Memory Definition Block) */
552
553 case ACPI_IVRS_TYPE_MEMORY1:
554 case ACPI_IVRS_TYPE_MEMORY2:
555 case ACPI_IVRS_TYPE_MEMORY3:
556
557 AcpiOsPrintf ("\n");
558 InfoTable = AcpiDmTableInfoIvrsMemory;
559 break;
560
561 default:
562
563 AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n",
564 Subtable->Type);
565
566 /* Attempt to continue */
567
568 if (!Subtable->Length)
569 {
570 AcpiOsPrintf ("Invalid zero length subtable\n");
571 return;
572 }
573 goto NextSubtable;
574 }
575
576 /* Dump the subtable */
577
578 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
579 Subtable->Length, InfoTable);
580 if (ACPI_FAILURE (Status))
581 {
582 return;
583 }
584
585 /* The hardware subtables (IVHD) can contain multiple device entries */
586
587 if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
588 Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 ||
589 Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3)
590 {
591 if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1)
592 {
593 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1);
594 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
595 sizeof (ACPI_IVRS_HARDWARE1));
596 }
597 else
598 {
599 /* ACPI_IVRS_TYPE_HARDWARE2, HARDWARE3 subtable types */
600
601 EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2);
602 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
603 sizeof (ACPI_IVRS_HARDWARE2));
604 }
605
606 /* Process all of the Device Entries */
607
608 while (EntryOffset < (Offset + Subtable->Length))
609 {
610 AcpiOsPrintf ("\n");
611
612 /*
613 * Upper 2 bits of Type encode the length of the device entry
614 *
615 * 00 = 4 byte
616 * 01 = 8 byte
617 * 1x = variable length
618 */
619 EntryType = DeviceEntry->Type;
620 EntryLength = EntryType >> 6 == 1 ? 8 : 4;
621
622 switch (EntryType)
623 {
624 /* 4-byte device entries */
625
626 case ACPI_IVRS_TYPE_PAD4:
627 case ACPI_IVRS_TYPE_ALL:
628 case ACPI_IVRS_TYPE_SELECT:
629 case ACPI_IVRS_TYPE_START:
630 case ACPI_IVRS_TYPE_END:
631
632 InfoTable = AcpiDmTableInfoIvrs4;
633 break;
634
635 /* 8-byte entries, type A */
636
637 case ACPI_IVRS_TYPE_ALIAS_SELECT:
638 case ACPI_IVRS_TYPE_ALIAS_START:
639
640 InfoTable = AcpiDmTableInfoIvrs8a;
641 break;
642
643 /* 8-byte entries, type B */
644
645 case ACPI_IVRS_TYPE_PAD8:
646 case ACPI_IVRS_TYPE_EXT_SELECT:
647 case ACPI_IVRS_TYPE_EXT_START:
648
649 InfoTable = AcpiDmTableInfoIvrs8b;
650 break;
651
652 /* 8-byte entries, type C */
653
654 case ACPI_IVRS_TYPE_SPECIAL:
655
656 InfoTable = AcpiDmTableInfoIvrs8c;
657 break;
658
659 /* Variable-length entries */
660
661 case ACPI_IVRS_TYPE_HID:
662
663 EntryLength = 4;
664 InfoTable = AcpiDmTableInfoIvrsHid;
665 break;
666
667 default:
668 InfoTable = AcpiDmTableInfoIvrs4;
669 AcpiOsPrintf (
670 "\n**** Unknown IVRS device entry type/length: "
671 "0x%.2X/0x%X at offset 0x%.4X: (header below)\n",
672 EntryType, EntryLength, EntryOffset);
673 break;
674 }
675
676 /* Dump the Device Entry */
677
678 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
679 DeviceEntry, EntryLength, InfoTable);
680 if (ACPI_FAILURE (Status))
681 {
682 return;
683 }
684
685 HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry);
686 EntryOffset += EntryLength;
687 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, HidSubtable,
688 EntryLength);
689
690 if (EntryType == ACPI_IVRS_TYPE_HID)
691 {
692 /*
693 * Determine if the HID is an integer or a string.
694 * An integer is defined to be 32 bits, with the upper 32 bits
695 * set to zero. (from the ACPI Spec): "The HID can be a 32-bit
696 * integer or a character string. If an integer, the lower
697 * 4 bytes of the field contain the integer and the upper
698 * 4 bytes are padded with 0".
699 */
700 if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid))
701 {
702 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
703 &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger);
704 }
705 else
706 {
707 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
708 &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString);
709 }
710 if (ACPI_FAILURE (Status))
711 {
712 return;
713 }
714
715 EntryOffset += 8;
716
717 /*
718 * Determine if the CID is an integer or a string. The format
719 * of the CID is the same as the HID above. From ACPI Spec:
720 * "If present, CID must be a single Compatible Device ID
721 * following the same format as the HID field."
722 */
723 if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid))
724 {
725 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
726 &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger);
727 }
728 else
729 {
730 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
731 &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString);
732 }
733 if (ACPI_FAILURE (Status))
734 {
735 return;
736 }
737
738 EntryOffset += 8;
739 EntryLength = HidSubtable->UidLength;
740
741 if (EntryLength > ACPI_IVRS_UID_NOT_PRESENT)
742 {
743 /* Dump the UID based upon the UidType field (String or Integer) */
744
745 if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING)
746 {
747 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
748 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString);
749 if (ACPI_FAILURE (Status))
750 {
751 return;
752 }
753 }
754 else /* ACPI_IVRS_UID_IS_INTEGER */
755 {
756 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
757 &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger);
758 if (ACPI_FAILURE (Status))
759 {
760 return;
761 }
762 }
763 }
764
765 EntryOffset += EntryLength+2;
766 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER,
767 Table, EntryOffset);
768 }
769 }
770 }
771
772 NextSubtable:
773 /* Point to next subtable */
774
775 Offset += Subtable->Length;
776 Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
777 }
778 }
779
780
781 /*******************************************************************************
782 *
783 * FUNCTION: AcpiDmDumpLpit
784 *
785 * PARAMETERS: Table - A LPIT table
786 *
787 * RETURN: None
788 *
789 * DESCRIPTION: Format the contents of a LPIT. This table type consists
790 * of an open-ended number of subtables. Note: There are no
791 * entries in the main table. An LPIT consists of the table
792 * header and then subtables only.
793 *
794 ******************************************************************************/
795
796 void
AcpiDmDumpLpit(ACPI_TABLE_HEADER * Table)797 AcpiDmDumpLpit (
798 ACPI_TABLE_HEADER *Table)
799 {
800 ACPI_STATUS Status;
801 ACPI_LPIT_HEADER *Subtable;
802 UINT32 Length = Table->Length;
803 UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
804 ACPI_DMTABLE_INFO *InfoTable;
805 UINT32 SubtableLength;
806
807
808 /* Subtables */
809
810 Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
811 while (Offset < Table->Length)
812 {
813 /* Common subtable header */
814
815 Status = AcpiDmDumpTable (Length, Offset, Subtable,
816 sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
817 if (ACPI_FAILURE (Status))
818 {
819 return;
820 }
821
822 switch (Subtable->Type)
823 {
824 case ACPI_LPIT_TYPE_NATIVE_CSTATE:
825
826 InfoTable = AcpiDmTableInfoLpit0;
827 SubtableLength = sizeof (ACPI_LPIT_NATIVE);
828 break;
829
830 default:
831
832 /* Cannot continue on unknown type - no length */
833
834 AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
835 Subtable->Type);
836 return;
837 }
838
839 Status = AcpiDmDumpTable (Length, Offset, Subtable,
840 SubtableLength, InfoTable);
841 if (ACPI_FAILURE (Status))
842 {
843 return;
844 }
845
846 AcpiOsPrintf ("\n");
847
848 /* Point to next subtable */
849
850 Offset += SubtableLength;
851 Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength);
852 }
853 }
854
855
856 /*******************************************************************************
857 *
858 * FUNCTION: AcpiDmDumpMadt
859 *
860 * PARAMETERS: Table - A MADT table
861 *
862 * RETURN: None
863 *
864 * DESCRIPTION: Format the contents of a MADT. This table type consists
865 * of an open-ended number of subtables.
866 *
867 ******************************************************************************/
868
869 void
AcpiDmDumpMadt(ACPI_TABLE_HEADER * Table)870 AcpiDmDumpMadt (
871 ACPI_TABLE_HEADER *Table)
872 {
873 ACPI_STATUS Status;
874 ACPI_SUBTABLE_HEADER *Subtable;
875 UINT32 Length = Table->Length;
876 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
877 ACPI_DMTABLE_INFO *InfoTable;
878
879
880 /* Main table */
881
882 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
883 if (ACPI_FAILURE (Status))
884 {
885 return;
886 }
887
888 /* Subtables */
889
890 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
891 DbgPrint (ASL_PARSE_OUTPUT, "//0B) Offset %X, from table start: 0x%8.8X%8.8X\n",
892 Offset, ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
893 while (Offset < Table->Length)
894 {
895 /* Common subtable header */
896
897 AcpiOsPrintf ("\n");
898 Status = AcpiDmDumpTable (Length, Offset, Subtable,
899 Subtable->Length, AcpiDmTableInfoMadtHdr);
900 if (ACPI_FAILURE (Status))
901 {
902 return;
903 }
904
905 DbgPrint (ASL_PARSE_OUTPUT, "subtableType: %X\n", Subtable->Type);
906 switch (Subtable->Type)
907 {
908 case ACPI_MADT_TYPE_LOCAL_APIC:
909
910 InfoTable = AcpiDmTableInfoMadt0;
911 break;
912
913 case ACPI_MADT_TYPE_IO_APIC:
914
915 InfoTable = AcpiDmTableInfoMadt1;
916 break;
917
918 case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
919
920 InfoTable = AcpiDmTableInfoMadt2;
921 break;
922
923 case ACPI_MADT_TYPE_NMI_SOURCE:
924
925 InfoTable = AcpiDmTableInfoMadt3;
926 break;
927
928 case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
929
930 InfoTable = AcpiDmTableInfoMadt4;
931 break;
932
933 case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
934
935 InfoTable = AcpiDmTableInfoMadt5;
936 break;
937
938 case ACPI_MADT_TYPE_IO_SAPIC:
939
940 InfoTable = AcpiDmTableInfoMadt6;
941 break;
942
943 case ACPI_MADT_TYPE_LOCAL_SAPIC:
944
945 InfoTable = AcpiDmTableInfoMadt7;
946 break;
947
948 case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
949
950 InfoTable = AcpiDmTableInfoMadt8;
951 break;
952
953 case ACPI_MADT_TYPE_LOCAL_X2APIC:
954
955 InfoTable = AcpiDmTableInfoMadt9;
956 break;
957
958 case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
959
960 InfoTable = AcpiDmTableInfoMadt10;
961 break;
962
963 case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
964
965 InfoTable = AcpiDmTableInfoMadt11;
966 break;
967
968 case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
969
970 InfoTable = AcpiDmTableInfoMadt12;
971 break;
972
973 case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
974
975 InfoTable = AcpiDmTableInfoMadt13;
976 break;
977
978 case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
979
980 InfoTable = AcpiDmTableInfoMadt14;
981 break;
982
983 case ACPI_MADT_TYPE_GENERIC_TRANSLATOR:
984
985 InfoTable = AcpiDmTableInfoMadt15;
986 break;
987
988 case ACPI_MADT_TYPE_MULTIPROC_WAKEUP:
989
990 InfoTable = AcpiDmTableInfoMadt16;
991 break;
992
993 case ACPI_MADT_TYPE_CORE_PIC:
994
995 InfoTable = AcpiDmTableInfoMadt17;
996 break;
997
998 case ACPI_MADT_TYPE_LIO_PIC:
999
1000 InfoTable = AcpiDmTableInfoMadt18;
1001 break;
1002
1003 case ACPI_MADT_TYPE_HT_PIC:
1004
1005 InfoTable = AcpiDmTableInfoMadt19;
1006 break;
1007
1008 case ACPI_MADT_TYPE_EIO_PIC:
1009
1010 InfoTable = AcpiDmTableInfoMadt20;
1011 break;
1012
1013 case ACPI_MADT_TYPE_MSI_PIC:
1014
1015 InfoTable = AcpiDmTableInfoMadt21;
1016 break;
1017
1018 case ACPI_MADT_TYPE_BIO_PIC:
1019
1020 InfoTable = AcpiDmTableInfoMadt22;
1021 break;
1022
1023 case ACPI_MADT_TYPE_LPC_PIC:
1024
1025 InfoTable = AcpiDmTableInfoMadt23;
1026 break;
1027
1028 case ACPI_MADT_TYPE_RINTC:
1029
1030 InfoTable = AcpiDmTableInfoMadt24;
1031 break;
1032
1033 case ACPI_MADT_TYPE_IMSIC:
1034
1035 InfoTable = AcpiDmTableInfoMadt25;
1036 break;
1037
1038 case ACPI_MADT_TYPE_APLIC:
1039
1040 InfoTable = AcpiDmTableInfoMadt26;
1041 break;
1042
1043 case ACPI_MADT_TYPE_PLIC:
1044
1045 InfoTable = AcpiDmTableInfoMadt27;
1046 break;
1047
1048 default:
1049
1050 if ((Subtable->Type >= ACPI_MADT_TYPE_RESERVED) &&
1051 (Subtable->Type < ACPI_MADT_TYPE_OEM_RESERVED))
1052 {
1053 AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
1054 Subtable->Type);
1055 goto NextSubtable;
1056 }
1057 else if (Subtable->Type >= ACPI_MADT_TYPE_OEM_RESERVED)
1058 {
1059 DbgPrint (ASL_PARSE_OUTPUT, "//[Found an OEM structure, type = %0x]\n",
1060 Subtable->Type);
1061 Offset += sizeof (ACPI_SUBTABLE_HEADER);
1062 DbgPrint (ASL_PARSE_OUTPUT, "//[0) Subtable->Length = %X, Subtable = %p, Offset = %X]\n",
1063 Subtable->Length, Subtable, Offset);
1064 DbgPrint (ASL_PARSE_OUTPUT, "//[0A) Offset from table start: 0x%8.8X%8.8X]\n",
1065 ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
1066 }
1067
1068 /* Attempt to continue */
1069
1070 if (!Subtable->Length)
1071 {
1072 AcpiOsPrintf ("Invalid zero length subtable\n");
1073 return;
1074 }
1075
1076 /* Dump the OEM data */
1077
1078 Status = AcpiDmDumpTable (Length, Offset, ACPI_CAST_PTR (UINT8, Table) + Offset,
1079 Subtable->Length - sizeof (ACPI_SUBTABLE_HEADER), AcpiDmTableInfoMadt128);
1080 if (ACPI_FAILURE (Status))
1081 {
1082 return;
1083 }
1084
1085 DbgPrint (ASL_PARSE_OUTPUT, "//[1) Subtable->Length = %X, Offset = %X]\n",
1086 Subtable->Length, Offset);
1087 Offset -= sizeof (ACPI_SUBTABLE_HEADER);
1088
1089 goto NextSubtable;
1090 }
1091
1092 DbgPrint (ASL_PARSE_OUTPUT, "//[2) Subtable->Length = %X, Offset = %X]\n",
1093 Subtable->Length, Offset);
1094 Status = AcpiDmDumpTable (Length, Offset, Subtable,
1095 Subtable->Length, InfoTable);
1096 if (ACPI_FAILURE (Status))
1097 {
1098 return;
1099 }
1100
1101 NextSubtable:
1102 /* Point to next subtable */
1103
1104 DbgPrint (ASL_PARSE_OUTPUT, "//[3) Subtable->Length = %X, Offset = %X]\n",
1105 Subtable->Length, Offset);
1106 DbgPrint (ASL_PARSE_OUTPUT, "//[4) Offset from table start: 0x%8.8X%8.8X (%p) %p]\n",
1107 ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (UINT8, Subtable) - ACPI_CAST_PTR (UINT8, Table)), Subtable, Table);
1108 if (Offset > Table->Length)
1109 {
1110 return;
1111 }
1112
1113 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable,
1114 Subtable->Length);
1115
1116 Offset = ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table);
1117 if (Offset >= Table->Length)
1118 {
1119 return;
1120 }
1121
1122 DbgPrint (ASL_PARSE_OUTPUT, "//[5) Next Subtable %p, length %X]\n",
1123 Subtable, Subtable->Length);
1124 DbgPrint (ASL_PARSE_OUTPUT, "//[5B) Offset from table start: 0x%8.8X%8.8X (%p)]\n",
1125 ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)), Subtable);
1126 }
1127 }
1128
1129
1130 /*******************************************************************************
1131 *
1132 * FUNCTION: AcpiDmDumpMcfg
1133 *
1134 * PARAMETERS: Table - A MCFG Table
1135 *
1136 * RETURN: None
1137 *
1138 * DESCRIPTION: Format the contents of a MCFG table
1139 *
1140 ******************************************************************************/
1141
1142 void
AcpiDmDumpMcfg(ACPI_TABLE_HEADER * Table)1143 AcpiDmDumpMcfg (
1144 ACPI_TABLE_HEADER *Table)
1145 {
1146 ACPI_STATUS Status;
1147 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
1148 ACPI_MCFG_ALLOCATION *Subtable;
1149
1150
1151 /* Main table */
1152
1153 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
1154 if (ACPI_FAILURE (Status))
1155 {
1156 return;
1157 }
1158
1159 /* Subtables */
1160
1161 Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
1162 while (Offset < Table->Length)
1163 {
1164 if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
1165 {
1166 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
1167 (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
1168 return;
1169 }
1170
1171 AcpiOsPrintf ("\n");
1172 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1173 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
1174 if (ACPI_FAILURE (Status))
1175 {
1176 return;
1177 }
1178
1179 /* Point to next subtable (each subtable is of fixed length) */
1180
1181 Offset += sizeof (ACPI_MCFG_ALLOCATION);
1182 Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable,
1183 sizeof (ACPI_MCFG_ALLOCATION));
1184 }
1185 }
1186
1187 /*******************************************************************************
1188 *
1189 * FUNCTION: AcpiDmDumpMpam
1190 *
1191 * PARAMETERS: Table - A MPAM table
1192 *
1193 * RETURN: None
1194 *
1195 * DESCRIPTION: Format the contents of a MPAM table
1196 *
1197 ******************************************************************************/
1198
1199 void
AcpiDmDumpMpam(ACPI_TABLE_HEADER * Table)1200 AcpiDmDumpMpam (
1201 ACPI_TABLE_HEADER *Table)
1202 {
1203 ACPI_STATUS Status;
1204 ACPI_MPAM_MSC_NODE *MpamMscNode;
1205 ACPI_MPAM_RESOURCE_NODE *MpamResourceNode;
1206 ACPI_DMTABLE_INFO *InfoTable;
1207 UINT32 Offset = sizeof(ACPI_TABLE_HEADER);
1208 UINT32 MpamResourceNodeLength = 0;
1209
1210 while (Offset < Table->Length)
1211 {
1212 MpamMscNode = ACPI_ADD_PTR (ACPI_MPAM_MSC_NODE, Table, Offset);
1213
1214 /* Subtable: MSC */
1215 Status = AcpiDmDumpTable (MpamMscNode->Length, 0, MpamMscNode, 0,
1216 AcpiDmTableInfoMpam0);
1217 if (ACPI_FAILURE (Status))
1218 {
1219 return;
1220 }
1221
1222 /* Offset the start of the array of resources */
1223 Offset += sizeof(ACPI_MPAM_MSC_NODE);
1224
1225 /* Subtable: MSC RIS(es) */
1226 for (UINT32 ResourceIdx = 0; ResourceIdx < MpamMscNode->NumResouceNodes; ResourceIdx++)
1227 {
1228 MpamResourceNode = ACPI_ADD_PTR (ACPI_MPAM_RESOURCE_NODE, Table, Offset);
1229
1230 MpamResourceNodeLength = sizeof(ACPI_MPAM_RESOURCE_NODE) +
1231 MpamResourceNode->NumFunctionalDeps * sizeof(ACPI_MPAM_FUNC_DEPS);
1232
1233 Offset += MpamResourceNodeLength;
1234
1235 /* Subtable: MSC RIS */
1236 Status = AcpiDmDumpTable (MpamResourceNodeLength, 0, MpamResourceNode, 0,
1237 AcpiDmTableInfoMpam1);
1238 if (ACPI_FAILURE (Status))
1239 {
1240 return;
1241 }
1242
1243 switch (MpamResourceNode->LocatorType)
1244 {
1245 case ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE:
1246 InfoTable = AcpiDmTableInfoMpam1A;
1247 break;
1248 case ACPI_MPAM_LOCATION_TYPE_MEMORY:
1249 InfoTable = AcpiDmTableInfoMpam1B;
1250 break;
1251 case ACPI_MPAM_LOCATION_TYPE_SMMU:
1252 InfoTable = AcpiDmTableInfoMpam1C;
1253 break;
1254 case ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE:
1255 InfoTable = AcpiDmTableInfoMpam1D;
1256 break;
1257 case ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE:
1258 InfoTable = AcpiDmTableInfoMpam1E;
1259 break;
1260 case ACPI_MPAM_LOCATION_TYPE_INTERCONNECT:
1261 InfoTable = AcpiDmTableInfoMpam1F;
1262 break;
1263 case ACPI_MPAM_LOCATION_TYPE_UNKNOWN:
1264 InfoTable = AcpiDmTableInfoMpam1G;
1265 default:
1266 AcpiOsPrintf ("\n**** Unknown MPAM locator type 0x%X\n",
1267 MpamResourceNode->LocatorType);
1268 return;
1269 }
1270
1271 /* Subtable: MSC Resource Locator(s) */
1272 Status = AcpiDmDumpTable (sizeof(ACPI_MPAM_RESOURCE_LOCATOR), 0,
1273 &MpamResourceNode->Locator, 0, InfoTable);
1274 if (ACPI_FAILURE (Status))
1275 {
1276 return;
1277 }
1278
1279 /* Get the number of functional dependencies of an RIS */
1280 Status = AcpiDmDumpTable (sizeof(UINT32), 0, &MpamResourceNode->NumFunctionalDeps, 0,
1281 AcpiDmTableInfoMpam1Deps);
1282 if (ACPI_FAILURE (Status))
1283 {
1284 return;
1285 }
1286
1287 /* Subtable: MSC functional dependencies */
1288 for (UINT32 funcDep = 0; funcDep < MpamResourceNode->NumFunctionalDeps; funcDep++)
1289 {
1290 Status = AcpiDmDumpTable (sizeof(ACPI_MPAM_FUNC_DEPS), 0,
1291 &MpamResourceNode->NumFunctionalDeps, 0, AcpiDmTableInfoMpam2);
1292 if (ACPI_FAILURE (Status))
1293 {
1294 return;
1295 }
1296 }
1297
1298 AcpiOsPrintf ("\n\n");
1299 }
1300
1301 }
1302
1303 return;
1304 }
1305
1306 /*******************************************************************************
1307 *
1308 * FUNCTION: AcpiDmDumpMpst
1309 *
1310 * PARAMETERS: Table - A MPST Table
1311 *
1312 * RETURN: None
1313 *
1314 * DESCRIPTION: Format the contents of a MPST table
1315 *
1316 ******************************************************************************/
1317
1318 void
AcpiDmDumpMpst(ACPI_TABLE_HEADER * Table)1319 AcpiDmDumpMpst (
1320 ACPI_TABLE_HEADER *Table)
1321 {
1322 ACPI_STATUS Status;
1323 UINT32 Offset = sizeof (ACPI_TABLE_MPST);
1324 ACPI_MPST_POWER_NODE *Subtable0;
1325 ACPI_MPST_POWER_STATE *Subtable0A;
1326 ACPI_MPST_COMPONENT *Subtable0B;
1327 ACPI_MPST_DATA_HDR *Subtable1;
1328 ACPI_MPST_POWER_DATA *Subtable2;
1329 UINT16 SubtableCount;
1330 UINT32 PowerStateCount;
1331 UINT32 ComponentCount;
1332
1333
1334 /* Main table */
1335
1336 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
1337 if (ACPI_FAILURE (Status))
1338 {
1339 return;
1340 }
1341
1342 /* Subtable: Memory Power Node(s) */
1343
1344 SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
1345 Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
1346
1347 while ((Offset < Table->Length) && SubtableCount)
1348 {
1349 AcpiOsPrintf ("\n");
1350 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
1351 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
1352 if (ACPI_FAILURE (Status))
1353 {
1354 return;
1355 }
1356
1357 /* Extract the sub-subtable counts */
1358
1359 PowerStateCount = Subtable0->NumPowerStates;
1360 ComponentCount = Subtable0->NumPhysicalComponents;
1361 Offset += sizeof (ACPI_MPST_POWER_NODE);
1362
1363 /* Sub-subtables - Memory Power State Structure(s) */
1364
1365 Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0,
1366 sizeof (ACPI_MPST_POWER_NODE));
1367
1368 while (PowerStateCount)
1369 {
1370 AcpiOsPrintf ("\n");
1371 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
1372 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
1373 if (ACPI_FAILURE (Status))
1374 {
1375 return;
1376 }
1377
1378 Subtable0A++;
1379 PowerStateCount--;
1380 Offset += sizeof (ACPI_MPST_POWER_STATE);
1381 }
1382
1383 /* Sub-subtables - Physical Component ID Structure(s) */
1384
1385 Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A);
1386
1387 if (ComponentCount)
1388 {
1389 AcpiOsPrintf ("\n");
1390 }
1391
1392 while (ComponentCount)
1393 {
1394 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
1395 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
1396 if (ACPI_FAILURE (Status))
1397 {
1398 return;
1399 }
1400
1401 Subtable0B++;
1402 ComponentCount--;
1403 Offset += sizeof (ACPI_MPST_COMPONENT);
1404 }
1405
1406 /* Point to next Memory Power Node subtable */
1407
1408 SubtableCount--;
1409 Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
1410 sizeof (ACPI_MPST_POWER_NODE) +
1411 (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
1412 (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
1413 }
1414
1415 /* Subtable: Count of Memory Power State Characteristic structures */
1416
1417 AcpiOsPrintf ("\n");
1418 Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
1419 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
1420 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
1421 if (ACPI_FAILURE (Status))
1422 {
1423 return;
1424 }
1425
1426 SubtableCount = Subtable1->CharacteristicsCount;
1427 Offset += sizeof (ACPI_MPST_DATA_HDR);
1428
1429 /* Subtable: Memory Power State Characteristics structure(s) */
1430
1431 Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
1432 sizeof (ACPI_MPST_DATA_HDR));
1433
1434 while ((Offset < Table->Length) && SubtableCount)
1435 {
1436 AcpiOsPrintf ("\n");
1437 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
1438 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
1439 if (ACPI_FAILURE (Status))
1440 {
1441 return;
1442 }
1443
1444 Subtable2++;
1445 SubtableCount--;
1446 Offset += sizeof (ACPI_MPST_POWER_DATA);
1447 }
1448 }
1449
1450
1451 /*******************************************************************************
1452 *
1453 * FUNCTION: AcpiDmDumpMsct
1454 *
1455 * PARAMETERS: Table - A MSCT table
1456 *
1457 * RETURN: None
1458 *
1459 * DESCRIPTION: Format the contents of a MSCT
1460 *
1461 ******************************************************************************/
1462
1463 void
AcpiDmDumpMsct(ACPI_TABLE_HEADER * Table)1464 AcpiDmDumpMsct (
1465 ACPI_TABLE_HEADER *Table)
1466 {
1467 ACPI_STATUS Status;
1468 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
1469 ACPI_MSCT_PROXIMITY *Subtable;
1470
1471
1472 /* Main table */
1473
1474 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
1475 if (ACPI_FAILURE (Status))
1476 {
1477 return;
1478 }
1479
1480 /* Subtables */
1481
1482 Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
1483 while (Offset < Table->Length)
1484 {
1485 /* Common subtable header */
1486
1487 AcpiOsPrintf ("\n");
1488 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1489 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
1490 if (ACPI_FAILURE (Status))
1491 {
1492 return;
1493 }
1494
1495 /* Point to next subtable */
1496
1497 Offset += sizeof (ACPI_MSCT_PROXIMITY);
1498 Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable,
1499 sizeof (ACPI_MSCT_PROXIMITY));
1500 }
1501 }
1502
1503
1504 /*******************************************************************************
1505 *
1506 * FUNCTION: AcpiDmDumpNfit
1507 *
1508 * PARAMETERS: Table - A NFIT table
1509 *
1510 * RETURN: None
1511 *
1512 * DESCRIPTION: Format the contents of an NFIT.
1513 *
1514 ******************************************************************************/
1515
1516 void
AcpiDmDumpNfit(ACPI_TABLE_HEADER * Table)1517 AcpiDmDumpNfit (
1518 ACPI_TABLE_HEADER *Table)
1519 {
1520 ACPI_STATUS Status;
1521 UINT32 Offset = sizeof (ACPI_TABLE_NFIT);
1522 UINT32 FieldOffset = 0;
1523 UINT32 Length;
1524 ACPI_NFIT_HEADER *Subtable;
1525 ACPI_DMTABLE_INFO *InfoTable;
1526 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
1527 ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
1528 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
1529 UINT32 i;
1530
1531
1532 /* Main table */
1533
1534 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
1535 if (ACPI_FAILURE (Status))
1536 {
1537 return;
1538 }
1539
1540 /* Subtables */
1541
1542 Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
1543 while (Offset < Table->Length)
1544 {
1545 /* NFIT subtable header */
1546
1547 AcpiOsPrintf ("\n");
1548 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1549 Subtable->Length, AcpiDmTableInfoNfitHdr);
1550 if (ACPI_FAILURE (Status))
1551 {
1552 return;
1553 }
1554
1555 switch (Subtable->Type)
1556 {
1557 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
1558
1559 InfoTable = AcpiDmTableInfoNfit0;
1560 break;
1561
1562 case ACPI_NFIT_TYPE_MEMORY_MAP:
1563
1564 InfoTable = AcpiDmTableInfoNfit1;
1565 break;
1566
1567 case ACPI_NFIT_TYPE_INTERLEAVE:
1568
1569 /* Has a variable number of 32-bit values at the end */
1570
1571 InfoTable = AcpiDmTableInfoNfit2;
1572 FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
1573 break;
1574
1575 case ACPI_NFIT_TYPE_SMBIOS:
1576
1577 SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable);
1578 InfoTable = AcpiDmTableInfoNfit3;
1579 break;
1580
1581 case ACPI_NFIT_TYPE_CONTROL_REGION:
1582
1583 InfoTable = AcpiDmTableInfoNfit4;
1584 break;
1585
1586 case ACPI_NFIT_TYPE_DATA_REGION:
1587
1588 InfoTable = AcpiDmTableInfoNfit5;
1589 break;
1590
1591 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1592
1593 /* Has a variable number of 64-bit addresses at the end */
1594
1595 InfoTable = AcpiDmTableInfoNfit6;
1596 FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS);
1597 break;
1598
1599 case ACPI_NFIT_TYPE_CAPABILITIES: /* ACPI 6.0A */
1600
1601 InfoTable = AcpiDmTableInfoNfit7;
1602 break;
1603
1604 default:
1605 AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
1606 Subtable->Type);
1607
1608 /* Attempt to continue */
1609
1610 if (!Subtable->Length)
1611 {
1612 AcpiOsPrintf ("Invalid zero length subtable\n");
1613 return;
1614 }
1615 goto NextSubtable;
1616 }
1617
1618 AcpiOsPrintf ("\n");
1619 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
1620 Subtable->Length, InfoTable);
1621 if (ACPI_FAILURE (Status))
1622 {
1623 return;
1624 }
1625
1626 /* Per-subtable variable-length fields */
1627
1628 switch (Subtable->Type)
1629 {
1630 case ACPI_NFIT_TYPE_INTERLEAVE:
1631
1632 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
1633 for (i = 0; i < Interleave->LineCount; i++)
1634 {
1635 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1636 &Interleave->LineOffset[i],
1637 sizeof (UINT32), AcpiDmTableInfoNfit2a);
1638 if (ACPI_FAILURE (Status))
1639 {
1640 return;
1641 }
1642
1643 FieldOffset += sizeof (UINT32);
1644 }
1645 break;
1646
1647 case ACPI_NFIT_TYPE_SMBIOS:
1648
1649 Length = Subtable->Length -
1650 sizeof (ACPI_NFIT_SMBIOS);
1651
1652 if (Length)
1653 {
1654 Status = AcpiDmDumpTable (Table->Length,
1655 sizeof (ACPI_NFIT_SMBIOS),
1656 SmbiosInfo,
1657 Length, AcpiDmTableInfoNfit3a);
1658 if (ACPI_FAILURE (Status))
1659 {
1660 return;
1661 }
1662 }
1663
1664 break;
1665
1666 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
1667
1668 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
1669 for (i = 0; i < Hint->HintCount; i++)
1670 {
1671 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
1672 &Hint->HintAddress[i],
1673 sizeof (UINT64), AcpiDmTableInfoNfit6a);
1674 if (ACPI_FAILURE (Status))
1675 {
1676 return;
1677 }
1678
1679 FieldOffset += sizeof (UINT64);
1680 }
1681 break;
1682
1683 default:
1684 break;
1685 }
1686
1687 NextSubtable:
1688 /* Point to next subtable */
1689
1690 Offset += Subtable->Length;
1691 Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
1692 }
1693 }
1694
1695
1696 /*******************************************************************************
1697 *
1698 * FUNCTION: AcpiDmDumpPcct
1699 *
1700 * PARAMETERS: Table - A PCCT table
1701 *
1702 * RETURN: None
1703 *
1704 * DESCRIPTION: Format the contents of a PCCT. This table type consists
1705 * of an open-ended number of subtables.
1706 *
1707 ******************************************************************************/
1708
1709 void
AcpiDmDumpPcct(ACPI_TABLE_HEADER * Table)1710 AcpiDmDumpPcct (
1711 ACPI_TABLE_HEADER *Table)
1712 {
1713 ACPI_STATUS Status;
1714 ACPI_PCCT_SUBSPACE *Subtable;
1715 ACPI_DMTABLE_INFO *InfoTable;
1716 UINT32 Length = Table->Length;
1717 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
1718
1719
1720 /* Main table */
1721
1722 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
1723 if (ACPI_FAILURE (Status))
1724 {
1725 return;
1726 }
1727
1728 /* Subtables */
1729
1730 Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
1731 while (Offset < Table->Length)
1732 {
1733 /* Common subtable header */
1734
1735 AcpiOsPrintf ("\n");
1736 Status = AcpiDmDumpTable (Length, Offset, Subtable,
1737 Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
1738 if (ACPI_FAILURE (Status))
1739 {
1740 return;
1741 }
1742
1743 switch (Subtable->Header.Type)
1744 {
1745 case ACPI_PCCT_TYPE_GENERIC_SUBSPACE:
1746
1747 InfoTable = AcpiDmTableInfoPcct0;
1748 break;
1749
1750 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE:
1751
1752 InfoTable = AcpiDmTableInfoPcct1;
1753 break;
1754
1755 case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2:
1756
1757 InfoTable = AcpiDmTableInfoPcct2;
1758 break;
1759
1760 case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE:
1761
1762 InfoTable = AcpiDmTableInfoPcct3;
1763 break;
1764
1765 case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE:
1766
1767 InfoTable = AcpiDmTableInfoPcct4;
1768 break;
1769
1770 case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE:
1771
1772 InfoTable = AcpiDmTableInfoPcct5;
1773 break;
1774
1775 default:
1776
1777 AcpiOsPrintf (
1778 "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n",
1779 Subtable->Header.Type);
1780 return;
1781 }
1782
1783 AcpiOsPrintf ("\n");
1784 Status = AcpiDmDumpTable (Length, Offset, Subtable,
1785 Subtable->Header.Length, InfoTable);
1786 if (ACPI_FAILURE (Status))
1787 {
1788 return;
1789 }
1790
1791 /* Point to next subtable */
1792
1793 Offset += Subtable->Header.Length;
1794 Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable,
1795 Subtable->Header.Length);
1796 }
1797 }
1798
1799
1800 /*******************************************************************************
1801 *
1802 * FUNCTION: AcpiDmDumpPdtt
1803 *
1804 * PARAMETERS: Table - A PDTT table
1805 *
1806 * RETURN: None
1807 *
1808 * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length
1809 * table that contains an open-ended number of IDs
1810 * at the end of the table.
1811 *
1812 ******************************************************************************/
1813
1814 void
AcpiDmDumpPdtt(ACPI_TABLE_HEADER * Table)1815 AcpiDmDumpPdtt (
1816 ACPI_TABLE_HEADER *Table)
1817 {
1818 ACPI_STATUS Status;
1819 ACPI_PDTT_CHANNEL *Subtable;
1820 UINT32 Length = Table->Length;
1821 UINT32 Offset = sizeof (ACPI_TABLE_PDTT);
1822
1823
1824 /* Main table */
1825
1826 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
1827 if (ACPI_FAILURE (Status))
1828 {
1829 return;
1830 }
1831
1832 /* Subtables. Currently there is only one type, but can be multiples */
1833
1834 Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
1835 while (Offset < Table->Length)
1836 {
1837 AcpiOsPrintf ("\n");
1838 Status = AcpiDmDumpTable (Length, Offset, Subtable,
1839 sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
1840 if (ACPI_FAILURE (Status))
1841 {
1842 return;
1843 }
1844
1845 /* Point to next subtable */
1846
1847 Offset += sizeof (ACPI_PDTT_CHANNEL);
1848 Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable,
1849 sizeof (ACPI_PDTT_CHANNEL));
1850 }
1851 }
1852
1853
1854 /*******************************************************************************
1855 *
1856 * FUNCTION: AcpiDmDumpPhat
1857 *
1858 * PARAMETERS: Table - A PHAT table
1859 *
1860 * RETURN: None
1861 *
1862 * DESCRIPTION: Format the contents of a PHAT.
1863 *
1864 ******************************************************************************/
1865
1866 void
AcpiDmDumpPhat(ACPI_TABLE_HEADER * Table)1867 AcpiDmDumpPhat (
1868 ACPI_TABLE_HEADER *Table)
1869 {
1870 ACPI_STATUS Status;
1871 ACPI_DMTABLE_INFO *InfoTable;
1872 ACPI_PHAT_HEADER *Subtable;
1873 ACPI_PHAT_VERSION_DATA *VersionData;
1874 UINT32 RecordCount;
1875 UINT32 Length = Table->Length;
1876 UINT32 Offset = sizeof (ACPI_TABLE_PHAT);
1877 UINT32 OriginalOffset;
1878 UINT32 SubtableLength;
1879 UINT32 PathLength;
1880 UINT32 VendorLength;
1881 UINT16 RecordType;
1882 const wchar_t *WideString;
1883
1884
1885 Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
1886
1887 while (Offset < Table->Length)
1888 {
1889 /* Common subtable header */
1890
1891 AcpiOsPrintf ("\n");
1892 Status = AcpiDmDumpTable (Length, Offset, Subtable,
1893 sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
1894 if (ACPI_FAILURE (Status))
1895 {
1896 return;
1897 }
1898
1899 DbgPrint (ASL_DEBUG_OUTPUT, "\n/* %u, Subtable->Type %X */\n",
1900 __LINE__, Subtable->Type);
1901
1902 switch (Subtable->Type)
1903 {
1904 case ACPI_PHAT_TYPE_FW_VERSION_DATA:
1905
1906 InfoTable = AcpiDmTableInfoPhat0;
1907 SubtableLength = Offset += sizeof (ACPI_PHAT_VERSION_DATA);
1908 break;
1909
1910 case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
1911
1912 InfoTable = AcpiDmTableInfoPhat1;
1913 SubtableLength = Offset += sizeof (ACPI_PHAT_TYPE_FW_HEALTH_DATA);
1914 break;
1915
1916 default:
1917
1918 DbgPrint (ASL_DEBUG_OUTPUT, "\n**** Unknown PHAT subtable type 0x%X\n\n",
1919 Subtable->Type);
1920
1921 return;
1922 }
1923
1924 Status = AcpiDmDumpTable (Length, SubtableLength, Subtable,
1925 SubtableLength, InfoTable);
1926 if (ACPI_FAILURE (Status))
1927 {
1928 return;
1929 }
1930
1931 OriginalOffset = Offset;
1932 switch (Subtable->Type)
1933 {
1934 case ACPI_PHAT_TYPE_FW_VERSION_DATA:
1935
1936 VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
1937 RecordCount = VersionData->ElementCount;
1938 RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
1939
1940 /*
1941 * Skip past a zero-valued block (not part of the ACPI PHAT specification).
1942 * First, check for a zero length record and a zero element count
1943 */
1944 if (!VersionData->Header.Length && !VersionData->ElementCount)
1945 {
1946 while (RecordType == 0)
1947 {
1948 Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
1949 RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
1950 RecordCount = VersionData->ElementCount;
1951 Offset += 1;
1952 }
1953
1954 Offset -= 1;
1955 AcpiOsPrintf ("\n/* Warning: Block of zeros found above starting at Offset %X Length %X */\n"
1956 "/* (not compliant to PHAT specification -- ignoring block) */\n",
1957 OriginalOffset - 12, Offset - OriginalOffset + 12);
1958 }
1959
1960 DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, RecordCount: %X, Offset %X, SubtableLength %X */\n",
1961 __LINE__, RecordCount, Offset, SubtableLength);
1962
1963 /* Emit each of the version elements */
1964
1965 while (RecordCount && VersionData->Header.Length)
1966 {
1967 AcpiOsPrintf ("\n/* Version Element #%Xh Offset %Xh */\n\n",
1968 VersionData->ElementCount - RecordCount + 1, Offset);
1969
1970 Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
1971 Status = AcpiDmDumpTable (Length, Offset, Subtable,
1972 sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
1973 if (ACPI_FAILURE (Status))
1974 {
1975 return;
1976 }
1977
1978 Offset += sizeof (ACPI_PHAT_VERSION_ELEMENT);
1979 RecordCount--;
1980 }
1981
1982 break;
1983
1984 case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
1985
1986 /*
1987 * Get the length of the Device Path (UEFI wide string).
1988 * Include the wide null terminator (+2),
1989 */
1990 WideString = ACPI_ADD_PTR (wchar_t, Subtable,
1991 sizeof (ACPI_PHAT_HEALTH_DATA));
1992
1993 PathLength = (wcslen (WideString) * 2) + 2;
1994 DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, PathLength %X, Offset %X, Table->Length %X */\n",
1995 __LINE__, PathLength, Offset, Length);
1996
1997 Status = AcpiDmDumpTable (Length, Offset,
1998 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
1999 PathLength, AcpiDmTableInfoPhat1a);
2000 Offset += PathLength;
2001 if (ACPI_FAILURE (Status))
2002 {
2003 return;
2004 }
2005
2006 /* Get Device-Specific Data - length of which is the remaining subtable length. */
2007
2008 VendorLength =
2009 Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
2010 DbgPrint (ASL_DEBUG_OUTPUT, "%u, Subtable->Length %X, VendorLength %X, Offset %X PathLength: %X\n",
2011 __LINE__, Subtable->Length, VendorLength, Offset, PathLength);
2012
2013 if (VendorLength)
2014 {
2015 /* Point past the Device Path, Compile the Device-Specific Data */
2016
2017 Status = AcpiDmDumpTable (Length, Offset,
2018 ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
2019 VendorLength, AcpiDmTableInfoPhat1b);
2020 if (ACPI_FAILURE (Status))
2021 {
2022 return;
2023 }
2024
2025 Offset += VendorLength;
2026 }
2027
2028 break;
2029
2030 default:
2031
2032 AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
2033 Subtable->Type);
2034 return;
2035 }
2036
2037 /* Next subtable */
2038
2039 DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, Bottom of main loop: Offset %X, "
2040 "Subtable->Length %X, Table->Length %X */\n",
2041 __LINE__, Offset, Subtable->Length, Table->Length);
2042
2043 Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table,
2044 Offset);
2045 }
2046 }
2047
2048
2049 /*******************************************************************************
2050 *
2051 * FUNCTION: AcpiDmDumpPmtt
2052 *
2053 * PARAMETERS: Table - A PMTT table
2054 *
2055 * RETURN: None
2056 *
2057 * DESCRIPTION: Format the contents of a PMTT. This table type consists
2058 * of an open-ended number of subtables.
2059 *
2060 ******************************************************************************/
2061
2062 void
AcpiDmDumpPmtt(ACPI_TABLE_HEADER * Table)2063 AcpiDmDumpPmtt (
2064 ACPI_TABLE_HEADER *Table)
2065 {
2066 ACPI_STATUS Status;
2067 ACPI_PMTT_HEADER *Subtable;
2068 UINT32 Length = Table->Length;
2069 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
2070
2071
2072 /* Main table */
2073
2074 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
2075 if (ACPI_FAILURE (Status))
2076 {
2077 return;
2078 }
2079
2080 /* Subtables */
2081
2082 Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
2083 while (Offset < Table->Length)
2084 {
2085 /* Each of the types below contain the common subtable header */
2086
2087 AcpiOsPrintf ("\n");
2088 switch (Subtable->Type)
2089 {
2090 case ACPI_PMTT_TYPE_SOCKET:
2091
2092 Status = AcpiDmDumpTable (Length, Offset, Subtable,
2093 Subtable->Length, AcpiDmTableInfoPmtt0);
2094 if (ACPI_FAILURE (Status))
2095 {
2096 return;
2097 }
2098 break;
2099
2100 case ACPI_PMTT_TYPE_CONTROLLER:
2101 Status = AcpiDmDumpTable (Length, Offset, Subtable,
2102 Subtable->Length, AcpiDmTableInfoPmtt1);
2103 if (ACPI_FAILURE (Status))
2104 {
2105 return;
2106 }
2107 break;
2108
2109 case ACPI_PMTT_TYPE_DIMM:
2110 Status = AcpiDmDumpTable (Length, Offset, Subtable,
2111 Subtable->Length, AcpiDmTableInfoPmtt2);
2112 if (ACPI_FAILURE (Status))
2113 {
2114 return;
2115 }
2116 break;
2117
2118 case ACPI_PMTT_TYPE_VENDOR:
2119 Status = AcpiDmDumpTable (Length, Offset, Subtable,
2120 Subtable->Length, AcpiDmTableInfoPmttVendor);
2121 if (ACPI_FAILURE (Status))
2122 {
2123 return;
2124 }
2125 break;
2126
2127 default:
2128 AcpiOsPrintf (
2129 "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n",
2130 Subtable->Type);
2131 return;
2132 }
2133
2134 /* Point to next subtable */
2135
2136 Offset += Subtable->Length;
2137 Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
2138 Subtable, Subtable->Length);
2139 }
2140 }
2141
2142
2143 /*******************************************************************************
2144 *
2145 * FUNCTION: AcpiDmDumpPptt
2146 *
2147 * PARAMETERS: Table - A PMTT table
2148 *
2149 * RETURN: None
2150 *
2151 * DESCRIPTION: Format the contents of a PPTT. This table type consists
2152 * of an open-ended number of subtables.
2153 *
2154 ******************************************************************************/
2155
2156 void
AcpiDmDumpPptt(ACPI_TABLE_HEADER * Table)2157 AcpiDmDumpPptt (
2158 ACPI_TABLE_HEADER *Table)
2159 {
2160 ACPI_STATUS Status;
2161 ACPI_SUBTABLE_HEADER *Subtable;
2162 ACPI_PPTT_PROCESSOR *PpttProcessor;
2163 UINT8 Length;
2164 UINT8 SubtableOffset;
2165 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
2166 ACPI_DMTABLE_INFO *InfoTable;
2167 UINT32 i;
2168
2169
2170 /* There is no main table (other than the standard ACPI header) */
2171
2172 /* Subtables */
2173
2174 Offset = sizeof (ACPI_TABLE_HEADER);
2175 while (Offset < Table->Length)
2176 {
2177 AcpiOsPrintf ("\n");
2178
2179 /* Common subtable header */
2180
2181 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
2182 if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER))
2183 {
2184 AcpiOsPrintf ("Invalid subtable length\n");
2185 return;
2186 }
2187 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2188 Subtable->Length, AcpiDmTableInfoPpttHdr);
2189 if (ACPI_FAILURE (Status))
2190 {
2191 return;
2192 }
2193
2194 switch (Subtable->Type)
2195 {
2196 case ACPI_PPTT_TYPE_PROCESSOR:
2197
2198 InfoTable = AcpiDmTableInfoPptt0;
2199 Length = sizeof (ACPI_PPTT_PROCESSOR);
2200 break;
2201
2202 case ACPI_PPTT_TYPE_CACHE:
2203
2204 InfoTable = AcpiDmTableInfoPptt1;
2205 Length = sizeof (ACPI_PPTT_CACHE);
2206 break;
2207
2208 case ACPI_PPTT_TYPE_ID:
2209
2210 InfoTable = AcpiDmTableInfoPptt2;
2211 Length = sizeof (ACPI_PPTT_ID);
2212 break;
2213
2214 default:
2215
2216 AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n",
2217 Subtable->Type);
2218
2219 /* Attempt to continue */
2220
2221 goto NextSubtable;
2222 }
2223
2224 if (Subtable->Length < Length)
2225 {
2226 AcpiOsPrintf ("Invalid subtable length\n");
2227 return;
2228 }
2229 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2230 Subtable->Length, InfoTable);
2231 if (ACPI_FAILURE (Status))
2232 {
2233 return;
2234 }
2235 SubtableOffset = Length;
2236
2237 switch (Subtable->Type)
2238 {
2239 case ACPI_PPTT_TYPE_PROCESSOR:
2240
2241 PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable);
2242
2243 /* Dump SMBIOS handles */
2244
2245 if ((UINT8)(Subtable->Length - SubtableOffset) <
2246 (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
2247 {
2248 AcpiOsPrintf ("Invalid private resource number\n");
2249 return;
2250 }
2251 for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
2252 {
2253 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2254 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2255 4, AcpiDmTableInfoPptt0a);
2256 if (ACPI_FAILURE (Status))
2257 {
2258 return;
2259 }
2260
2261 SubtableOffset += 4;
2262 }
2263 break;
2264
2265 case ACPI_PPTT_TYPE_CACHE:
2266
2267 if (Table->Revision < 3)
2268 {
2269 break;
2270 }
2271 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2272 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
2273 sizeof (ACPI_PPTT_CACHE_V1), AcpiDmTableInfoPptt1a);
2274 if (ACPI_FAILURE (Status))
2275 {
2276 return;
2277 }
2278 break;
2279
2280 default:
2281
2282 break;
2283 }
2284
2285 NextSubtable:
2286 /* Point to next subtable */
2287
2288 Offset += Subtable->Length;
2289 }
2290 }
2291
2292
2293 /*******************************************************************************
2294 *
2295 * FUNCTION: AcpiDmDumpPrmt
2296 *
2297 * PARAMETERS: Table - A PRMT table
2298 *
2299 * RETURN: None
2300 *
2301 * DESCRIPTION: Format the contents of a PRMT. This table type consists
2302 * of an open-ended number of subtables.
2303 *
2304 ******************************************************************************/
2305
2306 void
AcpiDmDumpPrmt(ACPI_TABLE_HEADER * Table)2307 AcpiDmDumpPrmt (
2308 ACPI_TABLE_HEADER *Table)
2309 {
2310 UINT32 CurrentOffset = sizeof (ACPI_TABLE_HEADER);
2311 ACPI_TABLE_PRMT_HEADER *PrmtHeader;
2312 ACPI_PRMT_MODULE_INFO *PrmtModuleInfo;
2313 ACPI_PRMT_HANDLER_INFO *PrmtHandlerInfo;
2314 ACPI_STATUS Status;
2315 UINT32 i, j;
2316
2317
2318 /* Main table header */
2319
2320 PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
2321 Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
2322 sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
2323 if (ACPI_FAILURE (Status))
2324 {
2325 AcpiOsPrintf ("Invalid PRMT header\n");
2326 return;
2327 }
2328
2329 CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER);
2330
2331 /* PRM Module Information Structure array */
2332
2333 for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
2334 {
2335 PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
2336 Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
2337 sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
2338
2339 CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
2340
2341 /* PRM handler information structure array */
2342
2343 for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
2344 {
2345 PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
2346 Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
2347 sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
2348
2349 CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
2350 }
2351 }
2352 }
2353
2354
2355 /*******************************************************************************
2356 *
2357 * FUNCTION: AcpiDmDumpRas2
2358 *
2359 * PARAMETERS: Table - A RAS2 table
2360 *
2361 * RETURN: None
2362 *
2363 * DESCRIPTION: Format the contents of a Ras2. This is a variable-length
2364 * table that contains an open-ended number of the RAS2 PCC
2365 * descriptors at the end of the table.
2366 *
2367 ******************************************************************************/
2368
2369 void
AcpiDmDumpRas2(ACPI_TABLE_HEADER * Table)2370 AcpiDmDumpRas2 (
2371 ACPI_TABLE_HEADER *Table)
2372 {
2373 ACPI_STATUS Status;
2374 ACPI_RAS2_PCC_DESC *Subtable;
2375 UINT32 Length = Table->Length;
2376 UINT32 Offset = sizeof (ACPI_TABLE_RAS2);
2377
2378
2379 /* Main table */
2380
2381 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRas2);
2382 if (ACPI_FAILURE (Status))
2383 {
2384 return;
2385 }
2386
2387 /* Subtables - RAS2 PCC descriptor list */
2388
2389 Subtable = ACPI_ADD_PTR (ACPI_RAS2_PCC_DESC, Table, Offset);
2390 while (Offset < Table->Length)
2391 {
2392 AcpiOsPrintf ("\n");
2393 Status = AcpiDmDumpTable (Length, Offset, Subtable,
2394 sizeof (ACPI_RAS2_PCC_DESC), AcpiDmTableInfoRas2PccDesc);
2395 if (ACPI_FAILURE (Status))
2396 {
2397 return;
2398 }
2399
2400 /* Point to next subtable */
2401
2402 Offset += sizeof (ACPI_RAS2_PCC_DESC);
2403 Subtable = ACPI_ADD_PTR (ACPI_RAS2_PCC_DESC, Subtable,
2404 sizeof (ACPI_RAS2_PCC_DESC));
2405 }
2406 }
2407
2408
2409 /*******************************************************************************
2410 *
2411 * FUNCTION: AcpiDmDumpRgrt
2412 *
2413 * PARAMETERS: Table - A RGRT table
2414 *
2415 * RETURN: None
2416 *
2417 * DESCRIPTION: Format the contents of a RGRT
2418 *
2419 ******************************************************************************/
2420
2421 void
AcpiDmDumpRgrt(ACPI_TABLE_HEADER * Table)2422 AcpiDmDumpRgrt (
2423 ACPI_TABLE_HEADER *Table)
2424 {
2425 ACPI_STATUS Status;
2426 ACPI_TABLE_RGRT *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table);
2427 UINT32 Offset = sizeof (ACPI_TABLE_RGRT);
2428
2429
2430 /* Main table */
2431
2432 Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt);
2433 if (ACPI_FAILURE (Status))
2434 {
2435 return;
2436 }
2437
2438 /* Dump the binary image as a subtable */
2439
2440 Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image,
2441 Table->Length - Offset, AcpiDmTableInfoRgrt0);
2442 if (ACPI_FAILURE (Status))
2443 {
2444 return;
2445 }
2446 }
2447
2448
2449 /*******************************************************************************
2450 *
2451 * FUNCTION: AcpiDmDumpRhct
2452 *
2453 * PARAMETERS: Table - A RHCT table
2454 *
2455 * RETURN: None
2456 *
2457 * DESCRIPTION: Format the contents of a RHCT.
2458 *
2459 ******************************************************************************/
2460
2461 void
AcpiDmDumpRhct(ACPI_TABLE_HEADER * Table)2462 AcpiDmDumpRhct (
2463 ACPI_TABLE_HEADER *Table)
2464 {
2465 ACPI_STATUS Status;
2466 ACPI_RHCT_NODE_HEADER *Subtable;
2467 ACPI_RHCT_HART_INFO *RhctHartInfo;
2468 ACPI_RHCT_ISA_STRING *RhctIsaString;
2469 ACPI_RHCT_CMO_NODE *RhctCmoNode;
2470 ACPI_RHCT_MMU_NODE *RhctMmuNode;
2471 UINT32 Length = Table->Length;
2472 UINT8 SubtableOffset, IsaPadOffset;
2473 UINT32 Offset = sizeof (ACPI_TABLE_RHCT);
2474 UINT32 i;
2475
2476 /* Main table */
2477
2478 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRhct);
2479 if (ACPI_FAILURE (Status))
2480 {
2481 return;
2482 }
2483
2484 /* Subtables */
2485
2486 while (Offset < Table->Length)
2487 {
2488 AcpiOsPrintf ("\n");
2489
2490 /* Common subtable header */
2491
2492 Subtable = ACPI_ADD_PTR (ACPI_RHCT_NODE_HEADER, Table, Offset);
2493 if (Subtable->Length < sizeof (ACPI_RHCT_NODE_HEADER))
2494 {
2495 AcpiOsPrintf ("Invalid subtable length\n");
2496 return;
2497 }
2498 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2499 Subtable->Length, AcpiDmTableInfoRhctNodeHdr);
2500 if (ACPI_FAILURE (Status))
2501 {
2502 return;
2503 }
2504
2505 Length = sizeof (ACPI_RHCT_NODE_HEADER);
2506
2507 if (Subtable->Length < Length)
2508 {
2509 AcpiOsPrintf ("Invalid subtable length\n");
2510 return;
2511 }
2512 SubtableOffset = (UINT8) Length;
2513
2514 switch (Subtable->Type)
2515 {
2516 case ACPI_RHCT_NODE_TYPE_HART_INFO:
2517 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2518 ACPI_ADD_PTR (ACPI_RHCT_HART_INFO, Subtable, SubtableOffset),
2519 sizeof (ACPI_RHCT_HART_INFO), AcpiDmTableInfoRhctHartInfo1);
2520
2521 RhctHartInfo = ACPI_ADD_PTR (ACPI_RHCT_HART_INFO, Subtable, SubtableOffset);
2522
2523 if ((UINT16)(Subtable->Length - SubtableOffset) <
2524 (UINT16)(RhctHartInfo->NumOffsets * 4))
2525 {
2526 AcpiOsPrintf ("Invalid number of offsets\n");
2527 return;
2528 }
2529 SubtableOffset += sizeof (ACPI_RHCT_HART_INFO);
2530 for (i = 0; i < RhctHartInfo->NumOffsets; i++)
2531 {
2532 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2533 ACPI_ADD_PTR (UINT32, Subtable, SubtableOffset),
2534 4, AcpiDmTableInfoRhctHartInfo2);
2535 if (ACPI_FAILURE (Status))
2536 {
2537 return;
2538 }
2539
2540 SubtableOffset += 4;
2541 }
2542 break;
2543
2544 case ACPI_RHCT_NODE_TYPE_ISA_STRING:
2545 RhctIsaString = ACPI_ADD_PTR (ACPI_RHCT_ISA_STRING, Subtable, SubtableOffset);
2546 IsaPadOffset = (UINT8) (SubtableOffset + 2 + RhctIsaString->IsaLength);
2547 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2548 RhctIsaString, RhctIsaString->IsaLength, AcpiDmTableInfoRhctIsa1);
2549 if (Subtable->Length > IsaPadOffset)
2550 {
2551 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2552 ACPI_ADD_PTR (UINT8, Subtable, IsaPadOffset),
2553 (Subtable->Length - IsaPadOffset), AcpiDmTableInfoRhctIsaPad);
2554 }
2555
2556 break;
2557
2558 case ACPI_RHCT_NODE_TYPE_CMO:
2559 RhctCmoNode = ACPI_ADD_PTR (ACPI_RHCT_CMO_NODE, Subtable, SubtableOffset);
2560 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2561 RhctCmoNode, 4, AcpiDmTableInfoRhctCmo1);
2562 break;
2563
2564 case ACPI_RHCT_NODE_TYPE_MMU:
2565 RhctMmuNode = ACPI_ADD_PTR (ACPI_RHCT_MMU_NODE, Subtable, SubtableOffset);
2566 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
2567 RhctMmuNode, 2, AcpiDmTableInfoRhctMmu1);
2568 break;
2569
2570 default:
2571 break;
2572 }
2573
2574 /* Point to next subtable */
2575
2576 Offset += Subtable->Length;
2577 }
2578 }
2579
2580
2581 /*******************************************************************************
2582 *
2583 * FUNCTION: AcpiDmDumpS3pt
2584 *
2585 * PARAMETERS: Table - A S3PT table
2586 *
2587 * RETURN: Length of the table
2588 *
2589 * DESCRIPTION: Format the contents of a S3PT
2590 *
2591 ******************************************************************************/
2592
2593 UINT32
AcpiDmDumpS3pt(ACPI_TABLE_HEADER * Tables)2594 AcpiDmDumpS3pt (
2595 ACPI_TABLE_HEADER *Tables)
2596 {
2597 ACPI_STATUS Status;
2598 UINT32 Offset = sizeof (ACPI_TABLE_S3PT);
2599 ACPI_FPDT_HEADER *Subtable;
2600 ACPI_DMTABLE_INFO *InfoTable;
2601 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
2602
2603
2604 /* Main table */
2605
2606 Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt);
2607 if (ACPI_FAILURE (Status))
2608 {
2609 return 0;
2610 }
2611
2612 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
2613 while (Offset < S3ptTable->Length)
2614 {
2615 /* Common subtable header */
2616
2617 AcpiOsPrintf ("\n");
2618 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2619 Subtable->Length, AcpiDmTableInfoS3ptHdr);
2620 if (ACPI_FAILURE (Status))
2621 {
2622 return 0;
2623 }
2624
2625 switch (Subtable->Type)
2626 {
2627 case ACPI_S3PT_TYPE_RESUME:
2628
2629 InfoTable = AcpiDmTableInfoS3pt0;
2630 break;
2631
2632 case ACPI_S3PT_TYPE_SUSPEND:
2633
2634 InfoTable = AcpiDmTableInfoS3pt1;
2635 break;
2636
2637 default:
2638
2639 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
2640 Subtable->Type);
2641
2642 /* Attempt to continue */
2643
2644 if (!Subtable->Length)
2645 {
2646 AcpiOsPrintf ("Invalid zero length subtable\n");
2647 return 0;
2648 }
2649 goto NextSubtable;
2650 }
2651
2652 AcpiOsPrintf ("\n");
2653 Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
2654 Subtable->Length, InfoTable);
2655 if (ACPI_FAILURE (Status))
2656 {
2657 return 0;
2658 }
2659
2660 NextSubtable:
2661 /* Point to next subtable */
2662
2663 Offset += Subtable->Length;
2664 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
2665 }
2666
2667 return (S3ptTable->Length);
2668 }
2669
2670
2671 /*******************************************************************************
2672 *
2673 * FUNCTION: AcpiDmDumpSdev
2674 *
2675 * PARAMETERS: Table - A SDEV table
2676 *
2677 * RETURN: None
2678 *
2679 * DESCRIPTION: Format the contents of a SDEV. This is a variable-length
2680 * table that contains variable strings and vendor data.
2681 *
2682 ******************************************************************************/
2683
2684 void
AcpiDmDumpSdev(ACPI_TABLE_HEADER * Table)2685 AcpiDmDumpSdev (
2686 ACPI_TABLE_HEADER *Table)
2687 {
2688 ACPI_STATUS Status;
2689 ACPI_SDEV_HEADER *Subtable;
2690 ACPI_SDEV_PCIE *Pcie;
2691 ACPI_SDEV_NAMESPACE *Namesp;
2692 ACPI_DMTABLE_INFO *InfoTable;
2693 ACPI_DMTABLE_INFO *SecureComponentInfoTable;
2694 UINT32 Length = Table->Length;
2695 UINT32 Offset = sizeof (ACPI_TABLE_SDEV);
2696 UINT16 PathOffset;
2697 UINT16 PathLength;
2698 UINT16 VendorDataOffset;
2699 UINT16 VendorDataLength;
2700 ACPI_SDEV_SECURE_COMPONENT *SecureComponent = NULL;
2701 UINT32 CurrentOffset = 0;
2702
2703
2704 /* Main table */
2705
2706 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
2707 if (ACPI_FAILURE (Status))
2708 {
2709 return;
2710 }
2711
2712 /* Subtables */
2713
2714 Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
2715 while (Offset < Table->Length)
2716 {
2717 /* Common subtable header */
2718
2719 AcpiOsPrintf ("\n");
2720 Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
2721 Subtable->Length, AcpiDmTableInfoSdevHdr);
2722 if (ACPI_FAILURE (Status))
2723 {
2724 return;
2725 }
2726
2727 switch (Subtable->Type)
2728 {
2729 case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2730
2731 InfoTable = AcpiDmTableInfoSdev0;
2732 break;
2733
2734 case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2735
2736 InfoTable = AcpiDmTableInfoSdev1;
2737 break;
2738
2739 default:
2740 goto NextSubtable;
2741 }
2742
2743 AcpiOsPrintf ("\n");
2744 Status = AcpiDmDumpTable (Table->Length, 0, Subtable,
2745 Subtable->Length, InfoTable);
2746 if (ACPI_FAILURE (Status))
2747 {
2748 return;
2749 }
2750
2751 switch (Subtable->Type)
2752 {
2753 case ACPI_SDEV_TYPE_NAMESPACE_DEVICE:
2754
2755 CurrentOffset = sizeof (ACPI_SDEV_NAMESPACE);
2756 if (Subtable->Flags & ACPI_SDEV_SECURE_COMPONENTS_PRESENT)
2757 {
2758 SecureComponent = ACPI_CAST_PTR (ACPI_SDEV_SECURE_COMPONENT,
2759 ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)));
2760
2761 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2762 ACPI_ADD_PTR(UINT8, Subtable, sizeof (ACPI_SDEV_NAMESPACE)),
2763 sizeof (ACPI_SDEV_SECURE_COMPONENT), AcpiDmTableInfoSdev0b);
2764 if (ACPI_FAILURE (Status))
2765 {
2766 return;
2767 }
2768 CurrentOffset += sizeof (ACPI_SDEV_SECURE_COMPONENT);
2769
2770 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2771 ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
2772 sizeof (ACPI_SDEV_HEADER), AcpiDmTableInfoSdevSecCompHdr);
2773 if (ACPI_FAILURE (Status))
2774 {
2775 return;
2776 }
2777 CurrentOffset += sizeof (ACPI_SDEV_HEADER);
2778
2779 switch (Subtable->Type)
2780 {
2781 case ACPI_SDEV_TYPE_ID_COMPONENT:
2782
2783 SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompId;
2784 break;
2785
2786 case ACPI_SDEV_TYPE_MEM_COMPONENT:
2787
2788 SecureComponentInfoTable = AcpiDmTableInfoSdevSecCompMem;
2789 break;
2790
2791 default:
2792 goto NextSubtable;
2793 }
2794
2795 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2796 ACPI_ADD_PTR(UINT8, Subtable, SecureComponent->SecureComponentOffset),
2797 SecureComponent->SecureComponentLength, SecureComponentInfoTable);
2798 CurrentOffset += SecureComponent->SecureComponentLength;
2799 }
2800
2801 /* Dump the PCIe device ID(s) */
2802
2803 Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
2804 PathOffset = Namesp->DeviceIdOffset;
2805 PathLength = Namesp->DeviceIdLength;
2806
2807 if (PathLength)
2808 {
2809 Status = AcpiDmDumpTable (Table->Length, CurrentOffset,
2810 ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
2811 PathLength, AcpiDmTableInfoSdev0a);
2812 if (ACPI_FAILURE (Status))
2813 {
2814 return;
2815 }
2816 CurrentOffset += PathLength;
2817 }
2818
2819 /* Dump the vendor-specific data */
2820
2821 VendorDataLength =
2822 Namesp->VendorDataLength;
2823 VendorDataOffset =
2824 Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
2825
2826 if (VendorDataLength)
2827 {
2828 Status = AcpiDmDumpTable (Table->Length, 0,
2829 ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
2830 VendorDataLength, AcpiDmTableInfoSdev1b);
2831 if (ACPI_FAILURE (Status))
2832 {
2833 return;
2834 }
2835 }
2836 break;
2837
2838 case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
2839
2840 /* PCI path substructures */
2841
2842 Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
2843 PathOffset = Pcie->PathOffset;
2844 PathLength = Pcie->PathLength;
2845
2846 while (PathLength)
2847 {
2848 Status = AcpiDmDumpTable (Table->Length,
2849 PathOffset + Offset,
2850 ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
2851 sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
2852 if (ACPI_FAILURE (Status))
2853 {
2854 return;
2855 }
2856
2857 PathOffset += sizeof (ACPI_SDEV_PCIE_PATH);
2858 PathLength -= sizeof (ACPI_SDEV_PCIE_PATH);
2859 }
2860
2861 /* VendorData */
2862
2863 VendorDataLength = Pcie->VendorDataLength;
2864 VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
2865
2866 if (VendorDataLength)
2867 {
2868 Status = AcpiDmDumpTable (Table->Length, 0,
2869 ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
2870 VendorDataLength, AcpiDmTableInfoSdev1b);
2871 if (ACPI_FAILURE (Status))
2872 {
2873 return;
2874 }
2875 }
2876 break;
2877
2878 default:
2879 goto NextSubtable;
2880 }
2881
2882 NextSubtable:
2883 /* Point to next subtable */
2884
2885 Offset += Subtable->Length;
2886 Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
2887 Subtable->Length);
2888 }
2889 }
2890