summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/exconvrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/exconvrt.c')
-rw-r--r--sys/contrib/dev/acpica/exconvrt.c115
1 files changed, 54 insertions, 61 deletions
diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c
index 46159ce..8612789 100644
--- a/sys/contrib/dev/acpica/exconvrt.c
+++ b/sys/contrib/dev/acpica/exconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 24 $
+ * $Revision: 30 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exconvrt")
+ ACPI_MODULE_NAME ("exconvrt")
/*******************************************************************************
@@ -158,14 +158,14 @@ AcpiExConvertToInteger (
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
*ResultDesc = ObjDesc;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_STRING:
Pointer = ObjDesc->String.Pointer;
@@ -178,7 +178,7 @@ AcpiExConvertToInteger (
break;
default:
- return (AE_TYPE);
+ return_ACPI_STATUS (AE_TYPE);
}
/*
@@ -187,10 +187,9 @@ AcpiExConvertToInteger (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
@@ -202,7 +201,6 @@ AcpiExConvertToInteger (
IntegerSize = sizeof (UINT32);
}
-
/*
* Convert the buffer/string to an integer. Note that both buffers and
* strings are treated as raw data - we don't convert ascii to hex for
@@ -228,13 +226,13 @@ AcpiExConvertToInteger (
{
case ACPI_TYPE_STRING:
- /* TBD: Need to use 64-bit STRTOUL */
+ /* TBD: Need to use 64-bit ACPI_STRTOUL */
/*
* Convert string to an integer
* String must be hexadecimal as per the ACPI specification
*/
- Result = STRTOUL (Pointer, NULL, 16);
+ Result = ACPI_STRTOUL (Pointer, NULL, 16);
break;
@@ -253,7 +251,6 @@ AcpiExConvertToInteger (
*/
Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
}
-
break;
}
@@ -270,7 +267,7 @@ AcpiExConvertToInteger (
}
*ResultDesc = RetDesc;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -300,7 +297,7 @@ AcpiExConvertToBuffer (
UINT8 *NewBuf;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
switch (ObjDesc->Common.Type)
@@ -313,7 +310,7 @@ AcpiExConvertToBuffer (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
@@ -328,16 +325,16 @@ AcpiExConvertToBuffer (
IntegerSize = sizeof (UINT32);
}
- /* Need enough space for one integers */
+ /* Need enough space for one integer */
RetDesc->Buffer.Length = IntegerSize;
NewBuf = ACPI_MEM_CALLOCATE (IntegerSize);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExConvertToBuffer: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the integer to the buffer */
@@ -350,14 +347,6 @@ AcpiExConvertToBuffer (
/* Return the new buffer descriptor */
- if (*ResultDesc == ObjDesc)
- {
- if (WalkState->Opcode != AML_STORE_OP)
- {
- AcpiUtRemoveReference (ObjDesc);
- }
- }
-
*ResultDesc = RetDesc;
break;
@@ -373,11 +362,10 @@ AcpiExConvertToBuffer (
default:
- return (AE_TYPE);
- break;
- }
+ return_ACPI_STATUS (AE_TYPE);
+ }
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -409,7 +397,7 @@ AcpiExConvertToAscii (
BOOLEAN LeadingZero = TRUE;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (Base)
@@ -436,7 +424,7 @@ AcpiExConvertToAscii (
if (!LeadingZero)
{
- String[k] = (UINT8) (ASCII_ZERO + Remainder);
+ String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
k++;
}
}
@@ -450,7 +438,7 @@ AcpiExConvertToAscii (
{
HexDigit = AcpiUtHexToAsciiChar (Integer, (j * 4));
- if (HexDigit != ASCII_ZERO)
+ if (HexDigit != ACPI_ASCII_ZERO)
{
LeadingZero = FALSE;
}
@@ -475,7 +463,7 @@ AcpiExConvertToAscii (
*/
if (!k)
{
- String [0] = ASCII_ZERO;
+ String [0] = ACPI_ASCII_ZERO;
k = 1;
}
String [k] = 0;
@@ -515,7 +503,7 @@ AcpiExConvertToString (
UINT8 *Pointer;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
switch (ObjDesc->Common.Type)
@@ -546,7 +534,7 @@ AcpiExConvertToString (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Need enough space for one ASCII integer plus null terminator */
@@ -554,10 +542,10 @@ AcpiExConvertToString (
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExConvertToString: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -606,7 +594,7 @@ AcpiExConvertToString (
{
if (StringLength > ACPI_MAX_STRING_CONVERSION)
{
- return (AE_AML_STRING_LIMIT);
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
}
@@ -616,7 +604,7 @@ AcpiExConvertToString (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* String length is the lesser of the Max or the actual length */
@@ -629,10 +617,10 @@ AcpiExConvertToString (
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExConvertToString: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
@@ -652,7 +640,7 @@ AcpiExConvertToString (
NewBuf [Index-1] = 0;
RetDesc->Buffer.Pointer = NewBuf;
- RetDesc->String.Length = STRLEN ((char *) NewBuf);
+ RetDesc->String.Length = ACPI_STRLEN ((char *) NewBuf);
/* Return the new buffer descriptor */
@@ -680,17 +668,16 @@ AcpiExConvertToString (
{
/* Must copy the string first and then truncate it */
- return (AE_NOT_IMPLEMENTED);
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
break;
default:
- return (AE_TYPE);
- break;
- }
+ return_ACPI_STATUS (AE_TYPE);
+ }
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -698,26 +685,32 @@ AcpiExConvertToString (
*
* FUNCTION: AcpiExConvertToTargetType
*
- * PARAMETERS: *ObjDesc - Object to be converted.
- * WalkState - Current method state
+ * PARAMETERS: DestinationType - Current type of the destination
+ * SourceDesc - Source object to be converted.
+ * WalkState - Current method state
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Implements "implicit conversion" rules for storing an object.
*
******************************************************************************/
ACPI_STATUS
AcpiExConvertToTargetType (
- ACPI_OBJECT_TYPE8 DestinationType,
- ACPI_OPERAND_OBJECT **ObjDesc,
+ ACPI_OBJECT_TYPE DestinationType,
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExConvertToTargetType");
+ ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
+
+
+ /* Default behavior */
+ *ResultDesc = SourceDesc;
/*
* If required by the target,
@@ -740,11 +733,11 @@ AcpiExConvertToTargetType (
default:
/* No conversion allowed for these types */
- if (DestinationType != (*ObjDesc)->Common.Type)
+ if (DestinationType != SourceDesc->Common.Type)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target does not allow conversion of type %s to %s\n",
- AcpiUtGetTypeName ((*ObjDesc)->Common.Type),
+ AcpiUtGetTypeName ((SourceDesc)->Common.Type),
AcpiUtGetTypeName (DestinationType)));
Status = AE_TYPE;
}
@@ -764,7 +757,7 @@ AcpiExConvertToTargetType (
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
- Status = AcpiExConvertToInteger (*ObjDesc, ObjDesc, WalkState);
+ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, WalkState);
break;
@@ -774,17 +767,17 @@ AcpiExConvertToTargetType (
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
- Status = AcpiExConvertToString (*ObjDesc, ObjDesc, 16, ACPI_UINT32_MAX, WalkState);
+ Status = AcpiExConvertToString (SourceDesc, ResultDesc, 16, ACPI_UINT32_MAX, WalkState);
break;
case ACPI_TYPE_BUFFER:
/*
- * The operand must be a String. We can convert an
- * Integer or Buffer if necessary
+ * The operand must be a Buffer. We can convert an
+ * Integer or String if necessary
*/
- Status = AcpiExConvertToBuffer (*ObjDesc, ObjDesc, WalkState);
+ Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState);
break;
}
break;
OpenPOWER on IntegriCloud