xref: /titanic_50/usr/src/uts/intel/sys/acpi/acdispat.h (revision da5577f07f6199b51ea374581248790c288e827b)
1 /******************************************************************************
2  *
3  * Name: acdispat.h - dispatcher (parser to interpreter interface)
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2016, 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 #ifndef _ACDISPAT_H_
45 #define _ACDISPAT_H_
46 
47 
48 #define NAMEOF_LOCAL_NTE    "__L0"
49 #define NAMEOF_ARG_NTE      "__A0"
50 
51 
52 /*
53  * dsargs - execution of dynamic arguments for static objects
54  */
55 ACPI_STATUS
56 AcpiDsGetBufferFieldArguments (
57     ACPI_OPERAND_OBJECT     *ObjDesc);
58 
59 ACPI_STATUS
60 AcpiDsGetBankFieldArguments (
61     ACPI_OPERAND_OBJECT     *ObjDesc);
62 
63 ACPI_STATUS
64 AcpiDsGetRegionArguments (
65     ACPI_OPERAND_OBJECT     *RgnDesc);
66 
67 ACPI_STATUS
68 AcpiDsGetBufferArguments (
69     ACPI_OPERAND_OBJECT     *ObjDesc);
70 
71 ACPI_STATUS
72 AcpiDsGetPackageArguments (
73     ACPI_OPERAND_OBJECT     *ObjDesc);
74 
75 
76 /*
77  * dscontrol - support for execution control opcodes
78  */
79 ACPI_STATUS
80 AcpiDsExecBeginControlOp (
81     ACPI_WALK_STATE         *WalkState,
82     ACPI_PARSE_OBJECT       *Op);
83 
84 ACPI_STATUS
85 AcpiDsExecEndControlOp (
86     ACPI_WALK_STATE         *WalkState,
87     ACPI_PARSE_OBJECT       *Op);
88 
89 
90 /*
91  * dsopcode - support for late operand evaluation
92  */
93 ACPI_STATUS
94 AcpiDsEvalBufferFieldOperands (
95     ACPI_WALK_STATE         *WalkState,
96     ACPI_PARSE_OBJECT       *Op);
97 
98 ACPI_STATUS
99 AcpiDsEvalRegionOperands (
100     ACPI_WALK_STATE         *WalkState,
101     ACPI_PARSE_OBJECT       *Op);
102 
103 ACPI_STATUS
104 AcpiDsEvalTableRegionOperands (
105     ACPI_WALK_STATE         *WalkState,
106     ACPI_PARSE_OBJECT       *Op);
107 
108 ACPI_STATUS
109 AcpiDsEvalDataObjectOperands (
110     ACPI_WALK_STATE         *WalkState,
111     ACPI_PARSE_OBJECT       *Op,
112     ACPI_OPERAND_OBJECT     *ObjDesc);
113 
114 ACPI_STATUS
115 AcpiDsEvalBankFieldOperands (
116     ACPI_WALK_STATE         *WalkState,
117     ACPI_PARSE_OBJECT       *Op);
118 
119 ACPI_STATUS
120 AcpiDsInitializeRegion (
121     ACPI_HANDLE             ObjHandle);
122 
123 
124 /*
125  * dsexec - Parser/Interpreter interface, method execution callbacks
126  */
127 ACPI_STATUS
128 AcpiDsGetPredicateValue (
129     ACPI_WALK_STATE         *WalkState,
130     ACPI_OPERAND_OBJECT     *ResultObj);
131 
132 ACPI_STATUS
133 AcpiDsExecBeginOp (
134     ACPI_WALK_STATE         *WalkState,
135     ACPI_PARSE_OBJECT       **OutOp);
136 
137 ACPI_STATUS
138 AcpiDsExecEndOp (
139     ACPI_WALK_STATE         *State);
140 
141 
142 /*
143  * dsfield - Parser/Interpreter interface for AML fields
144  */
145 ACPI_STATUS
146 AcpiDsCreateField (
147     ACPI_PARSE_OBJECT       *Op,
148     ACPI_NAMESPACE_NODE     *RegionNode,
149     ACPI_WALK_STATE         *WalkState);
150 
151 ACPI_STATUS
152 AcpiDsCreateBankField (
153     ACPI_PARSE_OBJECT       *Op,
154     ACPI_NAMESPACE_NODE     *RegionNode,
155     ACPI_WALK_STATE         *WalkState);
156 
157 ACPI_STATUS
158 AcpiDsCreateIndexField (
159     ACPI_PARSE_OBJECT       *Op,
160     ACPI_NAMESPACE_NODE     *RegionNode,
161     ACPI_WALK_STATE         *WalkState);
162 
163 ACPI_STATUS
164 AcpiDsCreateBufferField (
165     ACPI_PARSE_OBJECT       *Op,
166     ACPI_WALK_STATE         *WalkState);
167 
168 ACPI_STATUS
169 AcpiDsInitFieldObjects (
170     ACPI_PARSE_OBJECT       *Op,
171     ACPI_WALK_STATE         *WalkState);
172 
173 
174 /*
175  * dsload - Parser/Interpreter interface
176  */
177 ACPI_STATUS
178 AcpiDsInitCallbacks (
179     ACPI_WALK_STATE         *WalkState,
180     UINT32                  PassNumber);
181 
182 /* dsload - pass 1 namespace load callbacks */
183 
184 ACPI_STATUS
185 AcpiDsLoad1BeginOp (
186     ACPI_WALK_STATE         *WalkState,
187     ACPI_PARSE_OBJECT       **OutOp);
188 
189 ACPI_STATUS
190 AcpiDsLoad1EndOp (
191     ACPI_WALK_STATE         *WalkState);
192 
193 
194 /* dsload - 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 AcpiDsAutoSerializeMethod (
261     ACPI_NAMESPACE_NODE     *Node,
262     ACPI_OPERAND_OBJECT     *ObjDesc);
263 
264 ACPI_STATUS
265 AcpiDsCallControlMethod (
266     ACPI_THREAD_STATE       *Thread,
267     ACPI_WALK_STATE         *WalkState,
268     ACPI_PARSE_OBJECT       *Op);
269 
270 ACPI_STATUS
271 AcpiDsRestartControlMethod (
272     ACPI_WALK_STATE         *WalkState,
273     ACPI_OPERAND_OBJECT     *ReturnDesc);
274 
275 void
276 AcpiDsTerminateControlMethod (
277     ACPI_OPERAND_OBJECT     *MethodDesc,
278     ACPI_WALK_STATE         *WalkState);
279 
280 ACPI_STATUS
281 AcpiDsBeginMethodExecution (
282     ACPI_NAMESPACE_NODE     *MethodNode,
283     ACPI_OPERAND_OBJECT     *ObjDesc,
284     ACPI_WALK_STATE         *WalkState);
285 
286 ACPI_STATUS
287 AcpiDsMethodError (
288     ACPI_STATUS             Status,
289     ACPI_WALK_STATE         *WalkState);
290 
291 /*
292  * dsinit
293  */
294 ACPI_STATUS
295 AcpiDsInitializeObjects (
296     UINT32                  TableIndex,
297     ACPI_NAMESPACE_NODE     *StartNode);
298 
299 
300 /*
301  * dsobject - Parser/Interpreter interface - object initialization and conversion
302  */
303 ACPI_STATUS
304 AcpiDsBuildInternalBufferObj (
305     ACPI_WALK_STATE         *WalkState,
306     ACPI_PARSE_OBJECT       *Op,
307     UINT32                  BufferLength,
308     ACPI_OPERAND_OBJECT     **ObjDescPtr);
309 
310 ACPI_STATUS
311 AcpiDsBuildInternalPackageObj (
312     ACPI_WALK_STATE         *WalkState,
313     ACPI_PARSE_OBJECT       *op,
314     UINT32                  PackageLength,
315     ACPI_OPERAND_OBJECT     **ObjDesc);
316 
317 ACPI_STATUS
318 AcpiDsInitObjectFromOp (
319     ACPI_WALK_STATE         *WalkState,
320     ACPI_PARSE_OBJECT       *Op,
321     UINT16                  Opcode,
322     ACPI_OPERAND_OBJECT     **ObjDesc);
323 
324 ACPI_STATUS
325 AcpiDsCreateNode (
326     ACPI_WALK_STATE         *WalkState,
327     ACPI_NAMESPACE_NODE     *Node,
328     ACPI_PARSE_OBJECT       *Op);
329 
330 
331 /*
332  * dsutils - Parser/Interpreter interface utility routines
333  */
334 void
335 AcpiDsClearImplicitReturn (
336     ACPI_WALK_STATE         *WalkState);
337 
338 BOOLEAN
339 AcpiDsDoImplicitReturn (
340     ACPI_OPERAND_OBJECT     *ReturnDesc,
341     ACPI_WALK_STATE         *WalkState,
342     BOOLEAN                 AddReference);
343 
344 BOOLEAN
345 AcpiDsIsResultUsed (
346     ACPI_PARSE_OBJECT       *Op,
347     ACPI_WALK_STATE         *WalkState);
348 
349 void
350 AcpiDsDeleteResultIfNotUsed (
351     ACPI_PARSE_OBJECT       *Op,
352     ACPI_OPERAND_OBJECT     *ResultObj,
353     ACPI_WALK_STATE         *WalkState);
354 
355 ACPI_STATUS
356 AcpiDsCreateOperand (
357     ACPI_WALK_STATE         *WalkState,
358     ACPI_PARSE_OBJECT       *Arg,
359     UINT32                  ArgsRemaining);
360 
361 ACPI_STATUS
362 AcpiDsCreateOperands (
363     ACPI_WALK_STATE         *WalkState,
364     ACPI_PARSE_OBJECT       *FirstArg);
365 
366 ACPI_STATUS
367 AcpiDsResolveOperands (
368     ACPI_WALK_STATE         *WalkState);
369 
370 void
371 AcpiDsClearOperands (
372     ACPI_WALK_STATE         *WalkState);
373 
374 ACPI_STATUS
375 AcpiDsEvaluateNamePath (
376     ACPI_WALK_STATE         *WalkState);
377 
378 
379 /*
380  * dswscope - Scope Stack manipulation
381  */
382 ACPI_STATUS
383 AcpiDsScopeStackPush (
384     ACPI_NAMESPACE_NODE     *Node,
385     ACPI_OBJECT_TYPE        Type,
386     ACPI_WALK_STATE         *WalkState);
387 
388 
389 ACPI_STATUS
390 AcpiDsScopeStackPop (
391     ACPI_WALK_STATE         *WalkState);
392 
393 void
394 AcpiDsScopeStackClear (
395     ACPI_WALK_STATE         *WalkState);
396 
397 
398 /*
399  * dswstate - parser WALK_STATE management routines
400  */
401 ACPI_STATUS
402 AcpiDsObjStackPush (
403     void                    *Object,
404     ACPI_WALK_STATE         *WalkState);
405 
406 ACPI_STATUS
407 AcpiDsObjStackPop (
408     UINT32                  PopCount,
409     ACPI_WALK_STATE         *WalkState);
410 
411 ACPI_WALK_STATE *
412 AcpiDsCreateWalkState (
413     ACPI_OWNER_ID           OwnerId,
414     ACPI_PARSE_OBJECT       *Origin,
415     ACPI_OPERAND_OBJECT     *MthDesc,
416     ACPI_THREAD_STATE       *Thread);
417 
418 ACPI_STATUS
419 AcpiDsInitAmlWalk (
420     ACPI_WALK_STATE         *WalkState,
421     ACPI_PARSE_OBJECT       *Op,
422     ACPI_NAMESPACE_NODE     *MethodNode,
423     UINT8                   *AmlStart,
424     UINT32                  AmlLength,
425     ACPI_EVALUATE_INFO      *Info,
426     UINT8                   PassNumber);
427 
428 void
429 AcpiDsObjStackPopAndDelete (
430     UINT32                  PopCount,
431     ACPI_WALK_STATE         *WalkState);
432 
433 void
434 AcpiDsDeleteWalkState (
435     ACPI_WALK_STATE         *WalkState);
436 
437 ACPI_WALK_STATE *
438 AcpiDsPopWalkState (
439     ACPI_THREAD_STATE       *Thread);
440 
441 void
442 AcpiDsPushWalkState (
443     ACPI_WALK_STATE         *WalkState,
444     ACPI_THREAD_STATE       *Thread);
445 
446 ACPI_STATUS
447 AcpiDsResultStackClear (
448     ACPI_WALK_STATE         *WalkState);
449 
450 ACPI_WALK_STATE *
451 AcpiDsGetCurrentWalkState (
452     ACPI_THREAD_STATE       *Thread);
453 
454 ACPI_STATUS
455 AcpiDsResultPop (
456     ACPI_OPERAND_OBJECT     **Object,
457     ACPI_WALK_STATE         *WalkState);
458 
459 ACPI_STATUS
460 AcpiDsResultPush (
461     ACPI_OPERAND_OBJECT     *Object,
462     ACPI_WALK_STATE         *WalkState);
463 
464 
465 /*
466  * dsdebug - parser debugging routines
467  */
468 void
469 AcpiDsDumpMethodStack (
470     ACPI_STATUS             Status,
471     ACPI_WALK_STATE         *WalkState,
472     ACPI_PARSE_OBJECT       *Op);
473 
474 #endif /* _ACDISPAT_H_ */
475