Print this page
acpica-unix2-20130823
PANKOVs restructure
@@ -3,11 +3,11 @@
* Module Name: exconvrt - Object conversion routines
*
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -112,10 +112,11 @@
Pointer = ObjDesc->Buffer.Pointer;
Count = ObjDesc->Buffer.Length;
break;
default:
+
return_ACPI_STATUS (AE_TYPE);
}
/*
* Convert the buffer/string to an integer. Note that both buffers and
@@ -131,11 +132,10 @@
/* String conversion is different than Buffer conversion */
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
-
/*
* Convert string to an integer - for most cases, the string must be
* hexadecimal as per the ACPI specification. The only exception (as
* of ACPI 3.0) is that the ToInteger() operator allows both decimal
* and hexadecimal strings (hex prefixed with "0x").
@@ -145,11 +145,10 @@
{
return_ACPI_STATUS (Status);
}
break;
-
case ACPI_TYPE_BUFFER:
/* Check for zero-length buffer */
if (!Count)
@@ -177,14 +176,14 @@
*/
Result |= (((UINT64) Pointer[i]) << (i * 8));
}
break;
-
default:
/* No other types can get here */
+
break;
}
/* Create a new integer */
@@ -197,11 +196,11 @@
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Result)));
/* Save the Result */
- AcpiExTruncateFor32bitTable (ReturnDesc);
+ (void) AcpiExTruncateFor32bitTable (ReturnDesc);
*ResultDesc = ReturnDesc;
return_ACPI_STATUS (AE_OK);
}
@@ -240,11 +239,10 @@
*ResultDesc = ObjDesc;
return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_INTEGER:
-
/*
* Create a new Buffer object.
* Need enough space for one integer
*/
ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);
@@ -259,13 +257,11 @@
ACPI_MEMCPY (NewBuf,
&ObjDesc->Integer.Value,
AcpiGbl_IntegerByteWidth);
break;
-
case ACPI_TYPE_STRING:
-
/*
* Create a new Buffer object
* Size will be the string length
*
* NOTE: Add one to the string length to include the null terminator.
@@ -285,12 +281,12 @@
NewBuf = ReturnDesc->Buffer.Pointer;
ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
ObjDesc->String.Length);
break;
-
default:
+
return_ACPI_STATUS (AE_TYPE);
}
/* Mark buffer initialized */
@@ -342,19 +338,22 @@
/* Setup max length for the decimal number */
switch (DataWidth)
{
case 1:
+
DecimalLength = ACPI_MAX8_DECIMAL_DIGITS;
break;
case 4:
+
DecimalLength = ACPI_MAX32_DECIMAL_DIGITS;
break;
case 8:
default:
+
DecimalLength = ACPI_MAX64_DECIMAL_DIGITS;
break;
}
SupressZeros = TRUE; /* No leading zeros */
@@ -459,11 +458,10 @@
/* No conversion necessary */
*ResultDesc = ObjDesc;
return_ACPI_STATUS (AE_OK);
-
case ACPI_TYPE_INTEGER:
switch (Type)
{
case ACPI_EXPLICIT_CONVERT_DECIMAL:
@@ -503,11 +501,10 @@
ReturnDesc->String.Length = StringLength;
NewBuf [StringLength] = 0;
break;
-
case ACPI_TYPE_BUFFER:
/* Setup string length, base, and separator */
switch (Type)
@@ -602,10 +599,11 @@
}
*NewBuf = 0;
break;
default:
+
return_ACPI_STATUS (AE_TYPE);
}
*ResultDesc = ReturnDesc;
return_ACPI_STATUS (AE_OK);
@@ -661,10 +659,11 @@
* Named field can always handle conversions
*/
break;
default:
+
/* No conversion allowed for these types */
if (DestinationType != SourceDesc->Common.Type)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
@@ -674,11 +673,10 @@
Status = AE_TYPE;
}
}
break;
-
case ARGI_TARGETREF:
switch (DestinationType)
{
case ACPI_TYPE_INTEGER:
@@ -691,47 +689,44 @@
*/
Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
16);
break;
-
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
Status = AcpiExConvertToString (SourceDesc, ResultDesc,
ACPI_IMPLICIT_CONVERT_HEX);
break;
-
case ACPI_TYPE_BUFFER:
/*
* The operand must be a Buffer. We can convert an
* Integer or String if necessary
*/
Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
break;
-
default:
+
ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X",
DestinationType));
Status = AE_AML_INTERNAL;
break;
}
break;
-
case ARGI_REFERENCE:
/*
* CreateXxxxField cases - we are storing the field object into the name
*/
break;
-
default:
+
ACPI_ERROR ((AE_INFO,
"Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
Status = AE_AML_INTERNAL;
@@ -748,7 +743,5 @@
Status = AE_OK;
}
return_ACPI_STATUS (Status);
}
-
-