Commit 5d2a2207 authored by Len Brown's avatar Len Brown

/home/lenb/src/to-akpm branch 'acpi-2.6.12'

parents 1c5ad845 bd6dbdf3
......@@ -33,3 +33,6 @@ The result of the execution of this aml method is
attached to /proc/acpi/hotkey/poll_method, which is dnyamically
created. Please use command "cat /proc/acpi/hotkey/polling_method"
to retrieve it.
Note: Use cmdline "acpi_specific_hotkey" to enable legacy platform
specific drivers.
......@@ -86,20 +86,20 @@ acpi_ds_init_one_object (
void *context,
void **return_value)
{
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
acpi_object_type type;
acpi_status status;
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
ACPI_FUNCTION_NAME ("ds_init_one_object");
/*
* We are only interested in objects owned by the table that
* We are only interested in NS nodes owned by the table that
* was just loaded
*/
if (((struct acpi_namespace_node *) obj_handle)->owner_id !=
info->table_desc->table_id) {
if (node->owner_id != info->table_desc->owner_id) {
return (AE_OK);
}
......@@ -126,8 +126,6 @@ acpi_ds_init_one_object (
case ACPI_TYPE_METHOD:
info->method_count++;
/*
* Print a dot for each method unless we are going to print
* the entire pathname
......@@ -143,7 +141,7 @@ acpi_ds_init_one_object (
* on a per-table basis. Currently, we just use a global for the width.
*/
if (info->table_desc->pointer->revision == 1) {
((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
node->flags |= ANOBJ_DATA_WIDTH_32;
}
/*
......@@ -153,22 +151,14 @@ acpi_ds_init_one_object (
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Method %p [%4.4s] - parse failure, %s\n",
"\n+Method %p [%4.4s] - parse failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */
break;
}
/*
* Delete the parse tree. We simply re-parse the method
* for every execution since there isn't much overhead
*/
acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (
((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
info->method_count++;
break;
......@@ -237,7 +227,7 @@ acpi_ds_initialize_objects (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, table_desc->table_id, info.object_count,
table_desc->pointer->signature, table_desc->owner_id, info.object_count,
info.device_count, info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
......
......@@ -58,12 +58,11 @@
*
* FUNCTION: acpi_ds_parse_method
*
* PARAMETERS: obj_handle - Method node
* PARAMETERS: Node - Method node
*
* RETURN: Status
*
* DESCRIPTION: Call the parser and parse the AML that is associated with the
* method.
* DESCRIPTION: Parse the AML that is associated with the method.
*
* MUTEX: Assumes parser is locked
*
......@@ -71,31 +70,28 @@
acpi_status
acpi_ds_parse_method (
acpi_handle obj_handle)
struct acpi_namespace_node *node)
{
acpi_status status;
union acpi_operand_object *obj_desc;
union acpi_parse_object *op;
struct acpi_namespace_node *node;
acpi_owner_id owner_id;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle);
ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);
/* Parameter Validation */
if (!obj_handle) {
if (!node) {
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
acpi_ut_get_node_name (obj_handle), obj_handle));
acpi_ut_get_node_name (node), node));
/* Extract the method object from the method Node */
node = (struct acpi_namespace_node *) obj_handle;
obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
return_ACPI_STATUS (AE_NULL_OBJECT);
......@@ -132,14 +128,18 @@ acpi_ds_parse_method (
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
obj_desc->method.owning_id = owner_id;
status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
walk_state = acpi_ds_create_walk_state (
obj_desc->method.owner_id, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = AE_NO_MEMORY;
goto cleanup2;
}
status = acpi_ds_init_aml_walk (walk_state, op, node,
......@@ -147,7 +147,7 @@ acpi_ds_parse_method (
obj_desc->method.aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
goto cleanup2;
}
/*
......@@ -161,13 +161,25 @@ acpi_ds_parse_method (
*/
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
goto cleanup2;
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
acpi_ut_get_node_name (obj_handle), obj_handle, op));
acpi_ut_get_node_name (node), node, op));
/*
* Delete the parse tree. We simply re-parse the method for every
* execution since there isn't much overhead (compared to keeping lots
* of parse trees around)
*/
acpi_ns_delete_namespace_subtree (node);
acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);
cleanup2:
acpi_ut_release_owner_id (&obj_desc->method.owner_id);
cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
......@@ -263,7 +275,7 @@ acpi_ds_call_control_method (
{
acpi_status status;
struct acpi_namespace_node *method_node;
struct acpi_walk_state *next_walk_state;
struct acpi_walk_state *next_walk_state = NULL;
union acpi_operand_object *obj_desc;
struct acpi_parameter_info info;
u32 i;
......@@ -287,20 +299,23 @@ acpi_ds_call_control_method (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Init for new method, wait on concurrency semaphore */
status = acpi_ds_begin_method_execution (method_node, obj_desc,
this_walk_state->method_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
goto cleanup;
}
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
/* 1) Parse: Create a new walk state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
op, obj_desc, NULL);
if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
......@@ -330,7 +345,7 @@ acpi_ds_call_control_method (
/* 2) Execute: Create a new state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
NULL, obj_desc, thread);
if (!next_walk_state) {
status = AE_NO_MEMORY;
......@@ -381,6 +396,7 @@ acpi_ds_call_control_method (
/* On error, we must delete the new walk state */
cleanup:
acpi_ut_release_owner_id (&obj_desc->method.owner_id);
if (next_walk_state && (next_walk_state->method_desc)) {
/* Decrement the thread count on the method parse tree */
......@@ -552,8 +568,7 @@ acpi_ds_terminate_control_method (
*/
if ((walk_state->method_desc->method.concurrency == 1) &&
(!walk_state->method_desc->method.semaphore)) {
status = acpi_os_create_semaphore (1,
1,
status = acpi_os_create_semaphore (1, 1,
&walk_state->method_desc->method.semaphore);
}
......@@ -582,8 +597,10 @@ acpi_ds_terminate_control_method (
* Delete any namespace entries created anywhere else within
* the namespace
*/
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......
......@@ -632,23 +632,12 @@ acpi_ds_store_object_to_local (
* Weird, but true.
*/
if (opcode == AML_ARG_OP) {
/*
* Make sure that the object is the correct type. This may be
* overkill, butit is here because references were NS nodes in
* the past. Now they are operand objects of type Reference.
*/
if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_REPORT_ERROR ((
"Invalid descriptor type while storing to method arg: [%s]\n",
acpi_ut_get_descriptor_name (current_obj_desc)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* If we have a valid reference object that came from ref_of(),
* do the indirect store
*/
if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an obj_ref(Node), storing in node %p\n",
......
......@@ -547,6 +547,9 @@ acpi_ds_init_object_from_op (
case AML_TYPE_LITERAL:
obj_desc->integer.value = op->common.value.integer;
#ifndef ACPI_NO_METHOD_EXECUTION
acpi_ex_truncate_for32bit_table (obj_desc);
#endif
break;
......
......@@ -119,14 +119,15 @@ acpi_ds_execute_arguments (
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = AE_NO_MEMORY;
goto cleanup;
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
goto cleanup;
}
/* Mark this parse as a deferred opcode */
......@@ -138,8 +139,7 @@ acpi_ds_execute_arguments (
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
goto cleanup;
}
/* Get and init the Op created above */
......@@ -160,7 +160,8 @@ acpi_ds_execute_arguments (
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = AE_NO_MEMORY;
goto cleanup;
}
/* Execute the opcode and arguments */
......@@ -169,13 +170,15 @@ acpi_ds_execute_arguments (
aml_length, NULL, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
goto cleanup;
}
/* Mark this execution as a deferred opcode */
walk_state->deferred_node = node;
status = acpi_ps_parse_aml (walk_state);
cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
......
......@@ -50,7 +50,7 @@
#include <acpi/acnamesp.h>
#include <acpi/acevents.h>
#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
#include <acpi/acdisasm.h>
#endif
......@@ -145,15 +145,6 @@ acpi_ds_load1_begin_op (
if (op) {
if (!(walk_state->op_info->flags & AML_NAMED)) {
#if 0
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
walk_state->op_info->name);
*out_op = op;
return (AE_CTRL_SKIP);
}
#endif
*out_op = op;
return (AE_OK);
}
......@@ -185,7 +176,7 @@ acpi_ds_load1_begin_op (
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
/*
* Table disassembly:
......@@ -486,11 +477,31 @@ acpi_ds_load2_begin_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
if (op) {
if ((walk_state->control_state) &&
(walk_state->control_state->common.state ==
ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
/* We are executing a while loop outside of a method */
status = acpi_ds_exec_begin_op (walk_state, out_op);
return_ACPI_STATUS (status);
}
/* We only care about Namespace opcodes here */
if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
(walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
(!(walk_state->op_info->flags & AML_NAMED))) {
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
walk_state->op_info->flags));
/* Executing a type1 or type2 opcode outside of a method */
status = acpi_ds_exec_begin_op (walk_state, out_op);
return_ACPI_STATUS (status);
}
return_ACPI_STATUS (AE_OK);
}
......@@ -558,7 +569,7 @@ acpi_ds_load2_begin_op (
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
if (ACPI_FAILURE (status)) {
#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
}
......@@ -651,8 +662,10 @@ acpi_ds_load2_begin_op (
break;
}
/* Add new entry into namespace */
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
walk_state, &(node));
break;
}
......@@ -662,7 +675,6 @@ acpi_ds_load2_begin_op (
return_ACPI_STATUS (status);
}
if (!op) {
/* Create a new op */
......@@ -676,9 +688,7 @@ acpi_ds_load2_begin_op (
if (node) {
op->named.name = node->name.integer;
}
if (out_op) {
*out_op = op;
}
*out_op = op;
}
/*
......@@ -725,9 +735,24 @@ acpi_ds_load2_end_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
walk_state->op_info->name, op, walk_state));
/* Only interested in opcodes that have namespace objects */
/* Check if opcode had an associated namespace object */
if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
#ifndef ACPI_NO_METHOD_EXECUTION
/* No namespace object. Executable opcode? */
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
walk_state->op_info->flags));
/* Executing a type1 or type2 opcode outside of a method */
status = acpi_ds_exec_end_op (walk_state);
return_ACPI_STATUS (status);
}
#endif
return_ACPI_STATUS (AE_OK);
}
......@@ -736,7 +761,6 @@ acpi_ds_load2_end_op (
"Ending scope Op=%p State=%p\n", op, walk_state));
}
object_type = walk_state->op_info->object_type;
/*
......@@ -959,6 +983,7 @@ acpi_ds_load2_end_op (
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &(new_node));
if (ACPI_SUCCESS (status)) {
/*
* Make sure that what we found is indeed a method
* We didn't search for a method on purpose, to see if the name
......
......@@ -261,12 +261,12 @@ acpi_ds_result_pop_from_bottom (
if (!*object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X, Index=%X\n",
"Null operand! State=%p #Ops=%X Index=%X\n",
walk_state, state->results.num_results, (u32) index));
return (AE_AML_NO_RETURN_VALUE);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
state, walk_state));
......@@ -681,7 +681,7 @@ acpi_ds_create_walk_state (
ACPI_FUNCTION_TRACE ("ds_create_walk_state");
walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state));
if (!walk_state) {
return_PTR (NULL);
}
......@@ -704,7 +704,7 @@ acpi_ds_create_walk_state (
status = acpi_ds_result_stack_push (walk_state);
if (ACPI_FAILURE (status)) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
ACPI_MEM_FREE (walk_state);
return_PTR (NULL);
}
......@@ -744,7 +744,7 @@ acpi_ds_init_aml_walk (
u8 *aml_start,
u32 aml_length,
struct acpi_parameter_info *info,
u32 pass_number)
u8 pass_number)
{
acpi_status status;
struct acpi_parse_state *parser_state = &walk_state->parser_state;
......@@ -762,6 +762,7 @@ acpi_ds_init_aml_walk (
/* The next_op of the next_walk will be the beginning of the method */
walk_state->next_op = NULL;
walk_state->pass_number = pass_number;
if (info) {
if (info->parameter_type == ACPI_PARAM_GPE) {
......@@ -899,38 +900,11 @@ acpi_ds_delete_walk_state (
acpi_ut_delete_generic_state (state);
}
acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
ACPI_MEM_FREE (walk_state);
return_VOID;
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/******************************************************************************
*
* FUNCTION: acpi_ds_delete_walk_state_cache
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination.
*
******************************************************************************/
void
acpi_ds_delete_walk_state_cache (
void)
{
ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
return_VOID;
}
#endif
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
......
......@@ -396,6 +396,7 @@ acpi_ev_gpe_detect (
struct acpi_gpe_register_info *gpe_register_info;
u32 status_reg;
u32 enable_reg;
u32 flags;
acpi_status status;
struct acpi_gpe_block_info *gpe_block;
acpi_native_uint i;
......@@ -412,7 +413,7 @@ acpi_ev_gpe_detect (
/* Examine all GPE blocks attached to this interrupt level */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
gpe_block = gpe_xrupt_list->gpe_block_list_head;
while (gpe_block) {
/*
......@@ -476,7 +477,7 @@ acpi_ev_gpe_detect (
unlock_and_exit:
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
return (int_status);
}
......
......@@ -66,7 +66,7 @@ acpi_ev_match_prw_and_gpe (
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
u32 interrupt_level);
u32 interrupt_number);
static acpi_status
acpi_ev_delete_gpe_xrupt (
......@@ -75,7 +75,7 @@ acpi_ev_delete_gpe_xrupt (
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
u32 interrupt_level);
u32 interrupt_number);
static acpi_status
acpi_ev_create_gpe_info_blocks (
......@@ -138,7 +138,6 @@ acpi_ev_valid_gpe_event (
* FUNCTION: acpi_ev_walk_gpe_list
*
* PARAMETERS: gpe_walk_callback - Routine called for each GPE block
* Flags - ACPI_NOT_ISR or ACPI_ISR
*
* RETURN: Status
*
......@@ -148,18 +147,18 @@ acpi_ev_valid_gpe_event (
acpi_status
acpi_ev_walk_gpe_list (
ACPI_GPE_CALLBACK gpe_walk_callback,
u32 flags)
ACPI_GPE_CALLBACK gpe_walk_callback)
{
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
acpi_status status = AE_OK;
u32 flags;
ACPI_FUNCTION_TRACE ("ev_walk_gpe_list");
acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
/* Walk the interrupt level descriptor list */
......@@ -482,7 +481,7 @@ acpi_ev_match_prw_and_gpe (
*
* FUNCTION: acpi_ev_get_gpe_xrupt_block
*
* PARAMETERS: interrupt_level - Interrupt for a GPE block
* PARAMETERS: interrupt_number - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*
......@@ -495,11 +494,12 @@ acpi_ev_match_prw_and_gpe (
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
u32 interrupt_level)
u32 interrupt_number)
{
struct acpi_gpe_xrupt_info *next_gpe_xrupt;
struct acpi_gpe_xrupt_info *gpe_xrupt;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
......@@ -509,7 +509,7 @@ acpi_ev_get_gpe_xrupt_block (
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt) {
if (next_gpe_xrupt->interrupt_level == interrupt_level) {
if (next_gpe_xrupt->interrupt_number == interrupt_number) {
return_PTR (next_gpe_xrupt);
}
......@@ -523,11 +523,11 @@ acpi_ev_get_gpe_xrupt_block (
return_PTR (NULL);
}
gpe_xrupt->interrupt_level = interrupt_level;
gpe_xrupt->interrupt_number = interrupt_number;
/* Install new interrupt descriptor with spin lock */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (acpi_gbl_gpe_xrupt_list_head) {
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt->next) {
......@@ -540,17 +540,17 @@ acpi_ev_get_gpe_xrupt_block (
else {
acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
/* Install new interrupt handler if not SCI_INT */
if (interrupt_level != acpi_gbl_FADT->sci_int) {
status = acpi_os_install_interrupt_handler (interrupt_level,
if (interrupt_number != acpi_gbl_FADT->sci_int) {
status = acpi_os_install_interrupt_handler (interrupt_number,
acpi_ev_gpe_xrupt_handler, gpe_xrupt);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not install GPE interrupt handler at level 0x%X\n",
interrupt_level));
interrupt_number));
return_PTR (NULL);
}
}
......@@ -577,6 +577,7 @@ acpi_ev_delete_gpe_xrupt (
struct acpi_gpe_xrupt_info *gpe_xrupt)
{
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt");
......@@ -584,14 +585,14 @@ acpi_ev_delete_gpe_xrupt (
/* We never want to remove the SCI interrupt handler */
if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) {
if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
gpe_xrupt->gpe_block_list_head = NULL;
return_ACPI_STATUS (AE_OK);
}
/* Disable this interrupt */
status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level,
status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number,
acpi_ev_gpe_xrupt_handler);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......@@ -599,7 +600,7 @@ acpi_ev_delete_gpe_xrupt (
/* Unlink the interrupt block with lock */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_xrupt->previous) {
gpe_xrupt->previous->next = gpe_xrupt->next;
}
......@@ -607,7 +608,7 @@ acpi_ev_delete_gpe_xrupt (
if (gpe_xrupt->next) {
gpe_xrupt->next->previous = gpe_xrupt->previous;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
/* Free the block */
......@@ -621,7 +622,7 @@ acpi_ev_delete_gpe_xrupt (
* FUNCTION: acpi_ev_install_gpe_block
*
* PARAMETERS: gpe_block - New GPE block
* interrupt_level - Level to be associated with this GPE block
* interrupt_number - Xrupt to be associated with this GPE block
*
* RETURN: Status
*
......@@ -632,11 +633,12 @@ acpi_ev_delete_gpe_xrupt (
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
u32 interrupt_level)
u32 interrupt_number)
{
struct acpi_gpe_block_info *next_gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
......@@ -647,7 +649,7 @@ acpi_ev_install_gpe_block (
return_ACPI_STATUS (status);
}
gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level);
gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number);
if (!gpe_xrupt_block) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
......@@ -655,7 +657,7 @@ acpi_ev_install_gpe_block (
/* Install the new block at the end of the list with lock */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_xrupt_block->gpe_block_list_head) {
next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
while (next_gpe_block->next) {
......@@ -670,7 +672,7 @@ acpi_ev_install_gpe_block (
}
gpe_block->xrupt_block = gpe_xrupt_block;
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
unlock_and_exit:
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
......@@ -695,6 +697,7 @@ acpi_ev_delete_gpe_block (
struct acpi_gpe_block_info *gpe_block)
{
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
......@@ -720,7 +723,7 @@ acpi_ev_delete_gpe_block (
else {
/* Remove the block on this interrupt with lock */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_block->previous) {
gpe_block->previous->next = gpe_block->next;
}
......@@ -731,7 +734,7 @@ acpi_ev_delete_gpe_block (
if (gpe_block->next) {
gpe_block->next->previous = gpe_block->previous;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
}
/* Free the gpe_block */
......@@ -887,7 +890,7 @@ acpi_ev_create_gpe_info_blocks (
* gpe_block_address - Address and space_iD
* register_count - Number of GPE register pairs in the block
* gpe_block_base_number - Starting GPE number for the block
* interrupt_level - H/W interrupt for the block
* interrupt_number - H/W interrupt for the block
* return_gpe_block - Where the new block descriptor is returned
*
* RETURN: Status
......@@ -902,7 +905,7 @@ acpi_ev_create_gpe_block (
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u8 gpe_block_base_number,
u32 interrupt_level,
u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block)
{
struct acpi_gpe_block_info *gpe_block;
......@@ -948,7 +951,7 @@ acpi_ev_create_gpe_block (
/* Install the new block in the global list(s) */
status = acpi_ev_install_gpe_block (gpe_block, interrupt_level);
status = acpi_ev_install_gpe_block (gpe_block, interrupt_number);
if (ACPI_FAILURE (status)) {
ACPI_MEM_FREE (gpe_block);
return_ACPI_STATUS (status);
......@@ -1013,7 +1016,7 @@ acpi_ev_create_gpe_block (
((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)),
gpe_device->name.ascii,
gpe_block->register_count,
interrupt_level));
interrupt_number));
/* Enable all valid GPEs found above */
......
......@@ -411,6 +411,9 @@ acpi_ev_init_global_lock_handler (
* with an error.
*/
if (status == AE_NO_HARDWARE_RESPONSE) {
ACPI_REPORT_ERROR ((
"No response from Global Lock hardware, disabling lock\n"));
acpi_gbl_global_lock_present = FALSE;
status = AE_OK;
}
......@@ -589,7 +592,7 @@ acpi_ev_terminate (
/* Disable all GPEs in all GPE blocks */
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, ACPI_NOT_ISR);
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
/* Remove SCI handler */
......@@ -602,7 +605,7 @@ acpi_ev_terminate (
/* Deallocate all handler objects installed within GPE info structs */
status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers, ACPI_NOT_ISR);
status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);
/* Return to original mode if necessary */
......
......@@ -218,10 +218,14 @@ acpi_ev_pci_config_region_setup (
while (pci_root_node != acpi_gbl_root_node) {
status = acpi_ut_execute_HID (pci_root_node, &object_hID);
if (ACPI_SUCCESS (status)) {
/* Got a valid _HID, check if this is a PCI root */
/*
* Got a valid _HID string, check if this is a PCI root.
* New for ACPI 3.0: check for a PCI Express root also.
*/
if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING)))) {
sizeof (PCI_ROOT_HID_STRING)) ||
!(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING,
sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) {
/* Install a handler for this PCI root bridge */
status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
......
......@@ -591,6 +591,7 @@ acpi_install_gpe_handler (
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
......@@ -643,7 +644,7 @@ acpi_install_gpe_handler (
/* Install the handler */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
gpe_event_info->dispatch.handler = handler;
/* Setup up dispatch flags to indicate handler (vs. method) */
......@@ -651,7 +652,7 @@ acpi_install_gpe_handler (
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
unlock_and_exit:
......@@ -685,6 +686,7 @@ acpi_remove_gpe_handler (
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
......@@ -741,7 +743,7 @@ acpi_remove_gpe_handler (
/* Remove the handler */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
handler = gpe_event_info->dispatch.handler;
/* Restore Method node (if any), set dispatch flags */
......@@ -751,7 +753,7 @@ acpi_remove_gpe_handler (
if (handler->method_node) {
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
/* Now we can free the handler object */
......
......@@ -635,7 +635,7 @@ acpi_get_gpe_status (
* PARAMETERS: gpe_device - Handle to the parent GPE Block Device
* gpe_block_address - Address and space_iD
* register_count - Number of GPE register pairs in the block
* interrupt_level - H/W interrupt for the block
* interrupt_number - H/W interrupt for the block
*
* RETURN: Status
*
......@@ -648,7 +648,7 @@ acpi_install_gpe_block (
acpi_handle gpe_device,
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u32 interrupt_level)
u32 interrupt_number)
{
acpi_status status;
union acpi_operand_object *obj_desc;
......@@ -681,7 +681,7 @@ acpi_install_gpe_block (
* is always zero
*/
status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
0, interrupt_level, &gpe_block);
0, interrupt_number, &gpe_block);
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
......
......@@ -99,6 +99,11 @@ acpi_ex_add_table (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Init the table handle */
obj_desc->reference.opcode = AML_LOAD_OP;
*ddb_handle = obj_desc;
/* Install the new table into the local data structures */
ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
......@@ -109,7 +114,14 @@ acpi_ex_add_table (
table_info.allocation = ACPI_MEM_ALLOCATED;
status = acpi_tb_install_table (&table_info);
obj_desc->reference.object = table_info.installed_desc;
if (ACPI_FAILURE (status)) {
if (status == AE_ALREADY_EXISTS) {
/* Table already exists, just return the handle */
return_ACPI_STATUS (AE_OK);
}
goto cleanup;
}
......@@ -123,16 +135,12 @@ acpi_ex_add_table (
goto cleanup;
}
/* Init the table handle */
obj_desc->reference.opcode = AML_LOAD_OP;
obj_desc->reference.object = table_info.installed_desc;
*ddb_handle = obj_desc;
return_ACPI_STATUS (AE_OK);
cleanup:
acpi_ut_remove_reference (obj_desc);
*ddb_handle = NULL;
return_ACPI_STATUS (status);
}
......@@ -376,16 +384,22 @@ acpi_ex_load_op (
*/
status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
if (ACPI_FAILURE (status)) {
goto cleanup;
return_ACPI_STATUS (status);
}
table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
buffer_desc->buffer.pointer);
/* Sanity check the table length */
/* All done with the buffer_desc, delete it */
buffer_desc->buffer.pointer = NULL;
acpi_ut_remove_reference (buffer_desc);
/* Sanity check the table length */
if (table_ptr->length < sizeof (struct acpi_table_header)) {
return_ACPI_STATUS (AE_BAD_HEADER);
status = AE_BAD_HEADER;
goto cleanup;
}
break;
......@@ -413,7 +427,9 @@ acpi_ex_load_op (
status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
if (ACPI_FAILURE (status)) {
goto cleanup;
/* On error, table_ptr was deallocated above */
return_ACPI_STATUS (status);
}
/* Store the ddb_handle into the Target operand */
......@@ -421,17 +437,14 @@ acpi_ex_load_op (
status = acpi_ex_store (ddb_handle, target, walk_state);
if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle);
}
return_ACPI_STATUS (status);
/* table_ptr was deallocated above */
return_ACPI_STATUS (status);
}
cleanup:
if (buffer_desc) {
acpi_ut_remove_reference (buffer_desc);
}
else {
if (ACPI_FAILURE (status)) {
ACPI_MEM_FREE (table_ptr);
}
return_ACPI_STATUS (status);
......@@ -482,7 +495,8 @@ acpi_ex_unload_table (
* Delete the entire namespace under this table Node
* (Offset contains the table_id)
*/
acpi_ns_delete_namespace_by_owner (table_info->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 */
......
......@@ -367,7 +367,7 @@ acpi_ex_convert_to_ascii (
/* hex_length: 2 ascii hex chars per data byte */
hex_length = ACPI_MUL_2 (data_width);
hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width);
for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */
......
......@@ -51,6 +51,11 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
/*
* The following routines are used for debug output only
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */
#ifdef ACPI_FUTURE_USAGE
......@@ -73,13 +78,17 @@ static void
acpi_ex_out_address (
char *title,
acpi_physical_address value);
#endif /* ACPI_FUTURE_USAGE */
static void
acpi_ex_dump_reference (
union acpi_operand_object *obj_desc);
/*
* The following routines are used for debug output only
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
static void
acpi_ex_dump_package (
union acpi_operand_object *obj_desc,
u32 level,
u32 index);
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
......@@ -118,7 +127,7 @@ acpi_ex_dump_operand (
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc));
ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
return;
}
......@@ -467,7 +476,7 @@ acpi_ex_dump_operands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Stack dump from %s(%d), %s\n",
"************* Operand Stack dump from %s(%d), %s\n",
module_name, line_number, note));
return;
}
......@@ -508,7 +517,7 @@ acpi_ex_out_integer (
char *title,
u32 value)
{
acpi_os_printf ("%20s : %X\n", title, value);
acpi_os_printf ("%20s : %.2X\n", title, value);
}
static void
......@@ -563,11 +572,146 @@ acpi_ex_dump_node (
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_reference
*
* PARAMETERS: Object - Descriptor to dump
*
* DESCRIPTION: Dumps a reference object
*
******************************************************************************/
static void
acpi_ex_dump_reference (
union acpi_operand_object *obj_desc)
{
struct acpi_buffer ret_buf;
acpi_status status;
if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
acpi_os_printf ("Named Object %p ", obj_desc->reference.node);
ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not convert name to pathname\n");
}
else {
acpi_os_printf ("%s\n", (char *) ret_buf.pointer);
ACPI_MEM_FREE (ret_buf.pointer);
}
}
else if (obj_desc->reference.object) {
acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object);
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_package
*
* PARAMETERS: Object - Descriptor to dump
* Level - Indentation Level
* Index - Package index for this object
*
* DESCRIPTION: Dumps the elements of the package
*
******************************************************************************/
static void
acpi_ex_dump_package (
union acpi_operand_object *obj_desc,
u32 level,
u32 index)
{
u32 i;
/* Indentation and index output */
if (level > 0) {
for (i = 0; i < level; i++) {
acpi_os_printf (" ");
}
acpi_os_printf ("[%.2d] ", index);
}
acpi_os_printf ("%p ", obj_desc);
/* Null package elements are allowed */
if (!obj_desc) {
acpi_os_printf ("[Null Object]\n");
return;
}
/* Packages may only contain a few object types */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER:
acpi_os_printf ("[Integer] = %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
break;
case ACPI_TYPE_STRING:
acpi_os_printf ("[String] Value: ");
for (i = 0; i < obj_desc->string.length; i++) {
acpi_os_printf ("%c", obj_desc->string.pointer[i]);
}
acpi_os_printf ("\n");
break;
case ACPI_TYPE_BUFFER:
acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length);
if (obj_desc->buffer.length) {
acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer,
obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
}
else {
acpi_os_printf ("\n");
}
break;
case ACPI_TYPE_PACKAGE:
acpi_os_printf ("[Package] Contains %d Elements: \n",
obj_desc->package.count);
for (i = 0; i < obj_desc->package.count; i++) {
acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf ("[Object Reference] ");
acpi_ex_dump_reference (obj_desc);
break;
default:
acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
break;
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_object_descriptor
*
* PARAMETERS: *Object - Descriptor to dump
* PARAMETERS: Object - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the object descriptor given.
......@@ -579,9 +723,6 @@ acpi_ex_dump_object_descriptor (
union acpi_operand_object *obj_desc,
u32 flags)
{
u32 i;
ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
......@@ -648,22 +789,13 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_PACKAGE:
acpi_ex_out_integer ("Flags", obj_desc->package.flags);
acpi_ex_out_integer ("Count", obj_desc->package.count);
acpi_ex_out_pointer ("Elements", obj_desc->package.elements);
acpi_ex_out_integer ("Elements", obj_desc->package.count);
acpi_ex_out_pointer ("Element List", obj_desc->package.elements);
/* Dump the package contents */
if (obj_desc->package.count > 0) {
acpi_os_printf ("\nPackage Contents:\n");
for (i = 0; i < obj_desc->package.count; i++) {
acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
if (obj_desc->package.elements[i]) {
acpi_os_printf (" %s",
acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
}
acpi_os_printf ("\n");
}
}
acpi_os_printf ("\nPackage Contents:\n");
acpi_ex_dump_package (obj_desc, 0, 0);
break;
......@@ -686,7 +818,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("param_count", obj_desc->method.param_count);
acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore);
acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id);
acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id);
acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length);
acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start);
break;
......@@ -790,10 +922,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_pointer ("Node", obj_desc->reference.node);
acpi_ex_out_pointer ("Where", obj_desc->reference.where);
if (obj_desc->reference.object) {
acpi_os_printf ("\nReferenced Object:\n");
acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
}
acpi_ex_dump_reference (obj_desc);
break;
......
......@@ -87,6 +87,9 @@ acpi_ex_read_data_from_field (
if (!obj_desc) {
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
if (!ret_buffer_desc) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
/*
......@@ -182,7 +185,7 @@ acpi_ex_read_data_from_field (
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (buffer_desc);
}
else if (ret_buffer_desc) {
else {
*ret_buffer_desc = buffer_desc;
}
......
......@@ -302,7 +302,7 @@ acpi_ex_do_concatenate (
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
return_desc = acpi_ut_create_buffer_object (
return_desc = acpi_ut_create_buffer_object ((acpi_size)
ACPI_MUL_2 (acpi_gbl_integer_byte_width));
if (!return_desc) {
status = AE_NO_MEMORY;
......
......@@ -438,6 +438,13 @@ acpi_ex_get_name_string (
status = AE_AML_BAD_NAME;
}
if (ACPI_FAILURE (status)) {
if (name_string) {
ACPI_MEM_FREE (name_string);
}
return_ACPI_STATUS (status);
}
*out_name_string = name_string;
*out_name_length = (u32) (aml_address - in_aml_address);
......
......@@ -113,8 +113,9 @@ acpi_ex_opcode_0A_0T_1R (
status = AE_NO_MEMORY;
goto cleanup;
}
#if ACPI_MACHINE_WIDTH != 16
return_desc->integer.value = acpi_os_get_timer ();
#endif
break;
default: /* Unknown opcode */
......@@ -127,15 +128,16 @@ acpi_ex_opcode_0A_0T_1R (
cleanup:
if (!walk_state->result_obj) {
walk_state->result_obj = return_desc;
}
/* Delete return object on error */
if (ACPI_FAILURE (status)) {
if ((ACPI_FAILURE (status)) || walk_state->result_obj) {
acpi_ut_remove_reference (return_desc);
}
else {
/* Save the return value */
walk_state->result_obj = return_desc;
}
return_ACPI_STATUS (status);
}
......@@ -902,6 +904,7 @@ acpi_ex_opcode_1A_0T_1R (
*/
return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) operand[0]);
acpi_ut_add_reference (return_desc);
}
else {
/*
......@@ -951,20 +954,10 @@ acpi_ex_opcode_1A_0T_1R (
* add another reference to the referenced object, however.
*/
return_desc = *(operand[0]->reference.where);
if (!return_desc) {
/*
* We can't return a NULL dereferenced value. This is
* an uninitialized package element and is thus a
* severe error.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"NULL package element obj %p\n",
operand[0]));
status = AE_AML_UNINITIALIZED_ELEMENT;
goto cleanup;
if (return_desc) {
acpi_ut_add_reference (return_desc);
}
acpi_ut_add_reference (return_desc);
break;
......
......@@ -160,7 +160,7 @@ acpi_ex_opcode_3A_1T_1R (
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
char *buffer;
char *buffer = NULL;
acpi_status status = AE_OK;
acpi_integer index;
acpi_size length;
......@@ -193,34 +193,63 @@ acpi_ex_opcode_3A_1T_1R (
* If the index is beyond the length of the String/Buffer, or if the
* requested length is zero, return a zero-length String/Buffer
*/
if ((index < operand[0]->string.length) &&
(length > 0)) {
/* Truncate request if larger than the actual String/Buffer */
if ((index + length) >
operand[0]->string.length) {
length = (acpi_size) operand[0]->string.length -
(acpi_size) index;
}
if (index >= operand[0]->string.length) {
length = 0;
}
/* Truncate request if larger than the actual String/Buffer */
else if ((index + length) > operand[0]->string.length) {
length = (acpi_size) operand[0]->string.length -
(acpi_size) index;
}
/* Allocate a new buffer for the String/Buffer */
/* Strings always have a sub-pointer, not so for buffers */
switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
case ACPI_TYPE_STRING:
/* Always allocate a new buffer for the String */
buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1);
if (!buffer) {
status = AE_NO_MEMORY;
goto cleanup;
}
break;
case ACPI_TYPE_BUFFER:
/* If the requested length is zero, don't allocate a buffer */
if (length > 0) {
/* Allocate a new buffer for the Buffer */
buffer = ACPI_MEM_CALLOCATE (length);
if (!buffer) {
status = AE_NO_MEMORY;
goto cleanup;
}
}
break;
default: /* Should not happen */
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
if (length > 0) {
/* Copy the portion requested */
ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
length);
}
/* Set the length of the new String/Buffer */
/* Set the length of the new String/Buffer */
return_desc->string.pointer = buffer;
return_desc->string.length = (u32) length;
}
return_desc->string.pointer = buffer;
return_desc->string.length = (u32) length;
/* Mark buffer initialized */
......@@ -244,13 +273,13 @@ acpi_ex_opcode_3A_1T_1R (
/* Delete return object on error */
if (ACPI_FAILURE (status)) {
if (ACPI_FAILURE (status) || walk_state->result_obj) {
acpi_ut_remove_reference (return_desc);
}
/* Set the return object and exit */
if (!walk_state->result_obj) {
else {
walk_state->result_obj = return_desc;
}
return_ACPI_STATUS (status);
......
......@@ -426,6 +426,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
acpi_ut_remove_reference (obj_desc);
}
goto next_operand;
......@@ -448,6 +452,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
acpi_ut_remove_reference (obj_desc);
}
goto next_operand;
......@@ -471,6 +479,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
acpi_ut_remove_reference (obj_desc);
}
goto next_operand;
......@@ -515,6 +527,10 @@ acpi_ex_resolve_operands (
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
acpi_ut_remove_reference (obj_desc);
}
break;
default:
......
......@@ -147,7 +147,7 @@ acpi_ex_do_debug_object (
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
(u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
......@@ -574,7 +574,7 @@ acpi_ex_store_object_to_node (
/* If no implicit conversion, drop into the default case below */
if (!implicit_conversion) {
if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
/* Force execution of default (no implicit conversion) */
target_type = ACPI_TYPE_ANY;
......@@ -634,7 +634,7 @@ acpi_ex_store_object_to_node (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Storing %s (%p) directly into node (%p), no implicit conversion\n",
"Storing %s (%p) directly into node (%p) with no implicit conversion\n",
acpi_ut_get_object_type_name (source_desc), source_desc, node));
/* No conversions for all other types. Just attach the source object */
......
......@@ -265,10 +265,6 @@ acpi_ex_store_object_to_object (
case ACPI_TYPE_BUFFER:
/*
* Note: There is different store behavior depending on the original
* source type
*/
status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
break;
......
......@@ -369,7 +369,7 @@ acpi_ex_eisa_id_to_string (
*
* RETURN: None, string
*
* DESCRIPTOIN: Convert a number to string representation. Assumes string
* DESCRIPTION: Convert a number to string representation. Assumes string
* buffer is large enough to hold the string.
*
******************************************************************************/
......
......@@ -374,7 +374,7 @@ acpi_hw_enable_wakeup_gpe_block (
*
* FUNCTION: acpi_hw_disable_all_gpes
*
* PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
* PARAMETERS: None
*
* RETURN: Status
*
......@@ -384,7 +384,7 @@ acpi_hw_enable_wakeup_gpe_block (
acpi_status
acpi_hw_disable_all_gpes (
u32 flags)
void)
{
acpi_status status;
......@@ -392,8 +392,8 @@ acpi_hw_disable_all_gpes (
ACPI_FUNCTION_TRACE ("hw_disable_all_gpes");
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, flags);
status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, flags);
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
return_ACPI_STATUS (status);
}
......@@ -402,7 +402,7 @@ acpi_hw_disable_all_gpes (
*
* FUNCTION: acpi_hw_enable_all_runtime_gpes
*
* PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
* PARAMETERS: None
*
* RETURN: Status
*
......@@ -412,7 +412,7 @@ acpi_hw_disable_all_gpes (
acpi_status
acpi_hw_enable_all_runtime_gpes (
u32 flags)
void)
{
acpi_status status;
......@@ -420,7 +420,7 @@ acpi_hw_enable_all_runtime_gpes (
ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes");
status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block, flags);
status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block);
return_ACPI_STATUS (status);
}
......@@ -429,7 +429,7 @@ acpi_hw_enable_all_runtime_gpes (
*
* FUNCTION: acpi_hw_enable_all_wakeup_gpes
*
* PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
* PARAMETERS: None
*
* RETURN: Status
*
......@@ -439,7 +439,7 @@ acpi_hw_enable_all_runtime_gpes (
acpi_status
acpi_hw_enable_all_wakeup_gpes (
u32 flags)
void)
{
acpi_status status;
......@@ -447,7 +447,7 @@ acpi_hw_enable_all_wakeup_gpes (
ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes");
status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block, flags);
status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block);
return_ACPI_STATUS (status);
}
......@@ -106,7 +106,7 @@ acpi_hw_clear_acpi_status (
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, ACPI_ISR);
status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
unlock_and_exit:
if (flags & ACPI_MTX_LOCK) {
......
......@@ -274,13 +274,13 @@ acpi_enter_sleep_state (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
status = acpi_hw_disable_all_gpes (ACPI_ISR);
status = acpi_hw_disable_all_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_system_awake_and_running = FALSE;
status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
status = acpi_hw_enable_all_wakeup_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -424,13 +424,13 @@ acpi_enter_sleep_state_s4bios (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
status = acpi_hw_disable_all_gpes (ACPI_ISR);
status = acpi_hw_disable_all_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_system_awake_and_running = FALSE;
status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
status = acpi_hw_enable_all_wakeup_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -557,13 +557,13 @@ acpi_leave_sleep_state (
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
*/
status = acpi_hw_disable_all_gpes (ACPI_NOT_ISR);
status = acpi_hw_disable_all_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_system_awake_and_running = TRUE;
status = acpi_hw_enable_all_runtime_gpes (ACPI_NOT_ISR);
status = acpi_hw_enable_all_runtime_gpes ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......
......@@ -159,18 +159,19 @@ acpi_ns_root_initialize (
obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App)
#if defined (ACPI_ASL_COMPILER)
/*
* i_aSL Compiler cheats by putting parameter count
* in the owner_iD
*/
new_node->owner_id = obj_desc->method.param_count;
/* save the parameter count for the i_aSL compiler */
new_node->value = obj_desc->method.param_count;
#else
/* Mark this as a very SPECIAL method */
obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
#ifndef ACPI_DUMP_APP
obj_desc->method.implementation = acpi_ut_osi_implementation;
#endif
#endif
break;
......
......@@ -83,7 +83,7 @@ acpi_ns_create_node (
return_PTR (NULL);
}
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++);
node->name.integer = name;
node->reference_count = 1;
......@@ -151,7 +151,7 @@ acpi_ns_delete_node (
}
}
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
/*
* Detach an object if there is one then delete the node
......@@ -176,10 +176,9 @@ acpi_ns_delete_node (
* DESCRIPTION: Initialize a new namespace node and install it amongst
* its peers.
*
* Note: Current namespace lookup is linear search. However, the
* nodes are linked in alphabetical order to 1) put all reserved
* names (start with underscore) first, and to 2) make a readable
* namespace dump.
* Note: Current namespace lookup is linear search. This appears
* to be sufficient as namespace searches consume only a small
* fraction of the execution time of the ACPI subsystem.
*
******************************************************************************/
......@@ -190,12 +189,8 @@ acpi_ns_install_node (
struct acpi_namespace_node *node, /* New Child*/
acpi_object_type type)
{
u16 owner_id = 0;
acpi_owner_id owner_id = 0;
struct acpi_namespace_node *child_node;
#ifdef ACPI_ALPHABETIC_NAMESPACE
struct acpi_namespace_node *previous_child_node;
#endif
ACPI_FUNCTION_TRACE ("ns_install_node");
......@@ -219,57 +214,6 @@ acpi_ns_install_node (
node->peer = parent_node;
}
else {
#ifdef ACPI_ALPHABETIC_NAMESPACE
/*
* Walk the list whilst searching for the correct
* alphabetic placement.
*/
previous_child_node = NULL;
while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
acpi_ut_get_node_name (node)) < 0) {
if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* Last peer; Clear end-of-list flag */
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
/* This node is the new peer to the child node */
child_node->peer = node;
/* This node is the new end-of-list */
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
break;
}
/* Get next peer */
previous_child_node = child_node;
child_node = child_node->peer;
}
/* Did the node get inserted at the end-of-list? */
if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
/*
* Loop above terminated without reaching the end-of-list.
* Insert the new node at the current location
*/
if (previous_child_node) {
/* Insert node alphabetically */
node->peer = child_node;
previous_child_node->peer = node;
}
else {
/* Insert node alphabetically at start of list */
node->peer = child_node;
parent_node->child = node;
}
}
#else
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
}
......@@ -279,9 +223,8 @@ acpi_ns_install_node (
/* Clear end-of-list flag */
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
#endif
}
/* Init the new entry */
......@@ -362,7 +305,7 @@ acpi_ns_delete_children (
/* Now we can free this child object */
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
child_node, acpi_gbl_current_node_count));
......@@ -559,7 +502,7 @@ acpi_ns_remove_reference (
void
acpi_ns_delete_namespace_by_owner (
u16 owner_id)
acpi_owner_id owner_id)
{
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *deletion_node;
......@@ -570,6 +513,10 @@ acpi_ns_delete_namespace_by_owner (
ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
if (owner_id == 0) {
return_VOID;
}
parent_node = acpi_gbl_root_node;
child_node = NULL;
deletion_node = NULL;
......@@ -639,54 +586,3 @@ acpi_ns_delete_namespace_by_owner (
}
#ifdef ACPI_ALPHABETIC_NAMESPACE
/*******************************************************************************
*
* FUNCTION: acpi_ns_compare_names
*
* PARAMETERS: Name1 - First name to compare
* Name2 - Second name to compare
*
* RETURN: value from strncmp
*
* DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
* underscore are forced to be alphabetically first.
*
******************************************************************************/
int
acpi_ns_compare_names (
char *name1,
char *name2)
{
char reversed_name1[ACPI_NAME_SIZE];
char reversed_name2[ACPI_NAME_SIZE];
u32 i;
u32 j;
/*
* Replace all instances of "underscore" with a value that is smaller so
* that all names that are prefixed with underscore(s) are alphabetically
* first.
*
* Reverse the name bytewise so we can just do a 32-bit compare instead
* of a strncmp.
*/
for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
reversed_name1[j] = name1[i];
if (name1[i] == '_') {
reversed_name1[j] = '*';
}
reversed_name2[j] = name2[i];
if (name2[i] == '_') {
reversed_name2[j] = '*';
}
}
return (*(int *) reversed_name1 - *(int *) reversed_name2);
}
#endif
......@@ -85,6 +85,9 @@ acpi_ns_print_pathname (
u32 num_segments,
char *pathname)
{
acpi_native_uint i;
ACPI_FUNCTION_NAME ("ns_print_pathname");
......@@ -97,9 +100,13 @@ acpi_ns_print_pathname (
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
while (num_segments) {
acpi_os_printf ("%4.4s", pathname);
pathname += ACPI_NAME_SIZE;
for (i = 0; i < 4; i++) {
ACPI_IS_PRINT (pathname[i]) ?
acpi_os_printf ("%c", pathname[i]) :
acpi_os_printf ("?");
}
pathname += ACPI_NAME_SIZE;
num_segments--;
if (num_segments) {
acpi_os_printf (".");
......@@ -203,38 +210,42 @@ acpi_ns_dump_one_object (
/* Check if the owner matches */
if ((info->owner_id != ACPI_UINT32_MAX) &&
if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
(info->owner_id != this_node->owner_id)) {
return (AE_OK);
}
/* Indent the object according to the level */
if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
/* Indent the object according to the level */
acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
/* Check the node type and name */
/* Check the node type and name */
if (type > ACPI_TYPE_LOCAL_MAX) {
ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
}
if (type > ACPI_TYPE_LOCAL_MAX) {
ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
}
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
this_node->name.integer));
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
this_node->name.integer));
}
acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node));
}
/*
* Now we can print out the pertinent information
*/
acpi_os_printf ("%4.4s %-12s %p ",
acpi_ut_get_node_name (this_node), acpi_ut_get_type_name (type), this_node);
acpi_os_printf (" %-12s %p ",
acpi_ut_get_type_name (type), this_node);
dbg_level = acpi_dbg_level;
acpi_dbg_level = 0;
obj_desc = acpi_ns_get_attached_object (this_node);
acpi_dbg_level = dbg_level;
switch (info->display_type) {
switch (info->display_type & ACPI_DISPLAY_MASK) {
case ACPI_DISPLAY_SUMMARY:
if (!obj_desc) {
......@@ -475,7 +486,7 @@ acpi_ns_dump_one_object (
while (obj_desc) {
obj_type = ACPI_TYPE_INVALID;
acpi_os_printf (" Attached Object %p: ", obj_desc);
acpi_os_printf ("Attached Object %p: ", obj_desc);
/* Decode the type of attached object and dump the contents */
......@@ -484,9 +495,9 @@ acpi_ns_dump_one_object (
acpi_os_printf ("(Ptr to Node)\n");
bytes_to_dump = sizeof (struct acpi_namespace_node);
ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
break;
case ACPI_DESC_TYPE_OPERAND:
obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
......@@ -497,24 +508,19 @@ acpi_ns_dump_one_object (
bytes_to_dump = 32;
}
else {
acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n",
acpi_ut_get_type_name (obj_type), obj_type);
acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n",
obj_type, acpi_ut_get_type_name (obj_type));
bytes_to_dump = sizeof (union acpi_operand_object);
}
break;
ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
break;
default:
acpi_os_printf (
"(String or Buffer ptr - not an object descriptor) [%s]\n",
acpi_ut_get_descriptor_name (obj_desc));
bytes_to_dump = 16;
break;
}
ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
/* If value is NOT an internal object, we are done */
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
......@@ -525,13 +531,17 @@ acpi_ns_dump_one_object (
* Valid object, get the pointer to next level, if any
*/
switch (obj_type) {
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
/*
* NOTE: takes advantage of common fields between string/buffer
*/
bytes_to_dump = obj_desc->string.length;
obj_desc = (void *) obj_desc->string.pointer;
break;
case ACPI_TYPE_BUFFER:
obj_desc = (void *) obj_desc->buffer.pointer;
break;
acpi_os_printf ( "(Buffer/String pointer %p length %X)\n",
obj_desc, bytes_to_dump);
ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
goto cleanup;
case ACPI_TYPE_BUFFER_FIELD:
obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
......@@ -595,7 +605,7 @@ acpi_ns_dump_objects (
acpi_object_type type,
u8 display_type,
u32 max_depth,
u32 owner_id,
acpi_owner_id owner_id,
acpi_handle start_handle)
{
struct acpi_walk_info info;
......@@ -640,14 +650,14 @@ acpi_ns_dump_entry (
info.debug_level = debug_level;
info.owner_id = ACPI_UINT32_MAX;
info.owner_id = ACPI_OWNER_ID_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
(void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
}
#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_tables
......@@ -691,7 +701,7 @@ acpi_ns_dump_tables (
}
acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
ACPI_UINT32_MAX, search_handle);
ACPI_OWNER_ID_MAX, search_handle);
return_VOID;
}
#endif /* _ACPI_ASL_COMPILER */
......
......@@ -365,6 +365,7 @@ acpi_ns_evaluate_by_handle (
*
* PARAMETERS: Info - Method info block, contains:
* Node - Method Node to execute
* obj_desc - Method object
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
......@@ -387,7 +388,6 @@ acpi_ns_execute_control_method (
struct acpi_parameter_info *info)
{
acpi_status status;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE ("ns_execute_control_method");
......@@ -395,8 +395,8 @@ acpi_ns_execute_control_method (
/* Verify that there is a method associated with this object */
obj_desc = acpi_ns_get_attached_object (info->node);
if (!obj_desc) {
info->obj_desc = acpi_ns_get_attached_object (info->node);
if (!info->obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
......@@ -407,7 +407,7 @@ acpi_ns_execute_control_method (
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1));
/*
* Unlock the namespace before execution. This allows namespace access
......@@ -430,7 +430,7 @@ acpi_ns_execute_control_method (
return_ACPI_STATUS (status);
}
status = acpi_psx_execute (info);
status = acpi_ps_execute_method (info);
acpi_ex_exit_interpreter ();
return_ACPI_STATUS (status);
......
......@@ -198,7 +198,7 @@ acpi_ns_load_table_by_type (
switch (table_type) {
case ACPI_TABLE_DSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n"));
table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
......@@ -218,17 +218,18 @@ acpi_ns_load_table_by_type (
case ACPI_TABLE_SSDT:
case ACPI_TABLE_PSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
acpi_gbl_table_lists[ACPI_TABLE_SSDT].count));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
acpi_gbl_table_lists[table_type].count));
/*
* Traverse list of SSDT tables
* Traverse list of SSDT or PSDT tables
*/
table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next;
for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) {
table_desc = acpi_gbl_table_lists[table_type].next;
for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) {
/*
* Only attempt to load table if it is not
* Only attempt to load table into namespace if it is not
* already loaded!
*/
if (!table_desc->loaded_into_namespace) {
......@@ -245,33 +246,6 @@ acpi_ns_load_table_by_type (
break;
case ACPI_TABLE_PSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
acpi_gbl_table_lists[ACPI_TABLE_PSDT].count));
/*
* Traverse list of PSDT tables
*/
table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next;
for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) {
/* Only attempt to load table if it is not already loaded! */
if (!table_desc->loaded_into_namespace) {
status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
if (ACPI_FAILURE (status)) {
break;
}
table_desc->loaded_into_namespace = TRUE;
}
table_desc = table_desc->next;
}
break;
default:
status = AE_SUPPORT;
break;
......
......@@ -67,7 +67,7 @@
acpi_status
acpi_ns_one_complete_parse (
u32 pass_number,
u8 pass_number,
struct acpi_table_desc *table_desc)
{
union acpi_parse_object *parse_root;
......@@ -87,7 +87,7 @@ acpi_ns_one_complete_parse (
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (table_desc->table_id,
walk_state = acpi_ds_create_walk_state (table_desc->owner_id,
NULL, NULL, NULL);
if (!walk_state) {
acpi_ps_free_op (parse_root);
......@@ -146,6 +146,7 @@ acpi_ns_parse_table (
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
status = acpi_ns_one_complete_parse (1, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......@@ -160,6 +161,7 @@ acpi_ns_parse_table (
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
status = acpi_ns_one_complete_parse (2, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......
......@@ -782,54 +782,6 @@ acpi_os_delete_lock (
return_VOID;
}
/*
* Acquire a spinlock.
*
* handle is a pointer to the spinlock_t.
* flags is *not* the result of save_flags - it is an ACPI-specific flag variable
* that indicates whether we are at interrupt level.
*/
void
acpi_os_acquire_lock (
acpi_handle handle,
u32 flags)
{
ACPI_FUNCTION_TRACE ("os_acquire_lock");
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle,
((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
if (flags & ACPI_NOT_ISR)
ACPI_DISABLE_IRQS();
spin_lock((spinlock_t *)handle);
return_VOID;
}
/*
* Release a spinlock. See above.
*/
void
acpi_os_release_lock (
acpi_handle handle,
u32 flags)
{
ACPI_FUNCTION_TRACE ("os_release_lock");
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle,
((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
spin_unlock((spinlock_t *)handle);
if (flags & ACPI_NOT_ISR)
ACPI_ENABLE_IRQS();
return_VOID;
}
acpi_status
acpi_os_create_semaphore(
u32 max_units,
......@@ -1176,3 +1128,151 @@ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
EXPORT_SYMBOL(max_cstate);
/*
* Acquire a spinlock.
*
* handle is a pointer to the spinlock_t.
* flags is *not* the result of save_flags - it is an ACPI-specific flag variable
* that indicates whether we are at interrupt level.
*/
unsigned long
acpi_os_acquire_lock (
acpi_handle handle)
{
unsigned long flags;
spin_lock_irqsave((spinlock_t *)handle, flags);
return flags;
}
/*
* Release a spinlock. See above.
*/
void
acpi_os_release_lock (
acpi_handle handle,
unsigned long flags)
{
spin_unlock_irqrestore((spinlock_t *)handle, flags);
}
#ifndef ACPI_USE_LOCAL_CACHE
/*******************************************************************************
*
* FUNCTION: acpi_os_create_cache
*
* PARAMETERS: CacheName - Ascii name for the cache
* ObjectSize - Size of each cached object
* MaxDepth - Maximum depth of the cache (in objects)
* ReturnCache - Where the new cache object is returned
*
* RETURN: Status
*
* DESCRIPTION: Create a cache object
*
******************************************************************************/
acpi_status
acpi_os_create_cache (
char *name,
u16 size,
u16 depth,
acpi_cache_t **cache)
{
*cache = kmem_cache_create (name, size, 0, 0, NULL, NULL);
return AE_OK;
}
/*******************************************************************************
*
* FUNCTION: acpi_os_purge_cache
*
* PARAMETERS: Cache - Handle to cache object
*
* RETURN: Status
*
* DESCRIPTION: Free all objects within the requested cache.
*
******************************************************************************/
acpi_status
acpi_os_purge_cache (
acpi_cache_t *cache)
{
(void) kmem_cache_shrink(cache);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_os_delete_cache
*
* PARAMETERS: Cache - Handle to cache object
*
* RETURN: Status
*
* DESCRIPTION: Free all objects within the requested cache and delete the
* cache object.
*
******************************************************************************/
acpi_status
acpi_os_delete_cache (
acpi_cache_t *cache)
{
(void)kmem_cache_destroy(cache);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_os_release_object
*
* PARAMETERS: Cache - Handle to cache object
* Object - The object to be released
*
* RETURN: None
*
* DESCRIPTION: Release an object to the specified cache. If cache is full,
* the object is deleted.
*
******************************************************************************/
acpi_status
acpi_os_release_object (
acpi_cache_t *cache,
void *object)
{
kmem_cache_free(cache, object);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_os_acquire_object
*
* PARAMETERS: Cache - Handle to cache object
* ReturnObject - Where the object is returned
*
* RETURN: Status
*
* DESCRIPTION: Get an object from the specified cache. If cache is empty,
* the object is allocated.
*
******************************************************************************/
void *
acpi_os_acquire_object (
acpi_cache_t *cache)
{
void *object = kmem_cache_alloc(cache, GFP_KERNEL);
WARN_ON(!object);
return object;
}
#endif
......@@ -2,7 +2,7 @@
# Makefile for all Linux ACPI interpreter subdirectories
#
obj-y := psargs.o psparse.o pstree.o pswalk.o \
obj-y := psargs.o psparse.o psloop.o pstree.o pswalk.o \
psopcode.o psscope.o psutils.o psxface.o
EXTRA_CFLAGS += $(ACPI_CFLAGS)
This diff is collapsed.
......@@ -311,7 +311,7 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
......@@ -428,33 +428,23 @@ acpi_ps_get_opcode_info (
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
switch ((u8) (opcode >> 8)) {
case 0:
if (!(opcode & 0xFF00)) {
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
}
case AML_EXTOP:
/* Extended (16-bit, prefix+opcode) opcode */
if (((u8) opcode) <= MAX_EXTENDED_OPCODE) {
return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
}
/* Else fall through to error case below */
/*lint -fallthrough */
default:
if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
(((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
/* Valid extended (16-bit) opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown AML opcode [%4.4X]\n", opcode));
break;
return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
}
/* Unknown AML opcode */
/* Default is "unknown opcode" */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown AML opcode [%4.4X]\n", opcode));
return (&acpi_gbl_aml_op_info [_UNK]);
}
......
This diff is collapsed.
......@@ -154,12 +154,14 @@ acpi_ps_alloc_op (
if (flags == ACPI_PARSEOP_GENERIC) {
/* The generic op (default) is by far the most common (16 to 1) */
op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
op = acpi_os_acquire_object (acpi_gbl_ps_node_cache);
memset(op, 0, sizeof(struct acpi_parse_obj_common));
}
else {
/* Extended parseop */
op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache);
memset(op, 0, sizeof(struct acpi_parse_obj_named));
}
/* Initialize the Op */
......@@ -198,41 +200,14 @@ acpi_ps_free_op (
}
if (op->common.flags & ACPI_PARSEOP_GENERIC) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
(void) acpi_os_release_object (acpi_gbl_ps_node_cache, op);
}
else {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
(void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
}
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
* FUNCTION: acpi_ps_delete_parse_cache
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Free all objects that are on the parse cache list.
*
******************************************************************************/
void
acpi_ps_delete_parse_cache (
void)
{
ACPI_FUNCTION_TRACE ("ps_delete_parse_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT);
return_VOID;
}
#endif
/*******************************************************************************
*
* FUNCTION: Utility functions
......
......@@ -46,19 +46,30 @@
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psxface")
/* Local Prototypes */
static acpi_status
acpi_ps_execute_pass (
struct acpi_parameter_info *info);
static void
acpi_ps_update_parameter_list (
struct acpi_parameter_info *info,
u16 action);
/*******************************************************************************
*
* FUNCTION: acpi_psx_execute
* FUNCTION: acpi_ps_execute_method
*
* PARAMETERS: Info - Method info block, contains:
* Node - Method Node to execute
* obj_desc - Method object
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
......@@ -67,6 +78,7 @@
* parameter_type - Type of Parameter list
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* pass_number - Parse or execute pass
*
* RETURN: Status
*
......@@ -75,171 +87,194 @@
******************************************************************************/
acpi_status
acpi_psx_execute (
acpi_ps_execute_method (
struct acpi_parameter_info *info)
{
acpi_status status;
union acpi_operand_object *obj_desc;
u32 i;
union acpi_parse_object *op;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE ("psx_execute");
ACPI_FUNCTION_TRACE ("ps_execute_method");
/* Validate the Node and get the attached object */
/* Validate the Info and method Node */
if (!info || !info->node) {
return_ACPI_STATUS (AE_NULL_ENTRY);
}
obj_desc = acpi_ns_get_attached_object (info->node);
if (!obj_desc) {
return_ACPI_STATUS (AE_NULL_OBJECT);
}
/* Init for new method, wait on concurrency semaphore */
status = acpi_ds_begin_method_execution (info->node, obj_desc, NULL);
status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
if ((info->parameter_type == ACPI_PARAM_ARGS) &&
(info->parameters)) {
/*
* The caller "owns" the parameters, so give each one an extra
* reference
*/
for (i = 0; info->parameters[i]; i++) {
acpi_ut_add_reference (info->parameters[i]);
}
}
/*
* 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Parse **** Entry=%p obj=%p\n",
info->node, obj_desc));
/* Create and init a Root Node */
op = acpi_ps_create_scope_op ();
if (!op) {
status = AE_NO_MEMORY;
goto cleanup1;
}
/*
* Get a new owner_id for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
NULL, NULL, NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup2;
}
status = acpi_ds_init_aml_walk (walk_state, op, info->node,
obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, 1);
status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
goto cleanup3;
return_ACPI_STATUS (status);
}
/* Parse the AML */
/*
* The caller "owns" the parameters, so give each one an extra
* reference
*/
acpi_ps_update_parameter_list (info, REF_INCREMENT);
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
/*
* 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Parse **** Entry=%p obj=%p\n",
info->node, info->obj_desc));
info->pass_number = 1;
status = acpi_ps_execute_pass (info);
if (ACPI_FAILURE (status)) {
goto cleanup1; /* Walk state is already deleted */
goto cleanup;
}
/*
* 2) Execute the method. Performs second pass parse simultaneously
* 2) Execute the method. Performs second pass parse simultaneously
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Execution **** Entry=%p obj=%p\n",
info->node, obj_desc));
info->node, info->obj_desc));
/* Create and init a Root Node */
info->pass_number = 3;
status = acpi_ps_execute_pass (info);
op = acpi_ps_create_scope_op ();
if (!op) {
status = AE_NO_MEMORY;
goto cleanup1;
cleanup:
if (info->obj_desc->method.owner_id) {
acpi_ut_release_owner_id (&info->obj_desc->method.owner_id);
}
/* Init new op with the method name and pointer back to the NS node */
/* Take away the extra reference that we gave the parameters above */
acpi_ps_set_name (op, info->node->name.integer);
op->common.node = info->node;
acpi_ps_update_parameter_list (info, REF_DECREMENT);
/* Create and initialize a new walk state */
/* Exit now if error above */
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup2;
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ds_init_aml_walk (walk_state, op, info->node,
obj_desc->method.aml_start,
obj_desc->method.aml_length, info, 3);
if (ACPI_FAILURE (status)) {
goto cleanup3;
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
*/
if (info->return_object) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
info->return_object));
ACPI_DUMP_STACK_ENTRY (info->return_object);
status = AE_CTRL_RETURN_VALUE;
}
/* The walk of the parse tree is where we actually execute the method */
return_ACPI_STATUS (status);
}
status = acpi_ps_parse_aml (walk_state);
goto cleanup2; /* Walk state already deleted */
/*******************************************************************************
*
* FUNCTION: acpi_ps_update_parameter_list
*
* PARAMETERS: Info - See struct acpi_parameter_info
* (Used: parameter_type and Parameters)
* Action - Add or Remove reference
*
* RETURN: Status
*
* DESCRIPTION: Update reference count on all method parameter objects
*
******************************************************************************/
cleanup3:
acpi_ds_delete_walk_state (walk_state);
static void
acpi_ps_update_parameter_list (
struct acpi_parameter_info *info,
u16 action)
{
acpi_native_uint i;
cleanup2:
acpi_ps_delete_parse_tree (op);
cleanup1:
if ((info->parameter_type == ACPI_PARAM_ARGS) &&
(info->parameters)) {
/* Take away the extra reference that we gave the parameters above */
/* Update reference count for each parameter */
for (i = 0; info->parameters[i]; i++) {
/* Ignore errors, just do them all */
(void) acpi_ut_update_object_reference (
info->parameters[i], REF_DECREMENT);
(void) acpi_ut_update_object_reference (info->parameters[i], action);
}
}
}
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
/*******************************************************************************
*
* FUNCTION: acpi_ps_execute_pass
*
* PARAMETERS: Info - See struct acpi_parameter_info
* (Used: pass_number, Node, and obj_desc)
*
* RETURN: Status
*
* DESCRIPTION: Single AML pass: Parse or Execute a control method
*
******************************************************************************/
static acpi_status
acpi_ps_execute_pass (
struct acpi_parameter_info *info)
{
acpi_status status;
union acpi_parse_object *op;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE ("ps_execute_pass");
/* Create and init a Root Node */
op = acpi_ps_create_scope_op ();
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
*/
if (info->return_object) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
info->return_object));
ACPI_DUMP_STACK_ENTRY (info->return_object);
/* Create and initialize a new walk state */
status = AE_CTRL_RETURN_VALUE;
walk_state = acpi_ds_create_walk_state (
info->obj_desc->method.owner_id, NULL, NULL, NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup;
}
status = acpi_ds_init_aml_walk (walk_state, op, info->node,
info->obj_desc->method.aml_start,
info->obj_desc->method.aml_length,
info->pass_number == 1 ? NULL : info,
info->pass_number);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
goto cleanup;
}
/* Parse the AML */
status = acpi_ps_parse_aml (walk_state);
/* Walk state was deleted by parse_aml */
cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
......
......@@ -48,6 +48,9 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsdump")
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */
static void
......@@ -103,7 +106,6 @@ acpi_rs_dump_vendor_specific (
union acpi_resource_data *data);
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_irq
......
......@@ -97,7 +97,9 @@ acpi_tb_get_table_count (
ACPI_FUNCTION_ENTRY ();
if (RSDP->revision < 2) {
/* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
pointer_size = sizeof (u32);
}
else {
......@@ -158,7 +160,9 @@ acpi_tb_convert_to_xsdt (
/* Copy the table pointers */
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
if (acpi_gbl_RSDP->revision < 2) {
/* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
(ACPI_CAST_PTR (struct rsdt_descriptor_rev1,
table_info->pointer))->table_offset_entry[i]);
......
......@@ -124,9 +124,7 @@ acpi_tb_match_signature (
*
* RETURN: Status
*
* DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must
* already be loaded and validated.
* Install the table into the global data structs.
* DESCRIPTION: Install the table into the global data structures.
*
******************************************************************************/
......@@ -136,6 +134,7 @@ acpi_tb_install_table (
{
acpi_status status;
ACPI_FUNCTION_TRACE ("tb_install_table");
......@@ -143,22 +142,33 @@ acpi_tb_install_table (
status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
table_info->pointer->signature, acpi_format_exception (status)));
ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
/*
* Ignore a table that is already installed. For example, some BIOS
* ASL code will repeatedly attempt to load the same SSDT.
*/
status = acpi_tb_is_table_installed (table_info);
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
/* Install the table into the global data structure */
status = acpi_tb_init_table_descriptor (table_info->type, table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n",
ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n",
table_info->pointer->signature, acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
acpi_gbl_table_data[table_info->type].name, table_info->pointer));
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (status);
}
......@@ -251,6 +261,7 @@ acpi_tb_init_table_descriptor (
{
struct acpi_table_list *list_head;
struct acpi_table_desc *table_desc;
acpi_status status;
ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
......@@ -263,6 +274,13 @@ acpi_tb_init_table_descriptor (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Get a new owner ID for the table */
status = acpi_ut_allocate_owner_id (&table_desc->owner_id);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Install the table into the global data structure */
list_head = &acpi_gbl_table_lists[table_type];
......@@ -325,8 +343,6 @@ acpi_tb_init_table_descriptor (
table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
table_desc->aml_length = (u32) (table_desc->length -
(u32) sizeof (struct acpi_table_header));
table_desc->table_id = acpi_ut_allocate_owner_id (
ACPI_OWNER_TYPE_TABLE);
table_desc->loaded_into_namespace = FALSE;
/*
......@@ -339,7 +355,7 @@ acpi_tb_init_table_descriptor (
/* Return Data */
table_info->table_id = table_desc->table_id;
table_info->owner_id = table_desc->owner_id;
table_info->installed_desc = table_desc;
return_ACPI_STATUS (AE_OK);
......
......@@ -96,32 +96,13 @@ acpi_tb_verify_rsdp (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* The signature and checksum must both be correct
*/
if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
/* Nope, BAD Signature */
status = AE_BAD_SIGNATURE;
goto cleanup;
}
/* Check the standard checksum */
/* Verify RSDP signature and checksum */
if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
status = AE_BAD_CHECKSUM;
status = acpi_tb_validate_rsdp (rsdp);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
/* Check extended checksum if table version >= 2 */
if (rsdp->revision >= 2) {
if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
status = AE_BAD_CHECKSUM;
goto cleanup;
}
}
/* The RSDP supplied is OK */
table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp);
......@@ -159,8 +140,8 @@ acpi_tb_verify_rsdp (
*
* RETURN: None, Address
*
* DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
* version of the RSDP
* DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the
* version of the RSDP and whether the XSDT pointer is valid
*
******************************************************************************/
......@@ -174,16 +155,19 @@ acpi_tb_get_rsdt_address (
out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
/*
* For RSDP revision 0 or 1, we use the RSDT.
* For RSDP revision 2 (and above), we use the XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
}
else {
/* Use XSDT if it is present */
if ((acpi_gbl_RSDP->revision >= 2) &&
acpi_gbl_RSDP->xsdt_physical_address) {
out_address->pointer.value =
acpi_gbl_RSDP->xsdt_physical_address;
acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT;
}
else {
/* No XSDT, use the RSDT */
out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT;
}
}
......@@ -211,10 +195,9 @@ acpi_tb_validate_rsdt (
/*
* For RSDP revision 0 or 1, we use the RSDT.
* For RSDP revision 2 and above, we use the XSDT
* Search for appropriate signature, RSDT or XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG,
sizeof (RSDT_SIG) -1);
}
......@@ -236,11 +219,11 @@ acpi_tb_validate_rsdt (
acpi_gbl_RSDP->rsdt_physical_address,
(void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address));
if (acpi_gbl_RSDP->revision < 2) {
ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n"))
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
ACPI_REPORT_ERROR (("Looking for RSDT\n"))
}
else {
ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n"))
ACPI_REPORT_ERROR (("Looking for XSDT\n"))
}
ACPI_DUMP_BUFFER ((char *) table_ptr, 48);
......
......@@ -59,6 +59,67 @@ acpi_tb_handle_to_object (
#endif
/*******************************************************************************
*
* FUNCTION: acpi_tb_is_table_installed
*
* PARAMETERS: new_table_desc - Descriptor for new table being installed
*
* RETURN: Status - AE_ALREADY_EXISTS if the table is already installed
*
* DESCRIPTION: Determine if an ACPI table is already installed
*
* MUTEX: Table data structures should be locked
*
******************************************************************************/
acpi_status
acpi_tb_is_table_installed (
struct acpi_table_desc *new_table_desc)
{
struct acpi_table_desc *table_desc;
ACPI_FUNCTION_TRACE ("tb_is_table_installed");
/* Get the list descriptor and first table descriptor */
table_desc = acpi_gbl_table_lists[new_table_desc->type].next;
/* Examine all installed tables of this type */
while (table_desc) {
/* Compare Revision and oem_table_id */
if ((table_desc->loaded_into_namespace) &&
(table_desc->pointer->revision ==
new_table_desc->pointer->revision) &&
(!ACPI_MEMCMP (table_desc->pointer->oem_table_id,
new_table_desc->pointer->oem_table_id, 8))) {
/* This table is already installed */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n",
new_table_desc->pointer->signature,
new_table_desc->pointer->revision,
new_table_desc->pointer->oem_table_id));
new_table_desc->owner_id = table_desc->owner_id;
new_table_desc->installed_desc = table_desc;
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
/* Get next table on the list */
table_desc = table_desc->next;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_validate_table_header
......@@ -157,7 +218,7 @@ acpi_tb_verify_table_checksum (
/* Compute the checksum on the table */
checksum = acpi_tb_checksum (table_header, table_header->length);
checksum = acpi_tb_generate_checksum (table_header, table_header->length);
/* Return the appropriate exception */
......@@ -175,7 +236,7 @@ acpi_tb_verify_table_checksum (
/*******************************************************************************
*
* FUNCTION: acpi_tb_checksum
* FUNCTION: acpi_tb_generate_checksum
*
* PARAMETERS: Buffer - Buffer to checksum
* Length - Size of the buffer
......@@ -187,7 +248,7 @@ acpi_tb_verify_table_checksum (
******************************************************************************/
u8
acpi_tb_checksum (
acpi_tb_generate_checksum (
void *buffer,
u32 length)
{
......
......@@ -182,10 +182,23 @@ acpi_load_table (
return_ACPI_STATUS (status);
}
/* Check signature for a valid table type */
status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Install the new table into the local data structures */
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
if (status == AE_ALREADY_EXISTS) {
/* Table already exists, no error */
status = AE_OK;
}
/* Free table allocated by acpi_tb_get_table_body */
acpi_tb_delete_single_table (&table_info);
......@@ -260,8 +273,8 @@ acpi_unload_table (
* "Scope" operator. Thus, we need to track ownership by an ID, not
* simply a position within the hierarchy
*/
acpi_ns_delete_namespace_by_owner (table_desc->table_id);
acpi_ns_delete_namespace_by_owner (table_desc->owner_id);
acpi_ut_release_owner_id (&table_desc->owner_id);
table_desc = table_desc->next;
}
......
This diff is collapsed.
......@@ -3,6 +3,6 @@
#
obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
utcopy.o utdelete.o utglobal.o utmath.o utobject.o
utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o
EXTRA_CFLAGS += $(ACPI_CFLAGS)
This diff is collapsed.
This diff is collapsed.
......@@ -694,58 +694,50 @@ acpi_ut_copy_simple_object (
dest_desc->common.reference_count = reference_count;
dest_desc->common.next_object = next_object;
/* New object is not static, regardless of source */
dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
/* Handle the objects with extra data */
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case ACPI_TYPE_BUFFER:
dest_desc->buffer.node = NULL;
dest_desc->common.flags = source_desc->common.flags;
/*
* Allocate and copy the actual buffer if and only if:
* 1) There is a valid buffer pointer
* 2) The buffer is not static (not in an ACPI table) (in this case,
* the actual pointer was already copied above)
* 2) The buffer has a length > 0
*/
if ((source_desc->buffer.pointer) &&
(!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
dest_desc->buffer.pointer = NULL;
/* Create an actual buffer only if length > 0 */
if (source_desc->buffer.length) {
dest_desc->buffer.pointer =
ACPI_MEM_ALLOCATE (source_desc->buffer.length);
if (!dest_desc->buffer.pointer) {
return (AE_NO_MEMORY);
}
(source_desc->buffer.length)) {
dest_desc->buffer.pointer =
ACPI_MEM_ALLOCATE (source_desc->buffer.length);
if (!dest_desc->buffer.pointer) {
return (AE_NO_MEMORY);
}
/* Copy the actual buffer data */
/* Copy the actual buffer data */
ACPI_MEMCPY (dest_desc->buffer.pointer,
source_desc->buffer.pointer,
source_desc->buffer.length);
}
ACPI_MEMCPY (dest_desc->buffer.pointer,
source_desc->buffer.pointer,
source_desc->buffer.length);
}
break;
case ACPI_TYPE_STRING:
/*
* Allocate and copy the actual string if and only if:
* 1) There is a valid string pointer
* 2) The string is not static (not in an ACPI table) (in this case,
* the actual pointer was already copied above)
* (Pointer to a NULL string is allowed)
*/
if ((source_desc->string.pointer) &&
(!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
if (source_desc->string.pointer) {
dest_desc->string.pointer =
ACPI_MEM_ALLOCATE ((acpi_size) source_desc->string.length + 1);
if (!dest_desc->string.pointer) {
return (AE_NO_MEMORY);
}
/* Copy the actual string data */
ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer,
(acpi_size) source_desc->string.length + 1);
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -264,7 +264,7 @@ acpi_ut_subsystem_shutdown (
/* Purge the local caches */
(void) acpi_purge_cached_objects ();
(void) acpi_ut_delete_caches ();
/* Debug only - display leftover memory allocation, if any */
......
This diff is collapsed.
This diff is collapsed.
......@@ -338,7 +338,7 @@ acpi_ut_allocate_object_desc_dbg (
ACPI_FUNCTION_TRACE ("ut_allocate_object_desc_dbg");
object = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_OPERAND);
object = acpi_os_acquire_object (acpi_gbl_operand_cache);
if (!object) {
_ACPI_REPORT_ERROR (module_name, line_number, component_id,
("Could not allocate an object descriptor\n"));
......@@ -347,7 +347,7 @@ acpi_ut_allocate_object_desc_dbg (
}
/* Mark the descriptor type */
memset(object, 0, sizeof(union acpi_operand_object));
ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
......@@ -385,37 +385,9 @@ acpi_ut_delete_object_desc (
return_VOID;
}
acpi_ut_release_to_cache (ACPI_MEM_LIST_OPERAND, object);
return_VOID;
}
#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
* FUNCTION: acpi_ut_delete_object_cache
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination.
*
******************************************************************************/
void
acpi_ut_delete_object_cache (
void)
{
ACPI_FUNCTION_TRACE ("ut_delete_object_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
(void) acpi_os_release_object (acpi_gbl_operand_cache, object);
return_VOID;
}
#endif
/*******************************************************************************
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -199,7 +199,7 @@ struct acpi_object_method
ACPI_INTERNAL_METHOD implementation;
u8 concurrency;
u8 thread_count;
acpi_owner_id owning_id;
acpi_owner_id owner_id;
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment