]>
Commit | Line | Data |
---|---|---|
c85ac524 PG |
1 | /** @file\r |
2 | AML Lib.\r | |
3 | \r | |
691c5f77 | 4 | Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>\r |
c85ac524 PG |
5 | \r |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | **/\r | |
8 | \r | |
9 | #ifndef AML_LIB_H_\r | |
10 | #define AML_LIB_H_\r | |
11 | \r | |
12 | /**\r | |
13 | @mainpage Dynamic AML Generation\r | |
14 | @{\r | |
15 | @par Summary\r | |
16 | @{\r | |
17 | ACPI tables are categorized as data tables and definition block\r | |
18 | tables. Dynamic Tables Framework currently supports generation of ACPI\r | |
19 | data tables. Generation of definition block tables is difficult as these\r | |
20 | tables are encoded in ACPI Machine Language (AML), which has a complex\r | |
21 | grammar.\r | |
22 | \r | |
23 | Dynamic AML Generation is an extension to the Dynamic tables Framework.\r | |
24 | One of the techniques used to simplify definition block generation is to\r | |
25 | fixup a template SSDT table.\r | |
26 | \r | |
27 | Dynamic AML aims to provide a framework that allows fixing up of an ACPI\r | |
28 | SSDT template with appropriate information about the hardware.\r | |
29 | \r | |
30 | This framework consists of an:\r | |
31 | - AMLLib core that implements a rich set of interfaces to parse, traverse\r | |
32 | and update AML data.\r | |
33 | - AMLLib library APIs that provides interfaces to search and updates nodes\r | |
34 | in the AML namespace.\r | |
35 | @}\r | |
36 | @}\r | |
37 | */\r | |
38 | \r | |
39 | #include <IndustryStandard/Acpi.h>\r | |
40 | \r | |
41 | #ifndef AML_HANDLE\r | |
42 | \r | |
43 | /** Node handle.\r | |
44 | */\r | |
731c67e1 | 45 | typedef void *AML_NODE_HANDLE;\r |
c85ac524 PG |
46 | \r |
47 | /** Root Node handle.\r | |
48 | */\r | |
731c67e1 | 49 | typedef void *AML_ROOT_NODE_HANDLE;\r |
c85ac524 PG |
50 | \r |
51 | /** Object Node handle.\r | |
52 | */\r | |
731c67e1 | 53 | typedef void *AML_OBJECT_NODE_HANDLE;\r |
c85ac524 PG |
54 | \r |
55 | /** Data Node handle.\r | |
56 | */\r | |
731c67e1 | 57 | typedef void *AML_DATA_NODE_HANDLE;\r |
c85ac524 PG |
58 | \r |
59 | #endif // AML_HANDLE\r | |
60 | \r | |
61 | /** Parse the definition block.\r | |
62 | \r | |
63 | The function parses the whole AML blob. It starts with the ACPI DSDT/SSDT\r | |
64 | header and then parses the AML bytestream.\r | |
65 | A tree structure is returned via the RootPtr.\r | |
66 | The tree must be deleted with the AmlDeleteTree function.\r | |
67 | \r | |
68 | @ingroup UserApis\r | |
69 | \r | |
70 | @param [in] DefinitionBlock Pointer to the definition block.\r | |
71 | @param [out] RootPtr Pointer to the root node of the AML tree.\r | |
72 | \r | |
73 | @retval EFI_SUCCESS The function completed successfully.\r | |
74 | @retval EFI_BUFFER_TOO_SMALL No space left in the buffer.\r | |
75 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
76 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
77 | **/\r | |
78 | EFI_STATUS\r | |
79 | EFIAPI\r | |
80 | AmlParseDefinitionBlock (\r | |
731c67e1 MK |
81 | IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock,\r |
82 | OUT AML_ROOT_NODE_HANDLE *RootPtr\r | |
c85ac524 PG |
83 | );\r |
84 | \r | |
85 | /** Serialize an AML definition block.\r | |
86 | \r | |
87 | This functions allocates memory with the "AllocateZeroPool ()"\r | |
88 | function. This memory is used to serialize the AML tree and is\r | |
89 | returned in the Table.\r | |
90 | \r | |
91 | @ingroup UserApis\r | |
92 | \r | |
93 | @param [in] RootNode Root node of the tree.\r | |
94 | @param [out] Table On return, hold the serialized\r | |
95 | definition block.\r | |
96 | \r | |
97 | @retval EFI_SUCCESS The function completed successfully.\r | |
98 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
99 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
100 | **/\r | |
101 | EFI_STATUS\r | |
102 | EFIAPI\r | |
103 | AmlSerializeDefinitionBlock (\r | |
731c67e1 MK |
104 | IN AML_ROOT_NODE_HANDLE RootNode,\r |
105 | OUT EFI_ACPI_DESCRIPTION_HEADER **Table\r | |
c85ac524 PG |
106 | );\r |
107 | \r | |
108 | /** Clone a node and its children (clone a tree branch).\r | |
109 | \r | |
110 | The cloned branch returned is not attached to any tree.\r | |
111 | \r | |
112 | @ingroup UserApis\r | |
113 | \r | |
114 | @param [in] Node Pointer to a node.\r | |
115 | Node is the head of the branch to clone.\r | |
116 | @param [out] ClonedNode Pointer holding the head of the created cloned\r | |
117 | branch.\r | |
118 | \r | |
119 | @retval EFI_SUCCESS The function completed successfully.\r | |
120 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
121 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
122 | **/\r | |
123 | EFI_STATUS\r | |
124 | EFIAPI\r | |
125 | AmlCloneTree (\r | |
731c67e1 MK |
126 | IN AML_NODE_HANDLE Node,\r |
127 | OUT AML_NODE_HANDLE *ClonedNode\r | |
c85ac524 PG |
128 | );\r |
129 | \r | |
130 | /** Delete a Node and its children.\r | |
131 | \r | |
132 | The Node must be removed from the tree first,\r | |
133 | or must be the root node.\r | |
134 | \r | |
135 | @ingroup UserApis\r | |
136 | \r | |
137 | @param [in] Node Pointer to the node to delete.\r | |
138 | \r | |
139 | @retval EFI_SUCCESS The function completed successfully.\r | |
140 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
141 | **/\r | |
142 | EFI_STATUS\r | |
143 | EFIAPI\r | |
144 | AmlDeleteTree (\r | |
731c67e1 | 145 | IN AML_NODE_HANDLE Node\r |
c85ac524 PG |
146 | );\r |
147 | \r | |
148 | /** Detach the Node from the tree.\r | |
149 | \r | |
150 | The function will fail if the Node is in its parent's fixed\r | |
151 | argument list.\r | |
152 | The Node is not deleted. The deletion is done separately\r | |
153 | from the removal.\r | |
154 | \r | |
155 | @ingroup UserApis\r | |
156 | \r | |
157 | @param [in] Node Pointer to a Node.\r | |
158 | Must be a data node or an object node.\r | |
159 | \r | |
160 | @retval EFI_SUCCESS The function completed successfully.\r | |
161 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
162 | **/\r | |
163 | EFI_STATUS\r | |
164 | EFIAPI\r | |
165 | AmlDetachNode (\r | |
731c67e1 | 166 | IN AML_NODE_HANDLE Node\r |
c85ac524 PG |
167 | );\r |
168 | \r | |
169 | /** Find a node in the AML namespace, given an ASL path and a reference Node.\r | |
170 | \r | |
171 | - The AslPath can be an absolute path, or a relative path from the\r | |
172 | reference Node;\r | |
173 | - Node must be a root node or a namespace node;\r | |
174 | - A root node is expected to be at the top of the tree.\r | |
175 | \r | |
176 | E.g.:\r | |
177 | For the following AML namespace, with the ReferenceNode being the node with\r | |
178 | the name "AAAA":\r | |
179 | - the node with the name "BBBB" can be found by looking for the ASL\r | |
180 | path "BBBB";\r | |
181 | - the root node can be found by looking for the ASL relative path "^",\r | |
182 | or the absolute path "\\".\r | |
183 | \r | |
184 | AML namespace:\r | |
185 | \\r | |
186 | \-AAAA <- ReferenceNode\r | |
187 | \-BBBB\r | |
188 | \r | |
189 | @ingroup NameSpaceApis\r | |
190 | \r | |
191 | @param [in] ReferenceNode Reference node.\r | |
192 | If a relative path is given, the\r | |
193 | search is done from this node. If\r | |
194 | an absolute path is given, the\r | |
195 | search is done from the root node.\r | |
196 | Must be a root node or an object\r | |
197 | node which is part of the\r | |
198 | namespace.\r | |
199 | @param [in] AslPath ASL path to the searched node in\r | |
200 | the namespace. An ASL path name is\r | |
201 | NULL terminated. Can be a relative\r | |
202 | or absolute path.\r | |
203 | E.g.: "\\_SB.CLU0.CPU0" or "^CPU0"\r | |
204 | @param [out] OutNode Pointer to the found node.\r | |
205 | Contains NULL if not found.\r | |
206 | \r | |
207 | @retval EFI_SUCCESS The function completed successfully.\r | |
208 | @retval EFI_BUFFER_TOO_SMALL No space left in the buffer.\r | |
209 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
210 | @retval EFI_OUT_OF_RESOURCES Out of memory.\r | |
211 | **/\r | |
212 | EFI_STATUS\r | |
213 | EFIAPI\r | |
214 | AmlFindNode (\r | |
731c67e1 MK |
215 | IN AML_NODE_HANDLE ReferenceNode,\r |
216 | IN CHAR8 *AslPath,\r | |
217 | OUT AML_NODE_HANDLE *OutNode\r | |
c85ac524 PG |
218 | );\r |
219 | \r | |
220 | /**\r | |
221 | @defgroup UserApis User APIs\r | |
222 | @{\r | |
223 | User APIs are implemented to ease most common actions that might be done\r | |
224 | using the AmlLib. They allow to find specific objects like "_UID" or\r | |
225 | "_CRS" and to update their value. It also shows what can be done using\r | |
226 | AmlLib functions.\r | |
227 | @}\r | |
228 | */\r | |
229 | \r | |
230 | /** Update the name of a DeviceOp object node.\r | |
231 | \r | |
232 | @ingroup UserApis\r | |
233 | \r | |
234 | @param [in] DeviceOpNode Object node representing a Device.\r | |
235 | Must have an OpCode=AML_NAME_OP, SubOpCode=0.\r | |
236 | OpCode/SubOpCode.\r | |
237 | DeviceOp object nodes are defined in ASL\r | |
238 | using the "Device ()" function.\r | |
239 | @param [in] NewNameString The new Device's name.\r | |
240 | Must be a NULL-terminated ASL NameString\r | |
241 | e.g.: "DEV0", "DV15.DEV0", etc.\r | |
242 | The input string is copied.\r | |
243 | \r | |
244 | @retval EFI_SUCCESS The function completed successfully.\r | |
245 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
246 | **/\r | |
247 | EFI_STATUS\r | |
248 | EFIAPI\r | |
249 | AmlDeviceOpUpdateName (\r | |
731c67e1 MK |
250 | IN AML_OBJECT_NODE_HANDLE DeviceOpNode,\r |
251 | IN CHAR8 *NewNameString\r | |
c85ac524 PG |
252 | );\r |
253 | \r | |
254 | /** Update an integer value defined by a NameOp object node.\r | |
255 | \r | |
256 | For compatibility reasons, the NameOpNode must initially\r | |
257 | contain an integer.\r | |
258 | \r | |
259 | @ingroup UserApis\r | |
260 | \r | |
261 | @param [in] NameOpNode NameOp object node.\r | |
262 | Must have an OpCode=AML_NAME_OP, SubOpCode=0.\r | |
263 | NameOp object nodes are defined in ASL\r | |
264 | using the "Name ()" function.\r | |
265 | @param [in] NewInt New Integer value to assign.\r | |
266 | Must be a UINT64.\r | |
267 | \r | |
268 | @retval EFI_SUCCESS The function completed successfully.\r | |
269 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
270 | **/\r | |
271 | EFI_STATUS\r | |
272 | EFIAPI\r | |
273 | AmlNameOpUpdateInteger (\r | |
274 | IN AML_OBJECT_NODE_HANDLE NameOpNode,\r | |
275 | IN UINT64 NewInt\r | |
276 | );\r | |
277 | \r | |
278 | /** Update a string value defined by a NameOp object node.\r | |
279 | \r | |
280 | The NameOpNode must initially contain a string.\r | |
281 | The EISAID ASL macro converts a string to an integer. This, it is\r | |
282 | not accepted.\r | |
283 | \r | |
284 | @ingroup UserApis\r | |
285 | \r | |
286 | @param [in] NameOpNode NameOp object node.\r | |
287 | Must have an OpCode=AML_NAME_OP, SubOpCode=0.\r | |
288 | NameOp object nodes are defined in ASL\r | |
289 | using the "Name ()" function.\r | |
290 | @param [in] NewName New NULL terminated string to assign to\r | |
291 | the NameOpNode.\r | |
292 | The input string is copied.\r | |
293 | \r | |
294 | @retval EFI_SUCCESS The function completed successfully.\r | |
295 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
296 | **/\r | |
297 | EFI_STATUS\r | |
298 | EFIAPI\r | |
299 | AmlNameOpUpdateString (\r | |
731c67e1 MK |
300 | IN AML_OBJECT_NODE_HANDLE NameOpNode,\r |
301 | IN CONST CHAR8 *NewName\r | |
c85ac524 PG |
302 | );\r |
303 | \r | |
691c5f77 | 304 | /** Get the first Resource Data element contained in a named object.\r |
c85ac524 PG |
305 | \r |
306 | In the following ASL code, the function will return the Resource Data\r | |
307 | node corresponding to the "QWordMemory ()" ASL macro.\r | |
308 | Name (_CRS, ResourceTemplate() {\r | |
309 | QWordMemory (...) {...},\r | |
310 | Interrupt (...) {...}\r | |
311 | }\r | |
312 | )\r | |
313 | \r | |
314 | Note:\r | |
691c5f77 PG |
315 | "_CRS" names defined as methods are not handled by this function.\r |
316 | They must be defined as names, using the "Name ()" statement.\r | |
c85ac524 PG |
317 | \r |
318 | @ingroup UserApis\r | |
319 | \r | |
691c5f77 PG |
320 | @param [in] NameOpNode NameOp object node defining a named object.\r |
321 | Must have an OpCode=AML_NAME_OP, SubOpCode=0.\r | |
322 | NameOp object nodes are defined in ASL\r | |
323 | using the "Name ()" function.\r | |
324 | @param [out] OutRdNode Pointer to the first Resource Data element of\r | |
325 | the named object. A Resource Data element\r | |
326 | is stored in a data node.\r | |
c85ac524 PG |
327 | \r |
328 | @retval EFI_SUCCESS The function completed successfully.\r | |
329 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
330 | **/\r | |
331 | EFI_STATUS\r | |
332 | EFIAPI\r | |
691c5f77 | 333 | AmlNameOpGetFirstRdNode (\r |
731c67e1 MK |
334 | IN AML_OBJECT_NODE_HANDLE NameOpNode,\r |
335 | OUT AML_DATA_NODE_HANDLE *OutRdNode\r | |
c85ac524 PG |
336 | );\r |
337 | \r | |
338 | /** Get the Resource Data element following the CurrRdNode Resource Data.\r | |
339 | \r | |
340 | In the following ASL code, if CurrRdNode corresponds to the first\r | |
341 | "QWordMemory ()" ASL macro, the function will return the Resource Data\r | |
342 | node corresponding to the "Interrupt ()" ASL macro.\r | |
343 | Name (_CRS, ResourceTemplate() {\r | |
344 | QwordMemory (...) {...},\r | |
345 | Interrupt (...) {...}\r | |
346 | }\r | |
347 | )\r | |
348 | \r | |
691c5f77 PG |
349 | Note:\r |
350 | "_CRS" names defined as methods are not handled by this function.\r | |
351 | They must be defined as names, using the "Name ()" statement.\r | |
c85ac524 PG |
352 | \r |
353 | @ingroup UserApis\r | |
354 | \r | |
355 | @param [in] CurrRdNode Pointer to the current Resource Data element of\r | |
691c5f77 | 356 | the named object.\r |
c85ac524 PG |
357 | @param [out] OutRdNode Pointer to the Resource Data element following\r |
358 | the CurrRdNode.\r | |
359 | Contain a NULL pointer if CurrRdNode is the\r | |
360 | last Resource Data element in the list.\r | |
361 | The "End Tag" is not considered as a resource\r | |
362 | data element and is not returned.\r | |
363 | \r | |
364 | @retval EFI_SUCCESS The function completed successfully.\r | |
365 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
366 | **/\r | |
367 | EFI_STATUS\r | |
368 | EFIAPI\r | |
691c5f77 | 369 | AmlNameOpGetNextRdNode (\r |
731c67e1 MK |
370 | IN AML_DATA_NODE_HANDLE CurrRdNode,\r |
371 | OUT AML_DATA_NODE_HANDLE *OutRdNode\r | |
c85ac524 PG |
372 | );\r |
373 | \r | |
374 | /** Update the first interrupt of an Interrupt resource data node.\r | |
375 | \r | |
376 | The flags of the Interrupt resource data are left unchanged.\r | |
377 | \r | |
378 | The InterruptRdNode corresponds to the Resource Data created by the\r | |
379 | "Interrupt ()" ASL macro. It is an Extended Interrupt Resource Data.\r | |
380 | See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"\r | |
381 | for more information about Extended Interrupt Resource Data.\r | |
382 | \r | |
383 | @ingroup UserApis\r | |
384 | \r | |
385 | @param [in] InterruptRdNode Pointer to the an extended interrupt\r | |
386 | resource data node.\r | |
387 | @param [in] Irq Interrupt value to update.\r | |
388 | \r | |
389 | @retval EFI_SUCCESS The function completed successfully.\r | |
390 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
391 | @retval EFI_OUT_OF_RESOURCES Out of resources.\r | |
392 | **/\r | |
393 | EFI_STATUS\r | |
394 | EFIAPI\r | |
395 | AmlUpdateRdInterrupt (\r | |
731c67e1 MK |
396 | IN AML_DATA_NODE_HANDLE InterruptRdNode,\r |
397 | IN UINT32 Irq\r | |
c85ac524 PG |
398 | );\r |
399 | \r | |
400 | /** Update the base address and length of a QWord resource data node.\r | |
401 | \r | |
402 | @ingroup UserApis\r | |
403 | \r | |
404 | @param [in] QWordRdNode Pointer a QWord resource data\r | |
405 | node.\r | |
406 | @param [in] BaseAddress Base address.\r | |
407 | @param [in] BaseAddressLength Base address length.\r | |
408 | \r | |
409 | @retval EFI_SUCCESS The function completed successfully.\r | |
410 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
411 | @retval EFI_OUT_OF_RESOURCES Out of resources.\r | |
412 | **/\r | |
413 | EFI_STATUS\r | |
414 | EFIAPI\r | |
415 | AmlUpdateRdQWord (\r | |
416 | IN AML_DATA_NODE_HANDLE QWordRdNode,\r | |
417 | IN UINT64 BaseAddress,\r | |
418 | IN UINT64 BaseAddressLength\r | |
419 | );\r | |
420 | \r | |
7f1861be PG |
421 | /** Code generation for the "DWordIO ()" ASL function.\r |
422 | \r | |
423 | The Resource Data effectively created is a DWord Address Space Resource\r | |
424 | Data. Cf ACPI 6.4:\r | |
425 | - s6.4.3.5.2 "DWord Address Space Descriptor".\r | |
426 | - s19.6.34 "DWordIO".\r | |
427 | \r | |
428 | The created resource data node can be:\r | |
429 | - appended to the list of resource data elements of the NameOpNode.\r | |
430 | In such case NameOpNode must be defined by a the "Name ()" ASL statement\r | |
431 | and initially contain a "ResourceTemplate ()".\r | |
432 | - returned through the NewRdNode parameter.\r | |
433 | \r | |
434 | See ACPI 6.4 spec, s19.6.34 for more.\r | |
435 | \r | |
436 | @param [in] IsResourceConsumer ResourceUsage parameter.\r | |
437 | @param [in] IsMinFixed Minimum address is fixed.\r | |
438 | @param [in] IsMaxFixed Maximum address is fixed.\r | |
439 | @param [in] IsPosDecode Decode parameter\r | |
440 | @param [in] IsaRanges Possible values are:\r | |
441 | 0-Reserved\r | |
442 | 1-NonISAOnly\r | |
443 | 2-ISAOnly\r | |
444 | 3-EntireRange\r | |
445 | @param [in] AddressGranularity Address granularity.\r | |
446 | @param [in] AddressMinimum Minimum address.\r | |
447 | @param [in] AddressMaximum Maximum address.\r | |
448 | @param [in] AddressTranslation Address translation.\r | |
449 | @param [in] RangeLength Range length.\r | |
450 | @param [in] ResourceSourceIndex Resource Source index.\r | |
451 | Not supported. Must be 0.\r | |
452 | @param [in] ResourceSource Resource Source.\r | |
453 | Not supported. Must be NULL.\r | |
454 | @param [in] IsDenseTranslation TranslationDensity parameter.\r | |
455 | @param [in] IsTypeStatic TranslationType parameter.\r | |
456 | @param [in] NameOpNode NameOp object node defining a named object.\r | |
457 | If provided, append the new resource data\r | |
458 | node to the list of resource data elements\r | |
459 | of this node.\r | |
460 | @param [out] NewRdNode If provided and success,\r | |
461 | contain the created node.\r | |
462 | \r | |
463 | @retval EFI_SUCCESS The function completed successfully.\r | |
464 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
465 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
466 | **/\r | |
467 | EFI_STATUS\r | |
468 | EFIAPI\r | |
469 | AmlCodeGenRdDWordIo (\r | |
470 | IN BOOLEAN IsResourceConsumer,\r | |
471 | IN BOOLEAN IsMinFixed,\r | |
472 | IN BOOLEAN IsMaxFixed,\r | |
473 | IN BOOLEAN IsPosDecode,\r | |
474 | IN UINT8 IsaRanges,\r | |
475 | IN UINT32 AddressGranularity,\r | |
476 | IN UINT32 AddressMinimum,\r | |
477 | IN UINT32 AddressMaximum,\r | |
478 | IN UINT32 AddressTranslation,\r | |
479 | IN UINT32 RangeLength,\r | |
480 | IN UINT8 ResourceSourceIndex,\r | |
481 | IN CONST CHAR8 *ResourceSource,\r | |
482 | IN BOOLEAN IsDenseTranslation,\r | |
483 | IN BOOLEAN IsTypeStatic,\r | |
484 | IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL\r | |
485 | OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL\r | |
486 | );\r | |
487 | \r | |
488 | /** Code generation for the "DWordMemory ()" ASL function.\r | |
489 | \r | |
490 | The Resource Data effectively created is a DWord Address Space Resource\r | |
491 | Data. Cf ACPI 6.4:\r | |
492 | - s6.4.3.5.2 "DWord Address Space Descriptor".\r | |
493 | - s19.6.35 "DWordMemory".\r | |
494 | \r | |
495 | The created resource data node can be:\r | |
496 | - appended to the list of resource data elements of the NameOpNode.\r | |
497 | In such case NameOpNode must be defined by a the "Name ()" ASL statement\r | |
498 | and initially contain a "ResourceTemplate ()".\r | |
499 | - returned through the NewRdNode parameter.\r | |
500 | \r | |
501 | See ACPI 6.4 spec, s19.6.35 for more.\r | |
502 | \r | |
503 | @param [in] IsResourceConsumer ResourceUsage parameter.\r | |
504 | @param [in] IsPosDecode Decode parameter\r | |
505 | @param [in] IsMinFixed Minimum address is fixed.\r | |
506 | @param [in] IsMaxFixed Maximum address is fixed.\r | |
507 | @param [in] Cacheable Possible values are:\r | |
508 | 0-The memory is non-cacheable\r | |
509 | 1-The memory is cacheable\r | |
510 | 2-The memory is cacheable and supports\r | |
511 | write combining\r | |
512 | 3-The memory is cacheable and prefetchable\r | |
513 | @param [in] IsReadWrite ReadAndWrite parameter.\r | |
514 | @param [in] AddressGranularity Address granularity.\r | |
515 | @param [in] AddressMinimum Minimum address.\r | |
516 | @param [in] AddressMaximum Maximum address.\r | |
517 | @param [in] AddressTranslation Address translation.\r | |
518 | @param [in] RangeLength Range length.\r | |
519 | @param [in] ResourceSourceIndex Resource Source index.\r | |
520 | Not supported. Must be 0.\r | |
521 | @param [in] ResourceSource Resource Source.\r | |
522 | Not supported. Must be NULL.\r | |
523 | @param [in] MemoryRangeType Possible values are:\r | |
524 | 0-AddressRangeMemory\r | |
525 | 1-AddressRangeReserved\r | |
526 | 2-AddressRangeACPI\r | |
527 | 3-AddressRangeNVS\r | |
528 | @param [in] IsTypeStatic TranslationType parameter.\r | |
529 | @param [in] NameOpNode NameOp object node defining a named object.\r | |
530 | If provided, append the new resource data\r | |
531 | node to the list of resource data elements\r | |
532 | of this node.\r | |
533 | @param [out] NewRdNode If provided and success,\r | |
534 | contain the created node.\r | |
535 | \r | |
536 | @retval EFI_SUCCESS The function completed successfully.\r | |
537 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
538 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
539 | **/\r | |
540 | EFI_STATUS\r | |
541 | EFIAPI\r | |
542 | AmlCodeGenRdDWordMemory (\r | |
543 | IN BOOLEAN IsResourceConsumer,\r | |
544 | IN BOOLEAN IsPosDecode,\r | |
545 | IN BOOLEAN IsMinFixed,\r | |
546 | IN BOOLEAN IsMaxFixed,\r | |
547 | IN UINT8 Cacheable,\r | |
548 | IN BOOLEAN IsReadWrite,\r | |
549 | IN UINT32 AddressGranularity,\r | |
550 | IN UINT32 AddressMinimum,\r | |
551 | IN UINT32 AddressMaximum,\r | |
552 | IN UINT32 AddressTranslation,\r | |
553 | IN UINT32 RangeLength,\r | |
554 | IN UINT8 ResourceSourceIndex,\r | |
555 | IN CONST CHAR8 *ResourceSource,\r | |
556 | IN UINT8 MemoryRangeType,\r | |
557 | IN BOOLEAN IsTypeStatic,\r | |
558 | IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL\r | |
559 | OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL\r | |
560 | );\r | |
561 | \r | |
562 | /** Code generation for the "WordBusNumber ()" ASL function.\r | |
563 | \r | |
564 | The Resource Data effectively created is a Word Address Space Resource\r | |
565 | Data. Cf ACPI 6.4:\r | |
566 | - s6.4.3.5.3 "Word Address Space Descriptor".\r | |
567 | - s19.6.149 "WordBusNumber".\r | |
568 | \r | |
569 | The created resource data node can be:\r | |
570 | - appended to the list of resource data elements of the NameOpNode.\r | |
571 | In such case NameOpNode must be defined by a the "Name ()" ASL statement\r | |
572 | and initially contain a "ResourceTemplate ()".\r | |
573 | - returned through the NewRdNode parameter.\r | |
574 | \r | |
575 | See ACPI 6.4 spec, s19.6.149 for more.\r | |
576 | \r | |
577 | @param [in] IsResourceConsumer ResourceUsage parameter.\r | |
578 | @param [in] IsMinFixed Minimum address is fixed.\r | |
579 | @param [in] IsMaxFixed Maximum address is fixed.\r | |
580 | @param [in] IsPosDecode Decode parameter\r | |
581 | @param [in] AddressGranularity Address granularity.\r | |
582 | @param [in] AddressMinimum Minimum address.\r | |
583 | @param [in] AddressMaximum Maximum address.\r | |
584 | @param [in] AddressTranslation Address translation.\r | |
585 | @param [in] RangeLength Range length.\r | |
586 | @param [in] ResourceSourceIndex Resource Source index.\r | |
587 | Not supported. Must be 0.\r | |
588 | @param [in] ResourceSource Resource Source.\r | |
589 | Not supported. Must be NULL.\r | |
590 | @param [in] NameOpNode NameOp object node defining a named object.\r | |
591 | If provided, append the new resource data\r | |
592 | node to the list of resource data elements\r | |
593 | of this node.\r | |
594 | @param [out] NewRdNode If provided and success,\r | |
595 | contain the created node.\r | |
596 | \r | |
597 | @retval EFI_SUCCESS The function completed successfully.\r | |
598 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
599 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
600 | **/\r | |
601 | EFI_STATUS\r | |
602 | EFIAPI\r | |
603 | AmlCodeGenRdWordBusNumber (\r | |
604 | IN BOOLEAN IsResourceConsumer,\r | |
605 | IN BOOLEAN IsMinFixed,\r | |
606 | IN BOOLEAN IsMaxFixed,\r | |
607 | IN BOOLEAN IsPosDecode,\r | |
608 | IN UINT32 AddressGranularity,\r | |
609 | IN UINT32 AddressMinimum,\r | |
610 | IN UINT32 AddressMaximum,\r | |
611 | IN UINT32 AddressTranslation,\r | |
612 | IN UINT32 RangeLength,\r | |
613 | IN UINT8 ResourceSourceIndex,\r | |
614 | IN CONST CHAR8 *ResourceSource,\r | |
615 | IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL\r | |
616 | OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL\r | |
617 | );\r | |
618 | \r | |
619 | /** Code generation for the "QWordMemory ()" ASL function.\r | |
620 | \r | |
621 | The Resource Data effectively created is a QWord Address Space Resource\r | |
622 | Data. Cf ACPI 6.4:\r | |
623 | - s6.4.3.5.1 "QWord Address Space Descriptor".\r | |
624 | - s19.6.110 "QWordMemory".\r | |
625 | \r | |
626 | The created resource data node can be:\r | |
627 | - appended to the list of resource data elements of the NameOpNode.\r | |
628 | In such case NameOpNode must be defined by a the "Name ()" ASL statement\r | |
629 | and initially contain a "ResourceTemplate ()".\r | |
630 | - returned through the NewRdNode parameter.\r | |
631 | \r | |
632 | See ACPI 6.4 spec, s19.6.110 for more.\r | |
633 | \r | |
634 | @param [in] IsResourceConsumer ResourceUsage parameter.\r | |
635 | @param [in] IsPosDecode Decode parameter.\r | |
636 | @param [in] IsMinFixed Minimum address is fixed.\r | |
637 | @param [in] IsMaxFixed Maximum address is fixed.\r | |
638 | @param [in] Cacheable Possible values are:\r | |
639 | 0-The memory is non-cacheable\r | |
640 | 1-The memory is cacheable\r | |
641 | 2-The memory is cacheable and supports\r | |
642 | write combining\r | |
643 | 3-The memory is cacheable and prefetchable\r | |
644 | @param [in] IsReadWrite ReadAndWrite parameter.\r | |
645 | @param [in] AddressGranularity Address granularity.\r | |
646 | @param [in] AddressMinimum Minimum address.\r | |
647 | @param [in] AddressMaximum Maximum address.\r | |
648 | @param [in] AddressTranslation Address translation.\r | |
649 | @param [in] RangeLength Range length.\r | |
650 | @param [in] ResourceSourceIndex Resource Source index.\r | |
651 | Not supported. Must be 0.\r | |
652 | @param [in] ResourceSource Resource Source.\r | |
653 | Not supported. Must be NULL.\r | |
654 | @param [in] MemoryRangeType Possible values are:\r | |
655 | 0-AddressRangeMemory\r | |
656 | 1-AddressRangeReserved\r | |
657 | 2-AddressRangeACPI\r | |
658 | 3-AddressRangeNVS\r | |
659 | @param [in] IsTypeStatic TranslationType parameter.\r | |
660 | @param [in] NameOpNode NameOp object node defining a named object.\r | |
661 | If provided, append the new resource data\r | |
662 | node to the list of resource data elements\r | |
663 | of this node.\r | |
664 | @param [out] NewRdNode If provided and success,\r | |
665 | contain the created node.\r | |
666 | \r | |
667 | @retval EFI_SUCCESS The function completed successfully.\r | |
668 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
669 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
670 | **/\r | |
671 | EFI_STATUS\r | |
672 | EFIAPI\r | |
673 | AmlCodeGenRdQWordMemory (\r | |
674 | IN BOOLEAN IsResourceConsumer,\r | |
675 | IN BOOLEAN IsPosDecode,\r | |
676 | IN BOOLEAN IsMinFixed,\r | |
677 | IN BOOLEAN IsMaxFixed,\r | |
678 | IN UINT8 Cacheable,\r | |
679 | IN BOOLEAN IsReadWrite,\r | |
680 | IN UINT64 AddressGranularity,\r | |
681 | IN UINT64 AddressMinimum,\r | |
682 | IN UINT64 AddressMaximum,\r | |
683 | IN UINT64 AddressTranslation,\r | |
684 | IN UINT64 RangeLength,\r | |
685 | IN UINT8 ResourceSourceIndex,\r | |
686 | IN CONST CHAR8 *ResourceSource,\r | |
687 | IN UINT8 MemoryRangeType,\r | |
688 | IN BOOLEAN IsTypeStatic,\r | |
689 | IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL\r | |
690 | OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL\r | |
691 | );\r | |
692 | \r | |
22873f58 | 693 | /** Code generation for the "Interrupt ()" ASL function.\r |
c85ac524 PG |
694 | \r |
695 | The Resource Data effectively created is an Extended Interrupt Resource\r | |
22873f58 PG |
696 | Data. Cf ACPI 6.4:\r |
697 | - s6.4.3.6 "Extended Interrupt Descriptor"\r | |
698 | - s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"\r | |
c85ac524 | 699 | \r |
22873f58 PG |
700 | The created resource data node can be:\r |
701 | - appended to the list of resource data elements of the NameOpNode.\r | |
702 | In such case NameOpNode must be defined by a the "Name ()" ASL statement\r | |
703 | and initially contain a "ResourceTemplate ()".\r | |
704 | - returned through the NewRdNode parameter.\r | |
c85ac524 | 705 | \r |
691c5f77 | 706 | @ingroup CodeGenApis\r |
c85ac524 | 707 | \r |
c85ac524 PG |
708 | @param [in] ResourceConsumer The device consumes the specified interrupt\r |
709 | or produces it for use by a child device.\r | |
710 | @param [in] EdgeTriggered The interrupt is edge triggered or\r | |
711 | level triggered.\r | |
712 | @param [in] ActiveLow The interrupt is active-high or active-low.\r | |
713 | @param [in] Shared The interrupt can be shared with other\r | |
714 | devices or not (Exclusive).\r | |
715 | @param [in] IrqList Interrupt list. Must be non-NULL.\r | |
716 | @param [in] IrqCount Interrupt count. Must be non-zero.\r | |
22873f58 PG |
717 | @param [in] NameOpNode NameOp object node defining a named object.\r |
718 | If provided, append the new resource data node\r | |
719 | to the list of resource data elements of this\r | |
720 | node.\r | |
721 | @param [out] NewRdNode If provided and success,\r | |
722 | contain the created node.\r | |
c85ac524 PG |
723 | \r |
724 | @retval EFI_SUCCESS The function completed successfully.\r | |
725 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
726 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
727 | **/\r | |
728 | EFI_STATUS\r | |
729 | EFIAPI\r | |
22873f58 | 730 | AmlCodeGenRdInterrupt (\r |
c85ac524 PG |
731 | IN BOOLEAN ResourceConsumer,\r |
732 | IN BOOLEAN EdgeTriggered,\r | |
733 | IN BOOLEAN ActiveLow,\r | |
734 | IN BOOLEAN Shared,\r | |
22873f58 PG |
735 | IN UINT32 *IrqList,\r |
736 | IN UINT8 IrqCount,\r | |
fe2d8189 | 737 | IN AML_OBJECT_NODE_HANDLE NameOpNode OPTIONAL,\r |
22873f58 | 738 | OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL\r |
c85ac524 PG |
739 | );\r |
740 | \r | |
741 | /** AML code generation for DefinitionBlock.\r | |
742 | \r | |
743 | Create a Root Node handle.\r | |
744 | It is the caller's responsibility to free the allocated memory\r | |
745 | with the AmlDeleteTree function.\r | |
746 | \r | |
747 | AmlCodeGenDefinitionBlock (TableSignature, OemId, TableID, OEMRevision) is\r | |
748 | equivalent to the following ASL code:\r | |
749 | DefinitionBlock (AMLFileName, TableSignature, ComplianceRevision,\r | |
750 | OemId, TableID, OEMRevision) {}\r | |
751 | with the ComplianceRevision set to 2 and the AMLFileName is ignored.\r | |
752 | \r | |
753 | @ingroup CodeGenApis\r | |
754 | \r | |
755 | @param[in] TableSignature 4-character ACPI signature.\r | |
756 | Must be 'DSDT' or 'SSDT'.\r | |
757 | @param[in] OemId 6-character string OEM identifier.\r | |
758 | @param[in] OemTableId 8-character string OEM table identifier.\r | |
759 | @param[in] OemRevision OEM revision number.\r | |
760 | @param[out] DefinitionBlockTerm The ASL Term handle representing a\r | |
761 | Definition Block.\r | |
762 | \r | |
763 | @retval EFI_SUCCESS Success.\r | |
764 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
765 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
766 | **/\r | |
767 | EFI_STATUS\r | |
768 | EFIAPI\r | |
769 | AmlCodeGenDefinitionBlock (\r | |
731c67e1 MK |
770 | IN CONST CHAR8 *TableSignature,\r |
771 | IN CONST CHAR8 *OemId,\r | |
772 | IN CONST CHAR8 *OemTableId,\r | |
773 | IN UINT32 OemRevision,\r | |
774 | OUT AML_ROOT_NODE_HANDLE *NewRootNode\r | |
c85ac524 PG |
775 | );\r |
776 | \r | |
777 | /** AML code generation for a Name object node, containing a String.\r | |
778 | \r | |
779 | AmlCodeGenNameString ("_HID", "HID0000", ParentNode, NewObjectNode) is\r | |
780 | equivalent of the following ASL code:\r | |
781 | Name(_HID, "HID0000")\r | |
782 | \r | |
783 | @ingroup CodeGenApis\r | |
784 | \r | |
785 | @param [in] NameString The new variable name.\r | |
786 | Must be a NULL-terminated ASL NameString\r | |
787 | e.g.: "DEV0", "DV15.DEV0", etc.\r | |
788 | The input string is copied.\r | |
789 | @param [in] String NULL terminated String to associate to the\r | |
790 | NameString.\r | |
791 | @param [in] ParentNode If provided, set ParentNode as the parent\r | |
792 | of the node created.\r | |
793 | @param [out] NewObjectNode If success, contains the created node.\r | |
794 | \r | |
795 | @retval EFI_SUCCESS Success.\r | |
796 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
797 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
798 | **/\r | |
799 | EFI_STATUS\r | |
800 | EFIAPI\r | |
801 | AmlCodeGenNameString (\r | |
731c67e1 MK |
802 | IN CONST CHAR8 *NameString,\r |
803 | IN CHAR8 *String,\r | |
804 | IN AML_NODE_HANDLE ParentNode OPTIONAL,\r | |
805 | OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL\r | |
c85ac524 PG |
806 | );\r |
807 | \r | |
808 | /** AML code generation for a Name object node, containing an Integer.\r | |
809 | \r | |
810 | AmlCodeGenNameInteger ("_UID", 1, ParentNode, NewObjectNode) is\r | |
811 | equivalent of the following ASL code:\r | |
812 | Name(_UID, One)\r | |
813 | \r | |
814 | @ingroup CodeGenApis\r | |
815 | \r | |
816 | @param [in] NameString The new variable name.\r | |
817 | Must be a NULL-terminated ASL NameString\r | |
818 | e.g.: "DEV0", "DV15.DEV0", etc.\r | |
819 | The input string is copied.\r | |
820 | @param [in] Integer Integer to associate to the NameString.\r | |
821 | @param [in] ParentNode If provided, set ParentNode as the parent\r | |
822 | of the node created.\r | |
823 | @param [out] NewObjectNode If success, contains the created node.\r | |
824 | \r | |
825 | @retval EFI_SUCCESS Success.\r | |
826 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
827 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
828 | **/\r | |
829 | EFI_STATUS\r | |
830 | EFIAPI\r | |
831 | AmlCodeGenNameInteger (\r | |
731c67e1 MK |
832 | IN CONST CHAR8 *NameString,\r |
833 | IN UINT64 Integer,\r | |
834 | IN AML_NODE_HANDLE ParentNode OPTIONAL,\r | |
835 | OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL\r | |
c85ac524 PG |
836 | );\r |
837 | \r | |
838 | /** AML code generation for a Device object node.\r | |
839 | \r | |
840 | AmlCodeGenDevice ("COM0", ParentNode, NewObjectNode) is\r | |
841 | equivalent of the following ASL code:\r | |
842 | Device(COM0) {}\r | |
843 | \r | |
844 | @ingroup CodeGenApis\r | |
845 | \r | |
846 | @param [in] NameString The new Device's name.\r | |
847 | Must be a NULL-terminated ASL NameString\r | |
848 | e.g.: "DEV0", "DV15.DEV0", etc.\r | |
849 | The input string is copied.\r | |
850 | @param [in] ParentNode If provided, set ParentNode as the parent\r | |
851 | of the node created.\r | |
852 | @param [out] NewObjectNode If success, contains the created node.\r | |
853 | \r | |
854 | @retval EFI_SUCCESS Success.\r | |
855 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
856 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
857 | **/\r | |
858 | EFI_STATUS\r | |
859 | EFIAPI\r | |
860 | AmlCodeGenDevice (\r | |
731c67e1 MK |
861 | IN CONST CHAR8 *NameString,\r |
862 | IN AML_NODE_HANDLE ParentNode OPTIONAL,\r | |
863 | OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL\r | |
c85ac524 PG |
864 | );\r |
865 | \r | |
866 | /** AML code generation for a Scope object node.\r | |
867 | \r | |
868 | AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is\r | |
869 | equivalent of the following ASL code:\r | |
870 | Scope(_SB) {}\r | |
871 | \r | |
872 | @ingroup CodeGenApis\r | |
873 | \r | |
874 | @param [in] NameString The new Scope's name.\r | |
875 | Must be a NULL-terminated ASL NameString\r | |
876 | e.g.: "DEV0", "DV15.DEV0", etc.\r | |
877 | The input string is copied.\r | |
878 | @param [in] ParentNode If provided, set ParentNode as the parent\r | |
879 | of the node created.\r | |
880 | @param [out] NewObjectNode If success, contains the created node.\r | |
881 | \r | |
882 | @retval EFI_SUCCESS Success.\r | |
883 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
884 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
885 | **/\r | |
886 | EFI_STATUS\r | |
887 | EFIAPI\r | |
888 | AmlCodeGenScope (\r | |
731c67e1 MK |
889 | IN CONST CHAR8 *NameString,\r |
890 | IN AML_NODE_HANDLE ParentNode OPTIONAL,\r | |
891 | OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL\r | |
c85ac524 PG |
892 | );\r |
893 | \r | |
3e958e93 PG |
894 | /** AML code generation for a method returning a NameString.\r |
895 | \r | |
896 | AmlCodeGenMethodRetNameString (\r | |
897 | "MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode\r | |
898 | );\r | |
899 | is equivalent of the following ASL code:\r | |
900 | Method(MET0, 1, Serialized, 3) {\r | |
901 | Return (_CRS)\r | |
902 | }\r | |
903 | \r | |
904 | The ASL parameters "ReturnType" and "ParameterTypes" are not asked\r | |
905 | in this function. They are optional parameters in ASL.\r | |
906 | \r | |
907 | @ingroup CodeGenApis\r | |
908 | \r | |
909 | @param [in] MethodNameString The new Method's name.\r | |
910 | Must be a NULL-terminated ASL NameString\r | |
911 | e.g.: "MET0", "_SB.MET0", etc.\r | |
912 | The input string is copied.\r | |
913 | @param [in] ReturnedNameString The name of the object returned by the\r | |
914 | method. Optional parameter, can be:\r | |
915 | - NULL (ignored).\r | |
916 | - A NULL-terminated ASL NameString.\r | |
917 | e.g.: "MET0", "_SB.MET0", etc.\r | |
918 | The input string is copied.\r | |
919 | @param [in] NumArgs Number of arguments.\r | |
920 | Must be 0 <= NumArgs <= 6.\r | |
921 | @param [in] IsSerialized TRUE is equivalent to Serialized.\r | |
922 | FALSE is equivalent to NotSerialized.\r | |
923 | Default is NotSerialized in ASL spec.\r | |
924 | @param [in] SyncLevel Synchronization level for the method.\r | |
925 | Must be 0 <= SyncLevel <= 15.\r | |
926 | Default is 0 in ASL.\r | |
927 | @param [in] ParentNode If provided, set ParentNode as the parent\r | |
928 | of the node created.\r | |
929 | @param [out] NewObjectNode If success, contains the created node.\r | |
930 | \r | |
931 | @retval EFI_SUCCESS Success.\r | |
932 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
933 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
934 | **/\r | |
935 | EFI_STATUS\r | |
936 | EFIAPI\r | |
937 | AmlCodeGenMethodRetNameString (\r | |
731c67e1 MK |
938 | IN CONST CHAR8 *MethodNameString,\r |
939 | IN CONST CHAR8 *ReturnedNameString OPTIONAL,\r | |
940 | IN UINT8 NumArgs,\r | |
941 | IN BOOLEAN IsSerialized,\r | |
942 | IN UINT8 SyncLevel,\r | |
943 | IN AML_NODE_HANDLE ParentNode OPTIONAL,\r | |
944 | OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL\r | |
3e958e93 PG |
945 | );\r |
946 | \r | |
018a962d PG |
947 | /** Create a _LPI name.\r |
948 | \r | |
949 | AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is\r | |
950 | equivalent of the following ASL code:\r | |
951 | Name (_LPI, Package (\r | |
952 | 0, // Revision\r | |
953 | 1, // LevelId\r | |
954 | 0 // Count\r | |
955 | ))\r | |
956 | \r | |
957 | This function doesn't define any LPI state. As shown above, the count\r | |
958 | of _LPI state is set to 0.\r | |
959 | The AmlAddLpiState () function must be used to add LPI states.\r | |
960 | \r | |
961 | Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States".\r | |
962 | \r | |
963 | @ingroup CodeGenApis\r | |
964 | \r | |
965 | @param [in] LpiNameString The new LPI 's object name.\r | |
966 | Must be a NULL-terminated ASL NameString\r | |
967 | e.g.: "_LPI", "DEV0.PLPI", etc.\r | |
968 | The input string is copied.\r | |
969 | @param [in] Revision Revision number of the _LPI states.\r | |
970 | @param [in] LevelId A platform defined number that identifies the\r | |
971 | level of hierarchy of the processor node to\r | |
972 | which the LPI states apply.\r | |
973 | @param [in] ParentNode If provided, set ParentNode as the parent\r | |
974 | of the node created.\r | |
975 | @param [out] NewLpiNode If success, contains the created node.\r | |
976 | \r | |
977 | @retval EFI_SUCCESS The function completed successfully.\r | |
978 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
979 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
980 | **/\r | |
981 | EFI_STATUS\r | |
982 | EFIAPI\r | |
983 | AmlCreateLpiNode (\r | |
731c67e1 MK |
984 | IN CONST CHAR8 *LpiNameString,\r |
985 | IN UINT16 Revision,\r | |
986 | IN UINT64 LevelId,\r | |
987 | IN AML_NODE_HANDLE ParentNode OPTIONAL,\r | |
988 | OUT AML_OBJECT_NODE_HANDLE *NewLpiNode OPTIONAL\r | |
018a962d PG |
989 | );\r |
990 | \r | |
a5e36ad9 PG |
991 | /** Add an _LPI state to a LPI node created using AmlCreateLpiNode ().\r |
992 | \r | |
993 | AmlAddLpiState () increments the Count of LPI states in the LPI node by one,\r | |
994 | and adds the following package:\r | |
995 | Package() {\r | |
996 | MinResidency,\r | |
997 | WorstCaseWakeLatency,\r | |
998 | Flags,\r | |
999 | ArchFlags,\r | |
1000 | ResCntFreq,\r | |
1001 | EnableParentState,\r | |
1002 | (GenericRegisterDescriptor != NULL) ? // Entry method. If a\r | |
1003 | ResourceTemplate(GenericRegisterDescriptor) : // Register is given,\r | |
1004 | Integer, // use it. Use the\r | |
1005 | // Integer otherwise.\r | |
1006 | ResourceTemplate() { // NULL Residency Counter\r | |
1007 | Register (SystemMemory, 0, 0, 0, 0)\r | |
1008 | },\r | |
1009 | ResourceTemplate() { // NULL Usage Counter\r | |
1010 | Register (SystemMemory, 0, 0, 0, 0)\r | |
1011 | },\r | |
1012 | "" // NULL State Name\r | |
1013 | },\r | |
1014 | \r | |
1015 | Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States".\r | |
1016 | \r | |
1017 | @ingroup CodeGenApis\r | |
1018 | \r | |
1019 | @param [in] MinResidency Minimum Residency.\r | |
1020 | @param [in] WorstCaseWakeLatency Worst case wake-up latency.\r | |
1021 | @param [in] Flags Flags.\r | |
1022 | @param [in] ArchFlags Architectural flags.\r | |
1023 | @param [in] ResCntFreq Residency Counter Frequency.\r | |
1024 | @param [in] EnableParentState Enabled Parent State.\r | |
1025 | @param [in] GenericRegisterDescriptor Entry Method.\r | |
1026 | If not NULL, use this Register to\r | |
1027 | describe the entry method address.\r | |
1028 | @param [in] Integer Entry Method.\r | |
1029 | If GenericRegisterDescriptor is NULL,\r | |
1030 | take this value.\r | |
1031 | @param [in] ResidencyCounterRegister If not NULL, use it to populate the\r | |
1032 | residency counter register.\r | |
1033 | @param [in] UsageCounterRegister If not NULL, use it to populate the\r | |
1034 | usage counter register.\r | |
1035 | @param [in] StateName If not NULL, use it to populate the\r | |
1036 | state name.\r | |
1037 | @param [in] LpiNode Lpi node created with the function\r | |
1038 | AmlCreateLpiNode to which the new LPI\r | |
1039 | state is appended.\r | |
1040 | \r | |
1041 | @retval EFI_SUCCESS The function completed successfully.\r | |
1042 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
1043 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
1044 | **/\r | |
1045 | EFI_STATUS\r | |
1046 | EFIAPI\r | |
1047 | AmlAddLpiState (\r | |
731c67e1 MK |
1048 | IN UINT32 MinResidency,\r |
1049 | IN UINT32 WorstCaseWakeLatency,\r | |
1050 | IN UINT32 Flags,\r | |
1051 | IN UINT32 ArchFlags,\r | |
1052 | IN UINT32 ResCntFreq,\r | |
1053 | IN UINT32 EnableParentState,\r | |
1054 | IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GenericRegisterDescriptor OPTIONAL,\r | |
1055 | IN UINT64 Integer OPTIONAL,\r | |
1056 | IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ResidencyCounterRegister OPTIONAL,\r | |
1057 | IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *UsageCounterRegister OPTIONAL,\r | |
1058 | IN CHAR8 *StateName OPTIONAL,\r | |
1059 | IN AML_OBJECT_NODE_HANDLE LpiNode\r | |
a5e36ad9 PG |
1060 | );\r |
1061 | \r | |
691c5f77 PG |
1062 | // DEPRECATED APIS\r |
1063 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r | |
1064 | \r | |
1065 | /** DEPRECATED API\r | |
1066 | \r | |
1067 | Get the first Resource Data element contained in a "_CRS" object.\r | |
1068 | \r | |
1069 | In the following ASL code, the function will return the Resource Data\r | |
1070 | node corresponding to the "QWordMemory ()" ASL macro.\r | |
1071 | Name (_CRS, ResourceTemplate() {\r | |
1072 | QWordMemory (...) {...},\r | |
1073 | Interrupt (...) {...}\r | |
1074 | }\r | |
1075 | )\r | |
1076 | \r | |
1077 | Note:\r | |
1078 | - The "_CRS" object must be declared using ASL "Name (Declare Named Object)".\r | |
1079 | - "_CRS" declared using ASL "Method (Declare Control Method)" is not\r | |
1080 | supported.\r | |
1081 | \r | |
1082 | @ingroup UserApis\r | |
1083 | \r | |
1084 | @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.\r | |
1085 | Must have an OpCode=AML_NAME_OP, SubOpCode=0.\r | |
1086 | NameOp object nodes are defined in ASL\r | |
1087 | using the "Name ()" function.\r | |
1088 | @param [out] OutRdNode Pointer to the first Resource Data element of\r | |
1089 | the "_CRS" object. A Resource Data element\r | |
1090 | is stored in a data node.\r | |
1091 | \r | |
1092 | @retval EFI_SUCCESS The function completed successfully.\r | |
1093 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
1094 | **/\r | |
1095 | EFI_STATUS\r | |
1096 | EFIAPI\r | |
1097 | AmlNameOpCrsGetFirstRdNode (\r | |
731c67e1 MK |
1098 | IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,\r |
1099 | OUT AML_DATA_NODE_HANDLE *OutRdNode\r | |
691c5f77 PG |
1100 | );\r |
1101 | \r | |
1102 | /** DEPRECATED API\r | |
1103 | \r | |
1104 | Get the Resource Data element following the CurrRdNode Resource Data.\r | |
1105 | \r | |
1106 | In the following ASL code, if CurrRdNode corresponds to the first\r | |
1107 | "QWordMemory ()" ASL macro, the function will return the Resource Data\r | |
1108 | node corresponding to the "Interrupt ()" ASL macro.\r | |
1109 | Name (_CRS, ResourceTemplate() {\r | |
1110 | QwordMemory (...) {...},\r | |
1111 | Interrupt (...) {...}\r | |
1112 | }\r | |
1113 | )\r | |
1114 | \r | |
1115 | The CurrRdNode Resource Data node must be defined in an object named "_CRS"\r | |
1116 | and defined by a "Name ()" ASL function.\r | |
1117 | \r | |
1118 | @ingroup UserApis\r | |
1119 | \r | |
1120 | @param [in] CurrRdNode Pointer to the current Resource Data element of\r | |
1121 | the "_CRS" variable.\r | |
1122 | @param [out] OutRdNode Pointer to the Resource Data element following\r | |
1123 | the CurrRdNode.\r | |
1124 | Contain a NULL pointer if CurrRdNode is the\r | |
1125 | last Resource Data element in the list.\r | |
1126 | The "End Tag" is not considered as a resource\r | |
1127 | data element and is not returned.\r | |
1128 | \r | |
1129 | @retval EFI_SUCCESS The function completed successfully.\r | |
1130 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
1131 | **/\r | |
1132 | EFI_STATUS\r | |
1133 | EFIAPI\r | |
1134 | AmlNameOpCrsGetNextRdNode (\r | |
731c67e1 MK |
1135 | IN AML_DATA_NODE_HANDLE CurrRdNode,\r |
1136 | OUT AML_DATA_NODE_HANDLE *OutRdNode\r | |
691c5f77 PG |
1137 | );\r |
1138 | \r | |
1139 | /** DEPRECATED API\r | |
1140 | \r | |
1141 | Add an Interrupt Resource Data node.\r | |
1142 | \r | |
1143 | This function creates a Resource Data element corresponding to the\r | |
1144 | "Interrupt ()" ASL function, stores it in an AML Data Node.\r | |
1145 | \r | |
1146 | It then adds it after the input CurrRdNode in the list of resource data\r | |
1147 | element.\r | |
1148 | \r | |
1149 | The Resource Data effectively created is an Extended Interrupt Resource\r | |
1150 | Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"\r | |
1151 | for more information about Extended Interrupt Resource Data.\r | |
1152 | \r | |
1153 | The Extended Interrupt contains one single interrupt.\r | |
1154 | \r | |
1155 | This function allocates memory to create a data node. It is the caller's\r | |
1156 | responsibility to either:\r | |
1157 | - attach this node to an AML tree;\r | |
1158 | - delete this node.\r | |
1159 | \r | |
1160 | Note: The _CRS node must be defined using the ASL Name () function.\r | |
1161 | e.g. Name (_CRS, ResourceTemplate () {\r | |
1162 | ...\r | |
1163 | }\r | |
1164 | \r | |
1165 | @ingroup CodeGenApis\r | |
1166 | \r | |
1167 | @param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.\r | |
1168 | Must have an OpCode=AML_NAME_OP, SubOpCode=0.\r | |
1169 | NameOp object nodes are defined in ASL\r | |
1170 | using the "Name ()" function.\r | |
1171 | @param [in] ResourceConsumer The device consumes the specified interrupt\r | |
1172 | or produces it for use by a child device.\r | |
1173 | @param [in] EdgeTriggered The interrupt is edge triggered or\r | |
1174 | level triggered.\r | |
1175 | @param [in] ActiveLow The interrupt is active-high or active-low.\r | |
1176 | @param [in] Shared The interrupt can be shared with other\r | |
1177 | devices or not (Exclusive).\r | |
1178 | @param [in] IrqList Interrupt list. Must be non-NULL.\r | |
1179 | @param [in] IrqCount Interrupt count. Must be non-zero.\r | |
1180 | \r | |
1181 | \r | |
1182 | @retval EFI_SUCCESS The function completed successfully.\r | |
1183 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
1184 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r | |
1185 | **/\r | |
1186 | EFI_STATUS\r | |
1187 | EFIAPI\r | |
1188 | AmlCodeGenCrsAddRdInterrupt (\r | |
1189 | IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,\r | |
1190 | IN BOOLEAN ResourceConsumer,\r | |
1191 | IN BOOLEAN EdgeTriggered,\r | |
1192 | IN BOOLEAN ActiveLow,\r | |
1193 | IN BOOLEAN Shared,\r | |
731c67e1 | 1194 | IN UINT32 *IrqList,\r |
691c5f77 PG |
1195 | IN UINT8 IrqCount\r |
1196 | );\r | |
1197 | \r | |
1198 | #endif // DISABLE_NEW_DEPRECATED_INTERFACES\r | |
1199 | \r | |
c85ac524 | 1200 | #endif // AML_LIB_H_\r |