summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/executer/exstore.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/executer/exstore.c')
-rw-r--r--sys/contrib/dev/acpica/components/executer/exstore.c148
1 files changed, 105 insertions, 43 deletions
diff --git a/sys/contrib/dev/acpica/components/executer/exstore.c b/sys/contrib/dev/acpica/components/executer/exstore.c
index e14ab94..eb474a9 100644
--- a/sys/contrib/dev/acpica/components/executer/exstore.c
+++ b/sys/contrib/dev/acpica/components/executer/exstore.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -117,8 +117,8 @@ AcpiExStore (
* Storing an object into a Named node.
*/
Status = AcpiExStoreObjectToNode (SourceDesc,
- (ACPI_NAMESPACE_NODE *) DestDesc, WalkState,
- ACPI_IMPLICIT_CONVERSION);
+ (ACPI_NAMESPACE_NODE *) DestDesc, WalkState,
+ ACPI_IMPLICIT_CONVERSION);
return_ACPI_STATUS (Status);
}
@@ -147,7 +147,7 @@ AcpiExStore (
/* Destination is not a Reference object */
ACPI_ERROR ((AE_INFO,
- "Target is not a Reference or Constant object - %s [%p]",
+ "Target is not a Reference or Constant object - [%s] %p",
AcpiUtGetObjectTypeName (DestDesc), DestDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -168,8 +168,8 @@ AcpiExStore (
/* Storing an object into a Name "container" */
Status = AcpiExStoreObjectToNode (SourceDesc,
- RefDesc->Reference.Object,
- WalkState, ACPI_IMPLICIT_CONVERSION);
+ RefDesc->Reference.Object,
+ WalkState, ACPI_IMPLICIT_CONVERSION);
break;
case ACPI_REFCLASS_INDEX:
@@ -185,7 +185,7 @@ AcpiExStore (
/* Store to a method local/arg */
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class,
- RefDesc->Reference.Value, SourceDesc, WalkState);
+ RefDesc->Reference.Value, SourceDesc, WalkState);
break;
case ACPI_REFCLASS_DEBUG:
@@ -194,7 +194,7 @@ AcpiExStore (
* displayed and otherwise has no effect -- see ACPI Specification
*/
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "**** Write to Debug Object: Object %p %s ****:\n\n",
+ "**** Write to Debug Object: Object %p [%s] ****:\n\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
@@ -274,7 +274,8 @@ AcpiExStoreObjectToIndex (
{
/* Normal object, copy it */
- Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
+ Status = AcpiUtCopyIobjectToIobject (
+ SourceDesc, &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -356,7 +357,7 @@ AcpiExStoreObjectToIndex (
/* All other types are invalid */
ACPI_ERROR ((AE_INFO,
- "Source must be Integer/Buffer/String type, not %s",
+ "Source must be type [Integer/Buffer/String], found [%s]",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -368,8 +369,8 @@ AcpiExStoreObjectToIndex (
default:
ACPI_ERROR ((AE_INFO,
- "Target is not a Package or BufferField"));
- Status = AE_AML_OPERAND_TYPE;
+ "Target is not of type [Package/BufferField]"));
+ Status = AE_AML_TARGET_TYPE;
break;
}
@@ -390,20 +391,20 @@ AcpiExStoreObjectToIndex (
*
* DESCRIPTION: Store the object to the named object.
*
- * The Assignment of an object to a named object is handled here
- * The value passed in will replace the current value (if any)
- * with the input value.
+ * The assignment of an object to a named object is handled here.
+ * The value passed in will replace the current value (if any)
+ * with the input value.
*
- * When storing into an object the data is converted to the
- * target object type then stored in the object. This means
- * that the target object type (for an initialized target) will
- * not be changed by a store operation. A CopyObject can change
- * the target type, however.
+ * When storing into an object the data is converted to the
+ * target object type then stored in the object. This means
+ * that the target object type (for an initialized target) will
+ * not be changed by a store operation. A CopyObject can change
+ * the target type, however.
*
- * The ImplicitConversion flag is set to NO/FALSE only when
- * storing to an ArgX -- as per the rules of the ACPI spec.
+ * The ImplicitConversion flag is set to NO/FALSE only when
+ * storing to an ArgX -- as per the rules of the ACPI spec.
*
- * Assumes parameters are already validated.
+ * Assumes parameters are already validated.
*
******************************************************************************/
@@ -428,9 +429,75 @@ AcpiExStoreObjectToNode (
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
- Node, AcpiUtGetTypeName (TargetType)));
+ Node, AcpiUtGetTypeName (TargetType)));
+
+ /* Only limited target types possible for everything except CopyObject */
+
+ if (WalkState->Opcode != AML_COPY_OP)
+ {
+ /*
+ * Only CopyObject allows all object types to be overwritten. For
+ * TargetRef(s), there are restrictions on the object types that
+ * are allowed.
+ *
+ * Allowable operations/typing for Store:
+ *
+ * 1) Simple Store
+ * Integer --> Integer (Named/Local/Arg)
+ * String --> String (Named/Local/Arg)
+ * Buffer --> Buffer (Named/Local/Arg)
+ * Package --> Package (Named/Local/Arg)
+ *
+ * 2) Store with implicit conversion
+ * Integer --> String or Buffer (Named)
+ * String --> Integer or Buffer (Named)
+ * Buffer --> Integer or String (Named)
+ */
+ switch (TargetType)
+ {
+ case ACPI_TYPE_PACKAGE:
+ /*
+ * Here, can only store a package to an existing package.
+ * Storing a package to a Local/Arg is OK, and handled
+ * elsewhere.
+ */
+ if (WalkState->Opcode == AML_STORE_OP)
+ {
+ if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Cannot assign type [%s] to [Package] "
+ "(source must be type Pkg)",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+
+ return_ACPI_STATUS (AE_AML_TARGET_TYPE);
+ }
+ break;
+ }
+
+ /* Fallthrough */
+
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_EVENT:
+ case ACPI_TYPE_MUTEX:
+ case ACPI_TYPE_REGION:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ ACPI_ERROR ((AE_INFO,
+ "Target must be [Buffer/Integer/String/Reference]"
+ ", found [%s] (%4.4s)",
+ AcpiUtGetTypeName (Node->Type), Node->Name.Ascii));
+
+ return_ACPI_STATUS (AE_AML_TARGET_TYPE);
+
+ default:
+ break;
+ }
+ }
/*
* Resolve the source object to an actual value
@@ -446,13 +513,13 @@ AcpiExStoreObjectToNode (
switch (TargetType)
{
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
/*
* The simple data types all support implicit source operand
* conversion before the store.
*/
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
if ((WalkState->Opcode == AML_COPY_OP) ||
!ImplicitConversion)
@@ -462,8 +529,7 @@ AcpiExStoreObjectToNode (
* an implicit conversion, as per the ACPI specification.
* A direct store is performed instead.
*/
- Status = AcpiExStoreDirectToNode (SourceDesc, Node,
- WalkState);
+ Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState);
break;
}
@@ -487,11 +553,11 @@ AcpiExStoreObjectToNode (
* store has been performed such that the node/object type
* has been changed.
*/
- Status = AcpiNsAttachObject (Node, NewDesc,
- NewDesc->Common.Type);
+ Status = AcpiNsAttachObject (
+ Node, NewDesc, NewDesc->Common.Type);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Store %s into %s via Convert/Attach\n",
+ "Store type [%s] into [%s] via Convert/Attach\n",
AcpiUtGetObjectTypeName (SourceDesc),
AcpiUtGetObjectTypeName (NewDesc)));
}
@@ -513,18 +579,14 @@ AcpiExStoreObjectToNode (
default:
/*
- * No conversions for all other types. Directly store a copy of
- * the source object. This is the ACPI spec-defined behavior for
- * the CopyObject operator.
+ * CopyObject operator: No conversions for all other types.
+ * Instead, directly store a copy of the source object.
*
- * NOTE: For the Store operator, this is a departure from the
- * ACPI spec, which states "If conversion is impossible, abort
- * the running control method". Instead, this code implements
- * "If conversion is impossible, treat the Store operation as
- * a CopyObject".
+ * This is the ACPI spec-defined behavior for the CopyObject
+ * operator. (Note, for this default case, all normal
+ * Store/Target operations exited above with an error).
*/
- Status = AcpiExStoreDirectToNode (SourceDesc, Node,
- WalkState);
+ Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState);
break;
}
OpenPOWER on IntegriCloud