ACPI: ACPICA 20060608

Converted the locking mutex used for the ACPI hardware
to a spinlock. This change should eliminate all problems
caused by attempting to acquire a semaphore at interrupt
level, and it means that all ACPICA external interfaces
that directly access the ACPI hardware can be safely
called from interrupt level.

Fixed a regression introduced in 20060526 where the ACPI
device initialization could be prematurely aborted with
an AE_NOT_FOUND if a device did not have an optional
_INI method.

Fixed an IndexField issue where a write to the Data
Register should be limited in size to the AccessSize
(width) of the IndexField itself. (BZ 433, Fiodor Suietov)

Fixed problem reports (Valery Podrezov) integrated: - Allow
store of ThermalZone objects to Debug object.
http://bugzilla.kernel.org/show_bug.cgi?id=5369
http://bugzilla.kernel.org/show_bug.cgi?id=5370

Fixed problem reports (Fiodor Suietov) integrated: -
acpi_get_table_header() doesn't handle multiple instances
correctly (BZ 364)

Removed four global mutexes that were obsolete and were
no longer being used.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 3b7c435..051053f 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -785,6 +785,7 @@
 {
 	acpi_status status;
 	acpi_integer mask;
+	acpi_integer width_mask;
 	acpi_integer merged_datum;
 	acpi_integer raw_datum = 0;
 	u32 field_offset = 0;
@@ -809,8 +810,11 @@
 
 	/* Compute the number of datums (access width data items) */
 
+	width_mask =
+	    ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width);
 	mask =
-	    ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
+	    width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field.
+					      start_field_bit_offset);
 
 	datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
 				       obj_desc->common_field.access_bit_width);
@@ -850,7 +854,7 @@
 		merged_datum = raw_datum >>
 		    (obj_desc->common_field.access_bit_width -
 		     obj_desc->common_field.start_field_bit_offset);
-		mask = ACPI_INTEGER_MAX;
+		mask = width_mask;
 
 		if (i == datum_count) {
 			break;
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 8284c52..6374d8b 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -322,8 +322,9 @@
 
 			/* Since the bit position is one-based, subtract from 33 (65) */
 
-			return_desc->integer.value = temp32 == 0 ? 0 :
-			    (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+			return_desc->integer.value =
+			    temp32 ==
+			    0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
 			break;
 
 		case AML_FROM_BCD_OP:	/* from_bcd (BCDValue, Result) */
@@ -698,6 +699,7 @@
 		if (ACPI_FAILURE(status)) {
 			goto cleanup;
 		}
+
 		/* Allocate a descriptor to hold the type. */
 
 		return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -967,7 +969,6 @@
 						acpi_ut_add_reference
 						    (return_desc);
 					}
-
 					break;
 
 				default:
@@ -987,7 +988,6 @@
 
 				if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
 				    ACPI_DESC_TYPE_NAMED) {
-
 					return_desc =
 					    acpi_ns_get_attached_object((struct
 									 acpi_namespace_node
@@ -1002,7 +1002,7 @@
 
 			default:
 				ACPI_ERROR((AE_INFO,
-					    "Unknown opcode in ref(%p) - %X",
+					    "Unknown opcode in reference(%p) - %X",
 					    operand[0],
 					    operand[0]->reference.opcode));
 
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index f9b9f50..3089b05 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -114,10 +114,11 @@
 
 	/*
 	 * Several object types require no further processing:
-	 * 1) Devices rarely have an attached object, return the Node
+	 * 1) Device/Thermal objects don't have a "real" subobject, return the Node
 	 * 2) Method locals and arguments have a pseudo-Node
 	 */
-	if (entry_type == ACPI_TYPE_DEVICE ||
+	if ((entry_type == ACPI_TYPE_DEVICE) ||
+	    (entry_type == ACPI_TYPE_THERMAL) ||
 	    (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
 		return_ACPI_STATUS(AE_OK);
 	}
@@ -216,7 +217,6 @@
 	case ACPI_TYPE_METHOD:
 	case ACPI_TYPE_POWER:
 	case ACPI_TYPE_PROCESSOR:
-	case ACPI_TYPE_THERMAL:
 	case ACPI_TYPE_EVENT:
 	case ACPI_TYPE_REGION:
 
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 006bba0..6499de8 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -257,10 +257,24 @@
 
 		case AML_INT_NAMEPATH_OP:	/* Reference to a named object */
 
-			/* Get the object pointed to by the namespace node */
+			/* Dereference the name */
 
-			*stack_ptr = (stack_desc->reference.node)->object;
-			acpi_ut_add_reference(*stack_ptr);
+			if ((stack_desc->reference.node->type ==
+			     ACPI_TYPE_DEVICE)
+			    || (stack_desc->reference.node->type ==
+				ACPI_TYPE_THERMAL)) {
+
+				/* These node types do not have 'real' subobjects */
+
+				*stack_ptr = (void *)stack_desc->reference.node;
+			} else {
+				/* Get the object pointed to by the namespace node */
+
+				*stack_ptr =
+				    (stack_desc->reference.node)->object;
+				acpi_ut_add_reference(*stack_ptr);
+			}
+
 			acpi_ut_remove_reference(stack_desc);
 			break;
 
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 3ef8cd7..982c8b6 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -89,7 +89,7 @@
 
 	ACPI_FUNCTION_TRACE(ex_enter_interpreter);
 
-	status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
 	if (ACPI_FAILURE(status)) {
 		ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
 	}
@@ -125,7 +125,7 @@
 
 	ACPI_FUNCTION_TRACE(ex_exit_interpreter);
 
-	status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
+	status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
 	if (ACPI_FAILURE(status)) {
 		ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
 	}