summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/exutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/exutils.c')
-rw-r--r--sys/contrib/dev/acpica/exutils.c136
1 files changed, 48 insertions, 88 deletions
diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c
index 740a91a..ce23c15 100644
--- a/sys/contrib/dev/acpica/exutils.c
+++ b/sys/contrib/dev/acpica/exutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 93 $
+ * $Revision: 100 $
*
*****************************************************************************/
@@ -134,12 +134,9 @@
#define DEFINE_AML_GLOBALS
#include "acpi.h"
-#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
-#include "acnamesp.h"
#include "acevents.h"
-#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exutils")
@@ -167,7 +164,7 @@ AcpiExEnterInterpreter (void)
Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n"));
+ ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
}
return_ACPI_STATUS (Status);
@@ -204,6 +201,10 @@ AcpiExExitInterpreter (void)
Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+ }
return_VOID;
}
@@ -242,8 +243,6 @@ AcpiExValidateObjectType (
* FUNCTION: AcpiExTruncateFor32bitTable
*
* PARAMETERS: ObjDesc - Object to be truncated
- * WalkState - Current walk state
- * (A method must be executing)
*
* RETURN: none
*
@@ -254,8 +253,7 @@ AcpiExValidateObjectType (
void
AcpiExTruncateFor32bitTable (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_WALK_STATE *WalkState)
+ ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_FUNCTION_ENTRY ();
@@ -266,13 +264,12 @@ AcpiExTruncateFor32bitTable (
* a control method
*/
if ((!ObjDesc) ||
- (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) ||
- (!WalkState->MethodNode))
+ (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
{
return;
}
- if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
+ if (AcpiGbl_IntegerByteWidth == 4)
{
/*
* We are running a method that exists in a 32-bit ACPI table.
@@ -344,10 +341,12 @@ AcpiExAcquireGlobalLock (
*
******************************************************************************/
-ACPI_STATUS
+void
AcpiExReleaseGlobalLock (
BOOLEAN LockedByMe)
{
+ ACPI_STATUS Status;
+
ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
@@ -358,10 +357,14 @@ AcpiExReleaseGlobalLock (
{
/* OK, now release the lock */
- AcpiEvReleaseGlobalLock ();
- }
+ Status = AcpiEvReleaseGlobalLock ();
+ if (ACPI_FAILURE (Status))
+ {
+ /* Report the error, but there isn't much else we can do */
- return_ACPI_STATUS (AE_OK);
+ ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
+ }
+ }
}
@@ -381,25 +384,25 @@ AcpiExDigitsNeeded (
ACPI_INTEGER Value,
UINT32 Base)
{
- UINT32 NumDigits = 0;
+ UINT32 NumDigits;
+ ACPI_INTEGER CurrentValue;
+ ACPI_INTEGER Quotient;
ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
- if (Base < 1)
- {
- ACPI_REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n"));
- }
- else
+ /*
+ * ACPI_INTEGER is unsigned, so we don't worry about a '-'
+ */
+ CurrentValue = Value;
+ NumDigits = 0;
+
+ while (CurrentValue)
{
- /*
- * ACPI_INTEGER is unsigned, which is why we don't worry about a '-'
- */
- for (NumDigits = 1;
- (AcpiUtShortDivide (&Value, Base, &Value, NULL));
- ++NumDigits)
- { ; }
+ (void) AcpiUtShortDivide (&CurrentValue, Base, &Quotient, NULL);
+ NumDigits++;
+ CurrentValue = Quotient;
}
return_VALUE (NumDigits);
@@ -408,47 +411,6 @@ AcpiExDigitsNeeded (
/*******************************************************************************
*
- * FUNCTION: ntohl
- *
- * PARAMETERS: Value - Value to be converted
- *
- * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
- *
- ******************************************************************************/
-
-static UINT32
-_ntohl (
- UINT32 Value)
-{
- union
- {
- UINT32 Value;
- UINT8 Bytes[4];
- } Out;
-
- union
- {
- UINT32 Value;
- UINT8 Bytes[4];
- } In;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- In.Value = Value;
-
- Out.Bytes[0] = In.Bytes[3];
- Out.Bytes[1] = In.Bytes[2];
- Out.Bytes[2] = In.Bytes[1];
- Out.Bytes[3] = In.Bytes[0];
-
- return (Out.Value);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiExEisaIdToString
*
* PARAMETERS: NumericId - EISA ID to be converted
@@ -458,31 +420,29 @@ _ntohl (
*
******************************************************************************/
-ACPI_STATUS
+void
AcpiExEisaIdToString (
UINT32 NumericId,
NATIVE_CHAR *OutString)
{
- UINT32 id;
+ UINT32 EisaId;
ACPI_FUNCTION_ENTRY ();
- /* swap to big-endian to get contiguous bits */
+ /* Swap ID to big-endian to get contiguous bits */
- id = _ntohl (NumericId);
+ EisaId = AcpiUtDwordByteSwap (NumericId);
- OutString[0] = (char) ('@' + ((id >> 26) & 0x1f));
- OutString[1] = (char) ('@' + ((id >> 21) & 0x1f));
- OutString[2] = (char) ('@' + ((id >> 16) & 0x1f));
- OutString[3] = AcpiUtHexToAsciiChar (id, 12);
- OutString[4] = AcpiUtHexToAsciiChar (id, 8);
- OutString[5] = AcpiUtHexToAsciiChar (id, 4);
- OutString[6] = AcpiUtHexToAsciiChar (id, 0);
+ OutString[0] = (char) ('@' + ((EisaId >> 26) & 0x1f));
+ OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f));
+ OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f));
+ OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12);
+ OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8);
+ OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4);
+ OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0);
OutString[7] = 0;
-
- return (AE_OK);
}
@@ -497,7 +457,7 @@ AcpiExEisaIdToString (
*
******************************************************************************/
-ACPI_STATUS
+void
AcpiExUnsignedIntegerToString (
ACPI_INTEGER Value,
NATIVE_CHAR *OutString)
@@ -505,6 +465,7 @@ AcpiExUnsignedIntegerToString (
UINT32 Count;
UINT32 DigitsNeeded;
UINT32 Remainder;
+ ACPI_INTEGER Quotient;
ACPI_FUNCTION_ENTRY ();
@@ -515,11 +476,10 @@ AcpiExUnsignedIntegerToString (
for (Count = DigitsNeeded; Count > 0; Count--)
{
- AcpiUtShortDivide (&Value, 10, &Value, &Remainder);
- OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder);
+ (void) AcpiUtShortDivide (&Value, 10, &Quotient, &Remainder);
+ OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder);\
+ Value = Quotient;
}
-
- return (AE_OK);
}
OpenPOWER on IntegriCloud