diff options
Diffstat (limited to 'drivers/acpi/dispatcher')
| -rw-r--r-- | drivers/acpi/dispatcher/dsfield.c | 13 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dsinit.c | 6 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 232 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dsmthdat.c | 43 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dsobject.c | 25 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dsopcode.c | 63 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dsutils.c | 25 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dswexec.c | 26 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dswload.c | 67 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dswscope.c | 10 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dswstate.c | 72 |
11 files changed, 361 insertions, 221 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 76bc0463f6de..a6d77efb41a0 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
| @@ -87,7 +87,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
| 87 | union acpi_operand_object *second_desc = NULL; | 87 | union acpi_operand_object *second_desc = NULL; |
| 88 | u32 flags; | 88 | u32 flags; |
| 89 | 89 | ||
| 90 | ACPI_FUNCTION_TRACE("ds_create_buffer_field"); | 90 | ACPI_FUNCTION_TRACE(ds_create_buffer_field); |
| 91 | 91 | ||
| 92 | /* Get the name_string argument */ | 92 | /* Get the name_string argument */ |
| 93 | 93 | ||
| @@ -210,7 +210,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 210 | acpi_status status; | 210 | acpi_status status; |
| 211 | acpi_integer position; | 211 | acpi_integer position; |
| 212 | 212 | ||
| 213 | ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); | 213 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); |
| 214 | 214 | ||
| 215 | /* First field starts at bit zero */ | 215 | /* First field starts at bit zero */ |
| 216 | 216 | ||
| @@ -342,7 +342,7 @@ acpi_ds_create_field(union acpi_parse_object *op, | |||
| 342 | union acpi_parse_object *arg; | 342 | union acpi_parse_object *arg; |
| 343 | struct acpi_create_field_info info; | 343 | struct acpi_create_field_info info; |
| 344 | 344 | ||
| 345 | ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); | 345 | ACPI_FUNCTION_TRACE_PTR(ds_create_field, op); |
| 346 | 346 | ||
| 347 | /* First arg is the name of the parent op_region (must already exist) */ | 347 | /* First arg is the name of the parent op_region (must already exist) */ |
| 348 | 348 | ||
| @@ -399,7 +399,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
| 399 | struct acpi_namespace_node *node; | 399 | struct acpi_namespace_node *node; |
| 400 | u8 type = 0; | 400 | u8 type = 0; |
| 401 | 401 | ||
| 402 | ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); |
| 403 | 403 | ||
| 404 | switch (walk_state->opcode) { | 404 | switch (walk_state->opcode) { |
| 405 | case AML_FIELD_OP: | 405 | case AML_FIELD_OP: |
| @@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
| 425 | * Walk the list of entries in the field_list | 425 | * Walk the list of entries in the field_list |
| 426 | */ | 426 | */ |
| 427 | while (arg) { | 427 | while (arg) { |
| 428 | |||
| 428 | /* Ignore OFFSET and ACCESSAS terms here */ | 429 | /* Ignore OFFSET and ACCESSAS terms here */ |
| 429 | 430 | ||
| 430 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | 431 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { |
| @@ -481,7 +482,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
| 481 | union acpi_parse_object *arg; | 482 | union acpi_parse_object *arg; |
| 482 | struct acpi_create_field_info info; | 483 | struct acpi_create_field_info info; |
| 483 | 484 | ||
| 484 | ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); | 485 | ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op); |
| 485 | 486 | ||
| 486 | /* First arg is the name of the parent op_region (must already exist) */ | 487 | /* First arg is the name of the parent op_region (must already exist) */ |
| 487 | 488 | ||
| @@ -554,7 +555,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, | |||
| 554 | union acpi_parse_object *arg; | 555 | union acpi_parse_object *arg; |
| 555 | struct acpi_create_field_info info; | 556 | struct acpi_create_field_info info; |
| 556 | 557 | ||
| 557 | ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); | 558 | ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op); |
| 558 | 559 | ||
| 559 | /* First arg is the name of the Index register (must already exist) */ | 560 | /* First arg is the name of the Index register (must already exist) */ |
| 560 | 561 | ||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index e65a07ad2422..bbdf990e9f65 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
| @@ -184,7 +184,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
| 184 | * | 184 | * |
| 185 | * RETURN: Status | 185 | * RETURN: Status |
| 186 | * | 186 | * |
| 187 | * DESCRIPTION: Walk the namespace starting at "start_node" and perform any | 187 | * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any |
| 188 | * necessary initialization on the objects found therein | 188 | * necessary initialization on the objects found therein |
| 189 | * | 189 | * |
| 190 | ******************************************************************************/ | 190 | ******************************************************************************/ |
| @@ -196,7 +196,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
| 196 | acpi_status status; | 196 | acpi_status status; |
| 197 | struct acpi_init_walk_info info; | 197 | struct acpi_init_walk_info info; |
| 198 | 198 | ||
| 199 | ACPI_FUNCTION_TRACE("ds_initialize_objects"); | 199 | ACPI_FUNCTION_TRACE(ds_initialize_objects); |
| 200 | 200 | ||
| 201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 202 | "**** Starting initialization of namespace objects ****\n")); | 202 | "**** Starting initialization of namespace objects ****\n")); |
| @@ -213,7 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
| 213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, | 213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, |
| 214 | acpi_ds_init_one_object, &info, NULL); | 214 | acpi_ds_init_one_object, &info, NULL); |
| 215 | if (ACPI_FAILURE(status)) { | 215 | if (ACPI_FAILURE(status)) { |
| 216 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 216 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c475546535b6..bc9aca4e7401 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
| @@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
| 81 | /* Invoke the global exception handler */ | 81 | /* Invoke the global exception handler */ |
| 82 | 82 | ||
| 83 | if (acpi_gbl_exception_handler) { | 83 | if (acpi_gbl_exception_handler) { |
| 84 | |||
| 84 | /* Exit the interpreter, allow handler to execute methods */ | 85 | /* Exit the interpreter, allow handler to execute methods */ |
| 85 | 86 | ||
| 86 | acpi_ex_exit_interpreter(); | 87 | acpi_ex_exit_interpreter(); |
| @@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
| 100 | } | 101 | } |
| 101 | #ifdef ACPI_DISASSEMBLER | 102 | #ifdef ACPI_DISASSEMBLER |
| 102 | if (ACPI_FAILURE(status)) { | 103 | if (ACPI_FAILURE(status)) { |
| 104 | |||
| 103 | /* Display method locals/args if disassembler is present */ | 105 | /* Display method locals/args if disassembler is present */ |
| 104 | 106 | ||
| 105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); | 107 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); |
| @@ -132,7 +134,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
| 132 | { | 134 | { |
| 133 | acpi_status status = AE_OK; | 135 | acpi_status status = AE_OK; |
| 134 | 136 | ||
| 135 | ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); | 137 | ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); |
| 136 | 138 | ||
| 137 | if (!method_node) { | 139 | if (!method_node) { |
| 138 | return_ACPI_STATUS(AE_NULL_ENTRY); | 140 | return_ACPI_STATUS(AE_NULL_ENTRY); |
| @@ -168,11 +170,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
| 168 | 170 | ||
| 169 | /* | 171 | /* |
| 170 | * Get a unit from the method semaphore. This releases the | 172 | * Get a unit from the method semaphore. This releases the |
| 171 | * interpreter if we block | 173 | * interpreter if we block (then reacquires it) |
| 172 | */ | 174 | */ |
| 173 | status = | 175 | status = |
| 174 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, | 176 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
| 175 | ACPI_WAIT_FOREVER); | 177 | ACPI_WAIT_FOREVER); |
| 178 | if (ACPI_FAILURE(status)) { | ||
| 179 | return_ACPI_STATUS(status); | ||
| 180 | } | ||
| 176 | } | 181 | } |
| 177 | 182 | ||
| 178 | /* | 183 | /* |
| @@ -183,7 +188,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
| 183 | if (!obj_desc->method.owner_id) { | 188 | if (!obj_desc->method.owner_id) { |
| 184 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | 189 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
| 185 | if (ACPI_FAILURE(status)) { | 190 | if (ACPI_FAILURE(status)) { |
| 186 | return_ACPI_STATUS(status); | 191 | goto cleanup; |
| 187 | } | 192 | } |
| 188 | } | 193 | } |
| 189 | 194 | ||
| @@ -193,6 +198,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
| 193 | */ | 198 | */ |
| 194 | obj_desc->method.thread_count++; | 199 | obj_desc->method.thread_count++; |
| 195 | return_ACPI_STATUS(status); | 200 | return_ACPI_STATUS(status); |
| 201 | |||
| 202 | cleanup: | ||
| 203 | /* On error, must signal the method semaphore if present */ | ||
| 204 | |||
| 205 | if (obj_desc->method.semaphore) { | ||
| 206 | (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); | ||
| 207 | } | ||
| 208 | return_ACPI_STATUS(status); | ||
| 196 | } | 209 | } |
| 197 | 210 | ||
| 198 | /******************************************************************************* | 211 | /******************************************************************************* |
| @@ -218,10 +231,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 218 | struct acpi_namespace_node *method_node; | 231 | struct acpi_namespace_node *method_node; |
| 219 | struct acpi_walk_state *next_walk_state = NULL; | 232 | struct acpi_walk_state *next_walk_state = NULL; |
| 220 | union acpi_operand_object *obj_desc; | 233 | union acpi_operand_object *obj_desc; |
| 221 | struct acpi_parameter_info info; | 234 | struct acpi_evaluate_info *info; |
| 222 | u32 i; | 235 | u32 i; |
| 223 | 236 | ||
| 224 | ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); | 237 | ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); |
| 225 | 238 | ||
| 226 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 227 | "Execute method %p, currentstate=%p\n", | 240 | "Execute method %p, currentstate=%p\n", |
| @@ -240,25 +253,31 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 240 | return_ACPI_STATUS(AE_NULL_OBJECT); | 253 | return_ACPI_STATUS(AE_NULL_OBJECT); |
| 241 | } | 254 | } |
| 242 | 255 | ||
| 243 | /* Init for new method, wait on concurrency semaphore */ | 256 | /* Init for new method, possibly wait on concurrency semaphore */ |
| 244 | 257 | ||
| 245 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 258 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
| 246 | this_walk_state->method_node); | 259 | this_walk_state->method_node); |
| 247 | if (ACPI_FAILURE(status)) { | 260 | if (ACPI_FAILURE(status)) { |
| 248 | goto cleanup; | 261 | return_ACPI_STATUS(status); |
| 249 | } | 262 | } |
| 250 | 263 | ||
| 264 | /* | ||
| 265 | * 1) Parse the method. All "normal" methods are parsed for each execution. | ||
| 266 | * Internal methods (_OSI, etc.) do not require parsing. | ||
| 267 | */ | ||
| 251 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 268 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
| 252 | /* 1) Parse: Create a new walk state for the preempting walk */ | 269 | |
| 270 | /* Create a new walk state for the parse */ | ||
| 253 | 271 | ||
| 254 | next_walk_state = | 272 | next_walk_state = |
| 255 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, | 273 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, |
| 256 | obj_desc, NULL); | 274 | obj_desc, NULL); |
| 257 | if (!next_walk_state) { | 275 | if (!next_walk_state) { |
| 258 | return_ACPI_STATUS(AE_NO_MEMORY); | 276 | status = AE_NO_MEMORY; |
| 277 | goto cleanup; | ||
| 259 | } | 278 | } |
| 260 | 279 | ||
| 261 | /* Create and init a Root Node */ | 280 | /* Create and init a parse tree root */ |
| 262 | 281 | ||
| 263 | op = acpi_ps_create_scope_op(); | 282 | op = acpi_ps_create_scope_op(); |
| 264 | if (!op) { | 283 | if (!op) { |
| @@ -271,17 +290,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 271 | obj_desc->method.aml_length, | 290 | obj_desc->method.aml_length, |
| 272 | NULL, 1); | 291 | NULL, 1); |
| 273 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
| 274 | acpi_ds_delete_walk_state(next_walk_state); | 293 | acpi_ps_delete_parse_tree(op); |
| 275 | goto cleanup; | 294 | goto cleanup; |
| 276 | } | 295 | } |
| 277 | 296 | ||
| 278 | /* Begin AML parse */ | 297 | /* Begin AML parse (deletes next_walk_state) */ |
| 279 | 298 | ||
| 280 | status = acpi_ps_parse_aml(next_walk_state); | 299 | status = acpi_ps_parse_aml(next_walk_state); |
| 281 | acpi_ps_delete_parse_tree(op); | 300 | acpi_ps_delete_parse_tree(op); |
| 301 | if (ACPI_FAILURE(status)) { | ||
| 302 | goto cleanup; | ||
| 303 | } | ||
| 282 | } | 304 | } |
| 283 | 305 | ||
| 284 | /* 2) Execute: Create a new state for the preempting walk */ | 306 | /* 2) Begin method execution. Create a new walk state */ |
| 285 | 307 | ||
| 286 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, | 308 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, |
| 287 | NULL, obj_desc, thread); | 309 | NULL, obj_desc, thread); |
| @@ -289,6 +311,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 289 | status = AE_NO_MEMORY; | 311 | status = AE_NO_MEMORY; |
| 290 | goto cleanup; | 312 | goto cleanup; |
| 291 | } | 313 | } |
| 314 | |||
| 292 | /* | 315 | /* |
| 293 | * The resolved arguments were put on the previous walk state's operand | 316 | * The resolved arguments were put on the previous walk state's operand |
| 294 | * stack. Operands on the previous walk state stack always | 317 | * stack. Operands on the previous walk state stack always |
| @@ -296,12 +319,24 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 296 | */ | 319 | */ |
| 297 | this_walk_state->operands[this_walk_state->num_operands] = NULL; | 320 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
| 298 | 321 | ||
| 299 | info.parameters = &this_walk_state->operands[0]; | 322 | /* |
| 300 | info.parameter_type = ACPI_PARAM_ARGS; | 323 | * Allocate and initialize the evaluation information block |
| 324 | * TBD: this is somewhat inefficient, should change interface to | ||
| 325 | * ds_init_aml_walk. For now, keeps this struct off the CPU stack | ||
| 326 | */ | ||
| 327 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
| 328 | if (!info) { | ||
| 329 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
| 330 | } | ||
| 331 | |||
| 332 | info->parameters = &this_walk_state->operands[0]; | ||
| 333 | info->parameter_type = ACPI_PARAM_ARGS; | ||
| 301 | 334 | ||
| 302 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, | 335 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
| 303 | obj_desc->method.aml_start, | 336 | obj_desc->method.aml_start, |
| 304 | obj_desc->method.aml_length, &info, 3); | 337 | obj_desc->method.aml_length, info, 3); |
| 338 | |||
| 339 | ACPI_FREE(info); | ||
| 305 | if (ACPI_FAILURE(status)) { | 340 | if (ACPI_FAILURE(status)) { |
| 306 | goto cleanup; | 341 | goto cleanup; |
| 307 | } | 342 | } |
| @@ -323,6 +358,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 323 | "Starting nested execution, newstate=%p\n", | 358 | "Starting nested execution, newstate=%p\n", |
| 324 | next_walk_state)); | 359 | next_walk_state)); |
| 325 | 360 | ||
| 361 | /* Invoke an internal method if necessary */ | ||
| 362 | |||
| 326 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 363 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
| 327 | status = obj_desc->method.implementation(next_walk_state); | 364 | status = obj_desc->method.implementation(next_walk_state); |
| 328 | } | 365 | } |
| @@ -330,16 +367,14 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
| 330 | return_ACPI_STATUS(status); | 367 | return_ACPI_STATUS(status); |
| 331 | 368 | ||
| 332 | cleanup: | 369 | cleanup: |
| 333 | /* Decrement the thread count on the method parse tree */ | ||
| 334 | 370 | ||
| 335 | if (next_walk_state && (next_walk_state->method_desc)) { | 371 | /* On error, we must terminate the method properly */ |
| 336 | next_walk_state->method_desc->method.thread_count--; | ||
| 337 | } | ||
| 338 | 372 | ||
| 339 | /* On error, we must delete the new walk state */ | 373 | acpi_ds_terminate_control_method(obj_desc, next_walk_state); |
| 374 | if (next_walk_state) { | ||
| 375 | acpi_ds_delete_walk_state(next_walk_state); | ||
| 376 | } | ||
| 340 | 377 | ||
| 341 | acpi_ds_terminate_control_method(next_walk_state); | ||
| 342 | acpi_ds_delete_walk_state(next_walk_state); | ||
| 343 | return_ACPI_STATUS(status); | 378 | return_ACPI_STATUS(status); |
| 344 | } | 379 | } |
| 345 | 380 | ||
| @@ -362,25 +397,33 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
| 362 | union acpi_operand_object *return_desc) | 397 | union acpi_operand_object *return_desc) |
| 363 | { | 398 | { |
| 364 | acpi_status status; | 399 | acpi_status status; |
| 400 | int same_as_implicit_return; | ||
| 365 | 401 | ||
| 366 | ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state); |
| 367 | 403 | ||
| 368 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 404 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 369 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | 405 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", |
| 370 | (char *)&walk_state->method_node->name, | 406 | (char *)&walk_state->method_node->name, |
| 371 | walk_state->method_call_op, return_desc)); | 407 | walk_state->method_call_op, return_desc)); |
| 372 | 408 | ||
| 373 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 409 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 374 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", | 410 | " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", |
| 375 | walk_state->return_used, | 411 | walk_state->return_used, |
| 376 | walk_state->results, walk_state)); | 412 | walk_state->results, walk_state)); |
| 377 | 413 | ||
| 378 | /* Did the called method return a value? */ | 414 | /* Did the called method return a value? */ |
| 379 | 415 | ||
| 380 | if (return_desc) { | 416 | if (return_desc) { |
| 417 | |||
| 418 | /* Is the implicit return object the same as the return desc? */ | ||
| 419 | |||
| 420 | same_as_implicit_return = | ||
| 421 | (walk_state->implicit_return_obj == return_desc); | ||
| 422 | |||
| 381 | /* Are we actually going to use the return value? */ | 423 | /* Are we actually going to use the return value? */ |
| 382 | 424 | ||
| 383 | if (walk_state->return_used) { | 425 | if (walk_state->return_used) { |
| 426 | |||
| 384 | /* Save the return value from the previous method */ | 427 | /* Save the return value from the previous method */ |
| 385 | 428 | ||
| 386 | status = acpi_ds_result_push(return_desc, walk_state); | 429 | status = acpi_ds_result_push(return_desc, walk_state); |
| @@ -397,18 +440,23 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
| 397 | } | 440 | } |
| 398 | 441 | ||
| 399 | /* | 442 | /* |
| 400 | * The following code is the | 443 | * The following code is the optional support for the so-called |
| 401 | * optional support for a so-called "implicit return". Some AML code | 444 | * "implicit return". Some AML code assumes that the last value of the |
| 402 | * assumes that the last value of the method is "implicitly" returned | 445 | * method is "implicitly" returned to the caller, in the absence of an |
| 403 | * to the caller. Just save the last result as the return value. | 446 | * explicit return value. |
| 447 | * | ||
| 448 | * Just save the last result of the method as the return value. | ||
| 449 | * | ||
| 404 | * NOTE: this is optional because the ASL language does not actually | 450 | * NOTE: this is optional because the ASL language does not actually |
| 405 | * support this behavior. | 451 | * support this behavior. |
| 406 | */ | 452 | */ |
| 407 | else if (!acpi_ds_do_implicit_return | 453 | else if (!acpi_ds_do_implicit_return |
| 408 | (return_desc, walk_state, FALSE)) { | 454 | (return_desc, walk_state, FALSE) |
| 455 | || same_as_implicit_return) { | ||
| 409 | /* | 456 | /* |
| 410 | * Delete the return value if it will not be used by the | 457 | * Delete the return value if it will not be used by the |
| 411 | * calling method | 458 | * calling method or remove one reference if the explicit return |
| 459 | * is the same as the implicit return value. | ||
| 412 | */ | 460 | */ |
| 413 | acpi_ut_remove_reference(return_desc); | 461 | acpi_ut_remove_reference(return_desc); |
| 414 | } | 462 | } |
| @@ -421,7 +469,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
| 421 | * | 469 | * |
| 422 | * FUNCTION: acpi_ds_terminate_control_method | 470 | * FUNCTION: acpi_ds_terminate_control_method |
| 423 | * | 471 | * |
| 424 | * PARAMETERS: walk_state - State of the method | 472 | * PARAMETERS: method_desc - Method object |
| 473 | * walk_state - State associated with the method | ||
| 425 | * | 474 | * |
| 426 | * RETURN: None | 475 | * RETURN: None |
| 427 | * | 476 | * |
| @@ -431,95 +480,100 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
| 431 | * | 480 | * |
| 432 | ******************************************************************************/ | 481 | ******************************************************************************/ |
| 433 | 482 | ||
| 434 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 483 | void |
| 484 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
| 485 | struct acpi_walk_state *walk_state) | ||
| 435 | { | 486 | { |
| 436 | union acpi_operand_object *obj_desc; | ||
| 437 | struct acpi_namespace_node *method_node; | 487 | struct acpi_namespace_node *method_node; |
| 438 | acpi_status status; | 488 | acpi_status status; |
| 439 | 489 | ||
| 440 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 490 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
| 441 | 491 | ||
| 442 | if (!walk_state) { | 492 | /* method_desc is required, walk_state is optional */ |
| 443 | return_VOID; | ||
| 444 | } | ||
| 445 | 493 | ||
| 446 | /* The current method object was saved in the walk state */ | 494 | if (!method_desc) { |
| 447 | |||
| 448 | obj_desc = walk_state->method_desc; | ||
| 449 | if (!obj_desc) { | ||
| 450 | return_VOID; | 495 | return_VOID; |
| 451 | } | 496 | } |
| 452 | 497 | ||
| 453 | /* Delete all arguments and locals */ | 498 | if (walk_state) { |
| 454 | 499 | ||
| 455 | acpi_ds_method_data_delete_all(walk_state); | 500 | /* Delete all arguments and locals */ |
| 501 | |||
| 502 | acpi_ds_method_data_delete_all(walk_state); | ||
| 503 | } | ||
| 456 | 504 | ||
| 457 | /* | 505 | /* |
| 458 | * Lock the parser while we terminate this method. | 506 | * Lock the parser while we terminate this method. |
| 459 | * If this is the last thread executing the method, | 507 | * If this is the last thread executing the method, |
| 460 | * we have additional cleanup to perform | 508 | * we have additional cleanup to perform |
| 461 | */ | 509 | */ |
| 462 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 510 | status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); |
| 463 | if (ACPI_FAILURE(status)) { | 511 | if (ACPI_FAILURE(status)) { |
| 464 | return_VOID; | 512 | return_VOID; |
| 465 | } | 513 | } |
| 466 | 514 | ||
| 467 | /* Signal completion of the execution of this method if necessary */ | 515 | /* Signal completion of the execution of this method if necessary */ |
| 468 | 516 | ||
| 469 | if (walk_state->method_desc->method.semaphore) { | 517 | if (method_desc->method.semaphore) { |
| 470 | status = | 518 | status = |
| 471 | acpi_os_signal_semaphore(walk_state->method_desc->method. | 519 | acpi_os_signal_semaphore(method_desc->method.semaphore, 1); |
| 472 | semaphore, 1); | ||
| 473 | if (ACPI_FAILURE(status)) { | 520 | if (ACPI_FAILURE(status)) { |
| 474 | ACPI_ERROR((AE_INFO, | ||
| 475 | "Could not signal method semaphore")); | ||
| 476 | 521 | ||
| 477 | /* Ignore error and continue cleanup */ | 522 | /* Ignore error and continue */ |
| 523 | |||
| 524 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 525 | "Could not signal method semaphore")); | ||
| 478 | } | 526 | } |
| 479 | } | 527 | } |
| 480 | 528 | ||
| 481 | /* | 529 | if (walk_state) { |
| 482 | * There are no more threads executing this method. Perform | 530 | /* |
| 483 | * additional cleanup. | 531 | * Delete any objects created by this method during execution. |
| 484 | * | 532 | * The method Node is stored in the walk state |
| 485 | * The method Node is stored in the walk state | 533 | */ |
| 486 | */ | 534 | method_node = walk_state->method_node; |
| 487 | method_node = walk_state->method_node; | ||
| 488 | 535 | ||
| 489 | /* Lock namespace for possible update */ | 536 | /* Lock namespace for possible update */ |
| 490 | 537 | ||
| 491 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 538 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 492 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
| 493 | goto exit; | 540 | goto exit; |
| 494 | } | 541 | } |
| 495 | 542 | ||
| 496 | /* | 543 | /* |
| 497 | * Delete any namespace entries created immediately underneath | 544 | * Delete any namespace entries created immediately underneath |
| 498 | * the method | 545 | * the method |
| 499 | */ | 546 | */ |
| 500 | if (method_node->child) { | 547 | if (method_node && method_node->child) { |
| 501 | acpi_ns_delete_namespace_subtree(method_node); | 548 | acpi_ns_delete_namespace_subtree(method_node); |
| 549 | } | ||
| 550 | |||
| 551 | /* | ||
| 552 | * Delete any namespace entries created anywhere else within | ||
| 553 | * the namespace by the execution of this method | ||
| 554 | */ | ||
| 555 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); | ||
| 556 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 502 | } | 557 | } |
| 503 | 558 | ||
| 504 | /* | 559 | /* Decrement the thread count on the method */ |
| 505 | * Delete any namespace entries created anywhere else within | 560 | |
| 506 | * the namespace by the execution of this method | 561 | if (method_desc->method.thread_count) { |
| 507 | */ | 562 | method_desc->method.thread_count--; |
| 508 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. | 563 | } else { |
| 509 | owner_id); | 564 | ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); |
| 510 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 565 | } |
| 511 | 566 | ||
| 512 | /* Are there any other threads currently executing this method? */ | 567 | /* Are there any other threads currently executing this method? */ |
| 513 | 568 | ||
| 514 | if (walk_state->method_desc->method.thread_count) { | 569 | if (method_desc->method.thread_count) { |
| 515 | /* | 570 | /* |
| 516 | * Additional threads. Do not release the owner_id in this case, | 571 | * Additional threads. Do not release the owner_id in this case, |
| 517 | * we immediately reuse it for the next thread executing this method | 572 | * we immediately reuse it for the next thread executing this method |
| 518 | */ | 573 | */ |
| 519 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 574 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 520 | "*** Completed execution of one thread, %d threads remaining\n", | 575 | "*** Completed execution of one thread, %d threads remaining\n", |
| 521 | walk_state->method_desc->method. | 576 | method_desc->method.thread_count)); |
| 522 | thread_count)); | ||
| 523 | } else { | 577 | } else { |
| 524 | /* This is the only executing thread for this method */ | 578 | /* This is the only executing thread for this method */ |
| 525 | 579 | ||
| @@ -533,22 +587,20 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
| 533 | * This code is here because we must wait until the last thread exits | 587 | * This code is here because we must wait until the last thread exits |
| 534 | * before creating the synchronization semaphore. | 588 | * before creating the synchronization semaphore. |
| 535 | */ | 589 | */ |
| 536 | if ((walk_state->method_desc->method.concurrency == 1) && | 590 | if ((method_desc->method.concurrency == 1) && |
| 537 | (!walk_state->method_desc->method.semaphore)) { | 591 | (!method_desc->method.semaphore)) { |
| 538 | status = acpi_os_create_semaphore(1, 1, | 592 | status = acpi_os_create_semaphore(1, 1, |
| 539 | &walk_state-> | 593 | &method_desc->method. |
| 540 | method_desc->method. | ||
| 541 | semaphore); | 594 | semaphore); |
| 542 | } | 595 | } |
| 543 | 596 | ||
| 544 | /* No more threads, we can free the owner_id */ | 597 | /* No more threads, we can free the owner_id */ |
| 545 | 598 | ||
| 546 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 599 | acpi_ut_release_owner_id(&method_desc->method.owner_id); |
| 547 | owner_id); | ||
| 548 | } | 600 | } |
| 549 | 601 | ||
| 550 | exit: | 602 | exit: |
| 551 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); | 603 | (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); |
| 552 | return_VOID; | 604 | return_VOID; |
| 553 | } | 605 | } |
| 554 | 606 | ||
| @@ -581,7 +633,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
| 581 | union acpi_parse_object *op; | 633 | union acpi_parse_object *op; |
| 582 | struct acpi_walk_state *walk_state; | 634 | struct acpi_walk_state *walk_state; |
| 583 | 635 | ||
| 584 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | 636 | ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); |
| 585 | 637 | ||
| 586 | /* Parameter Validation */ | 638 | /* Parameter Validation */ |
| 587 | 639 | ||
| @@ -590,7 +642,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
| 590 | } | 642 | } |
| 591 | 643 | ||
| 592 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 644 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
| 593 | "**** Parsing [%4.4s] **** named_obj=%p\n", | 645 | "**** Parsing [%4.4s] **** NamedObj=%p\n", |
| 594 | acpi_ut_get_node_name(node), node)); | 646 | acpi_ut_get_node_name(node), node)); |
| 595 | 647 | ||
| 596 | /* Extract the method object from the method Node */ | 648 | /* Extract the method object from the method Node */ |
| @@ -669,7 +721,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
| 669 | } | 721 | } |
| 670 | 722 | ||
| 671 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 723 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
| 672 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 724 | "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", |
| 673 | acpi_ut_get_node_name(node), node, op)); | 725 | acpi_ut_get_node_name(node), node, op)); |
| 674 | 726 | ||
| 675 | /* | 727 | /* |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index c025674f938b..459160ff9058 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
| @@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
| 81 | * special data types. | 81 | * special data types. |
| 82 | * | 82 | * |
| 83 | * NOTES: walk_state fields are initialized to zero by the | 83 | * NOTES: walk_state fields are initialized to zero by the |
| 84 | * ACPI_MEM_CALLOCATE(). | 84 | * ACPI_ALLOCATE_ZEROED(). |
| 85 | * | 85 | * |
| 86 | * A pseudo-Namespace Node is assigned to each argument and local | 86 | * A pseudo-Namespace Node is assigned to each argument and local |
| 87 | * so that ref_of() can return a pointer to the Node. | 87 | * so that ref_of() can return a pointer to the Node. |
| @@ -92,7 +92,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
| 92 | { | 92 | { |
| 93 | u32 i; | 93 | u32 i; |
| 94 | 94 | ||
| 95 | ACPI_FUNCTION_TRACE("ds_method_data_init"); | 95 | ACPI_FUNCTION_TRACE(ds_method_data_init); |
| 96 | 96 | ||
| 97 | /* Init the method arguments */ | 97 | /* Init the method arguments */ |
| 98 | 98 | ||
| @@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
| 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, | 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, |
| 101 | NAMEOF_ARG_NTE); | 101 | NAMEOF_ARG_NTE); |
| 102 | walk_state->arguments[i].name.integer |= (i << 24); | 102 | walk_state->arguments[i].name.integer |= (i << 24); |
| 103 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; |
| 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
| 105 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | | 105 | walk_state->arguments[i].flags = |
| 106 | ANOBJ_METHOD_ARG; | 106 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /* Init the method locals */ | 109 | /* Init the method locals */ |
| @@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
| 113 | NAMEOF_LOCAL_NTE); | 113 | NAMEOF_LOCAL_NTE); |
| 114 | 114 | ||
| 115 | walk_state->local_variables[i].name.integer |= (i << 24); | 115 | walk_state->local_variables[i].name.integer |= (i << 24); |
| 116 | walk_state->local_variables[i].descriptor = | 116 | walk_state->local_variables[i].descriptor_type = |
| 117 | ACPI_DESC_TYPE_NAMED; | 117 | ACPI_DESC_TYPE_NAMED; |
| 118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
| 119 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | | 119 | walk_state->local_variables[i].flags = |
| 120 | ANOBJ_METHOD_LOCAL; | 120 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | return_VOID; | 123 | return_VOID; |
| @@ -140,7 +140,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) | |||
| 140 | { | 140 | { |
| 141 | u32 index; | 141 | u32 index; |
| 142 | 142 | ||
| 143 | ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); | 143 | ACPI_FUNCTION_TRACE(ds_method_data_delete_all); |
| 144 | 144 | ||
| 145 | /* Detach the locals */ | 145 | /* Detach the locals */ |
| 146 | 146 | ||
| @@ -199,7 +199,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
| 199 | acpi_status status; | 199 | acpi_status status; |
| 200 | u32 index = 0; | 200 | u32 index = 0; |
| 201 | 201 | ||
| 202 | ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); | 202 | ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params); |
| 203 | 203 | ||
| 204 | if (!params) { | 204 | if (!params) { |
| 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| @@ -251,7 +251,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
| 251 | struct acpi_walk_state *walk_state, | 251 | struct acpi_walk_state *walk_state, |
| 252 | struct acpi_namespace_node **node) | 252 | struct acpi_namespace_node **node) |
| 253 | { | 253 | { |
| 254 | ACPI_FUNCTION_TRACE("ds_method_data_get_node"); | 254 | ACPI_FUNCTION_TRACE(ds_method_data_get_node); |
| 255 | 255 | ||
| 256 | /* | 256 | /* |
| 257 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
| @@ -318,10 +318,10 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
| 318 | acpi_status status; | 318 | acpi_status status; |
| 319 | struct acpi_namespace_node *node; | 319 | struct acpi_namespace_node *node; |
| 320 | 320 | ||
| 321 | ACPI_FUNCTION_TRACE("ds_method_data_set_value"); | 321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
| 322 | 322 | ||
| 323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 324 | "new_obj %p Opcode %X, Refs=%d [%s]\n", object, | 324 | "NewObj %p Opcode %X, Refs=%d [%s]\n", object, |
| 325 | opcode, object->common.reference_count, | 325 | opcode, object->common.reference_count, |
| 326 | acpi_ut_get_type_name(object->common.type))); | 326 | acpi_ut_get_type_name(object->common.type))); |
| 327 | 327 | ||
| @@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
| 336 | * Increment ref count so object can't be deleted while installed. | 336 | * Increment ref count so object can't be deleted while installed. |
| 337 | * NOTE: We do not copy the object in order to preserve the call by | 337 | * NOTE: We do not copy the object in order to preserve the call by |
| 338 | * reference semantics of ACPI Control Method invocation. | 338 | * reference semantics of ACPI Control Method invocation. |
| 339 | * (See ACPI specification 2.0_c) | 339 | * (See ACPI Specification 2.0_c) |
| 340 | */ | 340 | */ |
| 341 | acpi_ut_add_reference(object); | 341 | acpi_ut_add_reference(object); |
| 342 | 342 | ||
| @@ -351,7 +351,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
| 351 | * FUNCTION: acpi_ds_method_data_get_value | 351 | * FUNCTION: acpi_ds_method_data_get_value |
| 352 | * | 352 | * |
| 353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
| 354 | * Index - which local_var or argument to get | 354 | * Index - Which local_var or argument to get |
| 355 | * walk_state - Current walk state object | 355 | * walk_state - Current walk state object |
| 356 | * dest_desc - Where Arg or Local value is returned | 356 | * dest_desc - Where Arg or Local value is returned |
| 357 | * | 357 | * |
| @@ -372,7 +372,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
| 372 | struct acpi_namespace_node *node; | 372 | struct acpi_namespace_node *node; |
| 373 | union acpi_operand_object *object; | 373 | union acpi_operand_object *object; |
| 374 | 374 | ||
| 375 | ACPI_FUNCTION_TRACE("ds_method_data_get_value"); | 375 | ACPI_FUNCTION_TRACE(ds_method_data_get_value); |
| 376 | 376 | ||
| 377 | /* Validate the object descriptor */ | 377 | /* Validate the object descriptor */ |
| 378 | 378 | ||
| @@ -459,7 +459,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
| 459 | * FUNCTION: acpi_ds_method_data_delete_value | 459 | * FUNCTION: acpi_ds_method_data_delete_value |
| 460 | * | 460 | * |
| 461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
| 462 | * Index - which local_var or argument to delete | 462 | * Index - Which local_var or argument to delete |
| 463 | * walk_state - Current walk state object | 463 | * walk_state - Current walk state object |
| 464 | * | 464 | * |
| 465 | * RETURN: None | 465 | * RETURN: None |
| @@ -477,7 +477,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
| 477 | struct acpi_namespace_node *node; | 477 | struct acpi_namespace_node *node; |
| 478 | union acpi_operand_object *object; | 478 | union acpi_operand_object *object; |
| 479 | 479 | ||
| 480 | ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); | 480 | ACPI_FUNCTION_TRACE(ds_method_data_delete_value); |
| 481 | 481 | ||
| 482 | /* Get the namespace node for the arg/local */ | 482 | /* Get the namespace node for the arg/local */ |
| 483 | 483 | ||
| @@ -538,7 +538,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
| 538 | union acpi_operand_object *current_obj_desc; | 538 | union acpi_operand_object *current_obj_desc; |
| 539 | union acpi_operand_object *new_obj_desc; | 539 | union acpi_operand_object *new_obj_desc; |
| 540 | 540 | ||
| 541 | ACPI_FUNCTION_TRACE("ds_store_object_to_local"); | 541 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
| 542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", |
| 543 | opcode, index, obj_desc)); | 543 | opcode, index, obj_desc)); |
| 544 | 544 | ||
| @@ -614,7 +614,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
| 614 | && (current_obj_desc->reference.opcode == | 614 | && (current_obj_desc->reference.opcode == |
| 615 | AML_REF_OF_OP)) { | 615 | AML_REF_OF_OP)) { |
| 616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 617 | "Arg (%p) is an obj_ref(Node), storing in node %p\n", | 617 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
| 618 | new_obj_desc, | 618 | new_obj_desc, |
| 619 | current_obj_desc)); | 619 | current_obj_desc)); |
| 620 | 620 | ||
| @@ -688,7 +688,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
| 688 | struct acpi_namespace_node *node; | 688 | struct acpi_namespace_node *node; |
| 689 | union acpi_operand_object *object; | 689 | union acpi_operand_object *object; |
| 690 | 690 | ||
| 691 | ACPI_FUNCTION_TRACE("ds_method_data_get_type"); | 691 | ACPI_FUNCTION_TRACE(ds_method_data_get_type); |
| 692 | 692 | ||
| 693 | /* Get the namespace node for the arg/local */ | 693 | /* Get the namespace node for the arg/local */ |
| 694 | 694 | ||
| @@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
| 701 | 701 | ||
| 702 | object = acpi_ns_get_attached_object(node); | 702 | object = acpi_ns_get_attached_object(node); |
| 703 | if (!object) { | 703 | if (!object) { |
| 704 | |||
| 704 | /* Uninitialized local/arg, return TYPE_ANY */ | 705 | /* Uninitialized local/arg, return TYPE_ANY */ |
| 705 | 706 | ||
| 706 | return_VALUE(ACPI_TYPE_ANY); | 707 | return_VALUE(ACPI_TYPE_ANY); |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8b21f0f9e517..72190abb1d59 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
| @@ -81,7 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
| 81 | union acpi_operand_object *obj_desc; | 81 | union acpi_operand_object *obj_desc; |
| 82 | acpi_status status; | 82 | acpi_status status; |
| 83 | 83 | ||
| 84 | ACPI_FUNCTION_TRACE("ds_build_internal_object"); | 84 | ACPI_FUNCTION_TRACE(ds_build_internal_object); |
| 85 | 85 | ||
| 86 | *obj_desc_ptr = NULL; | 86 | *obj_desc_ptr = NULL; |
| 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
| @@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
| 103 | common. | 103 | common. |
| 104 | node))); | 104 | node))); |
| 105 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
| 106 | |||
| 106 | /* Check if we are resolving a named reference within a package */ | 107 | /* Check if we are resolving a named reference within a package */ |
| 107 | 108 | ||
| 108 | if ((status == AE_NOT_FOUND) | 109 | if ((status == AE_NOT_FOUND) |
| @@ -186,7 +187,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
| 186 | union acpi_parse_object *byte_list; | 187 | union acpi_parse_object *byte_list; |
| 187 | u32 byte_list_length = 0; | 188 | u32 byte_list_length = 0; |
| 188 | 189 | ||
| 189 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | 190 | ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj); |
| 190 | 191 | ||
| 191 | /* | 192 | /* |
| 192 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". | 193 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". |
| @@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
| 195 | */ | 196 | */ |
| 196 | obj_desc = *obj_desc_ptr; | 197 | obj_desc = *obj_desc_ptr; |
| 197 | if (!obj_desc) { | 198 | if (!obj_desc) { |
| 199 | |||
| 198 | /* Create a new buffer object */ | 200 | /* Create a new buffer object */ |
| 199 | 201 | ||
| 200 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 202 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
| @@ -243,7 +245,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
| 243 | "Buffer defined with zero length in AML, creating\n")); | 245 | "Buffer defined with zero length in AML, creating\n")); |
| 244 | } else { | 246 | } else { |
| 245 | obj_desc->buffer.pointer = | 247 | obj_desc->buffer.pointer = |
| 246 | ACPI_MEM_CALLOCATE(obj_desc->buffer.length); | 248 | ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length); |
| 247 | if (!obj_desc->buffer.pointer) { | 249 | if (!obj_desc->buffer.pointer) { |
| 248 | acpi_ut_delete_object_desc(obj_desc); | 250 | acpi_ut_delete_object_desc(obj_desc); |
| 249 | return_ACPI_STATUS(AE_NO_MEMORY); | 251 | return_ACPI_STATUS(AE_NO_MEMORY); |
| @@ -291,7 +293,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 291 | acpi_status status = AE_OK; | 293 | acpi_status status = AE_OK; |
| 292 | acpi_native_uint i; | 294 | acpi_native_uint i; |
| 293 | 295 | ||
| 294 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | 296 | ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); |
| 295 | 297 | ||
| 296 | /* Find the parent of a possibly nested package */ | 298 | /* Find the parent of a possibly nested package */ |
| 297 | 299 | ||
| @@ -339,9 +341,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 339 | * individual objects). Add an extra pointer slot so | 341 | * individual objects). Add an extra pointer slot so |
| 340 | * that the list is always null terminated. | 342 | * that the list is always null terminated. |
| 341 | */ | 343 | */ |
| 342 | obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> | 344 | obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
| 343 | package.count + | 345 | obj_desc->package. |
| 344 | 1) * sizeof(void *)); | 346 | count + |
| 347 | 1) * sizeof(void *)); | ||
| 345 | 348 | ||
| 346 | if (!obj_desc->package.elements) { | 349 | if (!obj_desc->package.elements) { |
| 347 | acpi_ut_delete_object_desc(obj_desc); | 350 | acpi_ut_delete_object_desc(obj_desc); |
| @@ -355,6 +358,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 355 | arg = arg->common.next; | 358 | arg = arg->common.next; |
| 356 | for (i = 0; arg; i++) { | 359 | for (i = 0; arg; i++) { |
| 357 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 360 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
| 361 | |||
| 358 | /* Object (package or buffer) is already built */ | 362 | /* Object (package or buffer) is already built */ |
| 359 | 363 | ||
| 360 | obj_desc->package.elements[i] = | 364 | obj_desc->package.elements[i] = |
| @@ -396,7 +400,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
| 396 | acpi_status status; | 400 | acpi_status status; |
| 397 | union acpi_operand_object *obj_desc; | 401 | union acpi_operand_object *obj_desc; |
| 398 | 402 | ||
| 399 | ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); | 403 | ACPI_FUNCTION_TRACE_PTR(ds_create_node, op); |
| 400 | 404 | ||
| 401 | /* | 405 | /* |
| 402 | * Because of the execution pass through the non-control-method | 406 | * Because of the execution pass through the non-control-method |
| @@ -408,6 +412,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
| 408 | } | 412 | } |
| 409 | 413 | ||
| 410 | if (!op->common.value.arg) { | 414 | if (!op->common.value.arg) { |
| 415 | |||
| 411 | /* No arguments, there is nothing to do */ | 416 | /* No arguments, there is nothing to do */ |
| 412 | 417 | ||
| 413 | return_ACPI_STATUS(AE_OK); | 418 | return_ACPI_STATUS(AE_OK); |
| @@ -464,11 +469,12 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
| 464 | union acpi_operand_object *obj_desc; | 469 | union acpi_operand_object *obj_desc; |
| 465 | acpi_status status = AE_OK; | 470 | acpi_status status = AE_OK; |
| 466 | 471 | ||
| 467 | ACPI_FUNCTION_TRACE("ds_init_object_from_op"); | 472 | ACPI_FUNCTION_TRACE(ds_init_object_from_op); |
| 468 | 473 | ||
| 469 | obj_desc = *ret_obj_desc; | 474 | obj_desc = *ret_obj_desc; |
| 470 | op_info = acpi_ps_get_opcode_info(opcode); | 475 | op_info = acpi_ps_get_opcode_info(opcode); |
| 471 | if (op_info->class == AML_CLASS_UNKNOWN) { | 476 | if (op_info->class == AML_CLASS_UNKNOWN) { |
| 477 | |||
| 472 | /* Unknown opcode */ | 478 | /* Unknown opcode */ |
| 473 | 479 | ||
| 474 | return_ACPI_STATUS(AE_TYPE); | 480 | return_ACPI_STATUS(AE_TYPE); |
| @@ -626,6 +632,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
| 626 | default: /* Other literals, etc.. */ | 632 | default: /* Other literals, etc.. */ |
| 627 | 633 | ||
| 628 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 634 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
| 635 | |||
| 629 | /* Node was saved in Op */ | 636 | /* Node was saved in Op */ |
| 630 | 637 | ||
| 631 | obj_desc->reference.node = op->common.node; | 638 | obj_desc->reference.node = op->common.node; |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6229c10674e1..5b974a8fe614 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
| @@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, | |||
| 91 | union acpi_parse_object *op; | 91 | union acpi_parse_object *op; |
| 92 | struct acpi_walk_state *walk_state; | 92 | struct acpi_walk_state *walk_state; |
| 93 | 93 | ||
| 94 | ACPI_FUNCTION_TRACE("ds_execute_arguments"); | 94 | ACPI_FUNCTION_TRACE(ds_execute_arguments); |
| 95 | 95 | ||
| 96 | /* | 96 | /* |
| 97 | * Allocate a new parser op to be the root of the parsed tree | 97 | * Allocate a new parser op to be the root of the parsed tree |
| @@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
| 193 | struct acpi_namespace_node *node; | 193 | struct acpi_namespace_node *node; |
| 194 | acpi_status status; | 194 | acpi_status status; |
| 195 | 195 | ||
| 196 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); |
| 197 | 197 | ||
| 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
| 199 | return_ACPI_STATUS(AE_OK); | 199 | return_ACPI_STATUS(AE_OK); |
| @@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
| 206 | 206 | ||
| 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
| 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
| 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", | 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", |
| 210 | acpi_ut_get_node_name(node))); | 210 | acpi_ut_get_node_name(node))); |
| 211 | 211 | ||
| 212 | /* Execute the AML code for the term_arg arguments */ | 212 | /* Execute the AML code for the term_arg arguments */ |
| @@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | |||
| 235 | struct acpi_namespace_node *node; | 235 | struct acpi_namespace_node *node; |
| 236 | acpi_status status; | 236 | acpi_status status; |
| 237 | 237 | ||
| 238 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); | 238 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); |
| 239 | 239 | ||
| 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
| 241 | return_ACPI_STATUS(AE_OK); | 241 | return_ACPI_STATUS(AE_OK); |
| @@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | |||
| 279 | struct acpi_namespace_node *node; | 279 | struct acpi_namespace_node *node; |
| 280 | acpi_status status; | 280 | acpi_status status; |
| 281 | 281 | ||
| 282 | ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); | 282 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); |
| 283 | 283 | ||
| 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
| 285 | return_ACPI_STATUS(AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
| @@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 324 | acpi_status status; | 324 | acpi_status status; |
| 325 | union acpi_operand_object *extra_desc; | 325 | union acpi_operand_object *extra_desc; |
| 326 | 326 | ||
| 327 | ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); | 327 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); |
| 328 | 328 | ||
| 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
| 330 | return_ACPI_STATUS(AE_OK); | 330 | return_ACPI_STATUS(AE_OK); |
| @@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
| 343 | (ACPI_TYPE_REGION, node, NULL)); | 343 | (ACPI_TYPE_REGION, node, NULL)); |
| 344 | 344 | ||
| 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", |
| 346 | "[%4.4s] op_region Arg Init at AML %p\n", | ||
| 347 | acpi_ut_get_node_name(node), | 346 | acpi_ut_get_node_name(node), |
| 348 | extra_desc->extra.aml_start)); | 347 | extra_desc->extra.aml_start)); |
| 349 | 348 | ||
| @@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
| 352 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 351 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
| 353 | extra_desc->extra.aml_length, | 352 | extra_desc->extra.aml_length, |
| 354 | extra_desc->extra.aml_start); | 353 | extra_desc->extra.aml_start); |
| 354 | if (ACPI_FAILURE(status)) { | ||
| 355 | return_ACPI_STATUS(status); | ||
| 356 | } | ||
| 357 | |||
| 358 | /* Validate the region address/length via the host OS */ | ||
| 359 | |||
| 360 | status = acpi_os_validate_address(obj_desc->region.space_id, | ||
| 361 | obj_desc->region.address, | ||
| 362 | (acpi_size) obj_desc->region.length); | ||
| 363 | if (ACPI_FAILURE(status)) { | ||
| 364 | /* | ||
| 365 | * Invalid address/length. We will emit an error message and mark | ||
| 366 | * the region as invalid, so that it will cause an additional error if | ||
| 367 | * it is ever used. Then return AE_OK. | ||
| 368 | */ | ||
| 369 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 370 | "During address validation of OpRegion [%4.4s]", | ||
| 371 | node->name.ascii)); | ||
| 372 | obj_desc->common.flags |= AOPOBJ_INVALID; | ||
| 373 | status = AE_OK; | ||
| 374 | } | ||
| 375 | |||
| 355 | return_ACPI_STATUS(status); | 376 | return_ACPI_STATUS(status); |
| 356 | } | 377 | } |
| 357 | 378 | ||
| @@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
| 411 | u8 field_flags; | 432 | u8 field_flags; |
| 412 | acpi_status status; | 433 | acpi_status status; |
| 413 | 434 | ||
| 414 | ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); | 435 | ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc); |
| 415 | 436 | ||
| 416 | /* Host object must be a Buffer */ | 437 | /* Host object must be a Buffer */ |
| 417 | 438 | ||
| @@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
| 457 | 478 | ||
| 458 | if (bit_count == 0) { | 479 | if (bit_count == 0) { |
| 459 | ACPI_ERROR((AE_INFO, | 480 | ACPI_ERROR((AE_INFO, |
| 460 | "Attempt to create_field of length zero")); | 481 | "Attempt to CreateField of length zero")); |
| 461 | status = AE_AML_OPERAND_VALUE; | 482 | status = AE_AML_OPERAND_VALUE; |
| 462 | goto cleanup; | 483 | goto cleanup; |
| 463 | } | 484 | } |
| @@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 595 | struct acpi_namespace_node *node; | 616 | struct acpi_namespace_node *node; |
| 596 | union acpi_parse_object *next_op; | 617 | union acpi_parse_object *next_op; |
| 597 | 618 | ||
| 598 | ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); | 619 | ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op); |
| 599 | 620 | ||
| 600 | /* | 621 | /* |
| 601 | * This is where we evaluate the address and length fields of the | 622 | * This is where we evaluate the address and length fields of the |
| @@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 627 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 648 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
| 628 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 649 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
| 629 | walk_state->num_operands, | 650 | walk_state->num_operands, |
| 630 | "after acpi_ex_resolve_operands"); | 651 | "after AcpiExResolveOperands"); |
| 631 | 652 | ||
| 632 | if (ACPI_FAILURE(status)) { | 653 | if (ACPI_FAILURE(status)) { |
| 633 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", | 654 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", |
| @@ -640,6 +661,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
| 640 | /* Initialize the Buffer Field */ | 661 | /* Initialize the Buffer Field */ |
| 641 | 662 | ||
| 642 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 663 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
| 664 | |||
| 643 | /* NOTE: Slightly different operands for this opcode */ | 665 | /* NOTE: Slightly different operands for this opcode */ |
| 644 | 666 | ||
| 645 | status = | 667 | status = |
| @@ -685,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 685 | struct acpi_namespace_node *node; | 707 | struct acpi_namespace_node *node; |
| 686 | union acpi_parse_object *next_op; | 708 | union acpi_parse_object *next_op; |
| 687 | 709 | ||
| 688 | ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); | 710 | ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op); |
| 689 | 711 | ||
| 690 | /* | 712 | /* |
| 691 | * This is where we evaluate the address and length fields of the | 713 | * This is where we evaluate the address and length fields of the |
| @@ -718,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 718 | 740 | ||
| 719 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 741 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
| 720 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 742 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
| 721 | 1, "after acpi_ex_resolve_operands"); | 743 | 1, "after AcpiExResolveOperands"); |
| 722 | 744 | ||
| 723 | obj_desc = acpi_ns_get_attached_object(node); | 745 | obj_desc = acpi_ns_get_attached_object(node); |
| 724 | if (!obj_desc) { | 746 | if (!obj_desc) { |
| @@ -744,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
| 744 | operand_desc->integer.value; | 766 | operand_desc->integer.value; |
| 745 | acpi_ut_remove_reference(operand_desc); | 767 | acpi_ut_remove_reference(operand_desc); |
| 746 | 768 | ||
| 747 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 769 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
| 748 | obj_desc, | 770 | obj_desc, |
| 749 | ACPI_FORMAT_UINT64(obj_desc->region.address), | 771 | ACPI_FORMAT_UINT64(obj_desc->region.address), |
| 750 | obj_desc->region.length)); | 772 | obj_desc->region.length)); |
| @@ -780,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
| 780 | union acpi_operand_object *arg_desc; | 802 | union acpi_operand_object *arg_desc; |
| 781 | u32 length; | 803 | u32 length; |
| 782 | 804 | ||
| 783 | ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); | 805 | ACPI_FUNCTION_TRACE(ds_eval_data_object_operands); |
| 784 | 806 | ||
| 785 | /* The first operand (for all of these data objects) is the length */ | 807 | /* The first operand (for all of these data objects) is the length */ |
| 786 | 808 | ||
| @@ -874,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | |||
| 874 | acpi_status status = AE_OK; | 896 | acpi_status status = AE_OK; |
| 875 | union acpi_generic_state *control_state; | 897 | union acpi_generic_state *control_state; |
| 876 | 898 | ||
| 877 | ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); | 899 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); |
| 878 | 900 | ||
| 879 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | 901 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, |
| 880 | op->common.aml_opcode, walk_state)); | 902 | op->common.aml_opcode, walk_state)); |
| @@ -952,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 952 | acpi_status status = AE_OK; | 974 | acpi_status status = AE_OK; |
| 953 | union acpi_generic_state *control_state; | 975 | union acpi_generic_state *control_state; |
| 954 | 976 | ||
| 955 | ACPI_FUNCTION_NAME("ds_exec_end_control_op"); | 977 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); |
| 956 | 978 | ||
| 957 | switch (op->common.aml_opcode) { | 979 | switch (op->common.aml_opcode) { |
| 958 | case AML_IF_OP: | 980 | case AML_IF_OP: |
| @@ -984,6 +1006,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 984 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
| 985 | 1007 | ||
| 986 | if (walk_state->control_state->common.value) { | 1008 | if (walk_state->control_state->common.value) { |
| 1009 | |||
| 987 | /* Predicate was true, go back and evaluate it again! */ | 1010 | /* Predicate was true, go back and evaluate it again! */ |
| 988 | 1011 | ||
| 989 | status = AE_CTRL_PENDING; | 1012 | status = AE_CTRL_PENDING; |
| @@ -1014,6 +1037,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 1014 | * has been bubbled up the tree | 1037 | * has been bubbled up the tree |
| 1015 | */ | 1038 | */ |
| 1016 | if (op->common.value.arg) { | 1039 | if (op->common.value.arg) { |
| 1040 | |||
| 1017 | /* Since we have a real Return(), delete any implicit return */ | 1041 | /* Since we have a real Return(), delete any implicit return */ |
| 1018 | 1042 | ||
| 1019 | acpi_ds_clear_implicit_return(walk_state); | 1043 | acpi_ds_clear_implicit_return(walk_state); |
| @@ -1047,6 +1071,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 1047 | walk_state->return_desc = walk_state->operands[0]; | 1071 | walk_state->return_desc = walk_state->operands[0]; |
| 1048 | } else if ((walk_state->results) && | 1072 | } else if ((walk_state->results) && |
| 1049 | (walk_state->results->results.num_results > 0)) { | 1073 | (walk_state->results->results.num_results > 0)) { |
| 1074 | |||
| 1050 | /* Since we have a real Return(), delete any implicit return */ | 1075 | /* Since we have a real Return(), delete any implicit return */ |
| 1051 | 1076 | ||
| 1052 | acpi_ds_clear_implicit_return(walk_state); | 1077 | acpi_ds_clear_implicit_return(walk_state); |
| @@ -1095,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
| 1095 | } | 1120 | } |
| 1096 | 1121 | ||
| 1097 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1122 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 1098 | "Completed RETURN_OP State=%p, ret_val=%p\n", | 1123 | "Completed RETURN_OP State=%p, RetVal=%p\n", |
| 1099 | walk_state, walk_state->return_desc)); | 1124 | walk_state, walk_state->return_desc)); |
| 1100 | 1125 | ||
| 1101 | /* End the control method execution right now */ | 1126 | /* End the control method execution right now */ |
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 53356a591ac1..05230baf5de8 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
| @@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils") | |||
| 68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
| 69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) | 69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) |
| 70 | { | 70 | { |
| 71 | ACPI_FUNCTION_NAME("ds_clear_implicit_return"); | 71 | ACPI_FUNCTION_NAME(ds_clear_implicit_return); |
| 72 | 72 | ||
| 73 | /* | 73 | /* |
| 74 | * Slack must be enabled for this feature | 74 | * Slack must be enabled for this feature |
| @@ -115,7 +115,7 @@ u8 | |||
| 115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, | 115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, |
| 116 | struct acpi_walk_state *walk_state, u8 add_reference) | 116 | struct acpi_walk_state *walk_state, u8 add_reference) |
| 117 | { | 117 | { |
| 118 | ACPI_FUNCTION_NAME("ds_do_implicit_return"); | 118 | ACPI_FUNCTION_NAME(ds_do_implicit_return); |
| 119 | 119 | ||
| 120 | /* | 120 | /* |
| 121 | * Slack must be enabled for this feature, and we must | 121 | * Slack must be enabled for this feature, and we must |
| @@ -171,7 +171,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
| 171 | { | 171 | { |
| 172 | const struct acpi_opcode_info *parent_info; | 172 | const struct acpi_opcode_info *parent_info; |
| 173 | 173 | ||
| 174 | ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); | 174 | ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op); |
| 175 | 175 | ||
| 176 | /* Must have both an Op and a Result Object */ | 176 | /* Must have both an Op and a Result Object */ |
| 177 | 177 | ||
| @@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
| 202 | */ | 202 | */ |
| 203 | if ((!op->common.parent) || | 203 | if ((!op->common.parent) || |
| 204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
| 205 | |||
| 205 | /* No parent, the return value cannot possibly be used */ | 206 | /* No parent, the return value cannot possibly be used */ |
| 206 | 207 | ||
| 207 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 208 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| @@ -340,7 +341,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
| 340 | union acpi_operand_object *obj_desc; | 341 | union acpi_operand_object *obj_desc; |
| 341 | acpi_status status; | 342 | acpi_status status; |
| 342 | 343 | ||
| 343 | ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); | 344 | ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj); |
| 344 | 345 | ||
| 345 | if (!op) { | 346 | if (!op) { |
| 346 | ACPI_ERROR((AE_INFO, "Null Op")); | 347 | ACPI_ERROR((AE_INFO, "Null Op")); |
| @@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
| 352 | } | 353 | } |
| 353 | 354 | ||
| 354 | if (!acpi_ds_is_result_used(op, walk_state)) { | 355 | if (!acpi_ds_is_result_used(op, walk_state)) { |
| 356 | |||
| 355 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ | 357 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ |
| 356 | 358 | ||
| 357 | status = acpi_ds_result_pop(&obj_desc, walk_state); | 359 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
| @@ -382,7 +384,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) | |||
| 382 | u32 i; | 384 | u32 i; |
| 383 | acpi_status status = AE_OK; | 385 | acpi_status status = AE_OK; |
| 384 | 386 | ||
| 385 | ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); | 387 | ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state); |
| 386 | 388 | ||
| 387 | /* | 389 | /* |
| 388 | * Attempt to resolve each of the valid operands | 390 | * Attempt to resolve each of the valid operands |
| @@ -417,7 +419,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) | |||
| 417 | { | 419 | { |
| 418 | u32 i; | 420 | u32 i; |
| 419 | 421 | ||
| 420 | ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); | 422 | ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state); |
| 421 | 423 | ||
| 422 | /* Remove a reference on each operand on the stack */ | 424 | /* Remove a reference on each operand on the stack */ |
| 423 | 425 | ||
| @@ -465,7 +467,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 465 | acpi_interpreter_mode interpreter_mode; | 467 | acpi_interpreter_mode interpreter_mode; |
| 466 | const struct acpi_opcode_info *op_info; | 468 | const struct acpi_opcode_info *op_info; |
| 467 | 469 | ||
| 468 | ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); | 470 | ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg); |
| 469 | 471 | ||
| 470 | /* A valid name must be looked up in the namespace */ | 472 | /* A valid name must be looked up in the namespace */ |
| 471 | 473 | ||
| @@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 498 | */ | 500 | */ |
| 499 | if ((walk_state->deferred_node) && | 501 | if ((walk_state->deferred_node) && |
| 500 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) | 502 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) |
| 501 | && (arg_index != 0)) { | 503 | && (arg_index == |
| 504 | (u32) ((walk_state->opcode == | ||
| 505 | AML_CREATE_FIELD_OP) ? 3 : 2))) { | ||
| 502 | obj_desc = | 506 | obj_desc = |
| 503 | ACPI_CAST_PTR(union acpi_operand_object, | 507 | ACPI_CAST_PTR(union acpi_operand_object, |
| 504 | walk_state->deferred_node); | 508 | walk_state->deferred_node); |
| @@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 521 | && (parent_op->common.aml_opcode != AML_REGION_OP) | 525 | && (parent_op->common.aml_opcode != AML_REGION_OP) |
| 522 | && (parent_op->common.aml_opcode != | 526 | && (parent_op->common.aml_opcode != |
| 523 | AML_INT_NAMEPATH_OP)) { | 527 | AML_INT_NAMEPATH_OP)) { |
| 528 | |||
| 524 | /* Enter name into namespace if not found */ | 529 | /* Enter name into namespace if not found */ |
| 525 | 530 | ||
| 526 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; | 531 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; |
| @@ -572,7 +577,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
| 572 | 577 | ||
| 573 | /* Free the namestring created above */ | 578 | /* Free the namestring created above */ |
| 574 | 579 | ||
| 575 | ACPI_MEM_FREE(name_string); | 580 | ACPI_FREE(name_string); |
| 576 | 581 | ||
| 577 | /* Check status from the lookup */ | 582 | /* Check status from the lookup */ |
| 578 | 583 | ||
| @@ -696,7 +701,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
| 696 | union acpi_parse_object *arg; | 701 | union acpi_parse_object *arg; |
| 697 | u32 arg_count = 0; | 702 | u32 arg_count = 0; |
| 698 | 703 | ||
| 699 | ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); | 704 | ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); |
| 700 | 705 | ||
| 701 | /* For all arguments in the list... */ | 706 | /* For all arguments in the list... */ |
| 702 | 707 | ||
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index f1af655ff113..3acbd9145d72 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
| 50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
| 51 | #include <acpi/acdebug.h> | 51 | #include <acpi/acdebug.h> |
| 52 | #include <acpi/acdisasm.h> | ||
| 53 | 52 | ||
| 54 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
| 55 | ACPI_MODULE_NAME("dswexec") | 54 | ACPI_MODULE_NAME("dswexec") |
| @@ -93,7 +92,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
| 93 | union acpi_operand_object *obj_desc; | 92 | union acpi_operand_object *obj_desc; |
| 94 | union acpi_operand_object *local_obj_desc = NULL; | 93 | union acpi_operand_object *local_obj_desc = NULL; |
| 95 | 94 | ||
| 96 | ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); | 95 | ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state); |
| 97 | 96 | ||
| 98 | walk_state->control_state->common.state = 0; | 97 | walk_state->control_state->common.state = 0; |
| 99 | 98 | ||
| @@ -123,7 +122,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
| 123 | 122 | ||
| 124 | if (!obj_desc) { | 123 | if (!obj_desc) { |
| 125 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
| 126 | "No predicate obj_desc=%p State=%p", | 125 | "No predicate ObjDesc=%p State=%p", |
| 127 | obj_desc, walk_state)); | 126 | obj_desc, walk_state)); |
| 128 | 127 | ||
| 129 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 128 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
| @@ -140,7 +139,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
| 140 | 139 | ||
| 141 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { | 140 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { |
| 142 | ACPI_ERROR((AE_INFO, | 141 | ACPI_ERROR((AE_INFO, |
| 143 | "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X", | 142 | "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", |
| 144 | obj_desc, walk_state, | 143 | obj_desc, walk_state, |
| 145 | ACPI_GET_OBJECT_TYPE(obj_desc))); | 144 | ACPI_GET_OBJECT_TYPE(obj_desc))); |
| 146 | 145 | ||
| @@ -214,7 +213,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
| 214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
| 215 | u32 opcode_class; | 214 | u32 opcode_class; |
| 216 | 215 | ||
| 217 | ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); | 216 | ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state); |
| 218 | 217 | ||
| 219 | op = walk_state->op; | 218 | op = walk_state->op; |
| 220 | if (!op) { | 219 | if (!op) { |
| @@ -296,7 +295,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
| 296 | 295 | ||
| 297 | case AML_CLASS_NAMED_OBJECT: | 296 | case AML_CLASS_NAMED_OBJECT: |
| 298 | 297 | ||
| 299 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 298 | if (walk_state->walk_type & ACPI_WALK_METHOD) { |
| 300 | /* | 299 | /* |
| 301 | * Found a named object declaration during method execution; | 300 | * Found a named object declaration during method execution; |
| 302 | * we must enter this object into the namespace. The created | 301 | * we must enter this object into the namespace. The created |
| @@ -354,7 +353,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 354 | union acpi_parse_object *next_op; | 353 | union acpi_parse_object *next_op; |
| 355 | union acpi_parse_object *first_arg; | 354 | union acpi_parse_object *first_arg; |
| 356 | 355 | ||
| 357 | ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); | 356 | ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); |
| 358 | 357 | ||
| 359 | op = walk_state->op; | 358 | op = walk_state->op; |
| 360 | op_type = walk_state->op_info->type; | 359 | op_type = walk_state->op_info->type; |
| @@ -409,6 +408,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 409 | * being the object_type and size_of operators. | 408 | * being the object_type and size_of operators. |
| 410 | */ | 409 | */ |
| 411 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { | 410 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { |
| 411 | |||
| 412 | /* Resolve all operands */ | 412 | /* Resolve all operands */ |
| 413 | 413 | ||
| 414 | status = acpi_ex_resolve_operands(walk_state->opcode, | 414 | status = acpi_ex_resolve_operands(walk_state->opcode, |
| @@ -423,7 +423,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 423 | acpi_ps_get_opcode_name | 423 | acpi_ps_get_opcode_name |
| 424 | (walk_state->opcode), | 424 | (walk_state->opcode), |
| 425 | walk_state->num_operands, | 425 | walk_state->num_operands, |
| 426 | "after ex_resolve_operands"); | 426 | "after ExResolveOperands"); |
| 427 | } | 427 | } |
| 428 | } | 428 | } |
| 429 | 429 | ||
| @@ -437,7 +437,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); | 437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); |
| 438 | } else { | 438 | } else { |
| 439 | /* | 439 | /* |
| 440 | * Treat constructs of the form "Store(local_x,local_x)" as noops when the | 440 | * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the |
| 441 | * Local is uninitialized. | 441 | * Local is uninitialized. |
| 442 | */ | 442 | */ |
| 443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && | 443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && |
| @@ -548,6 +548,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 548 | */ | 548 | */ |
| 549 | status = acpi_ds_resolve_operands(walk_state); | 549 | status = acpi_ds_resolve_operands(walk_state); |
| 550 | if (ACPI_FAILURE(status)) { | 550 | if (ACPI_FAILURE(status)) { |
| 551 | |||
| 551 | /* On error, clear all resolved operands */ | 552 | /* On error, clear all resolved operands */ |
| 552 | 553 | ||
| 553 | acpi_ds_clear_operands(walk_state); | 554 | acpi_ds_clear_operands(walk_state); |
| @@ -569,7 +570,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 569 | case AML_TYPE_CREATE_FIELD: | 570 | case AML_TYPE_CREATE_FIELD: |
| 570 | 571 | ||
| 571 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 572 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 572 | "Executing create_field Buffer/Index Op=%p\n", | 573 | "Executing CreateField Buffer/Index Op=%p\n", |
| 573 | op)); | 574 | op)); |
| 574 | 575 | ||
| 575 | status = acpi_ds_load2_end_op(walk_state); | 576 | status = acpi_ds_load2_end_op(walk_state); |
| @@ -584,7 +585,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 584 | case AML_TYPE_CREATE_OBJECT: | 585 | case AML_TYPE_CREATE_OBJECT: |
| 585 | 586 | ||
| 586 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 587 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 587 | "Executing create_object (Buffer/Package) Op=%p\n", | 588 | "Executing CreateObject (Buffer/Package) Op=%p\n", |
| 588 | op)); | 589 | op)); |
| 589 | 590 | ||
| 590 | switch (op->common.parent->common.aml_opcode) { | 591 | switch (op->common.parent->common.aml_opcode) { |
| @@ -657,7 +658,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 657 | 658 | ||
| 658 | if (op->common.aml_opcode == AML_REGION_OP) { | 659 | if (op->common.aml_opcode == AML_REGION_OP) { |
| 659 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 660 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 660 | "Executing op_region Address/Length Op=%p\n", | 661 | "Executing OpRegion Address/Length Op=%p\n", |
| 661 | op)); | 662 | op)); |
| 662 | 663 | ||
| 663 | status = | 664 | status = |
| @@ -722,6 +723,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
| 722 | cleanup: | 723 | cleanup: |
| 723 | 724 | ||
| 724 | if (walk_state->result_obj) { | 725 | if (walk_state->result_obj) { |
| 726 | |||
| 725 | /* Break to debugger to display result */ | 727 | /* Break to debugger to display result */ |
| 726 | 728 | ||
| 727 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 729 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index d3d24da31c81..35074399c617 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
| @@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
| 127 | char *path; | 127 | char *path; |
| 128 | u32 flags; | 128 | u32 flags; |
| 129 | 129 | ||
| 130 | ACPI_FUNCTION_TRACE("ds_load1_begin_op"); | 130 | ACPI_FUNCTION_TRACE(ds_load1_begin_op); |
| 131 | 131 | ||
| 132 | op = walk_state->op; | 132 | op = walk_state->op; |
| 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
| @@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
| 178 | * Target of Scope() not found. Generate an External for it, and | 178 | * Target of Scope() not found. Generate an External for it, and |
| 179 | * insert the name into the namespace. | 179 | * insert the name into the namespace. |
| 180 | */ | 180 | */ |
| 181 | acpi_dm_add_to_external_list(path); | 181 | acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); |
| 182 | status = | 182 | status = |
| 183 | acpi_ns_lookup(walk_state->scope_info, path, | 183 | acpi_ns_lookup(walk_state->scope_info, path, |
| 184 | object_type, ACPI_IMODE_LOAD_PASS1, | 184 | object_type, ACPI_IMODE_LOAD_PASS1, |
| 185 | ACPI_NS_SEARCH_PARENT, walk_state, | 185 | ACPI_NS_SEARCH_PARENT, walk_state, |
| 186 | &(node)); | 186 | &node); |
| 187 | } | 187 | } |
| 188 | #endif | 188 | #endif |
| 189 | if (ACPI_FAILURE(status)) { | 189 | if (ACPI_FAILURE(status)) { |
| @@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
| 261 | */ | 261 | */ |
| 262 | 262 | ||
| 263 | if (walk_state->deferred_node) { | 263 | if (walk_state->deferred_node) { |
| 264 | |||
| 264 | /* This name is already in the namespace, get the node */ | 265 | /* This name is already in the namespace, get the node */ |
| 265 | 266 | ||
| 266 | node = walk_state->deferred_node; | 267 | node = walk_state->deferred_node; |
| @@ -300,10 +301,41 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
| 300 | status = | 301 | status = |
| 301 | acpi_ns_lookup(walk_state->scope_info, path, object_type, | 302 | acpi_ns_lookup(walk_state->scope_info, path, object_type, |
| 302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, | 303 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
| 303 | &(node)); | 304 | &node); |
| 304 | if (ACPI_FAILURE(status)) { | 305 | if (ACPI_FAILURE(status)) { |
| 305 | ACPI_ERROR_NAMESPACE(path, status); | 306 | if (status == AE_ALREADY_EXISTS) { |
| 306 | return_ACPI_STATUS(status); | 307 | |
| 308 | /* The name already exists in this scope */ | ||
| 309 | |||
| 310 | if (node->flags & ANOBJ_IS_EXTERNAL) { | ||
| 311 | /* | ||
| 312 | * Allow one create on an object or segment that was | ||
| 313 | * previously declared External | ||
| 314 | */ | ||
| 315 | node->flags &= ~ANOBJ_IS_EXTERNAL; | ||
| 316 | node->type = (u8) object_type; | ||
| 317 | |||
| 318 | /* Just retyped a node, probably will need to open a scope */ | ||
| 319 | |||
| 320 | if (acpi_ns_opens_scope(object_type)) { | ||
| 321 | status = | ||
| 322 | acpi_ds_scope_stack_push | ||
| 323 | (node, object_type, | ||
| 324 | walk_state); | ||
| 325 | if (ACPI_FAILURE(status)) { | ||
| 326 | return_ACPI_STATUS | ||
| 327 | (status); | ||
| 328 | } | ||
| 329 | } | ||
| 330 | status = AE_OK; | ||
| 331 | } | ||
| 332 | } | ||
| 333 | |||
| 334 | if (ACPI_FAILURE(status)) { | ||
| 335 | |||
| 336 | ACPI_ERROR_NAMESPACE(path, status); | ||
| 337 | return_ACPI_STATUS(status); | ||
| 338 | } | ||
| 307 | } | 339 | } |
| 308 | break; | 340 | break; |
| 309 | } | 341 | } |
| @@ -311,6 +343,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
| 311 | /* Common exit */ | 343 | /* Common exit */ |
| 312 | 344 | ||
| 313 | if (!op) { | 345 | if (!op) { |
| 346 | |||
| 314 | /* Create a new op */ | 347 | /* Create a new op */ |
| 315 | 348 | ||
| 316 | op = acpi_ps_alloc_op(walk_state->opcode); | 349 | op = acpi_ps_alloc_op(walk_state->opcode); |
| @@ -359,7 +392,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
| 359 | acpi_object_type object_type; | 392 | acpi_object_type object_type; |
| 360 | acpi_status status = AE_OK; | 393 | acpi_status status = AE_OK; |
| 361 | 394 | ||
| 362 | ACPI_FUNCTION_TRACE("ds_load1_end_op"); | 395 | ACPI_FUNCTION_TRACE(ds_load1_end_op); |
| 363 | 396 | ||
| 364 | op = walk_state->op; | 397 | op = walk_state->op; |
| 365 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 398 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
| @@ -413,6 +446,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
| 413 | #endif | 446 | #endif |
| 414 | 447 | ||
| 415 | if (op->common.aml_opcode == AML_NAME_OP) { | 448 | if (op->common.aml_opcode == AML_NAME_OP) { |
| 449 | |||
| 416 | /* For Name opcode, get the object type from the argument */ | 450 | /* For Name opcode, get the object type from the argument */ |
| 417 | 451 | ||
| 418 | if (op->common.value.arg) { | 452 | if (op->common.value.arg) { |
| @@ -445,7 +479,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
| 445 | * arguments.) | 479 | * arguments.) |
| 446 | */ | 480 | */ |
| 447 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 481 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 448 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 482 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
| 449 | walk_state, op, op->named.node)); | 483 | walk_state, op, op->named.node)); |
| 450 | 484 | ||
| 451 | if (!acpi_ns_get_attached_object(op->named.node)) { | 485 | if (!acpi_ns_get_attached_object(op->named.node)) { |
| @@ -511,7 +545,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 511 | acpi_object_type object_type; | 545 | acpi_object_type object_type; |
| 512 | char *buffer_ptr; | 546 | char *buffer_ptr; |
| 513 | 547 | ||
| 514 | ACPI_FUNCTION_TRACE("ds_load2_begin_op"); | 548 | ACPI_FUNCTION_TRACE(ds_load2_begin_op); |
| 515 | 549 | ||
| 516 | op = walk_state->op; | 550 | op = walk_state->op; |
| 517 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 551 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
| @@ -521,6 +555,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 521 | if ((walk_state->control_state) && | 555 | if ((walk_state->control_state) && |
| 522 | (walk_state->control_state->common.state == | 556 | (walk_state->control_state->common.state == |
| 523 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 557 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
| 558 | |||
| 524 | /* We are executing a while loop outside of a method */ | 559 | /* We are executing a while loop outside of a method */ |
| 525 | 560 | ||
| 526 | status = acpi_ds_exec_begin_op(walk_state, out_op); | 561 | status = acpi_ds_exec_begin_op(walk_state, out_op); |
| @@ -554,10 +589,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 554 | /* Get the name we are going to enter or lookup in the namespace */ | 589 | /* Get the name we are going to enter or lookup in the namespace */ |
| 555 | 590 | ||
| 556 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 591 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
| 592 | |||
| 557 | /* For Namepath op, get the path string */ | 593 | /* For Namepath op, get the path string */ |
| 558 | 594 | ||
| 559 | buffer_ptr = op->common.value.string; | 595 | buffer_ptr = op->common.value.string; |
| 560 | if (!buffer_ptr) { | 596 | if (!buffer_ptr) { |
| 597 | |||
| 561 | /* No name, just exit */ | 598 | /* No name, just exit */ |
| 562 | 599 | ||
| 563 | return_ACPI_STATUS(AE_OK); | 600 | return_ACPI_STATUS(AE_OK); |
| @@ -680,6 +717,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 680 | /* All other opcodes */ | 717 | /* All other opcodes */ |
| 681 | 718 | ||
| 682 | if (op && op->common.node) { | 719 | if (op && op->common.node) { |
| 720 | |||
| 683 | /* This op/node was previously entered into the namespace */ | 721 | /* This op/node was previously entered into the namespace */ |
| 684 | 722 | ||
| 685 | node = op->common.node; | 723 | node = op->common.node; |
| @@ -705,6 +743,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 705 | * Note: Name may already exist if we are executing a deferred opcode. | 743 | * Note: Name may already exist if we are executing a deferred opcode. |
| 706 | */ | 744 | */ |
| 707 | if (walk_state->deferred_node) { | 745 | if (walk_state->deferred_node) { |
| 746 | |||
| 708 | /* This name is already in the namespace, get the node */ | 747 | /* This name is already in the namespace, get the node */ |
| 709 | 748 | ||
| 710 | node = walk_state->deferred_node; | 749 | node = walk_state->deferred_node; |
| @@ -727,6 +766,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 727 | } | 766 | } |
| 728 | 767 | ||
| 729 | if (!op) { | 768 | if (!op) { |
| 769 | |||
| 730 | /* Create a new op */ | 770 | /* Create a new op */ |
| 731 | 771 | ||
| 732 | op = acpi_ps_alloc_op(walk_state->opcode); | 772 | op = acpi_ps_alloc_op(walk_state->opcode); |
| @@ -776,7 +816,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 776 | u32 i; | 816 | u32 i; |
| 777 | #endif | 817 | #endif |
| 778 | 818 | ||
| 779 | ACPI_FUNCTION_TRACE("ds_load2_end_op"); | 819 | ACPI_FUNCTION_TRACE(ds_load2_end_op); |
| 780 | 820 | ||
| 781 | op = walk_state->op; | 821 | op = walk_state->op; |
| 782 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | 822 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", |
| @@ -870,7 +910,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 870 | */ | 910 | */ |
| 871 | 911 | ||
| 872 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 912 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 873 | "Create-Load [%s] State=%p Op=%p named_obj=%p\n", | 913 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", |
| 874 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 914 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
| 875 | walk_state, op, node)); | 915 | walk_state, op, node)); |
| 876 | 916 | ||
| @@ -1045,7 +1085,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 1045 | * arguments.) | 1085 | * arguments.) |
| 1046 | */ | 1086 | */ |
| 1047 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1087 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 1048 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 1088 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
| 1049 | walk_state, op, op->named.node)); | 1089 | walk_state, op, op->named.node)); |
| 1050 | 1090 | ||
| 1051 | if (!acpi_ns_get_attached_object(op->named.node)) { | 1091 | if (!acpi_ns_get_attached_object(op->named.node)) { |
| @@ -1090,7 +1130,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 1090 | case AML_CLASS_METHOD_CALL: | 1130 | case AML_CLASS_METHOD_CALL: |
| 1091 | 1131 | ||
| 1092 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1132 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 1093 | "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", | 1133 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", |
| 1094 | walk_state, op, node)); | 1134 | walk_state, op, node)); |
| 1095 | 1135 | ||
| 1096 | /* | 1136 | /* |
| @@ -1104,7 +1144,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
| 1104 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | 1144 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, |
| 1105 | &(new_node)); | 1145 | &(new_node)); |
| 1106 | if (ACPI_SUCCESS(status)) { | 1146 | if (ACPI_SUCCESS(status)) { |
| 1107 | |||
| 1108 | /* | 1147 | /* |
| 1109 | * Make sure that what we found is indeed a method | 1148 | * Make sure that what we found is indeed a method |
| 1110 | * We didn't search for a method on purpose, to see if the name | 1149 | * We didn't search for a method on purpose, to see if the name |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index ada21ef4a174..c9228972f5f6 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
| @@ -63,9 +63,10 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) | |||
| 63 | { | 63 | { |
| 64 | union acpi_generic_state *scope_info; | 64 | union acpi_generic_state *scope_info; |
| 65 | 65 | ||
| 66 | ACPI_FUNCTION_NAME("ds_scope_stack_clear"); | 66 | ACPI_FUNCTION_NAME(ds_scope_stack_clear); |
| 67 | 67 | ||
| 68 | while (walk_state->scope_info) { | 68 | while (walk_state->scope_info) { |
| 69 | |||
| 69 | /* Pop a scope off the stack */ | 70 | /* Pop a scope off the stack */ |
| 70 | 71 | ||
| 71 | scope_info = walk_state->scope_info; | 72 | scope_info = walk_state->scope_info; |
| @@ -102,9 +103,10 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
| 102 | union acpi_generic_state *scope_info; | 103 | union acpi_generic_state *scope_info; |
| 103 | union acpi_generic_state *old_scope_info; | 104 | union acpi_generic_state *old_scope_info; |
| 104 | 105 | ||
| 105 | ACPI_FUNCTION_TRACE("ds_scope_stack_push"); | 106 | ACPI_FUNCTION_TRACE(ds_scope_stack_push); |
| 106 | 107 | ||
| 107 | if (!node) { | 108 | if (!node) { |
| 109 | |||
| 108 | /* Invalid scope */ | 110 | /* Invalid scope */ |
| 109 | 111 | ||
| 110 | ACPI_ERROR((AE_INFO, "Null scope parameter")); | 112 | ACPI_ERROR((AE_INFO, "Null scope parameter")); |
| @@ -126,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
| 126 | 128 | ||
| 127 | /* Init new scope object */ | 129 | /* Init new scope object */ |
| 128 | 130 | ||
| 129 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; | 131 | scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; |
| 130 | scope_info->scope.node = node; | 132 | scope_info->scope.node = node; |
| 131 | scope_info->common.value = (u16) type; | 133 | scope_info->common.value = (u16) type; |
| 132 | 134 | ||
| @@ -176,7 +178,7 @@ acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) | |||
| 176 | union acpi_generic_state *scope_info; | 178 | union acpi_generic_state *scope_info; |
| 177 | union acpi_generic_state *new_scope_info; | 179 | union acpi_generic_state *new_scope_info; |
| 178 | 180 | ||
| 179 | ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); | 181 | ACPI_FUNCTION_TRACE(ds_scope_stack_pop); |
| 180 | 182 | ||
| 181 | /* | 183 | /* |
| 182 | * Pop scope info object off the stack. | 184 | * Pop scope info object off the stack. |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index fa78cb74ee36..7817e5522679 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
| @@ -66,7 +66,6 @@ void *acpi_ds_obj_stack_get_value(u32 index, | |||
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
| 69 | |||
| 70 | /******************************************************************************* | 69 | /******************************************************************************* |
| 71 | * | 70 | * |
| 72 | * FUNCTION: acpi_ds_result_remove | 71 | * FUNCTION: acpi_ds_result_remove |
| @@ -88,7 +87,7 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
| 88 | { | 87 | { |
| 89 | union acpi_generic_state *state; | 88 | union acpi_generic_state *state; |
| 90 | 89 | ||
| 91 | ACPI_FUNCTION_NAME("ds_result_remove"); | 90 | ACPI_FUNCTION_NAME(ds_result_remove); |
| 92 | 91 | ||
| 93 | state = walk_state->results; | 92 | state = walk_state->results; |
| 94 | if (!state) { | 93 | if (!state) { |
| @@ -128,7 +127,6 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
| 128 | 127 | ||
| 129 | return (AE_OK); | 128 | return (AE_OK); |
| 130 | } | 129 | } |
| 131 | |||
| 132 | #endif /* ACPI_FUTURE_USAGE */ | 130 | #endif /* ACPI_FUTURE_USAGE */ |
| 133 | 131 | ||
| 134 | /******************************************************************************* | 132 | /******************************************************************************* |
| @@ -152,7 +150,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
| 152 | acpi_native_uint index; | 150 | acpi_native_uint index; |
| 153 | union acpi_generic_state *state; | 151 | union acpi_generic_state *state; |
| 154 | 152 | ||
| 155 | ACPI_FUNCTION_NAME("ds_result_pop"); | 153 | ACPI_FUNCTION_NAME(ds_result_pop); |
| 156 | 154 | ||
| 157 | state = walk_state->results; | 155 | state = walk_state->results; |
| 158 | if (!state) { | 156 | if (!state) { |
| @@ -170,6 +168,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
| 170 | state->results.num_results--; | 168 | state->results.num_results--; |
| 171 | 169 | ||
| 172 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { | 170 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { |
| 171 | |||
| 173 | /* Check for a valid result object */ | 172 | /* Check for a valid result object */ |
| 174 | 173 | ||
| 175 | if (state->results.obj_desc[index - 1]) { | 174 | if (state->results.obj_desc[index - 1]) { |
| @@ -213,7 +212,7 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, | |||
| 213 | acpi_native_uint index; | 212 | acpi_native_uint index; |
| 214 | union acpi_generic_state *state; | 213 | union acpi_generic_state *state; |
| 215 | 214 | ||
| 216 | ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); | 215 | ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); |
| 217 | 216 | ||
| 218 | state = walk_state->results; | 217 | state = walk_state->results; |
| 219 | if (!state) { | 218 | if (!state) { |
| @@ -278,7 +277,7 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
| 278 | { | 277 | { |
| 279 | union acpi_generic_state *state; | 278 | union acpi_generic_state *state; |
| 280 | 279 | ||
| 281 | ACPI_FUNCTION_NAME("ds_result_push"); | 280 | ACPI_FUNCTION_NAME(ds_result_push); |
| 282 | 281 | ||
| 283 | state = walk_state->results; | 282 | state = walk_state->results; |
| 284 | if (!state) { | 283 | if (!state) { |
| @@ -331,14 +330,14 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
| 331 | { | 330 | { |
| 332 | union acpi_generic_state *state; | 331 | union acpi_generic_state *state; |
| 333 | 332 | ||
| 334 | ACPI_FUNCTION_NAME("ds_result_stack_push"); | 333 | ACPI_FUNCTION_NAME(ds_result_stack_push); |
| 335 | 334 | ||
| 336 | state = acpi_ut_create_generic_state(); | 335 | state = acpi_ut_create_generic_state(); |
| 337 | if (!state) { | 336 | if (!state) { |
| 338 | return (AE_NO_MEMORY); | 337 | return (AE_NO_MEMORY); |
| 339 | } | 338 | } |
| 340 | 339 | ||
| 341 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; | 340 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; |
| 342 | acpi_ut_push_generic_state(&walk_state->results, state); | 341 | acpi_ut_push_generic_state(&walk_state->results, state); |
| 343 | 342 | ||
| 344 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", | 343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
| @@ -363,7 +362,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
| 363 | { | 362 | { |
| 364 | union acpi_generic_state *state; | 363 | union acpi_generic_state *state; |
| 365 | 364 | ||
| 366 | ACPI_FUNCTION_NAME("ds_result_stack_pop"); | 365 | ACPI_FUNCTION_NAME(ds_result_stack_pop); |
| 367 | 366 | ||
| 368 | /* Check for stack underflow */ | 367 | /* Check for stack underflow */ |
| 369 | 368 | ||
| @@ -376,7 +375,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
| 376 | state = acpi_ut_pop_generic_state(&walk_state->results); | 375 | state = acpi_ut_pop_generic_state(&walk_state->results); |
| 377 | 376 | ||
| 378 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 379 | "Result=%p remaining_results=%X State=%p\n", | 378 | "Result=%p RemainingResults=%X State=%p\n", |
| 380 | state, state->results.num_results, walk_state)); | 379 | state, state->results.num_results, walk_state)); |
| 381 | 380 | ||
| 382 | acpi_ut_delete_generic_state(state); | 381 | acpi_ut_delete_generic_state(state); |
| @@ -400,7 +399,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
| 400 | acpi_status | 399 | acpi_status |
| 401 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) | 400 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) |
| 402 | { | 401 | { |
| 403 | ACPI_FUNCTION_NAME("ds_obj_stack_push"); | 402 | ACPI_FUNCTION_NAME(ds_obj_stack_push); |
| 404 | 403 | ||
| 405 | /* Check for stack overflow */ | 404 | /* Check for stack overflow */ |
| 406 | 405 | ||
| @@ -445,9 +444,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) | |||
| 445 | { | 444 | { |
| 446 | u32 i; | 445 | u32 i; |
| 447 | 446 | ||
| 448 | ACPI_FUNCTION_NAME("ds_obj_stack_pop"); | 447 | ACPI_FUNCTION_NAME(ds_obj_stack_pop); |
| 449 | 448 | ||
| 450 | for (i = 0; i < pop_count; i++) { | 449 | for (i = 0; i < pop_count; i++) { |
| 450 | |||
| 451 | /* Check for stack underflow */ | 451 | /* Check for stack underflow */ |
| 452 | 452 | ||
| 453 | if (walk_state->num_operands == 0) { | 453 | if (walk_state->num_operands == 0) { |
| @@ -491,9 +491,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
| 491 | u32 i; | 491 | u32 i; |
| 492 | union acpi_operand_object *obj_desc; | 492 | union acpi_operand_object *obj_desc; |
| 493 | 493 | ||
| 494 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); | 494 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); |
| 495 | 495 | ||
| 496 | for (i = 0; i < pop_count; i++) { | 496 | for (i = 0; i < pop_count; i++) { |
| 497 | |||
| 497 | /* Check for stack underflow */ | 498 | /* Check for stack underflow */ |
| 498 | 499 | ||
| 499 | if (walk_state->num_operands == 0) { | 500 | if (walk_state->num_operands == 0) { |
| @@ -538,13 +539,13 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
| 538 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state | 539 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state |
| 539 | *thread) | 540 | *thread) |
| 540 | { | 541 | { |
| 541 | ACPI_FUNCTION_NAME("ds_get_current_walk_state"); | 542 | ACPI_FUNCTION_NAME(ds_get_current_walk_state); |
| 542 | 543 | ||
| 543 | if (!thread) { | 544 | if (!thread) { |
| 544 | return (NULL); | 545 | return (NULL); |
| 545 | } | 546 | } |
| 546 | 547 | ||
| 547 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", | 548 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n", |
| 548 | thread->walk_state_list)); | 549 | thread->walk_state_list)); |
| 549 | 550 | ||
| 550 | return (thread->walk_state_list); | 551 | return (thread->walk_state_list); |
| @@ -567,7 +568,7 @@ void | |||
| 567 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, | 568 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, |
| 568 | struct acpi_thread_state *thread) | 569 | struct acpi_thread_state *thread) |
| 569 | { | 570 | { |
| 570 | ACPI_FUNCTION_TRACE("ds_push_walk_state"); | 571 | ACPI_FUNCTION_TRACE(ds_push_walk_state); |
| 571 | 572 | ||
| 572 | walk_state->next = thread->walk_state_list; | 573 | walk_state->next = thread->walk_state_list; |
| 573 | thread->walk_state_list = walk_state; | 574 | thread->walk_state_list = walk_state; |
| @@ -593,11 +594,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
| 593 | { | 594 | { |
| 594 | struct acpi_walk_state *walk_state; | 595 | struct acpi_walk_state *walk_state; |
| 595 | 596 | ||
| 596 | ACPI_FUNCTION_TRACE("ds_pop_walk_state"); | 597 | ACPI_FUNCTION_TRACE(ds_pop_walk_state); |
| 597 | 598 | ||
| 598 | walk_state = thread->walk_state_list; | 599 | walk_state = thread->walk_state_list; |
| 599 | 600 | ||
| 600 | if (walk_state) { | 601 | if (walk_state) { |
| 602 | |||
| 601 | /* Next walk state becomes the current walk state */ | 603 | /* Next walk state becomes the current walk state */ |
| 602 | 604 | ||
| 603 | thread->walk_state_list = walk_state->next; | 605 | thread->walk_state_list = walk_state->next; |
| @@ -618,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
| 618 | * | 620 | * |
| 619 | * PARAMETERS: owner_id - ID for object creation | 621 | * PARAMETERS: owner_id - ID for object creation |
| 620 | * Origin - Starting point for this walk | 622 | * Origin - Starting point for this walk |
| 621 | * mth_desc - Method object | 623 | * method_desc - Method object |
| 622 | * Thread - Current thread state | 624 | * Thread - Current thread state |
| 623 | * | 625 | * |
| 624 | * RETURN: Pointer to the new walk state. | 626 | * RETURN: Pointer to the new walk state. |
| @@ -632,24 +634,24 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
| 632 | union acpi_parse_object | 634 | union acpi_parse_object |
| 633 | *origin, | 635 | *origin, |
| 634 | union acpi_operand_object | 636 | union acpi_operand_object |
| 635 | *mth_desc, | 637 | *method_desc, |
| 636 | struct acpi_thread_state | 638 | struct acpi_thread_state |
| 637 | *thread) | 639 | *thread) |
| 638 | { | 640 | { |
| 639 | struct acpi_walk_state *walk_state; | 641 | struct acpi_walk_state *walk_state; |
| 640 | acpi_status status; | 642 | acpi_status status; |
| 641 | 643 | ||
| 642 | ACPI_FUNCTION_TRACE("ds_create_walk_state"); | 644 | ACPI_FUNCTION_TRACE(ds_create_walk_state); |
| 643 | 645 | ||
| 644 | walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); | 646 | walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); |
| 645 | if (!walk_state) { | 647 | if (!walk_state) { |
| 646 | return_PTR(NULL); | 648 | return_PTR(NULL); |
| 647 | } | 649 | } |
| 648 | 650 | ||
| 649 | walk_state->data_type = ACPI_DESC_TYPE_WALK; | 651 | walk_state->descriptor_type = ACPI_DESC_TYPE_WALK; |
| 652 | walk_state->method_desc = method_desc; | ||
| 650 | walk_state->owner_id = owner_id; | 653 | walk_state->owner_id = owner_id; |
| 651 | walk_state->origin = origin; | 654 | walk_state->origin = origin; |
| 652 | walk_state->method_desc = mth_desc; | ||
| 653 | walk_state->thread = thread; | 655 | walk_state->thread = thread; |
| 654 | 656 | ||
| 655 | walk_state->parser_state.start_op = origin; | 657 | walk_state->parser_state.start_op = origin; |
| @@ -664,7 +666,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
| 664 | 666 | ||
| 665 | status = acpi_ds_result_stack_push(walk_state); | 667 | status = acpi_ds_result_stack_push(walk_state); |
| 666 | if (ACPI_FAILURE(status)) { | 668 | if (ACPI_FAILURE(status)) { |
| 667 | ACPI_MEM_FREE(walk_state); | 669 | ACPI_FREE(walk_state); |
| 668 | return_PTR(NULL); | 670 | return_PTR(NULL); |
| 669 | } | 671 | } |
| 670 | 672 | ||
| @@ -701,13 +703,13 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
| 701 | struct acpi_namespace_node *method_node, | 703 | struct acpi_namespace_node *method_node, |
| 702 | u8 * aml_start, | 704 | u8 * aml_start, |
| 703 | u32 aml_length, | 705 | u32 aml_length, |
| 704 | struct acpi_parameter_info *info, u8 pass_number) | 706 | struct acpi_evaluate_info *info, u8 pass_number) |
| 705 | { | 707 | { |
| 706 | acpi_status status; | 708 | acpi_status status; |
| 707 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 709 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
| 708 | union acpi_parse_object *extra_op; | 710 | union acpi_parse_object *extra_op; |
| 709 | 711 | ||
| 710 | ACPI_FUNCTION_TRACE("ds_init_aml_walk"); | 712 | ACPI_FUNCTION_TRACE(ds_init_aml_walk); |
| 711 | 713 | ||
| 712 | walk_state->parser_state.aml = | 714 | walk_state->parser_state.aml = |
| 713 | walk_state->parser_state.aml_start = aml_start; | 715 | walk_state->parser_state.aml_start = aml_start; |
| @@ -778,6 +780,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
| 778 | } | 780 | } |
| 779 | 781 | ||
| 780 | if (parser_state->start_node) { | 782 | if (parser_state->start_node) { |
| 783 | |||
| 781 | /* Push start scope on scope stack and make it current */ | 784 | /* Push start scope on scope stack and make it current */ |
| 782 | 785 | ||
| 783 | status = | 786 | status = |
| @@ -810,21 +813,24 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
| 810 | { | 813 | { |
| 811 | union acpi_generic_state *state; | 814 | union acpi_generic_state *state; |
| 812 | 815 | ||
| 813 | ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); | 816 | ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state); |
| 814 | 817 | ||
| 815 | if (!walk_state) { | 818 | if (!walk_state) { |
| 816 | return; | 819 | return; |
| 817 | } | 820 | } |
| 818 | 821 | ||
| 819 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 822 | if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { |
| 820 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", | 823 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", |
| 821 | walk_state)); | 824 | walk_state)); |
| 822 | return; | 825 | return; |
| 823 | } | 826 | } |
| 824 | 827 | ||
| 828 | /* There should not be any open scopes */ | ||
| 829 | |||
| 825 | if (walk_state->parser_state.scope) { | 830 | if (walk_state->parser_state.scope) { |
| 826 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", | 831 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", |
| 827 | walk_state)); | 832 | walk_state)); |
| 833 | acpi_ps_cleanup_scope(&walk_state->parser_state); | ||
| 828 | } | 834 | } |
| 829 | 835 | ||
| 830 | /* Always must free any linked control states */ | 836 | /* Always must free any linked control states */ |
| @@ -854,7 +860,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
| 854 | acpi_ut_delete_generic_state(state); | 860 | acpi_ut_delete_generic_state(state); |
| 855 | } | 861 | } |
| 856 | 862 | ||
| 857 | ACPI_MEM_FREE(walk_state); | 863 | ACPI_FREE(walk_state); |
| 858 | return_VOID; | 864 | return_VOID; |
| 859 | } | 865 | } |
| 860 | 866 | ||
| @@ -879,7 +885,7 @@ acpi_ds_result_insert(void *object, | |||
| 879 | { | 885 | { |
| 880 | union acpi_generic_state *state; | 886 | union acpi_generic_state *state; |
| 881 | 887 | ||
| 882 | ACPI_FUNCTION_NAME("ds_result_insert"); | 888 | ACPI_FUNCTION_NAME(ds_result_insert); |
| 883 | 889 | ||
| 884 | state = walk_state->results; | 890 | state = walk_state->results; |
| 885 | if (!state) { | 891 | if (!state) { |
| @@ -937,7 +943,7 @@ acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) | |||
| 937 | { | 943 | { |
| 938 | u32 i; | 944 | u32 i; |
| 939 | 945 | ||
| 940 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); | 946 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); |
| 941 | 947 | ||
| 942 | /* The stack size is configurable, but fixed */ | 948 | /* The stack size is configurable, but fixed */ |
| 943 | 949 | ||
| @@ -969,7 +975,7 @@ acpi_status | |||
| 969 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | 975 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, |
| 970 | struct acpi_walk_state *walk_state) | 976 | struct acpi_walk_state *walk_state) |
| 971 | { | 977 | { |
| 972 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); | 978 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); |
| 973 | 979 | ||
| 974 | /* Check for stack underflow */ | 980 | /* Check for stack underflow */ |
| 975 | 981 | ||
| @@ -1025,7 +1031,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | |||
| 1025 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) | 1031 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) |
| 1026 | { | 1032 | { |
| 1027 | 1033 | ||
| 1028 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); | 1034 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); |
| 1029 | 1035 | ||
| 1030 | /* Can't do it if the stack is empty */ | 1036 | /* Can't do it if the stack is empty */ |
| 1031 | 1037 | ||
