Commit c232f2a1 authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/src/26-stable-acpica

into intel.com:/home/lenb/src/26-stable-dev
parents 7ad21148 2f294db8
...@@ -312,7 +312,7 @@ acpi_ds_method_data_set_value ( ...@@ -312,7 +312,7 @@ acpi_ds_method_data_set_value (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"obj %p op %X, ref count = %d [%s]\n", object, "new_obj %p Opcode %X, Refs=%d [%s]\n", object,
opcode, object->common.reference_count, opcode, object->common.reference_count,
acpi_ut_get_type_name (object->common.type))); acpi_ut_get_type_name (object->common.type)));
...@@ -572,7 +572,7 @@ acpi_ds_store_object_to_local ( ...@@ -572,7 +572,7 @@ acpi_ds_store_object_to_local (
ACPI_FUNCTION_TRACE ("ds_store_object_to_local"); ACPI_FUNCTION_TRACE ("ds_store_object_to_local");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
opcode, index, obj_desc)); opcode, index, obj_desc));
/* Parameter validation */ /* Parameter validation */
......
...@@ -333,7 +333,7 @@ acpi_ds_clear_operands ( ...@@ -333,7 +333,7 @@ acpi_ds_clear_operands (
u32 i; u32 i;
ACPI_FUNCTION_TRACE_PTR ("acpi_ds_clear_operands", walk_state); ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state);
/* /*
......
...@@ -60,17 +60,18 @@ ...@@ -60,17 +60,18 @@
* Dispatch table for opcode classes * Dispatch table for opcode classes
*/ */
static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_1A_0T_0R, acpi_ex_opcode_0A_0T_1R,
acpi_ex_opcode_1A_0T_1R, acpi_ex_opcode_1A_0T_0R,
acpi_ex_opcode_1A_1T_0R, acpi_ex_opcode_1A_0T_1R,
acpi_ex_opcode_1A_1T_1R, acpi_ex_opcode_1A_1T_0R,
acpi_ex_opcode_2A_0T_0R, acpi_ex_opcode_1A_1T_1R,
acpi_ex_opcode_2A_0T_1R, acpi_ex_opcode_2A_0T_0R,
acpi_ex_opcode_2A_1T_1R, acpi_ex_opcode_2A_0T_1R,
acpi_ex_opcode_2A_2T_1R, acpi_ex_opcode_2A_1T_1R,
acpi_ex_opcode_3A_0T_0R, acpi_ex_opcode_2A_2T_1R,
acpi_ex_opcode_3A_1T_1R, acpi_ex_opcode_3A_0T_0R,
acpi_ex_opcode_6A_0T_1R}; acpi_ex_opcode_3A_1T_1R,
acpi_ex_opcode_6A_0T_1R};
/***************************************************************************** /*****************************************************************************
* *
...@@ -413,7 +414,7 @@ acpi_ds_exec_end_op ( ...@@ -413,7 +414,7 @@ acpi_ds_exec_end_op (
* routine. There is one routine per opcode "type" based upon the * routine. There is one routine per opcode "type" based upon the
* number of opcode arguments and return type. * number of opcode arguments and return type.
*/ */
status = acpi_gbl_op_type_dispatch [op_type] (walk_state); status = acpi_gbl_op_type_dispatch[op_type] (walk_state);
} }
else { else {
/* /*
...@@ -639,7 +640,8 @@ acpi_ds_exec_end_op ( ...@@ -639,7 +640,8 @@ acpi_ds_exec_end_op (
* conditional predicate * conditional predicate
*/ */
if ((walk_state->control_state) && if ((ACPI_SUCCESS (status)) &&
(walk_state->control_state) &&
(walk_state->control_state->common.state == (walk_state->control_state->common.state ==
ACPI_CONTROL_PREDICATE_EXECUTING) && ACPI_CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) { (walk_state->control_state->control.predicate_op == op)) {
...@@ -649,6 +651,19 @@ acpi_ds_exec_end_op ( ...@@ -649,6 +651,19 @@ acpi_ds_exec_end_op (
cleanup: 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,
walk_state->method_node->name.integer, walk_state->opcode,
walk_state->aml_offset, NULL);
acpi_ex_enter_interpreter ();
}
if (walk_state->result_obj) { if (walk_state->result_obj) {
/* Break to debugger to display result */ /* Break to debugger to display result */
......
...@@ -434,13 +434,8 @@ acpi_ev_gpe_detect ( ...@@ -434,13 +434,8 @@ acpi_ev_gpe_detect (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n", "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
ACPI_FORMAT_UINT64 ( gpe_register_info->base_gpe_number, status_reg, enable_reg));
gpe_register_info->status_address.address),
status_reg,
ACPI_FORMAT_UINT64 (
gpe_register_info->enable_address.address),
enable_reg));
/* First check if there is anything active at all in this register */ /* First check if there is anything active at all in this register */
......
...@@ -970,16 +970,14 @@ acpi_ev_create_gpe_block ( ...@@ -970,16 +970,14 @@ acpi_ev_create_gpe_block (
/* Dump info about this GPE block */ /* Dump info about this GPE block */
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"GPE %02X to %02X [%4.4s] %u regs at %8.8X%8.8X on int 0x%X\n", "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
(u32) gpe_block->block_base_number, (u32) gpe_block->block_base_number,
(u32) (gpe_block->block_base_number + (u32) (gpe_block->block_base_number +
((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)), ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)),
gpe_device->name.ascii, gpe_device->name.ascii,
gpe_block->register_count, gpe_block->register_count,
ACPI_FORMAT_UINT64 (gpe_block->block_address.address),
interrupt_level)); interrupt_level));
/* Enable all valid GPEs found above */ /* Enable all valid GPEs found above */
status = acpi_hw_enable_runtime_gpe_block (NULL, gpe_block); status = acpi_hw_enable_runtime_gpe_block (NULL, gpe_block);
......
...@@ -51,6 +51,51 @@ ...@@ -51,6 +51,51 @@
ACPI_MODULE_NAME ("evxface") 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 * FUNCTION: acpi_install_fixed_event_handler
......
This diff is collapsed.
This diff is collapsed.
...@@ -139,7 +139,7 @@ acpi_ex_setup_region ( ...@@ -139,7 +139,7 @@ acpi_ex_setup_region (
if (ACPI_ROUND_UP (rgn_desc->region.length, if (ACPI_ROUND_UP (rgn_desc->region.length,
obj_desc->common_field.access_byte_width) >= obj_desc->common_field.access_byte_width) >=
(obj_desc->common_field.base_byte_offset + (obj_desc->common_field.base_byte_offset +
obj_desc->common_field.access_byte_width + (acpi_native_uint) obj_desc->common_field.access_byte_width +
field_datum_byte_offset)) { field_datum_byte_offset)) {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -199,7 +199,8 @@ acpi_ex_opcode_2A_2T_1R ( ...@@ -199,7 +199,8 @@ acpi_ex_opcode_2A_2T_1R (
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* /*
...@@ -222,8 +223,10 @@ acpi_ex_opcode_2A_2T_1R ( ...@@ -222,8 +223,10 @@ acpi_ex_opcode_2A_2T_1R (
/* Quotient to return_desc1, remainder to return_desc2 */ /* Quotient to return_desc1, remainder to return_desc2 */
status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value, status = acpi_ut_divide (operand[0]->integer.value,
&return_desc1->integer.value, &return_desc2->integer.value); operand[1]->integer.value,
&return_desc1->integer.value,
&return_desc2->integer.value);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
...@@ -292,13 +295,13 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -292,13 +295,13 @@ acpi_ex_opcode_2A_1T_1R (
{ {
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
union acpi_operand_object *temp_desc = NULL;
u32 index; u32 index;
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_size length; acpi_size length;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* /*
...@@ -331,52 +334,17 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -331,52 +334,17 @@ acpi_ex_opcode_2A_1T_1R (
/* return_desc will contain the remainder */ /* return_desc will contain the remainder */
status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value, status = acpi_ut_divide (operand[0]->integer.value,
NULL, &return_desc->integer.value); operand[1]->integer.value,
NULL,
&return_desc->integer.value);
break; break;
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
/* status = acpi_ex_do_concatenate (operand[0], operand[1],
* Convert the second operand if necessary. The first operand &return_desc, walk_state);
* determines the type of the second operand, (See the Data Types
* section of the ACPI specification.) Both object types are
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism above.
*/
switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
case ACPI_TYPE_INTEGER:
status = acpi_ex_convert_to_integer (operand[1], &temp_desc, walk_state);
break;
case ACPI_TYPE_STRING:
status = acpi_ex_convert_to_string (operand[1], &temp_desc, 16, ACPI_UINT32_MAX, walk_state);
break;
case ACPI_TYPE_BUFFER:
status = acpi_ex_convert_to_buffer (operand[1], &temp_desc, walk_state);
break;
default:
ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
ACPI_GET_OBJECT_TYPE (operand[0])));
status = AE_AML_INTERNAL;
}
if (ACPI_FAILURE (status)) {
goto cleanup;
}
/*
* Both operands are now known to be the same object type
* (Both are Integer, String, or Buffer), and we can now perform the
* concatenation.
*/
status = acpi_ex_do_concatenate (operand[0], temp_desc, &return_desc, walk_state);
if (temp_desc != operand[1]) {
acpi_ut_remove_reference (temp_desc);
}
break; break;
...@@ -387,55 +355,45 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -387,55 +355,45 @@ acpi_ex_opcode_2A_1T_1R (
* been converted.) Copy the raw buffer data to a new object of type String. * been converted.) Copy the raw buffer data to a new object of type String.
*/ */
/* Get the length of the new string */ /*
* Get the length of the new string. It is the smallest of:
* 1) Length of the input buffer
* 2) Max length as specified in the to_string operator
* 3) Length of input buffer up to a zero byte (null terminator)
*
* NOTE: A length of zero is ok, and will create a zero-length, null
* terminated string.
*/
length = 0; length = 0;
if (operand[1]->integer.value == 0) {
/* Handle optional length value */
operand[1]->integer.value = ACPI_INTEGER_MAX;
}
while ((length < operand[0]->buffer.length) && while ((length < operand[0]->buffer.length) &&
(length < operand[1]->integer.value) && (length < operand[1]->integer.value) &&
(operand[0]->buffer.pointer[length])) { (operand[0]->buffer.pointer[length])) {
length++; length++;
if (length > ACPI_MAX_STRING_CONVERSION) {
status = AE_AML_STRING_LIMIT;
goto cleanup;
}
} }
if (length > ACPI_MAX_STRING_CONVERSION) { /* Allocate a new string object */
status = AE_AML_STRING_LIMIT;
goto cleanup;
}
/* Create the internal return object */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING); return_desc = acpi_ut_create_string_object (length);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
} }
/* Allocate a new string buffer (Length + 1 for null terminator) */ /* Copy the raw buffer data with no transform. NULL terminated already. */
return_desc->string.pointer = ACPI_MEM_CALLOCATE (length + 1);
if (!return_desc->string.pointer) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Copy the raw buffer data with no transform */
ACPI_MEMCPY (return_desc->string.pointer, operand[0]->buffer.pointer, length);
/* Set the string length */ ACPI_MEMCPY (return_desc->string.pointer,
operand[0]->buffer.pointer, length);
return_desc->string.length = (u32) length;
break; break;
case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
status = acpi_ex_concat_template (operand[0], operand[1], &return_desc, walk_state); status = acpi_ex_concat_template (operand[0], operand[1],
&return_desc, walk_state);
break; break;
...@@ -458,7 +416,8 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -458,7 +416,8 @@ acpi_ex_opcode_2A_1T_1R (
/* Object to be indexed is a Package */ /* Object to be indexed is a Package */
if (index >= operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond package end (%X)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index value (%X) beyond package end (%X)\n",
index, operand[0]->package.count)); index, operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
...@@ -472,7 +431,8 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -472,7 +431,8 @@ acpi_ex_opcode_2A_1T_1R (
/* Object to be indexed is a Buffer */ /* Object to be indexed is a Buffer */
if (index >= operand[0]->buffer.length) { if (index >= operand[0]->buffer.length) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond end of buffer (%X)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index value (%X) beyond end of buffer (%X)\n",
index, operand[0]->buffer.length)); index, operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT; status = AE_AML_BUFFER_LIMIT;
goto cleanup; goto cleanup;
...@@ -558,7 +518,8 @@ acpi_ex_opcode_2A_0T_1R ( ...@@ -558,7 +518,8 @@ acpi_ex_opcode_2A_0T_1R (
u8 logical_result = FALSE; u8 logical_result = FALSE;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Create the internal return object */ /* Create the internal return object */
...@@ -572,18 +533,15 @@ acpi_ex_opcode_2A_0T_1R ( ...@@ -572,18 +533,15 @@ acpi_ex_opcode_2A_0T_1R (
/* /*
* Execute the Opcode * Execute the Opcode
*/ */
if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ {
/* Both operands must be of the same type */ status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
operand[0]->integer.value, operand[1]->integer.value,
if (ACPI_GET_OBJECT_TYPE (operand[0]) != &logical_result);
ACPI_GET_OBJECT_TYPE (operand[1])) { goto store_logical_result;
status = AE_AML_OPERAND_TYPE; }
goto cleanup; else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ {
} status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
operand[1], &logical_result);
logical_result = acpi_ex_do_logical_op (walk_state->opcode,
operand[0],
operand[1]);
goto store_logical_result; goto store_logical_result;
} }
......
...@@ -121,7 +121,7 @@ acpi_ex_system_memory_space_handler ( ...@@ -121,7 +121,7 @@ acpi_ex_system_memory_space_handler (
* Hardware does not support non-aligned data transfers, we must verify * Hardware does not support non-aligned data transfers, we must verify
* the request. * the request.
*/ */
(void) acpi_ut_short_divide ((acpi_integer *) &address, length, NULL, &remainder); (void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder);
if (remainder != 0) { if (remainder != 0) {
return_ACPI_STATUS (AE_AML_ALIGNMENT); return_ACPI_STATUS (AE_AML_ALIGNMENT);
} }
......
...@@ -160,7 +160,7 @@ acpi_ex_resolve_operands ( ...@@ -160,7 +160,7 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] operand_types=%X \n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n",
opcode, op_info->name, arg_types)); opcode, op_info->name, arg_types));
/* /*
...@@ -227,12 +227,13 @@ acpi_ex_resolve_operands ( ...@@ -227,12 +227,13 @@ acpi_ex_resolve_operands (
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Reference Opcode: %s\n", op_info->name))); "Operand is a Reference, ref_opcode [%s]\n",
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)));
break; break;
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown Reference Opcode %X [%s]\n", "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
obj_desc->reference.opcode, obj_desc->reference.opcode,
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)); (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
...@@ -398,7 +399,7 @@ acpi_ex_resolve_operands ( ...@@ -398,7 +399,7 @@ acpi_ex_resolve_operands (
* But we can implicitly convert from a STRING or BUFFER * But we can implicitly convert from a STRING or BUFFER
* Aka - "Implicit Source Operand Conversion" * Aka - "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, walk_state); status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
...@@ -420,7 +421,7 @@ acpi_ex_resolve_operands ( ...@@ -420,7 +421,7 @@ acpi_ex_resolve_operands (
* But we can implicitly convert from a STRING or INTEGER * But we can implicitly convert from a STRING or INTEGER
* Aka - "Implicit Source Operand Conversion" * Aka - "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr, walk_state); status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
...@@ -442,7 +443,8 @@ acpi_ex_resolve_operands ( ...@@ -442,7 +443,8 @@ acpi_ex_resolve_operands (
* But we can implicitly convert from a BUFFER or INTEGER * But we can implicitly convert from a BUFFER or INTEGER
* Aka - "Implicit Source Operand Conversion" * Aka - "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_string (obj_desc, stack_ptr, 16, ACPI_UINT32_MAX, walk_state); status = acpi_ex_convert_to_string (obj_desc, stack_ptr,
ACPI_IMPLICIT_CONVERT_HEX);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
...@@ -494,7 +496,7 @@ acpi_ex_resolve_operands ( ...@@ -494,7 +496,7 @@ acpi_ex_resolve_operands (
/* Highest priority conversion is to type Buffer */ /* Highest priority conversion is to type Buffer */
status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr, walk_state); status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -129,7 +129,8 @@ acpi_ex_store ( ...@@ -129,7 +129,8 @@ acpi_ex_store (
/* Destination is not a Reference object */ /* Destination is not a Reference object */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Destination is not a Reference or Constant object [%p]\n", dest_desc)); "Target is not a Reference or Constant object - %s [%p]\n",
acpi_ut_get_object_type_name (dest_desc), dest_desc));
ACPI_DUMP_STACK_ENTRY (source_desc); ACPI_DUMP_STACK_ENTRY (source_desc);
ACPI_DUMP_STACK_ENTRY (dest_desc); ACPI_DUMP_STACK_ENTRY (dest_desc);
...@@ -182,23 +183,37 @@ acpi_ex_store ( ...@@ -182,23 +183,37 @@ acpi_ex_store (
* Storing to the Debug object causes the value stored to be * Storing to the Debug object causes the value stored to be
* displayed and otherwise has no effect -- see ACPI Specification * displayed and otherwise has no effect -- see ACPI Specification
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"**** Write to Debug Object: Object %p %s ****:\n\n",
source_desc, acpi_ut_get_object_type_name (source_desc)));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", 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)));
if (!acpi_ut_valid_internal_object (source_desc)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
"%p, Invalid Internal Object!\n", source_desc));
break;
}
switch (ACPI_GET_OBJECT_TYPE (source_desc)) { switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER: 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))); ACPI_FORMAT_UINT64 (source_desc->integer.value)));
}
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
(u32) source_desc->buffer.length)); (u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER (source_desc->buffer.pointer, ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
break; break;
...@@ -206,22 +221,22 @@ acpi_ex_store ( ...@@ -206,22 +221,22 @@ acpi_ex_store (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X, \"%s\"\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
source_desc->string.length, source_desc->string.pointer)); source_desc->string.length, source_desc->string.pointer));
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Size 0x%.2X Elements Ptr - %p\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
source_desc->package.count, source_desc->package.elements)); source_desc->package.count, source_desc->package.elements));
break; break;
default: default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
source_desc)); source_desc));
break; break;
} }
......
...@@ -167,7 +167,7 @@ acpi_ex_system_do_stall ( ...@@ -167,7 +167,7 @@ acpi_ex_system_do_stall (
acpi_status acpi_status
acpi_ex_system_do_suspend ( acpi_ex_system_do_suspend (
u32 how_long) acpi_integer how_long)
{ {
acpi_status status; acpi_status status;
...@@ -179,8 +179,7 @@ acpi_ex_system_do_suspend ( ...@@ -179,8 +179,7 @@ acpi_ex_system_do_suspend (
acpi_ex_exit_interpreter (); acpi_ex_exit_interpreter ();
acpi_os_sleep ((u16) (how_long / (u32) 1000), acpi_os_sleep (how_long);
(u16) (how_long % (u32) 1000));
/* And now we must get the interpreter again */ /* And now we must get the interpreter again */
......
...@@ -280,25 +280,25 @@ acpi_ex_digits_needed ( ...@@ -280,25 +280,25 @@ acpi_ex_digits_needed (
{ {
u32 num_digits; u32 num_digits;
acpi_integer current_value; acpi_integer current_value;
acpi_integer quotient;
ACPI_FUNCTION_TRACE ("ex_digits_needed"); ACPI_FUNCTION_TRACE ("ex_digits_needed");
/* /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
* acpi_integer is unsigned, so we don't worry about a '-'
*/ if (value == 0) {
if ((current_value = value) == 0) {
return_VALUE (1); return_VALUE (1);
} }
current_value = value;
num_digits = 0; num_digits = 0;
/* Count the digits in the requested base */
while (current_value) { while (current_value) {
(void) acpi_ut_short_divide (&current_value, base, &quotient, NULL); (void) acpi_ut_short_divide (current_value, base, &current_value, NULL);
num_digits++; num_digits++;
current_value = quotient;
} }
return_VALUE (num_digits); return_VALUE (num_digits);
...@@ -361,7 +361,6 @@ acpi_ex_unsigned_integer_to_string ( ...@@ -361,7 +361,6 @@ acpi_ex_unsigned_integer_to_string (
u32 count; u32 count;
u32 digits_needed; u32 digits_needed;
u32 remainder; u32 remainder;
acpi_integer quotient;
ACPI_FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
...@@ -371,9 +370,8 @@ acpi_ex_unsigned_integer_to_string ( ...@@ -371,9 +370,8 @@ acpi_ex_unsigned_integer_to_string (
out_string[digits_needed] = 0; out_string[digits_needed] = 0;
for (count = digits_needed; count > 0; count--) { for (count = digits_needed; count > 0; count--) {
(void) acpi_ut_short_divide (&value, 10, &quotient, &remainder); (void) acpi_ut_short_divide (value, 10, &value, &remainder);
out_string[count-1] = (char) ('0' + remainder);\ out_string[count-1] = (char) ('0' + remainder);\
value = quotient;
} }
} }
......
...@@ -709,6 +709,7 @@ acpi_hw_low_level_read ( ...@@ -709,6 +709,7 @@ acpi_hw_low_level_read (
u32 *value, u32 *value,
struct acpi_generic_address *reg) struct acpi_generic_address *reg)
{ {
u64 address;
acpi_status status; acpi_status status;
...@@ -720,8 +721,14 @@ acpi_hw_low_level_read ( ...@@ -720,8 +721,14 @@ acpi_hw_low_level_read (
* a non-zero address within. However, don't return an error * a non-zero address within. However, don't return an error
* because the PM1A/B code must not fail if B isn't present. * because the PM1A/B code must not fail if B isn't present.
*/ */
if ((!reg) || if (!reg) {
(!reg->address)) { return (AE_OK);
}
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&address, &reg->address);
if (!address) {
return (AE_OK); return (AE_OK);
} }
*value = 0; *value = 0;
...@@ -734,14 +741,14 @@ acpi_hw_low_level_read ( ...@@ -734,14 +741,14 @@ acpi_hw_low_level_read (
case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_MEMORY:
status = acpi_os_read_memory ( status = acpi_os_read_memory (
(acpi_physical_address) reg->address, (acpi_physical_address) address,
value, width); value, width);
break; break;
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
status = acpi_os_read_port ((acpi_io_address) reg->address, status = acpi_os_read_port ((acpi_io_address) address,
value, width); value, width);
break; break;
...@@ -754,7 +761,7 @@ acpi_hw_low_level_read ( ...@@ -754,7 +761,7 @@ acpi_hw_low_level_read (
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
*value, width, *value, width,
ACPI_FORMAT_UINT64 (reg->address), ACPI_FORMAT_UINT64 (address),
acpi_ut_get_region_name (reg->address_space_id))); acpi_ut_get_region_name (reg->address_space_id)));
return (status); return (status);
...@@ -781,6 +788,7 @@ acpi_hw_low_level_write ( ...@@ -781,6 +788,7 @@ acpi_hw_low_level_write (
u32 value, u32 value,
struct acpi_generic_address *reg) struct acpi_generic_address *reg)
{ {
u64 address;
acpi_status status; acpi_status status;
...@@ -792,8 +800,14 @@ acpi_hw_low_level_write ( ...@@ -792,8 +800,14 @@ acpi_hw_low_level_write (
* a non-zero address within. However, don't return an error * a non-zero address within. However, don't return an error
* because the PM1A/B code must not fail if B isn't present. * because the PM1A/B code must not fail if B isn't present.
*/ */
if ((!reg) || if (!reg) {
(!reg->address)) { return (AE_OK);
}
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&address, &reg->address);
if (!address) {
return (AE_OK); return (AE_OK);
} }
...@@ -805,14 +819,14 @@ acpi_hw_low_level_write ( ...@@ -805,14 +819,14 @@ acpi_hw_low_level_write (
case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_MEMORY:
status = acpi_os_write_memory ( status = acpi_os_write_memory (
(acpi_physical_address) reg->address, (acpi_physical_address) address,
value, width); value, width);
break; break;
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
status = acpi_os_write_port ((acpi_io_address) reg->address, status = acpi_os_write_port ((acpi_io_address) address,
value, width); value, width);
break; break;
...@@ -825,7 +839,7 @@ acpi_hw_low_level_write ( ...@@ -825,7 +839,7 @@ acpi_hw_low_level_write (
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
value, width, value, width,
ACPI_FORMAT_UINT64 (reg->address), ACPI_FORMAT_UINT64 (address),
acpi_ut_get_region_name (reg->address_space_id))); acpi_ut_get_region_name (reg->address_space_id)));
return (status); return (status);
......
...@@ -149,10 +149,9 @@ acpi_get_timer_duration ( ...@@ -149,10 +149,9 @@ acpi_get_timer_duration (
u32 end_ticks, u32 end_ticks,
u32 *time_elapsed) u32 *time_elapsed)
{ {
u32 delta_ticks = 0;
union uint64_overlay normalized_ticks;
acpi_status status; acpi_status status;
acpi_integer out_quotient; u32 delta_ticks;
acpi_integer quotient;
ACPI_FUNCTION_TRACE ("acpi_get_timer_duration"); ACPI_FUNCTION_TRACE ("acpi_get_timer_duration");
...@@ -164,7 +163,7 @@ acpi_get_timer_duration ( ...@@ -164,7 +163,7 @@ acpi_get_timer_duration (
/* /*
* Compute Tick Delta: * Compute Tick Delta:
* Handle (max one) timer rollovers on 24- versus 32-bit timers. * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
*/ */
if (start_ticks < end_ticks) { if (start_ticks < end_ticks) {
delta_ticks = end_ticks - start_ticks; delta_ticks = end_ticks - start_ticks;
...@@ -181,22 +180,20 @@ acpi_get_timer_duration ( ...@@ -181,22 +180,20 @@ acpi_get_timer_duration (
delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
} }
} }
else { else /* start_ticks == end_ticks */ {
*time_elapsed = 0; *time_elapsed = 0;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* /*
* Compute Duration (Requires a 64-bit divide): * Compute Duration (Requires a 64-bit multiply and divide):
* *
* time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY; * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
*/ */
normalized_ticks.full = ((u64) delta_ticks) * 1000000; status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000,
PM_TIMER_FREQUENCY, &quotient, NULL);
status = acpi_ut_short_divide (&normalized_ticks.full, PM_TIMER_FREQUENCY,
&out_quotient, NULL);
*time_elapsed = (u32) out_quotient; *time_elapsed = (u32) quotient;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -161,8 +161,10 @@ acpi_ns_root_initialize (void) ...@@ -161,8 +161,10 @@ acpi_ns_root_initialize (void)
#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App) #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; new_node->owner_id = obj_desc->method.param_count;
#else #else
/* Mark this as a very SPECIAL method */ /* Mark this as a very SPECIAL method */
...@@ -236,7 +238,8 @@ acpi_ns_root_initialize (void) ...@@ -236,7 +238,8 @@ acpi_ns_root_initialize (void)
/* Store pointer to value descriptor in the Node */ /* 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 */ /* Remove local reference to the object */
...@@ -462,7 +465,8 @@ acpi_ns_lookup ( ...@@ -462,7 +465,8 @@ acpi_ns_lookup (
type = this_node->type; type = this_node->type;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 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; break;
case AML_DUAL_NAME_PREFIX: case AML_DUAL_NAME_PREFIX:
...@@ -554,7 +558,7 @@ acpi_ns_lookup ( ...@@ -554,7 +558,7 @@ acpi_ns_lookup (
/* Try to find the single (4 character) ACPI name */ /* Try to find the single (4 character) ACPI name */
status = acpi_ns_search_and_enter (simple_name, walk_state, current_node, 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 (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
/* Name not found in ACPI namespace */ /* Name not found in ACPI namespace */
......
...@@ -198,7 +198,8 @@ acpi_ns_dump_one_object ( ...@@ -198,7 +198,8 @@ acpi_ns_dump_one_object (
} }
if (!acpi_ut_valid_acpi_name (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_REPORT_WARNING (("Invalid ACPI Name %08X\n",
this_node->name.integer));
} }
/* /*
...@@ -226,9 +227,8 @@ acpi_ns_dump_one_object ( ...@@ -226,9 +227,8 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_PROCESSOR:
acpi_os_printf ("ID %X Len %.4X Addr %p\n", acpi_os_printf ("ID %X Len %.4X Addr %p\n",
obj_desc->processor.proc_id, obj_desc->processor.proc_id, obj_desc->processor.length,
obj_desc->processor.length, (char *) obj_desc->processor.address);
(char *) obj_desc->processor.address);
break; break;
...@@ -241,16 +241,15 @@ acpi_ns_dump_one_object ( ...@@ -241,16 +241,15 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
acpi_os_printf ("Args %X Len %.4X Aml %p\n", acpi_os_printf ("Args %X Len %.4X Aml %p\n",
(u32) obj_desc->method.param_count, (u32) obj_desc->method.param_count,
obj_desc->method.aml_length, obj_desc->method.aml_length, obj_desc->method.aml_start);
obj_desc->method.aml_start);
break; break;
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
acpi_os_printf ("= %8.8X%8.8X\n", acpi_os_printf ("= %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (obj_desc->integer.value)); ACPI_FORMAT_UINT64 (obj_desc->integer.value));
break; break;
...@@ -258,7 +257,7 @@ acpi_ns_dump_one_object ( ...@@ -258,7 +257,7 @@ acpi_ns_dump_one_object (
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf ("Elements %.2X\n", acpi_os_printf ("Elements %.2X\n",
obj_desc->package.count); obj_desc->package.count);
} }
else { else {
acpi_os_printf ("[Length not yet evaluated]\n"); acpi_os_printf ("[Length not yet evaluated]\n");
...@@ -298,11 +297,12 @@ acpi_ns_dump_one_object ( ...@@ -298,11 +297,12 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_REGION: 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) { if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n", acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
ACPI_FORMAT_UINT64 (obj_desc->region.address), ACPI_FORMAT_UINT64 (obj_desc->region.address),
obj_desc->region.length); obj_desc->region.length);
} }
else { else {
acpi_os_printf (" [Address/Length not yet evaluated]\n"); acpi_os_printf (" [Address/Length not yet evaluated]\n");
...@@ -313,7 +313,7 @@ acpi_ns_dump_one_object ( ...@@ -313,7 +313,7 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf ("[%s]\n", acpi_os_printf ("[%s]\n",
acpi_ps_get_opcode_name (obj_desc->reference.opcode)); acpi_ps_get_opcode_name (obj_desc->reference.opcode));
break; break;
...@@ -322,7 +322,7 @@ acpi_ns_dump_one_object ( ...@@ -322,7 +322,7 @@ acpi_ns_dump_one_object (
if (obj_desc->buffer_field.buffer_obj && if (obj_desc->buffer_field.buffer_obj &&
obj_desc->buffer_field.buffer_obj->buffer.node) { obj_desc->buffer_field.buffer_obj->buffer.node) {
acpi_os_printf ("Buf [%4.4s]", 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; break;
...@@ -330,30 +330,31 @@ acpi_ns_dump_one_object ( ...@@ -330,30 +330,31 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf ("Rgn [%4.4s]", 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; break;
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]", 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->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->bank_field.bank_obj->common_field.node));
break; break;
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]", 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.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.data_obj->common_field.node));
break; break;
case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_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; break;
default: default:
...@@ -371,10 +372,10 @@ acpi_ns_dump_one_object ( ...@@ -371,10 +372,10 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n", acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n",
(obj_desc->common_field.base_byte_offset * 8) (obj_desc->common_field.base_byte_offset * 8)
+ obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
obj_desc->common_field.access_byte_width); obj_desc->common_field.access_byte_width);
break; break;
default: default:
...@@ -471,12 +472,13 @@ acpi_ns_dump_one_object ( ...@@ -471,12 +472,13 @@ acpi_ns_dump_one_object (
obj_type = ACPI_GET_OBJECT_TYPE (obj_desc); obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
if (obj_type > ACPI_TYPE_LOCAL_MAX) { 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; bytes_to_dump = 32;
} }
else { else {
acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n", 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); bytes_to_dump = sizeof (union acpi_operand_object);
} }
break; break;
...@@ -484,8 +486,9 @@ acpi_ns_dump_one_object ( ...@@ -484,8 +486,9 @@ acpi_ns_dump_one_object (
default: default:
acpi_os_printf ("(String or Buffer ptr - not an object descriptor) [%s]\n", acpi_os_printf (
acpi_ut_get_descriptor_name (obj_desc)); "(String or Buffer ptr - not an object descriptor) [%s]\n",
acpi_ut_get_descriptor_name (obj_desc));
bytes_to_dump = 16; bytes_to_dump = 16;
break; break;
} }
...@@ -552,7 +555,7 @@ acpi_ns_dump_one_object ( ...@@ -552,7 +555,7 @@ acpi_ns_dump_one_object (
* FUNCTION: acpi_ns_dump_objects * FUNCTION: acpi_ns_dump_objects
* *
* PARAMETERS: Type - Object type to be dumped * 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. * for an effectively unlimited depth.
* owner_id - Dump only objects owned by this ID. Use * owner_id - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners. * ACPI_UINT32_MAX to match all owners.
......
...@@ -91,10 +91,10 @@ acpi_ns_dump_one_device ( ...@@ -91,10 +91,10 @@ acpi_ns_dump_one_device (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
} }
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
info->hardware_id.value, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
ACPI_FORMAT_UINT64 (info->address), info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
info->current_status)); info->current_status));
ACPI_MEM_FREE (info); ACPI_MEM_FREE (info);
} }
...@@ -133,7 +133,8 @@ acpi_ns_dump_root_devices (void) ...@@ -133,7 +133,8 @@ acpi_ns_dump_root_devices (void)
return; 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, status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
......
...@@ -57,14 +57,9 @@ ...@@ -57,14 +57,9 @@
* *
* FUNCTION: acpi_ns_evaluate_relative * FUNCTION: acpi_ns_evaluate_relative
* *
* PARAMETERS: Handle - The relative containing object * PARAMETERS: Pathname - Name of method to execute, If NULL, the
* Pathname - Name of method to execute, If NULL, the
* handle is the object to execute * handle is the object to execute
* Params - List of parameters to pass to the method, * Info - Method info block
* 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.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -138,8 +133,7 @@ acpi_ns_evaluate_relative ( ...@@ -138,8 +133,7 @@ acpi_ns_evaluate_relative (
} }
/* /*
* Now that we have a handle to the object, we can attempt * Now that we have a handle to the object, we can attempt to evaluate it.
* to evaluate it.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, node, acpi_ns_get_attached_object (node))); pathname, node, acpi_ns_get_attached_object (node)));
...@@ -165,9 +159,9 @@ acpi_ns_evaluate_relative ( ...@@ -165,9 +159,9 @@ acpi_ns_evaluate_relative (
* *
* PARAMETERS: Pathname - Fully qualified pathname to the object * PARAMETERS: Pathname - Fully qualified pathname to the object
* Info - Contains: * 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. * 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 * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* *
...@@ -213,14 +207,14 @@ acpi_ns_evaluate_by_name ( ...@@ -213,14 +207,14 @@ acpi_ns_evaluate_by_name (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) { 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)); pathname, status));
goto cleanup; goto cleanup;
} }
/* /*
* Now that we have a handle to the object, we can attempt * Now that we have a handle to the object, we can attempt to evaluate it.
* to evaluate it.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, info->node, acpi_ns_get_attached_object (info->node))); pathname, info->node, acpi_ns_get_attached_object (info->node)));
...@@ -303,9 +297,8 @@ acpi_ns_evaluate_by_handle ( ...@@ -303,9 +297,8 @@ acpi_ns_evaluate_by_handle (
} }
/* /*
* For a method alias, we must grab the actual method node * For a method alias, we must grab the actual method node so that proper
* so that proper scoping context will be established * scoping context will be established before execution.
* before execution.
*/ */
if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object); info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object);
...@@ -314,11 +307,9 @@ acpi_ns_evaluate_by_handle ( ...@@ -314,11 +307,9 @@ acpi_ns_evaluate_by_handle (
/* /*
* Two major cases here: * Two major cases here:
* 1) The object is an actual control method -- execute it. * 1) The object is an actual control method -- execute it.
* 2) The object is not a method -- just return it's current * 2) The object is not a method -- just return it's current value
* value
* *
* In both cases, the namespace is unlocked by the * In both cases, the namespace is unlocked by the acpi_ns* procedure
* acpi_ns* procedure
*/ */
if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) { if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) {
/* /*
...@@ -328,15 +319,13 @@ acpi_ns_evaluate_by_handle ( ...@@ -328,15 +319,13 @@ acpi_ns_evaluate_by_handle (
} }
else { else {
/* /*
* Case 2) Object is NOT a method, just return its * Case 2) Object is NOT a method, just return its current value
* current value
*/ */
status = acpi_ns_get_object_value (info); status = acpi_ns_get_object_value (info);
} }
/* /*
* Check if there is a return value on the stack that must * Check if there is a return value on the stack that must be dealt with
* be dealt with
*/ */
if (status == AE_CTRL_RETURN_VALUE) { if (status == AE_CTRL_RETURN_VALUE) {
/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
...@@ -345,8 +334,8 @@ acpi_ns_evaluate_by_handle ( ...@@ -345,8 +334,8 @@ acpi_ns_evaluate_by_handle (
} }
/* /*
* Namespace was unlocked by the handling acpi_ns* function, * Namespace was unlocked by the handling acpi_ns* function, so we
* so we just return * just return
*/ */
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -356,12 +345,7 @@ acpi_ns_evaluate_by_handle ( ...@@ -356,12 +345,7 @@ acpi_ns_evaluate_by_handle (
* *
* FUNCTION: acpi_ns_execute_control_method * FUNCTION: acpi_ns_execute_control_method
* *
* PARAMETERS: method_node - The method to execute * PARAMETERS: Info - Method info block (w/params)
* 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.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -430,8 +414,7 @@ acpi_ns_execute_control_method ( ...@@ -430,8 +414,7 @@ acpi_ns_execute_control_method (
* *
* FUNCTION: acpi_ns_get_object_value * FUNCTION: acpi_ns_get_object_value
* *
* PARAMETERS: Node - The object * PARAMETERS: Info - Method info block (w/params)
* return_obj_desc - Where the objects value is returned
* *
* RETURN: Status * RETURN: Status
* *
...@@ -453,28 +436,25 @@ acpi_ns_get_object_value ( ...@@ -453,28 +436,25 @@ acpi_ns_get_object_value (
/* /*
* Objects require additional resolution steps (e.g., the * Objects require additional resolution steps (e.g., the Node may be a
* Node may be a field that must be read, etc.) -- we can't just grab * field that must be read, etc.) -- we can't just grab the object out of
* the object out of the node. * the node.
*/ */
/* /*
* Use resolve_node_to_value() to get the associated value. This call * Use resolve_node_to_value() to get the associated value. This call always
* always deletes obj_desc (allocated above). * deletes obj_desc (allocated above).
* *
* NOTE: we can get away with passing in NULL for a walk state * NOTE: we can get away with passing in NULL for a walk state because
* because obj_desc is guaranteed to not be a reference to either * obj_desc is guaranteed to not be a reference to either a method local or
* a method local or a method argument (because this interface can only be * a method argument (because this interface can only be called from the
* called from the acpi_evaluate external interface, never called from * acpi_evaluate external interface, never called from a running method.)
* a running control method.)
* *
* Even though we do not directly invoke the interpreter * Even though we do not directly invoke the interpreter for this, we must
* for this, we must enter it because we could access an opregion. * enter it because we could access an opregion. The opregion access code
* The opregion access code assumes that the interpreter * assumes that the interpreter is locked.
* is locked.
* *
* We must release the namespace lock before entering the * We must release the namespace lock before entering the intepreter.
* intepreter.
*/ */
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -485,16 +465,18 @@ acpi_ns_get_object_value ( ...@@ -485,16 +465,18 @@ acpi_ns_get_object_value (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
status = acpi_ex_resolve_node_to_value (&resolved_node, NULL); status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
/* /*
* If acpi_ex_resolve_node_to_value() succeeded, the return value was * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
* placed in resolved_node. * in resolved_node.
*/ */
acpi_ex_exit_interpreter (); acpi_ex_exit_interpreter ();
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
status = AE_CTRL_RETURN_VALUE; 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", 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 ( ...@@ -77,7 +77,8 @@ acpi_ns_initialize_objects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n")); "**** 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 */ /* Set all init info to zero */
...@@ -142,7 +143,8 @@ acpi_ns_initialize_devices ( ...@@ -142,7 +143,8 @@ acpi_ns_initialize_devices (
info.num_STA = 0; info.num_STA = 0;
info.num_INI = 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); status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -257,8 +259,8 @@ acpi_ns_init_one_object ( ...@@ -257,8 +259,8 @@ acpi_ns_init_one_object (
} }
/* /*
* Each of these types can contain executable AML code within * Each of these types can contain executable AML code within the
* the declaration. * declaration.
*/ */
switch (type) { switch (type) {
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
...@@ -267,21 +269,18 @@ acpi_ns_init_one_object ( ...@@ -267,21 +269,18 @@ acpi_ns_init_one_object (
status = acpi_ds_get_region_arguments (obj_desc); status = acpi_ds_get_region_arguments (obj_desc);
break; break;
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
info->field_init++; info->field_init++;
status = acpi_ds_get_buffer_field_arguments (obj_desc); status = acpi_ds_get_buffer_field_arguments (obj_desc);
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
info->buffer_init++; info->buffer_init++;
status = acpi_ds_get_buffer_arguments (obj_desc); status = acpi_ds_get_buffer_arguments (obj_desc);
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
info->package_init++; info->package_init++;
...@@ -301,15 +300,17 @@ acpi_ns_init_one_object ( ...@@ -301,15 +300,17 @@ acpi_ns_init_one_object (
acpi_format_exception (status))); 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)) { if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
} }
/* /*
* We ignore errors from above, and always return OK, since * We ignore errors from above, and always return OK, since we don't want
* we don't want to abort the walk on any single error. * to abort the walk on any single error.
*/ */
acpi_ex_exit_interpreter (); acpi_ex_exit_interpreter ();
return (AE_OK); return (AE_OK);
...@@ -363,7 +364,8 @@ acpi_ns_init_one_device ( ...@@ -363,7 +364,8 @@ acpi_ns_init_one_device (
return_ACPI_STATUS (AE_OK); 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, ".")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
} }
...@@ -429,6 +431,5 @@ acpi_ns_init_one_device ( ...@@ -429,6 +431,5 @@ acpi_ns_init_one_device (
status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI); status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI);
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -92,12 +92,14 @@ acpi_ns_load_table ( ...@@ -92,12 +92,14 @@ acpi_ns_load_table (
return_ACPI_STATUS (AE_BAD_PARAMETER); 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 */ /* Ignore table if there is no AML contained within */
if (!table_desc->aml_length) { 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); return_ACPI_STATUS (AE_OK);
} }
...@@ -110,7 +112,8 @@ acpi_ns_load_table ( ...@@ -110,7 +112,8 @@ acpi_ns_load_table (
* to another control method, we can't continue parsing * to another control method, we can't continue parsing
* because we don't know how many arguments to parse next! * 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); status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -196,7 +199,6 @@ acpi_ns_load_table_by_type ( ...@@ -196,7 +199,6 @@ acpi_ns_load_table_by_type (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
table_desc->loaded_into_namespace = TRUE; table_desc->loaded_into_namespace = TRUE;
} }
break; break;
...@@ -252,7 +254,6 @@ acpi_ns_load_table_by_type ( ...@@ -252,7 +254,6 @@ acpi_ns_load_table_by_type (
table_desc = table_desc->next; table_desc = table_desc->next;
} }
break; break;
......
...@@ -202,7 +202,11 @@ acpi_ns_get_pathname_length ( ...@@ -202,7 +202,11 @@ acpi_ns_get_pathname_length (
next_node = acpi_ns_get_parent_node (next_node); next_node = acpi_ns_get_parent_node (next_node);
} }
return (size + 1); if (!size) {
size = 1; /* Root node case */
}
return (size + 1); /* +1 for null string terminator */
} }
...@@ -253,7 +257,8 @@ acpi_ns_handle_to_pathname ( ...@@ -253,7 +257,8 @@ acpi_ns_handle_to_pathname (
acpi_ns_build_external_path (node, required_size, buffer->pointer); 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); return_ACPI_STATUS (AE_OK);
} }
......
...@@ -96,8 +96,10 @@ acpi_ns_search_node ( ...@@ -96,8 +96,10 @@ acpi_ns_search_node (
scope_name = acpi_ns_get_external_pathname (node); scope_name = acpi_ns_get_external_pathname (node);
if (scope_name) { if (scope_name) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type))); "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); ACPI_MEM_FREE (scope_name);
} }
...@@ -164,7 +166,7 @@ acpi_ns_search_node ( ...@@ -164,7 +166,7 @@ acpi_ns_search_node (
* PARAMETERS: *target_name - Ascii ACPI name to search for * PARAMETERS: *target_name - Ascii ACPI name to search for
* *Node - Starting node where search will begin * *Node - Starting node where search will begin
* Type - Object type to match * Type - Object type to match
* **return_node - Where the matched Named Obj is returned * **return_node - Where the matched Node is returned
* *
* RETURN: Status * RETURN: Status
* *
...@@ -199,13 +201,13 @@ acpi_ns_search_parent_tree ( ...@@ -199,13 +201,13 @@ acpi_ns_search_parent_tree (
parent_node = acpi_ns_get_parent_node (node); parent_node = acpi_ns_get_parent_node (node);
/* /*
* If there is no parent (i.e., we are at the root) or * If there is no parent (i.e., we are at the root) or type is "local",
* type is "local", we won't be searching the parent tree. * we won't be searching the parent tree.
*/ */
if (!parent_node) { if (!parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
(char *) &target_name)); (char *) &target_name));
return_ACPI_STATUS (AE_NOT_FOUND); return_ACPI_STATUS (AE_NOT_FOUND);
} }
if (acpi_ns_local (type)) { if (acpi_ns_local (type)) {
...@@ -217,11 +219,12 @@ acpi_ns_search_parent_tree ( ...@@ -217,11 +219,12 @@ acpi_ns_search_parent_tree (
/* Search the 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 * Search parents until target is found or we have backed up to the root
* the root
*/ */
while (parent_node) { while (parent_node) {
/* /*
...@@ -230,7 +233,7 @@ acpi_ns_search_parent_tree ( ...@@ -230,7 +233,7 @@ acpi_ns_search_parent_tree (
* the actual name we are searching for. Typechecking comes later. * the actual name we are searching for. Typechecking comes later.
*/ */
status = acpi_ns_search_node (target_name, parent_node, status = acpi_ns_search_node (target_name, parent_node,
ACPI_TYPE_ANY, return_node); ACPI_TYPE_ANY, return_node);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -293,7 +296,8 @@ acpi_ns_search_and_enter ( ...@@ -293,7 +296,8 @@ acpi_ns_search_and_enter (
/* Parameter validation */ /* Parameter validation */
if (!node || !target_name || !return_node) { 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)); node, target_name, return_node));
ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n")); ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n"));
...@@ -330,22 +334,20 @@ acpi_ns_search_and_enter ( ...@@ -330,22 +334,20 @@ acpi_ns_search_and_enter (
} }
/* /*
* The name was not found. If we are NOT performing the * The name was not found. If we are NOT performing the first pass
* first pass (name entry) of loading the namespace, search * (name entry) of loading the namespace, search the parent tree (all the
* the parent tree (all the way to the root if necessary.) * way to the root if necessary.) We don't want to perform the parent
* We don't want to perform the parent search when the * search when the namespace is actually being loaded. We want to perform
* namespace is actually being loaded. We want to perform * the search when namespace references are being resolved (load pass 2)
* the search when namespace references are being resolved * and during the execution phase.
* (load pass 2) and during the execution phase.
*/ */
if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) && if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
(flags & ACPI_NS_SEARCH_PARENT)) { (flags & ACPI_NS_SEARCH_PARENT)) {
/* /*
* Not found at this level - search parent tree according * Not found at this level - search parent tree according to the
* to ACPI specification * ACPI specification
*/ */
status = acpi_ns_search_parent_tree (target_name, node, status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
type, return_node);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -355,7 +357,8 @@ acpi_ns_search_and_enter ( ...@@ -355,7 +357,8 @@ acpi_ns_search_and_enter (
* In execute mode, just search, never add names. Exit now. * In execute mode, just search, never add names. Exit now.
*/ */
if (interpreter_mode == ACPI_IMODE_EXECUTE) { 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)); (char *) &target_name, node));
return_ACPI_STATUS (AE_NOT_FOUND); return_ACPI_STATUS (AE_NOT_FOUND);
......
...@@ -85,12 +85,14 @@ acpi_ns_report_error ( ...@@ -85,12 +85,14 @@ acpi_ns_report_error (
if (lookup_status == AE_BAD_CHARACTER) { if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */ /* 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 { else {
/* Convert path to external format */ /* 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 */ /* Print target name */
...@@ -141,7 +143,8 @@ acpi_ns_report_method_error ( ...@@ -141,7 +143,8 @@ acpi_ns_report_method_error (
if (path) { 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)) { if (ACPI_FAILURE (status)) {
acpi_os_printf ("report_method_error: Could not get node\n"); acpi_os_printf ("report_method_error: Could not get node\n");
return; return;
...@@ -180,7 +183,7 @@ acpi_ns_print_node_pathname ( ...@@ -180,7 +183,7 @@ acpi_ns_print_node_pathname (
return; 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; buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
...@@ -324,13 +327,11 @@ acpi_ns_get_internal_name_length ( ...@@ -324,13 +327,11 @@ acpi_ns_get_internal_name_length (
info->fully_qualified = FALSE; info->fully_qualified = FALSE;
/* /*
* For the internal name, the required length is 4 bytes * For the internal name, the required length is 4 bytes per segment, plus
* per segment, plus 1 each for root_prefix, multi_name_prefix_op, * 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null
* segment count, trailing null (which is not really needed, * (which is not really needed, but no there's harm in putting it there)
* but no there's harm in putting it there)
* *
* strlen() + 1 covers the first name_seg, which has no * strlen() + 1 covers the first name_seg, which has no path separator
* path separator
*/ */
if (acpi_ns_valid_root_prefix (next_external_char[0])) { if (acpi_ns_valid_root_prefix (next_external_char[0])) {
info->fully_qualified = TRUE; info->fully_qualified = TRUE;
...@@ -347,10 +348,9 @@ acpi_ns_get_internal_name_length ( ...@@ -347,10 +348,9 @@ acpi_ns_get_internal_name_length (
} }
/* /*
* Determine the number of ACPI name "segments" by counting * Determine the number of ACPI name "segments" by counting the number of
* the number of path separators within the string. Start * path separators within the string. Start with one segment since the
* with one segment since the segment count is (# separators) * segment count is [(# separators) + 1], and zero separators is ok.
* + 1, and zero separators is ok.
*/ */
if (*next_external_char) { if (*next_external_char) {
info->num_segments = 1; info->num_segments = 1;
...@@ -625,7 +625,8 @@ acpi_ns_externalize_name ( ...@@ -625,7 +625,8 @@ acpi_ns_externalize_name (
/* <count> 4-byte names */ /* <count> 4-byte names */
names_index = prefix_length + 2; 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; break;
case AML_DUAL_NAME_PREFIX: case AML_DUAL_NAME_PREFIX:
...@@ -672,7 +673,7 @@ acpi_ns_externalize_name ( ...@@ -672,7 +673,7 @@ acpi_ns_externalize_name (
} }
/* /*
* Build converted_name... * Build converted_name
*/ */
*converted_name = ACPI_MEM_CALLOCATE (required_length); *converted_name = ACPI_MEM_CALLOCATE (required_length);
if (!(*converted_name)) { if (!(*converted_name)) {
...@@ -756,7 +757,7 @@ acpi_ns_map_handle_to_node ( ...@@ -756,7 +757,7 @@ acpi_ns_map_handle_to_node (
* *
* PARAMETERS: Node - Node to be converted to a Handle * 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 * DESCRIPTION: Convert a real Node to a namespace handle
* *
...@@ -976,7 +977,8 @@ acpi_ns_find_parent_name ( ...@@ -976,7 +977,8 @@ acpi_ns_find_parent_name (
parent_node = acpi_ns_get_parent_node (child_node); parent_node = acpi_ns_get_parent_node (child_node);
if (parent_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), child_node, acpi_ut_get_node_name (child_node),
parent_node, acpi_ut_get_node_name (parent_node))); parent_node, acpi_ut_get_node_name (parent_node)));
...@@ -985,7 +987,8 @@ acpi_ns_find_parent_name ( ...@@ -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))); child_node, acpi_ut_get_node_name (child_node)));
} }
...@@ -1018,11 +1021,9 @@ acpi_ns_get_parent_node ( ...@@ -1018,11 +1021,9 @@ acpi_ns_get_parent_node (
} }
/* /*
* Walk to the end of this peer list. * Walk to the end of this peer list. The last entry is marked with a flag
* The last entry is marked with a flag and the peer * and the peer pointer is really a pointer back to the parent. This saves
* pointer is really a pointer back to the parent. * putting a parent back pointer in each and every named object!
* This saves putting a parent back pointer in each and
* every named object!
*/ */
while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
node = node->peer; node = node->peer;
...@@ -1039,8 +1040,8 @@ acpi_ns_get_parent_node ( ...@@ -1039,8 +1040,8 @@ acpi_ns_get_parent_node (
* *
* PARAMETERS: Node - Current table entry * PARAMETERS: Node - Current table entry
* *
* RETURN: Next valid Node in the linked node list. NULL if no more valid * RETURN: Next valid Node in the linked node list. NULL if no more valid
* nodess * nodes.
* *
* DESCRIPTION: Find the next valid node within a name table. * DESCRIPTION: Find the next valid node within a name table.
* Useful for implementing NULL-end-of-list loops. * Useful for implementing NULL-end-of-list loops.
......
...@@ -306,10 +306,10 @@ acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) ...@@ -306,10 +306,10 @@ acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
*/ */
void void
acpi_os_sleep(u32 sec, u32 ms) acpi_os_sleep(acpi_integer ms)
{ {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(HZ * sec + (ms * HZ) / 1000); schedule_timeout(((signed long) ms * HZ) / 1000);
} }
void void
...@@ -326,6 +326,29 @@ acpi_os_stall(u32 us) ...@@ -326,6 +326,29 @@ acpi_os_stall(u32 us)
} }
} }
/*
* Support ACPI 3.0 AML Timer operand
* Returns 64-bit free-running, monotonically increasing timer
* with 100ns granularity
*/
u64
acpi_os_get_timer (void)
{
static u64 t;
#ifdef CONFIG_HPET
/* TBD: use HPET if available */
#endif
#ifdef CONFIG_X86_PM_TIMER
/* TBD: default to PM timer if HPET was not available */
#endif
if (!t)
printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n");
return(++t);
}
acpi_status acpi_status
acpi_os_read_port( acpi_os_read_port(
acpi_io_address port, acpi_io_address port,
......
...@@ -194,6 +194,7 @@ ...@@ -194,6 +194,7 @@
#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) #define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) #define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
#define ARGP_TIMER_OP ARG_NONE
#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
...@@ -325,6 +326,7 @@ ...@@ -325,6 +326,7 @@
#define ARGI_STRING_OP ARGI_INVALID_OPCODE #define ARGI_STRING_OP ARGI_INVALID_OPCODE
#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
#define ARGI_TIMER_OP ARG_NONE
#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
...@@ -527,8 +529,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -527,8 +529,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), /* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), /* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), /* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), /* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), /* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), /* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
...@@ -588,7 +590,6 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -588,7 +590,6 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), /* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), /* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* ACPI 2.0 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), /* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
...@@ -606,7 +607,11 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -606,7 +607,11 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE) /* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
/* ACPI 3.0 opcodes */
/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R)
/*! [End] no source code translation !*/ /*! [End] no source code translation !*/
}; };
...@@ -615,7 +620,6 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -615,7 +620,6 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
* This table is directly indexed by the opcodes, and returns an * This table is directly indexed by the opcodes, and returns an
* index into the table above * index into the table above
*/ */
static const u8 acpi_gbl_short_op_index[256] = static const u8 acpi_gbl_short_op_index[256] =
{ {
/* 0 1 2 3 4 5 6 7 */ /* 0 1 2 3 4 5 6 7 */
...@@ -654,7 +658,10 @@ static const u8 acpi_gbl_short_op_index[256] = ...@@ -654,7 +658,10 @@ static const u8 acpi_gbl_short_op_index[256] =
/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
}; };
/*
* This table is indexed by the second opcode of the extended opcode
* pair. It returns an index into the opcode table (acpi_gbl_aml_op_info)
*/
static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
{ {
/* 0 1 2 3 4 5 6 7 */ /* 0 1 2 3 4 5 6 7 */
...@@ -665,7 +672,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = ...@@ -665,7 +672,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, /* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
...@@ -724,7 +731,7 @@ acpi_ps_get_opcode_info ( ...@@ -724,7 +731,7 @@ acpi_ps_get_opcode_info (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", opcode)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode));
break; break;
} }
......
...@@ -129,10 +129,9 @@ union acpi_parse_object* ...@@ -129,10 +129,9 @@ union acpi_parse_object*
acpi_ps_alloc_op ( acpi_ps_alloc_op (
u16 opcode) u16 opcode)
{ {
union acpi_parse_object *op = NULL; union acpi_parse_object *op;
u32 size;
u8 flags;
const struct acpi_opcode_info *op_info; const struct acpi_opcode_info *op_info;
u8 flags = ACPI_PARSEOP_GENERIC;
ACPI_FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
...@@ -140,32 +139,28 @@ acpi_ps_alloc_op ( ...@@ -140,32 +139,28 @@ acpi_ps_alloc_op (
op_info = acpi_ps_get_opcode_info (opcode); op_info = acpi_ps_get_opcode_info (opcode);
/* Allocate the minimum required size object */ /* Determine type of parse_op required */
if (op_info->flags & AML_DEFER) { if (op_info->flags & AML_DEFER) {
size = sizeof (struct acpi_parse_obj_named);
flags = ACPI_PARSEOP_DEFERRED; flags = ACPI_PARSEOP_DEFERRED;
} }
else if (op_info->flags & AML_NAMED) { else if (op_info->flags & AML_NAMED) {
size = sizeof (struct acpi_parse_obj_named);
flags = ACPI_PARSEOP_NAMED; flags = ACPI_PARSEOP_NAMED;
} }
else if (opcode == AML_INT_BYTELIST_OP) { else if (opcode == AML_INT_BYTELIST_OP) {
size = sizeof (struct acpi_parse_obj_named);
flags = ACPI_PARSEOP_BYTELIST; flags = ACPI_PARSEOP_BYTELIST;
} }
else {
size = sizeof (struct acpi_parse_obj_common);
flags = ACPI_PARSEOP_GENERIC;
}
if (size == sizeof (struct acpi_parse_obj_common)) { /* Allocate the minimum required size object */
/*
* The generic op is by far the most common (16 to 1) 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_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
} }
else { else {
/* Extended parseop */
op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT); op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
} }
......
...@@ -74,7 +74,6 @@ acpi_rs_get_byte_stream_length ( ...@@ -74,7 +74,6 @@ acpi_rs_get_byte_stream_length (
{ {
acpi_size byte_stream_size_needed = 0; acpi_size byte_stream_size_needed = 0;
acpi_size segment_size; acpi_size segment_size;
struct acpi_resource_ext_irq *ex_irq = NULL;
u8 done = FALSE; u8 done = FALSE;
...@@ -91,8 +90,8 @@ acpi_rs_get_byte_stream_length ( ...@@ -91,8 +90,8 @@ acpi_rs_get_byte_stream_length (
case ACPI_RSTYPE_IRQ: case ACPI_RSTYPE_IRQ:
/* /*
* IRQ Resource * IRQ Resource
* For an IRQ Resource, Byte 3, although optional, will * For an IRQ Resource, Byte 3, although optional, will always be
* always be created - it holds IRQ information. * created - it holds IRQ information.
*/ */
segment_size = 4; segment_size = 4;
break; break;
...@@ -108,8 +107,8 @@ acpi_rs_get_byte_stream_length ( ...@@ -108,8 +107,8 @@ acpi_rs_get_byte_stream_length (
case ACPI_RSTYPE_START_DPF: case ACPI_RSTYPE_START_DPF:
/* /*
* Start Dependent Functions Resource * Start Dependent Functions Resource
* For a start_dependent_functions Resource, Byte 1, * For a start_dependent_functions Resource, Byte 1, although
* although optional, will always be created. * optional, will always be created.
*/ */
segment_size = 2; segment_size = 2;
break; break;
...@@ -141,10 +140,9 @@ acpi_rs_get_byte_stream_length ( ...@@ -141,10 +140,9 @@ acpi_rs_get_byte_stream_length (
case ACPI_RSTYPE_VENDOR: case ACPI_RSTYPE_VENDOR:
/* /*
* Vendor Defined Resource * Vendor Defined Resource
* For a Vendor Specific resource, if the Length is * For a Vendor Specific resource, if the Length is between 1 and 7
* between 1 and 7 it will be created as a Small * it will be created as a Small Resource data type, otherwise it
* Resource data type, otherwise it is a Large * is a Large Resource data type.
* Resource data type.
*/ */
if (linked_list->data.vendor_specific.length > 7) { if (linked_list->data.vendor_specific.length > 7) {
segment_size = 3; segment_size = 3;
...@@ -191,10 +189,9 @@ acpi_rs_get_byte_stream_length ( ...@@ -191,10 +189,9 @@ acpi_rs_get_byte_stream_length (
case ACPI_RSTYPE_ADDRESS16: case ACPI_RSTYPE_ADDRESS16:
/* /*
* 16-Bit Address Resource * 16-Bit Address Resource
* The base size of this byte stream is 16. If a * The base size of this byte stream is 16. If a Resource Source
* Resource Source string is not NULL, add 1 for * string is not NULL, add 1 for the Index + the length of the null
* the Index + the length of the null terminated * terminated string Resource Source + 1 for the null.
* string Resource Source + 1 for the null.
*/ */
segment_size = 16; segment_size = 16;
...@@ -223,10 +220,9 @@ acpi_rs_get_byte_stream_length ( ...@@ -223,10 +220,9 @@ acpi_rs_get_byte_stream_length (
case ACPI_RSTYPE_ADDRESS64: case ACPI_RSTYPE_ADDRESS64:
/* /*
* 64-Bit Address Resource * 64-Bit Address Resource
* The base size of this byte stream is 46. If a Resource * The base size of this byte stream is 46. If a resource_source
* Source string is not NULL, add 1 for the Index + the * string is not NULL, add 1 for the Index + the length of the null
* length of the null terminated string Resource Source + * terminated string Resource Source + 1 for the null.
* 1 for the null.
*/ */
segment_size = 46; segment_size = 46;
...@@ -239,9 +235,8 @@ acpi_rs_get_byte_stream_length ( ...@@ -239,9 +235,8 @@ acpi_rs_get_byte_stream_length (
case ACPI_RSTYPE_EXT_IRQ: case ACPI_RSTYPE_EXT_IRQ:
/* /*
* Extended IRQ Resource * Extended IRQ Resource
* The base size of this byte stream is 9. This is for an * The base size of this byte stream is 9. This is for an Interrupt
* Interrupt table length of 1. For each additional * table length of 1. For each additional interrupt, add 4.
* interrupt, add 4.
* If a Resource Source string is not NULL, add 1 for the * If a Resource Source string is not NULL, add 1 for the
* Index + the length of the null terminated string * Index + the length of the null terminated string
* Resource Source + 1 for the null. * Resource Source + 1 for the null.
...@@ -249,7 +244,7 @@ acpi_rs_get_byte_stream_length ( ...@@ -249,7 +244,7 @@ acpi_rs_get_byte_stream_length (
segment_size = 9 + segment_size = 9 +
(((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); (((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
if (ex_irq && ex_irq->resource_source.string_ptr) { if (linked_list->data.extended_irq.resource_source.string_ptr) {
segment_size += linked_list->data.extended_irq.resource_source.string_length; segment_size += linked_list->data.extended_irq.resource_source.string_length;
segment_size++; segment_size++;
} }
...@@ -257,8 +252,7 @@ acpi_rs_get_byte_stream_length ( ...@@ -257,8 +252,7 @@ acpi_rs_get_byte_stream_length (
default: default:
/* /*
* If we get here, everything is out of sync, * If we get here, everything is out of sync, exit with error
* so exit with an error
*/ */
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
...@@ -366,7 +360,6 @@ acpi_rs_get_list_length ( ...@@ -366,7 +360,6 @@ acpi_rs_get_list_length (
/* /*
* 32-Bit Memory Range Resource * 32-Bit Memory Range Resource
*/ */
bytes_consumed = 20; bytes_consumed = 20;
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32);
...@@ -395,14 +388,12 @@ acpi_rs_get_list_length ( ...@@ -395,14 +388,12 @@ acpi_rs_get_list_length (
bytes_consumed = temp16 + 3; bytes_consumed = temp16 + 3;
/* /*
* Resource Source Index and Resource Source are * Resource Source Index and Resource Source are optional elements.
* optional elements. Check the length of the * Check the length of the Bytestream. If it is greater than 43,
* Bytestream. If it is greater than 43, that * that means that an Index exists and is followed by a null
* means that an Index exists and is followed by * terminated string. Therefore, set the temp variable to the
* a null termininated string. Therefore, set * length minus the minimum byte stream length plus the byte for
* the temp variable to the length minus the minimum * the Index to determine the size of the NULL terminated string.
* byte stream length plus the byte for the Index to
* determine the size of the NULL terminiated string.
*/ */
if (43 < temp16) { if (43 < temp16) {
temp8 = (u8) (temp16 - 44); temp8 = (u8) (temp16 - 44);
...@@ -433,14 +424,12 @@ acpi_rs_get_list_length ( ...@@ -433,14 +424,12 @@ acpi_rs_get_list_length (
bytes_consumed = temp16 + 3; bytes_consumed = temp16 + 3;
/* /*
* Resource Source Index and Resource Source are * Resource Source Index and Resource Source are optional elements.
* optional elements. Check the length of the * Check the length of the Bytestream. If it is greater than 23,
* Bytestream. If it is greater than 23, that * that means that an Index exists and is followed by a null
* means that an Index exists and is followed by * terminated string. Therefore, set the temp variable to the
* a null termininated string. Therefore, set * length minus the minimum byte stream length plus the byte for
* the temp variable to the length minus the minimum * the Index to determine the size of the NULL terminated string.
* byte stream length plus the byte for the Index to
* determine the size of the NULL terminiated string.
*/ */
if (23 < temp16) { if (23 < temp16) {
temp8 = (u8) (temp16 - 24); temp8 = (u8) (temp16 - 24);
...@@ -471,14 +460,12 @@ acpi_rs_get_list_length ( ...@@ -471,14 +460,12 @@ acpi_rs_get_list_length (
bytes_consumed = temp16 + 3; bytes_consumed = temp16 + 3;
/* /*
* Resource Source Index and Resource Source are * Resource Source Index and Resource Source are optional elements.
* optional elements. Check the length of the * Check the length of the Bytestream. If it is greater than 13,
* Bytestream. If it is greater than 13, that * that means that an Index exists and is followed by a null
* means that an Index exists and is followed by * terminated string. Therefore, set the temp variable to the
* a null termininated string. Therefore, set * length minus the minimum byte stream length plus the byte for
* the temp variable to the length minus the minimum * the Index to determine the size of the NULL terminated string.
* byte stream length plus the byte for the Index to
* determine the size of the NULL terminiated string.
*/ */
if (13 < temp16) { if (13 < temp16) {
temp8 = (u8) (temp16 - 14); temp8 = (u8) (temp16 - 14);
...@@ -509,9 +496,8 @@ acpi_rs_get_list_length ( ...@@ -509,9 +496,8 @@ acpi_rs_get_list_length (
bytes_consumed = temp16 + 3; bytes_consumed = temp16 + 3;
/* /*
* Point past the length field and the * Point past the length field and the Interrupt vector flags to
* Interrupt vector flags to save off the * save off the Interrupt table length to the Temp8 variable.
* Interrupt table length to the Temp8 variable.
*/ */
buffer += 3; buffer += 3;
temp8 = *buffer; temp8 = *buffer;
...@@ -523,14 +509,12 @@ acpi_rs_get_list_length ( ...@@ -523,14 +509,12 @@ acpi_rs_get_list_length (
additional_bytes = (u8) ((temp8 - 1) * 4); additional_bytes = (u8) ((temp8 - 1) * 4);
/* /*
* Resource Source Index and Resource Source are * Resource Source Index and Resource Source are optional elements.
* optional elements. Check the length of the * Check the length of the Bytestream. If it is greater than 9,
* Bytestream. If it is greater than 9, that * that means that an Index exists and is followed by a null
* means that an Index exists and is followed by * terminated string. Therefore, set the temp variable to the
* a null termininated string. Therefore, set * length minus the minimum byte stream length plus the byte for
* the temp variable to the length minus the minimum * the Index to determine the size of the NULL terminated string.
* byte stream length plus the byte for the Index to
* determine the size of the NULL terminiated string.
*/ */
if (9 + additional_bytes < temp16) { if (9 + additional_bytes < temp16) {
temp8 = (u8) (temp16 - (9 + additional_bytes)); temp8 = (u8) (temp16 - (9 + additional_bytes));
...@@ -565,9 +549,8 @@ acpi_rs_get_list_length ( ...@@ -565,9 +549,8 @@ acpi_rs_get_list_length (
bytes_consumed = 3; bytes_consumed = 3;
} }
/* /* Point past the descriptor */
* Point past the descriptor
*/
++buffer; ++buffer;
/* /*
...@@ -595,9 +578,8 @@ acpi_rs_get_list_length ( ...@@ -595,9 +578,8 @@ acpi_rs_get_list_length (
buffer = byte_stream_buffer; buffer = byte_stream_buffer;
bytes_consumed = 3; bytes_consumed = 3;
/* /* Point past the descriptor */
* Point past the descriptor
*/
++buffer; ++buffer;
/* /*
......
...@@ -167,6 +167,9 @@ acpi_tb_get_table_header ( ...@@ -167,6 +167,9 @@ acpi_tb_get_table_header (
return_ACPI_STATUS (AE_BAD_PARAMETER); 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); return_ACPI_STATUS (AE_OK);
} }
......
...@@ -87,12 +87,28 @@ acpi_tb_find_table ( ...@@ -87,12 +87,28 @@ acpi_tb_find_table (
return_ACPI_STATUS (AE_AML_STRING_LIMIT); 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, table = acpi_gbl_DSDT;
ACPI_LOGICAL_ADDRESSING, &table); }
if (ACPI_FAILURE (status)) { else {
return_ACPI_STATUS (status); /* 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 */ /* Check oem_id and oem_table_id */
...@@ -102,6 +118,7 @@ acpi_tb_find_table ( ...@@ -102,6 +118,7 @@ acpi_tb_find_table (
return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature));
*table_ptr = table; *table_ptr = table;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
......
...@@ -265,7 +265,7 @@ acpi_ut_validate_buffer ( ...@@ -265,7 +265,7 @@ acpi_ut_validate_buffer (
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Validate that the buffer is of the required length or * 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 ( ...@@ -305,24 +305,25 @@ acpi_ut_initialize_buffer (
/* Allocate a new buffer with local interface to allow tracking */ /* 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) { if (!buffer->pointer) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
/* Clear the buffer */
ACPI_MEMSET (buffer->pointer, 0, required_length);
break; break;
default: default:
/* Validate the size of the buffer */ /* Existing buffer: Validate the size of the buffer */
if (buffer->length < required_length) { if (buffer->length < required_length) {
status = AE_BUFFER_OVERFLOW; status = AE_BUFFER_OVERFLOW;
break;
} }
/* Clear the buffer */
ACPI_MEMSET (buffer->pointer, 0, required_length);
break; break;
} }
...@@ -472,7 +473,7 @@ acpi_ut_allocate_and_track ( ...@@ -472,7 +473,7 @@ acpi_ut_allocate_and_track (
acpi_status status; acpi_status status;
allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_block), component, allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), component,
module, line); module, line);
if (!allocation) { if (!allocation) {
return (NULL); return (NULL);
...@@ -518,7 +519,7 @@ acpi_ut_callocate_and_track ( ...@@ -518,7 +519,7 @@ acpi_ut_callocate_and_track (
acpi_status status; acpi_status status;
allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_block), component, allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), component,
module, line); module, line);
if (!allocation) { if (!allocation) {
/* Report allocation error */ /* Report allocation error */
...@@ -712,6 +713,7 @@ acpi_ut_track_allocation ( ...@@ -712,6 +713,7 @@ acpi_ut_track_allocation (
allocation->line = line; allocation->line = line;
ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME); ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME);
allocation->module[ACPI_MAX_MODULE_NAME-1] = 0;
/* Insert at list head */ /* Insert at list head */
......
...@@ -621,6 +621,10 @@ acpi_ut_add_reference ( ...@@ -621,6 +621,10 @@ acpi_ut_add_reference (
return_VOID; return_VOID;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
"Obj %p Current Refs=%X [To Be Incremented]\n",
object, object->common.reference_count));
/* Increment the reference count */ /* Increment the reference count */
(void) acpi_ut_update_object_reference (object, REF_INCREMENT); (void) acpi_ut_update_object_reference (object, REF_INCREMENT);
...@@ -664,8 +668,9 @@ acpi_ut_remove_reference ( ...@@ -664,8 +668,9 @@ acpi_ut_remove_reference (
return_VOID; return_VOID;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
object, object->common.reference_count)); "Obj %p Current Refs=%X [To Be Decremented]\n",
object, object->common.reference_count));
/* /*
* Decrement the reference count, and only actually delete the object * Decrement the reference count, and only actually delete the object
......
...@@ -861,6 +861,7 @@ acpi_ut_init_globals ( ...@@ -861,6 +861,7 @@ acpi_ut_init_globals (
acpi_gbl_system_notify.handler = NULL; acpi_gbl_system_notify.handler = NULL;
acpi_gbl_device_notify.handler = NULL; acpi_gbl_device_notify.handler = NULL;
acpi_gbl_exception_handler = NULL;
acpi_gbl_init_handler = NULL; acpi_gbl_init_handler = NULL;
/* Global "typed" ACPI table pointers */ /* Global "typed" ACPI table pointers */
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
* *
* FUNCTION: acpi_ut_short_divide * FUNCTION: acpi_ut_short_divide
* *
* PARAMETERS: in_dividend - Pointer to the dividend * PARAMETERS: Dividend - 64-bit dividend
* Divisor - 32-bit divisor * Divisor - 32-bit divisor
* out_quotient - Pointer to where the quotient is returned * out_quotient - Pointer to where the quotient is returned
* out_remainder - Pointer to where the remainder is returned * out_remainder - Pointer to where the remainder is returned
...@@ -74,19 +74,18 @@ ...@@ -74,19 +74,18 @@
acpi_status acpi_status
acpi_ut_short_divide ( acpi_ut_short_divide (
acpi_integer *in_dividend, acpi_integer dividend,
u32 divisor, u32 divisor,
acpi_integer *out_quotient, acpi_integer *out_quotient,
u32 *out_remainder) u32 *out_remainder)
{ {
union uint64_overlay dividend; union uint64_overlay dividend_ovl;
union uint64_overlay quotient; union uint64_overlay quotient;
u32 remainder32; u32 remainder32;
ACPI_FUNCTION_TRACE ("ut_short_divide"); ACPI_FUNCTION_TRACE ("ut_short_divide");
dividend.full = *in_dividend;
/* Always check for a zero divisor */ /* Always check for a zero divisor */
...@@ -95,13 +94,15 @@ acpi_ut_short_divide ( ...@@ -95,13 +94,15 @@ acpi_ut_short_divide (
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
} }
dividend_ovl.full = dividend;
/* /*
* The quotient is 64 bits, the remainder is always 32 bits, * The quotient is 64 bits, the remainder is always 32 bits,
* and is generated by the second divide. * and is generated by the second divide.
*/ */
ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor, ACPI_DIV_64_BY_32 (0, dividend_ovl.part.hi, divisor,
quotient.part.hi, remainder32); quotient.part.hi, remainder32);
ACPI_DIV_64_BY_32 (remainder32, dividend.part.lo, divisor, ACPI_DIV_64_BY_32 (remainder32, dividend_ovl.part.lo, divisor,
quotient.part.lo, remainder32); quotient.part.lo, remainder32);
/* Return only what was requested */ /* Return only what was requested */
...@@ -121,8 +122,8 @@ acpi_ut_short_divide ( ...@@ -121,8 +122,8 @@ acpi_ut_short_divide (
* *
* FUNCTION: acpi_ut_divide * FUNCTION: acpi_ut_divide
* *
* PARAMETERS: in_dividend - Pointer to the dividend * PARAMETERS: in_dividend - Dividend
* in_divisor - Pointer to the divisor * in_divisor - Divisor
* out_quotient - Pointer to where the quotient is returned * out_quotient - Pointer to where the quotient is returned
* out_remainder - Pointer to where the remainder is returned * out_remainder - Pointer to where the remainder is returned
* *
...@@ -134,8 +135,8 @@ acpi_ut_short_divide ( ...@@ -134,8 +135,8 @@ acpi_ut_short_divide (
acpi_status acpi_status
acpi_ut_divide ( acpi_ut_divide (
acpi_integer *in_dividend, acpi_integer in_dividend,
acpi_integer *in_divisor, acpi_integer in_divisor,
acpi_integer *out_quotient, acpi_integer *out_quotient,
acpi_integer *out_remainder) acpi_integer *out_remainder)
{ {
...@@ -155,13 +156,13 @@ acpi_ut_divide ( ...@@ -155,13 +156,13 @@ acpi_ut_divide (
/* Always check for a zero divisor */ /* Always check for a zero divisor */
if (*in_divisor == 0) { if (in_divisor == 0) {
ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
} }
divisor.full = *in_divisor; divisor.full = in_divisor;
dividend.full = *in_dividend; dividend.full = in_dividend;
if (divisor.part.hi == 0) { if (divisor.part.hi == 0) {
/* /*
* 1) Simplest case is where the divisor is 32 bits, we can * 1) Simplest case is where the divisor is 32 bits, we can
...@@ -269,7 +270,7 @@ acpi_ut_divide ( ...@@ -269,7 +270,7 @@ acpi_ut_divide (
acpi_status acpi_status
acpi_ut_short_divide ( acpi_ut_short_divide (
acpi_integer *in_dividend, acpi_integer in_dividend,
u32 divisor, u32 divisor,
acpi_integer *out_quotient, acpi_integer *out_quotient,
u32 *out_remainder) u32 *out_remainder)
...@@ -288,10 +289,10 @@ acpi_ut_short_divide ( ...@@ -288,10 +289,10 @@ acpi_ut_short_divide (
/* Return only what was requested */ /* Return only what was requested */
if (out_quotient) { if (out_quotient) {
*out_quotient = *in_dividend / divisor; *out_quotient = in_dividend / divisor;
} }
if (out_remainder) { if (out_remainder) {
*out_remainder = (u32) *in_dividend % divisor; *out_remainder = (u32) in_dividend % divisor;
} }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -299,8 +300,8 @@ acpi_ut_short_divide ( ...@@ -299,8 +300,8 @@ acpi_ut_short_divide (
acpi_status acpi_status
acpi_ut_divide ( acpi_ut_divide (
acpi_integer *in_dividend, acpi_integer in_dividend,
acpi_integer *in_divisor, acpi_integer in_divisor,
acpi_integer *out_quotient, acpi_integer *out_quotient,
acpi_integer *out_remainder) acpi_integer *out_remainder)
{ {
...@@ -309,7 +310,7 @@ acpi_ut_divide ( ...@@ -309,7 +310,7 @@ acpi_ut_divide (
/* Always check for a zero divisor */ /* Always check for a zero divisor */
if (*in_divisor == 0) { if (in_divisor == 0) {
ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
} }
...@@ -318,10 +319,10 @@ acpi_ut_divide ( ...@@ -318,10 +319,10 @@ acpi_ut_divide (
/* Return only what was requested */ /* Return only what was requested */
if (out_quotient) { if (out_quotient) {
*out_quotient = *in_dividend / *in_divisor; *out_quotient = in_dividend / in_divisor;
} }
if (out_remainder) { if (out_remainder) {
*out_remainder = *in_dividend % *in_divisor; *out_remainder = in_dividend % in_divisor;
} }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
......
...@@ -356,16 +356,15 @@ acpi_ut_valid_acpi_character ( ...@@ -356,16 +356,15 @@ acpi_ut_valid_acpi_character (
* FUNCTION: acpi_ut_strtoul64 * FUNCTION: acpi_ut_strtoul64
* *
* PARAMETERS: String - Null terminated string * PARAMETERS: String - Null terminated string
* Terminater - Where a pointer to the terminating byte is returned * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE
* Base - Radix of the string * ret_integer - Where the converted integer is returned
* *
* RETURN: Converted value * RETURN: Status and Converted value
* *
* DESCRIPTION: Convert a string into an unsigned value. * DESCRIPTION: Convert a string into an unsigned value.
* NOTE: Does not support Octal strings, not needed.
* *
******************************************************************************/ ******************************************************************************/
#define NEGATIVE 1
#define POSITIVE 0
acpi_status acpi_status
acpi_ut_strtoul64 ( acpi_ut_strtoul64 (
...@@ -373,50 +372,40 @@ acpi_ut_strtoul64 ( ...@@ -373,50 +372,40 @@ acpi_ut_strtoul64 (
u32 base, u32 base,
acpi_integer *ret_integer) acpi_integer *ret_integer)
{ {
u32 index; u32 this_digit;
acpi_integer return_value = 0; acpi_integer return_value = 0;
acpi_status status = AE_OK;
acpi_integer dividend;
acpi_integer quotient; acpi_integer quotient;
*ret_integer = 0; ACPI_FUNCTION_TRACE ("ut_stroul64");
switch (base) { switch (base) {
case 0: case ACPI_ANY_BASE:
case 8:
case 10: case 10:
case 16: case 16:
break; break;
default: default:
/* /* Invalid Base */
* The specified Base parameter is not in the domain of return_ACPI_STATUS (AE_BAD_PARAMETER);
* this function:
*/
return (AE_BAD_PARAMETER);
} }
/* /* Skip over any white space in the buffer */
* skip over any white space in the buffer:
*/
while (ACPI_IS_SPACE (*string) || *string == '\t') { while (ACPI_IS_SPACE (*string) || *string == '\t') {
++string; ++string;
} }
/* /*
* If the input parameter Base is zero, then we need to * If the input parameter Base is zero, then we need to
* determine if it is octal, decimal, or hexadecimal: * determine if it is decimal or hexadecimal:
*/ */
if (base == 0) { if (base == 0) {
if (*string == '0') { if ((*string == '0') &&
if (ACPI_TOLOWER (*(++string)) == 'x') { (ACPI_TOLOWER (*(++string)) == 'x')) {
base = 16; base = 16;
++string; ++string;
}
else {
base = 8;
}
} }
else { else {
base = 10; base = 10;
...@@ -424,76 +413,67 @@ acpi_ut_strtoul64 ( ...@@ -424,76 +413,67 @@ acpi_ut_strtoul64 (
} }
/* /*
* For octal and hexadecimal bases, skip over the leading * For hexadecimal base, skip over the leading
* 0 or 0x, if they are present. * 0 or 0x, if they are present.
*/ */
if (base == 8 && *string == '0') {
string++;
}
if (base == 16 && if (base == 16 &&
*string == '0' && *string == '0' &&
ACPI_TOLOWER (*(++string)) == 'x') { ACPI_TOLOWER (*(++string)) == 'x') {
string++; string++;
} }
/* Main loop: convert the string to an unsigned long */ /* Main loop: convert the string to a 64-bit integer */
while (*string) { while (*string) {
if (ACPI_IS_DIGIT (*string)) { if (ACPI_IS_DIGIT (*string)) {
index = ((u8) *string) - '0'; /* Convert ASCII 0-9 to Decimal value */
this_digit = ((u8) *string) - '0';
} }
else { else {
index = (u8) ACPI_TOUPPER (*string); this_digit = (u8) ACPI_TOUPPER (*string);
if (ACPI_IS_UPPER ((char) index)) { if (ACPI_IS_UPPER ((char) this_digit)) {
index = index - 'A' + 10; /* Convert ASCII Hex char to value */
this_digit = this_digit - 'A' + 10;
} }
else { else {
goto error_exit; goto error_exit;
} }
} }
if (index >= base) { /* Check to see if digit is out of range */
if (this_digit >= base) {
goto error_exit; goto error_exit;
} }
/* Check to see if value is out of range: */ /* Divide the digit into the correct position */
dividend = ACPI_INTEGER_MAX - (acpi_integer) index; (void) acpi_ut_short_divide ((ACPI_INTEGER_MAX - (acpi_integer) this_digit),
(void) acpi_ut_short_divide (&dividend, base, &quotient, NULL); base, &quotient, NULL);
if (return_value > quotient) { if (return_value > quotient) {
goto error_exit; goto error_exit;
} }
return_value *= base; return_value *= base;
return_value += index; return_value += this_digit;
++string; ++string;
} }
*ret_integer = return_value; *ret_integer = return_value;
return (status); return_ACPI_STATUS (AE_OK);
error_exit: error_exit:
switch (base) { /* Base was set/validated above */
case 8:
status = AE_BAD_OCTAL_CONSTANT;
break;
case 10:
status = AE_BAD_DECIMAL_CONSTANT;
break;
case 16:
status = AE_BAD_HEX_CONSTANT;
break;
default: if (base == 10) {
/* Base validated above */ return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
break; }
else {
return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
} }
return (status);
} }
......
...@@ -155,9 +155,8 @@ acpi_ut_create_buffer_object ( ...@@ -155,9 +155,8 @@ acpi_ut_create_buffer_object (
ACPI_FUNCTION_TRACE_U32 ("ut_create_buffer_object", buffer_size); ACPI_FUNCTION_TRACE_U32 ("ut_create_buffer_object", buffer_size);
/* /* Create a new Buffer object */
* Create a new Buffer object
*/
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!buffer_desc) { if (!buffer_desc) {
return_PTR (NULL); return_PTR (NULL);
...@@ -189,6 +188,61 @@ acpi_ut_create_buffer_object ( ...@@ -189,6 +188,61 @@ acpi_ut_create_buffer_object (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ut_create_string_object
*
* PARAMETERS: string_size - Size of string to be created. Does not
* include NULL terminator, this is added
* automatically.
*
* RETURN: Pointer to a new String object
*
* DESCRIPTION: Create a fully initialized string object
*
******************************************************************************/
union acpi_operand_object *
acpi_ut_create_string_object (
acpi_size string_size)
{
union acpi_operand_object *string_desc;
char *string;
ACPI_FUNCTION_TRACE_U32 ("ut_create_string_object", string_size);
/* Create a new String object */
string_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
if (!string_desc) {
return_PTR (NULL);
}
/*
* Allocate the actual string buffer -- (Size + 1) for NULL terminator.
* NOTE: Zero-length strings are NULL terminated
*/
string = ACPI_MEM_CALLOCATE (string_size + 1);
if (!string) {
ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n",
(u32) string_size));
acpi_ut_remove_reference (string_desc);
return_PTR (NULL);
}
/* Complete string object initialization */
string_desc->string.pointer = string;
string_desc->string.length = (u32) string_size;
/* Return the new string descriptor */
return_PTR (string_desc);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ut_valid_internal_object * FUNCTION: acpi_ut_valid_internal_object
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20040816 #define ACPI_CA_VERSION 0x20041015
/* /*
* OS name, used for the _OS object. The _OS object is essentially obsolete, * 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]; ...@@ -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_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_device_notify;
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_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 acpi_init_handler acpi_gbl_init_handler;
ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
......
...@@ -83,21 +83,25 @@ acpi_status ...@@ -83,21 +83,25 @@ acpi_status
acpi_ex_convert_to_integer ( acpi_ex_convert_to_integer (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, union acpi_operand_object **result_desc,
struct acpi_walk_state *walk_state); u32 flags);
acpi_status acpi_status
acpi_ex_convert_to_buffer ( acpi_ex_convert_to_buffer (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, union acpi_operand_object **result_desc);
struct acpi_walk_state *walk_state);
acpi_status acpi_status
acpi_ex_convert_to_string ( acpi_ex_convert_to_string (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, union acpi_operand_object **result_desc,
u32 base, u32 type);
u32 max_length,
struct acpi_walk_state *walk_state); /* Types for ->String conversion */
#define ACPI_EXPLICIT_BYTE_COPY 0x00000000
#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
acpi_status acpi_status
acpi_ex_convert_to_target_type ( acpi_ex_convert_to_target_type (
...@@ -109,7 +113,7 @@ acpi_ex_convert_to_target_type ( ...@@ -109,7 +113,7 @@ acpi_ex_convert_to_target_type (
u32 u32
acpi_ex_convert_to_ascii ( acpi_ex_convert_to_ascii (
acpi_integer integer, acpi_integer integer,
u32 base, u16 base,
u8 *string, u8 *string,
u8 max_length); u8 max_length);
...@@ -243,11 +247,19 @@ acpi_ex_do_concatenate ( ...@@ -243,11 +247,19 @@ acpi_ex_do_concatenate (
union acpi_operand_object **actual_return_desc, union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state); struct acpi_walk_state *walk_state);
u8 acpi_status
acpi_ex_do_logical_numeric_op (
u16 opcode,
acpi_integer integer0,
acpi_integer integer1,
u8 *logical_result);
acpi_status
acpi_ex_do_logical_op ( acpi_ex_do_logical_op (
u16 opcode, u16 opcode,
union acpi_operand_object *obj_desc, union acpi_operand_object *operand0,
union acpi_operand_object *obj_desc2); union acpi_operand_object *operand1,
u8 *logical_result);
acpi_integer acpi_integer
acpi_ex_do_math_op ( acpi_ex_do_math_op (
...@@ -374,7 +386,7 @@ acpi_ex_system_do_notify_op ( ...@@ -374,7 +386,7 @@ acpi_ex_system_do_notify_op (
acpi_status acpi_status
acpi_ex_system_do_suspend( acpi_ex_system_do_suspend(
u32 time); acpi_integer time);
acpi_status acpi_status
acpi_ex_system_do_stall ( acpi_ex_system_do_stall (
...@@ -412,6 +424,10 @@ acpi_ex_system_wait_semaphore ( ...@@ -412,6 +424,10 @@ acpi_ex_system_wait_semaphore (
* exmonadic - ACPI AML (p-code) execution, monadic operators * exmonadic - ACPI AML (p-code) execution, monadic operators
*/ */
acpi_status
acpi_ex_opcode_0A_0T_1R (
struct acpi_walk_state *walk_state);
acpi_status acpi_status
acpi_ex_opcode_1A_0T_0R ( acpi_ex_opcode_1A_0T_0R (
struct acpi_walk_state *walk_state); struct acpi_walk_state *walk_state);
......
...@@ -53,7 +53,7 @@ typedef u32 acpi_mutex_handle; ...@@ -53,7 +53,7 @@ typedef u32 acpi_mutex_handle;
/* Total number of aml opcodes defined */ /* Total number of aml opcodes defined */
#define AML_NUM_OPCODES 0x7E #define AML_NUM_OPCODES 0x7F
/***************************************************************************** /*****************************************************************************
......
...@@ -135,7 +135,10 @@ struct acpi_object_integer ...@@ -135,7 +135,10 @@ struct acpi_object_integer
acpi_integer value; acpi_integer value;
}; };
/*
* Note: The String and Buffer object must be identical through the Pointer
* element. There is code that depends on this.
*/
struct acpi_object_string /* Null terminated, ASCII characters only */ struct acpi_object_string /* Null terminated, ASCII characters only */
{ {
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_COMMON_HEADER
......
...@@ -216,10 +216,13 @@ void ...@@ -216,10 +216,13 @@ void
acpi_os_wait_events_complete( acpi_os_wait_events_complete(
void * context); void * context);
void
acpi_os_wait_events_complete (
void *context);
void void
acpi_os_sleep ( acpi_os_sleep (
u32 seconds, acpi_integer milliseconds);
u32 milliseconds);
void void
acpi_os_stall ( acpi_os_stall (
...@@ -304,7 +307,7 @@ acpi_os_writable ( ...@@ -304,7 +307,7 @@ acpi_os_writable (
void *pointer, void *pointer,
acpi_size length); acpi_size length);
u32 u64
acpi_os_get_timer ( acpi_os_get_timer (
void); void);
......
...@@ -299,6 +299,15 @@ acpi_install_gpe_handler ( ...@@ -299,6 +299,15 @@ acpi_install_gpe_handler (
acpi_event_handler address, acpi_event_handler address,
void *context); void *context);
acpi_status
acpi_install_exception_handler (
acpi_exception_handler handler);
/*
* Event interfaces
*/
acpi_status acpi_status
acpi_acquire_global_lock ( acpi_acquire_global_lock (
u16 timeout, u16 timeout,
......
...@@ -303,7 +303,7 @@ struct uint32_struct ...@@ -303,7 +303,7 @@ struct uint32_struct
typedef u32 acpi_integer; typedef u32 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT32_MAX #define ACPI_INTEGER_MAX ACPI_UINT32_MAX
#define ACPI_INTEGER_BIT_SIZE 32 #define ACPI_INTEGER_BIT_SIZE 32
#define ACPI_MAX_DECIMAL_DIGITS 10 #define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
...@@ -315,13 +315,18 @@ typedef u32 acpi_integer; ...@@ -315,13 +315,18 @@ typedef u32 acpi_integer;
typedef u64 acpi_integer; typedef u64 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64 #define ACPI_INTEGER_BIT_SIZE 64
#define ACPI_MAX_DECIMAL_DIGITS 19 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
#if ACPI_MACHINE_WIDTH == 64 #if ACPI_MACHINE_WIDTH == 64
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
#endif #endif
#endif #endif
#define ACPI_MAX64_DECIMAL_DIGITS 20
#define ACPI_MAX32_DECIMAL_DIGITS 10
#define ACPI_MAX16_DECIMAL_DIGITS 5
#define ACPI_MAX8_DECIMAL_DIGITS 3
/* /*
* Constants with special meanings * Constants with special meanings
...@@ -831,6 +836,14 @@ acpi_status (*acpi_init_handler) ( ...@@ -831,6 +836,14 @@ acpi_status (*acpi_init_handler) (
#define ACPI_INIT_DEVICE_INI 1 #define ACPI_INIT_DEVICE_INI 1
typedef
acpi_status (*acpi_exception_handler) (
acpi_status aml_status,
acpi_name name,
u16 opcode,
u32 aml_offset,
void *context);
/* Address Spaces (For Operation Regions) */ /* Address Spaces (For Operation Regions) */
......
...@@ -177,6 +177,12 @@ acpi_ut_strncpy ( ...@@ -177,6 +177,12 @@ acpi_ut_strncpy (
const char *src_string, const char *src_string,
acpi_size count); acpi_size count);
int
acpi_ut_memcmp (
const char *buffer1,
const char *buffer2,
acpi_size count);
int int
acpi_ut_strncmp ( acpi_ut_strncmp (
const char *string1, const char *string1,
...@@ -577,6 +583,10 @@ union acpi_operand_object * ...@@ -577,6 +583,10 @@ union acpi_operand_object *
acpi_ut_create_buffer_object ( acpi_ut_create_buffer_object (
acpi_size buffer_size); acpi_size buffer_size);
union acpi_operand_object *
acpi_ut_create_string_object (
acpi_size string_size);
/* /*
* ut_ref_cnt - Object reference count management * ut_ref_cnt - Object reference count management
...@@ -690,14 +700,14 @@ acpi_ut_print_string ( ...@@ -690,14 +700,14 @@ acpi_ut_print_string (
acpi_status acpi_status
acpi_ut_divide ( acpi_ut_divide (
acpi_integer *in_dividend, acpi_integer in_dividend,
acpi_integer *in_divisor, acpi_integer in_divisor,
acpi_integer *out_quotient, acpi_integer *out_quotient,
acpi_integer *out_remainder); acpi_integer *out_remainder);
acpi_status acpi_status
acpi_ut_short_divide ( acpi_ut_short_divide (
acpi_integer *in_dividend, acpi_integer in_dividend,
u32 divisor, u32 divisor,
acpi_integer *out_quotient, acpi_integer *out_quotient,
u32 *out_remainder); u32 *out_remainder);
...@@ -716,6 +726,10 @@ acpi_ut_strtoul64 ( ...@@ -716,6 +726,10 @@ acpi_ut_strtoul64 (
u32 base, u32 base,
acpi_integer *ret_integer); acpi_integer *ret_integer);
/* Values for Base above (16=Hex, 10=Decimal) */
#define ACPI_ANY_BASE 0
char * char *
acpi_ut_strupr ( acpi_ut_strupr (
char *src_string); char *src_string);
......
...@@ -170,6 +170,7 @@ ...@@ -170,6 +170,7 @@
#define AML_REVISION_OP (u16) 0x5b30 #define AML_REVISION_OP (u16) 0x5b30
#define AML_DEBUG_OP (u16) 0x5b31 #define AML_DEBUG_OP (u16) 0x5b31
#define AML_FATAL_OP (u16) 0x5b32 #define AML_FATAL_OP (u16) 0x5b32
#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */
#define AML_REGION_OP (u16) 0x5b80 #define AML_REGION_OP (u16) 0x5b80
#define AML_FIELD_OP (u16) 0x5b81 #define AML_FIELD_OP (u16) 0x5b81
#define AML_DEVICE_OP (u16) 0x5b82 #define AML_DEVICE_OP (u16) 0x5b82
...@@ -305,22 +306,24 @@ ...@@ -305,22 +306,24 @@
/* Opcode flags */ /* Opcode flags */
#define AML_HAS_ARGS 0x0800
#define AML_HAS_TARGET 0x0400
#define AML_HAS_RETVAL 0x0200
#define AML_NSOBJECT 0x0100
#define AML_NSOPCODE 0x0080
#define AML_NSNODE 0x0040
#define AML_NAMED 0x0020
#define AML_DEFER 0x0010
#define AML_FIELD 0x0008
#define AML_CREATE 0x0004
#define AML_MATH 0x0002
#define AML_LOGICAL 0x0001 #define AML_LOGICAL 0x0001
#define AML_CONSTANT 0x1000 #define AML_LOGICAL_NUMERIC 0x0002
#define AML_MATH 0x0004
#define AML_CREATE 0x0008
#define AML_FIELD 0x0010
#define AML_DEFER 0x0020
#define AML_NAMED 0x0040
#define AML_NSNODE 0x0080
#define AML_NSOPCODE 0x0100
#define AML_NSOBJECT 0x0200
#define AML_HAS_RETVAL 0x0400
#define AML_HAS_TARGET 0x0800
#define AML_HAS_ARGS 0x1000
#define AML_CONSTANT 0x2000
/* Convenient flag groupings */ /* Convenient flag groupings */
#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL
#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ #define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ #define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
...@@ -338,17 +341,18 @@ ...@@ -338,17 +341,18 @@
* The opcode Type is used in a dispatch table, do not change * The opcode Type is used in a dispatch table, do not change
* without updating the table. * without updating the table.
*/ */
#define AML_TYPE_EXEC_1A_0T_0R 0x00 /* Monadic1 */ #define AML_TYPE_EXEC_0A_0T_1R 0x00
#define AML_TYPE_EXEC_1A_0T_1R 0x01 /* Monadic2 */ #define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */
#define AML_TYPE_EXEC_1A_1T_0R 0x02 #define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */
#define AML_TYPE_EXEC_1A_1T_1R 0x03 /* monadic2_r */ #define AML_TYPE_EXEC_1A_1T_0R 0x03
#define AML_TYPE_EXEC_2A_0T_0R 0x04 /* Dyadic1 */ #define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */
#define AML_TYPE_EXEC_2A_0T_1R 0x05 /* Dyadic2 */ #define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */
#define AML_TYPE_EXEC_2A_1T_1R 0x06 /* dyadic2_r */ #define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */
#define AML_TYPE_EXEC_2A_2T_1R 0x07 #define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */
#define AML_TYPE_EXEC_3A_0T_0R 0x08 #define AML_TYPE_EXEC_2A_2T_1R 0x08
#define AML_TYPE_EXEC_3A_1T_1R 0x09 #define AML_TYPE_EXEC_3A_0T_0R 0x09
#define AML_TYPE_EXEC_6A_0T_1R 0x0A #define AML_TYPE_EXEC_3A_1T_1R 0x0A
#define AML_TYPE_EXEC_6A_0T_1R 0x0B
/* End of types used in dispatch table */ /* End of types used in dispatch table */
#define AML_TYPE_LITERAL 0x0B #define AML_TYPE_LITERAL 0x0B
......
...@@ -99,7 +99,7 @@ struct asl_resource_node ...@@ -99,7 +99,7 @@ struct asl_resource_node
/* /*
* Resource descriptors defined in the ACPI specification. * Resource descriptors defined in the ACPI specification.
* *
* Alignment must be BYTE because these descriptors * Packing/alignment must be BYTE because these descriptors
* are used to overlay the AML byte stream. * are used to overlay the AML byte stream.
*/ */
#pragma pack(1) #pragma pack(1)
...@@ -297,7 +297,7 @@ struct asl_general_register_desc ...@@ -297,7 +297,7 @@ struct asl_general_register_desc
#pragma pack() #pragma pack()
/* Union of all resource descriptors, sow we can allocate the worst case */ /* Union of all resource descriptors, so we can allocate the worst case */
union asl_resource_desc union asl_resource_desc
{ {
......
...@@ -232,6 +232,7 @@ ...@@ -232,6 +232,7 @@
#define ACPI_STRCAT(d,s) (void) strcat((d), (s)) #define ACPI_STRCAT(d,s) (void) strcat((d), (s))
#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n))
#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n))
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n))
...@@ -295,6 +296,7 @@ typedef char *va_list; ...@@ -295,6 +296,7 @@ typedef char *va_list;
#define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s))
#define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n))
#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n))
#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
#define ACPI_TOUPPER acpi_ut_to_upper #define ACPI_TOUPPER acpi_ut_to_upper
......
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