ACPI: ACPICA 20060526

Restructured, flattened, and simplified the internal
interfaces for namespace object evaluation - resulting
in smaller code, less CPU stack use, and fewer
interfaces. (With assistance from Mikhail Kouzmich)

Fixed a problem with the CopyObject operator where the
first parameter was not typed correctly for the parser,
interpreter, compiler, and disassembler. Caused various
errors and unexpected behavior.

Fixed a problem where a ShiftLeft or ShiftRight of
more than 64 bits produced incorrect results with some
C compilers. Since the behavior of C compilers when
the shift value is larger than the datatype width is
apparently not well defined, the interpreter now detects
this condition and simply returns zero as expected in all
such cases. (BZ 395)

Fixed problem reports (Valery Podrezov) integrated: -
Update String-to-Integer conversion to match ACPI 3.0A spec
http://bugzilla.kernel.org/show_bug.cgi?id=5329
Allow interpreter to handle nested method declarations
http://bugzilla.kernel.org/show_bug.cgi?id=5361

Fixed problem reports (Fiodor Suietov) integrated: -
acpi_terminate() doesn't free debug memory allocation
list objects (BZ 355) - After Core Subsystem
shutdown, acpi_subsystem_status() returns AE_OK (BZ 356) -
acpi_os_unmap_memory() for RSDP can be invoked inconsistently
(BZ 357) - Resource Manager should return AE_TYPE for
non-device objects (BZ 358) - Incomplete cleanup branch
in AcpiNsEvaluateRelative (BZ 359) - Use acpi_os_free()
instead of ACPI_FREE in acpi_rs_set_srs_method_data (BZ 360)
- Incomplete cleanup branch in acpi_ps_parse_aml (BZ 361) -
Incomplete cleanup branch in acpi_ds_delete_walk_state (BZ 362)
- acpi_get_table_header returns AE_NO_ACPI_TABLES until DSDT
is loaded (BZ 365) - Status of the Global Initialization
Handler call not used (BZ 366) - Incorrect object parameter
to Global Initialization Handler (BZ 367)

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index ec9f5a1..5a3aa8d 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -127,8 +127,7 @@
 acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
 {
 	acpi_status status = AE_OK;
-	struct acpi_parameter_info info;
-	char *sleep_state_name;
+	struct acpi_evaluate_info *info;
 
 	ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data);
 
@@ -138,34 +137,39 @@
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	/* Evaluate the namespace object containing the values for this state */
+	/* Allocate the evaluation information block */
 
-	info.parameters = NULL;
-	info.return_object = NULL;
-	sleep_state_name =
+	info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+	if (!info) {
+		return_ACPI_STATUS(AE_NO_MEMORY);
+	}
+
+	info->pathname =
 	    ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
 
-	status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
+	/* Evaluate the namespace object containing the values for this state */
+
+	status = acpi_ns_evaluate(info);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
 				  "%s while evaluating SleepState [%s]\n",
 				  acpi_format_exception(status),
-				  sleep_state_name));
+				  info->pathname));
 
-		return_ACPI_STATUS(status);
+		goto cleanup;
 	}
 
 	/* Must have a return object */
 
-	if (!info.return_object) {
+	if (!info->return_object) {
 		ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
-			    sleep_state_name));
+			    info->pathname));
 		status = AE_NOT_EXIST;
 	}
 
 	/* It must be of type Package */
 
-	else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) {
+	else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) {
 		ACPI_ERROR((AE_INFO,
 			    "Sleep State return object is not a Package"));
 		status = AE_AML_OPERAND_TYPE;
@@ -178,7 +182,7 @@
 	 * by BIOS vendors seems to be to have 2 or more elements, at least
 	 * one per sleep type (A/B).
 	 */
-	else if (info.return_object->package.count < 2) {
+	else if (info->return_object->package.count < 2) {
 		ACPI_ERROR((AE_INFO,
 			    "Sleep State return package does not have at least two elements"));
 		status = AE_AML_NO_OPERAND;
@@ -186,35 +190,38 @@
 
 	/* The first two elements must both be of type Integer */
 
-	else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0])
+	else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0])
 		  != ACPI_TYPE_INTEGER) ||
-		 (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
+		 (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1])
 		  != ACPI_TYPE_INTEGER)) {
 		ACPI_ERROR((AE_INFO,
 			    "Sleep State return package elements are not both Integers (%s, %s)",
-			    acpi_ut_get_object_type_name(info.return_object->
+			    acpi_ut_get_object_type_name(info->return_object->
 							 package.elements[0]),
-			    acpi_ut_get_object_type_name(info.return_object->
+			    acpi_ut_get_object_type_name(info->return_object->
 							 package.elements[1])));
 		status = AE_AML_OPERAND_TYPE;
 	} else {
 		/* Valid _Sx_ package size, type, and value */
 
 		*sleep_type_a = (u8)
-		    (info.return_object->package.elements[0])->integer.value;
+		    (info->return_object->package.elements[0])->integer.value;
 		*sleep_type_b = (u8)
-		    (info.return_object->package.elements[1])->integer.value;
+		    (info->return_object->package.elements[1])->integer.value;
 	}
 
 	if (ACPI_FAILURE(status)) {
 		ACPI_EXCEPTION((AE_INFO, status,
 				"While evaluating SleepState [%s], bad Sleep object %p type %s",
-				sleep_state_name, info.return_object,
-				acpi_ut_get_object_type_name(info.
+				info->pathname, info->return_object,
+				acpi_ut_get_object_type_name(info->
 							     return_object)));
 	}
 
-	acpi_ut_remove_reference(info.return_object);
+	acpi_ut_remove_reference(info->return_object);
+
+      cleanup:
+	ACPI_FREE(info);
 	return_ACPI_STATUS(status);
 }