diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 14:52:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 14:52:52 -0400 |
commit | 08acd4f8af42affd8cbed81cc1b69fa12ddb213f (patch) | |
tree | 988d15db6233b20db6a500cd5f590c6d2041462d /drivers/acpi/executer | |
parent | ccf2779544eecfcc5447e2028d1029b6d4ff7bb6 (diff) | |
parent | 008238b54ac2350babf195084ecedbcf7851a202 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (179 commits)
ACPI: Fix acpi_processor_idle and idle= boot parameters interaction
acpi: fix section mismatch warning in pnpacpi
intel_menlo: fix build warning
ACPI: Cleanup: Remove unneeded, multiple local dummy variables
ACPI: video - fix permissions on some proc entries
ACPI: video - properly handle errors when registering proc elements
ACPI: video - do not store invalid entries in attached_array list
ACPI: re-name acpi_pm_ops to acpi_suspend_ops
ACER_WMI/ASUS_LAPTOP: fix build bug
thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed
ACPI: check a return value correctly in acpi_power_get_context()
#if 0 acpi/bay.c:eject_removable_drive()
eeepc-laptop: add hwmon fan control
eeepc-laptop: add backlight
eeepc-laptop: add base driver
ACPI: thinkpad-acpi: bump up version to 0.20
ACPI: thinkpad-acpi: fix selects in Kconfig
ACPI: thinkpad-acpi: use a private workqueue
ACPI: thinkpad-acpi: fluff really minor fix
ACPI: thinkpad-acpi: use uppercase for "LED" on user documentation
...
Fixed conflicts in drivers/acpi/video.c and drivers/misc/intel_menlow.c
manually.
Diffstat (limited to 'drivers/acpi/executer')
23 files changed, 592 insertions, 410 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 25802f302ffe..24da921d13e3 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
46 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acevents.h> | ||
49 | #include <acpi/actables.h> | 48 | #include <acpi/actables.h> |
50 | #include <acpi/acdispat.h> | 49 | #include <acpi/acdispat.h> |
51 | 50 | ||
@@ -138,6 +137,14 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
138 | 137 | ||
139 | ACPI_FUNCTION_TRACE(ex_load_table_op); | 138 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
140 | 139 | ||
140 | /* Validate lengths for the signature_string, OEMIDString, OEMtable_iD */ | ||
141 | |||
142 | if ((operand[0]->string.length > ACPI_NAME_SIZE) || | ||
143 | (operand[1]->string.length > ACPI_OEM_ID_SIZE) || | ||
144 | (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) { | ||
145 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
146 | } | ||
147 | |||
141 | /* Find the ACPI table in the RSDT/XSDT */ | 148 | /* Find the ACPI table in the RSDT/XSDT */ |
142 | 149 | ||
143 | status = acpi_tb_find_table(operand[0]->string.pointer, | 150 | status = acpi_tb_find_table(operand[0]->string.pointer, |
@@ -229,11 +236,18 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
229 | status = acpi_get_table_by_index(table_index, &table); | 236 | status = acpi_get_table_by_index(table_index, &table); |
230 | if (ACPI_SUCCESS(status)) { | 237 | if (ACPI_SUCCESS(status)) { |
231 | ACPI_INFO((AE_INFO, | 238 | ACPI_INFO((AE_INFO, |
232 | "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", | 239 | "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]", |
233 | table->signature, table->oem_id, | 240 | table->signature, table->oem_id, |
234 | table->oem_table_id)); | 241 | table->oem_table_id)); |
235 | } | 242 | } |
236 | 243 | ||
244 | /* Invoke table handler if present */ | ||
245 | |||
246 | if (acpi_gbl_table_handler) { | ||
247 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table, | ||
248 | acpi_gbl_table_handler_context); | ||
249 | } | ||
250 | |||
237 | *return_desc = ddb_handle; | 251 | *return_desc = ddb_handle; |
238 | return_ACPI_STATUS(status); | 252 | return_ACPI_STATUS(status); |
239 | } | 253 | } |
@@ -268,6 +282,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
268 | struct acpi_table_desc table_desc; | 282 | struct acpi_table_desc table_desc; |
269 | acpi_native_uint table_index; | 283 | acpi_native_uint table_index; |
270 | acpi_status status; | 284 | acpi_status status; |
285 | u32 length; | ||
271 | 286 | ||
272 | ACPI_FUNCTION_TRACE(ex_load_op); | 287 | ACPI_FUNCTION_TRACE(ex_load_op); |
273 | 288 | ||
@@ -278,16 +293,16 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
278 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 293 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
279 | case ACPI_TYPE_REGION: | 294 | case ACPI_TYPE_REGION: |
280 | 295 | ||
296 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", | ||
297 | obj_desc, | ||
298 | acpi_ut_get_object_type_name(obj_desc))); | ||
299 | |||
281 | /* Region must be system_memory (from ACPI spec) */ | 300 | /* Region must be system_memory (from ACPI spec) */ |
282 | 301 | ||
283 | if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { | 302 | if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
284 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 303 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
285 | } | 304 | } |
286 | 305 | ||
287 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", | ||
288 | obj_desc, | ||
289 | acpi_ut_get_object_type_name(obj_desc))); | ||
290 | |||
291 | /* | 306 | /* |
292 | * If the Region Address and Length have not been previously evaluated, | 307 | * If the Region Address and Length have not been previously evaluated, |
293 | * evaluate them now and save the results. | 308 | * evaluate them now and save the results. |
@@ -299,6 +314,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
299 | } | 314 | } |
300 | } | 315 | } |
301 | 316 | ||
317 | /* | ||
318 | * We will simply map the memory region for the table. However, the | ||
319 | * memory region is technically not guaranteed to remain stable and | ||
320 | * we may eventually have to copy the table to a local buffer. | ||
321 | */ | ||
302 | table_desc.address = obj_desc->region.address; | 322 | table_desc.address = obj_desc->region.address; |
303 | table_desc.length = obj_desc->region.length; | 323 | table_desc.length = obj_desc->region.length; |
304 | table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; | 324 | table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; |
@@ -306,18 +326,41 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
306 | 326 | ||
307 | case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ | 327 | case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ |
308 | 328 | ||
309 | /* Simply extract the buffer from the buffer object */ | ||
310 | |||
311 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 329 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
312 | "Load from Buffer or Field %p %s\n", obj_desc, | 330 | "Load from Buffer or Field %p %s\n", obj_desc, |
313 | acpi_ut_get_object_type_name(obj_desc))); | 331 | acpi_ut_get_object_type_name(obj_desc))); |
314 | 332 | ||
315 | table_desc.pointer = ACPI_CAST_PTR(struct acpi_table_header, | 333 | length = obj_desc->buffer.length; |
316 | obj_desc->buffer.pointer); | 334 | |
317 | table_desc.length = table_desc.pointer->length; | 335 | /* Must have at least an ACPI table header */ |
318 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | 336 | |
337 | if (length < sizeof(struct acpi_table_header)) { | ||
338 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | ||
339 | } | ||
340 | |||
341 | /* Validate checksum here. It won't get validated in tb_add_table */ | ||
319 | 342 | ||
320 | obj_desc->buffer.pointer = NULL; | 343 | status = |
344 | acpi_tb_verify_checksum(ACPI_CAST_PTR | ||
345 | (struct acpi_table_header, | ||
346 | obj_desc->buffer.pointer), length); | ||
347 | if (ACPI_FAILURE(status)) { | ||
348 | return_ACPI_STATUS(status); | ||
349 | } | ||
350 | |||
351 | /* | ||
352 | * We need to copy the buffer since the original buffer could be | ||
353 | * changed or deleted in the future | ||
354 | */ | ||
355 | table_desc.pointer = ACPI_ALLOCATE(length); | ||
356 | if (!table_desc.pointer) { | ||
357 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
358 | } | ||
359 | |||
360 | ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, | ||
361 | length); | ||
362 | table_desc.length = length; | ||
363 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | ||
321 | break; | 364 | break; |
322 | 365 | ||
323 | default: | 366 | default: |
@@ -333,7 +376,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
333 | } | 376 | } |
334 | 377 | ||
335 | status = | 378 | status = |
336 | acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle); | 379 | acpi_ex_add_table(table_index, walk_state->scope_info->scope.node, |
380 | &ddb_handle); | ||
337 | if (ACPI_FAILURE(status)) { | 381 | if (ACPI_FAILURE(status)) { |
338 | 382 | ||
339 | /* On error, table_ptr was deallocated above */ | 383 | /* On error, table_ptr was deallocated above */ |
@@ -349,11 +393,23 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
349 | 393 | ||
350 | /* table_ptr was deallocated above */ | 394 | /* table_ptr was deallocated above */ |
351 | 395 | ||
396 | acpi_ut_remove_reference(ddb_handle); | ||
352 | return_ACPI_STATUS(status); | 397 | return_ACPI_STATUS(status); |
353 | } | 398 | } |
354 | 399 | ||
400 | /* Invoke table handler if present */ | ||
401 | |||
402 | if (acpi_gbl_table_handler) { | ||
403 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, | ||
404 | table_desc.pointer, | ||
405 | acpi_gbl_table_handler_context); | ||
406 | } | ||
407 | |||
355 | cleanup: | 408 | cleanup: |
356 | if (ACPI_FAILURE(status)) { | 409 | if (ACPI_FAILURE(status)) { |
410 | |||
411 | /* Delete allocated buffer or mapping */ | ||
412 | |||
357 | acpi_tb_delete_table(&table_desc); | 413 | acpi_tb_delete_table(&table_desc); |
358 | } | 414 | } |
359 | return_ACPI_STATUS(status); | 415 | return_ACPI_STATUS(status); |
@@ -376,6 +432,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
376 | acpi_status status = AE_OK; | 432 | acpi_status status = AE_OK; |
377 | union acpi_operand_object *table_desc = ddb_handle; | 433 | union acpi_operand_object *table_desc = ddb_handle; |
378 | acpi_native_uint table_index; | 434 | acpi_native_uint table_index; |
435 | struct acpi_table_header *table; | ||
379 | 436 | ||
380 | ACPI_FUNCTION_TRACE(ex_unload_table); | 437 | ACPI_FUNCTION_TRACE(ex_unload_table); |
381 | 438 | ||
@@ -395,17 +452,25 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
395 | 452 | ||
396 | table_index = (acpi_native_uint) table_desc->reference.object; | 453 | table_index = (acpi_native_uint) table_desc->reference.object; |
397 | 454 | ||
455 | /* Invoke table handler if present */ | ||
456 | |||
457 | if (acpi_gbl_table_handler) { | ||
458 | status = acpi_get_table_by_index(table_index, &table); | ||
459 | if (ACPI_SUCCESS(status)) { | ||
460 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD, | ||
461 | table, | ||
462 | acpi_gbl_table_handler_context); | ||
463 | } | ||
464 | } | ||
465 | |||
398 | /* | 466 | /* |
399 | * Delete the entire namespace under this table Node | 467 | * Delete the entire namespace under this table Node |
400 | * (Offset contains the table_id) | 468 | * (Offset contains the table_id) |
401 | */ | 469 | */ |
402 | acpi_tb_delete_namespace_by_owner(table_index); | 470 | acpi_tb_delete_namespace_by_owner(table_index); |
403 | acpi_tb_release_owner_id(table_index); | 471 | (void)acpi_tb_release_owner_id(table_index); |
404 | 472 | ||
405 | acpi_tb_set_table_loaded_flag(table_index, FALSE); | 473 | acpi_tb_set_table_loaded_flag(table_index, FALSE); |
406 | 474 | ||
407 | /* Delete the table descriptor (ddb_handle) */ | 475 | return_ACPI_STATUS(AE_OK); |
408 | |||
409 | acpi_ut_remove_reference(table_desc); | ||
410 | return_ACPI_STATUS(status); | ||
411 | } | 476 | } |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 79f2c0d42c06..fd954b4ed83d 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 6e9a23e47fef..60e62c4f0577 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -96,6 +96,9 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
96 | * to the original Node. | 96 | * to the original Node. |
97 | */ | 97 | */ |
98 | switch (target_node->type) { | 98 | switch (target_node->type) { |
99 | |||
100 | /* For these types, the sub-object can change dynamically via a Store */ | ||
101 | |||
99 | case ACPI_TYPE_INTEGER: | 102 | case ACPI_TYPE_INTEGER: |
100 | case ACPI_TYPE_STRING: | 103 | case ACPI_TYPE_STRING: |
101 | case ACPI_TYPE_BUFFER: | 104 | case ACPI_TYPE_BUFFER: |
@@ -103,9 +106,18 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
103 | case ACPI_TYPE_BUFFER_FIELD: | 106 | case ACPI_TYPE_BUFFER_FIELD: |
104 | 107 | ||
105 | /* | 108 | /* |
109 | * These types open a new scope, so we need the NS node in order to access | ||
110 | * any children. | ||
111 | */ | ||
112 | case ACPI_TYPE_DEVICE: | ||
113 | case ACPI_TYPE_POWER: | ||
114 | case ACPI_TYPE_PROCESSOR: | ||
115 | case ACPI_TYPE_THERMAL: | ||
116 | case ACPI_TYPE_LOCAL_SCOPE: | ||
117 | |||
118 | /* | ||
106 | * The new alias has the type ALIAS and points to the original | 119 | * The new alias has the type ALIAS and points to the original |
107 | * NS node, not the object itself. This is because for these | 120 | * NS node, not the object itself. |
108 | * types, the object can change dynamically via a Store. | ||
109 | */ | 121 | */ |
110 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; | 122 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; |
111 | alias_node->object = | 123 | alias_node->object = |
@@ -115,9 +127,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
115 | case ACPI_TYPE_METHOD: | 127 | case ACPI_TYPE_METHOD: |
116 | 128 | ||
117 | /* | 129 | /* |
118 | * The new alias has the type ALIAS and points to the original | 130 | * Control method aliases need to be differentiated |
119 | * NS node, not the object itself. This is because for these | ||
120 | * types, the object can change dynamically via a Store. | ||
121 | */ | 131 | */ |
122 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; | 132 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; |
123 | alias_node->object = | 133 | alias_node->object = |
@@ -342,101 +352,6 @@ acpi_ex_create_region(u8 * aml_start, | |||
342 | 352 | ||
343 | /******************************************************************************* | 353 | /******************************************************************************* |
344 | * | 354 | * |
345 | * FUNCTION: acpi_ex_create_table_region | ||
346 | * | ||
347 | * PARAMETERS: walk_state - Current state | ||
348 | * | ||
349 | * RETURN: Status | ||
350 | * | ||
351 | * DESCRIPTION: Create a new data_table_region object | ||
352 | * | ||
353 | ******************************************************************************/ | ||
354 | |||
355 | acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) | ||
356 | { | ||
357 | acpi_status status; | ||
358 | union acpi_operand_object **operand = &walk_state->operands[0]; | ||
359 | union acpi_operand_object *obj_desc; | ||
360 | struct acpi_namespace_node *node; | ||
361 | union acpi_operand_object *region_obj2; | ||
362 | acpi_native_uint table_index; | ||
363 | struct acpi_table_header *table; | ||
364 | |||
365 | ACPI_FUNCTION_TRACE(ex_create_table_region); | ||
366 | |||
367 | /* Get the Node from the object stack */ | ||
368 | |||
369 | node = walk_state->op->common.node; | ||
370 | |||
371 | /* | ||
372 | * If the region object is already attached to this node, | ||
373 | * just return | ||
374 | */ | ||
375 | if (acpi_ns_get_attached_object(node)) { | ||
376 | return_ACPI_STATUS(AE_OK); | ||
377 | } | ||
378 | |||
379 | /* Find the ACPI table */ | ||
380 | |||
381 | status = acpi_tb_find_table(operand[1]->string.pointer, | ||
382 | operand[2]->string.pointer, | ||
383 | operand[3]->string.pointer, &table_index); | ||
384 | if (ACPI_FAILURE(status)) { | ||
385 | return_ACPI_STATUS(status); | ||
386 | } | ||
387 | |||
388 | /* Create the region descriptor */ | ||
389 | |||
390 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); | ||
391 | if (!obj_desc) { | ||
392 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
393 | } | ||
394 | |||
395 | region_obj2 = obj_desc->common.next_object; | ||
396 | region_obj2->extra.region_context = NULL; | ||
397 | |||
398 | status = acpi_get_table_by_index(table_index, &table); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | return_ACPI_STATUS(status); | ||
401 | } | ||
402 | |||
403 | /* Init the region from the operands */ | ||
404 | |||
405 | obj_desc->region.space_id = REGION_DATA_TABLE; | ||
406 | obj_desc->region.address = | ||
407 | (acpi_physical_address) ACPI_TO_INTEGER(table); | ||
408 | obj_desc->region.length = table->length; | ||
409 | obj_desc->region.node = node; | ||
410 | obj_desc->region.flags = AOPOBJ_DATA_VALID; | ||
411 | |||
412 | /* Install the new region object in the parent Node */ | ||
413 | |||
414 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); | ||
415 | if (ACPI_FAILURE(status)) { | ||
416 | goto cleanup; | ||
417 | } | ||
418 | |||
419 | status = acpi_ev_initialize_region(obj_desc, FALSE); | ||
420 | if (ACPI_FAILURE(status)) { | ||
421 | if (status == AE_NOT_EXIST) { | ||
422 | status = AE_OK; | ||
423 | } else { | ||
424 | goto cleanup; | ||
425 | } | ||
426 | } | ||
427 | |||
428 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; | ||
429 | |||
430 | cleanup: | ||
431 | |||
432 | /* Remove local reference to the object */ | ||
433 | |||
434 | acpi_ut_remove_reference(obj_desc); | ||
435 | return_ACPI_STATUS(status); | ||
436 | } | ||
437 | |||
438 | /******************************************************************************* | ||
439 | * | ||
440 | * FUNCTION: acpi_ex_create_processor | 355 | * FUNCTION: acpi_ex_create_processor |
441 | * | 356 | * |
442 | * PARAMETERS: walk_state - Current state | 357 | * PARAMETERS: walk_state - Current state |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 51c9c29987c3..74f1b22601b3 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -500,25 +500,28 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
500 | acpi_os_printf("Reference: Debug\n"); | 500 | acpi_os_printf("Reference: Debug\n"); |
501 | break; | 501 | break; |
502 | 502 | ||
503 | case AML_NAME_OP: | 503 | case AML_INDEX_OP: |
504 | 504 | ||
505 | ACPI_DUMP_PATHNAME(obj_desc->reference.object, | 505 | acpi_os_printf("Reference: Index %p\n", |
506 | "Reference: Name: ", ACPI_LV_INFO, | 506 | obj_desc->reference.object); |
507 | _COMPONENT); | ||
508 | ACPI_DUMP_ENTRY(obj_desc->reference.object, | ||
509 | ACPI_LV_INFO); | ||
510 | break; | 507 | break; |
511 | 508 | ||
512 | case AML_INDEX_OP: | 509 | case AML_LOAD_OP: |
513 | 510 | ||
514 | acpi_os_printf("Reference: Index %p\n", | 511 | acpi_os_printf("Reference: [DdbHandle] TableIndex %p\n", |
515 | obj_desc->reference.object); | 512 | obj_desc->reference.object); |
516 | break; | 513 | break; |
517 | 514 | ||
518 | case AML_REF_OF_OP: | 515 | case AML_REF_OF_OP: |
519 | 516 | ||
520 | acpi_os_printf("Reference: (RefOf) %p\n", | 517 | acpi_os_printf("Reference: (RefOf) %p [%s]\n", |
521 | obj_desc->reference.object); | 518 | obj_desc->reference.object, |
519 | acpi_ut_get_type_name(((union | ||
520 | acpi_operand_object | ||
521 | *)obj_desc-> | ||
522 | reference. | ||
523 | object)->common. | ||
524 | type)); | ||
522 | break; | 525 | break; |
523 | 526 | ||
524 | case AML_ARG_OP: | 527 | case AML_ARG_OP: |
@@ -559,8 +562,9 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
559 | 562 | ||
560 | case AML_INT_NAMEPATH_OP: | 563 | case AML_INT_NAMEPATH_OP: |
561 | 564 | ||
562 | acpi_os_printf("Reference.Node->Name %X\n", | 565 | acpi_os_printf("Reference: Namepath %X [%4.4s]\n", |
563 | obj_desc->reference.node->name.integer); | 566 | obj_desc->reference.node->name.integer, |
567 | obj_desc->reference.node->name.ascii); | ||
564 | break; | 568 | break; |
565 | 569 | ||
566 | default: | 570 | default: |
@@ -640,8 +644,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
640 | acpi_os_printf("\n"); | 644 | acpi_os_printf("\n"); |
641 | } else { | 645 | } else { |
642 | acpi_os_printf(" base %8.8X%8.8X Length %X\n", | 646 | acpi_os_printf(" base %8.8X%8.8X Length %X\n", |
643 | ACPI_FORMAT_UINT64(obj_desc->region. | 647 | ACPI_FORMAT_NATIVE_UINT(obj_desc->region. |
644 | address), | 648 | address), |
645 | obj_desc->region.length); | 649 | obj_desc->region.length); |
646 | } | 650 | } |
647 | break; | 651 | break; |
@@ -877,20 +881,43 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
877 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 881 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
878 | 882 | ||
879 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | 883 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { |
880 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); | 884 | acpi_os_printf(" Named Object %p ", obj_desc->reference.node); |
881 | 885 | ||
882 | status = | 886 | status = |
883 | acpi_ns_handle_to_pathname(obj_desc->reference.node, | 887 | acpi_ns_handle_to_pathname(obj_desc->reference.node, |
884 | &ret_buf); | 888 | &ret_buf); |
885 | if (ACPI_FAILURE(status)) { | 889 | if (ACPI_FAILURE(status)) { |
886 | acpi_os_printf("Could not convert name to pathname\n"); | 890 | acpi_os_printf(" Could not convert name to pathname\n"); |
887 | } else { | 891 | } else { |
888 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | 892 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); |
889 | ACPI_FREE(ret_buf.pointer); | 893 | ACPI_FREE(ret_buf.pointer); |
890 | } | 894 | } |
891 | } else if (obj_desc->reference.object) { | 895 | } else if (obj_desc->reference.object) { |
892 | acpi_os_printf("\nReferenced Object: %p\n", | 896 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
893 | obj_desc->reference.object); | 897 | ACPI_DESC_TYPE_OPERAND) { |
898 | acpi_os_printf(" Target: %p", | ||
899 | obj_desc->reference.object); | ||
900 | if (obj_desc->reference.opcode == AML_LOAD_OP) { | ||
901 | /* | ||
902 | * For DDBHandle reference, | ||
903 | * obj_desc->Reference.Object is the table index | ||
904 | */ | ||
905 | acpi_os_printf(" [DDBHandle]\n"); | ||
906 | } else { | ||
907 | acpi_os_printf(" [%s]\n", | ||
908 | acpi_ut_get_type_name(((union | ||
909 | acpi_operand_object | ||
910 | *) | ||
911 | obj_desc-> | ||
912 | reference. | ||
913 | object)-> | ||
914 | common. | ||
915 | type)); | ||
916 | } | ||
917 | } else { | ||
918 | acpi_os_printf(" Target: %p\n", | ||
919 | obj_desc->reference.object); | ||
920 | } | ||
894 | } | 921 | } |
895 | } | 922 | } |
896 | 923 | ||
@@ -976,7 +1003,9 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
976 | 1003 | ||
977 | case ACPI_TYPE_LOCAL_REFERENCE: | 1004 | case ACPI_TYPE_LOCAL_REFERENCE: |
978 | 1005 | ||
979 | acpi_os_printf("[Object Reference] "); | 1006 | acpi_os_printf("[Object Reference] %s", |
1007 | (acpi_ps_get_opcode_info | ||
1008 | (obj_desc->reference.opcode))->name); | ||
980 | acpi_ex_dump_reference_obj(obj_desc); | 1009 | acpi_ex_dump_reference_obj(obj_desc); |
981 | break; | 1010 | break; |
982 | 1011 | ||
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index 2d88a3d8d1ad..3e440d84226a 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -71,7 +71,6 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
71 | union acpi_operand_object *buffer_desc; | 71 | union acpi_operand_object *buffer_desc; |
72 | acpi_size length; | 72 | acpi_size length; |
73 | void *buffer; | 73 | void *buffer; |
74 | u8 locked; | ||
75 | 74 | ||
76 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); | 75 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); |
77 | 76 | ||
@@ -111,9 +110,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
111 | 110 | ||
112 | /* Lock entire transaction if requested */ | 111 | /* Lock entire transaction if requested */ |
113 | 112 | ||
114 | locked = | 113 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
115 | acpi_ex_acquire_global_lock(obj_desc->common_field. | ||
116 | field_flags); | ||
117 | 114 | ||
118 | /* | 115 | /* |
119 | * Perform the read. | 116 | * Perform the read. |
@@ -125,7 +122,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
125 | buffer.pointer), | 122 | buffer.pointer), |
126 | ACPI_READ | (obj_desc->field. | 123 | ACPI_READ | (obj_desc->field. |
127 | attribute << 16)); | 124 | attribute << 16)); |
128 | acpi_ex_release_global_lock(locked); | 125 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
129 | goto exit; | 126 | goto exit; |
130 | } | 127 | } |
131 | 128 | ||
@@ -175,13 +172,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
175 | 172 | ||
176 | /* Lock entire transaction if requested */ | 173 | /* Lock entire transaction if requested */ |
177 | 174 | ||
178 | locked = | 175 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
179 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
180 | 176 | ||
181 | /* Read from the field */ | 177 | /* Read from the field */ |
182 | 178 | ||
183 | status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); | 179 | status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); |
184 | acpi_ex_release_global_lock(locked); | 180 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
185 | 181 | ||
186 | exit: | 182 | exit: |
187 | if (ACPI_FAILURE(status)) { | 183 | if (ACPI_FAILURE(status)) { |
@@ -214,10 +210,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
214 | { | 210 | { |
215 | acpi_status status; | 211 | acpi_status status; |
216 | u32 length; | 212 | u32 length; |
217 | u32 required_length; | ||
218 | void *buffer; | 213 | void *buffer; |
219 | void *new_buffer; | ||
220 | u8 locked; | ||
221 | union acpi_operand_object *buffer_desc; | 214 | union acpi_operand_object *buffer_desc; |
222 | 215 | ||
223 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); | 216 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); |
@@ -278,9 +271,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
278 | 271 | ||
279 | /* Lock entire transaction if requested */ | 272 | /* Lock entire transaction if requested */ |
280 | 273 | ||
281 | locked = | 274 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
282 | acpi_ex_acquire_global_lock(obj_desc->common_field. | ||
283 | field_flags); | ||
284 | 275 | ||
285 | /* | 276 | /* |
286 | * Perform the write (returns status and perhaps data in the | 277 | * Perform the write (returns status and perhaps data in the |
@@ -291,7 +282,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
291 | (acpi_integer *) buffer, | 282 | (acpi_integer *) buffer, |
292 | ACPI_WRITE | (obj_desc->field. | 283 | ACPI_WRITE | (obj_desc->field. |
293 | attribute << 16)); | 284 | attribute << 16)); |
294 | acpi_ex_release_global_lock(locked); | 285 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
295 | 286 | ||
296 | *result_desc = buffer_desc; | 287 | *result_desc = buffer_desc; |
297 | return_ACPI_STATUS(status); | 288 | return_ACPI_STATUS(status); |
@@ -319,35 +310,6 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
319 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 310 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
320 | } | 311 | } |
321 | 312 | ||
322 | /* | ||
323 | * We must have a buffer that is at least as long as the field | ||
324 | * we are writing to. This is because individual fields are | ||
325 | * indivisible and partial writes are not supported -- as per | ||
326 | * the ACPI specification. | ||
327 | */ | ||
328 | new_buffer = NULL; | ||
329 | required_length = | ||
330 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); | ||
331 | |||
332 | if (length < required_length) { | ||
333 | |||
334 | /* We need to create a new buffer */ | ||
335 | |||
336 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); | ||
337 | if (!new_buffer) { | ||
338 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
339 | } | ||
340 | |||
341 | /* | ||
342 | * Copy the original data to the new buffer, starting | ||
343 | * at Byte zero. All unused (upper) bytes of the | ||
344 | * buffer will be 0. | ||
345 | */ | ||
346 | ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length); | ||
347 | buffer = new_buffer; | ||
348 | length = required_length; | ||
349 | } | ||
350 | |||
351 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 313 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
352 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", | 314 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", |
353 | source_desc, | 315 | source_desc, |
@@ -366,19 +328,12 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
366 | 328 | ||
367 | /* Lock entire transaction if requested */ | 329 | /* Lock entire transaction if requested */ |
368 | 330 | ||
369 | locked = | 331 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
370 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
371 | 332 | ||
372 | /* Write to the field */ | 333 | /* Write to the field */ |
373 | 334 | ||
374 | status = acpi_ex_insert_into_field(obj_desc, buffer, length); | 335 | status = acpi_ex_insert_into_field(obj_desc, buffer, length); |
375 | acpi_ex_release_global_lock(locked); | 336 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
376 | |||
377 | /* Free temporary buffer if we used one */ | ||
378 | |||
379 | if (new_buffer) { | ||
380 | ACPI_FREE(new_buffer); | ||
381 | } | ||
382 | 337 | ||
383 | return_ACPI_STATUS(status); | 338 | return_ACPI_STATUS(status); |
384 | } | 339 | } |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 65a48b6170ee..e336b5dc7a50 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -263,7 +263,8 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
263 | rgn_desc->region.space_id, | 263 | rgn_desc->region.space_id, |
264 | obj_desc->common_field.access_byte_width, | 264 | obj_desc->common_field.access_byte_width, |
265 | obj_desc->common_field.base_byte_offset, | 265 | obj_desc->common_field.base_byte_offset, |
266 | field_datum_byte_offset, (void *)address)); | 266 | field_datum_byte_offset, ACPI_CAST_PTR(void, |
267 | address))); | ||
267 | 268 | ||
268 | /* Invoke the appropriate address_space/op_region handler */ | 269 | /* Invoke the appropriate address_space/op_region handler */ |
269 | 270 | ||
@@ -805,18 +806,39 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
805 | u32 datum_count; | 806 | u32 datum_count; |
806 | u32 field_datum_count; | 807 | u32 field_datum_count; |
807 | u32 i; | 808 | u32 i; |
809 | u32 required_length; | ||
810 | void *new_buffer; | ||
808 | 811 | ||
809 | ACPI_FUNCTION_TRACE(ex_insert_into_field); | 812 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
810 | 813 | ||
811 | /* Validate input buffer */ | 814 | /* Validate input buffer */ |
812 | 815 | ||
813 | if (buffer_length < | 816 | new_buffer = NULL; |
814 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { | 817 | required_length = |
815 | ACPI_ERROR((AE_INFO, | 818 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
816 | "Field size %X (bits) is too large for buffer (%X)", | 819 | /* |
817 | obj_desc->common_field.bit_length, buffer_length)); | 820 | * We must have a buffer that is at least as long as the field |
821 | * we are writing to. This is because individual fields are | ||
822 | * indivisible and partial writes are not supported -- as per | ||
823 | * the ACPI specification. | ||
824 | */ | ||
825 | if (buffer_length < required_length) { | ||
818 | 826 | ||
819 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); | 827 | /* We need to create a new buffer */ |
828 | |||
829 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); | ||
830 | if (!new_buffer) { | ||
831 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
832 | } | ||
833 | |||
834 | /* | ||
835 | * Copy the original data to the new buffer, starting | ||
836 | * at Byte zero. All unused (upper) bytes of the | ||
837 | * buffer will be 0. | ||
838 | */ | ||
839 | ACPI_MEMCPY((char *)new_buffer, (char *)buffer, buffer_length); | ||
840 | buffer = new_buffer; | ||
841 | buffer_length = required_length; | ||
820 | } | 842 | } |
821 | 843 | ||
822 | /* | 844 | /* |
@@ -866,7 +888,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
866 | merged_datum, | 888 | merged_datum, |
867 | field_offset); | 889 | field_offset); |
868 | if (ACPI_FAILURE(status)) { | 890 | if (ACPI_FAILURE(status)) { |
869 | return_ACPI_STATUS(status); | 891 | goto exit; |
870 | } | 892 | } |
871 | 893 | ||
872 | field_offset += obj_desc->common_field.access_byte_width; | 894 | field_offset += obj_desc->common_field.access_byte_width; |
@@ -924,5 +946,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
924 | mask, merged_datum, | 946 | mask, merged_datum, |
925 | field_offset); | 947 | field_offset); |
926 | 948 | ||
949 | exit: | ||
950 | /* Free temporary buffer if we used one */ | ||
951 | |||
952 | if (new_buffer) { | ||
953 | ACPI_FREE(new_buffer); | ||
954 | } | ||
927 | return_ACPI_STATUS(status); | 955 | return_ACPI_STATUS(status); |
928 | } | 956 | } |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index f13d1cec2d6d..cc956a5b5267 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 6748e3ef0997..c873ab40cd0e 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -126,6 +126,79 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
126 | 126 | ||
127 | /******************************************************************************* | 127 | /******************************************************************************* |
128 | * | 128 | * |
129 | * FUNCTION: acpi_ex_acquire_mutex_object | ||
130 | * | ||
131 | * PARAMETERS: time_desc - Timeout in milliseconds | ||
132 | * obj_desc - Mutex object | ||
133 | * Thread - Current thread state | ||
134 | * | ||
135 | * RETURN: Status | ||
136 | * | ||
137 | * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common | ||
138 | * path that supports multiple acquires by the same thread. | ||
139 | * | ||
140 | * MUTEX: Interpreter must be locked | ||
141 | * | ||
142 | * NOTE: This interface is called from three places: | ||
143 | * 1) From acpi_ex_acquire_mutex, via an AML Acquire() operator | ||
144 | * 2) From acpi_ex_acquire_global_lock when an AML Field access requires the | ||
145 | * global lock | ||
146 | * 3) From the external interface, acpi_acquire_global_lock | ||
147 | * | ||
148 | ******************************************************************************/ | ||
149 | |||
150 | acpi_status | ||
151 | acpi_ex_acquire_mutex_object(u16 timeout, | ||
152 | union acpi_operand_object *obj_desc, | ||
153 | acpi_thread_id thread_id) | ||
154 | { | ||
155 | acpi_status status; | ||
156 | |||
157 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc); | ||
158 | |||
159 | if (!obj_desc) { | ||
160 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
161 | } | ||
162 | |||
163 | /* Support for multiple acquires by the owning thread */ | ||
164 | |||
165 | if (obj_desc->mutex.thread_id == thread_id) { | ||
166 | /* | ||
167 | * The mutex is already owned by this thread, just increment the | ||
168 | * acquisition depth | ||
169 | */ | ||
170 | obj_desc->mutex.acquisition_depth++; | ||
171 | return_ACPI_STATUS(AE_OK); | ||
172 | } | ||
173 | |||
174 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | ||
175 | |||
176 | if (obj_desc == acpi_gbl_global_lock_mutex) { | ||
177 | status = acpi_ev_acquire_global_lock(timeout); | ||
178 | } else { | ||
179 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, | ||
180 | timeout); | ||
181 | } | ||
182 | |||
183 | if (ACPI_FAILURE(status)) { | ||
184 | |||
185 | /* Includes failure from a timeout on time_desc */ | ||
186 | |||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
189 | |||
190 | /* Acquired the mutex: update mutex object */ | ||
191 | |||
192 | obj_desc->mutex.thread_id = thread_id; | ||
193 | obj_desc->mutex.acquisition_depth = 1; | ||
194 | obj_desc->mutex.original_sync_level = 0; | ||
195 | obj_desc->mutex.owner_thread = NULL; /* Used only for AML Acquire() */ | ||
196 | |||
197 | return_ACPI_STATUS(AE_OK); | ||
198 | } | ||
199 | |||
200 | /******************************************************************************* | ||
201 | * | ||
129 | * FUNCTION: acpi_ex_acquire_mutex | 202 | * FUNCTION: acpi_ex_acquire_mutex |
130 | * | 203 | * |
131 | * PARAMETERS: time_desc - Timeout integer | 204 | * PARAMETERS: time_desc - Timeout integer |
@@ -151,7 +224,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
151 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 224 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
152 | } | 225 | } |
153 | 226 | ||
154 | /* Sanity check: we must have a valid thread ID */ | 227 | /* Must have a valid thread ID */ |
155 | 228 | ||
156 | if (!walk_state->thread) { | 229 | if (!walk_state->thread) { |
157 | ACPI_ERROR((AE_INFO, | 230 | ACPI_ERROR((AE_INFO, |
@@ -161,7 +234,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
161 | } | 234 | } |
162 | 235 | ||
163 | /* | 236 | /* |
164 | * Current Sync must be less than or equal to the sync level of the | 237 | * Current sync level must be less than or equal to the sync level of the |
165 | * mutex. This mechanism provides some deadlock prevention | 238 | * mutex. This mechanism provides some deadlock prevention |
166 | */ | 239 | */ |
167 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 240 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
@@ -172,51 +245,89 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
172 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 245 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
173 | } | 246 | } |
174 | 247 | ||
175 | /* Support for multiple acquires by the owning thread */ | 248 | status = acpi_ex_acquire_mutex_object((u16) time_desc->integer.value, |
249 | obj_desc, | ||
250 | walk_state->thread->thread_id); | ||
251 | if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { | ||
176 | 252 | ||
177 | if (obj_desc->mutex.owner_thread) { | 253 | /* Save Thread object, original/current sync levels */ |
178 | if (obj_desc->mutex.owner_thread->thread_id == | 254 | |
179 | walk_state->thread->thread_id) { | 255 | obj_desc->mutex.owner_thread = walk_state->thread; |
180 | /* | 256 | obj_desc->mutex.original_sync_level = |
181 | * The mutex is already owned by this thread, just increment the | 257 | walk_state->thread->current_sync_level; |
182 | * acquisition depth | 258 | walk_state->thread->current_sync_level = |
183 | */ | 259 | obj_desc->mutex.sync_level; |
184 | obj_desc->mutex.acquisition_depth++; | 260 | |
185 | return_ACPI_STATUS(AE_OK); | 261 | /* Link the mutex to the current thread for force-unlock at method exit */ |
186 | } | 262 | |
263 | acpi_ex_link_mutex(obj_desc, walk_state->thread); | ||
187 | } | 264 | } |
188 | 265 | ||
189 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | 266 | return_ACPI_STATUS(status); |
267 | } | ||
190 | 268 | ||
191 | if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 269 | /******************************************************************************* |
192 | status = | 270 | * |
193 | acpi_ev_acquire_global_lock((u16) time_desc->integer.value); | 271 | * FUNCTION: acpi_ex_release_mutex_object |
194 | } else { | 272 | * |
195 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, | 273 | * PARAMETERS: obj_desc - The object descriptor for this op |
196 | (u16) time_desc->integer. | 274 | * |
197 | value); | 275 | * RETURN: Status |
276 | * | ||
277 | * DESCRIPTION: Release a previously acquired Mutex, low level interface. | ||
278 | * Provides a common path that supports multiple releases (after | ||
279 | * previous multiple acquires) by the same thread. | ||
280 | * | ||
281 | * MUTEX: Interpreter must be locked | ||
282 | * | ||
283 | * NOTE: This interface is called from three places: | ||
284 | * 1) From acpi_ex_release_mutex, via an AML Acquire() operator | ||
285 | * 2) From acpi_ex_release_global_lock when an AML Field access requires the | ||
286 | * global lock | ||
287 | * 3) From the external interface, acpi_release_global_lock | ||
288 | * | ||
289 | ******************************************************************************/ | ||
290 | |||
291 | acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | ||
292 | { | ||
293 | acpi_status status = AE_OK; | ||
294 | |||
295 | ACPI_FUNCTION_TRACE(ex_release_mutex_object); | ||
296 | |||
297 | if (obj_desc->mutex.acquisition_depth == 0) { | ||
298 | return (AE_NOT_ACQUIRED); | ||
198 | } | 299 | } |
199 | 300 | ||
200 | if (ACPI_FAILURE(status)) { | 301 | /* Match multiple Acquires with multiple Releases */ |
201 | 302 | ||
202 | /* Includes failure from a timeout on time_desc */ | 303 | obj_desc->mutex.acquisition_depth--; |
304 | if (obj_desc->mutex.acquisition_depth != 0) { | ||
203 | 305 | ||
204 | return_ACPI_STATUS(status); | 306 | /* Just decrement the depth and return */ |
307 | |||
308 | return_ACPI_STATUS(AE_OK); | ||
205 | } | 309 | } |
206 | 310 | ||
207 | /* Have the mutex: update mutex and walk info and save the sync_level */ | 311 | if (obj_desc->mutex.owner_thread) { |
208 | 312 | ||
209 | obj_desc->mutex.owner_thread = walk_state->thread; | 313 | /* Unlink the mutex from the owner's list */ |
210 | obj_desc->mutex.acquisition_depth = 1; | ||
211 | obj_desc->mutex.original_sync_level = | ||
212 | walk_state->thread->current_sync_level; | ||
213 | 314 | ||
214 | walk_state->thread->current_sync_level = obj_desc->mutex.sync_level; | 315 | acpi_ex_unlink_mutex(obj_desc); |
316 | obj_desc->mutex.owner_thread = NULL; | ||
317 | } | ||
215 | 318 | ||
216 | /* Link the mutex to the current thread for force-unlock at method exit */ | 319 | /* Release the mutex, special case for Global Lock */ |
217 | 320 | ||
218 | acpi_ex_link_mutex(obj_desc, walk_state->thread); | 321 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
219 | return_ACPI_STATUS(AE_OK); | 322 | status = acpi_ev_release_global_lock(); |
323 | } else { | ||
324 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | ||
325 | } | ||
326 | |||
327 | /* Clear mutex info */ | ||
328 | |||
329 | obj_desc->mutex.thread_id = 0; | ||
330 | return_ACPI_STATUS(status); | ||
220 | } | 331 | } |
221 | 332 | ||
222 | /******************************************************************************* | 333 | /******************************************************************************* |
@@ -253,22 +364,13 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
253 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); | 364 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
254 | } | 365 | } |
255 | 366 | ||
256 | /* Sanity check: we must have a valid thread ID */ | ||
257 | |||
258 | if (!walk_state->thread) { | ||
259 | ACPI_ERROR((AE_INFO, | ||
260 | "Cannot release Mutex [%4.4s], null thread info", | ||
261 | acpi_ut_get_node_name(obj_desc->mutex.node))); | ||
262 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
263 | } | ||
264 | |||
265 | /* | 367 | /* |
266 | * The Mutex is owned, but this thread must be the owner. | 368 | * The Mutex is owned, but this thread must be the owner. |
267 | * Special case for Global Lock, any thread can release | 369 | * Special case for Global Lock, any thread can release |
268 | */ | 370 | */ |
269 | if ((obj_desc->mutex.owner_thread->thread_id != | 371 | if ((obj_desc->mutex.owner_thread->thread_id != |
270 | walk_state->thread->thread_id) | 372 | walk_state->thread->thread_id) |
271 | && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { | 373 | && (obj_desc != acpi_gbl_global_lock_mutex)) { |
272 | ACPI_ERROR((AE_INFO, | 374 | ACPI_ERROR((AE_INFO, |
273 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", | 375 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", |
274 | (unsigned long)walk_state->thread->thread_id, | 376 | (unsigned long)walk_state->thread->thread_id, |
@@ -278,45 +380,37 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
278 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 380 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
279 | } | 381 | } |
280 | 382 | ||
383 | /* Must have a valid thread ID */ | ||
384 | |||
385 | if (!walk_state->thread) { | ||
386 | ACPI_ERROR((AE_INFO, | ||
387 | "Cannot release Mutex [%4.4s], null thread info", | ||
388 | acpi_ut_get_node_name(obj_desc->mutex.node))); | ||
389 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
390 | } | ||
391 | |||
281 | /* | 392 | /* |
282 | * The sync level of the mutex must be less than or equal to the current | 393 | * The sync level of the mutex must be less than or equal to the current |
283 | * sync level | 394 | * sync level |
284 | */ | 395 | */ |
285 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 396 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
286 | ACPI_ERROR((AE_INFO, | 397 | ACPI_ERROR((AE_INFO, |
287 | "Cannot release Mutex [%4.4s], incorrect SyncLevel", | 398 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", |
288 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 399 | acpi_ut_get_node_name(obj_desc->mutex.node), |
400 | obj_desc->mutex.sync_level, | ||
401 | walk_state->thread->current_sync_level)); | ||
289 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 402 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
290 | } | 403 | } |
291 | 404 | ||
292 | /* Match multiple Acquires with multiple Releases */ | 405 | status = acpi_ex_release_mutex_object(obj_desc); |
293 | |||
294 | obj_desc->mutex.acquisition_depth--; | ||
295 | if (obj_desc->mutex.acquisition_depth != 0) { | ||
296 | |||
297 | /* Just decrement the depth and return */ | ||
298 | |||
299 | return_ACPI_STATUS(AE_OK); | ||
300 | } | ||
301 | |||
302 | /* Unlink the mutex from the owner's list */ | ||
303 | 406 | ||
304 | acpi_ex_unlink_mutex(obj_desc); | 407 | if (obj_desc->mutex.acquisition_depth == 0) { |
305 | 408 | ||
306 | /* Release the mutex, special case for Global Lock */ | 409 | /* Restore the original sync_level */ |
307 | 410 | ||
308 | if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 411 | walk_state->thread->current_sync_level = |
309 | status = acpi_ev_release_global_lock(); | 412 | obj_desc->mutex.original_sync_level; |
310 | } else { | ||
311 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | ||
312 | } | 413 | } |
313 | |||
314 | /* Update the mutex and restore sync_level */ | ||
315 | |||
316 | obj_desc->mutex.owner_thread = NULL; | ||
317 | walk_state->thread->current_sync_level = | ||
318 | obj_desc->mutex.original_sync_level; | ||
319 | |||
320 | return_ACPI_STATUS(status); | 414 | return_ACPI_STATUS(status); |
321 | } | 415 | } |
322 | 416 | ||
@@ -357,7 +451,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
357 | 451 | ||
358 | /* Release the mutex, special case for Global Lock */ | 452 | /* Release the mutex, special case for Global Lock */ |
359 | 453 | ||
360 | if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 454 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
361 | 455 | ||
362 | /* Ignore errors */ | 456 | /* Ignore errors */ |
363 | 457 | ||
@@ -369,6 +463,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
369 | /* Mark mutex unowned */ | 463 | /* Mark mutex unowned */ |
370 | 464 | ||
371 | obj_desc->mutex.owner_thread = NULL; | 465 | obj_desc->mutex.owner_thread = NULL; |
466 | obj_desc->mutex.thread_id = 0; | ||
372 | 467 | ||
373 | /* Update Thread sync_level (Last mutex is the important one) */ | 468 | /* Update Thread sync_level (Last mutex is the important one) */ |
374 | 469 | ||
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 308eae52dc05..817e67be3697 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 252f10acbbcc..7c3bea575e02 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -121,6 +121,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
121 | 121 | ||
122 | if ((ACPI_FAILURE(status)) || walk_state->result_obj) { | 122 | if ((ACPI_FAILURE(status)) || walk_state->result_obj) { |
123 | acpi_ut_remove_reference(return_desc); | 123 | acpi_ut_remove_reference(return_desc); |
124 | walk_state->result_obj = NULL; | ||
124 | } else { | 125 | } else { |
125 | /* Save the return value */ | 126 | /* Save the return value */ |
126 | 127 | ||
@@ -739,26 +740,38 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
739 | value = acpi_gbl_integer_byte_width; | 740 | value = acpi_gbl_integer_byte_width; |
740 | break; | 741 | break; |
741 | 742 | ||
742 | case ACPI_TYPE_BUFFER: | ||
743 | value = temp_desc->buffer.length; | ||
744 | break; | ||
745 | |||
746 | case ACPI_TYPE_STRING: | 743 | case ACPI_TYPE_STRING: |
747 | value = temp_desc->string.length; | 744 | value = temp_desc->string.length; |
748 | break; | 745 | break; |
749 | 746 | ||
747 | case ACPI_TYPE_BUFFER: | ||
748 | |||
749 | /* Buffer arguments may not be evaluated at this point */ | ||
750 | |||
751 | status = acpi_ds_get_buffer_arguments(temp_desc); | ||
752 | value = temp_desc->buffer.length; | ||
753 | break; | ||
754 | |||
750 | case ACPI_TYPE_PACKAGE: | 755 | case ACPI_TYPE_PACKAGE: |
756 | |||
757 | /* Package arguments may not be evaluated at this point */ | ||
758 | |||
759 | status = acpi_ds_get_package_arguments(temp_desc); | ||
751 | value = temp_desc->package.count; | 760 | value = temp_desc->package.count; |
752 | break; | 761 | break; |
753 | 762 | ||
754 | default: | 763 | default: |
755 | ACPI_ERROR((AE_INFO, | 764 | ACPI_ERROR((AE_INFO, |
756 | "Operand is not Buf/Int/Str/Pkg - found type %s", | 765 | "Operand must be Buffer/Integer/String/Package - found type %s", |
757 | acpi_ut_get_type_name(type))); | 766 | acpi_ut_get_type_name(type))); |
758 | status = AE_AML_OPERAND_TYPE; | 767 | status = AE_AML_OPERAND_TYPE; |
759 | goto cleanup; | 768 | goto cleanup; |
760 | } | 769 | } |
761 | 770 | ||
771 | if (ACPI_FAILURE(status)) { | ||
772 | goto cleanup; | ||
773 | } | ||
774 | |||
762 | /* | 775 | /* |
763 | * Now that we have the size of the object, create a result | 776 | * Now that we have the size of the object, create a result |
764 | * object to hold the value | 777 | * object to hold the value |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 17e652e65379..8e8bbb6ccebd 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -241,10 +241,6 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
241 | goto cleanup; | 241 | goto cleanup; |
242 | } | 242 | } |
243 | 243 | ||
244 | /* Return the remainder */ | ||
245 | |||
246 | walk_state->result_obj = return_desc1; | ||
247 | |||
248 | cleanup: | 244 | cleanup: |
249 | /* | 245 | /* |
250 | * Since the remainder is not returned indirectly, remove a reference to | 246 | * Since the remainder is not returned indirectly, remove a reference to |
@@ -259,6 +255,12 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
259 | acpi_ut_remove_reference(return_desc1); | 255 | acpi_ut_remove_reference(return_desc1); |
260 | } | 256 | } |
261 | 257 | ||
258 | /* Save return object (the remainder) on success */ | ||
259 | |||
260 | else { | ||
261 | walk_state->result_obj = return_desc1; | ||
262 | } | ||
263 | |||
262 | return_ACPI_STATUS(status); | 264 | return_ACPI_STATUS(status); |
263 | } | 265 | } |
264 | 266 | ||
@@ -490,6 +492,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
490 | 492 | ||
491 | if (ACPI_FAILURE(status)) { | 493 | if (ACPI_FAILURE(status)) { |
492 | acpi_ut_remove_reference(return_desc); | 494 | acpi_ut_remove_reference(return_desc); |
495 | walk_state->result_obj = NULL; | ||
493 | } | 496 | } |
494 | 497 | ||
495 | return_ACPI_STATUS(status); | 498 | return_ACPI_STATUS(status); |
@@ -583,8 +586,6 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
583 | return_desc->integer.value = ACPI_INTEGER_MAX; | 586 | return_desc->integer.value = ACPI_INTEGER_MAX; |
584 | } | 587 | } |
585 | 588 | ||
586 | walk_state->result_obj = return_desc; | ||
587 | |||
588 | cleanup: | 589 | cleanup: |
589 | 590 | ||
590 | /* Delete return object on error */ | 591 | /* Delete return object on error */ |
@@ -593,5 +594,11 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
593 | acpi_ut_remove_reference(return_desc); | 594 | acpi_ut_remove_reference(return_desc); |
594 | } | 595 | } |
595 | 596 | ||
597 | /* Save return object on success */ | ||
598 | |||
599 | else { | ||
600 | walk_state->result_obj = return_desc; | ||
601 | } | ||
602 | |||
596 | return_ACPI_STATUS(status); | 603 | return_ACPI_STATUS(status); |
597 | } | 604 | } |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 7fe67cf82cee..9cb4197681af 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -260,6 +260,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
260 | 260 | ||
261 | if (ACPI_FAILURE(status) || walk_state->result_obj) { | 261 | if (ACPI_FAILURE(status) || walk_state->result_obj) { |
262 | acpi_ut_remove_reference(return_desc); | 262 | acpi_ut_remove_reference(return_desc); |
263 | walk_state->result_obj = NULL; | ||
263 | } | 264 | } |
264 | 265 | ||
265 | /* Set the return object and exit */ | 266 | /* Set the return object and exit */ |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index bd80a9cb3d65..67d48737af53 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -322,8 +322,6 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
322 | goto cleanup; | 322 | goto cleanup; |
323 | } | 323 | } |
324 | 324 | ||
325 | walk_state->result_obj = return_desc; | ||
326 | |||
327 | cleanup: | 325 | cleanup: |
328 | 326 | ||
329 | /* Delete return object on error */ | 327 | /* Delete return object on error */ |
@@ -332,5 +330,11 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
332 | acpi_ut_remove_reference(return_desc); | 330 | acpi_ut_remove_reference(return_desc); |
333 | } | 331 | } |
334 | 332 | ||
333 | /* Save return object on success */ | ||
334 | |||
335 | else { | ||
336 | walk_state->result_obj = return_desc; | ||
337 | } | ||
338 | |||
335 | return_ACPI_STATUS(status); | 339 | return_ACPI_STATUS(status); |
336 | } | 340 | } |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index efe5d4b461a4..3a2f8cd4c62a 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -412,6 +412,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
412 | acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | 412 | acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) |
413 | { | 413 | { |
414 | union acpi_operand_object *obj_desc; | 414 | union acpi_operand_object *obj_desc; |
415 | union acpi_operand_object *second_desc = NULL; | ||
415 | u32 type; | 416 | u32 type; |
416 | acpi_status status; | 417 | acpi_status status; |
417 | 418 | ||
@@ -494,6 +495,20 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
494 | obj_desc->field.access_byte_width, | 495 | obj_desc->field.access_byte_width, |
495 | obj_desc->bank_field.region_obj, | 496 | obj_desc->bank_field.region_obj, |
496 | obj_desc->bank_field.bank_obj)); | 497 | obj_desc->bank_field.bank_obj)); |
498 | |||
499 | /* | ||
500 | * Remember location in AML stream of the field unit | ||
501 | * opcode and operands -- since the bank_value | ||
502 | * operands must be evaluated. | ||
503 | */ | ||
504 | second_desc = obj_desc->common.next_object; | ||
505 | second_desc->extra.aml_start = | ||
506 | ((union acpi_parse_object *)(info->data_register_node))-> | ||
507 | named.data; | ||
508 | second_desc->extra.aml_length = | ||
509 | ((union acpi_parse_object *)(info->data_register_node))-> | ||
510 | named.length; | ||
511 | |||
497 | break; | 512 | break; |
498 | 513 | ||
499 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 514 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 3f51b7e84a17..7cd8bb54fa01 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -160,7 +160,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
160 | if (!mem_info->mapped_logical_address) { | 160 | if (!mem_info->mapped_logical_address) { |
161 | ACPI_ERROR((AE_INFO, | 161 | ACPI_ERROR((AE_INFO, |
162 | "Could not map memory at %8.8X%8.8X, size %X", | 162 | "Could not map memory at %8.8X%8.8X, size %X", |
163 | ACPI_FORMAT_UINT64(address), | 163 | ACPI_FORMAT_NATIVE_UINT(address), |
164 | (u32) window_size)); | 164 | (u32) window_size)); |
165 | mem_info->mapped_length = 0; | 165 | mem_info->mapped_length = 0; |
166 | return_ACPI_STATUS(AE_NO_MEMORY); | 166 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -182,7 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
182 | 182 | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
184 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", | 184 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
185 | bit_width, function, ACPI_FORMAT_UINT64(address))); | 185 | bit_width, function, |
186 | ACPI_FORMAT_NATIVE_UINT(address))); | ||
186 | 187 | ||
187 | /* | 188 | /* |
188 | * Perform the memory read or write | 189 | * Perform the memory read or write |
@@ -284,7 +285,8 @@ acpi_ex_system_io_space_handler(u32 function, | |||
284 | 285 | ||
285 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
286 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", | 287 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", |
287 | bit_width, function, ACPI_FORMAT_UINT64(address))); | 288 | bit_width, function, |
289 | ACPI_FORMAT_NATIVE_UINT(address))); | ||
288 | 290 | ||
289 | /* Decode the function parameter */ | 291 | /* Decode the function parameter */ |
290 | 292 | ||
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 2b3a01cc4929..5596f42c9676 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -116,9 +116,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
116 | * Several object types require no further processing: | 116 | * Several object types require no further processing: |
117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node | 117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node |
118 | * 2) Method locals and arguments have a pseudo-Node | 118 | * 2) Method locals and arguments have a pseudo-Node |
119 | * 3) 10/2007: Added method type to assist with Package construction. | ||
119 | */ | 120 | */ |
120 | if ((entry_type == ACPI_TYPE_DEVICE) || | 121 | if ((entry_type == ACPI_TYPE_DEVICE) || |
121 | (entry_type == ACPI_TYPE_THERMAL) || | 122 | (entry_type == ACPI_TYPE_THERMAL) || |
123 | (entry_type == ACPI_TYPE_METHOD) || | ||
122 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { | 124 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { |
123 | return_ACPI_STATUS(AE_OK); | 125 | return_ACPI_STATUS(AE_OK); |
124 | } | 126 | } |
@@ -214,7 +216,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
214 | /* For these objects, just return the object attached to the Node */ | 216 | /* For these objects, just return the object attached to the Node */ |
215 | 217 | ||
216 | case ACPI_TYPE_MUTEX: | 218 | case ACPI_TYPE_MUTEX: |
217 | case ACPI_TYPE_METHOD: | ||
218 | case ACPI_TYPE_POWER: | 219 | case ACPI_TYPE_POWER: |
219 | case ACPI_TYPE_PROCESSOR: | 220 | case ACPI_TYPE_PROCESSOR: |
220 | case ACPI_TYPE_EVENT: | 221 | case ACPI_TYPE_EVENT: |
@@ -238,13 +239,12 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
238 | case ACPI_TYPE_LOCAL_REFERENCE: | 239 | case ACPI_TYPE_LOCAL_REFERENCE: |
239 | 240 | ||
240 | switch (source_desc->reference.opcode) { | 241 | switch (source_desc->reference.opcode) { |
241 | case AML_LOAD_OP: | 242 | case AML_LOAD_OP: /* This is a ddb_handle */ |
243 | case AML_REF_OF_OP: | ||
244 | case AML_INDEX_OP: | ||
242 | 245 | ||
243 | /* This is a ddb_handle */ | ||
244 | /* Return an additional reference to the object */ | 246 | /* Return an additional reference to the object */ |
245 | 247 | ||
246 | case AML_REF_OF_OP: | ||
247 | |||
248 | obj_desc = source_desc; | 248 | obj_desc = source_desc; |
249 | acpi_ut_add_reference(obj_desc); | 249 | acpi_ut_add_reference(obj_desc); |
250 | break; | 250 | break; |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 6c64e55dab0e..b35f7c817acf 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -140,7 +140,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
140 | { | 140 | { |
141 | acpi_status status = AE_OK; | 141 | acpi_status status = AE_OK; |
142 | union acpi_operand_object *stack_desc; | 142 | union acpi_operand_object *stack_desc; |
143 | void *temp_node; | ||
144 | union acpi_operand_object *obj_desc = NULL; | 143 | union acpi_operand_object *obj_desc = NULL; |
145 | u16 opcode; | 144 | u16 opcode; |
146 | 145 | ||
@@ -156,23 +155,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
156 | opcode = stack_desc->reference.opcode; | 155 | opcode = stack_desc->reference.opcode; |
157 | 156 | ||
158 | switch (opcode) { | 157 | switch (opcode) { |
159 | case AML_NAME_OP: | ||
160 | |||
161 | /* | ||
162 | * Convert name reference to a namespace node | ||
163 | * Then, acpi_ex_resolve_node_to_value can be used to get the value | ||
164 | */ | ||
165 | temp_node = stack_desc->reference.object; | ||
166 | |||
167 | /* Delete the Reference Object */ | ||
168 | |||
169 | acpi_ut_remove_reference(stack_desc); | ||
170 | |||
171 | /* Return the namespace node */ | ||
172 | |||
173 | (*stack_ptr) = temp_node; | ||
174 | break; | ||
175 | |||
176 | case AML_LOCAL_OP: | 158 | case AML_LOCAL_OP: |
177 | case AML_ARG_OP: | 159 | case AML_ARG_OP: |
178 | 160 | ||
@@ -207,15 +189,25 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
207 | switch (stack_desc->reference.target_type) { | 189 | switch (stack_desc->reference.target_type) { |
208 | case ACPI_TYPE_BUFFER_FIELD: | 190 | case ACPI_TYPE_BUFFER_FIELD: |
209 | 191 | ||
210 | /* Just return - leave the Reference on the stack */ | 192 | /* Just return - do not dereference */ |
211 | break; | 193 | break; |
212 | 194 | ||
213 | case ACPI_TYPE_PACKAGE: | 195 | case ACPI_TYPE_PACKAGE: |
214 | 196 | ||
197 | /* If method call or copy_object - do not dereference */ | ||
198 | |||
199 | if ((walk_state->opcode == | ||
200 | AML_INT_METHODCALL_OP) | ||
201 | || (walk_state->opcode == AML_COPY_OP)) { | ||
202 | break; | ||
203 | } | ||
204 | |||
205 | /* Otherwise, dereference the package_index to a package element */ | ||
206 | |||
215 | obj_desc = *stack_desc->reference.where; | 207 | obj_desc = *stack_desc->reference.where; |
216 | if (obj_desc) { | 208 | if (obj_desc) { |
217 | /* | 209 | /* |
218 | * Valid obj descriptor, copy pointer to return value | 210 | * Valid object descriptor, copy pointer to return value |
219 | * (i.e., dereference the package index) | 211 | * (i.e., dereference the package index) |
220 | * Delete the ref object, increment the returned object | 212 | * Delete the ref object, increment the returned object |
221 | */ | 213 | */ |
@@ -224,11 +216,11 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
224 | *stack_ptr = obj_desc; | 216 | *stack_ptr = obj_desc; |
225 | } else { | 217 | } else { |
226 | /* | 218 | /* |
227 | * A NULL object descriptor means an unitialized element of | 219 | * A NULL object descriptor means an uninitialized element of |
228 | * the package, can't dereference it | 220 | * the package, can't dereference it |
229 | */ | 221 | */ |
230 | ACPI_ERROR((AE_INFO, | 222 | ACPI_ERROR((AE_INFO, |
231 | "Attempt to deref an Index to NULL pkg element Idx=%p", | 223 | "Attempt to dereference an Index to NULL package element Idx=%p", |
232 | stack_desc)); | 224 | stack_desc)); |
233 | status = AE_AML_UNINITIALIZED_ELEMENT; | 225 | status = AE_AML_UNINITIALIZED_ELEMENT; |
234 | } | 226 | } |
@@ -239,7 +231,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
239 | /* Invalid reference object */ | 231 | /* Invalid reference object */ |
240 | 232 | ||
241 | ACPI_ERROR((AE_INFO, | 233 | ACPI_ERROR((AE_INFO, |
242 | "Unknown TargetType %X in Index/Reference obj %p", | 234 | "Unknown TargetType %X in Index/Reference object %p", |
243 | stack_desc->reference.target_type, | 235 | stack_desc->reference.target_type, |
244 | stack_desc)); | 236 | stack_desc)); |
245 | status = AE_AML_INTERNAL; | 237 | status = AE_AML_INTERNAL; |
@@ -251,7 +243,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
251 | case AML_DEBUG_OP: | 243 | case AML_DEBUG_OP: |
252 | case AML_LOAD_OP: | 244 | case AML_LOAD_OP: |
253 | 245 | ||
254 | /* Just leave the object as-is */ | 246 | /* Just leave the object as-is, do not dereference */ |
255 | 247 | ||
256 | break; | 248 | break; |
257 | 249 | ||
@@ -390,10 +382,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
390 | } | 382 | } |
391 | 383 | ||
392 | /* | 384 | /* |
393 | * For reference objects created via the ref_of or Index operators, | 385 | * For reference objects created via the ref_of, Index, or Load/load_table |
394 | * we need to get to the base object (as per the ACPI specification | 386 | * operators, we need to get to the base object (as per the ACPI |
395 | * of the object_type and size_of operators). This means traversing | 387 | * specification of the object_type and size_of operators). This means |
396 | * the list of possibly many nested references. | 388 | * traversing the list of possibly many nested references. |
397 | */ | 389 | */ |
398 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 390 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
399 | switch (obj_desc->reference.opcode) { | 391 | switch (obj_desc->reference.opcode) { |
@@ -463,6 +455,11 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
463 | } | 455 | } |
464 | break; | 456 | break; |
465 | 457 | ||
458 | case AML_LOAD_OP: | ||
459 | |||
460 | type = ACPI_TYPE_DDB_HANDLE; | ||
461 | goto exit; | ||
462 | |||
466 | case AML_LOCAL_OP: | 463 | case AML_LOCAL_OP: |
467 | case AML_ARG_OP: | 464 | case AML_ARG_OP: |
468 | 465 | ||
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index 09d897b3f6d5..73e29e566a70 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -137,7 +137,6 @@ acpi_ex_resolve_operands(u16 opcode, | |||
137 | union acpi_operand_object *obj_desc; | 137 | union acpi_operand_object *obj_desc; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | u8 object_type; | 139 | u8 object_type; |
140 | void *temp_node; | ||
141 | u32 arg_types; | 140 | u32 arg_types; |
142 | const struct acpi_opcode_info *op_info; | 141 | const struct acpi_opcode_info *op_info; |
143 | u32 this_arg_type; | 142 | u32 this_arg_type; |
@@ -239,7 +238,6 @@ acpi_ex_resolve_operands(u16 opcode, | |||
239 | 238 | ||
240 | /*lint -fallthrough */ | 239 | /*lint -fallthrough */ |
241 | 240 | ||
242 | case AML_NAME_OP: | ||
243 | case AML_INDEX_OP: | 241 | case AML_INDEX_OP: |
244 | case AML_REF_OF_OP: | 242 | case AML_REF_OF_OP: |
245 | case AML_ARG_OP: | 243 | case AML_ARG_OP: |
@@ -332,15 +330,6 @@ acpi_ex_resolve_operands(u16 opcode, | |||
332 | if (ACPI_FAILURE(status)) { | 330 | if (ACPI_FAILURE(status)) { |
333 | return_ACPI_STATUS(status); | 331 | return_ACPI_STATUS(status); |
334 | } | 332 | } |
335 | |||
336 | if (obj_desc->reference.opcode == AML_NAME_OP) { | ||
337 | |||
338 | /* Convert a named reference to the actual named object */ | ||
339 | |||
340 | temp_node = obj_desc->reference.object; | ||
341 | acpi_ut_remove_reference(obj_desc); | ||
342 | (*stack_ptr) = temp_node; | ||
343 | } | ||
344 | goto next_operand; | 333 | goto next_operand; |
345 | 334 | ||
346 | case ARGI_DATAREFOBJ: /* Store operator only */ | 335 | case ARGI_DATAREFOBJ: /* Store operator only */ |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index f4b69a637820..76c875bc3154 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -84,8 +84,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); | 85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); |
86 | 86 | ||
87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | 87 | /* Print line header as long as we are not in the middle of an object display */ |
88 | level, " ")); | 88 | |
89 | if (!((level > 0) && index == 0)) { | ||
90 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | ||
91 | level, " ")); | ||
92 | } | ||
89 | 93 | ||
90 | /* Display index for package output only */ | 94 | /* Display index for package output only */ |
91 | 95 | ||
@@ -95,12 +99,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
95 | } | 99 | } |
96 | 100 | ||
97 | if (!source_desc) { | 101 | if (!source_desc) { |
98 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); | 102 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); |
99 | return_VOID; | 103 | return_VOID; |
100 | } | 104 | } |
101 | 105 | ||
102 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { | 106 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { |
103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ", | 107 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s ", |
104 | acpi_ut_get_object_type_name | 108 | acpi_ut_get_object_type_name |
105 | (source_desc))); | 109 | (source_desc))); |
106 | 110 | ||
@@ -123,6 +127,8 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
123 | return_VOID; | 127 | return_VOID; |
124 | } | 128 | } |
125 | 129 | ||
130 | /* source_desc is of type ACPI_DESC_TYPE_OPERAND */ | ||
131 | |||
126 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { | 132 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { |
127 | case ACPI_TYPE_INTEGER: | 133 | case ACPI_TYPE_INTEGER: |
128 | 134 | ||
@@ -147,7 +153,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
147 | (u32) source_desc->buffer.length)); | 153 | (u32) source_desc->buffer.length)); |
148 | ACPI_DUMP_BUFFER(source_desc->buffer.pointer, | 154 | ACPI_DUMP_BUFFER(source_desc->buffer.pointer, |
149 | (source_desc->buffer.length < | 155 | (source_desc->buffer.length < |
150 | 32) ? source_desc->buffer.length : 32); | 156 | 256) ? source_desc->buffer.length : 256); |
151 | break; | 157 | break; |
152 | 158 | ||
153 | case ACPI_TYPE_STRING: | 159 | case ACPI_TYPE_STRING: |
@@ -160,7 +166,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
160 | case ACPI_TYPE_PACKAGE: | 166 | case ACPI_TYPE_PACKAGE: |
161 | 167 | ||
162 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | 168 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
163 | "[0x%.2X Elements]\n", | 169 | "[Contains 0x%.2X Elements]\n", |
164 | source_desc->package.count)); | 170 | source_desc->package.count)); |
165 | 171 | ||
166 | /* Output the entire contents of the package */ | 172 | /* Output the entire contents of the package */ |
@@ -180,12 +186,59 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
180 | (source_desc->reference.opcode), | 186 | (source_desc->reference.opcode), |
181 | source_desc->reference.offset)); | 187 | source_desc->reference.offset)); |
182 | } else { | 188 | } else { |
183 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n", | 189 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]", |
184 | acpi_ps_get_opcode_name | 190 | acpi_ps_get_opcode_name |
185 | (source_desc->reference.opcode))); | 191 | (source_desc->reference.opcode))); |
186 | } | 192 | } |
187 | 193 | ||
188 | if (source_desc->reference.object) { | 194 | if (source_desc->reference.opcode == AML_LOAD_OP) { /* Load and load_table */ |
195 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | ||
196 | " Table OwnerId %p\n", | ||
197 | source_desc->reference.object)); | ||
198 | break; | ||
199 | } | ||
200 | |||
201 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " ")); | ||
202 | |||
203 | /* Check for valid node first, then valid object */ | ||
204 | |||
205 | if (source_desc->reference.node) { | ||
206 | if (ACPI_GET_DESCRIPTOR_TYPE | ||
207 | (source_desc->reference.node) != | ||
208 | ACPI_DESC_TYPE_NAMED) { | ||
209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | ||
210 | " %p - Not a valid namespace node\n", | ||
211 | source_desc->reference. | ||
212 | node)); | ||
213 | } else { | ||
214 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | ||
215 | "Node %p [%4.4s] ", | ||
216 | source_desc->reference. | ||
217 | node, | ||
218 | (source_desc->reference. | ||
219 | node)->name.ascii)); | ||
220 | |||
221 | switch ((source_desc->reference.node)->type) { | ||
222 | |||
223 | /* These types have no attached object */ | ||
224 | |||
225 | case ACPI_TYPE_DEVICE: | ||
226 | acpi_os_printf("Device\n"); | ||
227 | break; | ||
228 | |||
229 | case ACPI_TYPE_THERMAL: | ||
230 | acpi_os_printf("Thermal Zone\n"); | ||
231 | break; | ||
232 | |||
233 | default: | ||
234 | acpi_ex_do_debug_object((source_desc-> | ||
235 | reference. | ||
236 | node)->object, | ||
237 | level + 4, 0); | ||
238 | break; | ||
239 | } | ||
240 | } | ||
241 | } else if (source_desc->reference.object) { | ||
189 | if (ACPI_GET_DESCRIPTOR_TYPE | 242 | if (ACPI_GET_DESCRIPTOR_TYPE |
190 | (source_desc->reference.object) == | 243 | (source_desc->reference.object) == |
191 | ACPI_DESC_TYPE_NAMED) { | 244 | ACPI_DESC_TYPE_NAMED) { |
@@ -198,18 +251,13 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
198 | acpi_ex_do_debug_object(source_desc->reference. | 251 | acpi_ex_do_debug_object(source_desc->reference. |
199 | object, level + 4, 0); | 252 | object, level + 4, 0); |
200 | } | 253 | } |
201 | } else if (source_desc->reference.node) { | ||
202 | acpi_ex_do_debug_object((source_desc->reference.node)-> | ||
203 | object, level + 4, 0); | ||
204 | } | 254 | } |
205 | break; | 255 | break; |
206 | 256 | ||
207 | default: | 257 | default: |
208 | 258 | ||
209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n", | 259 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p\n", |
210 | source_desc, | 260 | source_desc)); |
211 | acpi_ut_get_object_type_name | ||
212 | (source_desc))); | ||
213 | break; | 261 | break; |
214 | } | 262 | } |
215 | 263 | ||
@@ -313,7 +361,6 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
313 | * 4) Store to the debug object | 361 | * 4) Store to the debug object |
314 | */ | 362 | */ |
315 | switch (ref_desc->reference.opcode) { | 363 | switch (ref_desc->reference.opcode) { |
316 | case AML_NAME_OP: | ||
317 | case AML_REF_OF_OP: | 364 | case AML_REF_OF_OP: |
318 | 365 | ||
319 | /* Storing an object into a Name "container" */ | 366 | /* Storing an object into a Name "container" */ |
@@ -415,11 +462,24 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
415 | */ | 462 | */ |
416 | obj_desc = *(index_desc->reference.where); | 463 | obj_desc = *(index_desc->reference.where); |
417 | 464 | ||
418 | status = | 465 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
419 | acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, | 466 | ACPI_TYPE_LOCAL_REFERENCE |
420 | walk_state); | 467 | && source_desc->reference.opcode == AML_LOAD_OP) { |
421 | if (ACPI_FAILURE(status)) { | 468 | |
422 | return_ACPI_STATUS(status); | 469 | /* This is a DDBHandle, just add a reference to it */ |
470 | |||
471 | acpi_ut_add_reference(source_desc); | ||
472 | new_desc = source_desc; | ||
473 | } else { | ||
474 | /* Normal object, copy it */ | ||
475 | |||
476 | status = | ||
477 | acpi_ut_copy_iobject_to_iobject(source_desc, | ||
478 | &new_desc, | ||
479 | walk_state); | ||
480 | if (ACPI_FAILURE(status)) { | ||
481 | return_ACPI_STATUS(status); | ||
482 | } | ||
423 | } | 483 | } |
424 | 484 | ||
425 | if (obj_desc) { | 485 | if (obj_desc) { |
@@ -571,10 +631,17 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
571 | 631 | ||
572 | /* If no implicit conversion, drop into the default case below */ | 632 | /* If no implicit conversion, drop into the default case below */ |
573 | 633 | ||
574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { | 634 | if ((!implicit_conversion) || |
575 | 635 | ((walk_state->opcode == AML_COPY_OP) && | |
576 | /* Force execution of default (no implicit conversion) */ | 636 | (target_type != ACPI_TYPE_LOCAL_REGION_FIELD) && |
577 | 637 | (target_type != ACPI_TYPE_LOCAL_BANK_FIELD) && | |
638 | (target_type != ACPI_TYPE_LOCAL_INDEX_FIELD))) { | ||
639 | /* | ||
640 | * Force execution of default (no implicit conversion). Note: | ||
641 | * copy_object does not perform an implicit conversion, as per the ACPI | ||
642 | * spec -- except in case of region/bank/index fields -- because these | ||
643 | * objects must retain their original type permanently. | ||
644 | */ | ||
578 | target_type = ACPI_TYPE_ANY; | 645 | target_type = ACPI_TYPE_ANY; |
579 | } | 646 | } |
580 | 647 | ||
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 1d622c625c64..a6d2168b81f9 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -7,7 +7,7 @@ | |||
7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2007, R. Byron Moore | 10 | * Copyright (C) 2000 - 2008, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 8233d40178ee..9a75ff09fb0c 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 9460baff3032..68990f1df371 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -44,7 +44,6 @@ | |||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
47 | #include <acpi/acevents.h> | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exsystem") | 49 | ACPI_MODULE_NAME("exsystem") |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 6b0aeccbb69b..86c03880b523 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -61,7 +61,6 @@ | |||
61 | #include <acpi/acpi.h> | 61 | #include <acpi/acpi.h> |
62 | #include <acpi/acinterp.h> | 62 | #include <acpi/acinterp.h> |
63 | #include <acpi/amlcode.h> | 63 | #include <acpi/amlcode.h> |
64 | #include <acpi/acevents.h> | ||
65 | 64 | ||
66 | #define _COMPONENT ACPI_EXECUTER | 65 | #define _COMPONENT ACPI_EXECUTER |
67 | ACPI_MODULE_NAME("exutils") | 66 | ACPI_MODULE_NAME("exutils") |
@@ -217,9 +216,10 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
217 | 216 | ||
218 | /* | 217 | /* |
219 | * Object must be a valid number and we must be executing | 218 | * Object must be a valid number and we must be executing |
220 | * a control method | 219 | * a control method. NS node could be there for AML_INT_NAMEPATH_OP. |
221 | */ | 220 | */ |
222 | if ((!obj_desc) || | 221 | if ((!obj_desc) || |
222 | (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || | ||
223 | (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { | 223 | (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { |
224 | return; | 224 | return; |
225 | } | 225 | } |
@@ -240,72 +240,73 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
240 | * PARAMETERS: field_flags - Flags with Lock rule: | 240 | * PARAMETERS: field_flags - Flags with Lock rule: |
241 | * always_lock or never_lock | 241 | * always_lock or never_lock |
242 | * | 242 | * |
243 | * RETURN: TRUE/FALSE indicating whether the lock was actually acquired | 243 | * RETURN: None |
244 | * | 244 | * |
245 | * DESCRIPTION: Obtain the global lock and keep track of this fact via two | 245 | * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field |
246 | * methods. A global variable keeps the state of the lock, and | 246 | * flags specifiy that it is to be obtained before field access. |
247 | * the state is returned to the caller. | ||
248 | * | 247 | * |
249 | ******************************************************************************/ | 248 | ******************************************************************************/ |
250 | 249 | ||
251 | u8 acpi_ex_acquire_global_lock(u32 field_flags) | 250 | void acpi_ex_acquire_global_lock(u32 field_flags) |
252 | { | 251 | { |
253 | u8 locked = FALSE; | ||
254 | acpi_status status; | 252 | acpi_status status; |
255 | 253 | ||
256 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); | 254 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); |
257 | 255 | ||
258 | /* Only attempt lock if the always_lock bit is set */ | 256 | /* Only use the lock if the always_lock bit is set */ |
257 | |||
258 | if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { | ||
259 | return_VOID; | ||
260 | } | ||
259 | 261 | ||
260 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 262 | /* Attempt to get the global lock, wait forever */ |
261 | 263 | ||
262 | /* We should attempt to get the lock, wait forever */ | 264 | status = acpi_ex_acquire_mutex_object(ACPI_WAIT_FOREVER, |
265 | acpi_gbl_global_lock_mutex, | ||
266 | acpi_os_get_thread_id()); | ||
263 | 267 | ||
264 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); | 268 | if (ACPI_FAILURE(status)) { |
265 | if (ACPI_SUCCESS(status)) { | 269 | ACPI_EXCEPTION((AE_INFO, status, |
266 | locked = TRUE; | 270 | "Could not acquire Global Lock")); |
267 | } else { | ||
268 | ACPI_EXCEPTION((AE_INFO, status, | ||
269 | "Could not acquire Global Lock")); | ||
270 | } | ||
271 | } | 271 | } |
272 | 272 | ||
273 | return_UINT8(locked); | 273 | return_VOID; |
274 | } | 274 | } |
275 | 275 | ||
276 | /******************************************************************************* | 276 | /******************************************************************************* |
277 | * | 277 | * |
278 | * FUNCTION: acpi_ex_release_global_lock | 278 | * FUNCTION: acpi_ex_release_global_lock |
279 | * | 279 | * |
280 | * PARAMETERS: locked_by_me - Return value from corresponding call to | 280 | * PARAMETERS: field_flags - Flags with Lock rule: |
281 | * acquire_global_lock. | 281 | * always_lock or never_lock |
282 | * | 282 | * |
283 | * RETURN: None | 283 | * RETURN: None |
284 | * | 284 | * |
285 | * DESCRIPTION: Release the global lock if it is locked. | 285 | * DESCRIPTION: Release the ACPI hardware Global Lock |
286 | * | 286 | * |
287 | ******************************************************************************/ | 287 | ******************************************************************************/ |
288 | 288 | ||
289 | void acpi_ex_release_global_lock(u8 locked_by_me) | 289 | void acpi_ex_release_global_lock(u32 field_flags) |
290 | { | 290 | { |
291 | acpi_status status; | 291 | acpi_status status; |
292 | 292 | ||
293 | ACPI_FUNCTION_TRACE(ex_release_global_lock); | 293 | ACPI_FUNCTION_TRACE(ex_release_global_lock); |
294 | 294 | ||
295 | /* Only attempt unlock if the caller locked it */ | 295 | /* Only use the lock if the always_lock bit is set */ |
296 | 296 | ||
297 | if (locked_by_me) { | 297 | if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { |
298 | return_VOID; | ||
299 | } | ||
298 | 300 | ||
299 | /* OK, now release the lock */ | 301 | /* Release the global lock */ |
300 | 302 | ||
301 | status = acpi_ev_release_global_lock(); | 303 | status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); |
302 | if (ACPI_FAILURE(status)) { | 304 | if (ACPI_FAILURE(status)) { |
303 | 305 | ||
304 | /* Report the error, but there isn't much else we can do */ | 306 | /* Report the error, but there isn't much else we can do */ |
305 | 307 | ||
306 | ACPI_EXCEPTION((AE_INFO, status, | 308 | ACPI_EXCEPTION((AE_INFO, status, |
307 | "Could not release ACPI Global Lock")); | 309 | "Could not release Global Lock")); |
308 | } | ||
309 | } | 310 | } |
310 | 311 | ||
311 | return_VOID; | 312 | return_VOID; |