Skip to content

Commit

Permalink
ACPI: ACPICA 20060707
Browse files Browse the repository at this point in the history
Added the ACPI_PACKED_POINTERS_NOT_SUPPORTED macro to
support C compilers that do not allow the initialization
of address pointers within packed structures - even though
the hardware itself may support misaligned transfers. Some
of the debug data structures are packed by default to
minimize size.

Added an error message for the case where
acpi_os_get_thread_id() returns zero. A non-zero value is
required by the core ACPICA code to ensure the proper
operation of AML mutexes and recursive control methods.

The DSDT is now the only ACPI table that determines whether
the AML interpreter is in 32-bit or 64-bit mode. Not really
a functional change, but the hooks for per-table 32/64
switching have been removed from the code. A clarification
to the ACPI specification is forthcoming in ACPI 3.0B.

Fixed a possible leak of an Owner ID in the error
path of tbinstal.c acpi_tb_init_table_descriptor() and
migrated all table OwnerID deletion to a single place in
acpi_tb_uninstall_table() to correct possible leaks when using
the acpi_tb_delete_tables_by_type() interface (with assistance
from Lance Ortiz.)

Fixed a problem with Serialized control methods where the
semaphore associated with the method could be over-signaled
after multiple method invocations.

Fixed two issues with the locking of the internal
namespace data structure. Both the Unload() operator and
acpi_unload_table() interface now lock the namespace during
the namespace deletion associated with the table unload
(with assistance from Linn Crosetto.)

Fixed problem reports (Valery Podrezov) integrated: -
Eliminate unnecessary memory allocation for CreateXxxxField
http://bugzilla.kernel.org/show_bug.cgi?id=5426

Fixed problem reports (Fiodor Suietov) integrated: -
Incomplete cleanup branches in AcpiTbGetTableRsdt (BZ 369)
- On Address Space handler deletion, needless deactivation
call (BZ 374) - AcpiRemoveAddressSpaceHandler: validate
Device handle parameter (BZ 375) - Possible memory leak,
Notify sub-objects of Processor, Power, ThermalZone (BZ
376) - AcpiRemoveAddressSpaceHandler: validate Handler
parameter (BZ 378) - Minimum Length of RSDT should be
validated (BZ 379) - AcpiRemoveNotifyHandler: return
AE_NOT_EXIST if Processor Obj has no Handler (BZ (380)
- AcpiUnloadTable: return AE_NOT_EXIST if no table of
specified type loaded (BZ 381)

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Bob Moore authored and Len Brown committed Jul 9, 2006
1 parent 120bda2 commit f6dd922
Show file tree
Hide file tree
Showing 21 changed files with 209 additions and 113 deletions.
10 changes: 0 additions & 10 deletions drivers/acpi/dispatcher/dsinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle,

case ACPI_TYPE_METHOD:

/*
* Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table.
* TBD: This is really for possible future support of integer width
* on a per-table basis. Currently, we just use a global for the width.
*/
if (info->table_desc->pointer->revision == 1) {
node->flags |= ANOBJ_DATA_WIDTH_32;
}

info->method_count++;
break;

Expand Down
23 changes: 4 additions & 19 deletions drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
union acpi_operand_object *mutex_desc;
acpi_status status;

ACPI_FUNCTION_NAME(ds_create_method_mutex);
ACPI_FUNCTION_TRACE(ds_create_method_mutex);

/* Create the new mutex object */

Expand Down Expand Up @@ -493,7 +493,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,

ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n",
(char *)&walk_state->method_node->name,
acpi_ut_get_node_name(walk_state->method_node),
walk_state->method_call_op, return_desc));

ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
Expand Down Expand Up @@ -610,6 +610,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,

acpi_os_release_mutex(method_desc->method.mutex->mutex.
os_mutex);
method_desc->method.mutex->mutex.owner_thread = NULL;
}
}

Expand All @@ -620,27 +621,11 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
*/
method_node = walk_state->method_node;

/* Lock namespace for possible update */

status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_VOID;
}

/*
* Delete any namespace entries created immediately underneath
* the method
*/
if (method_node && method_node->child) {
acpi_ns_delete_namespace_subtree(method_node);
}

/*
* Delete any namespace entries created anywhere else within
* Delete any namespace objects created anywhere within
* the namespace by the execution of this method
*/
acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id);
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
}

/* Decrement the thread count on the method */
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/dispatcher/dswexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
/*
* Most operators with arguments.
* Most operators with arguments (except create_xxx_field operators)
* Start a new result/operand state
*/
if (walk_state->opcode != AML_CREATE_FIELD_OP) {
if (walk_state->op_info->object_type != ACPI_TYPE_BUFFER_FIELD) {
status = acpi_ds_result_stack_push(walk_state);
}
break;
Expand Down
44 changes: 25 additions & 19 deletions drivers/acpi/events/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,34 +528,40 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
}
}

/* Call the setup handler with the deactivate notification */
/*
* If the region has been activated, call the setup handler
* with the deactivate notification
*/
if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
region_setup = handler_obj->address_space.setup;
status =
region_setup(region_obj,
ACPI_REGION_DEACTIVATE,
handler_obj->address_space.
context, region_context);

region_setup = handler_obj->address_space.setup;
status =
region_setup(region_obj, ACPI_REGION_DEACTIVATE,
handler_obj->address_space.context,
region_context);
/* Init routine may fail, Just ignore errors */

/* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"from region handler - deactivate, [%s]",
acpi_ut_get_region_name
(region_obj->region.
space_id)));
}

if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"from region init, [%s]",
acpi_ut_get_region_name
(region_obj->region.space_id)));
region_obj->region.flags &=
~(AOPOBJ_SETUP_COMPLETE);
}

region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);

/*
* Remove handler reference in the region
*
* NOTE: this doesn't mean that the region goes away
* The region is just inaccessible as indicated to
* the _REG method
* NOTE: this doesn't mean that the region goes away, the region
* is just inaccessible as indicated to the _REG method
*
* If the region is on the handler's list
* this better be the region's handler
* If the region is on the handler's list, this must be the
* region's handler
*/
region_obj->region.handler = NULL;
acpi_ut_remove_reference(handler_obj);
Expand Down
44 changes: 26 additions & 18 deletions drivers/acpi/events/evxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device,
node = acpi_ns_map_handle_to_node(device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock;
goto unlock_and_exit;
}

/* Root Object */
Expand All @@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device,
((handler_type & ACPI_DEVICE_NOTIFY) &&
!acpi_gbl_device_notify.handler)) {
status = AE_NOT_EXIST;
goto unlock;
goto unlock_and_exit;
}

/* Make sure all deferred tasks are completed */
Expand Down Expand Up @@ -474,25 +474,29 @@ acpi_remove_notify_handler(acpi_handle device,

if (!acpi_ev_is_notify_object(node)) {
status = AE_TYPE;
goto unlock;
goto unlock_and_exit;
}

/* Check for an existing internal object */

obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) {
status = AE_NOT_EXIST;
goto unlock;
goto unlock_and_exit;
}

/* Object exists - make sure there's an existing handler */

if (handler_type & ACPI_SYSTEM_NOTIFY) {
notify_obj = obj_desc->common_notify.system_notify;
if ((!notify_obj) ||
(notify_obj->notify.handler != handler)) {
if (!notify_obj) {
status = AE_NOT_EXIST;
goto unlock_and_exit;
}

if (notify_obj->notify.handler != handler) {
status = AE_BAD_PARAMETER;
goto unlock;
goto unlock_and_exit;
}
/* Make sure all deferred tasks are completed */

Expand All @@ -510,10 +514,14 @@ acpi_remove_notify_handler(acpi_handle device,

if (handler_type & ACPI_DEVICE_NOTIFY) {
notify_obj = obj_desc->common_notify.device_notify;
if ((!notify_obj) ||
(notify_obj->notify.handler != handler)) {
if (!notify_obj) {
status = AE_NOT_EXIST;
goto unlock_and_exit;
}

if (notify_obj->notify.handler != handler) {
status = AE_BAD_PARAMETER;
goto unlock;
goto unlock_and_exit;
}
/* Make sure all deferred tasks are completed */

Expand All @@ -530,9 +538,9 @@ acpi_remove_notify_handler(acpi_handle device,
}
}

unlock:
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
exit:
exit:
if (ACPI_FAILURE(status))
ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler"));
return_ACPI_STATUS(status);
Expand Down Expand Up @@ -586,23 +594,23 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
if (!gpe_event_info) {
status = AE_BAD_PARAMETER;
goto unlock;
goto unlock_and_exit;
}

/* Make sure that there isn't a handler there already */

if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) {
status = AE_ALREADY_EXISTS;
goto unlock;
goto unlock_and_exit;
}

/* Allocate and init handler object */

handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
if (!handler) {
status = AE_NO_MEMORY;
goto unlock;
goto unlock_and_exit;
}

handler->address = address;
Expand All @@ -613,7 +621,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,

status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
goto unlock;
goto unlock_and_exit;
}

/* Install the handler */
Expand All @@ -628,9 +636,9 @@ acpi_install_gpe_handler(acpi_handle gpe_device,

acpi_os_release_lock(acpi_gbl_gpe_lock, flags);

unlock:
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
exit:
exit:
if (ACPI_FAILURE(status))
ACPI_EXCEPTION((AE_INFO, status,
"Installing notify handler failed"));
Expand Down
13 changes: 12 additions & 1 deletion drivers/acpi/events/evxfregn.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ acpi_remove_address_space_handler(acpi_handle device,
/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(device);
if (!node) {
if (!node ||
((node->type != ACPI_TYPE_DEVICE) &&
(node->type != ACPI_TYPE_PROCESSOR) &&
(node->type != ACPI_TYPE_THERMAL) &&
(node != acpi_gbl_root_node))) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
Expand All @@ -178,6 +182,13 @@ acpi_remove_address_space_handler(acpi_handle device,

if (handler_obj->address_space.space_id == space_id) {

/* Handler must be the same as the installed handler */

if (handler_obj->address_space.handler != handler) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}

/* Matched space_id, first dereference this in the Regions */

ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/executer/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
* (Offset contains the table_id)
*/
acpi_ns_delete_namespace_by_owner(table_info->owner_id);
acpi_ut_release_owner_id(&table_info->owner_id);

/* Delete the table itself */

Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/executer/exconvrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_NO_MEMORY);
}

ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64(result)));

/* Save the Result */

return_desc->integer.value = result;
Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/executer/exsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ACPI_MODULE_NAME("exsystem")
*
* DESCRIPTION: Implements a semaphore wait with a check to see if the
* semaphore is available immediately. If it is not, the
* interpreter is released.
* interpreter is released before waiting.
*
******************************************************************************/
acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
Expand Down Expand Up @@ -110,9 +110,9 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
*
* RETURN: Status
*
* DESCRIPTION: Implements a semaphore wait with a check to see if the
* semaphore is available immediately. If it is not, the
* interpreter is released.
* DESCRIPTION: Implements a mutex wait with a check to see if the
* mutex is available immediately. If it is not, the
* interpreter is released before waiting.
*
******************************************************************************/

Expand Down
13 changes: 12 additions & 1 deletion drivers/acpi/namespace/nsalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,21 +386,31 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
* specific ID. Used to delete entire ACPI tables. All
* reference counts are updated.
*
* MUTEX: Locks namespace during deletion walk.
*
******************************************************************************/

void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
{
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *deletion_node;
u32 level;
struct acpi_namespace_node *parent_node;
u32 level;
acpi_status status;

ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id);

if (owner_id == 0) {
return_VOID;
}

/* Lock namespace for possible update */

status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_VOID;
}

deletion_node = NULL;
parent_node = acpi_gbl_root_node;
child_node = NULL;
Expand Down Expand Up @@ -469,5 +479,6 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
}
}

(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_VOID;
}
Loading

0 comments on commit f6dd922

Please sign in to comment.