Commit 8d7b2d68 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] ACPICA 20040827 update from Bob Moore

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

Implemented support for implicit object conversion in
the non-numeric logical operators (LEqual, LGreater,
LGreaterEqual, LLess, LLessEqual, and LNotEqual.) Any
combination of Integers/Strings/Buffers may now be used;
the second operand is implicitly converted on the fly to
match the type of the first operand.  For example:

LEqual (Source1, Source2)

Source1 and Source2 must each evaluate to an integer, a
string, or a buffer. The data type of Source1 dictates the
required type of Source2.  Source2 is implicitly converted
if necessary to match the type of Source1.

Updated and corrected the behavior of the string
conversion support.  The rules concerning conversion of
buffers to strings (according to the ACPI specification)
are as follows:

ToDecimalString - explicit byte-wise conversion of buffer
to string of decimal values (0-255) separated by commas.

ToHexString - explicit byte-wise conversion of buffer to
string of hex values (0-FF) separated by commas.

ToString - explicit byte-wise conversion of buffer to
string.  Byte-by-byte copy with no transform except NULL
terminated.  Any other implicit buffer-to-string conversion

byte-wise conversion of buffer to string of hex values
(0-FF) separated by spaces.

Fixed a problem in acpi_ns_get_pathname_length where the
returned length was one byte too short in the case of a
node in the root scope.  This could cause a fault during
debug output.
parent 66f57430
...@@ -639,7 +639,8 @@ acpi_ds_exec_end_op ( ...@@ -639,7 +639,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)) {
......
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.
...@@ -344,7 +344,7 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -344,7 +344,7 @@ acpi_ex_opcode_1A_1T_1R (
/* Insert the BCD digit that resides in the remainder from above */ /* Insert the BCD digit that resides in the remainder from above */
return_desc->integer.value |= (((acpi_integer) temp32) << (i * 4)); return_desc->integer.value |= (((acpi_integer) temp32) << ACPI_MUL_4 (i));
} }
/* Overflow if there is any data left in Digit */ /* Overflow if there is any data left in Digit */
...@@ -429,31 +429,36 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -429,31 +429,36 @@ acpi_ex_opcode_1A_1T_1R (
*/ */
case AML_COPY_OP: /* Copy (Source, Target) */ case AML_COPY_OP: /* Copy (Source, Target) */
status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc, walk_state); status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc,
walk_state);
break; break;
case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */
status = acpi_ex_convert_to_string (operand[0], &return_desc, 10, ACPI_UINT32_MAX, walk_state); status = acpi_ex_convert_to_string (operand[0], &return_desc,
ACPI_EXPLICIT_CONVERT_DECIMAL, walk_state->opcode);
break; break;
case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */
status = acpi_ex_convert_to_string (operand[0], &return_desc, 16, ACPI_UINT32_MAX, walk_state); status = acpi_ex_convert_to_string (operand[0], &return_desc,
ACPI_EXPLICIT_CONVERT_HEX, walk_state->opcode);
break; break;
case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */
status = acpi_ex_convert_to_buffer (operand[0], &return_desc, walk_state); status = acpi_ex_convert_to_buffer (operand[0], &return_desc,
walk_state->opcode);
break; break;
case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */
status = acpi_ex_convert_to_integer (operand[0], &return_desc, walk_state); status = acpi_ex_convert_to_integer (operand[0], &return_desc,
walk_state->opcode);
break; break;
...@@ -463,8 +468,9 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -463,8 +468,9 @@ acpi_ex_opcode_1A_1T_1R (
/* /*
* These are two obsolete opcodes * These are two obsolete opcodes
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
acpi_ps_get_opcode_name (walk_state->opcode))); "%s is obsolete and not implemented\n",
acpi_ps_get_opcode_name (walk_state->opcode)));
status = AE_SUPPORT; status = AE_SUPPORT;
goto cleanup; goto cleanup;
......
...@@ -292,7 +292,6 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -292,7 +292,6 @@ 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;
...@@ -331,52 +330,15 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -331,52 +330,15 @@ 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,
&operand[1]->integer.value,
NULL, &return_desc->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], &return_desc, walk_state);
* Convert the second operand if necessary. The first operand
* 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;
...@@ -407,35 +369,25 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -407,35 +369,25 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup; goto cleanup;
} }
/* Create the internal return object */ /* Allocate a new string (Length + 1 for null terminator) */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING); return_desc = acpi_ut_create_string_object (length + 1);
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 +410,8 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -458,7 +410,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 +425,8 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -472,7 +425,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;
...@@ -572,18 +526,15 @@ acpi_ex_opcode_2A_0T_1R ( ...@@ -572,18 +526,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;
} }
......
...@@ -398,7 +398,8 @@ acpi_ex_resolve_operands ( ...@@ -398,7 +398,8 @@ 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,
walk_state->opcode);
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,8 @@ acpi_ex_resolve_operands ( ...@@ -420,7 +421,8 @@ 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,
walk_state->opcode);
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 +444,8 @@ acpi_ex_resolve_operands ( ...@@ -442,7 +444,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, walk_state->opcode);
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 +497,8 @@ acpi_ex_resolve_operands ( ...@@ -494,7 +497,8 @@ 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,
walk_state->opcode);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -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 */
} }
......
...@@ -527,8 +527,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -527,8 +527,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),
......
...@@ -472,7 +472,7 @@ acpi_ut_allocate_and_track ( ...@@ -472,7 +472,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 +518,7 @@ acpi_ut_callocate_and_track ( ...@@ -518,7 +518,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 +712,7 @@ acpi_ut_track_allocation ( ...@@ -712,6 +712,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 */
......
...@@ -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,63 @@ acpi_ut_create_buffer_object ( ...@@ -189,6 +188,63 @@ acpi_ut_create_buffer_object (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ut_create_string_object
*
* PARAMETERS: string_size - Size of string to be created, plus one
* for the NULL terminater. Actual sting
* length will be this size minus one.
*
* 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 = NULL;
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);
}
/* Create an actual string only if size > 0 */
if (string_size > 0) {
/* Allocate the actual string */
string = ACPI_MEM_CALLOCATE (string_size);
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 - 1;
/* 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 0x20040827
/* /*
* 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,
......
...@@ -83,21 +83,27 @@ acpi_status ...@@ -83,21 +83,27 @@ 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); u16 opcode);
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); u16 opcode);
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, u16 opcode);
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 +115,7 @@ acpi_ex_convert_to_target_type ( ...@@ -109,7 +115,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 +249,19 @@ acpi_ex_do_concatenate ( ...@@ -243,11 +249,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 (
......
...@@ -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
......
...@@ -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
......
...@@ -577,6 +577,10 @@ union acpi_operand_object * ...@@ -577,6 +577,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
......
...@@ -305,19 +305,20 @@ ...@@ -305,19 +305,20 @@
/* 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 */
......
...@@ -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
{ {
......
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