Commit 419a57d5 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] ACPICA 20040922 from Bob Moore

Signed-off-by: default avatarLen Brown <len.brown@intel.com>

Fixed a problem with the implementation of the LNot()
operator where "Ones" was not returned for the TRUE
case. Changed the code to return Ones instead of (!Arg)
which was usually 1. This change affects iASL constant
folding for this operator also.

Fixed a problem in acpi_ut_initialize_buffer where an
existing buffer was not initialized properly -- Now zero
the entire buffer in this case where the buffer already
exists.

Changed the interface to acpi_os_sleep from (UINT32
Seconds, UINT32 Milliseconds) to simply (ACPI_INTEGER
Milliseconds). This simplifies all related code
considerably. This requires changes/updates to all OS
interface layers (OSLs.)

Implemented a new external interface,
acpi_install_exception_handler, to allow a system exception
handler to be installed. This handler is invoked upon
any run-time exception that occurs during control method
execution.

Added support for the DSDT in acpi_tb_find_table. This
allows the DataTableRegion() operator to access the local
copy of the DSDT.
parent 8d7b2d68
......@@ -650,6 +650,17 @@ acpi_ds_exec_end_op (
cleanup:
/* Invoke exception handler on error */
if (ACPI_FAILURE (status) &&
acpi_gbl_exception_handler &&
!(status & AE_CODE_CONTROL)) {
acpi_ex_exit_interpreter ();
status = acpi_gbl_exception_handler (status);
acpi_ex_enter_interpreter ();
}
if (walk_state->result_obj) {
/* Break to debugger to display result */
......
......@@ -51,6 +51,51 @@
ACPI_MODULE_NAME ("evxface")
/*******************************************************************************
*
* FUNCTION: acpi_install_exception_handler
*
* PARAMETERS: Handler - Pointer to the handler function for the
* event
*
* RETURN: Status
*
* DESCRIPTION: Saves the pointer to the handler function
*
******************************************************************************/
acpi_status
acpi_install_exception_handler (
acpi_exception_handler handler)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("acpi_install_exception_handler");
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Don't allow two handlers. */
if (acpi_gbl_exception_handler) {
status = AE_ALREADY_EXISTS;
goto cleanup;
}
/* Install the handler */
acpi_gbl_exception_handler = handler;
cleanup:
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_install_fixed_event_handler
......
This diff is collapsed.
......@@ -124,7 +124,7 @@ acpi_ex_opcode_1A_0T_0R (
case AML_SLEEP_OP: /* Sleep (msec_time) */
status = acpi_ex_system_do_suspend ((u32) operand[0]->integer.value);
status = acpi_ex_system_do_suspend (operand[0]->integer.value);
break;
......@@ -543,7 +543,13 @@ acpi_ex_opcode_1A_0T_1R (
goto cleanup;
}
return_desc->integer.value = !operand[0]->integer.value;
/*
* Set result to ONES (TRUE) if Value == 0. Note:
* return_desc->Integer.Value is initially == 0 (FALSE) from above.
*/
if (!operand[0]->integer.value) {
return_desc->integer.value = ACPI_INTEGER_MAX;
}
break;
......
......@@ -185,20 +185,26 @@ acpi_ex_store (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
acpi_ut_get_object_type_name (source_desc)));
acpi_ut_get_object_type_name (source_desc)));
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
if (acpi_gbl_integer_byte_width == 4) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
(u32) source_desc->integer.value));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (source_desc->integer.value)));
}
break;
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X",
(u32) source_desc->buffer.length));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
(u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
break;
......@@ -206,22 +212,22 @@ acpi_ex_store (
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X, \"%s\"\n",
source_desc->string.length, source_desc->string.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
source_desc->string.length, source_desc->string.pointer));
break;
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Size 0x%.2X Elements Ptr - %p\n",
source_desc->package.count, source_desc->package.elements));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
source_desc->package.count, source_desc->package.elements));
break;
default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
source_desc));
source_desc));
break;
}
......
......@@ -167,7 +167,7 @@ acpi_ex_system_do_stall (
acpi_status
acpi_ex_system_do_suspend (
u32 how_long)
acpi_integer how_long)
{
acpi_status status;
......@@ -179,8 +179,7 @@ acpi_ex_system_do_suspend (
acpi_ex_exit_interpreter ();
acpi_os_sleep ((u16) (how_long / (u32) 1000),
(u16) (how_long % (u32) 1000));
acpi_os_sleep (how_long);
/* And now we must get the interpreter again */
......
......@@ -161,8 +161,10 @@ acpi_ns_root_initialize (void)
#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App)
/* i_aSL Compiler cheats by putting parameter count in the owner_iD */
/*
* i_aSL Compiler cheats by putting parameter count
* in the owner_iD
*/
new_node->owner_id = obj_desc->method.param_count;
#else
/* Mark this as a very SPECIAL method */
......@@ -236,7 +238,8 @@ acpi_ns_root_initialize (void)
/* Store pointer to value descriptor in the Node */
status = acpi_ns_attach_object (new_node, obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc));
status = acpi_ns_attach_object (new_node, obj_desc,
ACPI_GET_OBJECT_TYPE (obj_desc));
/* Remove local reference to the object */
......@@ -462,7 +465,8 @@ acpi_ns_lookup (
type = this_node->type;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Prefix-only Pathname (Zero name segments), Flags=%X\n", flags));
"Prefix-only Pathname (Zero name segments), Flags=%X\n",
flags));
break;
case AML_DUAL_NAME_PREFIX:
......@@ -554,7 +558,7 @@ acpi_ns_lookup (
/* Try to find the single (4 character) ACPI name */
status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
interpreter_mode, this_search_type, local_flags, &this_node);
interpreter_mode, this_search_type, local_flags, &this_node);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
/* Name not found in ACPI namespace */
......
......@@ -198,7 +198,8 @@ acpi_ns_dump_one_object (
}
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name.integer));
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
this_node->name.integer));
}
/*
......@@ -226,9 +227,8 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_PROCESSOR:
acpi_os_printf ("ID %X Len %.4X Addr %p\n",
obj_desc->processor.proc_id,
obj_desc->processor.length,
(char *) obj_desc->processor.address);
obj_desc->processor.proc_id, obj_desc->processor.length,
(char *) obj_desc->processor.address);
break;
......@@ -241,16 +241,15 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_METHOD:
acpi_os_printf ("Args %X Len %.4X Aml %p\n",
(u32) obj_desc->method.param_count,
obj_desc->method.aml_length,
obj_desc->method.aml_start);
(u32) obj_desc->method.param_count,
obj_desc->method.aml_length, obj_desc->method.aml_start);
break;
case ACPI_TYPE_INTEGER:
acpi_os_printf ("= %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
break;
......@@ -258,7 +257,7 @@ acpi_ns_dump_one_object (
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf ("Elements %.2X\n",
obj_desc->package.count);
obj_desc->package.count);
}
else {
acpi_os_printf ("[Length not yet evaluated]\n");
......@@ -298,11 +297,12 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_REGION:
acpi_os_printf ("[%s]", acpi_ut_get_region_name (obj_desc->region.space_id));
acpi_os_printf ("[%s]",
acpi_ut_get_region_name (obj_desc->region.space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
ACPI_FORMAT_UINT64 (obj_desc->region.address),
obj_desc->region.length);
ACPI_FORMAT_UINT64 (obj_desc->region.address),
obj_desc->region.length);
}
else {
acpi_os_printf (" [Address/Length not yet evaluated]\n");
......@@ -313,7 +313,7 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf ("[%s]\n",
acpi_ps_get_opcode_name (obj_desc->reference.opcode));
acpi_ps_get_opcode_name (obj_desc->reference.opcode));
break;
......@@ -322,7 +322,7 @@ acpi_ns_dump_one_object (
if (obj_desc->buffer_field.buffer_obj &&
obj_desc->buffer_field.buffer_obj->buffer.node) {
acpi_os_printf ("Buf [%4.4s]",
acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node));
acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node));
}
break;
......@@ -330,30 +330,31 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf ("Rgn [%4.4s]",
acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node));
acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node));
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]",
acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node),
acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node),
acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]",
acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node),
acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node),
acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
break;
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
acpi_os_printf ("Target %4.4s (%p)\n", acpi_ut_get_node_name (obj_desc), obj_desc);
acpi_os_printf ("Target %4.4s (%p)\n",
acpi_ut_get_node_name (obj_desc), obj_desc);
break;
default:
......@@ -371,10 +372,10 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n",
(obj_desc->common_field.base_byte_offset * 8)
+ obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.bit_length,
obj_desc->common_field.access_byte_width);
(obj_desc->common_field.base_byte_offset * 8)
+ obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.bit_length,
obj_desc->common_field.access_byte_width);
break;
default:
......@@ -471,12 +472,13 @@ acpi_ns_dump_one_object (
obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
if (obj_type > ACPI_TYPE_LOCAL_MAX) {
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type);
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
obj_type);
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_ut_get_type_name (obj_type), obj_type);
bytes_to_dump = sizeof (union acpi_operand_object);
}
break;
......@@ -484,8 +486,9 @@ acpi_ns_dump_one_object (
default:
acpi_os_printf ("(String or Buffer ptr - not an object descriptor) [%s]\n",
acpi_ut_get_descriptor_name (obj_desc));
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;
}
......@@ -552,7 +555,7 @@ acpi_ns_dump_one_object (
* FUNCTION: acpi_ns_dump_objects
*
* PARAMETERS: Type - Object type to be dumped
* max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
* max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
* for an effectively unlimited depth.
* owner_id - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners.
......
......@@ -91,10 +91,10 @@ acpi_ns_dump_one_device (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
info->hardware_id.value,
ACPI_FORMAT_UINT64 (info->address),
info->current_status));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
" HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
info->current_status));
ACPI_MEM_FREE (info);
}
......@@ -133,7 +133,8 @@ acpi_ns_dump_root_devices (void)
return;
}
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Display of all devices in the namespace:\n"));
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
......
......@@ -57,14 +57,9 @@
*
* FUNCTION: acpi_ns_evaluate_relative
*
* PARAMETERS: Handle - The relative containing object
* Pathname - Name of method to execute, If NULL, the
* PARAMETERS: Pathname - Name of method to execute, If NULL, the
* handle is the object to execute
* Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* Info - Method info block
*
* RETURN: Status
*
......@@ -138,8 +133,7 @@ acpi_ns_evaluate_relative (
}
/*
* Now that we have a handle to the object, we can attempt
* to evaluate it.
* Now that we have a handle to the object, we can attempt to evaluate it.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, node, acpi_ns_get_attached_object (node)));
......@@ -165,9 +159,9 @@ acpi_ns_evaluate_relative (
*
* PARAMETERS: Pathname - Fully qualified pathname to the object
* Info - Contains:
* return_object - Where to put method's return value (if
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* Params - List of parameters to pass to the method,
* Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
*
......@@ -213,14 +207,14 @@ acpi_ns_evaluate_by_name (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Object at [%s] was not found, status=%.4X\n",
pathname, status));
goto cleanup;
}
/*
* Now that we have a handle to the object, we can attempt
* to evaluate it.
* Now that we have a handle to the object, we can attempt to evaluate it.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, info->node, acpi_ns_get_attached_object (info->node)));
......@@ -303,9 +297,8 @@ acpi_ns_evaluate_by_handle (
}
/*
* For a method alias, we must grab the actual method node
* so that proper scoping context will be established
* before execution.
* For a method alias, we must grab the actual method node so that proper
* scoping context will be established before execution.
*/
if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object);
......@@ -314,11 +307,9 @@ acpi_ns_evaluate_by_handle (
/*
* Two major cases here:
* 1) The object is an actual control method -- execute it.
* 2) The object is not a method -- just return it's current
* value
* 2) The object is not a method -- just return it's current value
*
* In both cases, the namespace is unlocked by the
* acpi_ns* procedure
* In both cases, the namespace is unlocked by the acpi_ns* procedure
*/
if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) {
/*
......@@ -328,15 +319,13 @@ acpi_ns_evaluate_by_handle (
}
else {
/*
* Case 2) Object is NOT a method, just return its
* current value
* Case 2) Object is NOT a method, just return its current value
*/
status = acpi_ns_get_object_value (info);
}
/*
* Check if there is a return value on the stack that must
* be dealt with
* Check if there is a return value on the stack that must be dealt with
*/
if (status == AE_CTRL_RETURN_VALUE) {
/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
......@@ -345,8 +334,8 @@ acpi_ns_evaluate_by_handle (
}
/*
* Namespace was unlocked by the handling acpi_ns* function,
* so we just return
* Namespace was unlocked by the handling acpi_ns* function, so we
* just return
*/
return_ACPI_STATUS (status);
}
......@@ -356,12 +345,7 @@ acpi_ns_evaluate_by_handle (
*
* FUNCTION: acpi_ns_execute_control_method
*
* PARAMETERS: method_node - The method to execute
* Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* return_obj_desc - List of result objects to be returned
* from the method.
* PARAMETERS: Info - Method info block (w/params)
*
* RETURN: Status
*
......@@ -430,8 +414,7 @@ acpi_ns_execute_control_method (
*
* FUNCTION: acpi_ns_get_object_value
*
* PARAMETERS: Node - The object
* return_obj_desc - Where the objects value is returned
* PARAMETERS: Info - Method info block (w/params)
*
* RETURN: Status
*
......@@ -453,28 +436,25 @@ acpi_ns_get_object_value (
/*
* Objects require additional resolution steps (e.g., the
* Node may be a field that must be read, etc.) -- we can't just grab
* the object out of the node.
* Objects require additional resolution steps (e.g., the Node may be a
* field that must be read, etc.) -- we can't just grab the object out of
* the node.
*/
/*
* Use resolve_node_to_value() to get the associated value. This call
* always deletes obj_desc (allocated above).
* Use resolve_node_to_value() to get the associated value. This call always
* deletes obj_desc (allocated above).
*
* NOTE: we can get away with passing in NULL for a walk state
* because obj_desc is guaranteed to not be a reference to either
* a method local or a method argument (because this interface can only be
* called from the acpi_evaluate external interface, never called from
* a running control method.)
* NOTE: we can get away with passing in NULL for a walk state because
* obj_desc is guaranteed to not be a reference to either a method local or
* a method argument (because this interface can only be called from the
* acpi_evaluate external interface, never called from a running method.)
*
* Even though we do not directly invoke the interpreter
* for this, we must enter it because we could access an opregion.
* The opregion access code assumes that the interpreter
* is locked.
* Even though we do not directly invoke the interpreter for this, we must
* enter it because we could access an opregion. The opregion access code
* assumes that the interpreter is locked.
*
* We must release the namespace lock before entering the
* intepreter.
* We must release the namespace lock before entering the intepreter.
*/
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
......@@ -485,16 +465,18 @@ acpi_ns_get_object_value (
if (ACPI_SUCCESS (status)) {
status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
/*
* If acpi_ex_resolve_node_to_value() succeeded, the return value was
* placed in resolved_node.
* If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
* in resolved_node.
*/
acpi_ex_exit_interpreter ();
if (ACPI_SUCCESS (status)) {
status = AE_CTRL_RETURN_VALUE;
info->return_object = ACPI_CAST_PTR (union acpi_operand_object, resolved_node);
info->return_object = ACPI_CAST_PTR
(union acpi_operand_object, resolved_node);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
info->return_object, acpi_ut_get_object_type_name (info->return_object)));
info->return_object,
acpi_ut_get_object_type_name (info->return_object)));
}
}
......
......@@ -77,7 +77,8 @@ acpi_ns_initialize_objects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Completing Region/Field/Buffer/Package initialization:"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"Completing Region/Field/Buffer/Package initialization:"));
/* Set all init info to zero */
......@@ -142,7 +143,8 @@ acpi_ns_initialize_devices (
info.num_STA = 0;
info.num_INI = 0;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Executing all Device _STA and_INI methods:"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"Executing all Device _STA and_INI methods:"));
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
......@@ -257,8 +259,8 @@ acpi_ns_init_one_object (
}
/*
* Each of these types can contain executable AML code within
* the declaration.
* Each of these types can contain executable AML code within the
* declaration.
*/
switch (type) {
case ACPI_TYPE_REGION:
......@@ -267,21 +269,18 @@ acpi_ns_init_one_object (
status = acpi_ds_get_region_arguments (obj_desc);
break;
case ACPI_TYPE_BUFFER_FIELD:
info->field_init++;
status = acpi_ds_get_buffer_field_arguments (obj_desc);
break;
case ACPI_TYPE_BUFFER:
info->buffer_init++;
status = acpi_ds_get_buffer_arguments (obj_desc);
break;
case ACPI_TYPE_PACKAGE:
info->package_init++;
......@@ -301,15 +300,17 @@ acpi_ns_init_one_object (
acpi_format_exception (status)));
}
/* Print a dot for each object unless we are going to print the entire pathname */
/*
* Print a dot for each object unless we are going to print the entire
* pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
}
/*
* We ignore errors from above, and always return OK, since
* we don't want to abort the walk on any single error.
* We ignore errors from above, and always return OK, since we don't want
* to abort the walk on any single error.
*/
acpi_ex_exit_interpreter ();
return (AE_OK);
......@@ -363,7 +364,8 @@ acpi_ns_init_one_device (
return_ACPI_STATUS (AE_OK);
}
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && (!(acpi_dbg_level & ACPI_LV_INFO))) {
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
(!(acpi_dbg_level & ACPI_LV_INFO))) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
}
......@@ -429,6 +431,5 @@ acpi_ns_init_one_device (
status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI);
}
return_ACPI_STATUS (status);
}
......@@ -92,12 +92,14 @@ acpi_ns_load_table (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_start));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
table_desc->aml_start));
/* Ignore table if there is no AML contained within */
if (!table_desc->aml_length) {
ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", table_desc->pointer->signature));
ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
table_desc->pointer->signature));
return_ACPI_STATUS (AE_OK);
}
......@@ -110,7 +112,8 @@ acpi_ns_load_table (
* to another control method, we can't continue parsing
* because we don't know how many arguments to parse next!
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Loading table into namespace ****\n"));
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
......@@ -196,7 +199,6 @@ acpi_ns_load_table_by_type (
if (ACPI_SUCCESS (status)) {
table_desc->loaded_into_namespace = TRUE;
}
break;
......@@ -252,7 +254,6 @@ acpi_ns_load_table_by_type (
table_desc = table_desc->next;
}
break;
......
......@@ -257,7 +257,8 @@ acpi_ns_handle_to_pathname (
acpi_ns_build_external_path (node, required_size, buffer->pointer);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) buffer->pointer, (u32) required_size));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n",
(char *) buffer->pointer, (u32) required_size));
return_ACPI_STATUS (AE_OK);
}
......
......@@ -96,8 +96,10 @@ acpi_ns_search_node (
scope_name = acpi_ns_get_external_pathname (node);
if (scope_name) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n",
scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type)));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching %s (%p) For [%4.4s] (%s)\n",
scope_name, node, (char *) &target_name,
acpi_ut_get_type_name (type)));
ACPI_MEM_FREE (scope_name);
}
......@@ -164,7 +166,7 @@ acpi_ns_search_node (
* PARAMETERS: *target_name - Ascii ACPI name to search for
* *Node - Starting node where search will begin
* Type - Object type to match
* **return_node - Where the matched Named Obj is returned
* **return_node - Where the matched Node is returned
*
* RETURN: Status
*
......@@ -199,13 +201,13 @@ acpi_ns_search_parent_tree (
parent_node = acpi_ns_get_parent_node (node);
/*
* If there is no parent (i.e., we are at the root) or
* type is "local", we won't be searching the parent tree.
* If there is no parent (i.e., we are at the root) or type is "local",
* we won't be searching the parent tree.
*/
if (!parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
(char *) &target_name));
return_ACPI_STATUS (AE_NOT_FOUND);
return_ACPI_STATUS (AE_NOT_FOUND);
}
if (acpi_ns_local (type)) {
......@@ -217,11 +219,12 @@ acpi_ns_search_parent_tree (
/* Search the parent tree */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char *) &target_name));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching parent [%4.4s] for [%4.4s]\n",
acpi_ut_get_node_name (parent_node), (char *) &target_name));
/*
* Search parents until found the target or we have backed up to
* the root
* Search parents until target is found or we have backed up to the root
*/
while (parent_node) {
/*
......@@ -230,7 +233,7 @@ acpi_ns_search_parent_tree (
* the actual name we are searching for. Typechecking comes later.
*/
status = acpi_ns_search_node (target_name, parent_node,
ACPI_TYPE_ANY, return_node);
ACPI_TYPE_ANY, return_node);
if (ACPI_SUCCESS (status)) {
return_ACPI_STATUS (status);
}
......@@ -293,7 +296,8 @@ acpi_ns_search_and_enter (
/* Parameter validation */
if (!node || !target_name || !return_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param: Node %p Name %X return_node %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null param: Node %p Name %X return_node %p\n",
node, target_name, return_node));
ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n"));
......@@ -330,22 +334,20 @@ acpi_ns_search_and_enter (
}
/*
* The name was not found. If we are NOT performing the
* first pass (name entry) of loading the namespace, search
* the parent tree (all the way to the root if necessary.)
* We don't want to perform the parent search when the
* namespace is actually being loaded. We want to perform
* the search when namespace references are being resolved
* (load pass 2) and during the execution phase.
* The name was not found. If we are NOT performing the first pass
* (name entry) of loading the namespace, search the parent tree (all the
* way to the root if necessary.) We don't want to perform the parent
* search when the namespace is actually being loaded. We want to perform
* the search when namespace references are being resolved (load pass 2)
* and during the execution phase.
*/
if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
(flags & ACPI_NS_SEARCH_PARENT)) {
/*
* Not found at this level - search parent tree according
* to ACPI specification
* Not found at this level - search parent tree according to the
* ACPI specification
*/
status = acpi_ns_search_parent_tree (target_name, node,
type, return_node);
status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
if (ACPI_SUCCESS (status)) {
return_ACPI_STATUS (status);
}
......@@ -355,7 +357,8 @@ acpi_ns_search_and_enter (
* In execute mode, just search, never add names. Exit now.
*/
if (interpreter_mode == ACPI_IMODE_EXECUTE) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"%4.4s Not found in %p [Not adding]\n",
(char *) &target_name, node));
return_ACPI_STATUS (AE_NOT_FOUND);
......
......@@ -85,12 +85,14 @@ acpi_ns_report_error (
if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */
acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", *(ACPI_CAST_PTR (u32, internal_name)));
acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n",
*(ACPI_CAST_PTR (u32, internal_name)));
}
else {
/* Convert path to external format */
status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name);
status = acpi_ns_externalize_name (ACPI_UINT32_MAX,
internal_name, NULL, &name);
/* Print target name */
......@@ -141,7 +143,8 @@ acpi_ns_report_method_error (
if (path) {
status = acpi_ns_get_node_by_path (path, prefix_node, ACPI_NS_NO_UPSEARCH, &node);
status = acpi_ns_get_node_by_path (path, prefix_node,
ACPI_NS_NO_UPSEARCH, &node);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("report_method_error: Could not get node\n");
return;
......@@ -180,7 +183,7 @@ acpi_ns_print_node_pathname (
return;
}
/* Convert handle to a full pathname and print it (with supplied message) */
/* Convert handle to full pathname and print it (with supplied message) */
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
......@@ -324,13 +327,11 @@ acpi_ns_get_internal_name_length (
info->fully_qualified = FALSE;
/*
* For the internal name, the required length is 4 bytes
* per segment, plus 1 each for root_prefix, multi_name_prefix_op,
* segment count, trailing null (which is not really needed,
* but no there's harm in putting it there)
* For the internal name, the required length is 4 bytes per segment, plus
* 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null
* (which is not really needed, but no there's harm in putting it there)
*
* strlen() + 1 covers the first name_seg, which has no
* path separator
* strlen() + 1 covers the first name_seg, which has no path separator
*/
if (acpi_ns_valid_root_prefix (next_external_char[0])) {
info->fully_qualified = TRUE;
......@@ -347,10 +348,9 @@ acpi_ns_get_internal_name_length (
}
/*
* Determine the number of ACPI name "segments" by counting
* the number of path separators within the string. Start
* with one segment since the segment count is (# separators)
* + 1, and zero separators is ok.
* Determine the number of ACPI name "segments" by counting the number of
* path separators within the string. Start with one segment since the
* segment count is [(# separators) + 1], and zero separators is ok.
*/
if (*next_external_char) {
info->num_segments = 1;
......@@ -625,7 +625,8 @@ acpi_ns_externalize_name (
/* <count> 4-byte names */
names_index = prefix_length + 2;
num_segments = (acpi_native_uint) (u8) internal_name[(acpi_native_uint) (prefix_length + 1)];
num_segments = (acpi_native_uint) (u8)
internal_name[(acpi_native_uint) (prefix_length + 1)];
break;
case AML_DUAL_NAME_PREFIX:
......@@ -672,7 +673,7 @@ acpi_ns_externalize_name (
}
/*
* Build converted_name...
* Build converted_name
*/
*converted_name = ACPI_MEM_CALLOCATE (required_length);
if (!(*converted_name)) {
......@@ -756,7 +757,7 @@ acpi_ns_map_handle_to_node (
*
* PARAMETERS: Node - Node to be converted to a Handle
*
* RETURN: An USER acpi_handle
* RETURN: A user handle
*
* DESCRIPTION: Convert a real Node to a namespace handle
*
......@@ -976,7 +977,8 @@ acpi_ns_find_parent_name (
parent_node = acpi_ns_get_parent_node (child_node);
if (parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Parent of %p [%4.4s] is %p [%4.4s]\n",
child_node, acpi_ut_get_node_name (child_node),
parent_node, acpi_ut_get_node_name (parent_node)));
......@@ -985,7 +987,8 @@ acpi_ns_find_parent_name (
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Unable to find parent of %p (%4.4s)\n",
child_node, acpi_ut_get_node_name (child_node)));
}
......@@ -1018,11 +1021,9 @@ acpi_ns_get_parent_node (
}
/*
* Walk to the end of this peer list.
* The last entry is marked with a flag and the peer
* pointer is really a pointer back to the parent.
* This saves putting a parent back pointer in each and
* every named object!
* Walk to the end of this peer list. The last entry is marked with a flag
* and the peer pointer is really a pointer back to the parent. This saves
* putting a parent back pointer in each and every named object!
*/
while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
node = node->peer;
......@@ -1039,8 +1040,8 @@ acpi_ns_get_parent_node (
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Next valid Node in the linked node list. NULL if no more valid
* nodess
* RETURN: Next valid Node in the linked node list. NULL if no more valid
* nodes.
*
* DESCRIPTION: Find the next valid node within a name table.
* Useful for implementing NULL-end-of-list loops.
......
......@@ -167,6 +167,9 @@ acpi_tb_get_table_header (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n",
&return_header->signature));
return_ACPI_STATUS (AE_OK);
}
......
......@@ -87,12 +87,28 @@ acpi_tb_find_table (
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
/* Find the table */
if (!ACPI_STRNCMP (signature, DSDT_SIG, ACPI_NAME_SIZE)) {
/*
* The DSDT pointer is contained in the FADT, not the RSDT.
* This code should suffice, because the only code that would perform
* a "find" on the DSDT is the data_table_region() AML opcode -- in
* which case, the DSDT is guaranteed to be already loaded.
* If this becomes insufficient, the FADT will have to be found first.
*/
if (!acpi_gbl_DSDT) {
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
status = acpi_get_firmware_table (signature, 1,
ACPI_LOGICAL_ADDRESSING, &table);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
table = acpi_gbl_DSDT;
}
else {
/* Find the table */
status = acpi_get_firmware_table (signature, 1,
ACPI_LOGICAL_ADDRESSING, &table);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
/* Check oem_id and oem_table_id */
......@@ -102,6 +118,7 @@ acpi_tb_find_table (
return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
}
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature));
*table_ptr = table;
return_ACPI_STATUS (AE_OK);
}
......
......@@ -265,7 +265,7 @@ acpi_ut_validate_buffer (
* RETURN: Status
*
* DESCRIPTION: Validate that the buffer is of the required length or
* allocate a new buffer.
* allocate a new buffer. Returned buffer is always zeroed.
*
******************************************************************************/
......@@ -305,24 +305,25 @@ acpi_ut_initialize_buffer (
/* Allocate a new buffer with local interface to allow tracking */
buffer->pointer = ACPI_MEM_ALLOCATE (required_length);
buffer->pointer = ACPI_MEM_CALLOCATE (required_length);
if (!buffer->pointer) {
return (AE_NO_MEMORY);
}
/* Clear the buffer */
ACPI_MEMSET (buffer->pointer, 0, required_length);
break;
default:
/* Validate the size of the buffer */
/* Existing buffer: Validate the size of the buffer */
if (buffer->length < required_length) {
status = AE_BUFFER_OVERFLOW;
break;
}
/* Clear the buffer */
ACPI_MEMSET (buffer->pointer, 0, required_length);
break;
}
......
......@@ -861,6 +861,7 @@ acpi_ut_init_globals (
acpi_gbl_system_notify.handler = NULL;
acpi_gbl_device_notify.handler = NULL;
acpi_gbl_exception_handler = NULL;
acpi_gbl_init_handler = NULL;
/* Global "typed" ACPI table pointers */
......
......@@ -64,7 +64,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20040827
#define ACPI_CA_VERSION 0x20040922
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
......
......@@ -180,6 +180,7 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
......
......@@ -388,7 +388,7 @@ acpi_ex_system_do_notify_op (
acpi_status
acpi_ex_system_do_suspend(
u32 time);
acpi_integer time);
acpi_status
acpi_ex_system_do_stall (
......
......@@ -216,10 +216,13 @@ void
acpi_os_wait_events_complete(
void * context);
void
acpi_os_wait_events_complete (
void *context);
void
acpi_os_sleep (
u32 seconds,
u32 milliseconds);
acpi_integer milliseconds);
void
acpi_os_stall (
......
......@@ -299,6 +299,15 @@ acpi_install_gpe_handler (
acpi_event_handler address,
void *context);
acpi_status
acpi_install_exception_handler (
acpi_exception_handler handler);
/*
* Event interfaces
*/
acpi_status
acpi_acquire_global_lock (
u16 timeout,
......
......@@ -836,6 +836,10 @@ acpi_status (*acpi_init_handler) (
#define ACPI_INIT_DEVICE_INI 1
typedef
acpi_status (*acpi_exception_handler) (
acpi_status status);
/* Address Spaces (For Operation Regions) */
......
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