Skip to content

Commit

Permalink
Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/lenb/linux-acpi-2.6

* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  ACPICA: Update version to 20091112.
  ACPICA: Add additional module-level code support
  ACPICA: Deploy new create integer interface where appropriate
  ACPICA: New internal utility function to create Integer objects
  ACPICA: Add repair for predefined methods that must return sorted lists
  ACPICA: Fix possible fault if return Package objects contain NULL elements
  ACPICA: Add post-order callback to acpi_walk_namespace
  ACPICA: Change package length error message to an info message
  ACPICA: Reduce severity of predefined repair messages, Warning to Info
  ACPICA: Update version to 20091013
  ACPICA: Fix possible memory leak for Scope ASL operator
  ACPICA: Remove possibility of executing _REG methods twice
  ACPICA: Add repair for bad _MAT buffers
  ACPICA: Add repair for bad _BIF/_BIX packages
  • Loading branch information
torvalds committed Dec 10, 2009
2 parents f71eaf6 + b00eb79 commit 3067e02
Show file tree
Hide file tree
Showing 49 changed files with 1,153 additions and 283 deletions.
2 changes: 1 addition & 1 deletion arch/ia64/sn/kernel/io_acpi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
pcidev_match.handle = NULL;

acpi_walk_namespace(ACPI_TYPE_DEVICE, rootbus_handle, ACPI_UINT32_MAX,
find_matching_device, &pcidev_match, NULL);
find_matching_device, NULL, &pcidev_match, NULL);

if (!pcidev_match.handle) {
printk(KERN_ERR
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/cpufreq/longhaul.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)

/* Find ACPI data for processor */
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, &longhaul_walk_callback,
ACPI_UINT32_MAX, &longhaul_walk_callback, NULL,
NULL, (void *)&pr);

/* Check ACPI support for C3 state */
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static int __init acpi_memory_device_init(void)

status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
acpi_memory_register_notify_handler,
acpi_memory_register_notify_handler, NULL,
NULL, NULL);

if (ACPI_FAILURE(status)) {
Expand All @@ -561,7 +561,7 @@ static void __exit acpi_memory_device_exit(void)
*/
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
acpi_memory_deregister_notify_handler,
acpi_memory_deregister_notify_handler, NULL,
NULL, NULL);

if (ACPI_FAILURE(status))
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \
nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
nsparse.o nspredef.o nsrepair.o
nsparse.o nspredef.o nsrepair.o nsrepair2.o

acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o

Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/acpica/acmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist

#else

Expand All @@ -349,6 +350,8 @@
#define ACPI_ERROR_NAMESPACE(s, e)
#define ACPI_ERROR_METHOD(s, n, p, e)
#define ACPI_WARN_PREDEFINED(plist)
#define ACPI_INFO_PREDEFINED(plist)

#endif /* ACPI_NO_ERROR_MESSAGES */

/*
Expand Down
16 changes: 14 additions & 2 deletions drivers/acpi/acpica/acnamesp.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
u32 flags,
acpi_walk_callback user_function,
acpi_walk_callback pre_order_visit,
acpi_walk_callback post_order_visit,
void *context, void **return_value);

struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
Expand Down Expand Up @@ -272,7 +273,8 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
acpi_object_handler handler, void **data);

/*
* nsrepair - return object repair for predefined methods/objects
* nsrepair - General return object repair for all
* predefined methods/objects
*/
acpi_status
acpi_ns_repair_object(struct acpi_predefined_data *data,
Expand All @@ -284,6 +286,16 @@ acpi_status
acpi_ns_repair_package_list(struct acpi_predefined_data *data,
union acpi_operand_object **obj_desc_ptr);

/*
* nsrepair2 - Return object repair for specific
* predefined methods/objects
*/
acpi_status
acpi_ns_complex_repairs(struct acpi_predefined_data *data,
struct acpi_namespace_node *node,
acpi_status validate_status,
union acpi_operand_object **return_object_ptr);

/*
* nssearch - Namespace searching and entry
*/
Expand Down
7 changes: 7 additions & 0 deletions drivers/acpi/acpica/acutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ u8 acpi_ut_valid_internal_object(void *object);

union acpi_operand_object *acpi_ut_create_package_object(u32 count);

union acpi_operand_object *acpi_ut_create_integer_object(u64 value);

union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);

union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
Expand Down Expand Up @@ -481,6 +483,11 @@ acpi_ut_predefined_warning(const char *module_name,
char *pathname,
u8 node_flags, const char *format, ...);

void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_info(const char *module_name,
u32 line_number,
char *pathname, u8 node_flags, const char *format, ...);

/* Values for Base above (16=Hex, 10=Decimal) */

#define ACPI_ANY_BASE 0
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dsinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ acpi_ds_initialize_objects(u32 table_index,
status =
acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object,
&info, NULL);
NULL, &info, NULL);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/acpi/acpica/dsmthdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,11 @@ acpi_ds_method_data_get_value(u8 type,
/* If slack enabled, init the local_x/arg_x to an Integer of value zero */

if (acpi_gbl_enable_interpreter_slack) {
object =
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
object = acpi_ut_create_integer_object((u64) 0);
if (!object) {
return_ACPI_STATUS(AE_NO_MEMORY);
}

object->integer.value = 0;
node->object = object;
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/acpica/dsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
*
* Note: technically, this is an error, from ACPI spec: "It is an error
* for NumElements to be less than the number of elements in the
* PackageList". However, we just print an error message and
* PackageList". However, we just print a message and
* no exception is returned. This provides Windows compatibility. Some
* BIOSs will alter the num_elements on the fly, creating this type
* of ill-formed package object.
Expand All @@ -510,9 +510,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
arg = arg->common.next;
}

ACPI_WARNING((AE_INFO,
"Package List length (0x%X) larger than NumElements count (0x%X), truncated\n",
i, element_count));
ACPI_INFO((AE_INFO,
"Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n",
i, element_count));
} else if (i < element_count) {
/*
* Arg list (elements) was exhausted, but we did not reach num_elements count.
Expand Down
50 changes: 33 additions & 17 deletions drivers/acpi/acpica/dswload.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,26 +639,42 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
break;

case AML_SCOPE_OP:
/*
* The Path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up
* for use later.
*/
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE(status)) {
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
} else {
ACPI_ERROR_NAMESPACE(buffer_ptr, status);

/* Special case for Scope(\) -> refers to the Root node */

if (op && (op->named.node == acpi_gbl_root_node)) {
node = op->named.node;

status =
acpi_ds_scope_stack_push(node, object_type,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
} else {
/*
* The Path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up
* for use later.
*/
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state,
&(node));
if (ACPI_FAILURE(status)) {
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
} else {
ACPI_ERROR_NAMESPACE(buffer_ptr,
status);
}
#else
ACPI_ERROR_NAMESPACE(buffer_ptr, status);
ACPI_ERROR_NAMESPACE(buffer_ptr, status);
#endif
return_ACPI_STATUS(status);
return_ACPI_STATUS(status);
}
}

/*
Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/acpica/evgpeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,

status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
acpi_ev_save_method_info, gpe_block,
NULL);
acpi_ev_save_method_info, NULL,
gpe_block, NULL);

/* Return the new block */

Expand Down Expand Up @@ -1022,8 +1022,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
status =
acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
acpi_ev_match_prw_and_gpe, &gpe_info,
NULL);
acpi_ev_match_prw_and_gpe, NULL,
&gpe_info, NULL);
}

/*
Expand Down
81 changes: 66 additions & 15 deletions drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
ACPI_MODULE_NAME("evregion")

/* Local prototypes */
static u8
acpi_ev_has_default_handler(struct acpi_namespace_node *node,
acpi_adr_space_type space_id);

static acpi_status
acpi_ev_reg_run(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
Expand Down Expand Up @@ -140,6 +144,50 @@ acpi_status acpi_ev_install_region_handlers(void)
return_ACPI_STATUS(status);
}

/*******************************************************************************
*
* FUNCTION: acpi_ev_has_default_handler
*
* PARAMETERS: Node - Namespace node for the device
* space_id - The address space ID
*
* RETURN: TRUE if default handler is installed, FALSE otherwise
*
* DESCRIPTION: Check if the default handler is installed for the requested
* space ID.
*
******************************************************************************/

static u8
acpi_ev_has_default_handler(struct acpi_namespace_node *node,
acpi_adr_space_type space_id)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *handler_obj;

/* Must have an existing internal object */

obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) {
handler_obj = obj_desc->device.handler;

/* Walk the linked list of handlers for this object */

while (handler_obj) {
if (handler_obj->address_space.space_id == space_id) {
if (handler_obj->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
return (TRUE);
}
}

handler_obj = handler_obj->address_space.next;
}
}

return (FALSE);
}

/*******************************************************************************
*
* FUNCTION: acpi_ev_initialize_op_regions
Expand Down Expand Up @@ -169,12 +217,18 @@ acpi_status acpi_ev_initialize_op_regions(void)

for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
/*
* TBD: Make sure handler is the DEFAULT handler, otherwise
* _REG will have already been run.
* Make sure the installed handler is the DEFAULT handler. If not the
* default, the _REG methods will have already been run (when the
* handler was installed)
*/
status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
acpi_gbl_default_address_spaces
[i]);
if (acpi_ev_has_default_handler(acpi_gbl_root_node,
acpi_gbl_default_address_spaces
[i])) {
status =
acpi_ev_execute_reg_methods(acpi_gbl_root_node,
acpi_gbl_default_address_spaces
[i]);
}
}

(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
Expand Down Expand Up @@ -235,23 +289,20 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
* connection status 1 for connecting the handler, 0 for disconnecting
* the handler (Passed as a parameter)
*/
args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
args[0] =
acpi_ut_create_integer_object((u64) region_obj->region.space_id);
if (!args[0]) {
status = AE_NO_MEMORY;
goto cleanup1;
}

args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
args[1] = acpi_ut_create_integer_object((u64) function);
if (!args[1]) {
status = AE_NO_MEMORY;
goto cleanup2;
}

/* Setup the parameter objects */

args[0]->integer.value = region_obj->region.space_id;
args[1]->integer.value = function;
args[2] = NULL;
args[2] = NULL; /* Terminate list */

/* Execute the method, no return value */

Expand Down Expand Up @@ -971,8 +1022,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
*/
status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK,
acpi_ev_install_handler, handler_obj,
NULL);
acpi_ev_install_handler, NULL,
handler_obj, NULL);

unlock_and_exit:
return_ACPI_STATUS(status);
Expand Down Expand Up @@ -1008,7 +1059,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
*/
status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
&space_id, NULL);
NULL, &space_id, NULL);

return_ACPI_STATUS(status);
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,

/* Table not found, return an Integer=0 and AE_OK */

ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
ddb_handle = acpi_ut_create_integer_object((u64) 0);
if (!ddb_handle) {
return_ACPI_STATUS(AE_NO_MEMORY);
}

ddb_handle->integer.value = 0;
*return_desc = ddb_handle;

return_ACPI_STATUS(AE_OK);
}

Expand Down
Loading

0 comments on commit 3067e02

Please sign in to comment.