Deleted Added
full compact
exresop.c (123315) exresop.c (126372)
1
2/******************************************************************************
3 *
4 * Module Name: exresop - AML Interpreter operand/object resolution
1
2/******************************************************************************
3 *
4 * Module Name: exresop - AML Interpreter operand/object resolution
5 * $Revision: 65 $
5 * $Revision: 67 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * PARTICULAR PURPOSE.
91 *
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * LIMITED REMEDY.
100 *
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
115 *
116 *****************************************************************************/
117
118#define __EXRESOP_C__
119
120#include "acpi.h"
121#include "amlcode.h"
122#include "acparser.h"
123#include "acinterp.h"
124
125
126#define _COMPONENT ACPI_EXECUTER
127 ACPI_MODULE_NAME ("exresop")
128
129
130/*******************************************************************************
131 *
132 * FUNCTION: AcpiExCheckObjectType
133 *
134 * PARAMETERS: TypeNeeded Object type needed
135 * ThisType Actual object type
136 * Object Object pointer
137 *
138 * RETURN: Status
139 *
140 * DESCRIPTION: Check required type against actual type
141 *
142 ******************************************************************************/
143
144ACPI_STATUS
145AcpiExCheckObjectType (
146 ACPI_OBJECT_TYPE TypeNeeded,
147 ACPI_OBJECT_TYPE ThisType,
148 void *Object)
149{
150 ACPI_FUNCTION_NAME ("ExCheckObjectType");
151
152
153 if (TypeNeeded == ACPI_TYPE_ANY)
154 {
155 /* All types OK, so we don't perform any typechecks */
156
157 return (AE_OK);
158 }
159
160 if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
161 {
162 /*
163 * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
164 * objects and thus allow them to be targets. (As per the ACPI
165 * specification, a store to a constant is a noop.)
166 */
167 if ((ThisType == ACPI_TYPE_INTEGER) &&
168 (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
169 {
170 return (AE_OK);
171 }
172 }
173
174 if (TypeNeeded != ThisType)
175 {
176 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
177 "Needed [%s], found [%s] %p\n",
178 AcpiUtGetTypeName (TypeNeeded),
179 AcpiUtGetTypeName (ThisType), Object));
180
181 return (AE_AML_OPERAND_TYPE);
182 }
183
184 return (AE_OK);
185}
186
187
188/*******************************************************************************
189 *
190 * FUNCTION: AcpiExResolveOperands
191 *
192 * PARAMETERS: Opcode - Opcode being interpreted
193 * StackPtr - Pointer to the operand stack to be
194 * resolved
195 * WalkState - Current state
196 *
197 * RETURN: Status
198 *
199 * DESCRIPTION: Convert multiple input operands to the types required by the
200 * target operator.
201 *
202 * Each 5-bit group in ArgTypes represents one required
203 * operand and indicates the required Type. The corresponding operand
204 * will be converted to the required type if possible, otherwise we
205 * abort with an exception.
206 *
207 ******************************************************************************/
208
209ACPI_STATUS
210AcpiExResolveOperands (
211 UINT16 Opcode,
212 ACPI_OPERAND_OBJECT **StackPtr,
213 ACPI_WALK_STATE *WalkState)
214{
215 ACPI_OPERAND_OBJECT *ObjDesc;
216 ACPI_STATUS Status = AE_OK;
217 UINT8 ObjectType;
218 void *TempNode;
219 UINT32 ArgTypes;
220 const ACPI_OPCODE_INFO *OpInfo;
221 UINT32 ThisArgType;
222 ACPI_OBJECT_TYPE TypeNeeded;
223
224
225 ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
226
227
228 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
229 if (OpInfo->Class == AML_CLASS_UNKNOWN)
230 {
231 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
232 }
233
234 ArgTypes = OpInfo->RuntimeArgs;
235 if (ArgTypes == ARGI_INVALID_OPCODE)
236 {
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * PARTICULAR PURPOSE.
91 *
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * LIMITED REMEDY.
100 *
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
115 *
116 *****************************************************************************/
117
118#define __EXRESOP_C__
119
120#include "acpi.h"
121#include "amlcode.h"
122#include "acparser.h"
123#include "acinterp.h"
124
125
126#define _COMPONENT ACPI_EXECUTER
127 ACPI_MODULE_NAME ("exresop")
128
129
130/*******************************************************************************
131 *
132 * FUNCTION: AcpiExCheckObjectType
133 *
134 * PARAMETERS: TypeNeeded Object type needed
135 * ThisType Actual object type
136 * Object Object pointer
137 *
138 * RETURN: Status
139 *
140 * DESCRIPTION: Check required type against actual type
141 *
142 ******************************************************************************/
143
144ACPI_STATUS
145AcpiExCheckObjectType (
146 ACPI_OBJECT_TYPE TypeNeeded,
147 ACPI_OBJECT_TYPE ThisType,
148 void *Object)
149{
150 ACPI_FUNCTION_NAME ("ExCheckObjectType");
151
152
153 if (TypeNeeded == ACPI_TYPE_ANY)
154 {
155 /* All types OK, so we don't perform any typechecks */
156
157 return (AE_OK);
158 }
159
160 if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
161 {
162 /*
163 * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
164 * objects and thus allow them to be targets. (As per the ACPI
165 * specification, a store to a constant is a noop.)
166 */
167 if ((ThisType == ACPI_TYPE_INTEGER) &&
168 (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
169 {
170 return (AE_OK);
171 }
172 }
173
174 if (TypeNeeded != ThisType)
175 {
176 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
177 "Needed [%s], found [%s] %p\n",
178 AcpiUtGetTypeName (TypeNeeded),
179 AcpiUtGetTypeName (ThisType), Object));
180
181 return (AE_AML_OPERAND_TYPE);
182 }
183
184 return (AE_OK);
185}
186
187
188/*******************************************************************************
189 *
190 * FUNCTION: AcpiExResolveOperands
191 *
192 * PARAMETERS: Opcode - Opcode being interpreted
193 * StackPtr - Pointer to the operand stack to be
194 * resolved
195 * WalkState - Current state
196 *
197 * RETURN: Status
198 *
199 * DESCRIPTION: Convert multiple input operands to the types required by the
200 * target operator.
201 *
202 * Each 5-bit group in ArgTypes represents one required
203 * operand and indicates the required Type. The corresponding operand
204 * will be converted to the required type if possible, otherwise we
205 * abort with an exception.
206 *
207 ******************************************************************************/
208
209ACPI_STATUS
210AcpiExResolveOperands (
211 UINT16 Opcode,
212 ACPI_OPERAND_OBJECT **StackPtr,
213 ACPI_WALK_STATE *WalkState)
214{
215 ACPI_OPERAND_OBJECT *ObjDesc;
216 ACPI_STATUS Status = AE_OK;
217 UINT8 ObjectType;
218 void *TempNode;
219 UINT32 ArgTypes;
220 const ACPI_OPCODE_INFO *OpInfo;
221 UINT32 ThisArgType;
222 ACPI_OBJECT_TYPE TypeNeeded;
223
224
225 ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
226
227
228 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
229 if (OpInfo->Class == AML_CLASS_UNKNOWN)
230 {
231 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
232 }
233
234 ArgTypes = OpInfo->RuntimeArgs;
235 if (ArgTypes == ARGI_INVALID_OPCODE)
236 {
237 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - %X is not a valid AML opcode\n",
237 ACPI_REPORT_ERROR (("ResolveOperands: %X is not a valid AML opcode\n",
238 Opcode));
239
240 return_ACPI_STATUS (AE_AML_INTERNAL);
241 }
242
243 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] OperandTypes=%X \n",
244 Opcode, OpInfo->Name, ArgTypes));
245
246 /*
247 * Normal exit is with (ArgTypes == 0) at end of argument list.
248 * Function will return an exception from within the loop upon
249 * finding an entry which is not (or cannot be converted
250 * to) the required type; if stack underflows; or upon
251 * finding a NULL stack entry (which should not happen).
252 */
253 while (GET_CURRENT_ARG_TYPE (ArgTypes))
254 {
255 if (!StackPtr || !*StackPtr)
256 {
238 Opcode));
239
240 return_ACPI_STATUS (AE_AML_INTERNAL);
241 }
242
243 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] OperandTypes=%X \n",
244 Opcode, OpInfo->Name, ArgTypes));
245
246 /*
247 * Normal exit is with (ArgTypes == 0) at end of argument list.
248 * Function will return an exception from within the loop upon
249 * finding an entry which is not (or cannot be converted
250 * to) the required type; if stack underflows; or upon
251 * finding a NULL stack entry (which should not happen).
252 */
253 while (GET_CURRENT_ARG_TYPE (ArgTypes))
254 {
255 if (!StackPtr || !*StackPtr)
256 {
257 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %p\n",
257 ACPI_REPORT_ERROR (("ResolveOperands: Null stack entry at %p\n",
258 StackPtr));
259
260 return_ACPI_STATUS (AE_AML_INTERNAL);
261 }
262
263 /* Extract useful items */
264
265 ObjDesc = *StackPtr;
266
267 /* Decode the descriptor type */
268
269 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
270 {
271 case ACPI_DESC_TYPE_NAMED:
272
273 /* Node */
274
275 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
276 break;
277
278
279 case ACPI_DESC_TYPE_OPERAND:
280
281 /* ACPI internal object */
282
283 ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
284
285 /* Check for bad ACPI_OBJECT_TYPE */
286
287 if (!AcpiUtValidObjectType (ObjectType))
288 {
289 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
290 ObjectType));
291
292 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
293 }
294
295 if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
296 {
297 /*
298 * Decode the Reference
299 */
300 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
301 if (OpInfo->Class == AML_CLASS_UNKNOWN)
302 {
303 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
304 }
305
306 switch (ObjDesc->Reference.Opcode)
307 {
308 case AML_DEBUG_OP:
309 case AML_NAME_OP:
310 case AML_INDEX_OP:
311 case AML_REF_OF_OP:
312 case AML_ARG_OP:
313 case AML_LOCAL_OP:
314 case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
315
316 ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
317 "Reference Opcode: %s\n", OpInfo->Name)));
318 break;
319
320 default:
321 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
322 "Unknown Reference Opcode %X [%s]\n",
323 ObjDesc->Reference.Opcode,
324 (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name));
325
326 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
327 }
328 }
329 break;
330
331
332 default:
333
334 /* Invalid descriptor */
335
336 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
337 "Invalid descriptor %p [%s]\n",
338 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
339
340 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
341 }
342
343
344 /*
345 * Get one argument type, point to the next
346 */
347 ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
348 INCREMENT_ARG_LIST (ArgTypes);
349
350 /*
351 * Handle cases where the object does not need to be
352 * resolved to a value
353 */
354 switch (ThisArgType)
355 {
356 case ARGI_REF_OR_STRING: /* Can be a String or Reference */
357
358 if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
359 (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
360 {
361 /*
362 * String found - the string references a named object and must be
363 * resolved to a node
364 */
365 goto NextOperand;
366 }
367
368 /* Else not a string - fall through to the normal Reference case below */
369 /*lint -fallthrough */
370
371 case ARGI_REFERENCE: /* References: */
372 case ARGI_INTEGER_REF:
373 case ARGI_OBJECT_REF:
374 case ARGI_DEVICE_REF:
375 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
376 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
377 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
378
379 /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
380
381 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */
382 {
383 goto NextOperand;
384 }
385
386 Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
387 ObjectType, ObjDesc);
388 if (ACPI_FAILURE (Status))
389 {
390 return_ACPI_STATUS (Status);
391 }
392
393 if (AML_NAME_OP == ObjDesc->Reference.Opcode)
394 {
395 /*
396 * Convert an indirect name ptr to direct name ptr and put
397 * it on the stack
398 */
399 TempNode = ObjDesc->Reference.Object;
400 AcpiUtRemoveReference (ObjDesc);
401 (*StackPtr) = TempNode;
402 }
403 goto NextOperand;
404
405
406 case ARGI_ANYTYPE:
407
408 /*
409 * We don't want to resolve IndexOp reference objects during
410 * a store because this would be an implicit DeRefOf operation.
411 * Instead, we just want to store the reference object.
412 * -- All others must be resolved below.
413 */
414 if ((Opcode == AML_STORE_OP) &&
415 (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
416 ((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
417 {
418 goto NextOperand;
419 }
420 break;
421
422 default:
423 /* All cases covered above */
424 break;
425 }
426
427
428 /*
429 * Resolve this object to a value
430 */
431 Status = AcpiExResolveToValue (StackPtr, WalkState);
432 if (ACPI_FAILURE (Status))
433 {
434 return_ACPI_STATUS (Status);
435 }
436
437 /* Get the resolved object */
438
439 ObjDesc = *StackPtr;
440
441 /*
442 * Check the resulting object (value) type
443 */
444 switch (ThisArgType)
445 {
446 /*
447 * For the simple cases, only one type of resolved object
448 * is allowed
449 */
450 case ARGI_MUTEX:
451
452 /* Need an operand of type ACPI_TYPE_MUTEX */
453
454 TypeNeeded = ACPI_TYPE_MUTEX;
455 break;
456
457 case ARGI_EVENT:
458
459 /* Need an operand of type ACPI_TYPE_EVENT */
460
461 TypeNeeded = ACPI_TYPE_EVENT;
462 break;
463
464 case ARGI_PACKAGE: /* Package */
465
466 /* Need an operand of type ACPI_TYPE_PACKAGE */
467
468 TypeNeeded = ACPI_TYPE_PACKAGE;
469 break;
470
471 case ARGI_ANYTYPE:
472
473 /* Any operand type will do */
474
475 TypeNeeded = ACPI_TYPE_ANY;
476 break;
477
478 case ARGI_DDBHANDLE:
479
480 /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
481
482 TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
483 break;
484
485
486 /*
487 * The more complex cases allow multiple resolved object types
488 */
489 case ARGI_INTEGER: /* Number */
490
491 /*
492 * Need an operand of type ACPI_TYPE_INTEGER,
493 * But we can implicitly convert from a STRING or BUFFER
494 * Aka - "Implicit Source Operand Conversion"
495 */
496 Status = AcpiExConvertToInteger (ObjDesc, StackPtr, WalkState);
497 if (ACPI_FAILURE (Status))
498 {
499 if (Status == AE_TYPE)
500 {
501 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
502 "Needed [Integer/String/Buffer], found [%s] %p\n",
503 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
504
505 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
506 }
507
508 return_ACPI_STATUS (Status);
509 }
510 goto NextOperand;
511
512
513 case ARGI_BUFFER:
514
515 /*
516 * Need an operand of type ACPI_TYPE_BUFFER,
517 * But we can implicitly convert from a STRING or INTEGER
518 * Aka - "Implicit Source Operand Conversion"
519 */
520 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
521 if (ACPI_FAILURE (Status))
522 {
523 if (Status == AE_TYPE)
524 {
525 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
526 "Needed [Integer/String/Buffer], found [%s] %p\n",
527 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
528
529 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
530 }
531
532 return_ACPI_STATUS (Status);
533 }
534 goto NextOperand;
535
536
537 case ARGI_STRING:
538
539 /*
540 * Need an operand of type ACPI_TYPE_STRING,
541 * But we can implicitly convert from a BUFFER or INTEGER
542 * Aka - "Implicit Source Operand Conversion"
543 */
544 Status = AcpiExConvertToString (ObjDesc, StackPtr, 16, ACPI_UINT32_MAX, WalkState);
545 if (ACPI_FAILURE (Status))
546 {
547 if (Status == AE_TYPE)
548 {
549 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
550 "Needed [Integer/String/Buffer], found [%s] %p\n",
551 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
552
553 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
554 }
555
556 return_ACPI_STATUS (Status);
557 }
558 goto NextOperand;
559
560
561 case ARGI_COMPUTEDATA:
562
563 /* Need an operand of type INTEGER, STRING or BUFFER */
564
565 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
566 {
567 case ACPI_TYPE_INTEGER:
568 case ACPI_TYPE_STRING:
569 case ACPI_TYPE_BUFFER:
570
571 /* Valid operand */
572 break;
573
574 default:
575 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
576 "Needed [Integer/String/Buffer], found [%s] %p\n",
577 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
578
579 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
580 }
581 goto NextOperand;
582
583
584 case ARGI_BUFFER_OR_STRING:
585
586 /* Need an operand of type STRING or BUFFER */
587
588 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
589 {
590 case ACPI_TYPE_STRING:
591 case ACPI_TYPE_BUFFER:
592
593 /* Valid operand */
594 break;
595
596 case ACPI_TYPE_INTEGER:
597
598 /* Highest priority conversion is to type Buffer */
599
600 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
601 if (ACPI_FAILURE (Status))
602 {
603 return_ACPI_STATUS (Status);
604 }
605 break;
606
607 default:
608 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
609 "Needed [Integer/String/Buffer], found [%s] %p\n",
610 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
611
612 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
613 }
614 goto NextOperand;
615
616
617 case ARGI_DATAOBJECT:
618 /*
619 * ARGI_DATAOBJECT is only used by the SizeOf operator.
620 * Need a buffer, string, package, or RefOf reference.
621 *
622 * The only reference allowed here is a direct reference to
623 * a namespace node.
624 */
625 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
626 {
627 case ACPI_TYPE_PACKAGE:
628 case ACPI_TYPE_STRING:
629 case ACPI_TYPE_BUFFER:
630 case ACPI_TYPE_LOCAL_REFERENCE:
631
632 /* Valid operand */
633 break;
634
635 default:
636 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
637 "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
638 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
639
640 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
641 }
642 goto NextOperand;
643
644
645 case ARGI_COMPLEXOBJ:
646
647 /* Need a buffer or package or (ACPI 2.0) String */
648
649 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
650 {
651 case ACPI_TYPE_PACKAGE:
652 case ACPI_TYPE_STRING:
653 case ACPI_TYPE_BUFFER:
654
655 /* Valid operand */
656 break;
657
658 default:
659 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
660 "Needed [Buffer/String/Package], found [%s] %p\n",
661 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
662
663 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
664 }
665 goto NextOperand;
666
667
668 case ARGI_REGION_OR_FIELD:
669
670 /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */
671
672 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
673 {
674 case ACPI_TYPE_REGION:
675 case ACPI_TYPE_LOCAL_REGION_FIELD:
676 case ACPI_TYPE_LOCAL_BANK_FIELD:
677 case ACPI_TYPE_LOCAL_INDEX_FIELD:
678
679 /* Valid operand */
680 break;
681
682 default:
683 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
684 "Needed [Region/RegionField], found [%s] %p\n",
685 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
686
687 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
688 }
689 goto NextOperand;
690
691
692 default:
693
694 /* Unknown type */
695
696 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
697 "Internal - Unknown ARGI (required operand) type %X\n",
698 ThisArgType));
699
700 return_ACPI_STATUS (AE_BAD_PARAMETER);
701 }
702
703 /*
704 * Make sure that the original object was resolved to the
705 * required object type (Simple cases only).
706 */
707 Status = AcpiExCheckObjectType (TypeNeeded,
708 ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
709 if (ACPI_FAILURE (Status))
710 {
711 return_ACPI_STATUS (Status);
712 }
713
714NextOperand:
715 /*
716 * If more operands needed, decrement StackPtr to point
717 * to next operand on stack
718 */
719 if (GET_CURRENT_ARG_TYPE (ArgTypes))
720 {
721 StackPtr--;
722 }
723
724 } /* while (*Types) */
725
726 return_ACPI_STATUS (Status);
727}
728
729
258 StackPtr));
259
260 return_ACPI_STATUS (AE_AML_INTERNAL);
261 }
262
263 /* Extract useful items */
264
265 ObjDesc = *StackPtr;
266
267 /* Decode the descriptor type */
268
269 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
270 {
271 case ACPI_DESC_TYPE_NAMED:
272
273 /* Node */
274
275 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
276 break;
277
278
279 case ACPI_DESC_TYPE_OPERAND:
280
281 /* ACPI internal object */
282
283 ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
284
285 /* Check for bad ACPI_OBJECT_TYPE */
286
287 if (!AcpiUtValidObjectType (ObjectType))
288 {
289 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
290 ObjectType));
291
292 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
293 }
294
295 if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
296 {
297 /*
298 * Decode the Reference
299 */
300 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
301 if (OpInfo->Class == AML_CLASS_UNKNOWN)
302 {
303 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
304 }
305
306 switch (ObjDesc->Reference.Opcode)
307 {
308 case AML_DEBUG_OP:
309 case AML_NAME_OP:
310 case AML_INDEX_OP:
311 case AML_REF_OF_OP:
312 case AML_ARG_OP:
313 case AML_LOCAL_OP:
314 case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
315
316 ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
317 "Reference Opcode: %s\n", OpInfo->Name)));
318 break;
319
320 default:
321 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
322 "Unknown Reference Opcode %X [%s]\n",
323 ObjDesc->Reference.Opcode,
324 (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name));
325
326 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
327 }
328 }
329 break;
330
331
332 default:
333
334 /* Invalid descriptor */
335
336 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
337 "Invalid descriptor %p [%s]\n",
338 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
339
340 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
341 }
342
343
344 /*
345 * Get one argument type, point to the next
346 */
347 ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
348 INCREMENT_ARG_LIST (ArgTypes);
349
350 /*
351 * Handle cases where the object does not need to be
352 * resolved to a value
353 */
354 switch (ThisArgType)
355 {
356 case ARGI_REF_OR_STRING: /* Can be a String or Reference */
357
358 if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
359 (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
360 {
361 /*
362 * String found - the string references a named object and must be
363 * resolved to a node
364 */
365 goto NextOperand;
366 }
367
368 /* Else not a string - fall through to the normal Reference case below */
369 /*lint -fallthrough */
370
371 case ARGI_REFERENCE: /* References: */
372 case ARGI_INTEGER_REF:
373 case ARGI_OBJECT_REF:
374 case ARGI_DEVICE_REF:
375 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
376 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
377 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
378
379 /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
380
381 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */
382 {
383 goto NextOperand;
384 }
385
386 Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
387 ObjectType, ObjDesc);
388 if (ACPI_FAILURE (Status))
389 {
390 return_ACPI_STATUS (Status);
391 }
392
393 if (AML_NAME_OP == ObjDesc->Reference.Opcode)
394 {
395 /*
396 * Convert an indirect name ptr to direct name ptr and put
397 * it on the stack
398 */
399 TempNode = ObjDesc->Reference.Object;
400 AcpiUtRemoveReference (ObjDesc);
401 (*StackPtr) = TempNode;
402 }
403 goto NextOperand;
404
405
406 case ARGI_ANYTYPE:
407
408 /*
409 * We don't want to resolve IndexOp reference objects during
410 * a store because this would be an implicit DeRefOf operation.
411 * Instead, we just want to store the reference object.
412 * -- All others must be resolved below.
413 */
414 if ((Opcode == AML_STORE_OP) &&
415 (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
416 ((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
417 {
418 goto NextOperand;
419 }
420 break;
421
422 default:
423 /* All cases covered above */
424 break;
425 }
426
427
428 /*
429 * Resolve this object to a value
430 */
431 Status = AcpiExResolveToValue (StackPtr, WalkState);
432 if (ACPI_FAILURE (Status))
433 {
434 return_ACPI_STATUS (Status);
435 }
436
437 /* Get the resolved object */
438
439 ObjDesc = *StackPtr;
440
441 /*
442 * Check the resulting object (value) type
443 */
444 switch (ThisArgType)
445 {
446 /*
447 * For the simple cases, only one type of resolved object
448 * is allowed
449 */
450 case ARGI_MUTEX:
451
452 /* Need an operand of type ACPI_TYPE_MUTEX */
453
454 TypeNeeded = ACPI_TYPE_MUTEX;
455 break;
456
457 case ARGI_EVENT:
458
459 /* Need an operand of type ACPI_TYPE_EVENT */
460
461 TypeNeeded = ACPI_TYPE_EVENT;
462 break;
463
464 case ARGI_PACKAGE: /* Package */
465
466 /* Need an operand of type ACPI_TYPE_PACKAGE */
467
468 TypeNeeded = ACPI_TYPE_PACKAGE;
469 break;
470
471 case ARGI_ANYTYPE:
472
473 /* Any operand type will do */
474
475 TypeNeeded = ACPI_TYPE_ANY;
476 break;
477
478 case ARGI_DDBHANDLE:
479
480 /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
481
482 TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
483 break;
484
485
486 /*
487 * The more complex cases allow multiple resolved object types
488 */
489 case ARGI_INTEGER: /* Number */
490
491 /*
492 * Need an operand of type ACPI_TYPE_INTEGER,
493 * But we can implicitly convert from a STRING or BUFFER
494 * Aka - "Implicit Source Operand Conversion"
495 */
496 Status = AcpiExConvertToInteger (ObjDesc, StackPtr, WalkState);
497 if (ACPI_FAILURE (Status))
498 {
499 if (Status == AE_TYPE)
500 {
501 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
502 "Needed [Integer/String/Buffer], found [%s] %p\n",
503 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
504
505 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
506 }
507
508 return_ACPI_STATUS (Status);
509 }
510 goto NextOperand;
511
512
513 case ARGI_BUFFER:
514
515 /*
516 * Need an operand of type ACPI_TYPE_BUFFER,
517 * But we can implicitly convert from a STRING or INTEGER
518 * Aka - "Implicit Source Operand Conversion"
519 */
520 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
521 if (ACPI_FAILURE (Status))
522 {
523 if (Status == AE_TYPE)
524 {
525 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
526 "Needed [Integer/String/Buffer], found [%s] %p\n",
527 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
528
529 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
530 }
531
532 return_ACPI_STATUS (Status);
533 }
534 goto NextOperand;
535
536
537 case ARGI_STRING:
538
539 /*
540 * Need an operand of type ACPI_TYPE_STRING,
541 * But we can implicitly convert from a BUFFER or INTEGER
542 * Aka - "Implicit Source Operand Conversion"
543 */
544 Status = AcpiExConvertToString (ObjDesc, StackPtr, 16, ACPI_UINT32_MAX, WalkState);
545 if (ACPI_FAILURE (Status))
546 {
547 if (Status == AE_TYPE)
548 {
549 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
550 "Needed [Integer/String/Buffer], found [%s] %p\n",
551 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
552
553 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
554 }
555
556 return_ACPI_STATUS (Status);
557 }
558 goto NextOperand;
559
560
561 case ARGI_COMPUTEDATA:
562
563 /* Need an operand of type INTEGER, STRING or BUFFER */
564
565 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
566 {
567 case ACPI_TYPE_INTEGER:
568 case ACPI_TYPE_STRING:
569 case ACPI_TYPE_BUFFER:
570
571 /* Valid operand */
572 break;
573
574 default:
575 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
576 "Needed [Integer/String/Buffer], found [%s] %p\n",
577 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
578
579 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
580 }
581 goto NextOperand;
582
583
584 case ARGI_BUFFER_OR_STRING:
585
586 /* Need an operand of type STRING or BUFFER */
587
588 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
589 {
590 case ACPI_TYPE_STRING:
591 case ACPI_TYPE_BUFFER:
592
593 /* Valid operand */
594 break;
595
596 case ACPI_TYPE_INTEGER:
597
598 /* Highest priority conversion is to type Buffer */
599
600 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
601 if (ACPI_FAILURE (Status))
602 {
603 return_ACPI_STATUS (Status);
604 }
605 break;
606
607 default:
608 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
609 "Needed [Integer/String/Buffer], found [%s] %p\n",
610 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
611
612 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
613 }
614 goto NextOperand;
615
616
617 case ARGI_DATAOBJECT:
618 /*
619 * ARGI_DATAOBJECT is only used by the SizeOf operator.
620 * Need a buffer, string, package, or RefOf reference.
621 *
622 * The only reference allowed here is a direct reference to
623 * a namespace node.
624 */
625 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
626 {
627 case ACPI_TYPE_PACKAGE:
628 case ACPI_TYPE_STRING:
629 case ACPI_TYPE_BUFFER:
630 case ACPI_TYPE_LOCAL_REFERENCE:
631
632 /* Valid operand */
633 break;
634
635 default:
636 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
637 "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
638 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
639
640 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
641 }
642 goto NextOperand;
643
644
645 case ARGI_COMPLEXOBJ:
646
647 /* Need a buffer or package or (ACPI 2.0) String */
648
649 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
650 {
651 case ACPI_TYPE_PACKAGE:
652 case ACPI_TYPE_STRING:
653 case ACPI_TYPE_BUFFER:
654
655 /* Valid operand */
656 break;
657
658 default:
659 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
660 "Needed [Buffer/String/Package], found [%s] %p\n",
661 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
662
663 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
664 }
665 goto NextOperand;
666
667
668 case ARGI_REGION_OR_FIELD:
669
670 /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */
671
672 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
673 {
674 case ACPI_TYPE_REGION:
675 case ACPI_TYPE_LOCAL_REGION_FIELD:
676 case ACPI_TYPE_LOCAL_BANK_FIELD:
677 case ACPI_TYPE_LOCAL_INDEX_FIELD:
678
679 /* Valid operand */
680 break;
681
682 default:
683 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
684 "Needed [Region/RegionField], found [%s] %p\n",
685 AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
686
687 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
688 }
689 goto NextOperand;
690
691
692 default:
693
694 /* Unknown type */
695
696 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
697 "Internal - Unknown ARGI (required operand) type %X\n",
698 ThisArgType));
699
700 return_ACPI_STATUS (AE_BAD_PARAMETER);
701 }
702
703 /*
704 * Make sure that the original object was resolved to the
705 * required object type (Simple cases only).
706 */
707 Status = AcpiExCheckObjectType (TypeNeeded,
708 ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
709 if (ACPI_FAILURE (Status))
710 {
711 return_ACPI_STATUS (Status);
712 }
713
714NextOperand:
715 /*
716 * If more operands needed, decrement StackPtr to point
717 * to next operand on stack
718 */
719 if (GET_CURRENT_ARG_TYPE (ArgTypes))
720 {
721 StackPtr--;
722 }
723
724 } /* while (*Types) */
725
726 return_ACPI_STATUS (Status);
727}
728
729