xref: /titanic_41/usr/src/uts/intel/sys/acpi/acdispat.h (revision a9478106a12424322498e53cf7cd75bd8a4d6004)
1 /******************************************************************************
2  *
3  * Name: acdispat.h - dispatcher (parser to interpreter interface)
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2011, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 
45 #ifndef _ACDISPAT_H_
46 #define _ACDISPAT_H_
47 
48 
49 #define NAMEOF_LOCAL_NTE    "__L0"
50 #define NAMEOF_ARG_NTE      "__A0"
51 
52 
53 /*
54  * dsargs - execution of dynamic arguments for static objects
55  */
56 ACPI_STATUS
57 AcpiDsGetBufferFieldArguments (
58     ACPI_OPERAND_OBJECT     *ObjDesc);
59 
60 ACPI_STATUS
61 AcpiDsGetBankFieldArguments (
62     ACPI_OPERAND_OBJECT     *ObjDesc);
63 
64 ACPI_STATUS
65 AcpiDsGetRegionArguments (
66     ACPI_OPERAND_OBJECT     *RgnDesc);
67 
68 ACPI_STATUS
69 AcpiDsGetBufferArguments (
70     ACPI_OPERAND_OBJECT     *ObjDesc);
71 
72 ACPI_STATUS
73 AcpiDsGetPackageArguments (
74     ACPI_OPERAND_OBJECT     *ObjDesc);
75 
76 
77 /*
78  * dscontrol - support for execution control opcodes
79  */
80 ACPI_STATUS
81 AcpiDsExecBeginControlOp (
82     ACPI_WALK_STATE         *WalkState,
83     ACPI_PARSE_OBJECT       *Op);
84 
85 ACPI_STATUS
86 AcpiDsExecEndControlOp (
87     ACPI_WALK_STATE         *WalkState,
88     ACPI_PARSE_OBJECT       *Op);
89 
90 
91 /*
92  * dsopcode - support for late operand evaluation
93  */
94 ACPI_STATUS
95 AcpiDsEvalBufferFieldOperands (
96     ACPI_WALK_STATE         *WalkState,
97     ACPI_PARSE_OBJECT       *Op);
98 
99 ACPI_STATUS
100 AcpiDsEvalRegionOperands (
101     ACPI_WALK_STATE         *WalkState,
102     ACPI_PARSE_OBJECT       *Op);
103 
104 ACPI_STATUS
105 AcpiDsEvalTableRegionOperands (
106     ACPI_WALK_STATE         *WalkState,
107     ACPI_PARSE_OBJECT       *Op);
108 
109 ACPI_STATUS
110 AcpiDsEvalDataObjectOperands (
111     ACPI_WALK_STATE         *WalkState,
112     ACPI_PARSE_OBJECT       *Op,
113     ACPI_OPERAND_OBJECT     *ObjDesc);
114 
115 ACPI_STATUS
116 AcpiDsEvalBankFieldOperands (
117     ACPI_WALK_STATE         *WalkState,
118     ACPI_PARSE_OBJECT       *Op);
119 
120 ACPI_STATUS
121 AcpiDsInitializeRegion (
122     ACPI_HANDLE             ObjHandle);
123 
124 
125 /*
126  * dsexec - Parser/Interpreter interface, method execution callbacks
127  */
128 ACPI_STATUS
129 AcpiDsGetPredicateValue (
130     ACPI_WALK_STATE         *WalkState,
131     ACPI_OPERAND_OBJECT     *ResultObj);
132 
133 ACPI_STATUS
134 AcpiDsExecBeginOp (
135     ACPI_WALK_STATE         *WalkState,
136     ACPI_PARSE_OBJECT       **OutOp);
137 
138 ACPI_STATUS
139 AcpiDsExecEndOp (
140     ACPI_WALK_STATE         *State);
141 
142 
143 /*
144  * dsfield - Parser/Interpreter interface for AML fields
145  */
146 ACPI_STATUS
147 AcpiDsCreateField (
148     ACPI_PARSE_OBJECT       *Op,
149     ACPI_NAMESPACE_NODE     *RegionNode,
150     ACPI_WALK_STATE         *WalkState);
151 
152 ACPI_STATUS
153 AcpiDsCreateBankField (
154     ACPI_PARSE_OBJECT       *Op,
155     ACPI_NAMESPACE_NODE     *RegionNode,
156     ACPI_WALK_STATE         *WalkState);
157 
158 ACPI_STATUS
159 AcpiDsCreateIndexField (
160     ACPI_PARSE_OBJECT       *Op,
161     ACPI_NAMESPACE_NODE     *RegionNode,
162     ACPI_WALK_STATE         *WalkState);
163 
164 ACPI_STATUS
165 AcpiDsCreateBufferField (
166     ACPI_PARSE_OBJECT       *Op,
167     ACPI_WALK_STATE         *WalkState);
168 
169 ACPI_STATUS
170 AcpiDsInitFieldObjects (
171     ACPI_PARSE_OBJECT       *Op,
172     ACPI_WALK_STATE         *WalkState);
173 
174 
175 /*
176  * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks
177  */
178 ACPI_STATUS
179 AcpiDsInitCallbacks (
180     ACPI_WALK_STATE         *WalkState,
181     UINT32                  PassNumber);
182 
183 ACPI_STATUS
184 AcpiDsLoad1BeginOp (
185     ACPI_WALK_STATE         *WalkState,
186     ACPI_PARSE_OBJECT       **OutOp);
187 
188 ACPI_STATUS
189 AcpiDsLoad1EndOp (
190     ACPI_WALK_STATE         *WalkState);
191 
192 
193 /*
194  * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks
195  */
196 ACPI_STATUS
197 AcpiDsLoad2BeginOp (
198     ACPI_WALK_STATE         *WalkState,
199     ACPI_PARSE_OBJECT       **OutOp);
200 
201 ACPI_STATUS
202 AcpiDsLoad2EndOp (
203     ACPI_WALK_STATE         *WalkState);
204 
205 
206 /*
207  * dsmthdat - method data (locals/args)
208  */
209 ACPI_STATUS
210 AcpiDsStoreObjectToLocal (
211     UINT8                   Type,
212     UINT32                  Index,
213     ACPI_OPERAND_OBJECT     *SrcDesc,
214     ACPI_WALK_STATE         *WalkState);
215 
216 ACPI_STATUS
217 AcpiDsMethodDataGetEntry (
218     UINT16                  Opcode,
219     UINT32                  Index,
220     ACPI_WALK_STATE         *WalkState,
221     ACPI_OPERAND_OBJECT     ***Node);
222 
223 void
224 AcpiDsMethodDataDeleteAll (
225     ACPI_WALK_STATE         *WalkState);
226 
227 BOOLEAN
228 AcpiDsIsMethodValue (
229     ACPI_OPERAND_OBJECT     *ObjDesc);
230 
231 ACPI_STATUS
232 AcpiDsMethodDataGetValue (
233     UINT8                   Type,
234     UINT32                  Index,
235     ACPI_WALK_STATE         *WalkState,
236     ACPI_OPERAND_OBJECT     **DestDesc);
237 
238 ACPI_STATUS
239 AcpiDsMethodDataInitArgs (
240     ACPI_OPERAND_OBJECT     **Params,
241     UINT32                  MaxParamCount,
242     ACPI_WALK_STATE         *WalkState);
243 
244 ACPI_STATUS
245 AcpiDsMethodDataGetNode (
246     UINT8                   Type,
247     UINT32                  Index,
248     ACPI_WALK_STATE         *WalkState,
249     ACPI_NAMESPACE_NODE     **Node);
250 
251 void
252 AcpiDsMethodDataInit (
253     ACPI_WALK_STATE         *WalkState);
254 
255 
256 /*
257  * dsmethod - Parser/Interpreter interface - control method parsing
258  */
259 ACPI_STATUS
260 AcpiDsParseMethod (
261     ACPI_NAMESPACE_NODE     *Node);
262 
263 ACPI_STATUS
264 AcpiDsCallControlMethod (
265     ACPI_THREAD_STATE       *Thread,
266     ACPI_WALK_STATE         *WalkState,
267     ACPI_PARSE_OBJECT       *Op);
268 
269 ACPI_STATUS
270 AcpiDsRestartControlMethod (
271     ACPI_WALK_STATE         *WalkState,
272     ACPI_OPERAND_OBJECT     *ReturnDesc);
273 
274 void
275 AcpiDsTerminateControlMethod (
276     ACPI_OPERAND_OBJECT     *MethodDesc,
277     ACPI_WALK_STATE         *WalkState);
278 
279 ACPI_STATUS
280 AcpiDsBeginMethodExecution (
281     ACPI_NAMESPACE_NODE     *MethodNode,
282     ACPI_OPERAND_OBJECT     *ObjDesc,
283     ACPI_WALK_STATE         *WalkState);
284 
285 ACPI_STATUS
286 AcpiDsMethodError (
287     ACPI_STATUS             Status,
288     ACPI_WALK_STATE         *WalkState);
289 
290 /*
291  * dsinit
292  */
293 ACPI_STATUS
294 AcpiDsInitializeObjects (
295     UINT32                  TableIndex,
296     ACPI_NAMESPACE_NODE     *StartNode);
297 
298 
299 /*
300  * dsobject - Parser/Interpreter interface - object initialization and conversion
301  */
302 ACPI_STATUS
303 AcpiDsBuildInternalBufferObj (
304     ACPI_WALK_STATE         *WalkState,
305     ACPI_PARSE_OBJECT       *Op,
306     UINT32                  BufferLength,
307     ACPI_OPERAND_OBJECT     **ObjDescPtr);
308 
309 ACPI_STATUS
310 AcpiDsBuildInternalPackageObj (
311     ACPI_WALK_STATE         *WalkState,
312     ACPI_PARSE_OBJECT       *op,
313     UINT32                  PackageLength,
314     ACPI_OPERAND_OBJECT     **ObjDesc);
315 
316 ACPI_STATUS
317 AcpiDsInitObjectFromOp (
318     ACPI_WALK_STATE         *WalkState,
319     ACPI_PARSE_OBJECT       *Op,
320     UINT16                  Opcode,
321     ACPI_OPERAND_OBJECT     **ObjDesc);
322 
323 ACPI_STATUS
324 AcpiDsCreateNode (
325     ACPI_WALK_STATE         *WalkState,
326     ACPI_NAMESPACE_NODE     *Node,
327     ACPI_PARSE_OBJECT       *Op);
328 
329 
330 /*
331  * dsutils - Parser/Interpreter interface utility routines
332  */
333 void
334 AcpiDsClearImplicitReturn (
335     ACPI_WALK_STATE         *WalkState);
336 
337 BOOLEAN
338 AcpiDsDoImplicitReturn (
339     ACPI_OPERAND_OBJECT     *ReturnDesc,
340     ACPI_WALK_STATE         *WalkState,
341     BOOLEAN                 AddReference);
342 
343 BOOLEAN
344 AcpiDsIsResultUsed (
345     ACPI_PARSE_OBJECT       *Op,
346     ACPI_WALK_STATE         *WalkState);
347 
348 void
349 AcpiDsDeleteResultIfNotUsed (
350     ACPI_PARSE_OBJECT       *Op,
351     ACPI_OPERAND_OBJECT     *ResultObj,
352     ACPI_WALK_STATE         *WalkState);
353 
354 ACPI_STATUS
355 AcpiDsCreateOperand (
356     ACPI_WALK_STATE         *WalkState,
357     ACPI_PARSE_OBJECT       *Arg,
358     UINT32                  ArgsRemaining);
359 
360 ACPI_STATUS
361 AcpiDsCreateOperands (
362     ACPI_WALK_STATE         *WalkState,
363     ACPI_PARSE_OBJECT       *FirstArg);
364 
365 ACPI_STATUS
366 AcpiDsResolveOperands (
367     ACPI_WALK_STATE         *WalkState);
368 
369 void
370 AcpiDsClearOperands (
371     ACPI_WALK_STATE         *WalkState);
372 
373 ACPI_STATUS
374 AcpiDsEvaluateNamePath (
375     ACPI_WALK_STATE         *WalkState);
376 
377 
378 /*
379  * dswscope - Scope Stack manipulation
380  */
381 ACPI_STATUS
382 AcpiDsScopeStackPush (
383     ACPI_NAMESPACE_NODE     *Node,
384     ACPI_OBJECT_TYPE        Type,
385     ACPI_WALK_STATE         *WalkState);
386 
387 
388 ACPI_STATUS
389 AcpiDsScopeStackPop (
390     ACPI_WALK_STATE         *WalkState);
391 
392 void
393 AcpiDsScopeStackClear (
394     ACPI_WALK_STATE         *WalkState);
395 
396 
397 /*
398  * dswstate - parser WALK_STATE management routines
399  */
400 ACPI_STATUS
401 AcpiDsObjStackPush (
402     void                    *Object,
403     ACPI_WALK_STATE         *WalkState);
404 
405 ACPI_STATUS
406 AcpiDsObjStackPop (
407     UINT32                  PopCount,
408     ACPI_WALK_STATE         *WalkState);
409 
410 ACPI_WALK_STATE *
411 AcpiDsCreateWalkState (
412     ACPI_OWNER_ID           OwnerId,
413     ACPI_PARSE_OBJECT       *Origin,
414     ACPI_OPERAND_OBJECT     *MthDesc,
415     ACPI_THREAD_STATE       *Thread);
416 
417 ACPI_STATUS
418 AcpiDsInitAmlWalk (
419     ACPI_WALK_STATE         *WalkState,
420     ACPI_PARSE_OBJECT       *Op,
421     ACPI_NAMESPACE_NODE     *MethodNode,
422     UINT8                   *AmlStart,
423     UINT32                  AmlLength,
424     ACPI_EVALUATE_INFO      *Info,
425     UINT8                   PassNumber);
426 
427 void
428 AcpiDsObjStackPopAndDelete (
429     UINT32                  PopCount,
430     ACPI_WALK_STATE         *WalkState);
431 
432 void
433 AcpiDsDeleteWalkState (
434     ACPI_WALK_STATE         *WalkState);
435 
436 ACPI_WALK_STATE *
437 AcpiDsPopWalkState (
438     ACPI_THREAD_STATE       *Thread);
439 
440 void
441 AcpiDsPushWalkState (
442     ACPI_WALK_STATE         *WalkState,
443     ACPI_THREAD_STATE       *Thread);
444 
445 ACPI_STATUS
446 AcpiDsResultStackClear (
447     ACPI_WALK_STATE         *WalkState);
448 
449 ACPI_WALK_STATE *
450 AcpiDsGetCurrentWalkState (
451     ACPI_THREAD_STATE       *Thread);
452 
453 ACPI_STATUS
454 AcpiDsResultPop (
455     ACPI_OPERAND_OBJECT     **Object,
456     ACPI_WALK_STATE         *WalkState);
457 
458 ACPI_STATUS
459 AcpiDsResultPush (
460     ACPI_OPERAND_OBJECT     *Object,
461     ACPI_WALK_STATE         *WalkState);
462 
463 #endif /* _ACDISPAT_H_ */
464