aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-07-10 02:39:41 -0400
committerLen Brown <len.brown@intel.com>2006-07-10 02:39:41 -0400
commit0f12b15ebcedce115a5d8e5ff741e49a7993f67c (patch)
tree3bfea88873b2a43c5528b9687fa010b6eff23458 /drivers
parent20b499aa06edf59fa2d21f29d42d36586c6c058e (diff)
parentf6dd9221dddb3550e60d32aee688588ec208312c (diff)
Pull acpica-20060707 into test branch
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/dispatcher/dsinit.c10
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c23
-rw-r--r--drivers/acpi/dispatcher/dswexec.c4
-rw-r--r--drivers/acpi/events/evregion.c44
-rw-r--r--drivers/acpi/events/evxface.c44
-rw-r--r--drivers/acpi/events/evxfregn.c13
-rw-r--r--drivers/acpi/executer/exconfig.c1
-rw-r--r--drivers/acpi/executer/exconvrt.c3
-rw-r--r--drivers/acpi/executer/exsystem.c8
-rw-r--r--drivers/acpi/namespace/nsalloc.c13
-rw-r--r--drivers/acpi/tables/tbget.c12
-rw-r--r--drivers/acpi/tables/tbinstal.c21
-rw-r--r--drivers/acpi/tables/tbrsdt.c27
-rw-r--r--drivers/acpi/tables/tbxface.c32
-rw-r--r--drivers/acpi/utilities/utdelete.c13
-rw-r--r--drivers/acpi/utilities/utmisc.c25
-rw-r--r--drivers/acpi/utilities/utstate.c7
17 files changed, 194 insertions, 106 deletions
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index daf51b5b5875..1888c055d10f 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -116,16 +116,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
116 116
117 case ACPI_TYPE_METHOD: 117 case ACPI_TYPE_METHOD:
118 118
119 /*
120 * Set the execution data width (32 or 64) based upon the
121 * revision number of the parent ACPI table.
122 * TBD: This is really for possible future support of integer width
123 * on a per-table basis. Currently, we just use a global for the width.
124 */
125 if (info->table_desc->pointer->revision == 1) {
126 node->flags |= ANOBJ_DATA_WIDTH_32;
127 }
128
129 info->method_count++; 119 info->method_count++;
130 break; 120 break;
131 121
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index a39a33f4847a..cf888add3191 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -134,7 +134,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
134 union acpi_operand_object *mutex_desc; 134 union acpi_operand_object *mutex_desc;
135 acpi_status status; 135 acpi_status status;
136 136
137 ACPI_FUNCTION_NAME(ds_create_method_mutex); 137 ACPI_FUNCTION_TRACE(ds_create_method_mutex);
138 138
139 /* Create the new mutex object */ 139 /* Create the new mutex object */
140 140
@@ -493,7 +493,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
493 493
494 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 494 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
495 "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", 495 "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n",
496 (char *)&walk_state->method_node->name, 496 acpi_ut_get_node_name(walk_state->method_node),
497 walk_state->method_call_op, return_desc)); 497 walk_state->method_call_op, return_desc));
498 498
499 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 499 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -610,6 +610,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
610 610
611 acpi_os_release_mutex(method_desc->method.mutex->mutex. 611 acpi_os_release_mutex(method_desc->method.mutex->mutex.
612 os_mutex); 612 os_mutex);
613 method_desc->method.mutex->mutex.owner_thread = NULL;
613 } 614 }
614 } 615 }
615 616
@@ -620,27 +621,11 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
620 */ 621 */
621 method_node = walk_state->method_node; 622 method_node = walk_state->method_node;
622 623
623 /* Lock namespace for possible update */
624
625 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
626 if (ACPI_FAILURE(status)) {
627 return_VOID;
628 }
629
630 /*
631 * Delete any namespace entries created immediately underneath
632 * the method
633 */
634 if (method_node && method_node->child) {
635 acpi_ns_delete_namespace_subtree(method_node);
636 }
637
638 /* 624 /*
639 * Delete any namespace entries created anywhere else within 625 * Delete any namespace objects created anywhere within
640 * the namespace by the execution of this method 626 * the namespace by the execution of this method
641 */ 627 */
642 acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); 628 acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id);
643 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
644 } 629 }
645 630
646 /* Decrement the thread count on the method */ 631 /* Decrement the thread count on the method */
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index b1ded62d0df1..d7a616c3104e 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -313,10 +313,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
313 case AML_CLASS_EXECUTE: 313 case AML_CLASS_EXECUTE:
314 case AML_CLASS_CREATE: 314 case AML_CLASS_CREATE:
315 /* 315 /*
316 * Most operators with arguments. 316 * Most operators with arguments (except create_xxx_field operators)
317 * Start a new result/operand state 317 * Start a new result/operand state
318 */ 318 */
319 if (walk_state->opcode != AML_CREATE_FIELD_OP) { 319 if (walk_state->op_info->object_type != ACPI_TYPE_BUFFER_FIELD) {
320 status = acpi_ds_result_stack_push(walk_state); 320 status = acpi_ds_result_stack_push(walk_state);
321 } 321 }
322 break; 322 break;
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index 094a17e4c86d..21caae04fe85 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -528,34 +528,40 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
528 } 528 }
529 } 529 }
530 530
531 /* Call the setup handler with the deactivate notification */ 531 /*
532 * If the region has been activated, call the setup handler
533 * with the deactivate notification
534 */
535 if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
536 region_setup = handler_obj->address_space.setup;
537 status =
538 region_setup(region_obj,
539 ACPI_REGION_DEACTIVATE,
540 handler_obj->address_space.
541 context, region_context);
532 542
533 region_setup = handler_obj->address_space.setup; 543 /* Init routine may fail, Just ignore errors */
534 status =
535 region_setup(region_obj, ACPI_REGION_DEACTIVATE,
536 handler_obj->address_space.context,
537 region_context);
538 544
539 /* Init routine may fail, Just ignore errors */ 545 if (ACPI_FAILURE(status)) {
546 ACPI_EXCEPTION((AE_INFO, status,
547 "from region handler - deactivate, [%s]",
548 acpi_ut_get_region_name
549 (region_obj->region.
550 space_id)));
551 }
540 552
541 if (ACPI_FAILURE(status)) { 553 region_obj->region.flags &=
542 ACPI_EXCEPTION((AE_INFO, status, 554 ~(AOPOBJ_SETUP_COMPLETE);
543 "from region init, [%s]",
544 acpi_ut_get_region_name
545 (region_obj->region.space_id)));
546 } 555 }
547 556
548 region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
549
550 /* 557 /*
551 * Remove handler reference in the region 558 * Remove handler reference in the region
552 * 559 *
553 * NOTE: this doesn't mean that the region goes away 560 * NOTE: this doesn't mean that the region goes away, the region
554 * The region is just inaccessible as indicated to 561 * is just inaccessible as indicated to the _REG method
555 * the _REG method
556 * 562 *
557 * If the region is on the handler's list 563 * If the region is on the handler's list, this must be the
558 * this better be the region's handler 564 * region's handler
559 */ 565 */
560 region_obj->region.handler = NULL; 566 region_obj->region.handler = NULL;
561 acpi_ut_remove_reference(handler_obj); 567 acpi_ut_remove_reference(handler_obj);
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 4f948df17ab9..923fd2b46955 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device,
428 node = acpi_ns_map_handle_to_node(device); 428 node = acpi_ns_map_handle_to_node(device);
429 if (!node) { 429 if (!node) {
430 status = AE_BAD_PARAMETER; 430 status = AE_BAD_PARAMETER;
431 goto unlock; 431 goto unlock_and_exit;
432 } 432 }
433 433
434 /* Root Object */ 434 /* Root Object */
@@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device,
442 ((handler_type & ACPI_DEVICE_NOTIFY) && 442 ((handler_type & ACPI_DEVICE_NOTIFY) &&
443 !acpi_gbl_device_notify.handler)) { 443 !acpi_gbl_device_notify.handler)) {
444 status = AE_NOT_EXIST; 444 status = AE_NOT_EXIST;
445 goto unlock; 445 goto unlock_and_exit;
446 } 446 }
447 447
448 /* Make sure all deferred tasks are completed */ 448 /* Make sure all deferred tasks are completed */
@@ -474,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device,
474 474
475 if (!acpi_ev_is_notify_object(node)) { 475 if (!acpi_ev_is_notify_object(node)) {
476 status = AE_TYPE; 476 status = AE_TYPE;
477 goto unlock; 477 goto unlock_and_exit;
478 } 478 }
479 479
480 /* Check for an existing internal object */ 480 /* Check for an existing internal object */
@@ -482,17 +482,21 @@ acpi_remove_notify_handler(acpi_handle device,
482 obj_desc = acpi_ns_get_attached_object(node); 482 obj_desc = acpi_ns_get_attached_object(node);
483 if (!obj_desc) { 483 if (!obj_desc) {
484 status = AE_NOT_EXIST; 484 status = AE_NOT_EXIST;
485 goto unlock; 485 goto unlock_and_exit;
486 } 486 }
487 487
488 /* Object exists - make sure there's an existing handler */ 488 /* Object exists - make sure there's an existing handler */
489 489
490 if (handler_type & ACPI_SYSTEM_NOTIFY) { 490 if (handler_type & ACPI_SYSTEM_NOTIFY) {
491 notify_obj = obj_desc->common_notify.system_notify; 491 notify_obj = obj_desc->common_notify.system_notify;
492 if ((!notify_obj) || 492 if (!notify_obj) {
493 (notify_obj->notify.handler != handler)) { 493 status = AE_NOT_EXIST;
494 goto unlock_and_exit;
495 }
496
497 if (notify_obj->notify.handler != handler) {
494 status = AE_BAD_PARAMETER; 498 status = AE_BAD_PARAMETER;
495 goto unlock; 499 goto unlock_and_exit;
496 } 500 }
497 /* Make sure all deferred tasks are completed */ 501 /* Make sure all deferred tasks are completed */
498 502
@@ -510,10 +514,14 @@ acpi_remove_notify_handler(acpi_handle device,
510 514
511 if (handler_type & ACPI_DEVICE_NOTIFY) { 515 if (handler_type & ACPI_DEVICE_NOTIFY) {
512 notify_obj = obj_desc->common_notify.device_notify; 516 notify_obj = obj_desc->common_notify.device_notify;
513 if ((!notify_obj) || 517 if (!notify_obj) {
514 (notify_obj->notify.handler != handler)) { 518 status = AE_NOT_EXIST;
519 goto unlock_and_exit;
520 }
521
522 if (notify_obj->notify.handler != handler) {
515 status = AE_BAD_PARAMETER; 523 status = AE_BAD_PARAMETER;
516 goto unlock; 524 goto unlock_and_exit;
517 } 525 }
518 /* Make sure all deferred tasks are completed */ 526 /* Make sure all deferred tasks are completed */
519 527
@@ -530,9 +538,9 @@ acpi_remove_notify_handler(acpi_handle device,
530 } 538 }
531 } 539 }
532 540
533unlock: 541 unlock_and_exit:
534 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 542 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
535exit: 543 exit:
536 if (ACPI_FAILURE(status)) 544 if (ACPI_FAILURE(status))
537 ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); 545 ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler"));
538 return_ACPI_STATUS(status); 546 return_ACPI_STATUS(status);
@@ -586,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
586 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 594 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
587 if (!gpe_event_info) { 595 if (!gpe_event_info) {
588 status = AE_BAD_PARAMETER; 596 status = AE_BAD_PARAMETER;
589 goto unlock; 597 goto unlock_and_exit;
590 } 598 }
591 599
592 /* Make sure that there isn't a handler there already */ 600 /* Make sure that there isn't a handler there already */
@@ -594,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
594 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 602 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
595 ACPI_GPE_DISPATCH_HANDLER) { 603 ACPI_GPE_DISPATCH_HANDLER) {
596 status = AE_ALREADY_EXISTS; 604 status = AE_ALREADY_EXISTS;
597 goto unlock; 605 goto unlock_and_exit;
598 } 606 }
599 607
600 /* Allocate and init handler object */ 608 /* Allocate and init handler object */
@@ -602,7 +610,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
602 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); 610 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
603 if (!handler) { 611 if (!handler) {
604 status = AE_NO_MEMORY; 612 status = AE_NO_MEMORY;
605 goto unlock; 613 goto unlock_and_exit;
606 } 614 }
607 615
608 handler->address = address; 616 handler->address = address;
@@ -613,7 +621,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
613 621
614 status = acpi_ev_disable_gpe(gpe_event_info); 622 status = acpi_ev_disable_gpe(gpe_event_info);
615 if (ACPI_FAILURE(status)) { 623 if (ACPI_FAILURE(status)) {
616 goto unlock; 624 goto unlock_and_exit;
617 } 625 }
618 626
619 /* Install the handler */ 627 /* Install the handler */
@@ -628,9 +636,9 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
628 636
629 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 637 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
630 638
631unlock: 639 unlock_and_exit:
632 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 640 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
633exit: 641 exit:
634 if (ACPI_FAILURE(status)) 642 if (ACPI_FAILURE(status))
635 ACPI_EXCEPTION((AE_INFO, status, 643 ACPI_EXCEPTION((AE_INFO, status,
636 "Installing notify handler failed")); 644 "Installing notify handler failed"));
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c
index e8b86a0baad0..83b12a9afa32 100644
--- a/drivers/acpi/events/evxfregn.c
+++ b/drivers/acpi/events/evxfregn.c
@@ -155,7 +155,11 @@ acpi_remove_address_space_handler(acpi_handle device,
155 /* Convert and validate the device handle */ 155 /* Convert and validate the device handle */
156 156
157 node = acpi_ns_map_handle_to_node(device); 157 node = acpi_ns_map_handle_to_node(device);
158 if (!node) { 158 if (!node ||
159 ((node->type != ACPI_TYPE_DEVICE) &&
160 (node->type != ACPI_TYPE_PROCESSOR) &&
161 (node->type != ACPI_TYPE_THERMAL) &&
162 (node != acpi_gbl_root_node))) {
159 status = AE_BAD_PARAMETER; 163 status = AE_BAD_PARAMETER;
160 goto unlock_and_exit; 164 goto unlock_and_exit;
161 } 165 }
@@ -178,6 +182,13 @@ acpi_remove_address_space_handler(acpi_handle device,
178 182
179 if (handler_obj->address_space.space_id == space_id) { 183 if (handler_obj->address_space.space_id == space_id) {
180 184
185 /* Handler must be the same as the installed handler */
186
187 if (handler_obj->address_space.handler != handler) {
188 status = AE_BAD_PARAMETER;
189 goto unlock_and_exit;
190 }
191
181 /* Matched space_id, first dereference this in the Regions */ 192 /* Matched space_id, first dereference this in the Regions */
182 193
183 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 194 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 83fed079a276..c8341fa5fe01 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -502,7 +502,6 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
502 * (Offset contains the table_id) 502 * (Offset contains the table_id)
503 */ 503 */
504 acpi_ns_delete_namespace_by_owner(table_info->owner_id); 504 acpi_ns_delete_namespace_by_owner(table_info->owner_id);
505 acpi_ut_release_owner_id(&table_info->owner_id);
506 505
507 /* Delete the table itself */ 506 /* Delete the table itself */
508 507
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index b732e399b1ef..544e81a6a438 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -170,6 +170,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
170 return_ACPI_STATUS(AE_NO_MEMORY); 170 return_ACPI_STATUS(AE_NO_MEMORY);
171 } 171 }
172 172
173 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
174 ACPI_FORMAT_UINT64(result)));
175
173 /* Save the Result */ 176 /* Save the Result */
174 177
175 return_desc->integer.value = result; 178 return_desc->integer.value = result;
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index 6b5d1e6ce94b..28aef3e69ecc 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -60,7 +60,7 @@ ACPI_MODULE_NAME("exsystem")
60 * 60 *
61 * DESCRIPTION: Implements a semaphore wait with a check to see if the 61 * DESCRIPTION: Implements a semaphore wait with a check to see if the
62 * semaphore is available immediately. If it is not, the 62 * semaphore is available immediately. If it is not, the
63 * interpreter is released. 63 * interpreter is released before waiting.
64 * 64 *
65 ******************************************************************************/ 65 ******************************************************************************/
66acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) 66acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
@@ -110,9 +110,9 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
110 * 110 *
111 * RETURN: Status 111 * RETURN: Status
112 * 112 *
113 * DESCRIPTION: Implements a semaphore wait with a check to see if the 113 * DESCRIPTION: Implements a mutex wait with a check to see if the
114 * semaphore is available immediately. If it is not, the 114 * mutex is available immediately. If it is not, the
115 * interpreter is released. 115 * interpreter is released before waiting.
116 * 116 *
117 ******************************************************************************/ 117 ******************************************************************************/
118 118
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index dc3f0739a46b..55b407aae266 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -386,14 +386,17 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
386 * specific ID. Used to delete entire ACPI tables. All 386 * specific ID. Used to delete entire ACPI tables. All
387 * reference counts are updated. 387 * reference counts are updated.
388 * 388 *
389 * MUTEX: Locks namespace during deletion walk.
390 *
389 ******************************************************************************/ 391 ******************************************************************************/
390 392
391void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) 393void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
392{ 394{
393 struct acpi_namespace_node *child_node; 395 struct acpi_namespace_node *child_node;
394 struct acpi_namespace_node *deletion_node; 396 struct acpi_namespace_node *deletion_node;
395 u32 level;
396 struct acpi_namespace_node *parent_node; 397 struct acpi_namespace_node *parent_node;
398 u32 level;
399 acpi_status status;
397 400
398 ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); 401 ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id);
399 402
@@ -401,6 +404,13 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
401 return_VOID; 404 return_VOID;
402 } 405 }
403 406
407 /* Lock namespace for possible update */
408
409 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
410 if (ACPI_FAILURE(status)) {
411 return_VOID;
412 }
413
404 deletion_node = NULL; 414 deletion_node = NULL;
405 parent_node = acpi_gbl_root_node; 415 parent_node = acpi_gbl_root_node;
406 child_node = NULL; 416 child_node = NULL;
@@ -469,5 +479,6 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
469 } 479 }
470 } 480 }
471 481
482 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
472 return_VOID; 483 return_VOID;
473} 484}
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
index 99eacceff563..7856db759af0 100644
--- a/drivers/acpi/tables/tbget.c
+++ b/drivers/acpi/tables/tbget.c
@@ -320,6 +320,16 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
320 320
321 ACPI_FUNCTION_TRACE(tb_get_this_table); 321 ACPI_FUNCTION_TRACE(tb_get_this_table);
322 322
323 /* Validate minimum length */
324
325 if (header->length < sizeof(struct acpi_table_header)) {
326 ACPI_ERROR((AE_INFO,
327 "Table length (%X) is smaller than minimum (%X)",
328 header->length, sizeof(struct acpi_table_header)));
329
330 return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
331 }
332
323 /* 333 /*
324 * Flags contains the current processor mode (Virtual or Physical 334 * Flags contains the current processor mode (Virtual or Physical
325 * addressing) The pointer_type is either Logical or Physical 335 * addressing) The pointer_type is either Logical or Physical
@@ -356,7 +366,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
356 */ 366 */
357 status = acpi_os_map_memory(address->pointer.physical, 367 status = acpi_os_map_memory(address->pointer.physical,
358 (acpi_size) header->length, 368 (acpi_size) header->length,
359 (void *)&full_table); 369 ACPI_CAST_PTR(void, &full_table));
360 if (ACPI_FAILURE(status)) { 370 if (ACPI_FAILURE(status)) {
361 ACPI_ERROR((AE_INFO, 371 ACPI_ERROR((AE_INFO,
362 "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X", 372 "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X",
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 7ca2df75bb11..1668a232fb67 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -256,7 +256,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
256 256
257 status = acpi_ut_allocate_owner_id(&table_desc->owner_id); 257 status = acpi_ut_allocate_owner_id(&table_desc->owner_id);
258 if (ACPI_FAILURE(status)) { 258 if (ACPI_FAILURE(status)) {
259 return_ACPI_STATUS(status); 259 goto error_exit1;
260 } 260 }
261 261
262 /* Install the table into the global data structure */ 262 /* Install the table into the global data structure */
@@ -274,8 +274,8 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
274 * at this location, so return an error. 274 * at this location, so return an error.
275 */ 275 */
276 if (list_head->next) { 276 if (list_head->next) {
277 ACPI_FREE(table_desc); 277 status = AE_ALREADY_EXISTS;
278 return_ACPI_STATUS(AE_ALREADY_EXISTS); 278 goto error_exit2;
279 } 279 }
280 280
281 table_desc->next = list_head->next; 281 table_desc->next = list_head->next;
@@ -335,6 +335,17 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
335 table_info->owner_id = table_desc->owner_id; 335 table_info->owner_id = table_desc->owner_id;
336 table_info->installed_desc = table_desc; 336 table_info->installed_desc = table_desc;
337 return_ACPI_STATUS(AE_OK); 337 return_ACPI_STATUS(AE_OK);
338
339 /* Error exit with cleanup */
340
341 error_exit2:
342
343 acpi_ut_release_owner_id(&table_desc->owner_id);
344
345 error_exit1:
346
347 ACPI_FREE(table_desc);
348 return_ACPI_STATUS(status);
338} 349}
339 350
340/******************************************************************************* 351/*******************************************************************************
@@ -525,6 +536,10 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
525 536
526 acpi_tb_delete_single_table(table_desc); 537 acpi_tb_delete_single_table(table_desc);
527 538
539 /* Free the owner ID associated with this table */
540
541 acpi_ut_release_owner_id(&table_desc->owner_id);
542
528 /* Free the table descriptor */ 543 /* Free the table descriptor */
529 544
530 next_desc = table_desc->next; 545 next_desc = table_desc->next;
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index abcb08c2592a..0ad3dbb9ebca 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -183,6 +183,17 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
183 183
184 ACPI_FUNCTION_ENTRY(); 184 ACPI_FUNCTION_ENTRY();
185 185
186 /* Validate minimum length */
187
188 if (table_ptr->length < sizeof(struct acpi_table_header)) {
189 ACPI_ERROR((AE_INFO,
190 "RSDT/XSDT length (%X) is smaller than minimum (%X)",
191 table_ptr->length,
192 sizeof(struct acpi_table_header)));
193
194 return (AE_INVALID_TABLE_LENGTH);
195 }
196
186 /* Search for appropriate signature, RSDT or XSDT */ 197 /* Search for appropriate signature, RSDT or XSDT */
187 198
188 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { 199 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
@@ -210,7 +221,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
210 ACPI_ERROR((AE_INFO, "Looking for XSDT")); 221 ACPI_ERROR((AE_INFO, "Looking for XSDT"));
211 } 222 }
212 223
213 ACPI_DUMP_BUFFER((char *)table_ptr, 48); 224 ACPI_DUMP_BUFFER(ACPI_CAST_PTR(char, table_ptr), 48);
214 return (AE_BAD_SIGNATURE); 225 return (AE_BAD_SIGNATURE);
215 } 226 }
216 227
@@ -258,7 +269,7 @@ acpi_status acpi_tb_get_table_rsdt(void)
258 269
259 status = acpi_tb_validate_rsdt(table_info.pointer); 270 status = acpi_tb_validate_rsdt(table_info.pointer);
260 if (ACPI_FAILURE(status)) { 271 if (ACPI_FAILURE(status)) {
261 return_ACPI_STATUS(status); 272 goto error_cleanup;
262 } 273 }
263 274
264 /* Get the number of tables defined in the RSDT or XSDT */ 275 /* Get the number of tables defined in the RSDT or XSDT */
@@ -270,14 +281,14 @@ acpi_status acpi_tb_get_table_rsdt(void)
270 281
271 status = acpi_tb_convert_to_xsdt(&table_info); 282 status = acpi_tb_convert_to_xsdt(&table_info);
272 if (ACPI_FAILURE(status)) { 283 if (ACPI_FAILURE(status)) {
273 return_ACPI_STATUS(status); 284 goto error_cleanup;
274 } 285 }
275 286
276 /* Save the table pointers and allocation info */ 287 /* Save the table pointers and allocation info */
277 288
278 status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); 289 status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info);
279 if (ACPI_FAILURE(status)) { 290 if (ACPI_FAILURE(status)) {
280 return_ACPI_STATUS(status); 291 goto error_cleanup;
281 } 292 }
282 293
283 acpi_gbl_XSDT = 294 acpi_gbl_XSDT =
@@ -285,4 +296,12 @@ acpi_status acpi_tb_get_table_rsdt(void)
285 296
286 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); 297 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
287 return_ACPI_STATUS(status); 298 return_ACPI_STATUS(status);
299
300 error_cleanup:
301
302 /* Free table allocated by acpi_tb_get_table */
303
304 acpi_tb_delete_single_table(&table_info);
305
306 return_ACPI_STATUS(status);
288} 307}
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 4e91f2984815..7767987be15a 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -134,8 +134,8 @@ ACPI_EXPORT_SYMBOL(acpi_load_tables)
134 * RETURN: Status 134 * RETURN: Status
135 * 135 *
136 * DESCRIPTION: This function is called to load a table from the caller's 136 * DESCRIPTION: This function is called to load a table from the caller's
137 * buffer. The buffer must contain an entire ACPI Table including 137 * buffer. The buffer must contain an entire ACPI Table including
138 * a valid header. The header fields will be verified, and if it 138 * a valid header. The header fields will be verified, and if it
139 * is determined that the table is invalid, the call will fail. 139 * is determined that the table is invalid, the call will fail.
140 * 140 *
141 ******************************************************************************/ 141 ******************************************************************************/
@@ -245,15 +245,18 @@ acpi_status acpi_unload_table(acpi_table_type table_type)
245 /* Find all tables of the requested type */ 245 /* Find all tables of the requested type */
246 246
247 table_desc = acpi_gbl_table_lists[table_type].next; 247 table_desc = acpi_gbl_table_lists[table_type].next;
248 if (!table_desc) {
249 return_ACPI_STATUS(AE_NOT_EXIST);
250 }
251
248 while (table_desc) { 252 while (table_desc) {
249 /* 253 /*
250 * Delete all namespace entries owned by this table. Note that these 254 * Delete all namespace objects owned by this table. Note that these
251 * entries can appear anywhere in the namespace by virtue of the AML 255 * objects can appear anywhere in the namespace by virtue of the AML
252 * "Scope" operator. Thus, we need to track ownership by an ID, not 256 * "Scope" operator. Thus, we need to track ownership by an ID, not
253 * simply a position within the hierarchy 257 * simply a position within the hierarchy
254 */ 258 */
255 acpi_ns_delete_namespace_by_owner(table_desc->owner_id); 259 acpi_ns_delete_namespace_by_owner(table_desc->owner_id);
256 acpi_ut_release_owner_id(&table_desc->owner_id);
257 table_desc = table_desc->next; 260 table_desc = table_desc->next;
258 } 261 }
259 262
@@ -275,12 +278,12 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table)
275 * see acpi_gbl_acpi_table_flag 278 * see acpi_gbl_acpi_table_flag
276 * out_table_header - pointer to the struct acpi_table_header if successful 279 * out_table_header - pointer to the struct acpi_table_header if successful
277 * 280 *
278 * DESCRIPTION: This function is called to get an ACPI table header. The caller 281 * DESCRIPTION: This function is called to get an ACPI table header. The caller
279 * supplies an pointer to a data area sufficient to contain an ACPI 282 * supplies an pointer to a data area sufficient to contain an ACPI
280 * struct acpi_table_header structure. 283 * struct acpi_table_header structure.
281 * 284 *
282 * The header contains a length field that can be used to determine 285 * The header contains a length field that can be used to determine
283 * the size of the buffer needed to contain the entire table. This 286 * the size of the buffer needed to contain the entire table. This
284 * function is not valid for the RSD PTR table since it does not 287 * function is not valid for the RSD PTR table since it does not
285 * have a standard header and is fixed length. 288 * have a standard header and is fixed length.
286 * 289 *
@@ -322,7 +325,8 @@ acpi_get_table_header(acpi_table_type table_type,
322 325
323 /* Copy the header to the caller's buffer */ 326 /* Copy the header to the caller's buffer */
324 327
325 ACPI_MEMCPY((void *)out_table_header, (void *)tbl_ptr, 328 ACPI_MEMCPY(ACPI_CAST_PTR(void, out_table_header),
329 ACPI_CAST_PTR(void, tbl_ptr),
326 sizeof(struct acpi_table_header)); 330 sizeof(struct acpi_table_header));
327 331
328 return_ACPI_STATUS(status); 332 return_ACPI_STATUS(status);
@@ -344,10 +348,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_header)
344 * 348 *
345 * RETURN: Status 349 * RETURN: Status
346 * 350 *
347 * DESCRIPTION: This function is called to get an ACPI table. The caller 351 * DESCRIPTION: This function is called to get an ACPI table. The caller
348 * supplies an out_buffer large enough to contain the entire ACPI 352 * supplies an out_buffer large enough to contain the entire ACPI
349 * table. The caller should call the acpi_get_table_header function 353 * table. The caller should call the acpi_get_table_header function
350 * first to determine the buffer size needed. Upon completion 354 * first to determine the buffer size needed. Upon completion
351 * the out_buffer->Length field will indicate the number of bytes 355 * the out_buffer->Length field will indicate the number of bytes
352 * copied into the out_buffer->buf_ptr buffer. This table will be 356 * copied into the out_buffer->buf_ptr buffer. This table will be
353 * a complete table including the header. 357 * a complete table including the header.
@@ -417,7 +421,9 @@ acpi_get_table(acpi_table_type table_type,
417 421
418 /* Copy the table to the buffer */ 422 /* Copy the table to the buffer */
419 423
420 ACPI_MEMCPY((void *)ret_buffer->pointer, (void *)tbl_ptr, table_length); 424 ACPI_MEMCPY(ACPI_CAST_PTR(void, ret_buffer->pointer),
425 ACPI_CAST_PTR(void, tbl_ptr), table_length);
426
421 return_ACPI_STATUS(AE_OK); 427 return_ACPI_STATUS(AE_OK);
422} 428}
423 429
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 38ebe1c54330..9d3f1149ba21 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -447,11 +447,16 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
447 */ 447 */
448 switch (ACPI_GET_OBJECT_TYPE(object)) { 448 switch (ACPI_GET_OBJECT_TYPE(object)) {
449 case ACPI_TYPE_DEVICE: 449 case ACPI_TYPE_DEVICE:
450 case ACPI_TYPE_PROCESSOR:
451 case ACPI_TYPE_POWER:
452 case ACPI_TYPE_THERMAL:
450 453
451 acpi_ut_update_ref_count(object->device.system_notify, 454 /* Update the notify objects for these types (if present) */
452 action); 455
453 acpi_ut_update_ref_count(object->device.device_notify, 456 acpi_ut_update_ref_count(object->common_notify.
454 action); 457 system_notify, action);
458 acpi_ut_update_ref_count(object->common_notify.
459 device_notify, action);
455 break; 460 break;
456 461
457 case ACPI_TYPE_PACKAGE: 462 case ACPI_TYPE_PACKAGE:
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 33268310c738..6d8a8211be90 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -65,7 +65,7 @@ ACPI_MODULE_NAME("utmisc")
65u8 acpi_ut_is_aml_table(struct acpi_table_header *table) 65u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
66{ 66{
67 67
68 /* Ignore tables that contain AML */ 68 /* These are the only tables that contain executable AML */
69 69
70 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || 70 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) ||
71 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || 71 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) ||
@@ -419,10 +419,15 @@ void acpi_ut_set_integer_width(u8 revision)
419{ 419{
420 420
421 if (revision <= 1) { 421 if (revision <= 1) {
422
423 /* 32-bit case */
424
422 acpi_gbl_integer_bit_width = 32; 425 acpi_gbl_integer_bit_width = 32;
423 acpi_gbl_integer_nybble_width = 8; 426 acpi_gbl_integer_nybble_width = 8;
424 acpi_gbl_integer_byte_width = 4; 427 acpi_gbl_integer_byte_width = 4;
425 } else { 428 } else {
429 /* 64-bit case (ACPI 2.0+) */
430
426 acpi_gbl_integer_bit_width = 64; 431 acpi_gbl_integer_bit_width = 64;
427 acpi_gbl_integer_nybble_width = 16; 432 acpi_gbl_integer_nybble_width = 16;
428 acpi_gbl_integer_byte_width = 8; 433 acpi_gbl_integer_byte_width = 8;
@@ -502,6 +507,7 @@ acpi_ut_display_init_pathname(u8 type,
502 * FUNCTION: acpi_ut_valid_acpi_char 507 * FUNCTION: acpi_ut_valid_acpi_char
503 * 508 *
504 * PARAMETERS: Char - The character to be examined 509 * PARAMETERS: Char - The character to be examined
510 * Position - Byte position (0-3)
505 * 511 *
506 * RETURN: TRUE if the character is valid, FALSE otherwise 512 * RETURN: TRUE if the character is valid, FALSE otherwise
507 * 513 *
@@ -609,7 +615,9 @@ acpi_name acpi_ut_repair_name(acpi_name name)
609 * 615 *
610 * RETURN: Status and Converted value 616 * RETURN: Status and Converted value
611 * 617 *
612 * DESCRIPTION: Convert a string into an unsigned value. 618 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
619 * 32-bit or 64-bit conversion, depending on the current mode
620 * of the interpreter.
613 * NOTE: Does not support Octal strings, not needed. 621 * NOTE: Does not support Octal strings, not needed.
614 * 622 *
615 ******************************************************************************/ 623 ******************************************************************************/
@@ -627,7 +635,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
627 u8 sign_of0x = 0; 635 u8 sign_of0x = 0;
628 u8 term = 0; 636 u8 term = 0;
629 637
630 ACPI_FUNCTION_TRACE(ut_stroul64); 638 ACPI_FUNCTION_TRACE_STR(ut_stroul64, string);
631 639
632 switch (base) { 640 switch (base) {
633 case ACPI_ANY_BASE: 641 case ACPI_ANY_BASE:
@@ -675,11 +683,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
675 } 683 }
676 } 684 }
677 685
686 /*
687 * Perform a 32-bit or 64-bit conversion, depending upon the current
688 * execution mode of the interpreter
689 */
678 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; 690 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
679 691
680 /* At least one character in the string here */ 692 /* Main loop: convert the string to a 32- or 64-bit integer */
681
682 /* Main loop: convert the string to a 64-bit integer */
683 693
684 while (*string) { 694 while (*string) {
685 if (ACPI_IS_DIGIT(*string)) { 695 if (ACPI_IS_DIGIT(*string)) {
@@ -754,6 +764,9 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
754 764
755 all_done: 765 all_done:
756 766
767 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
768 ACPI_FORMAT_UINT64(return_value)));
769
757 *ret_integer = return_value; 770 *ret_integer = return_value;
758 return_ACPI_STATUS(AE_OK); 771 return_ACPI_STATUS(AE_OK);
759 772
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index 0f5c5bb5deff..eaa13d05c859 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -199,6 +199,13 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
199 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; 199 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
200 state->thread.thread_id = acpi_os_get_thread_id(); 200 state->thread.thread_id = acpi_os_get_thread_id();
201 201
202 /* Check for invalid thread ID - zero is very bad, it will break things */
203
204 if (!state->thread.thread_id) {
205 ACPI_ERROR((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId"));
206 state->thread.thread_id = (acpi_thread_id) 1;
207 }
208
202 return_PTR((struct acpi_thread_state *)state); 209 return_PTR((struct acpi_thread_state *)state);
203} 210}
204 211