xref: /illumos-gate/usr/src/uts/intel/sys/acpi/acdispat.h (revision db2bae30)
1 /******************************************************************************
2  *
3  * Name: acdispat.h - dispatcher (parser to interpreter interface)
4  *       $Revision: 1.79 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 
118 #ifndef _ACDISPAT_H_
119 #define _ACDISPAT_H_
120 
121 
122 #define NAMEOF_LOCAL_NTE    "__L0"
123 #define NAMEOF_ARG_NTE      "__A0"
124 
125 
126 /*
127  * dsopcode - support for late evaluation
128  */
129 ACPI_STATUS
130 AcpiDsGetBufferFieldArguments (
131     ACPI_OPERAND_OBJECT     *ObjDesc);
132 
133 ACPI_STATUS
134 AcpiDsGetBankFieldArguments (
135     ACPI_OPERAND_OBJECT     *ObjDesc);
136 
137 ACPI_STATUS
138 AcpiDsGetRegionArguments (
139     ACPI_OPERAND_OBJECT     *RgnDesc);
140 
141 ACPI_STATUS
142 AcpiDsGetBufferArguments (
143     ACPI_OPERAND_OBJECT     *ObjDesc);
144 
145 ACPI_STATUS
146 AcpiDsGetPackageArguments (
147     ACPI_OPERAND_OBJECT     *ObjDesc);
148 
149 ACPI_STATUS
150 AcpiDsEvalBufferFieldOperands (
151     ACPI_WALK_STATE         *WalkState,
152     ACPI_PARSE_OBJECT       *Op);
153 
154 ACPI_STATUS
155 AcpiDsEvalRegionOperands (
156     ACPI_WALK_STATE         *WalkState,
157     ACPI_PARSE_OBJECT       *Op);
158 
159 ACPI_STATUS
160 AcpiDsEvalTableRegionOperands (
161     ACPI_WALK_STATE         *WalkState,
162     ACPI_PARSE_OBJECT       *Op);
163 
164 ACPI_STATUS
165 AcpiDsEvalDataObjectOperands (
166     ACPI_WALK_STATE         *WalkState,
167     ACPI_PARSE_OBJECT       *Op,
168     ACPI_OPERAND_OBJECT     *ObjDesc);
169 
170 ACPI_STATUS
171 AcpiDsEvalBankFieldOperands (
172     ACPI_WALK_STATE         *WalkState,
173     ACPI_PARSE_OBJECT       *Op);
174 
175 ACPI_STATUS
176 AcpiDsInitializeRegion (
177     ACPI_HANDLE             ObjHandle);
178 
179 
180 /*
181  * dsctrl - Parser/Interpreter interface, control stack routines
182  */
183 ACPI_STATUS
184 AcpiDsExecBeginControlOp (
185     ACPI_WALK_STATE         *WalkState,
186     ACPI_PARSE_OBJECT       *Op);
187 
188 ACPI_STATUS
189 AcpiDsExecEndControlOp (
190     ACPI_WALK_STATE         *WalkState,
191     ACPI_PARSE_OBJECT       *Op);
192 
193 
194 /*
195  * dsexec - Parser/Interpreter interface, method execution callbacks
196  */
197 ACPI_STATUS
198 AcpiDsGetPredicateValue (
199     ACPI_WALK_STATE         *WalkState,
200     ACPI_OPERAND_OBJECT     *ResultObj);
201 
202 ACPI_STATUS
203 AcpiDsExecBeginOp (
204     ACPI_WALK_STATE         *WalkState,
205     ACPI_PARSE_OBJECT       **OutOp);
206 
207 ACPI_STATUS
208 AcpiDsExecEndOp (
209     ACPI_WALK_STATE         *State);
210 
211 
212 /*
213  * dsfield - Parser/Interpreter interface for AML fields
214  */
215 ACPI_STATUS
216 AcpiDsCreateField (
217     ACPI_PARSE_OBJECT       *Op,
218     ACPI_NAMESPACE_NODE     *RegionNode,
219     ACPI_WALK_STATE         *WalkState);
220 
221 ACPI_STATUS
222 AcpiDsCreateBankField (
223     ACPI_PARSE_OBJECT       *Op,
224     ACPI_NAMESPACE_NODE     *RegionNode,
225     ACPI_WALK_STATE         *WalkState);
226 
227 ACPI_STATUS
228 AcpiDsCreateIndexField (
229     ACPI_PARSE_OBJECT       *Op,
230     ACPI_NAMESPACE_NODE     *RegionNode,
231     ACPI_WALK_STATE         *WalkState);
232 
233 ACPI_STATUS
234 AcpiDsCreateBufferField (
235     ACPI_PARSE_OBJECT       *Op,
236     ACPI_WALK_STATE         *WalkState);
237 
238 ACPI_STATUS
239 AcpiDsInitFieldObjects (
240     ACPI_PARSE_OBJECT       *Op,
241     ACPI_WALK_STATE         *WalkState);
242 
243 
244 /*
245  * dsload - Parser/Interpreter interface, namespace load callbacks
246  */
247 ACPI_STATUS
248 AcpiDsLoad1BeginOp (
249     ACPI_WALK_STATE         *WalkState,
250     ACPI_PARSE_OBJECT       **OutOp);
251 
252 ACPI_STATUS
253 AcpiDsLoad1EndOp (
254     ACPI_WALK_STATE         *WalkState);
255 
256 ACPI_STATUS
257 AcpiDsLoad2BeginOp (
258     ACPI_WALK_STATE         *WalkState,
259     ACPI_PARSE_OBJECT       **OutOp);
260 
261 ACPI_STATUS
262 AcpiDsLoad2EndOp (
263     ACPI_WALK_STATE         *WalkState);
264 
265 ACPI_STATUS
266 AcpiDsInitCallbacks (
267     ACPI_WALK_STATE         *WalkState,
268     UINT32                  PassNumber);
269 
270 
271 /*
272  * dsmthdat - method data (locals/args)
273  */
274 ACPI_STATUS
275 AcpiDsStoreObjectToLocal (
276     UINT8                   Type,
277     UINT32                  Index,
278     ACPI_OPERAND_OBJECT     *SrcDesc,
279     ACPI_WALK_STATE         *WalkState);
280 
281 ACPI_STATUS
282 AcpiDsMethodDataGetEntry (
283     UINT16                  Opcode,
284     UINT32                  Index,
285     ACPI_WALK_STATE         *WalkState,
286     ACPI_OPERAND_OBJECT     ***Node);
287 
288 void
289 AcpiDsMethodDataDeleteAll (
290     ACPI_WALK_STATE         *WalkState);
291 
292 BOOLEAN
293 AcpiDsIsMethodValue (
294     ACPI_OPERAND_OBJECT     *ObjDesc);
295 
296 ACPI_STATUS
297 AcpiDsMethodDataGetValue (
298     UINT8                   Type,
299     UINT32                  Index,
300     ACPI_WALK_STATE         *WalkState,
301     ACPI_OPERAND_OBJECT     **DestDesc);
302 
303 ACPI_STATUS
304 AcpiDsMethodDataInitArgs (
305     ACPI_OPERAND_OBJECT     **Params,
306     UINT32                  MaxParamCount,
307     ACPI_WALK_STATE         *WalkState);
308 
309 ACPI_STATUS
310 AcpiDsMethodDataGetNode (
311     UINT8                   Type,
312     UINT32                  Index,
313     ACPI_WALK_STATE         *WalkState,
314     ACPI_NAMESPACE_NODE     **Node);
315 
316 void
317 AcpiDsMethodDataInit (
318     ACPI_WALK_STATE         *WalkState);
319 
320 
321 /*
322  * dsmethod - Parser/Interpreter interface - control method parsing
323  */
324 ACPI_STATUS
325 AcpiDsParseMethod (
326     ACPI_NAMESPACE_NODE     *Node);
327 
328 ACPI_STATUS
329 AcpiDsCallControlMethod (
330     ACPI_THREAD_STATE       *Thread,
331     ACPI_WALK_STATE         *WalkState,
332     ACPI_PARSE_OBJECT       *Op);
333 
334 ACPI_STATUS
335 AcpiDsRestartControlMethod (
336     ACPI_WALK_STATE         *WalkState,
337     ACPI_OPERAND_OBJECT     *ReturnDesc);
338 
339 void
340 AcpiDsTerminateControlMethod (
341     ACPI_OPERAND_OBJECT     *MethodDesc,
342     ACPI_WALK_STATE         *WalkState);
343 
344 ACPI_STATUS
345 AcpiDsBeginMethodExecution (
346     ACPI_NAMESPACE_NODE     *MethodNode,
347     ACPI_OPERAND_OBJECT     *ObjDesc,
348     ACPI_WALK_STATE         *WalkState);
349 
350 ACPI_STATUS
351 AcpiDsMethodError (
352     ACPI_STATUS             Status,
353     ACPI_WALK_STATE         *WalkState);
354 
355 /*
356  * dsinit
357  */
358 ACPI_STATUS
359 AcpiDsInitializeObjects (
360     UINT32                  TableIndex,
361     ACPI_NAMESPACE_NODE     *StartNode);
362 
363 
364 /*
365  * dsobject - Parser/Interpreter interface - object initialization and conversion
366  */
367 ACPI_STATUS
368 AcpiDsBuildInternalBufferObj (
369     ACPI_WALK_STATE         *WalkState,
370     ACPI_PARSE_OBJECT       *Op,
371     UINT32                  BufferLength,
372     ACPI_OPERAND_OBJECT     **ObjDescPtr);
373 
374 ACPI_STATUS
375 AcpiDsBuildInternalPackageObj (
376     ACPI_WALK_STATE         *WalkState,
377     ACPI_PARSE_OBJECT       *op,
378     UINT32                  PackageLength,
379     ACPI_OPERAND_OBJECT     **ObjDesc);
380 
381 ACPI_STATUS
382 AcpiDsInitObjectFromOp (
383     ACPI_WALK_STATE         *WalkState,
384     ACPI_PARSE_OBJECT       *Op,
385     UINT16                  Opcode,
386     ACPI_OPERAND_OBJECT     **ObjDesc);
387 
388 ACPI_STATUS
389 AcpiDsCreateNode (
390     ACPI_WALK_STATE         *WalkState,
391     ACPI_NAMESPACE_NODE     *Node,
392     ACPI_PARSE_OBJECT       *Op);
393 
394 
395 /*
396  * dsutils - Parser/Interpreter interface utility routines
397  */
398 void
399 AcpiDsClearImplicitReturn (
400     ACPI_WALK_STATE         *WalkState);
401 
402 BOOLEAN
403 AcpiDsDoImplicitReturn (
404     ACPI_OPERAND_OBJECT     *ReturnDesc,
405     ACPI_WALK_STATE         *WalkState,
406     BOOLEAN                 AddReference);
407 
408 BOOLEAN
409 AcpiDsIsResultUsed (
410     ACPI_PARSE_OBJECT       *Op,
411     ACPI_WALK_STATE         *WalkState);
412 
413 void
414 AcpiDsDeleteResultIfNotUsed (
415     ACPI_PARSE_OBJECT       *Op,
416     ACPI_OPERAND_OBJECT     *ResultObj,
417     ACPI_WALK_STATE         *WalkState);
418 
419 ACPI_STATUS
420 AcpiDsCreateOperand (
421     ACPI_WALK_STATE         *WalkState,
422     ACPI_PARSE_OBJECT       *Arg,
423     UINT32                  ArgsRemaining);
424 
425 ACPI_STATUS
426 AcpiDsCreateOperands (
427     ACPI_WALK_STATE         *WalkState,
428     ACPI_PARSE_OBJECT       *FirstArg);
429 
430 ACPI_STATUS
431 AcpiDsResolveOperands (
432     ACPI_WALK_STATE         *WalkState);
433 
434 void
435 AcpiDsClearOperands (
436     ACPI_WALK_STATE         *WalkState);
437 
438 ACPI_STATUS
439 AcpiDsEvaluateNamePath (
440     ACPI_WALK_STATE         *WalkState);
441 
442 
443 /*
444  * dswscope - Scope Stack manipulation
445  */
446 ACPI_STATUS
447 AcpiDsScopeStackPush (
448     ACPI_NAMESPACE_NODE     *Node,
449     ACPI_OBJECT_TYPE        Type,
450     ACPI_WALK_STATE         *WalkState);
451 
452 
453 ACPI_STATUS
454 AcpiDsScopeStackPop (
455     ACPI_WALK_STATE         *WalkState);
456 
457 void
458 AcpiDsScopeStackClear (
459     ACPI_WALK_STATE         *WalkState);
460 
461 
462 /*
463  * dswstate - parser WALK_STATE management routines
464  */
465 ACPI_STATUS
466 AcpiDsObjStackPush (
467     void                    *Object,
468     ACPI_WALK_STATE         *WalkState);
469 
470 ACPI_STATUS
471 AcpiDsObjStackPop (
472     UINT32                  PopCount,
473     ACPI_WALK_STATE         *WalkState);
474 
475 ACPI_WALK_STATE *
476 AcpiDsCreateWalkState (
477     ACPI_OWNER_ID           OwnerId,
478     ACPI_PARSE_OBJECT       *Origin,
479     ACPI_OPERAND_OBJECT     *MthDesc,
480     ACPI_THREAD_STATE       *Thread);
481 
482 ACPI_STATUS
483 AcpiDsInitAmlWalk (
484     ACPI_WALK_STATE         *WalkState,
485     ACPI_PARSE_OBJECT       *Op,
486     ACPI_NAMESPACE_NODE     *MethodNode,
487     UINT8                   *AmlStart,
488     UINT32                  AmlLength,
489     ACPI_EVALUATE_INFO      *Info,
490     UINT8                   PassNumber);
491 
492 void
493 AcpiDsObjStackPopAndDelete (
494     UINT32                  PopCount,
495     ACPI_WALK_STATE         *WalkState);
496 
497 void
498 AcpiDsDeleteWalkState (
499     ACPI_WALK_STATE         *WalkState);
500 
501 ACPI_WALK_STATE *
502 AcpiDsPopWalkState (
503     ACPI_THREAD_STATE       *Thread);
504 
505 void
506 AcpiDsPushWalkState (
507     ACPI_WALK_STATE         *WalkState,
508     ACPI_THREAD_STATE       *Thread);
509 
510 ACPI_STATUS
511 AcpiDsResultStackClear (
512     ACPI_WALK_STATE         *WalkState);
513 
514 ACPI_WALK_STATE *
515 AcpiDsGetCurrentWalkState (
516     ACPI_THREAD_STATE       *Thread);
517 
518 ACPI_STATUS
519 AcpiDsResultPop (
520     ACPI_OPERAND_OBJECT     **Object,
521     ACPI_WALK_STATE         *WalkState);
522 
523 ACPI_STATUS
524 AcpiDsResultPush (
525     ACPI_OPERAND_OBJECT     *Object,
526     ACPI_WALK_STATE         *WalkState);
527 
528 #endif /* _ACDISPAT_H_ */
529