diff options
author | Robert Moore <robert.moore@intel.com> | 2005-04-18 22:49:35 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-12 00:08:52 -0400 |
commit | 44f6c01242da4e162f28d8e1216a8c7a91174605 (patch) | |
tree | 53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/executer/exresop.c | |
parent | ebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff) |
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index"
argument to an ASL function was still (internally) 32
bits instead of the required 64 bits. This was the Index
argument to the Index, Mid, and Match operators.
The "strupr" function is now permanently local
(acpi_ut_strupr), since this is not a POSIX-defined
function and not present in most kernel-level C
libraries. References to the C library strupr function
have been removed from the headers.
Completed the deployment of static
functions/prototypes. All prototypes with the static
attribute have been moved from the headers to the owning
C file.
ACPICA 20050329 from Bob Moore
An error is now generated if an attempt is made to create
a Buffer Field of length zero (A CreateField with a length
operand of zero.)
The interpreter now issues a warning whenever executable
code at the module level is detected during ACPI table
load. This will give some idea of the prevalence of this
type of code.
Implemented support for references to named objects (other
than control methods) within package objects.
Enhanced package object output for the debug
object. Package objects are now completely dumped, showing
all elements.
Enhanced miscellaneous object output for the debug
object. Any object can now be written to the debug object
(for example, a device object can be written, and the type
of the object will be displayed.)
The "static" qualifier has been added to all local
functions across the core subsystem.
The number of "long" lines (> 80 chars) within the source
has been significantly reduced, by about 1/3.
Cleaned up all header files to ensure that all CA/iASL
functions are prototyped (even static functions) and the
formatting is consistent.
Two new header files have been added, acopcode.h and
acnames.h.
Removed several obsolete functions that were no longer
used.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exresop.c')
-rw-r--r-- | drivers/acpi/executer/exresop.c | 80 |
1 files changed, 50 insertions, 30 deletions
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index c92890220c32..d8b470eefe7a 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -52,6 +52,14 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exresop") | 53 | ACPI_MODULE_NAME ("exresop") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ex_check_object_type ( | ||
59 | acpi_object_type type_needed, | ||
60 | acpi_object_type this_type, | ||
61 | void *object); | ||
62 | |||
55 | 63 | ||
56 | /******************************************************************************* | 64 | /******************************************************************************* |
57 | * | 65 | * |
@@ -67,7 +75,7 @@ | |||
67 | * | 75 | * |
68 | ******************************************************************************/ | 76 | ******************************************************************************/ |
69 | 77 | ||
70 | acpi_status | 78 | static acpi_status |
71 | acpi_ex_check_object_type ( | 79 | acpi_ex_check_object_type ( |
72 | acpi_object_type type_needed, | 80 | acpi_object_type type_needed, |
73 | acpi_object_type this_type, | 81 | acpi_object_type this_type, |
@@ -142,6 +150,7 @@ acpi_ex_resolve_operands ( | |||
142 | const struct acpi_opcode_info *op_info; | 150 | const struct acpi_opcode_info *op_info; |
143 | u32 this_arg_type; | 151 | u32 this_arg_type; |
144 | acpi_object_type type_needed; | 152 | acpi_object_type type_needed; |
153 | u16 target_op = 0; | ||
145 | 154 | ||
146 | 155 | ||
147 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); | 156 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); |
@@ -160,7 +169,8 @@ acpi_ex_resolve_operands ( | |||
160 | return_ACPI_STATUS (AE_AML_INTERNAL); | 169 | return_ACPI_STATUS (AE_AML_INTERNAL); |
161 | } | 170 | } |
162 | 171 | ||
163 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", | 172 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
173 | "Opcode %X [%s] required_operand_types=%8.8X \n", | ||
164 | opcode, op_info->name, arg_types)); | 174 | opcode, op_info->name, arg_types)); |
165 | 175 | ||
166 | /* | 176 | /* |
@@ -187,7 +197,7 @@ acpi_ex_resolve_operands ( | |||
187 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 197 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { |
188 | case ACPI_DESC_TYPE_NAMED: | 198 | case ACPI_DESC_TYPE_NAMED: |
189 | 199 | ||
190 | /* Node */ | 200 | /* Namespace Node */ |
191 | 201 | ||
192 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; | 202 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; |
193 | break; | 203 | break; |
@@ -202,16 +212,16 @@ acpi_ex_resolve_operands ( | |||
202 | /* Check for bad acpi_object_type */ | 212 | /* Check for bad acpi_object_type */ |
203 | 213 | ||
204 | if (!acpi_ut_valid_object_type (object_type)) { | 214 | if (!acpi_ut_valid_object_type (object_type)) { |
205 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n", | 215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
216 | "Bad operand object type [%X]\n", | ||
206 | object_type)); | 217 | object_type)); |
207 | 218 | ||
208 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 219 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
209 | } | 220 | } |
210 | 221 | ||
211 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 222 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
212 | /* | 223 | /* Decode the Reference */ |
213 | * Decode the Reference | 224 | |
214 | */ | ||
215 | op_info = acpi_ps_get_opcode_info (opcode); | 225 | op_info = acpi_ps_get_opcode_info (opcode); |
216 | if (op_info->class == AML_CLASS_UNKNOWN) { | 226 | if (op_info->class == AML_CLASS_UNKNOWN) { |
217 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 227 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
@@ -219,12 +229,17 @@ acpi_ex_resolve_operands ( | |||
219 | 229 | ||
220 | switch (obj_desc->reference.opcode) { | 230 | switch (obj_desc->reference.opcode) { |
221 | case AML_DEBUG_OP: | 231 | case AML_DEBUG_OP: |
232 | target_op = AML_DEBUG_OP; | ||
233 | |||
234 | /*lint -fallthrough */ | ||
235 | |||
222 | case AML_NAME_OP: | 236 | case AML_NAME_OP: |
223 | case AML_INDEX_OP: | 237 | case AML_INDEX_OP: |
224 | case AML_REF_OF_OP: | 238 | case AML_REF_OF_OP: |
225 | case AML_ARG_OP: | 239 | case AML_ARG_OP: |
226 | case AML_LOCAL_OP: | 240 | case AML_LOCAL_OP: |
227 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ | 241 | 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 | 243 | ||
229 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 244 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
230 | "Operand is a Reference, ref_opcode [%s]\n", | 245 | "Operand is a Reference, ref_opcode [%s]\n", |
@@ -254,10 +269,8 @@ acpi_ex_resolve_operands ( | |||
254 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 269 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
255 | } | 270 | } |
256 | 271 | ||
272 | /* Get one argument type, point to the next */ | ||
257 | 273 | ||
258 | /* | ||
259 | * Get one argument type, point to the next | ||
260 | */ | ||
261 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); | 274 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); |
262 | INCREMENT_ARG_LIST (arg_types); | 275 | INCREMENT_ARG_LIST (arg_types); |
263 | 276 | ||
@@ -271,26 +284,31 @@ acpi_ex_resolve_operands ( | |||
271 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && | 284 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && |
272 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { | 285 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { |
273 | /* | 286 | /* |
274 | * String found - the string references a named object and must be | 287 | * String found - the string references a named object and |
275 | * resolved to a node | 288 | * must be resolved to a node |
276 | */ | 289 | */ |
277 | goto next_operand; | 290 | goto next_operand; |
278 | } | 291 | } |
279 | 292 | ||
280 | /* Else not a string - fall through to the normal Reference case below */ | 293 | /* |
294 | * Else not a string - fall through to the normal Reference | ||
295 | * case below | ||
296 | */ | ||
281 | /*lint -fallthrough */ | 297 | /*lint -fallthrough */ |
282 | 298 | ||
283 | case ARGI_REFERENCE: /* References: */ | 299 | case ARGI_REFERENCE: /* References: */ |
284 | case ARGI_INTEGER_REF: | 300 | case ARGI_INTEGER_REF: |
285 | case ARGI_OBJECT_REF: | 301 | case ARGI_OBJECT_REF: |
286 | case ARGI_DEVICE_REF: | 302 | case ARGI_DEVICE_REF: |
287 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ | 303 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
288 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ | 304 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
289 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ | 305 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
290 | |||
291 | /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */ | ||
292 | 306 | ||
293 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ { | 307 | /* |
308 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE | ||
309 | * A Namespace Node is OK as-is | ||
310 | */ | ||
311 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | ||
294 | goto next_operand; | 312 | goto next_operand; |
295 | } | 313 | } |
296 | 314 | ||
@@ -300,11 +318,9 @@ acpi_ex_resolve_operands ( | |||
300 | return_ACPI_STATUS (status); | 318 | return_ACPI_STATUS (status); |
301 | } | 319 | } |
302 | 320 | ||
303 | if (AML_NAME_OP == obj_desc->reference.opcode) { | 321 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
304 | /* | 322 | /* Convert a named reference to the actual named object */ |
305 | * Convert an indirect name ptr to direct name ptr and put | 323 | |
306 | * it on the stack | ||
307 | */ | ||
308 | temp_node = obj_desc->reference.object; | 324 | temp_node = obj_desc->reference.object; |
309 | acpi_ut_remove_reference (obj_desc); | 325 | acpi_ut_remove_reference (obj_desc); |
310 | (*stack_ptr) = temp_node; | 326 | (*stack_ptr) = temp_node; |
@@ -332,7 +348,6 @@ acpi_ex_resolve_operands ( | |||
332 | break; | 348 | break; |
333 | } | 349 | } |
334 | 350 | ||
335 | |||
336 | /* | 351 | /* |
337 | * Resolve this object to a value | 352 | * Resolve this object to a value |
338 | */ | 353 | */ |
@@ -392,7 +407,7 @@ acpi_ex_resolve_operands ( | |||
392 | /* | 407 | /* |
393 | * The more complex cases allow multiple resolved object types | 408 | * The more complex cases allow multiple resolved object types |
394 | */ | 409 | */ |
395 | case ARGI_INTEGER: /* Number */ | 410 | case ARGI_INTEGER: |
396 | 411 | ||
397 | /* | 412 | /* |
398 | * Need an operand of type ACPI_TYPE_INTEGER, | 413 | * Need an operand of type ACPI_TYPE_INTEGER, |
@@ -563,7 +578,7 @@ acpi_ex_resolve_operands ( | |||
563 | 578 | ||
564 | case ARGI_REGION_OR_FIELD: | 579 | case ARGI_REGION_OR_FIELD: |
565 | 580 | ||
566 | /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */ | 581 | /* Need an operand of type REGION or a FIELD in a region */ |
567 | 582 | ||
568 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 583 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
569 | case ACPI_TYPE_REGION: | 584 | case ACPI_TYPE_REGION: |
@@ -614,6 +629,12 @@ acpi_ex_resolve_operands ( | |||
614 | break; | 629 | break; |
615 | } | 630 | } |
616 | 631 | ||
632 | if (target_op == AML_DEBUG_OP) { | ||
633 | /* Allow store of any object to the Debug object */ | ||
634 | |||
635 | break; | ||
636 | } | ||
637 | |||
617 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 638 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
618 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", | 639 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", |
619 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 640 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); |
@@ -652,8 +673,7 @@ next_operand: | |||
652 | if (GET_CURRENT_ARG_TYPE (arg_types)) { | 673 | if (GET_CURRENT_ARG_TYPE (arg_types)) { |
653 | stack_ptr--; | 674 | stack_ptr--; |
654 | } | 675 | } |
655 | 676 | } | |
656 | } /* while (*Types) */ | ||
657 | 677 | ||
658 | return_ACPI_STATUS (status); | 678 | return_ACPI_STATUS (status); |
659 | } | 679 | } |