Commit dc95a270 authored by Bob Moore's avatar Bob Moore Committed by Len Brown

ACPICA: Deploy new create integer interface where appropriate

Simplifies creation of simple integer objects.
ACPICA BZ 823.

http://www.acpica.org/bugzilla/show_bug.cgi?id=823Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 502f7efa
...@@ -409,13 +409,11 @@ acpi_ds_method_data_get_value(u8 type, ...@@ -409,13 +409,11 @@ acpi_ds_method_data_get_value(u8 type,
/* If slack enabled, init the local_x/arg_x to an Integer of value zero */ /* If slack enabled, init the local_x/arg_x to an Integer of value zero */
if (acpi_gbl_enable_interpreter_slack) { if (acpi_gbl_enable_interpreter_slack) {
object = object = acpi_ut_create_integer_object((u64) 0);
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!object) { if (!object) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
object->integer.value = 0;
node->object = object; node->object = object;
} }
......
...@@ -289,23 +289,20 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) ...@@ -289,23 +289,20 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
* connection status 1 for connecting the handler, 0 for disconnecting * connection status 1 for connecting the handler, 0 for disconnecting
* the handler (Passed as a parameter) * the handler (Passed as a parameter)
*/ */
args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); args[0] =
acpi_ut_create_integer_object((u64) region_obj->region.space_id);
if (!args[0]) { if (!args[0]) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup1; goto cleanup1;
} }
args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); args[1] = acpi_ut_create_integer_object((u64) function);
if (!args[1]) { if (!args[1]) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup2; goto cleanup2;
} }
/* Setup the parameter objects */ args[2] = NULL; /* Terminate list */
args[0]->integer.value = region_obj->region.space_id;
args[1]->integer.value = function;
args[2] = NULL;
/* Execute the method, no return value */ /* Execute the method, no return value */
......
...@@ -170,14 +170,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, ...@@ -170,14 +170,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
/* Table not found, return an Integer=0 and AE_OK */ /* Table not found, return an Integer=0 and AE_OK */
ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); ddb_handle = acpi_ut_create_integer_object((u64) 0);
if (!ddb_handle) { if (!ddb_handle) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
ddb_handle->integer.value = 0;
*return_desc = ddb_handle; *return_desc = ddb_handle;
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
......
...@@ -167,7 +167,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, ...@@ -167,7 +167,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
/* Create a new integer */ /* Create a new integer */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_integer_object(result);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
...@@ -177,7 +177,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, ...@@ -177,7 +177,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
/* Save the Result */ /* Save the Result */
return_desc->integer.value = result;
acpi_ex_truncate_for32bit_table(return_desc); acpi_ex_truncate_for32bit_table(return_desc);
*result_desc = return_desc; *result_desc = return_desc;
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -162,13 +162,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, ...@@ -162,13 +162,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
} else { } else {
/* Field will fit within an Integer (normal case) */ /* Field will fit within an Integer (normal case) */
buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); buffer_desc = acpi_ut_create_integer_object((u64) 0);
if (!buffer_desc) { if (!buffer_desc) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
length = acpi_gbl_integer_byte_width; length = acpi_gbl_integer_byte_width;
buffer_desc->integer.value = 0;
buffer = &buffer_desc->integer.value; buffer = &buffer_desc->integer.value;
} }
......
...@@ -100,12 +100,12 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -100,12 +100,12 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
/* Create a return object of type Integer */ /* Create a return object of type Integer */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc =
acpi_ut_create_integer_object(acpi_os_get_timer());
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
} }
return_desc->integer.value = acpi_os_get_timer();
break; break;
default: /* Unknown opcode */ default: /* Unknown opcode */
...@@ -599,7 +599,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -599,7 +599,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_LNOT_OP: /* LNot (Operand) */ case AML_LNOT_OP: /* LNot (Operand) */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_integer_object((u64) 0);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
...@@ -702,13 +702,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -702,13 +702,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
/* Allocate a descriptor to hold the type. */ /* Allocate a descriptor to hold the type. */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_integer_object((u64) type);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
} }
return_desc->integer.value = type;
break; break;
case AML_SIZE_OF_OP: /* size_of (source_object) */ case AML_SIZE_OF_OP: /* size_of (source_object) */
...@@ -777,13 +775,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -777,13 +775,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
* Now that we have the size of the object, create a result * Now that we have the size of the object, create a result
* object to hold the value * object to hold the value
*/ */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_integer_object(value);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
} }
return_desc->integer.value = value;
break; break;
case AML_REF_OF_OP: /* ref_of (source_object) */ case AML_REF_OF_OP: /* ref_of (source_object) */
...@@ -946,24 +942,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -946,24 +942,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
* NOTE: index into a buffer is NOT a pointer to a * NOTE: index into a buffer is NOT a pointer to a
* sub-buffer of the main buffer, it is only a pointer to a * sub-buffer of the main buffer, it is only a pointer to a
* single element (byte) of the buffer! * single element (byte) of the buffer!
*
* Since we are returning the value of the buffer at the
* indexed location, we don't need to add an additional
* reference to the buffer itself.
*/ */
return_desc = return_desc =
acpi_ut_create_internal_object acpi_ut_create_integer_object((u64)
(ACPI_TYPE_INTEGER); temp_desc->
buffer.
pointer
[operand
[0]->
reference.
value]);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
} }
/*
* Since we are returning the value of the buffer at the
* indexed location, we don't need to add an additional
* reference to the buffer itself.
*/
return_desc->integer.value =
temp_desc->buffer.
pointer[operand[0]->reference.
value];
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
......
...@@ -253,18 +253,15 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) ...@@ -253,18 +253,15 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
} }
/* Create an integer for the return value */ /* Create an integer for the return value */
/* Default return value is ACPI_INTEGER_MAX if no match found */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_integer_object(ACPI_INTEGER_MAX);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
} }
/* Default return value if no match found */
return_desc->integer.value = ACPI_INTEGER_MAX;
/* /*
* Examine each element until a match is found. Both match conditions * Examine each element until a match is found. Both match conditions
* must be satisfied for a match to occur. Within the loop, * must be satisfied for a match to occur. Within the loop,
......
...@@ -610,17 +610,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -610,17 +610,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
implicit_return_obj) { implicit_return_obj) {
previous_walk_state-> previous_walk_state->
implicit_return_obj = implicit_return_obj =
acpi_ut_create_internal_object acpi_ut_create_integer_object
(ACPI_TYPE_INTEGER); ((u64) 0);
if (!previous_walk_state-> if (!previous_walk_state->
implicit_return_obj) { implicit_return_obj) {
return_ACPI_STATUS return_ACPI_STATUS
(AE_NO_MEMORY); (AE_NO_MEMORY);
} }
previous_walk_state->
implicit_return_obj->
integer.value = 0;
} }
/* Restart the calling control method */ /* Restart the calling control method */
......
...@@ -306,14 +306,12 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) ...@@ -306,14 +306,12 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
*/ */
if (acpi_gbl_enable_interpreter_slack) { if (acpi_gbl_enable_interpreter_slack) {
walk_state->implicit_return_obj = walk_state->implicit_return_obj =
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); acpi_ut_create_integer_object((u64) 0);
if (!walk_state->implicit_return_obj) { if (!walk_state->implicit_return_obj) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
acpi_ds_delete_walk_state(walk_state); acpi_ds_delete_walk_state(walk_state);
goto cleanup; goto cleanup;
} }
walk_state->implicit_return_obj->integer.value = 0;
} }
/* Parse the AML */ /* Parse the AML */
......
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