diff options
Diffstat (limited to 'drivers/acpi/executer/exresop.c')
-rw-r--r-- | drivers/acpi/executer/exresop.c | 390 |
1 files changed, 197 insertions, 193 deletions
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index aaba7abcb52d..ff064e79ab90 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -42,24 +42,18 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | #include <acpi/acparser.h> | 47 | #include <acpi/acparser.h> |
49 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exresop") | 51 | ACPI_MODULE_NAME("exresop") |
54 | 52 | ||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static acpi_status | 54 | static acpi_status |
58 | acpi_ex_check_object_type ( | 55 | acpi_ex_check_object_type(acpi_object_type type_needed, |
59 | acpi_object_type type_needed, | 56 | acpi_object_type this_type, void *object); |
60 | acpi_object_type this_type, | ||
61 | void *object); | ||
62 | |||
63 | 57 | ||
64 | /******************************************************************************* | 58 | /******************************************************************************* |
65 | * | 59 | * |
@@ -76,13 +70,10 @@ acpi_ex_check_object_type ( | |||
76 | ******************************************************************************/ | 70 | ******************************************************************************/ |
77 | 71 | ||
78 | static acpi_status | 72 | static acpi_status |
79 | acpi_ex_check_object_type ( | 73 | acpi_ex_check_object_type(acpi_object_type type_needed, |
80 | acpi_object_type type_needed, | 74 | acpi_object_type this_type, void *object) |
81 | acpi_object_type this_type, | ||
82 | void *object) | ||
83 | { | 75 | { |
84 | ACPI_FUNCTION_NAME ("ex_check_object_type"); | 76 | ACPI_FUNCTION_NAME("ex_check_object_type"); |
85 | |||
86 | 77 | ||
87 | if (type_needed == ACPI_TYPE_ANY) { | 78 | if (type_needed == ACPI_TYPE_ANY) { |
88 | /* All types OK, so we don't perform any typechecks */ | 79 | /* All types OK, so we don't perform any typechecks */ |
@@ -97,16 +88,17 @@ acpi_ex_check_object_type ( | |||
97 | * specification, a store to a constant is a noop.) | 88 | * specification, a store to a constant is a noop.) |
98 | */ | 89 | */ |
99 | if ((this_type == ACPI_TYPE_INTEGER) && | 90 | if ((this_type == ACPI_TYPE_INTEGER) && |
100 | (((union acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) { | 91 | (((union acpi_operand_object *)object)->common. |
92 | flags & AOPOBJ_AML_CONSTANT)) { | ||
101 | return (AE_OK); | 93 | return (AE_OK); |
102 | } | 94 | } |
103 | } | 95 | } |
104 | 96 | ||
105 | if (type_needed != this_type) { | 97 | if (type_needed != this_type) { |
106 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 98 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
107 | "Needed [%s], found [%s] %p\n", | 99 | "Needed [%s], found [%s] %p\n", |
108 | acpi_ut_get_type_name (type_needed), | 100 | acpi_ut_get_type_name(type_needed), |
109 | acpi_ut_get_type_name (this_type), object)); | 101 | acpi_ut_get_type_name(this_type), object)); |
110 | 102 | ||
111 | return (AE_AML_OPERAND_TYPE); | 103 | return (AE_AML_OPERAND_TYPE); |
112 | } | 104 | } |
@@ -114,7 +106,6 @@ acpi_ex_check_object_type ( | |||
114 | return (AE_OK); | 106 | return (AE_OK); |
115 | } | 107 | } |
116 | 108 | ||
117 | |||
118 | /******************************************************************************* | 109 | /******************************************************************************* |
119 | * | 110 | * |
120 | * FUNCTION: acpi_ex_resolve_operands | 111 | * FUNCTION: acpi_ex_resolve_operands |
@@ -137,41 +128,37 @@ acpi_ex_check_object_type ( | |||
137 | ******************************************************************************/ | 128 | ******************************************************************************/ |
138 | 129 | ||
139 | acpi_status | 130 | acpi_status |
140 | acpi_ex_resolve_operands ( | 131 | acpi_ex_resolve_operands(u16 opcode, |
141 | u16 opcode, | 132 | union acpi_operand_object ** stack_ptr, |
142 | union acpi_operand_object **stack_ptr, | 133 | struct acpi_walk_state * walk_state) |
143 | struct acpi_walk_state *walk_state) | ||
144 | { | 134 | { |
145 | union acpi_operand_object *obj_desc; | 135 | union acpi_operand_object *obj_desc; |
146 | acpi_status status = AE_OK; | 136 | acpi_status status = AE_OK; |
147 | u8 object_type; | 137 | u8 object_type; |
148 | void *temp_node; | 138 | void *temp_node; |
149 | u32 arg_types; | 139 | u32 arg_types; |
150 | const struct acpi_opcode_info *op_info; | 140 | const struct acpi_opcode_info *op_info; |
151 | u32 this_arg_type; | 141 | u32 this_arg_type; |
152 | acpi_object_type type_needed; | 142 | acpi_object_type type_needed; |
153 | u16 target_op = 0; | 143 | u16 target_op = 0; |
154 | 144 | ||
155 | 145 | ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); | |
156 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); | 146 | |
157 | 147 | op_info = acpi_ps_get_opcode_info(opcode); | |
158 | |||
159 | op_info = acpi_ps_get_opcode_info (opcode); | ||
160 | if (op_info->class == AML_CLASS_UNKNOWN) { | 148 | if (op_info->class == AML_CLASS_UNKNOWN) { |
161 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 149 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
162 | } | 150 | } |
163 | 151 | ||
164 | arg_types = op_info->runtime_args; | 152 | arg_types = op_info->runtime_args; |
165 | if (arg_types == ARGI_INVALID_OPCODE) { | 153 | if (arg_types == ARGI_INVALID_OPCODE) { |
166 | ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n", | 154 | ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); |
167 | opcode)); | ||
168 | 155 | ||
169 | return_ACPI_STATUS (AE_AML_INTERNAL); | 156 | return_ACPI_STATUS(AE_AML_INTERNAL); |
170 | } | 157 | } |
171 | 158 | ||
172 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 159 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
173 | "Opcode %X [%s] required_operand_types=%8.8X \n", | 160 | "Opcode %X [%s] required_operand_types=%8.8X \n", |
174 | opcode, op_info->name, arg_types)); | 161 | opcode, op_info->name, arg_types)); |
175 | 162 | ||
176 | /* | 163 | /* |
177 | * Normal exit is with (arg_types == 0) at end of argument list. | 164 | * Normal exit is with (arg_types == 0) at end of argument list. |
@@ -180,12 +167,11 @@ acpi_ex_resolve_operands ( | |||
180 | * to) the required type; if stack underflows; or upon | 167 | * to) the required type; if stack underflows; or upon |
181 | * finding a NULL stack entry (which should not happen). | 168 | * finding a NULL stack entry (which should not happen). |
182 | */ | 169 | */ |
183 | while (GET_CURRENT_ARG_TYPE (arg_types)) { | 170 | while (GET_CURRENT_ARG_TYPE(arg_types)) { |
184 | if (!stack_ptr || !*stack_ptr) { | 171 | if (!stack_ptr || !*stack_ptr) { |
185 | ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n", | 172 | ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); |
186 | stack_ptr)); | ||
187 | 173 | ||
188 | return_ACPI_STATUS (AE_AML_INTERNAL); | 174 | return_ACPI_STATUS(AE_AML_INTERNAL); |
189 | } | 175 | } |
190 | 176 | ||
191 | /* Extract useful items */ | 177 | /* Extract useful items */ |
@@ -194,37 +180,37 @@ acpi_ex_resolve_operands ( | |||
194 | 180 | ||
195 | /* Decode the descriptor type */ | 181 | /* Decode the descriptor type */ |
196 | 182 | ||
197 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 183 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
198 | case ACPI_DESC_TYPE_NAMED: | 184 | case ACPI_DESC_TYPE_NAMED: |
199 | 185 | ||
200 | /* Namespace Node */ | 186 | /* Namespace Node */ |
201 | 187 | ||
202 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; | 188 | object_type = |
189 | ((struct acpi_namespace_node *)obj_desc)->type; | ||
203 | break; | 190 | break; |
204 | 191 | ||
205 | |||
206 | case ACPI_DESC_TYPE_OPERAND: | 192 | case ACPI_DESC_TYPE_OPERAND: |
207 | 193 | ||
208 | /* ACPI internal object */ | 194 | /* ACPI internal object */ |
209 | 195 | ||
210 | object_type = ACPI_GET_OBJECT_TYPE (obj_desc); | 196 | object_type = ACPI_GET_OBJECT_TYPE(obj_desc); |
211 | 197 | ||
212 | /* Check for bad acpi_object_type */ | 198 | /* Check for bad acpi_object_type */ |
213 | 199 | ||
214 | if (!acpi_ut_valid_object_type (object_type)) { | 200 | if (!acpi_ut_valid_object_type(object_type)) { |
215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 201 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
216 | "Bad operand object type [%X]\n", | 202 | "Bad operand object type [%X]\n", |
217 | object_type)); | 203 | object_type)); |
218 | 204 | ||
219 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 205 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
220 | } | 206 | } |
221 | 207 | ||
222 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 208 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
223 | /* Decode the Reference */ | 209 | /* Decode the Reference */ |
224 | 210 | ||
225 | op_info = acpi_ps_get_opcode_info (opcode); | 211 | op_info = acpi_ps_get_opcode_info(opcode); |
226 | if (op_info->class == AML_CLASS_UNKNOWN) { | 212 | if (op_info->class == AML_CLASS_UNKNOWN) { |
227 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 213 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
228 | } | 214 | } |
229 | 215 | ||
230 | switch (obj_desc->reference.opcode) { | 216 | switch (obj_desc->reference.opcode) { |
@@ -238,51 +224,62 @@ acpi_ex_resolve_operands ( | |||
238 | case AML_REF_OF_OP: | 224 | case AML_REF_OF_OP: |
239 | case AML_ARG_OP: | 225 | case AML_ARG_OP: |
240 | case AML_LOCAL_OP: | 226 | case AML_LOCAL_OP: |
241 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ | 227 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
242 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 228 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
243 | 229 | ||
244 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 230 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
245 | "Operand is a Reference, ref_opcode [%s]\n", | 231 | ((ACPI_DB_EXEC, |
246 | (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name))); | 232 | "Operand is a Reference, ref_opcode [%s]\n", |
233 | (acpi_ps_get_opcode_info | ||
234 | (obj_desc-> | ||
235 | reference. | ||
236 | opcode))-> | ||
237 | name))); | ||
247 | break; | 238 | break; |
248 | 239 | ||
249 | default: | 240 | default: |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 241 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
251 | "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", | 242 | "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", |
252 | obj_desc->reference.opcode, | 243 | obj_desc->reference. |
253 | (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)); | 244 | opcode, |
254 | 245 | (acpi_ps_get_opcode_info | |
255 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 246 | (obj_desc->reference. |
247 | opcode))->name)); | ||
248 | |||
249 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
256 | } | 250 | } |
257 | } | 251 | } |
258 | break; | 252 | break; |
259 | 253 | ||
260 | |||
261 | default: | 254 | default: |
262 | 255 | ||
263 | /* Invalid descriptor */ | 256 | /* Invalid descriptor */ |
264 | 257 | ||
265 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 258 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
266 | "Invalid descriptor %p [%s]\n", | 259 | "Invalid descriptor %p [%s]\n", |
267 | obj_desc, acpi_ut_get_descriptor_name (obj_desc))); | 260 | obj_desc, |
261 | acpi_ut_get_descriptor_name | ||
262 | (obj_desc))); | ||
268 | 263 | ||
269 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 264 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
270 | } | 265 | } |
271 | 266 | ||
272 | /* Get one argument type, point to the next */ | 267 | /* Get one argument type, point to the next */ |
273 | 268 | ||
274 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); | 269 | this_arg_type = GET_CURRENT_ARG_TYPE(arg_types); |
275 | INCREMENT_ARG_LIST (arg_types); | 270 | INCREMENT_ARG_LIST(arg_types); |
276 | 271 | ||
277 | /* | 272 | /* |
278 | * Handle cases where the object does not need to be | 273 | * Handle cases where the object does not need to be |
279 | * resolved to a value | 274 | * resolved to a value |
280 | */ | 275 | */ |
281 | switch (this_arg_type) { | 276 | switch (this_arg_type) { |
282 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ | 277 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ |
283 | 278 | ||
284 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && | 279 | if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
285 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { | 280 | ACPI_DESC_TYPE_OPERAND) |
281 | && (ACPI_GET_OBJECT_TYPE(obj_desc) == | ||
282 | ACPI_TYPE_STRING)) { | ||
286 | /* | 283 | /* |
287 | * String found - the string references a named object and | 284 | * String found - the string references a named object and |
288 | * must be resolved to a node | 285 | * must be resolved to a node |
@@ -296,39 +293,40 @@ acpi_ex_resolve_operands ( | |||
296 | */ | 293 | */ |
297 | /*lint -fallthrough */ | 294 | /*lint -fallthrough */ |
298 | 295 | ||
299 | case ARGI_REFERENCE: /* References: */ | 296 | case ARGI_REFERENCE: /* References: */ |
300 | case ARGI_INTEGER_REF: | 297 | case ARGI_INTEGER_REF: |
301 | case ARGI_OBJECT_REF: | 298 | case ARGI_OBJECT_REF: |
302 | case ARGI_DEVICE_REF: | 299 | case ARGI_DEVICE_REF: |
303 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ | 300 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
304 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ | 301 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
305 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ | 302 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
306 | 303 | ||
307 | /* | 304 | /* |
308 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE | 305 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE |
309 | * A Namespace Node is OK as-is | 306 | * A Namespace Node is OK as-is |
310 | */ | 307 | */ |
311 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | 308 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
309 | ACPI_DESC_TYPE_NAMED) { | ||
312 | goto next_operand; | 310 | goto next_operand; |
313 | } | 311 | } |
314 | 312 | ||
315 | status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE, | 313 | status = |
316 | object_type, obj_desc); | 314 | acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE, |
317 | if (ACPI_FAILURE (status)) { | 315 | object_type, obj_desc); |
318 | return_ACPI_STATUS (status); | 316 | if (ACPI_FAILURE(status)) { |
317 | return_ACPI_STATUS(status); | ||
319 | } | 318 | } |
320 | 319 | ||
321 | if (obj_desc->reference.opcode == AML_NAME_OP) { | 320 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
322 | /* Convert a named reference to the actual named object */ | 321 | /* Convert a named reference to the actual named object */ |
323 | 322 | ||
324 | temp_node = obj_desc->reference.object; | 323 | temp_node = obj_desc->reference.object; |
325 | acpi_ut_remove_reference (obj_desc); | 324 | acpi_ut_remove_reference(obj_desc); |
326 | (*stack_ptr) = temp_node; | 325 | (*stack_ptr) = temp_node; |
327 | } | 326 | } |
328 | goto next_operand; | 327 | goto next_operand; |
329 | 328 | ||
330 | 329 | case ARGI_DATAREFOBJ: /* Store operator only */ | |
331 | case ARGI_DATAREFOBJ: /* Store operator only */ | ||
332 | 330 | ||
333 | /* | 331 | /* |
334 | * We don't want to resolve index_op reference objects during | 332 | * We don't want to resolve index_op reference objects during |
@@ -337,8 +335,10 @@ acpi_ex_resolve_operands ( | |||
337 | * -- All others must be resolved below. | 335 | * -- All others must be resolved below. |
338 | */ | 336 | */ |
339 | if ((opcode == AML_STORE_OP) && | 337 | if ((opcode == AML_STORE_OP) && |
340 | (ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) && | 338 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == |
341 | ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { | 339 | ACPI_TYPE_LOCAL_REFERENCE) |
340 | && ((*stack_ptr)->reference.opcode == | ||
341 | AML_INDEX_OP)) { | ||
342 | goto next_operand; | 342 | goto next_operand; |
343 | } | 343 | } |
344 | break; | 344 | break; |
@@ -351,9 +351,9 @@ acpi_ex_resolve_operands ( | |||
351 | /* | 351 | /* |
352 | * Resolve this object to a value | 352 | * Resolve this object to a value |
353 | */ | 353 | */ |
354 | status = acpi_ex_resolve_to_value (stack_ptr, walk_state); | 354 | status = acpi_ex_resolve_to_value(stack_ptr, walk_state); |
355 | if (ACPI_FAILURE (status)) { | 355 | if (ACPI_FAILURE(status)) { |
356 | return_ACPI_STATUS (status); | 356 | return_ACPI_STATUS(status); |
357 | } | 357 | } |
358 | 358 | ||
359 | /* Get the resolved object */ | 359 | /* Get the resolved object */ |
@@ -364,10 +364,10 @@ acpi_ex_resolve_operands ( | |||
364 | * Check the resulting object (value) type | 364 | * Check the resulting object (value) type |
365 | */ | 365 | */ |
366 | switch (this_arg_type) { | 366 | switch (this_arg_type) { |
367 | /* | 367 | /* |
368 | * For the simple cases, only one type of resolved object | 368 | * For the simple cases, only one type of resolved object |
369 | * is allowed | 369 | * is allowed |
370 | */ | 370 | */ |
371 | case ARGI_MUTEX: | 371 | case ARGI_MUTEX: |
372 | 372 | ||
373 | /* Need an operand of type ACPI_TYPE_MUTEX */ | 373 | /* Need an operand of type ACPI_TYPE_MUTEX */ |
@@ -382,7 +382,7 @@ acpi_ex_resolve_operands ( | |||
382 | type_needed = ACPI_TYPE_EVENT; | 382 | type_needed = ACPI_TYPE_EVENT; |
383 | break; | 383 | break; |
384 | 384 | ||
385 | case ARGI_PACKAGE: /* Package */ | 385 | case ARGI_PACKAGE: /* Package */ |
386 | 386 | ||
387 | /* Need an operand of type ACPI_TYPE_PACKAGE */ | 387 | /* Need an operand of type ACPI_TYPE_PACKAGE */ |
388 | 388 | ||
@@ -403,10 +403,9 @@ acpi_ex_resolve_operands ( | |||
403 | type_needed = ACPI_TYPE_LOCAL_REFERENCE; | 403 | type_needed = ACPI_TYPE_LOCAL_REFERENCE; |
404 | break; | 404 | break; |
405 | 405 | ||
406 | 406 | /* | |
407 | /* | 407 | * The more complex cases allow multiple resolved object types |
408 | * The more complex cases allow multiple resolved object types | 408 | */ |
409 | */ | ||
410 | case ARGI_INTEGER: | 409 | case ARGI_INTEGER: |
411 | 410 | ||
412 | /* | 411 | /* |
@@ -414,25 +413,27 @@ acpi_ex_resolve_operands ( | |||
414 | * But we can implicitly convert from a STRING or BUFFER | 413 | * But we can implicitly convert from a STRING or BUFFER |
415 | * Aka - "Implicit Source Operand Conversion" | 414 | * Aka - "Implicit Source Operand Conversion" |
416 | */ | 415 | */ |
417 | status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16); | 416 | status = |
418 | if (ACPI_FAILURE (status)) { | 417 | acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); |
418 | if (ACPI_FAILURE(status)) { | ||
419 | if (status == AE_TYPE) { | 419 | if (status == AE_TYPE) { |
420 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 420 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
421 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 421 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
422 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 422 | acpi_ut_get_object_type_name |
423 | (obj_desc), | ||
424 | obj_desc)); | ||
423 | 425 | ||
424 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 426 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
425 | } | 427 | } |
426 | 428 | ||
427 | return_ACPI_STATUS (status); | 429 | return_ACPI_STATUS(status); |
428 | } | 430 | } |
429 | 431 | ||
430 | if (obj_desc != *stack_ptr) { | 432 | if (obj_desc != *stack_ptr) { |
431 | acpi_ut_remove_reference (obj_desc); | 433 | acpi_ut_remove_reference(obj_desc); |
432 | } | 434 | } |
433 | goto next_operand; | 435 | goto next_operand; |
434 | 436 | ||
435 | |||
436 | case ARGI_BUFFER: | 437 | case ARGI_BUFFER: |
437 | 438 | ||
438 | /* | 439 | /* |
@@ -440,25 +441,26 @@ acpi_ex_resolve_operands ( | |||
440 | * But we can implicitly convert from a STRING or INTEGER | 441 | * But we can implicitly convert from a STRING or INTEGER |
441 | * Aka - "Implicit Source Operand Conversion" | 442 | * Aka - "Implicit Source Operand Conversion" |
442 | */ | 443 | */ |
443 | status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); | 444 | status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); |
444 | if (ACPI_FAILURE (status)) { | 445 | if (ACPI_FAILURE(status)) { |
445 | if (status == AE_TYPE) { | 446 | if (status == AE_TYPE) { |
446 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 447 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
447 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 448 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
448 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 449 | acpi_ut_get_object_type_name |
450 | (obj_desc), | ||
451 | obj_desc)); | ||
449 | 452 | ||
450 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 453 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
451 | } | 454 | } |
452 | 455 | ||
453 | return_ACPI_STATUS (status); | 456 | return_ACPI_STATUS(status); |
454 | } | 457 | } |
455 | 458 | ||
456 | if (obj_desc != *stack_ptr) { | 459 | if (obj_desc != *stack_ptr) { |
457 | acpi_ut_remove_reference (obj_desc); | 460 | acpi_ut_remove_reference(obj_desc); |
458 | } | 461 | } |
459 | goto next_operand; | 462 | goto next_operand; |
460 | 463 | ||
461 | |||
462 | case ARGI_STRING: | 464 | case ARGI_STRING: |
463 | 465 | ||
464 | /* | 466 | /* |
@@ -466,83 +468,86 @@ acpi_ex_resolve_operands ( | |||
466 | * But we can implicitly convert from a BUFFER or INTEGER | 468 | * But we can implicitly convert from a BUFFER or INTEGER |
467 | * Aka - "Implicit Source Operand Conversion" | 469 | * Aka - "Implicit Source Operand Conversion" |
468 | */ | 470 | */ |
469 | status = acpi_ex_convert_to_string (obj_desc, stack_ptr, | 471 | status = acpi_ex_convert_to_string(obj_desc, stack_ptr, |
470 | ACPI_IMPLICIT_CONVERT_HEX); | 472 | ACPI_IMPLICIT_CONVERT_HEX); |
471 | if (ACPI_FAILURE (status)) { | 473 | if (ACPI_FAILURE(status)) { |
472 | if (status == AE_TYPE) { | 474 | if (status == AE_TYPE) { |
473 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 475 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
474 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 476 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
475 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 477 | acpi_ut_get_object_type_name |
478 | (obj_desc), | ||
479 | obj_desc)); | ||
476 | 480 | ||
477 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 481 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
478 | } | 482 | } |
479 | 483 | ||
480 | return_ACPI_STATUS (status); | 484 | return_ACPI_STATUS(status); |
481 | } | 485 | } |
482 | 486 | ||
483 | if (obj_desc != *stack_ptr) { | 487 | if (obj_desc != *stack_ptr) { |
484 | acpi_ut_remove_reference (obj_desc); | 488 | acpi_ut_remove_reference(obj_desc); |
485 | } | 489 | } |
486 | goto next_operand; | 490 | goto next_operand; |
487 | 491 | ||
488 | |||
489 | case ARGI_COMPUTEDATA: | 492 | case ARGI_COMPUTEDATA: |
490 | 493 | ||
491 | /* Need an operand of type INTEGER, STRING or BUFFER */ | 494 | /* Need an operand of type INTEGER, STRING or BUFFER */ |
492 | 495 | ||
493 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 496 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
494 | case ACPI_TYPE_INTEGER: | 497 | case ACPI_TYPE_INTEGER: |
495 | case ACPI_TYPE_STRING: | 498 | case ACPI_TYPE_STRING: |
496 | case ACPI_TYPE_BUFFER: | 499 | case ACPI_TYPE_BUFFER: |
497 | 500 | ||
498 | /* Valid operand */ | 501 | /* Valid operand */ |
499 | break; | 502 | break; |
500 | 503 | ||
501 | default: | 504 | default: |
502 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 505 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
503 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 506 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
504 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 507 | acpi_ut_get_object_type_name |
508 | (obj_desc), obj_desc)); | ||
505 | 509 | ||
506 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 510 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
507 | } | 511 | } |
508 | goto next_operand; | 512 | goto next_operand; |
509 | 513 | ||
510 | |||
511 | case ARGI_BUFFER_OR_STRING: | 514 | case ARGI_BUFFER_OR_STRING: |
512 | 515 | ||
513 | /* Need an operand of type STRING or BUFFER */ | 516 | /* Need an operand of type STRING or BUFFER */ |
514 | 517 | ||
515 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 518 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
516 | case ACPI_TYPE_STRING: | 519 | case ACPI_TYPE_STRING: |
517 | case ACPI_TYPE_BUFFER: | 520 | case ACPI_TYPE_BUFFER: |
518 | 521 | ||
519 | /* Valid operand */ | 522 | /* Valid operand */ |
520 | break; | 523 | break; |
521 | 524 | ||
522 | case ACPI_TYPE_INTEGER: | 525 | case ACPI_TYPE_INTEGER: |
523 | 526 | ||
524 | /* Highest priority conversion is to type Buffer */ | 527 | /* Highest priority conversion is to type Buffer */ |
525 | 528 | ||
526 | status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); | 529 | status = |
527 | if (ACPI_FAILURE (status)) { | 530 | acpi_ex_convert_to_buffer(obj_desc, |
528 | return_ACPI_STATUS (status); | 531 | stack_ptr); |
532 | if (ACPI_FAILURE(status)) { | ||
533 | return_ACPI_STATUS(status); | ||
529 | } | 534 | } |
530 | 535 | ||
531 | if (obj_desc != *stack_ptr) { | 536 | if (obj_desc != *stack_ptr) { |
532 | acpi_ut_remove_reference (obj_desc); | 537 | acpi_ut_remove_reference(obj_desc); |
533 | } | 538 | } |
534 | break; | 539 | break; |
535 | 540 | ||
536 | default: | 541 | default: |
537 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 542 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
538 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 543 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
539 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 544 | acpi_ut_get_object_type_name |
545 | (obj_desc), obj_desc)); | ||
540 | 546 | ||
541 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 547 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
542 | } | 548 | } |
543 | goto next_operand; | 549 | goto next_operand; |
544 | 550 | ||
545 | |||
546 | case ARGI_DATAOBJECT: | 551 | case ARGI_DATAOBJECT: |
547 | /* | 552 | /* |
548 | * ARGI_DATAOBJECT is only used by the size_of operator. | 553 | * ARGI_DATAOBJECT is only used by the size_of operator. |
@@ -551,7 +556,7 @@ acpi_ex_resolve_operands ( | |||
551 | * The only reference allowed here is a direct reference to | 556 | * The only reference allowed here is a direct reference to |
552 | * a namespace node. | 557 | * a namespace node. |
553 | */ | 558 | */ |
554 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 559 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
555 | case ACPI_TYPE_PACKAGE: | 560 | case ACPI_TYPE_PACKAGE: |
556 | case ACPI_TYPE_STRING: | 561 | case ACPI_TYPE_STRING: |
557 | case ACPI_TYPE_BUFFER: | 562 | case ACPI_TYPE_BUFFER: |
@@ -561,20 +566,20 @@ acpi_ex_resolve_operands ( | |||
561 | break; | 566 | break; |
562 | 567 | ||
563 | default: | 568 | default: |
564 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 569 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
565 | "Needed [Buffer/String/Package/Reference], found [%s] %p\n", | 570 | "Needed [Buffer/String/Package/Reference], found [%s] %p\n", |
566 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 571 | acpi_ut_get_object_type_name |
572 | (obj_desc), obj_desc)); | ||
567 | 573 | ||
568 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 574 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
569 | } | 575 | } |
570 | goto next_operand; | 576 | goto next_operand; |
571 | 577 | ||
572 | |||
573 | case ARGI_COMPLEXOBJ: | 578 | case ARGI_COMPLEXOBJ: |
574 | 579 | ||
575 | /* Need a buffer or package or (ACPI 2.0) String */ | 580 | /* Need a buffer or package or (ACPI 2.0) String */ |
576 | 581 | ||
577 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 582 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
578 | case ACPI_TYPE_PACKAGE: | 583 | case ACPI_TYPE_PACKAGE: |
579 | case ACPI_TYPE_STRING: | 584 | case ACPI_TYPE_STRING: |
580 | case ACPI_TYPE_BUFFER: | 585 | case ACPI_TYPE_BUFFER: |
@@ -583,20 +588,20 @@ acpi_ex_resolve_operands ( | |||
583 | break; | 588 | break; |
584 | 589 | ||
585 | default: | 590 | default: |
586 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 591 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
587 | "Needed [Buffer/String/Package], found [%s] %p\n", | 592 | "Needed [Buffer/String/Package], found [%s] %p\n", |
588 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 593 | acpi_ut_get_object_type_name |
594 | (obj_desc), obj_desc)); | ||
589 | 595 | ||
590 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 596 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
591 | } | 597 | } |
592 | goto next_operand; | 598 | goto next_operand; |
593 | 599 | ||
594 | |||
595 | case ARGI_REGION_OR_FIELD: | 600 | case ARGI_REGION_OR_FIELD: |
596 | 601 | ||
597 | /* Need an operand of type REGION or a FIELD in a region */ | 602 | /* Need an operand of type REGION or a FIELD in a region */ |
598 | 603 | ||
599 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 604 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
600 | case ACPI_TYPE_REGION: | 605 | case ACPI_TYPE_REGION: |
601 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 606 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
602 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 607 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
@@ -606,20 +611,20 @@ acpi_ex_resolve_operands ( | |||
606 | break; | 611 | break; |
607 | 612 | ||
608 | default: | 613 | default: |
609 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 614 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
610 | "Needed [Region/region_field], found [%s] %p\n", | 615 | "Needed [Region/region_field], found [%s] %p\n", |
611 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 616 | acpi_ut_get_object_type_name |
617 | (obj_desc), obj_desc)); | ||
612 | 618 | ||
613 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 619 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
614 | } | 620 | } |
615 | goto next_operand; | 621 | goto next_operand; |
616 | 622 | ||
617 | |||
618 | case ARGI_DATAREFOBJ: | 623 | case ARGI_DATAREFOBJ: |
619 | 624 | ||
620 | /* Used by the Store() operator only */ | 625 | /* Used by the Store() operator only */ |
621 | 626 | ||
622 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 627 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
623 | case ACPI_TYPE_INTEGER: | 628 | case ACPI_TYPE_INTEGER: |
624 | case ACPI_TYPE_PACKAGE: | 629 | case ACPI_TYPE_PACKAGE: |
625 | case ACPI_TYPE_STRING: | 630 | case ACPI_TYPE_STRING: |
@@ -651,47 +656,46 @@ acpi_ex_resolve_operands ( | |||
651 | break; | 656 | break; |
652 | } | 657 | } |
653 | 658 | ||
654 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 659 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
655 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", | 660 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", |
656 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 661 | acpi_ut_get_object_type_name |
662 | (obj_desc), obj_desc)); | ||
657 | 663 | ||
658 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 664 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
659 | } | 665 | } |
660 | goto next_operand; | 666 | goto next_operand; |
661 | 667 | ||
662 | |||
663 | default: | 668 | default: |
664 | 669 | ||
665 | /* Unknown type */ | 670 | /* Unknown type */ |
666 | 671 | ||
667 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 672 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
668 | "Internal - Unknown ARGI (required operand) type %X\n", | 673 | "Internal - Unknown ARGI (required operand) type %X\n", |
669 | this_arg_type)); | 674 | this_arg_type)); |
670 | 675 | ||
671 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 676 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
672 | } | 677 | } |
673 | 678 | ||
674 | /* | 679 | /* |
675 | * Make sure that the original object was resolved to the | 680 | * Make sure that the original object was resolved to the |
676 | * required object type (Simple cases only). | 681 | * required object type (Simple cases only). |
677 | */ | 682 | */ |
678 | status = acpi_ex_check_object_type (type_needed, | 683 | status = acpi_ex_check_object_type(type_needed, |
679 | ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr); | 684 | ACPI_GET_OBJECT_TYPE |
680 | if (ACPI_FAILURE (status)) { | 685 | (*stack_ptr), *stack_ptr); |
681 | return_ACPI_STATUS (status); | 686 | if (ACPI_FAILURE(status)) { |
687 | return_ACPI_STATUS(status); | ||
682 | } | 688 | } |
683 | 689 | ||
684 | next_operand: | 690 | next_operand: |
685 | /* | 691 | /* |
686 | * If more operands needed, decrement stack_ptr to point | 692 | * If more operands needed, decrement stack_ptr to point |
687 | * to next operand on stack | 693 | * to next operand on stack |
688 | */ | 694 | */ |
689 | if (GET_CURRENT_ARG_TYPE (arg_types)) { | 695 | if (GET_CURRENT_ARG_TYPE(arg_types)) { |
690 | stack_ptr--; | 696 | stack_ptr--; |
691 | } | 697 | } |
692 | } | 698 | } |
693 | 699 | ||
694 | return_ACPI_STATUS (status); | 700 | return_ACPI_STATUS(status); |
695 | } | 701 | } |
696 | |||
697 | |||