sys/vfs/hammer2: Remove obsolete comments for unused/reserved ondisk fields
[dragonfly.git] / sys / contrib / dev / acpica / source / compiler / dttable1.c
blob2e6a856912cdc1fd227fccb1bd2848e6ff97285c
1 /******************************************************************************
3 * Module Name: dttable1.c - handling for specific ACPI tables
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12 * All rights reserved.
14 * 2. License
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.
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
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;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
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.
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.
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.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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.
80 * 4. Disclaimer and Export Compliance
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.
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.
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.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
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.
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.
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.
150 *****************************************************************************/
152 /* Compile all complex data tables, signatures starting with A-I */
154 #include "aslcompiler.h"
156 #define _COMPONENT DT_COMPILER
157 ACPI_MODULE_NAME ("dttable1")
160 static ACPI_DMTABLE_INFO TableInfoAsfAddress[] =
162 {ACPI_DMT_BUFFER, 0, "Addresses", 0},
163 {ACPI_DMT_EXIT, 0, NULL, 0}
166 static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] =
168 {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0},
169 {ACPI_DMT_EXIT, 0, NULL, 0}
173 /******************************************************************************
175 * FUNCTION: DtCompileAest
177 * PARAMETERS: List - Current field list pointer
179 * RETURN: Status
181 * DESCRIPTION: Compile AEST.
183 * NOTE: Assumes the following table structure:
184 * For all AEST Error Nodes:
185 * 1) An AEST Error Node, followed immediately by:
186 * 2) Any node-specific data
187 * 3) An Interface Structure (one)
188 * 4) A list (array) of Interrupt Structures, the count as specified
189 * in the NodeInterruptCount field of the Error Node header.
191 * AEST - ARM Error Source table. Conforms to:
192 * ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document Sep 2020
194 *****************************************************************************/
196 ACPI_STATUS
197 DtCompileAest (
198 void **List)
200 ACPI_AEST_HEADER *ErrorNodeHeader;
201 ACPI_AEST_PROCESSOR *AestProcessor;
202 DT_SUBTABLE *Subtable;
203 DT_SUBTABLE *ParentTable;
204 ACPI_DMTABLE_INFO *InfoTable;
205 ACPI_STATUS Status;
206 UINT32 i;
207 UINT32 Offset;
208 DT_FIELD **PFieldList = (DT_FIELD **) List;
211 while (*PFieldList)
213 /* Compile the common error node header */
215 Status = DtCompileTable (PFieldList, AcpiDmTableInfoAestHdr,
216 &Subtable);
217 if (ACPI_FAILURE (Status))
219 return (Status);
222 ParentTable = DtPeekSubtable ();
223 DtInsertSubtable (ParentTable, Subtable);
225 /* Everything past the error node header will be a subtable */
227 DtPushSubtable (Subtable);
230 * Compile the node-specific structure (Based on the error
231 * node header Type field)
233 ErrorNodeHeader = ACPI_CAST_PTR (ACPI_AEST_HEADER, Subtable->Buffer);
235 /* Point past the common error node header */
237 Offset = sizeof (ACPI_AEST_HEADER);
238 ErrorNodeHeader->NodeSpecificOffset = Offset;
240 /* Decode the error node type */
242 switch (ErrorNodeHeader->Type)
244 case ACPI_AEST_PROCESSOR_ERROR_NODE:
246 InfoTable = AcpiDmTableInfoAestProcError;
247 break;
249 case ACPI_AEST_MEMORY_ERROR_NODE:
251 InfoTable = AcpiDmTableInfoAestMemError;
252 break;
254 case ACPI_AEST_SMMU_ERROR_NODE:
256 InfoTable = AcpiDmTableInfoAestSmmuError;
257 break;
259 case ACPI_AEST_VENDOR_ERROR_NODE:
261 InfoTable = AcpiDmTableInfoAestVendorError;
262 break;
264 case ACPI_AEST_GIC_ERROR_NODE:
266 InfoTable = AcpiDmTableInfoAestGicError;
267 break;
269 /* Error case below */
270 default:
271 AcpiOsPrintf ("Unknown AEST Subtable Type: %X\n",
272 ErrorNodeHeader->Type);
273 return (AE_ERROR);
276 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
277 if (ACPI_FAILURE (Status))
279 return (Status);
282 /* Point past the node-specific structure */
284 Offset += Subtable->Length;
285 ErrorNodeHeader->NodeInterfaceOffset = Offset;
287 ParentTable = DtPeekSubtable ();
288 DtInsertSubtable (ParentTable, Subtable);
290 /* Compile any additional node-specific substructures */
292 if (ErrorNodeHeader->Type == ACPI_AEST_PROCESSOR_ERROR_NODE)
295 * Special handling for PROCESSOR_ERROR_NODE subtables
296 * (to handle the Resource Substructure via the ResourceType
297 * field).
299 AestProcessor = ACPI_CAST_PTR (ACPI_AEST_PROCESSOR,
300 Subtable->Buffer);
302 switch (AestProcessor->ResourceType)
304 case ACPI_AEST_CACHE_RESOURCE:
306 InfoTable = AcpiDmTableInfoAestCacheRsrc;
307 break;
309 case ACPI_AEST_TLB_RESOURCE:
311 InfoTable = AcpiDmTableInfoAestTlbRsrc;
312 break;
314 case ACPI_AEST_GENERIC_RESOURCE:
316 InfoTable = AcpiDmTableInfoAestGenRsrc;
317 AcpiOsPrintf ("Generic Resource Type (%X) is not supported at this time\n",
318 AestProcessor->ResourceType);
319 return (AE_ERROR);
321 /* Error case below */
322 default:
323 AcpiOsPrintf ("Unknown AEST Processor Resource Type: %X\n",
324 AestProcessor->ResourceType);
325 return (AE_ERROR);
328 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
329 if (ACPI_FAILURE (Status))
331 return (Status);
334 /* Point past the resource substructure subtable */
336 Offset += Subtable->Length;
337 ErrorNodeHeader->NodeInterfaceOffset = Offset;
339 ParentTable = DtPeekSubtable ();
340 DtInsertSubtable (ParentTable, Subtable);
343 /* Compile the (required) node interface structure */
345 Status = DtCompileTable (PFieldList, AcpiDmTableInfoAestXface,
346 &Subtable);
347 if (ACPI_FAILURE (Status))
349 return (Status);
352 ErrorNodeHeader->NodeInterruptOffset = 0;
353 ParentTable = DtPeekSubtable ();
354 DtInsertSubtable (ParentTable, Subtable);
356 /* Compile each of the node interrupt structures */
358 if (ErrorNodeHeader->NodeInterruptCount)
360 /* Point to the first interrupt structure */
362 Offset += Subtable->Length;
363 ErrorNodeHeader->NodeInterruptOffset = Offset;
366 /* Compile each of the interrupt structures */
368 for (i = 0; i < ErrorNodeHeader->NodeInterruptCount; i++)
370 Status = DtCompileTable (PFieldList, AcpiDmTableInfoAestXrupt,
371 &Subtable);
372 if (ACPI_FAILURE (Status))
374 return (Status);
377 ParentTable = DtPeekSubtable ();
378 DtInsertSubtable (ParentTable, Subtable);
381 /* Prepare for the next AEST Error node */
383 DtPopSubtable ();
386 return (AE_OK);
390 /******************************************************************************
392 * FUNCTION: DtCompileAsf
394 * PARAMETERS: List - Current field list pointer
396 * RETURN: Status
398 * DESCRIPTION: Compile ASF!.
400 *****************************************************************************/
402 ACPI_STATUS
403 DtCompileAsf (
404 void **List)
406 ACPI_ASF_INFO *AsfTable;
407 DT_SUBTABLE *Subtable;
408 DT_SUBTABLE *ParentTable;
409 ACPI_DMTABLE_INFO *InfoTable;
410 ACPI_DMTABLE_INFO *DataInfoTable = NULL;
411 UINT32 DataCount = 0;
412 ACPI_STATUS Status;
413 UINT32 i;
414 DT_FIELD **PFieldList = (DT_FIELD **) List;
415 DT_FIELD *SubtableStart;
418 while (*PFieldList)
420 SubtableStart = *PFieldList;
421 Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr,
422 &Subtable);
423 if (ACPI_FAILURE (Status))
425 return (Status);
428 ParentTable = DtPeekSubtable ();
429 DtInsertSubtable (ParentTable, Subtable);
430 DtPushSubtable (Subtable);
432 AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer);
434 switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
436 case ACPI_ASF_TYPE_INFO:
438 InfoTable = AcpiDmTableInfoAsf0;
439 break;
441 case ACPI_ASF_TYPE_ALERT:
443 InfoTable = AcpiDmTableInfoAsf1;
444 break;
446 case ACPI_ASF_TYPE_CONTROL:
448 InfoTable = AcpiDmTableInfoAsf2;
449 break;
451 case ACPI_ASF_TYPE_BOOT:
453 InfoTable = AcpiDmTableInfoAsf3;
454 break;
456 case ACPI_ASF_TYPE_ADDRESS:
458 InfoTable = AcpiDmTableInfoAsf4;
459 break;
461 default:
463 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
464 return (AE_ERROR);
467 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
468 if (ACPI_FAILURE (Status))
470 return (Status);
473 ParentTable = DtPeekSubtable ();
474 DtInsertSubtable (ParentTable, Subtable);
476 switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
478 case ACPI_ASF_TYPE_INFO:
480 DataInfoTable = NULL;
481 break;
483 case ACPI_ASF_TYPE_ALERT:
485 DataInfoTable = AcpiDmTableInfoAsf1a;
486 DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT,
487 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
488 sizeof (ACPI_ASF_HEADER)))->Alerts;
489 break;
491 case ACPI_ASF_TYPE_CONTROL:
493 DataInfoTable = AcpiDmTableInfoAsf2a;
494 DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE,
495 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
496 sizeof (ACPI_ASF_HEADER)))->Controls;
497 break;
499 case ACPI_ASF_TYPE_BOOT:
501 DataInfoTable = NULL;
502 break;
504 case ACPI_ASF_TYPE_ADDRESS:
506 DataInfoTable = TableInfoAsfAddress;
507 DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS,
508 ACPI_SUB_PTR (UINT8, Subtable->Buffer,
509 sizeof (ACPI_ASF_HEADER)))->Devices;
510 break;
512 default:
514 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
515 return (AE_ERROR);
518 if (DataInfoTable)
520 switch (AsfTable->Header.Type & 0x7F)
522 case ACPI_ASF_TYPE_ADDRESS:
524 while (DataCount > 0)
526 Status = DtCompileTable (PFieldList, DataInfoTable,
527 &Subtable);
528 if (ACPI_FAILURE (Status))
530 return (Status);
533 DtInsertSubtable (ParentTable, Subtable);
534 DataCount = DataCount - Subtable->Length;
536 break;
538 default:
540 for (i = 0; i < DataCount; i++)
542 Status = DtCompileTable (PFieldList, DataInfoTable,
543 &Subtable);
544 if (ACPI_FAILURE (Status))
546 return (Status);
549 DtInsertSubtable (ParentTable, Subtable);
551 break;
555 DtPopSubtable ();
558 return (AE_OK);
562 /******************************************************************************
564 * FUNCTION: DtCompileCedt
566 * PARAMETERS: List - Current field list pointer
568 * RETURN: Status
570 * DESCRIPTION: Compile CEDT.
572 *****************************************************************************/
574 ACPI_STATUS
575 DtCompileCedt (
576 void **List)
578 ACPI_STATUS Status;
579 DT_SUBTABLE *Subtable;
580 DT_SUBTABLE *ParentTable;
581 DT_FIELD **PFieldList = (DT_FIELD **) List;
582 ACPI_CEDT_HEADER *CedtHeader;
583 DT_FIELD *SubtableStart;
586 /* Walk the parse tree */
588 while (*PFieldList)
590 SubtableStart = *PFieldList;
592 /* CEDT Header */
594 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedtHdr,
595 &Subtable);
596 if (ACPI_FAILURE (Status))
598 return (Status);
601 ParentTable = DtPeekSubtable ();
602 DtInsertSubtable (ParentTable, Subtable);
603 DtPushSubtable (Subtable);
605 CedtHeader = ACPI_CAST_PTR (ACPI_CEDT_HEADER, Subtable->Buffer);
607 switch (CedtHeader->Type)
609 case ACPI_CEDT_TYPE_CHBS:
611 break;
613 default:
615 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "CEDT");
616 return (AE_ERROR);
619 /* CEDT Subtable */
621 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt0, &Subtable);
622 if (ACPI_FAILURE (Status))
624 return (Status);
627 ParentTable = DtPeekSubtable ();
628 DtInsertSubtable (ParentTable, Subtable);
629 DtPopSubtable ();
632 return (AE_OK);
636 /******************************************************************************
638 * FUNCTION: DtCompileCpep
640 * PARAMETERS: List - Current field list pointer
642 * RETURN: Status
644 * DESCRIPTION: Compile CPEP.
646 *****************************************************************************/
648 ACPI_STATUS
649 DtCompileCpep (
650 void **List)
652 ACPI_STATUS Status;
655 Status = DtCompileTwoSubtables (List,
656 AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0);
657 return (Status);
661 /******************************************************************************
663 * FUNCTION: DtCompileCsrt
665 * PARAMETERS: List - Current field list pointer
667 * RETURN: Status
669 * DESCRIPTION: Compile CSRT.
671 *****************************************************************************/
673 ACPI_STATUS
674 DtCompileCsrt (
675 void **List)
677 ACPI_STATUS Status = AE_OK;
678 DT_SUBTABLE *Subtable;
679 DT_SUBTABLE *ParentTable;
680 DT_FIELD **PFieldList = (DT_FIELD **) List;
681 UINT32 DescriptorCount;
682 UINT32 GroupLength;
685 /* Subtables (Resource Groups) */
687 ParentTable = DtPeekSubtable ();
688 while (*PFieldList)
690 /* Resource group subtable */
692 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt0,
693 &Subtable);
694 if (ACPI_FAILURE (Status))
696 return (Status);
699 /* Compute the number of resource descriptors */
701 GroupLength =
702 (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
703 Subtable->Buffer))->Length -
704 (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
705 Subtable->Buffer))->SharedInfoLength -
706 sizeof (ACPI_CSRT_GROUP);
708 DescriptorCount = (GroupLength /
709 sizeof (ACPI_CSRT_DESCRIPTOR));
711 DtInsertSubtable (ParentTable, Subtable);
712 DtPushSubtable (Subtable);
713 ParentTable = DtPeekSubtable ();
715 /* Shared info subtable (One per resource group) */
717 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt1,
718 &Subtable);
719 if (ACPI_FAILURE (Status))
721 return (Status);
724 DtInsertSubtable (ParentTable, Subtable);
726 /* Sub-Subtables (Resource Descriptors) */
728 while (*PFieldList && DescriptorCount)
731 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2,
732 &Subtable);
733 if (ACPI_FAILURE (Status))
735 return (Status);
738 DtInsertSubtable (ParentTable, Subtable);
740 DtPushSubtable (Subtable);
741 ParentTable = DtPeekSubtable ();
742 if (*PFieldList)
744 Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a,
745 &Subtable);
746 if (ACPI_FAILURE (Status))
748 return (Status);
750 if (Subtable)
752 DtInsertSubtable (ParentTable, Subtable);
756 DtPopSubtable ();
757 ParentTable = DtPeekSubtable ();
758 DescriptorCount--;
761 DtPopSubtable ();
762 ParentTable = DtPeekSubtable ();
765 return (Status);
769 /******************************************************************************
771 * FUNCTION: DtCompileDbg2
773 * PARAMETERS: List - Current field list pointer
775 * RETURN: Status
777 * DESCRIPTION: Compile DBG2.
779 *****************************************************************************/
781 ACPI_STATUS
782 DtCompileDbg2 (
783 void **List)
785 ACPI_STATUS Status;
786 DT_SUBTABLE *Subtable;
787 DT_SUBTABLE *ParentTable;
788 DT_FIELD **PFieldList = (DT_FIELD **) List;
789 UINT32 SubtableCount;
790 ACPI_DBG2_HEADER *Dbg2Header;
791 ACPI_DBG2_DEVICE *DeviceInfo;
792 UINT16 CurrentOffset;
793 UINT32 i;
796 /* Main table */
798 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2, &Subtable);
799 if (ACPI_FAILURE (Status))
801 return (Status);
804 ParentTable = DtPeekSubtable ();
805 DtInsertSubtable (ParentTable, Subtable);
807 /* Main table fields */
809 Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
810 Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
811 ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
813 SubtableCount = Dbg2Header->InfoCount;
814 DtPushSubtable (Subtable);
816 /* Process all Device Information subtables (Count = InfoCount) */
818 while (*PFieldList && SubtableCount)
820 /* Subtable: Debug Device Information */
822 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Device,
823 &Subtable);
824 if (ACPI_FAILURE (Status))
826 return (Status);
829 DeviceInfo = ACPI_CAST_PTR (ACPI_DBG2_DEVICE, Subtable->Buffer);
830 CurrentOffset = (UINT16) sizeof (ACPI_DBG2_DEVICE);
832 ParentTable = DtPeekSubtable ();
833 DtInsertSubtable (ParentTable, Subtable);
834 DtPushSubtable (Subtable);
836 ParentTable = DtPeekSubtable ();
838 /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
840 DeviceInfo->BaseAddressOffset = CurrentOffset;
841 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
843 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
844 &Subtable);
845 if (ACPI_FAILURE (Status))
847 return (Status);
850 CurrentOffset += (UINT16) sizeof (ACPI_GENERIC_ADDRESS);
851 DtInsertSubtable (ParentTable, Subtable);
854 /* AddressSize array (Required, size = RegisterCount) */
856 DeviceInfo->AddressSizeOffset = CurrentOffset;
857 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
859 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
860 &Subtable);
861 if (ACPI_FAILURE (Status))
863 return (Status);
866 CurrentOffset += (UINT16) sizeof (UINT32);
867 DtInsertSubtable (ParentTable, Subtable);
870 /* NamespaceString device identifier (Required, size = NamePathLength) */
872 DeviceInfo->NamepathOffset = CurrentOffset;
873 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
874 &Subtable);
875 if (ACPI_FAILURE (Status))
877 return (Status);
880 /* Update the device info header */
882 DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
883 CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
884 DtInsertSubtable (ParentTable, Subtable);
886 /* OemData - Variable-length data (Optional, size = OemDataLength) */
888 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData,
889 &Subtable);
890 if (Status == AE_END_OF_TABLE)
892 /* optional field was not found and we're at the end of the file */
894 goto subtableDone;
896 else if (ACPI_FAILURE (Status))
898 return (Status);
901 /* Update the device info header (zeros if no OEM data present) */
903 DeviceInfo->OemDataOffset = 0;
904 DeviceInfo->OemDataLength = 0;
906 /* Optional subtable (OemData) */
908 if (Subtable && Subtable->Length)
910 DeviceInfo->OemDataOffset = CurrentOffset;
911 DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
913 DtInsertSubtable (ParentTable, Subtable);
915 subtableDone:
916 SubtableCount--;
917 DtPopSubtable (); /* Get next Device Information subtable */
920 DtPopSubtable ();
921 return (AE_OK);
925 /******************************************************************************
927 * FUNCTION: DtCompileDmar
929 * PARAMETERS: List - Current field list pointer
931 * RETURN: Status
933 * DESCRIPTION: Compile DMAR.
935 *****************************************************************************/
937 ACPI_STATUS
938 DtCompileDmar (
939 void **List)
941 ACPI_STATUS Status;
942 DT_SUBTABLE *Subtable;
943 DT_SUBTABLE *ParentTable;
944 DT_FIELD **PFieldList = (DT_FIELD **) List;
945 DT_FIELD *SubtableStart;
946 ACPI_DMTABLE_INFO *InfoTable;
947 ACPI_DMAR_HEADER *DmarHeader;
948 ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
949 UINT32 DeviceScopeLength;
950 UINT32 PciPathLength;
953 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
954 if (ACPI_FAILURE (Status))
956 return (Status);
959 ParentTable = DtPeekSubtable ();
960 DtInsertSubtable (ParentTable, Subtable);
961 DtPushSubtable (Subtable);
963 while (*PFieldList)
965 /* DMAR Header */
967 SubtableStart = *PFieldList;
968 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr,
969 &Subtable);
970 if (ACPI_FAILURE (Status))
972 return (Status);
975 ParentTable = DtPeekSubtable ();
976 DtInsertSubtable (ParentTable, Subtable);
977 DtPushSubtable (Subtable);
979 DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
981 switch (DmarHeader->Type)
983 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
985 InfoTable = AcpiDmTableInfoDmar0;
986 break;
988 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
990 InfoTable = AcpiDmTableInfoDmar1;
991 break;
993 case ACPI_DMAR_TYPE_ROOT_ATS:
995 InfoTable = AcpiDmTableInfoDmar2;
996 break;
998 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
1000 InfoTable = AcpiDmTableInfoDmar3;
1001 break;
1003 case ACPI_DMAR_TYPE_NAMESPACE:
1005 InfoTable = AcpiDmTableInfoDmar4;
1006 break;
1008 default:
1010 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR");
1011 return (AE_ERROR);
1014 /* DMAR Subtable */
1016 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1017 if (ACPI_FAILURE (Status))
1019 return (Status);
1022 ParentTable = DtPeekSubtable ();
1023 DtInsertSubtable (ParentTable, Subtable);
1026 * Optional Device Scope subtables
1028 if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
1029 (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
1031 /* These types do not support device scopes */
1033 DtPopSubtable ();
1034 continue;
1037 DtPushSubtable (Subtable);
1038 DeviceScopeLength = DmarHeader->Length - Subtable->Length -
1039 ParentTable->Length;
1040 while (DeviceScopeLength)
1042 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
1043 &Subtable);
1044 if (Status == AE_NOT_FOUND)
1046 break;
1049 ParentTable = DtPeekSubtable ();
1050 DtInsertSubtable (ParentTable, Subtable);
1051 DtPushSubtable (Subtable);
1053 DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer);
1055 /* Optional PCI Paths */
1057 PciPathLength = DmarDeviceScope->Length - Subtable->Length;
1058 while (PciPathLength)
1060 Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
1061 &Subtable);
1062 if (Status == AE_NOT_FOUND)
1064 DtPopSubtable ();
1065 break;
1068 ParentTable = DtPeekSubtable ();
1069 DtInsertSubtable (ParentTable, Subtable);
1070 PciPathLength -= Subtable->Length;
1073 DtPopSubtable ();
1074 DeviceScopeLength -= DmarDeviceScope->Length;
1077 DtPopSubtable ();
1078 DtPopSubtable ();
1081 return (AE_OK);
1085 /******************************************************************************
1087 * FUNCTION: DtCompileDrtm
1089 * PARAMETERS: List - Current field list pointer
1091 * RETURN: Status
1093 * DESCRIPTION: Compile DRTM.
1095 *****************************************************************************/
1097 ACPI_STATUS
1098 DtCompileDrtm (
1099 void **List)
1101 ACPI_STATUS Status;
1102 DT_SUBTABLE *Subtable;
1103 DT_SUBTABLE *ParentTable;
1104 DT_FIELD **PFieldList = (DT_FIELD **) List;
1105 UINT32 Count;
1106 /* ACPI_TABLE_DRTM *Drtm; */
1107 ACPI_DRTM_VTABLE_LIST *DrtmVtl;
1108 ACPI_DRTM_RESOURCE_LIST *DrtmRl;
1109 /* ACPI_DRTM_DPS_ID *DrtmDps; */
1112 ParentTable = DtPeekSubtable ();
1114 /* Compile DRTM header */
1116 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm,
1117 &Subtable);
1118 if (ACPI_FAILURE (Status))
1120 return (Status);
1122 DtInsertSubtable (ParentTable, Subtable);
1125 * Using ACPI_SUB_PTR, We needn't define a separate structure. Care
1126 * should be taken to avoid accessing ACPI_TABLE_HADER fields.
1128 #if 0
1129 Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM,
1130 Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
1131 #endif
1132 /* Compile VTL */
1134 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0,
1135 &Subtable);
1136 if (ACPI_FAILURE (Status))
1138 return (Status);
1141 DtInsertSubtable (ParentTable, Subtable);
1142 DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer);
1144 DtPushSubtable (Subtable);
1145 ParentTable = DtPeekSubtable ();
1146 Count = 0;
1148 while (*PFieldList)
1150 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a,
1151 &Subtable);
1152 if (ACPI_FAILURE (Status))
1154 return (Status);
1156 if (!Subtable)
1158 break;
1160 DtInsertSubtable (ParentTable, Subtable);
1161 Count++;
1164 DrtmVtl->ValidatedTableCount = Count;
1165 DtPopSubtable ();
1166 ParentTable = DtPeekSubtable ();
1168 /* Compile RL */
1170 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1,
1171 &Subtable);
1172 if (ACPI_FAILURE (Status))
1174 return (Status);
1177 DtInsertSubtable (ParentTable, Subtable);
1178 DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer);
1180 DtPushSubtable (Subtable);
1181 ParentTable = DtPeekSubtable ();
1182 Count = 0;
1184 while (*PFieldList)
1186 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a,
1187 &Subtable);
1188 if (ACPI_FAILURE (Status))
1190 return (Status);
1193 if (!Subtable)
1195 break;
1198 DtInsertSubtable (ParentTable, Subtable);
1199 Count++;
1202 DrtmRl->ResourceCount = Count;
1203 DtPopSubtable ();
1204 ParentTable = DtPeekSubtable ();
1206 /* Compile DPS */
1208 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2,
1209 &Subtable);
1210 if (ACPI_FAILURE (Status))
1212 return (Status);
1214 DtInsertSubtable (ParentTable, Subtable);
1215 /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/
1218 return (AE_OK);
1222 /******************************************************************************
1224 * FUNCTION: DtCompileEinj
1226 * PARAMETERS: List - Current field list pointer
1228 * RETURN: Status
1230 * DESCRIPTION: Compile EINJ.
1232 *****************************************************************************/
1234 ACPI_STATUS
1235 DtCompileEinj (
1236 void **List)
1238 ACPI_STATUS Status;
1241 Status = DtCompileTwoSubtables (List,
1242 AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0);
1243 return (Status);
1247 /******************************************************************************
1249 * FUNCTION: DtCompileErst
1251 * PARAMETERS: List - Current field list pointer
1253 * RETURN: Status
1255 * DESCRIPTION: Compile ERST.
1257 *****************************************************************************/
1259 ACPI_STATUS
1260 DtCompileErst (
1261 void **List)
1263 ACPI_STATUS Status;
1266 Status = DtCompileTwoSubtables (List,
1267 AcpiDmTableInfoErst, AcpiDmTableInfoEinj0);
1268 return (Status);
1272 /******************************************************************************
1274 * FUNCTION: DtCompileGtdt
1276 * PARAMETERS: List - Current field list pointer
1278 * RETURN: Status
1280 * DESCRIPTION: Compile GTDT.
1282 *****************************************************************************/
1284 ACPI_STATUS
1285 DtCompileGtdt (
1286 void **List)
1288 ACPI_STATUS Status;
1289 DT_SUBTABLE *Subtable;
1290 DT_SUBTABLE *ParentTable;
1291 DT_FIELD **PFieldList = (DT_FIELD **) List;
1292 DT_FIELD *SubtableStart;
1293 ACPI_SUBTABLE_HEADER *GtdtHeader;
1294 ACPI_DMTABLE_INFO *InfoTable;
1295 UINT32 GtCount;
1296 ACPI_TABLE_HEADER *Header;
1299 ParentTable = DtPeekSubtable ();
1301 Header = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
1303 /* Compile the main table */
1305 Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt,
1306 &Subtable);
1307 if (ACPI_FAILURE (Status))
1309 return (Status);
1312 /* GTDT revision 3 later contains 2 extra fields before subtables */
1314 if (Header->Revision > 2)
1316 ParentTable = DtPeekSubtable ();
1317 DtInsertSubtable (ParentTable, Subtable);
1319 Status = DtCompileTable (PFieldList,
1320 AcpiDmTableInfoGtdtEl2, &Subtable);
1321 if (ACPI_FAILURE (Status))
1323 return (Status);
1327 ParentTable = DtPeekSubtable ();
1328 DtInsertSubtable (ParentTable, Subtable);
1330 while (*PFieldList)
1332 SubtableStart = *PFieldList;
1333 Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdtHdr,
1334 &Subtable);
1335 if (ACPI_FAILURE (Status))
1337 return (Status);
1340 ParentTable = DtPeekSubtable ();
1341 DtInsertSubtable (ParentTable, Subtable);
1342 DtPushSubtable (Subtable);
1344 GtdtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
1346 switch (GtdtHeader->Type)
1348 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1350 InfoTable = AcpiDmTableInfoGtdt0;
1351 break;
1353 case ACPI_GTDT_TYPE_WATCHDOG:
1355 InfoTable = AcpiDmTableInfoGtdt1;
1356 break;
1358 default:
1360 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "GTDT");
1361 return (AE_ERROR);
1364 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1365 if (ACPI_FAILURE (Status))
1367 return (Status);
1370 ParentTable = DtPeekSubtable ();
1371 DtInsertSubtable (ParentTable, Subtable);
1374 * Additional GT block subtable data
1377 switch (GtdtHeader->Type)
1379 case ACPI_GTDT_TYPE_TIMER_BLOCK:
1381 DtPushSubtable (Subtable);
1382 ParentTable = DtPeekSubtable ();
1384 GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
1385 Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
1387 while (GtCount)
1389 Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt0a,
1390 &Subtable);
1391 if (ACPI_FAILURE (Status))
1393 return (Status);
1396 DtInsertSubtable (ParentTable, Subtable);
1397 GtCount--;
1400 DtPopSubtable ();
1401 break;
1403 default:
1405 break;
1408 DtPopSubtable ();
1411 return (AE_OK);
1415 /******************************************************************************
1417 * FUNCTION: DtCompileFpdt
1419 * PARAMETERS: List - Current field list pointer
1421 * RETURN: Status
1423 * DESCRIPTION: Compile FPDT.
1425 *****************************************************************************/
1427 ACPI_STATUS
1428 DtCompileFpdt (
1429 void **List)
1431 ACPI_STATUS Status;
1432 ACPI_FPDT_HEADER *FpdtHeader;
1433 DT_SUBTABLE *Subtable;
1434 DT_SUBTABLE *ParentTable;
1435 ACPI_DMTABLE_INFO *InfoTable;
1436 DT_FIELD **PFieldList = (DT_FIELD **) List;
1437 DT_FIELD *SubtableStart;
1440 while (*PFieldList)
1442 SubtableStart = *PFieldList;
1443 Status = DtCompileTable (PFieldList, AcpiDmTableInfoFpdtHdr,
1444 &Subtable);
1445 if (ACPI_FAILURE (Status))
1447 return (Status);
1450 ParentTable = DtPeekSubtable ();
1451 DtInsertSubtable (ParentTable, Subtable);
1452 DtPushSubtable (Subtable);
1454 FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
1456 switch (FpdtHeader->Type)
1458 case ACPI_FPDT_TYPE_BOOT:
1460 InfoTable = AcpiDmTableInfoFpdt0;
1461 break;
1463 case ACPI_FPDT_TYPE_S3PERF:
1465 InfoTable = AcpiDmTableInfoFpdt1;
1466 break;
1468 default:
1470 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "FPDT");
1471 return (AE_ERROR);
1472 break;
1475 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1476 if (ACPI_FAILURE (Status))
1478 return (Status);
1481 ParentTable = DtPeekSubtable ();
1482 DtInsertSubtable (ParentTable, Subtable);
1483 DtPopSubtable ();
1486 return (AE_OK);
1490 /******************************************************************************
1492 * FUNCTION: DtCompileHest
1494 * PARAMETERS: List - Current field list pointer
1496 * RETURN: Status
1498 * DESCRIPTION: Compile HEST.
1500 *****************************************************************************/
1502 ACPI_STATUS
1503 DtCompileHest (
1504 void **List)
1506 ACPI_STATUS Status;
1507 DT_SUBTABLE *Subtable;
1508 DT_SUBTABLE *ParentTable;
1509 DT_FIELD **PFieldList = (DT_FIELD **) List;
1510 DT_FIELD *SubtableStart;
1511 ACPI_DMTABLE_INFO *InfoTable;
1512 UINT16 Type;
1513 UINT32 BankCount;
1516 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
1517 &Subtable);
1518 if (ACPI_FAILURE (Status))
1520 return (Status);
1523 ParentTable = DtPeekSubtable ();
1524 DtInsertSubtable (ParentTable, Subtable);
1526 while (*PFieldList)
1528 /* Get subtable type */
1530 SubtableStart = *PFieldList;
1531 DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
1533 switch (Type)
1535 case ACPI_HEST_TYPE_IA32_CHECK:
1537 InfoTable = AcpiDmTableInfoHest0;
1538 break;
1540 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1542 InfoTable = AcpiDmTableInfoHest1;
1543 break;
1545 case ACPI_HEST_TYPE_IA32_NMI:
1547 InfoTable = AcpiDmTableInfoHest2;
1548 break;
1550 case ACPI_HEST_TYPE_AER_ROOT_PORT:
1552 InfoTable = AcpiDmTableInfoHest6;
1553 break;
1555 case ACPI_HEST_TYPE_AER_ENDPOINT:
1557 InfoTable = AcpiDmTableInfoHest7;
1558 break;
1560 case ACPI_HEST_TYPE_AER_BRIDGE:
1562 InfoTable = AcpiDmTableInfoHest8;
1563 break;
1565 case ACPI_HEST_TYPE_GENERIC_ERROR:
1567 InfoTable = AcpiDmTableInfoHest9;
1568 break;
1570 case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
1572 InfoTable = AcpiDmTableInfoHest10;
1573 break;
1575 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1577 InfoTable = AcpiDmTableInfoHest11;
1578 break;
1580 default:
1582 /* Cannot continue on unknown type */
1584 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST");
1585 return (AE_ERROR);
1588 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1589 if (ACPI_FAILURE (Status))
1591 return (Status);
1594 DtInsertSubtable (ParentTable, Subtable);
1597 * Additional subtable data - IA32 Error Bank(s)
1599 BankCount = 0;
1600 switch (Type)
1602 case ACPI_HEST_TYPE_IA32_CHECK:
1604 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
1605 Subtable->Buffer))->NumHardwareBanks;
1606 break;
1608 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
1610 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
1611 Subtable->Buffer))->NumHardwareBanks;
1612 break;
1614 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK:
1616 BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK,
1617 Subtable->Buffer))->NumHardwareBanks;
1618 break;
1620 default:
1622 break;
1625 while (BankCount)
1627 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank,
1628 &Subtable);
1629 if (ACPI_FAILURE (Status))
1631 return (Status);
1634 DtInsertSubtable (ParentTable, Subtable);
1635 BankCount--;
1639 return (AE_OK);
1643 /******************************************************************************
1645 * FUNCTION: DtCompileHmat
1647 * PARAMETERS: List - Current field list pointer
1649 * RETURN: Status
1651 * DESCRIPTION: Compile HMAT.
1653 *****************************************************************************/
1655 ACPI_STATUS
1656 DtCompileHmat (
1657 void **List)
1659 ACPI_STATUS Status;
1660 DT_SUBTABLE *Subtable;
1661 DT_SUBTABLE *ParentTable;
1662 DT_FIELD **PFieldList = (DT_FIELD **) List;
1663 DT_FIELD *SubtableStart;
1664 DT_FIELD *EntryStart;
1665 ACPI_HMAT_STRUCTURE *HmatStruct;
1666 ACPI_HMAT_LOCALITY *HmatLocality;
1667 ACPI_HMAT_CACHE *HmatCache;
1668 ACPI_DMTABLE_INFO *InfoTable;
1669 UINT32 IntPDNumber;
1670 UINT32 TgtPDNumber;
1671 UINT64 EntryNumber;
1672 UINT16 SMBIOSHandleNumber;
1675 ParentTable = DtPeekSubtable ();
1677 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmat,
1678 &Subtable);
1679 if (ACPI_FAILURE (Status))
1681 return (Status);
1683 DtInsertSubtable (ParentTable, Subtable);
1685 while (*PFieldList)
1687 /* Compile HMAT structure header */
1689 SubtableStart = *PFieldList;
1690 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmatHdr,
1691 &Subtable);
1692 if (ACPI_FAILURE (Status))
1694 return (Status);
1696 DtInsertSubtable (ParentTable, Subtable);
1698 HmatStruct = ACPI_CAST_PTR (ACPI_HMAT_STRUCTURE, Subtable->Buffer);
1699 HmatStruct->Length = Subtable->Length;
1701 /* Compile HMAT structure body */
1703 switch (HmatStruct->Type)
1705 case ACPI_HMAT_TYPE_ADDRESS_RANGE:
1707 InfoTable = AcpiDmTableInfoHmat0;
1708 break;
1710 case ACPI_HMAT_TYPE_LOCALITY:
1712 InfoTable = AcpiDmTableInfoHmat1;
1713 break;
1715 case ACPI_HMAT_TYPE_CACHE:
1717 InfoTable = AcpiDmTableInfoHmat2;
1718 break;
1720 default:
1722 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HMAT");
1723 return (AE_ERROR);
1726 Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
1727 if (ACPI_FAILURE (Status))
1729 return (Status);
1731 DtInsertSubtable (ParentTable, Subtable);
1732 HmatStruct->Length += Subtable->Length;
1734 /* Compile HMAT structure additionals */
1736 switch (HmatStruct->Type)
1738 case ACPI_HMAT_TYPE_LOCALITY:
1740 HmatLocality = ACPI_SUB_PTR (ACPI_HMAT_LOCALITY,
1741 Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE));
1743 /* Compile initiator proximity domain list */
1745 IntPDNumber = 0;
1746 while (*PFieldList)
1748 Status = DtCompileTable (PFieldList,
1749 AcpiDmTableInfoHmat1a, &Subtable);
1750 if (ACPI_FAILURE (Status))
1752 return (Status);
1754 if (!Subtable)
1756 break;
1758 DtInsertSubtable (ParentTable, Subtable);
1759 HmatStruct->Length += Subtable->Length;
1760 IntPDNumber++;
1762 HmatLocality->NumberOfInitiatorPDs = IntPDNumber;
1764 /* Compile target proximity domain list */
1766 TgtPDNumber = 0;
1767 while (*PFieldList)
1769 Status = DtCompileTable (PFieldList,
1770 AcpiDmTableInfoHmat1b, &Subtable);
1771 if (ACPI_FAILURE (Status))
1773 return (Status);
1775 if (!Subtable)
1777 break;
1779 DtInsertSubtable (ParentTable, Subtable);
1780 HmatStruct->Length += Subtable->Length;
1781 TgtPDNumber++;
1783 HmatLocality->NumberOfTargetPDs = TgtPDNumber;
1785 /* Save start of the entries for reporting errors */
1787 EntryStart = *PFieldList;
1789 /* Compile latency/bandwidth entries */
1791 EntryNumber = 0;
1792 while (*PFieldList)
1794 Status = DtCompileTable (PFieldList,
1795 AcpiDmTableInfoHmat1c, &Subtable);
1796 if (ACPI_FAILURE (Status))
1798 return (Status);
1800 if (!Subtable)
1802 break;
1804 DtInsertSubtable (ParentTable, Subtable);
1805 HmatStruct->Length += Subtable->Length;
1806 EntryNumber++;
1809 /* Validate number of entries */
1811 if (EntryNumber !=
1812 ((UINT64)IntPDNumber * (UINT64)TgtPDNumber))
1814 DtFatal (ASL_MSG_INVALID_EXPRESSION, EntryStart, "HMAT");
1815 return (AE_ERROR);
1817 break;
1819 case ACPI_HMAT_TYPE_CACHE:
1821 /* Compile SMBIOS handles */
1823 HmatCache = ACPI_SUB_PTR (ACPI_HMAT_CACHE,
1824 Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE));
1825 SMBIOSHandleNumber = 0;
1826 while (*PFieldList)
1828 Status = DtCompileTable (PFieldList,
1829 AcpiDmTableInfoHmat2a, &Subtable);
1830 if (ACPI_FAILURE (Status))
1832 return (Status);
1834 if (!Subtable)
1836 break;
1838 DtInsertSubtable (ParentTable, Subtable);
1839 HmatStruct->Length += Subtable->Length;
1840 SMBIOSHandleNumber++;
1842 HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber;
1843 break;
1845 default:
1847 break;
1851 return (AE_OK);
1855 /******************************************************************************
1857 * FUNCTION: DtCompileIort
1859 * PARAMETERS: List - Current field list pointer
1861 * RETURN: Status
1863 * DESCRIPTION: Compile IORT.
1865 *****************************************************************************/
1867 ACPI_STATUS
1868 DtCompileIort (
1869 void **List)
1871 ACPI_STATUS Status;
1872 DT_SUBTABLE *Subtable;
1873 DT_SUBTABLE *ParentTable;
1874 DT_FIELD **PFieldList = (DT_FIELD **) List;
1875 DT_FIELD *SubtableStart;
1876 ACPI_TABLE_HEADER *Table;
1877 ACPI_TABLE_IORT *Iort;
1878 ACPI_IORT_NODE *IortNode;
1879 ACPI_IORT_ITS_GROUP *IortItsGroup;
1880 ACPI_IORT_SMMU *IortSmmu;
1881 ACPI_IORT_RMR *IortRmr;
1882 UINT32 NodeNumber;
1883 UINT32 NodeLength;
1884 UINT32 IdMappingNumber;
1885 UINT32 ItsNumber;
1886 UINT32 ContextIrptNumber;
1887 UINT32 PmuIrptNumber;
1888 UINT32 PaddingLength;
1889 UINT8 Revision;
1890 UINT32 RmrCount;
1893 ParentTable = DtPeekSubtable ();
1895 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort,
1896 &Subtable);
1897 if (ACPI_FAILURE (Status))
1899 return (Status);
1901 DtInsertSubtable (ParentTable, Subtable);
1903 Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
1904 Revision = Table->Revision;
1906 /* Both IORT Rev E and E.a have known issues and are not supported */
1908 if (Revision == 1 || Revision == 2)
1910 DtError (ASL_ERROR, ASL_MSG_UNSUPPORTED, NULL, "IORT table revision");
1911 return (AE_ERROR);
1915 * Using ACPI_SUB_PTR, We needn't define a separate structure. Care
1916 * should be taken to avoid accessing ACPI_TABLE_HEADER fields.
1918 Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT,
1919 Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
1922 * OptionalPadding - Variable-length data
1923 * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT))
1924 * Optionally allows the generic data types to be used for filling
1925 * this field.
1927 Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
1928 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
1929 &Subtable);
1930 if (ACPI_FAILURE (Status))
1932 return (Status);
1934 if (Subtable)
1936 DtInsertSubtable (ParentTable, Subtable);
1937 Iort->NodeOffset += Subtable->Length;
1939 else
1941 Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList),
1942 AcpiDmTableInfoIortHdr[0].Name, &PaddingLength);
1943 if (ACPI_FAILURE (Status))
1945 return (Status);
1947 Iort->NodeOffset += PaddingLength;
1950 NodeNumber = 0;
1951 while (*PFieldList)
1953 SubtableStart = *PFieldList;
1954 if (Revision == 0)
1956 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr,
1957 &Subtable);
1959 else if (Revision >= 3)
1961 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr3,
1962 &Subtable);
1965 if (ACPI_FAILURE (Status))
1967 return (Status);
1970 DtInsertSubtable (ParentTable, Subtable);
1971 IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer);
1972 NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
1974 DtPushSubtable (Subtable);
1975 ParentTable = DtPeekSubtable ();
1977 switch (IortNode->Type)
1979 case ACPI_IORT_NODE_ITS_GROUP:
1981 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0,
1982 &Subtable);
1983 if (ACPI_FAILURE (Status))
1985 return (Status);
1988 DtInsertSubtable (ParentTable, Subtable);
1989 IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer);
1990 NodeLength += Subtable->Length;
1992 ItsNumber = 0;
1993 while (*PFieldList)
1995 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a,
1996 &Subtable);
1997 if (ACPI_FAILURE (Status))
1999 return (Status);
2001 if (!Subtable)
2003 break;
2006 DtInsertSubtable (ParentTable, Subtable);
2007 NodeLength += Subtable->Length;
2008 ItsNumber++;
2011 IortItsGroup->ItsCount = ItsNumber;
2012 break;
2014 case ACPI_IORT_NODE_NAMED_COMPONENT:
2016 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1,
2017 &Subtable);
2018 if (ACPI_FAILURE (Status))
2020 return (Status);
2023 DtInsertSubtable (ParentTable, Subtable);
2024 NodeLength += Subtable->Length;
2027 * Padding - Variable-length data
2028 * Optionally allows the offset of the ID mappings to be used
2029 * for filling this field.
2031 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a,
2032 &Subtable);
2033 if (ACPI_FAILURE (Status))
2035 return (Status);
2038 if (Subtable)
2040 DtInsertSubtable (ParentTable, Subtable);
2041 NodeLength += Subtable->Length;
2043 else
2045 if (NodeLength > IortNode->MappingOffset)
2047 return (AE_BAD_DATA);
2050 if (NodeLength < IortNode->MappingOffset)
2052 Status = DtCompilePadding (
2053 IortNode->MappingOffset - NodeLength,
2054 &Subtable);
2055 if (ACPI_FAILURE (Status))
2057 return (Status);
2060 DtInsertSubtable (ParentTable, Subtable);
2061 NodeLength = IortNode->MappingOffset;
2064 break;
2066 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
2068 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2,
2069 &Subtable);
2070 if (ACPI_FAILURE (Status))
2072 return (Status);
2075 DtInsertSubtable (ParentTable, Subtable);
2076 NodeLength += Subtable->Length;
2077 break;
2079 case ACPI_IORT_NODE_SMMU:
2081 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3,
2082 &Subtable);
2083 if (ACPI_FAILURE (Status))
2085 return (Status);
2088 DtInsertSubtable (ParentTable, Subtable);
2089 IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer);
2090 NodeLength += Subtable->Length;
2092 /* Compile global interrupt array */
2094 IortSmmu->GlobalInterruptOffset = NodeLength;
2095 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
2096 &Subtable);
2097 if (ACPI_FAILURE (Status))
2099 return (Status);
2102 DtInsertSubtable (ParentTable, Subtable);
2103 NodeLength += Subtable->Length;
2105 /* Compile context interrupt array */
2107 ContextIrptNumber = 0;
2108 IortSmmu->ContextInterruptOffset = NodeLength;
2109 while (*PFieldList)
2111 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
2112 &Subtable);
2113 if (ACPI_FAILURE (Status))
2115 return (Status);
2118 if (!Subtable)
2120 break;
2123 DtInsertSubtable (ParentTable, Subtable);
2124 NodeLength += Subtable->Length;
2125 ContextIrptNumber++;
2128 IortSmmu->ContextInterruptCount = ContextIrptNumber;
2130 /* Compile PMU interrupt array */
2132 PmuIrptNumber = 0;
2133 IortSmmu->PmuInterruptOffset = NodeLength;
2134 while (*PFieldList)
2136 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
2137 &Subtable);
2138 if (ACPI_FAILURE (Status))
2140 return (Status);
2143 if (!Subtable)
2145 break;
2148 DtInsertSubtable (ParentTable, Subtable);
2149 NodeLength += Subtable->Length;
2150 PmuIrptNumber++;
2153 IortSmmu->PmuInterruptCount = PmuIrptNumber;
2154 break;
2156 case ACPI_IORT_NODE_SMMU_V3:
2158 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort4,
2159 &Subtable);
2160 if (ACPI_FAILURE (Status))
2162 return (Status);
2165 DtInsertSubtable (ParentTable, Subtable);
2166 NodeLength += Subtable->Length;
2167 break;
2169 case ACPI_IORT_NODE_PMCG:
2171 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort5,
2172 &Subtable);
2173 if (ACPI_FAILURE (Status))
2175 return (Status);
2178 DtInsertSubtable (ParentTable, Subtable);
2179 NodeLength += Subtable->Length;
2180 break;
2182 case ACPI_IORT_NODE_RMR:
2184 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort6,
2185 &Subtable);
2186 if (ACPI_FAILURE (Status))
2188 return (Status);
2191 DtInsertSubtable (ParentTable, Subtable);
2192 IortRmr = ACPI_CAST_PTR (ACPI_IORT_RMR, Subtable->Buffer);
2193 NodeLength += Subtable->Length;
2195 /* Compile RMR Descriptors */
2197 RmrCount = 0;
2198 IortRmr->RmrOffset = NodeLength;
2199 while (*PFieldList)
2201 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort6a,
2202 &Subtable);
2203 if (ACPI_FAILURE (Status))
2205 return (Status);
2208 if (!Subtable)
2210 break;
2213 DtInsertSubtable (ParentTable, Subtable);
2214 NodeLength += sizeof (ACPI_IORT_RMR_DESC);
2215 RmrCount++;
2218 IortRmr->RmrCount = RmrCount;
2219 break;
2221 default:
2223 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT");
2224 return (AE_ERROR);
2227 /* Compile Array of ID mappings */
2229 IortNode->MappingOffset = NodeLength;
2230 IdMappingNumber = 0;
2231 while (*PFieldList)
2233 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap,
2234 &Subtable);
2235 if (ACPI_FAILURE (Status))
2237 return (Status);
2240 if (!Subtable)
2242 break;
2245 DtInsertSubtable (ParentTable, Subtable);
2246 NodeLength += sizeof (ACPI_IORT_ID_MAPPING);
2247 IdMappingNumber++;
2250 IortNode->MappingCount = IdMappingNumber;
2251 if (!IdMappingNumber)
2253 IortNode->MappingOffset = 0;
2257 * Node length can be determined by DT_LENGTH option
2258 * IortNode->Length = NodeLength;
2260 DtPopSubtable ();
2261 ParentTable = DtPeekSubtable ();
2262 NodeNumber++;
2265 Iort->NodeCount = NodeNumber;
2266 return (AE_OK);
2270 /******************************************************************************
2272 * FUNCTION: DtCompileIvrs
2274 * PARAMETERS: List - Current field list pointer
2276 * RETURN: Status
2278 * DESCRIPTION: Compile IVRS. Notes:
2279 * The IVRS is essentially a flat table, with the following
2280 * structure:
2281 * <Main ACPI Table Header>
2282 * <Main subtable - virtualization info>
2283 * <IVHD>
2284 * <Device Entries>
2285 * ...
2286 * <IVHD>
2287 * <Device Entries>
2288 * <IVMD>
2289 * ...
2291 *****************************************************************************/
2293 ACPI_STATUS
2294 DtCompileIvrs (
2295 void **List)
2297 ACPI_STATUS Status;
2298 DT_SUBTABLE *Subtable;
2299 DT_SUBTABLE *ParentTable;
2300 DT_SUBTABLE *MainSubtable;
2301 DT_FIELD **PFieldList = (DT_FIELD **) List;
2302 DT_FIELD *SubtableStart;
2303 ACPI_DMTABLE_INFO *InfoTable = NULL;
2304 UINT8 SubtableType;
2305 UINT8 Temp64[16];
2306 UINT8 Temp8;
2309 /* Main table */
2311 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs,
2312 &Subtable);
2313 if (ACPI_FAILURE (Status))
2315 return (Status);
2318 ParentTable = DtPeekSubtable ();
2319 DtInsertSubtable (ParentTable, Subtable);
2320 DtPushSubtable (Subtable);
2322 /* Save a pointer to the main subtable */
2324 MainSubtable = Subtable;
2326 while (*PFieldList)
2328 SubtableStart = *PFieldList;
2330 /* Compile the SubtableType integer */
2332 DtCompileInteger (&SubtableType, *PFieldList, 1, 0);
2334 switch (SubtableType)
2337 /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */
2339 case ACPI_IVRS_TYPE_HARDWARE1:
2341 InfoTable = AcpiDmTableInfoIvrsHware1;
2342 break;
2344 /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */
2346 case ACPI_IVRS_TYPE_HARDWARE2:
2347 case ACPI_IVRS_TYPE_HARDWARE3:
2349 InfoTable = AcpiDmTableInfoIvrsHware23;
2350 break;
2352 /* Types 20h, 21h, 22h, IVMD (I/O Virtualization Memory Definition Block) */
2354 case ACPI_IVRS_TYPE_MEMORY1:
2355 case ACPI_IVRS_TYPE_MEMORY2:
2356 case ACPI_IVRS_TYPE_MEMORY3:
2358 InfoTable = AcpiDmTableInfoIvrsMemory;
2359 break;
2361 /* 4-byte device entries */
2363 case ACPI_IVRS_TYPE_PAD4:
2364 case ACPI_IVRS_TYPE_ALL:
2365 case ACPI_IVRS_TYPE_SELECT:
2366 case ACPI_IVRS_TYPE_START:
2367 case ACPI_IVRS_TYPE_END:
2369 InfoTable = AcpiDmTableInfoIvrs4;
2370 break;
2372 /* 8-byte device entries, type A */
2374 case ACPI_IVRS_TYPE_ALIAS_SELECT:
2375 case ACPI_IVRS_TYPE_ALIAS_START:
2377 InfoTable = AcpiDmTableInfoIvrs8a;
2378 break;
2380 /* 8-byte device entries, type B */
2382 case ACPI_IVRS_TYPE_EXT_SELECT:
2383 case ACPI_IVRS_TYPE_EXT_START:
2385 InfoTable = AcpiDmTableInfoIvrs8b;
2386 break;
2388 /* 8-byte device entries, type C */
2390 case ACPI_IVRS_TYPE_SPECIAL:
2392 InfoTable = AcpiDmTableInfoIvrs8c;
2393 break;
2395 /* Variable device entries, type F0h */
2397 case ACPI_IVRS_TYPE_HID:
2399 InfoTable = AcpiDmTableInfoIvrsHid;
2400 break;
2402 default:
2404 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart,
2405 "IVRS Device Entry");
2406 return (AE_ERROR);
2409 /* Compile the InfoTable from above */
2411 Status = DtCompileTable (PFieldList, InfoTable,
2412 &Subtable);
2413 if (ACPI_FAILURE (Status))
2415 return (Status);
2418 ParentTable = DtPeekSubtable ();
2419 if (SubtableType != ACPI_IVRS_TYPE_HARDWARE1 &&
2420 SubtableType != ACPI_IVRS_TYPE_HARDWARE2 &&
2421 SubtableType != ACPI_IVRS_TYPE_HARDWARE3 &&
2422 SubtableType != ACPI_IVRS_TYPE_HID &&
2423 SubtableType != ACPI_IVRS_TYPE_MEMORY1 &&
2424 SubtableType != ACPI_IVRS_TYPE_MEMORY2 &&
2425 SubtableType != ACPI_IVRS_TYPE_MEMORY3)
2427 if (ParentTable)
2428 DtInsertSubtable (ParentTable, Subtable);
2431 switch (SubtableType)
2433 case ACPI_IVRS_TYPE_HARDWARE1:
2434 case ACPI_IVRS_TYPE_HARDWARE2:
2435 case ACPI_IVRS_TYPE_HARDWARE3:
2436 case ACPI_IVRS_TYPE_MEMORY1:
2437 case ACPI_IVRS_TYPE_MEMORY2:
2438 case ACPI_IVRS_TYPE_MEMORY3:
2440 /* Insert these IVHDs/IVMDs at the root subtable */
2442 DtInsertSubtable (MainSubtable, Subtable);
2443 DtPushSubtable (Subtable);
2444 ParentTable = MainSubtable;
2445 break;
2447 case ACPI_IVRS_TYPE_HID:
2449 /* Special handling for the HID named device entry (0xF0) */
2451 if (ParentTable)
2453 DtInsertSubtable (ParentTable, Subtable);
2457 * Process the HID value. First, get the HID value as a string.
2459 DtCompileOneField ((UINT8 *) &Temp64, *PFieldList, 16, DT_FIELD_TYPE_STRING, 0);
2462 * Determine if the HID is an integer or a string.
2463 * An integer is defined to be 32 bits, with the upper 32 bits
2464 * set to zero. (from the ACPI Spec): "The HID can be a 32-bit
2465 * integer or a character string. If an integer, the lower
2466 * 4 bytes of the field contain the integer and the upper
2467 * 4 bytes are padded with 0".
2469 if (UtIsIdInteger ((UINT8 *) &Temp64))
2471 /* Compile the HID value as an integer */
2473 DtCompileOneField ((UINT8 *) &Temp64, *PFieldList, 8, DT_FIELD_TYPE_INTEGER, 0);
2475 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHidInteger,
2476 &Subtable);
2477 if (ACPI_FAILURE (Status))
2479 return (Status);
2482 else
2484 /* Compile the HID value as a string */
2486 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHidString,
2487 &Subtable);
2488 if (ACPI_FAILURE (Status))
2490 return (Status);
2494 DtInsertSubtable (ParentTable, Subtable);
2497 * Process the CID value. First, get the CID value as a string.
2499 DtCompileOneField ((UINT8 *) &Temp64, *PFieldList, 16, DT_FIELD_TYPE_STRING, 0);
2501 if (UtIsIdInteger ((UINT8 *) &Temp64))
2503 /* Compile the CID value as an integer */
2505 DtCompileOneField ((UINT8 *) &Temp64, *PFieldList, 8, DT_FIELD_TYPE_INTEGER, 0);
2507 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsCidInteger,
2508 &Subtable);
2509 if (ACPI_FAILURE (Status))
2511 return (Status);
2514 else
2516 /* Compile the CID value as a string */
2518 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsCidString,
2519 &Subtable);
2520 if (ACPI_FAILURE (Status))
2522 return (Status);
2526 DtInsertSubtable (ParentTable, Subtable);
2529 * Process the UID value. First, get and decode the "UID Format" field (Integer).
2531 if (!*PFieldList)
2533 return (AE_OK);
2536 DtCompileOneField (&Temp8, *PFieldList, 1, DT_FIELD_TYPE_INTEGER, 0);
2538 switch (Temp8)
2540 case ACPI_IVRS_UID_NOT_PRESENT:
2541 break;
2543 case ACPI_IVRS_UID_IS_INTEGER:
2545 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsUidInteger,
2546 &Subtable);
2547 if (ACPI_FAILURE (Status))
2549 return (Status);
2551 DtInsertSubtable (ParentTable, Subtable);
2552 break;
2554 case ACPI_IVRS_UID_IS_STRING:
2556 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsUidString,
2557 &Subtable);
2558 if (ACPI_FAILURE (Status))
2560 return (Status);
2562 DtInsertSubtable (ParentTable, Subtable);
2563 break;
2565 default:
2567 DtFatal (ASL_MSG_UNKNOWN_FORMAT, SubtableStart,
2568 "IVRS Device Entry");
2569 return (AE_ERROR);
2572 default:
2574 /* All other subtable types come through here */
2575 break;
2579 return (AE_OK);