1 /******************************************************************************
3 * Module Name: dttable1.c - handling for specific ACPI tables
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12 * All rights reserved.
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
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
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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
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
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
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
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
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 *****************************************************************************/
200 ACPI_AEST_HEADER
*ErrorNodeHeader
;
201 ACPI_AEST_PROCESSOR
*AestProcessor
;
202 DT_SUBTABLE
*Subtable
;
203 DT_SUBTABLE
*ParentTable
;
204 ACPI_DMTABLE_INFO
*InfoTable
;
208 DT_FIELD
**PFieldList
= (DT_FIELD
**) List
;
213 /* Compile the common error node header */
215 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoAestHdr
,
217 if (ACPI_FAILURE (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
;
249 case ACPI_AEST_MEMORY_ERROR_NODE
:
251 InfoTable
= AcpiDmTableInfoAestMemError
;
254 case ACPI_AEST_SMMU_ERROR_NODE
:
256 InfoTable
= AcpiDmTableInfoAestSmmuError
;
259 case ACPI_AEST_VENDOR_ERROR_NODE
:
261 InfoTable
= AcpiDmTableInfoAestVendorError
;
264 case ACPI_AEST_GIC_ERROR_NODE
:
266 InfoTable
= AcpiDmTableInfoAestGicError
;
269 /* Error case below */
271 AcpiOsPrintf ("Unknown AEST Subtable Type: %X\n",
272 ErrorNodeHeader
->Type
);
276 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
277 if (ACPI_FAILURE (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
299 AestProcessor
= ACPI_CAST_PTR (ACPI_AEST_PROCESSOR
,
302 switch (AestProcessor
->ResourceType
)
304 case ACPI_AEST_CACHE_RESOURCE
:
306 InfoTable
= AcpiDmTableInfoAestCacheRsrc
;
309 case ACPI_AEST_TLB_RESOURCE
:
311 InfoTable
= AcpiDmTableInfoAestTlbRsrc
;
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
);
321 /* Error case below */
323 AcpiOsPrintf ("Unknown AEST Processor Resource Type: %X\n",
324 AestProcessor
->ResourceType
);
328 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
329 if (ACPI_FAILURE (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
,
347 if (ACPI_FAILURE (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
,
372 if (ACPI_FAILURE (Status
))
377 ParentTable
= DtPeekSubtable ();
378 DtInsertSubtable (ParentTable
, Subtable
);
381 /* Prepare for the next AEST Error node */
390 /******************************************************************************
392 * FUNCTION: DtCompileAsf
394 * PARAMETERS: List - Current field list pointer
398 * DESCRIPTION: Compile ASF!.
400 *****************************************************************************/
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;
414 DT_FIELD
**PFieldList
= (DT_FIELD
**) List
;
415 DT_FIELD
*SubtableStart
;
420 SubtableStart
= *PFieldList
;
421 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoAsfHdr
,
423 if (ACPI_FAILURE (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
;
441 case ACPI_ASF_TYPE_ALERT
:
443 InfoTable
= AcpiDmTableInfoAsf1
;
446 case ACPI_ASF_TYPE_CONTROL
:
448 InfoTable
= AcpiDmTableInfoAsf2
;
451 case ACPI_ASF_TYPE_BOOT
:
453 InfoTable
= AcpiDmTableInfoAsf3
;
456 case ACPI_ASF_TYPE_ADDRESS
:
458 InfoTable
= AcpiDmTableInfoAsf4
;
463 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "ASF!");
467 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
468 if (ACPI_FAILURE (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
;
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
;
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
;
499 case ACPI_ASF_TYPE_BOOT
:
501 DataInfoTable
= NULL
;
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
;
514 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "ASF!");
520 switch (AsfTable
->Header
.Type
& 0x7F)
522 case ACPI_ASF_TYPE_ADDRESS
:
524 while (DataCount
> 0)
526 Status
= DtCompileTable (PFieldList
, DataInfoTable
,
528 if (ACPI_FAILURE (Status
))
533 DtInsertSubtable (ParentTable
, Subtable
);
534 DataCount
= DataCount
- Subtable
->Length
;
540 for (i
= 0; i
< DataCount
; i
++)
542 Status
= DtCompileTable (PFieldList
, DataInfoTable
,
544 if (ACPI_FAILURE (Status
))
549 DtInsertSubtable (ParentTable
, Subtable
);
562 /******************************************************************************
564 * FUNCTION: DtCompileCedt
566 * PARAMETERS: List - Current field list pointer
570 * DESCRIPTION: Compile CEDT.
572 *****************************************************************************/
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 */
590 SubtableStart
= *PFieldList
;
594 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoCedtHdr
,
596 if (ACPI_FAILURE (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
:
615 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "CEDT");
621 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoCedt0
, &Subtable
);
622 if (ACPI_FAILURE (Status
))
627 ParentTable
= DtPeekSubtable ();
628 DtInsertSubtable (ParentTable
, Subtable
);
636 /******************************************************************************
638 * FUNCTION: DtCompileCpep
640 * PARAMETERS: List - Current field list pointer
644 * DESCRIPTION: Compile CPEP.
646 *****************************************************************************/
655 Status
= DtCompileTwoSubtables (List
,
656 AcpiDmTableInfoCpep
, AcpiDmTableInfoCpep0
);
661 /******************************************************************************
663 * FUNCTION: DtCompileCsrt
665 * PARAMETERS: List - Current field list pointer
669 * DESCRIPTION: Compile CSRT.
671 *****************************************************************************/
677 ACPI_STATUS Status
= AE_OK
;
678 DT_SUBTABLE
*Subtable
;
679 DT_SUBTABLE
*ParentTable
;
680 DT_FIELD
**PFieldList
= (DT_FIELD
**) List
;
681 UINT32 DescriptorCount
;
685 /* Subtables (Resource Groups) */
687 ParentTable
= DtPeekSubtable ();
690 /* Resource group subtable */
692 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoCsrt0
,
694 if (ACPI_FAILURE (Status
))
699 /* Compute the number of resource descriptors */
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
,
719 if (ACPI_FAILURE (Status
))
724 DtInsertSubtable (ParentTable
, Subtable
);
726 /* Sub-Subtables (Resource Descriptors) */
728 while (*PFieldList
&& DescriptorCount
)
731 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoCsrt2
,
733 if (ACPI_FAILURE (Status
))
738 DtInsertSubtable (ParentTable
, Subtable
);
740 DtPushSubtable (Subtable
);
741 ParentTable
= DtPeekSubtable ();
744 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoCsrt2a
,
746 if (ACPI_FAILURE (Status
))
752 DtInsertSubtable (ParentTable
, Subtable
);
757 ParentTable
= DtPeekSubtable ();
762 ParentTable
= DtPeekSubtable ();
769 /******************************************************************************
771 * FUNCTION: DtCompileDbg2
773 * PARAMETERS: List - Current field list pointer
777 * DESCRIPTION: Compile DBG2.
779 *****************************************************************************/
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
;
798 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDbg2
, &Subtable
);
799 if (ACPI_FAILURE (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
,
824 if (ACPI_FAILURE (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
,
845 if (ACPI_FAILURE (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
,
861 if (ACPI_FAILURE (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
,
875 if (ACPI_FAILURE (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
,
890 if (Status
== AE_END_OF_TABLE
)
892 /* optional field was not found and we're at the end of the file */
896 else if (ACPI_FAILURE (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
);
917 DtPopSubtable (); /* Get next Device Information subtable */
925 /******************************************************************************
927 * FUNCTION: DtCompileDmar
929 * PARAMETERS: List - Current field list pointer
933 * DESCRIPTION: Compile DMAR.
935 *****************************************************************************/
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
))
959 ParentTable
= DtPeekSubtable ();
960 DtInsertSubtable (ParentTable
, Subtable
);
961 DtPushSubtable (Subtable
);
967 SubtableStart
= *PFieldList
;
968 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDmarHdr
,
970 if (ACPI_FAILURE (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
;
988 case ACPI_DMAR_TYPE_RESERVED_MEMORY
:
990 InfoTable
= AcpiDmTableInfoDmar1
;
993 case ACPI_DMAR_TYPE_ROOT_ATS
:
995 InfoTable
= AcpiDmTableInfoDmar2
;
998 case ACPI_DMAR_TYPE_HARDWARE_AFFINITY
:
1000 InfoTable
= AcpiDmTableInfoDmar3
;
1003 case ACPI_DMAR_TYPE_NAMESPACE
:
1005 InfoTable
= AcpiDmTableInfoDmar4
;
1010 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "DMAR");
1016 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
1017 if (ACPI_FAILURE (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 */
1037 DtPushSubtable (Subtable
);
1038 DeviceScopeLength
= DmarHeader
->Length
- Subtable
->Length
-
1039 ParentTable
->Length
;
1040 while (DeviceScopeLength
)
1042 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDmarScope
,
1044 if (Status
== AE_NOT_FOUND
)
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
,
1062 if (Status
== AE_NOT_FOUND
)
1068 ParentTable
= DtPeekSubtable ();
1069 DtInsertSubtable (ParentTable
, Subtable
);
1070 PciPathLength
-= Subtable
->Length
;
1074 DeviceScopeLength
-= DmarDeviceScope
->Length
;
1085 /******************************************************************************
1087 * FUNCTION: DtCompileDrtm
1089 * PARAMETERS: List - Current field list pointer
1093 * DESCRIPTION: Compile DRTM.
1095 *****************************************************************************/
1102 DT_SUBTABLE
*Subtable
;
1103 DT_SUBTABLE
*ParentTable
;
1104 DT_FIELD
**PFieldList
= (DT_FIELD
**) List
;
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
,
1118 if (ACPI_FAILURE (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.
1129 Drtm
= ACPI_SUB_PTR (ACPI_TABLE_DRTM
,
1130 Subtable
->Buffer
, sizeof (ACPI_TABLE_HEADER
));
1134 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDrtm0
,
1136 if (ACPI_FAILURE (Status
))
1141 DtInsertSubtable (ParentTable
, Subtable
);
1142 DrtmVtl
= ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST
, Subtable
->Buffer
);
1144 DtPushSubtable (Subtable
);
1145 ParentTable
= DtPeekSubtable ();
1150 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDrtm0a
,
1152 if (ACPI_FAILURE (Status
))
1160 DtInsertSubtable (ParentTable
, Subtable
);
1164 DrtmVtl
->ValidatedTableCount
= Count
;
1166 ParentTable
= DtPeekSubtable ();
1170 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDrtm1
,
1172 if (ACPI_FAILURE (Status
))
1177 DtInsertSubtable (ParentTable
, Subtable
);
1178 DrtmRl
= ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST
, Subtable
->Buffer
);
1180 DtPushSubtable (Subtable
);
1181 ParentTable
= DtPeekSubtable ();
1186 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDrtm1a
,
1188 if (ACPI_FAILURE (Status
))
1198 DtInsertSubtable (ParentTable
, Subtable
);
1202 DrtmRl
->ResourceCount
= Count
;
1204 ParentTable
= DtPeekSubtable ();
1208 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoDrtm2
,
1210 if (ACPI_FAILURE (Status
))
1214 DtInsertSubtable (ParentTable
, Subtable
);
1215 /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/
1222 /******************************************************************************
1224 * FUNCTION: DtCompileEinj
1226 * PARAMETERS: List - Current field list pointer
1230 * DESCRIPTION: Compile EINJ.
1232 *****************************************************************************/
1241 Status
= DtCompileTwoSubtables (List
,
1242 AcpiDmTableInfoEinj
, AcpiDmTableInfoEinj0
);
1247 /******************************************************************************
1249 * FUNCTION: DtCompileErst
1251 * PARAMETERS: List - Current field list pointer
1255 * DESCRIPTION: Compile ERST.
1257 *****************************************************************************/
1266 Status
= DtCompileTwoSubtables (List
,
1267 AcpiDmTableInfoErst
, AcpiDmTableInfoEinj0
);
1272 /******************************************************************************
1274 * FUNCTION: DtCompileGtdt
1276 * PARAMETERS: List - Current field list pointer
1280 * DESCRIPTION: Compile GTDT.
1282 *****************************************************************************/
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
;
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
,
1307 if (ACPI_FAILURE (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
))
1327 ParentTable
= DtPeekSubtable ();
1328 DtInsertSubtable (ParentTable
, Subtable
);
1332 SubtableStart
= *PFieldList
;
1333 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoGtdtHdr
,
1335 if (ACPI_FAILURE (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
;
1353 case ACPI_GTDT_TYPE_WATCHDOG
:
1355 InfoTable
= AcpiDmTableInfoGtdt1
;
1360 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "GTDT");
1364 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
1365 if (ACPI_FAILURE (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
;
1389 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoGtdt0a
,
1391 if (ACPI_FAILURE (Status
))
1396 DtInsertSubtable (ParentTable
, Subtable
);
1415 /******************************************************************************
1417 * FUNCTION: DtCompileFpdt
1419 * PARAMETERS: List - Current field list pointer
1423 * DESCRIPTION: Compile FPDT.
1425 *****************************************************************************/
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
;
1442 SubtableStart
= *PFieldList
;
1443 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoFpdtHdr
,
1445 if (ACPI_FAILURE (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
;
1463 case ACPI_FPDT_TYPE_S3PERF
:
1465 InfoTable
= AcpiDmTableInfoFpdt1
;
1470 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "FPDT");
1475 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
1476 if (ACPI_FAILURE (Status
))
1481 ParentTable
= DtPeekSubtable ();
1482 DtInsertSubtable (ParentTable
, Subtable
);
1490 /******************************************************************************
1492 * FUNCTION: DtCompileHest
1494 * PARAMETERS: List - Current field list pointer
1498 * DESCRIPTION: Compile HEST.
1500 *****************************************************************************/
1507 DT_SUBTABLE
*Subtable
;
1508 DT_SUBTABLE
*ParentTable
;
1509 DT_FIELD
**PFieldList
= (DT_FIELD
**) List
;
1510 DT_FIELD
*SubtableStart
;
1511 ACPI_DMTABLE_INFO
*InfoTable
;
1516 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoHest
,
1518 if (ACPI_FAILURE (Status
))
1523 ParentTable
= DtPeekSubtable ();
1524 DtInsertSubtable (ParentTable
, Subtable
);
1528 /* Get subtable type */
1530 SubtableStart
= *PFieldList
;
1531 DtCompileInteger ((UINT8
*) &Type
, *PFieldList
, 2, 0);
1535 case ACPI_HEST_TYPE_IA32_CHECK
:
1537 InfoTable
= AcpiDmTableInfoHest0
;
1540 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK
:
1542 InfoTable
= AcpiDmTableInfoHest1
;
1545 case ACPI_HEST_TYPE_IA32_NMI
:
1547 InfoTable
= AcpiDmTableInfoHest2
;
1550 case ACPI_HEST_TYPE_AER_ROOT_PORT
:
1552 InfoTable
= AcpiDmTableInfoHest6
;
1555 case ACPI_HEST_TYPE_AER_ENDPOINT
:
1557 InfoTable
= AcpiDmTableInfoHest7
;
1560 case ACPI_HEST_TYPE_AER_BRIDGE
:
1562 InfoTable
= AcpiDmTableInfoHest8
;
1565 case ACPI_HEST_TYPE_GENERIC_ERROR
:
1567 InfoTable
= AcpiDmTableInfoHest9
;
1570 case ACPI_HEST_TYPE_GENERIC_ERROR_V2
:
1572 InfoTable
= AcpiDmTableInfoHest10
;
1575 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK
:
1577 InfoTable
= AcpiDmTableInfoHest11
;
1582 /* Cannot continue on unknown type */
1584 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "HEST");
1588 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
1589 if (ACPI_FAILURE (Status
))
1594 DtInsertSubtable (ParentTable
, Subtable
);
1597 * Additional subtable data - IA32 Error Bank(s)
1602 case ACPI_HEST_TYPE_IA32_CHECK
:
1604 BankCount
= (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK
,
1605 Subtable
->Buffer
))->NumHardwareBanks
;
1608 case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK
:
1610 BankCount
= (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED
,
1611 Subtable
->Buffer
))->NumHardwareBanks
;
1614 case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK
:
1616 BankCount
= (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK
,
1617 Subtable
->Buffer
))->NumHardwareBanks
;
1627 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoHestBank
,
1629 if (ACPI_FAILURE (Status
))
1634 DtInsertSubtable (ParentTable
, Subtable
);
1643 /******************************************************************************
1645 * FUNCTION: DtCompileHmat
1647 * PARAMETERS: List - Current field list pointer
1651 * DESCRIPTION: Compile HMAT.
1653 *****************************************************************************/
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
;
1672 UINT16 SMBIOSHandleNumber
;
1675 ParentTable
= DtPeekSubtable ();
1677 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoHmat
,
1679 if (ACPI_FAILURE (Status
))
1683 DtInsertSubtable (ParentTable
, Subtable
);
1687 /* Compile HMAT structure header */
1689 SubtableStart
= *PFieldList
;
1690 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoHmatHdr
,
1692 if (ACPI_FAILURE (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
;
1710 case ACPI_HMAT_TYPE_LOCALITY
:
1712 InfoTable
= AcpiDmTableInfoHmat1
;
1715 case ACPI_HMAT_TYPE_CACHE
:
1717 InfoTable
= AcpiDmTableInfoHmat2
;
1722 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "HMAT");
1726 Status
= DtCompileTable (PFieldList
, InfoTable
, &Subtable
);
1727 if (ACPI_FAILURE (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 */
1748 Status
= DtCompileTable (PFieldList
,
1749 AcpiDmTableInfoHmat1a
, &Subtable
);
1750 if (ACPI_FAILURE (Status
))
1758 DtInsertSubtable (ParentTable
, Subtable
);
1759 HmatStruct
->Length
+= Subtable
->Length
;
1762 HmatLocality
->NumberOfInitiatorPDs
= IntPDNumber
;
1764 /* Compile target proximity domain list */
1769 Status
= DtCompileTable (PFieldList
,
1770 AcpiDmTableInfoHmat1b
, &Subtable
);
1771 if (ACPI_FAILURE (Status
))
1779 DtInsertSubtable (ParentTable
, Subtable
);
1780 HmatStruct
->Length
+= Subtable
->Length
;
1783 HmatLocality
->NumberOfTargetPDs
= TgtPDNumber
;
1785 /* Save start of the entries for reporting errors */
1787 EntryStart
= *PFieldList
;
1789 /* Compile latency/bandwidth entries */
1794 Status
= DtCompileTable (PFieldList
,
1795 AcpiDmTableInfoHmat1c
, &Subtable
);
1796 if (ACPI_FAILURE (Status
))
1804 DtInsertSubtable (ParentTable
, Subtable
);
1805 HmatStruct
->Length
+= Subtable
->Length
;
1809 /* Validate number of entries */
1812 ((UINT64
)IntPDNumber
* (UINT64
)TgtPDNumber
))
1814 DtFatal (ASL_MSG_INVALID_EXPRESSION
, EntryStart
, "HMAT");
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;
1828 Status
= DtCompileTable (PFieldList
,
1829 AcpiDmTableInfoHmat2a
, &Subtable
);
1830 if (ACPI_FAILURE (Status
))
1838 DtInsertSubtable (ParentTable
, Subtable
);
1839 HmatStruct
->Length
+= Subtable
->Length
;
1840 SMBIOSHandleNumber
++;
1842 HmatCache
->NumberOfSMBIOSHandles
= SMBIOSHandleNumber
;
1855 /******************************************************************************
1857 * FUNCTION: DtCompileIort
1859 * PARAMETERS: List - Current field list pointer
1863 * DESCRIPTION: Compile IORT.
1865 *****************************************************************************/
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
;
1884 UINT32 IdMappingNumber
;
1886 UINT32 ContextIrptNumber
;
1887 UINT32 PmuIrptNumber
;
1888 UINT32 PaddingLength
;
1893 ParentTable
= DtPeekSubtable ();
1895 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort
,
1897 if (ACPI_FAILURE (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");
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
1927 Iort
->NodeOffset
= sizeof (ACPI_TABLE_IORT
);
1928 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIortPad
,
1930 if (ACPI_FAILURE (Status
))
1936 DtInsertSubtable (ParentTable
, Subtable
);
1937 Iort
->NodeOffset
+= Subtable
->Length
;
1941 Status
= DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList
),
1942 AcpiDmTableInfoIortHdr
[0].Name
, &PaddingLength
);
1943 if (ACPI_FAILURE (Status
))
1947 Iort
->NodeOffset
+= PaddingLength
;
1953 SubtableStart
= *PFieldList
;
1956 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIortHdr
,
1959 else if (Revision
>= 3)
1961 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIortHdr3
,
1965 if (ACPI_FAILURE (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
,
1983 if (ACPI_FAILURE (Status
))
1988 DtInsertSubtable (ParentTable
, Subtable
);
1989 IortItsGroup
= ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP
, Subtable
->Buffer
);
1990 NodeLength
+= Subtable
->Length
;
1995 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort0a
,
1997 if (ACPI_FAILURE (Status
))
2006 DtInsertSubtable (ParentTable
, Subtable
);
2007 NodeLength
+= Subtable
->Length
;
2011 IortItsGroup
->ItsCount
= ItsNumber
;
2014 case ACPI_IORT_NODE_NAMED_COMPONENT
:
2016 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort1
,
2018 if (ACPI_FAILURE (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
,
2033 if (ACPI_FAILURE (Status
))
2040 DtInsertSubtable (ParentTable
, Subtable
);
2041 NodeLength
+= Subtable
->Length
;
2045 if (NodeLength
> IortNode
->MappingOffset
)
2047 return (AE_BAD_DATA
);
2050 if (NodeLength
< IortNode
->MappingOffset
)
2052 Status
= DtCompilePadding (
2053 IortNode
->MappingOffset
- NodeLength
,
2055 if (ACPI_FAILURE (Status
))
2060 DtInsertSubtable (ParentTable
, Subtable
);
2061 NodeLength
= IortNode
->MappingOffset
;
2066 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX
:
2068 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort2
,
2070 if (ACPI_FAILURE (Status
))
2075 DtInsertSubtable (ParentTable
, Subtable
);
2076 NodeLength
+= Subtable
->Length
;
2079 case ACPI_IORT_NODE_SMMU
:
2081 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort3
,
2083 if (ACPI_FAILURE (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
,
2097 if (ACPI_FAILURE (Status
))
2102 DtInsertSubtable (ParentTable
, Subtable
);
2103 NodeLength
+= Subtable
->Length
;
2105 /* Compile context interrupt array */
2107 ContextIrptNumber
= 0;
2108 IortSmmu
->ContextInterruptOffset
= NodeLength
;
2111 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort3b
,
2113 if (ACPI_FAILURE (Status
))
2123 DtInsertSubtable (ParentTable
, Subtable
);
2124 NodeLength
+= Subtable
->Length
;
2125 ContextIrptNumber
++;
2128 IortSmmu
->ContextInterruptCount
= ContextIrptNumber
;
2130 /* Compile PMU interrupt array */
2133 IortSmmu
->PmuInterruptOffset
= NodeLength
;
2136 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort3c
,
2138 if (ACPI_FAILURE (Status
))
2148 DtInsertSubtable (ParentTable
, Subtable
);
2149 NodeLength
+= Subtable
->Length
;
2153 IortSmmu
->PmuInterruptCount
= PmuIrptNumber
;
2156 case ACPI_IORT_NODE_SMMU_V3
:
2158 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort4
,
2160 if (ACPI_FAILURE (Status
))
2165 DtInsertSubtable (ParentTable
, Subtable
);
2166 NodeLength
+= Subtable
->Length
;
2169 case ACPI_IORT_NODE_PMCG
:
2171 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort5
,
2173 if (ACPI_FAILURE (Status
))
2178 DtInsertSubtable (ParentTable
, Subtable
);
2179 NodeLength
+= Subtable
->Length
;
2182 case ACPI_IORT_NODE_RMR
:
2184 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort6
,
2186 if (ACPI_FAILURE (Status
))
2191 DtInsertSubtable (ParentTable
, Subtable
);
2192 IortRmr
= ACPI_CAST_PTR (ACPI_IORT_RMR
, Subtable
->Buffer
);
2193 NodeLength
+= Subtable
->Length
;
2195 /* Compile RMR Descriptors */
2198 IortRmr
->RmrOffset
= NodeLength
;
2201 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIort6a
,
2203 if (ACPI_FAILURE (Status
))
2213 DtInsertSubtable (ParentTable
, Subtable
);
2214 NodeLength
+= sizeof (ACPI_IORT_RMR_DESC
);
2218 IortRmr
->RmrCount
= RmrCount
;
2223 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
, "IORT");
2227 /* Compile Array of ID mappings */
2229 IortNode
->MappingOffset
= NodeLength
;
2230 IdMappingNumber
= 0;
2233 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIortMap
,
2235 if (ACPI_FAILURE (Status
))
2245 DtInsertSubtable (ParentTable
, Subtable
);
2246 NodeLength
+= sizeof (ACPI_IORT_ID_MAPPING
);
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;
2261 ParentTable
= DtPeekSubtable ();
2265 Iort
->NodeCount
= NodeNumber
;
2270 /******************************************************************************
2272 * FUNCTION: DtCompileIvrs
2274 * PARAMETERS: List - Current field list pointer
2278 * DESCRIPTION: Compile IVRS. Notes:
2279 * The IVRS is essentially a flat table, with the following
2281 * <Main ACPI Table Header>
2282 * <Main subtable - virtualization info>
2291 *****************************************************************************/
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
;
2311 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIvrs
,
2313 if (ACPI_FAILURE (Status
))
2318 ParentTable
= DtPeekSubtable ();
2319 DtInsertSubtable (ParentTable
, Subtable
);
2320 DtPushSubtable (Subtable
);
2322 /* Save a pointer to the main subtable */
2324 MainSubtable
= Subtable
;
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
;
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
;
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
;
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
;
2372 /* 8-byte device entries, type A */
2374 case ACPI_IVRS_TYPE_ALIAS_SELECT
:
2375 case ACPI_IVRS_TYPE_ALIAS_START
:
2377 InfoTable
= AcpiDmTableInfoIvrs8a
;
2380 /* 8-byte device entries, type B */
2382 case ACPI_IVRS_TYPE_EXT_SELECT
:
2383 case ACPI_IVRS_TYPE_EXT_START
:
2385 InfoTable
= AcpiDmTableInfoIvrs8b
;
2388 /* 8-byte device entries, type C */
2390 case ACPI_IVRS_TYPE_SPECIAL
:
2392 InfoTable
= AcpiDmTableInfoIvrs8c
;
2395 /* Variable device entries, type F0h */
2397 case ACPI_IVRS_TYPE_HID
:
2399 InfoTable
= AcpiDmTableInfoIvrsHid
;
2404 DtFatal (ASL_MSG_UNKNOWN_SUBTABLE
, SubtableStart
,
2405 "IVRS Device Entry");
2409 /* Compile the InfoTable from above */
2411 Status
= DtCompileTable (PFieldList
, InfoTable
,
2413 if (ACPI_FAILURE (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
)
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
;
2447 case ACPI_IVRS_TYPE_HID
:
2449 /* Special handling for the HID named device entry (0xF0) */
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
,
2477 if (ACPI_FAILURE (Status
))
2484 /* Compile the HID value as a string */
2486 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIvrsHidString
,
2488 if (ACPI_FAILURE (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
,
2509 if (ACPI_FAILURE (Status
))
2516 /* Compile the CID value as a string */
2518 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIvrsCidString
,
2520 if (ACPI_FAILURE (Status
))
2526 DtInsertSubtable (ParentTable
, Subtable
);
2529 * Process the UID value. First, get and decode the "UID Format" field (Integer).
2536 DtCompileOneField (&Temp8
, *PFieldList
, 1, DT_FIELD_TYPE_INTEGER
, 0);
2540 case ACPI_IVRS_UID_NOT_PRESENT
:
2543 case ACPI_IVRS_UID_IS_INTEGER
:
2545 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIvrsUidInteger
,
2547 if (ACPI_FAILURE (Status
))
2551 DtInsertSubtable (ParentTable
, Subtable
);
2554 case ACPI_IVRS_UID_IS_STRING
:
2556 Status
= DtCompileTable (PFieldList
, AcpiDmTableInfoIvrsUidString
,
2558 if (ACPI_FAILURE (Status
))
2562 DtInsertSubtable (ParentTable
, Subtable
);
2567 DtFatal (ASL_MSG_UNKNOWN_FORMAT
, SubtableStart
,
2568 "IVRS Device Entry");
2574 /* All other subtable types come through here */