]>
Commit | Line | Data |
---|---|---|
292e5408 PG |
1 | /** @file\r |
2 | AML Defines.\r | |
3 | \r | |
1f515342 | 4 | Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>\r |
292e5408 PG |
5 | \r |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | **/\r | |
8 | \r | |
9 | #ifndef AML_DEFINES_H_\r | |
10 | #define AML_DEFINES_H_\r | |
11 | \r | |
12 | /**\r | |
13 | @defgroup TreeStructures Tree structures\r | |
14 | @ingroup AMLLib\r | |
15 | @{\r | |
16 | The AML tree created by the AMLLib relies on enum/define values and\r | |
17 | structures defined here.\r | |
18 | @}\r | |
19 | */\r | |
20 | \r | |
21 | /** AML tree node types.\r | |
22 | \r | |
23 | Data nodes are tagged with the data type they contain.\r | |
24 | Some data types cannot be used for data nodes (None, Object).\r | |
25 | EAmlUIntX types are converted to the EAML_NODE_DATA_TYPE enum type.\r | |
26 | These types are accessible externally.\r | |
27 | \r | |
28 | @ingroup TreeStructures\r | |
29 | */\r | |
30 | typedef enum EAmlNodeDataType {\r | |
31 | EAmlNodeDataTypeNone = 0, ///< EAmlNone, not accessible.\r | |
32 | EAmlNodeDataTypeReserved1, ///< EAmlUInt8, converted to the UInt type.\r | |
33 | EAmlNodeDataTypeReserved2, ///< EAmlUInt16, converted to the UInt type.\r | |
34 | EAmlNodeDataTypeReserved3, ///< EAmlUInt32, converted to the UInt type.\r | |
35 | EAmlNodeDataTypeReserved4, ///< EAmlUInt64, converted to the UInt type.\r | |
36 | EAmlNodeDataTypeReserved5, ///< EAmlObject, not accessible.\r | |
37 | EAmlNodeDataTypeNameString, ///< EAmlName, name corresponding to the\r | |
38 | /// NameString keyword in the ACPI\r | |
39 | /// specification. E.g.: "\_SB_.DEV0"\r | |
40 | EAmlNodeDataTypeString, ///< EAmlString, NULL terminated string.\r | |
41 | EAmlNodeDataTypeUInt, ///< Integer data of any length, EAmlUIntX\r | |
42 | /// are converted to this type.\r | |
43 | EAmlNodeDataTypeRaw, ///< Raw bytes contained in a buffer.\r | |
44 | EAmlNodeDataTypeResourceData, ///< Resource data element.\r | |
45 | EAmlNodeDataTypeFieldPkgLen, ///< FieldPkgLen data element.\r | |
46 | /// PkgLen are usually stored as\r | |
47 | /// part of object node structures.\r | |
48 | /// However, they can be found\r | |
49 | /// standalone in a FieldList.\r | |
50 | EAmlNodeDataTypeMax ///< Max enum.\r | |
51 | } EAML_NODE_DATA_TYPE;\r | |
52 | \r | |
53 | /** Indexes of fixed arguments.\r | |
54 | \r | |
55 | AML objects defined the ACPI 6.3 specification,\r | |
56 | s20.3 "AML Byte Stream Byte Values" can have at most 6 fixed arguments.\r | |
57 | \r | |
58 | Method and functions can have at most 7 arguments, cf\r | |
59 | s19.6.83 "Method (Declare Control Method)". The enum goes to 8 to store the\r | |
60 | name of the method invocation.\r | |
61 | \r | |
62 | @ingroup TreeStructures\r | |
63 | */\r | |
64 | typedef enum EAmlParseIndex {\r | |
65 | EAmlParseIndexTerm0 = 0, ///< First fixed argument index.\r | |
66 | EAmlParseIndexTerm1, ///< Second fixed argument index.\r | |
67 | EAmlParseIndexTerm2, ///< Third fixed argument index.\r | |
68 | EAmlParseIndexTerm3, ///< Fourth fixed argument index.\r | |
69 | EAmlParseIndexTerm4, ///< Fifth fixed argument index.\r | |
70 | EAmlParseIndexTerm5, ///< Sixth fixed argument index.\r | |
71 | EAmlParseIndexMax ///< Maximum fixed argument index (=6).\r | |
72 | } EAML_PARSE_INDEX;\r | |
73 | \r | |
74 | /** Maximum size of an AML NameString.\r | |
75 | \r | |
76 | An AML NameString can be at most (255 * 4) + 255 + 2 = 1277 bytes long.\r | |
77 | Indeed, according to ACPI 6.3 specification, s20.2.2,\r | |
78 | an AML NameString can be resolved as a MultiNamePath.\r | |
79 | \r | |
80 | The encoding of this MultiNamePath can be made of at most:\r | |
81 | - 255 carets ('^'), one for each level in the namespace;\r | |
82 | - 255 NameSeg of 4 bytes;\r | |
83 | - 2 bytes for the MultiNamePrefix and SegCount.\r | |
84 | \r | |
85 | @ingroup TreeStructures\r | |
86 | */\r | |
87 | #define MAX_AML_NAMESTRING_SIZE 1277U\r | |
88 | \r | |
89 | /** Maximum size of an ASL NameString.\r | |
90 | \r | |
91 | An ASL NameString can be at most (255 * 4) + 255 + 254 = 1529 bytes long.\r | |
92 | Cf the ASL grammar available in ACPI 6.3 specification, 19.2.2.\r | |
93 | \r | |
94 | The encoding of an ASL NameString can be made of at most:\r | |
95 | - 255 carets ('^'), one for each level in the namespace;\r | |
96 | - 255 NameSeg of 4 bytes;\r | |
97 | - 254 NameSeg separators ('.').\r | |
98 | \r | |
99 | @ingroup TreeStructures\r | |
100 | */\r | |
101 | #define MAX_ASL_NAMESTRING_SIZE 1529U\r | |
102 | \r | |
103 | /** Pseudo OpCode for method invocations.\r | |
104 | \r | |
105 | The AML grammar does not attribute an OpCode/SubOpCode couple for\r | |
106 | method invocations. This library is representing method invocations\r | |
107 | as if they had one.\r | |
108 | \r | |
109 | The AML encoding for method invocations in the ACPI specification 6.3 is:\r | |
110 | MethodInvocation := NameString TermArgList\r | |
111 | In this library, it is:\r | |
112 | MethodInvocation := MethodInvocationOp NameString ArgumentCount TermArgList\r | |
113 | ArgumentCount := ByteData\r | |
114 | \r | |
115 | When computing the size of a tree or serializing it, the additional data is\r | |
116 | not taken into account (i.e. the MethodInvocationOp and the ArgumentCount).\r | |
117 | \r | |
118 | @ingroup TreeStructures\r | |
119 | */\r | |
120 | #define AML_METHOD_INVOC_OP 0xD0\r | |
121 | \r | |
122 | /** Pseudo OpCode for NamedField field elements.\r | |
123 | \r | |
124 | The AML grammar does not attribute an OpCode/SubOpCode couple for\r | |
125 | the NamedField field element. This library is representing NamedField field\r | |
126 | elements as if they had one.\r | |
127 | \r | |
128 | The AML encoding for NamedField field elements in the ACPI specification 6.3\r | |
129 | is:\r | |
130 | NamedField := NameSeg PkgLength\r | |
131 | In this library, it is:\r | |
132 | NamedField := NamedFieldOp NameSeg PkgLength\r | |
133 | \r | |
134 | When computing the size of a tree or serializing it, the additional data is\r | |
135 | not taken into account (i.e. the NamedFieldOp).\r | |
136 | \r | |
137 | @ingroup TreeStructures\r | |
138 | */\r | |
139 | #define AML_FIELD_NAMED_OP 0x04\r | |
140 | \r | |
292e5408 PG |
141 | /** AML object types.\r |
142 | \r | |
143 | The ACPI specification defines several object types. They are listed\r | |
144 | with the definition of ObjectTypeKeyword.\r | |
145 | \r | |
146 | @ingroup TreeStructures\r | |
147 | */\r | |
148 | typedef enum EAmlObjType {\r | |
149 | EAmlObjTypeUnknown = 0x0,\r | |
150 | EAmlObjTypeInt,\r | |
151 | EAmlObjTypeStrObj,\r | |
152 | EAmlObjTypeBuffObj,\r | |
153 | EAmlObjTypePkgObj,\r | |
154 | EAmlObjTypeFieldUnitObj,\r | |
155 | EAmlObjTypeDeviceObj,\r | |
156 | EAmlObjTypeEventObj,\r | |
157 | EAmlObjTypeMethodObj,\r | |
158 | EAmlObjTypeMutexObj,\r | |
159 | EAmlObjTypeOpRegionObj,\r | |
160 | EAmlObjTypePowerResObj,\r | |
161 | EAmlObjTypeProcessorObj,\r | |
162 | EAmlObjTypeThermalZoneObj,\r | |
163 | EAmlObjTypeBuffFieldObj,\r | |
164 | EAmlObjTypeDDBHandleObj,\r | |
165 | } EAML_OBJ_TYPE;\r | |
166 | \r | |
167 | /** Node types.\r | |
168 | \r | |
169 | @ingroup TreeStructures\r | |
170 | */\r | |
171 | typedef enum EAmlNodeType {\r | |
172 | EAmlNodeUnknown, ///< Unknown/Invalid AML Node Type.\r | |
173 | EAmlNodeRoot, ///< AML Root Node, typically represents a DefinitionBlock.\r | |
174 | EAmlNodeObject, ///< AML Object Node, typically represents an ASL statement\r | |
175 | /// or its arguments.\r | |
176 | EAmlNodeData, ///< AML Data Node, typically represents arguments for an\r | |
177 | /// ASL statement.\r | |
178 | EAmlNodeMax ///< Max enum.\r | |
179 | } EAML_NODE_TYPE;\r | |
180 | \r | |
181 | #endif // AML_DEFINES_H_\r |