summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/aslutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslutils.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslutils.c127
1 files changed, 80 insertions, 47 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c
index b5e5051..1c9f48b 100644
--- a/sys/contrib/dev/acpica/compiler/aslutils.c
+++ b/sys/contrib/dev/acpica/compiler/aslutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
- * $Revision: 58 $
+ * $Revision: 1.66 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,10 +116,10 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "acnamesp.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslutils")
@@ -131,13 +131,23 @@ static const char * const *yytname = &AslCompilername[254];
extern const char * const yytname[];
#endif
+/* Local prototypes */
-void
-AslOptimizeNamepath (
- char *Buffer)
-{
- printf ("NamePath: %s\n", Buffer);
-}
+static ACPI_STATUS
+UtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ ACPI_INTEGER *RetInteger);
+
+static void
+UtPadNameWithUnderscores (
+ char *NameSeg,
+ char *PaddedNameSeg);
+
+static void
+UtAttachNameseg (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name);
/*******************************************************************************
@@ -158,6 +168,7 @@ UtDisplayConstantOpcodes (
{
UINT32 i;
+
printf ("Constant expression opcode information\n\n");
for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++)
@@ -211,24 +222,32 @@ UtLocalCalloc (
*
* FUNCTION: UtBeginEvent
*
- * PARAMETERS: Event - Event number (integer index)
- * Name - Ascii name of this event
+ * PARAMETERS: Name - Ascii name of this event
*
- * RETURN: None
+ * RETURN: Event - Event number (integer index)
*
* DESCRIPTION: Saves the current time with this event
*
******************************************************************************/
-void
+UINT8
UtBeginEvent (
- UINT32 Event,
char *Name)
{
- AslGbl_Events[Event].StartTime = (time_t) AcpiOsGetTimer();
- AslGbl_Events[Event].EventName = Name;
- AslGbl_Events[Event].Valid = TRUE;
+ if (AslGbl_NextEvent >= ASL_NUM_EVENTS)
+ {
+ AcpiOsPrintf ("Ran out of compiler event structs!\n");
+ return (AslGbl_NextEvent);
+ }
+
+ /* Init event with current (start) time */
+
+ AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer ();
+ AslGbl_Events[AslGbl_NextEvent].EventName = Name;
+ AslGbl_Events[AslGbl_NextEvent].Valid = TRUE;
+
+ return (AslGbl_NextEvent++);
}
@@ -246,10 +265,17 @@ UtBeginEvent (
void
UtEndEvent (
- UINT32 Event)
+ UINT8 Event)
{
- AslGbl_Events[Event].EndTime = (time_t) AcpiOsGetTimer();
+ if (Event >= ASL_NUM_EVENTS)
+ {
+ return;
+ }
+
+ /* Insert end time for event */
+
+ AslGbl_Events[Event].EndTime = AcpiOsGetTimer ();
}
@@ -257,7 +283,7 @@ UtEndEvent (
*
* FUNCTION: UtHexCharToValue
*
- * PARAMETERS: hc - Hex character in Ascii
+ * PARAMETERS: HexChar - Hex character in Ascii
*
* RETURN: The binary value of the hex character
*
@@ -267,20 +293,20 @@ UtEndEvent (
UINT8
UtHexCharToValue (
- int hc)
+ int HexChar)
{
- if (hc <= 0x39)
+ if (HexChar <= 0x39)
{
- return ((UINT8) (hc - 0x30));
+ return ((UINT8) (HexChar - 0x30));
}
- if (hc <= 0x46)
+ if (HexChar <= 0x46)
{
- return ((UINT8) (hc - 0x37));
+ return ((UINT8) (HexChar - 0x37));
}
- return ((UINT8) (hc - 0x57));
+ return ((UINT8) (HexChar - 0x57));
}
@@ -289,7 +315,7 @@ UtHexCharToValue (
* FUNCTION: UtConvertByteToHex
*
* PARAMETERS: RawByte - Binary data
- * *Buffer - Pointer to where the hex bytes will be stored
+ * Buffer - Pointer to where the hex bytes will be stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
@@ -317,7 +343,7 @@ UtConvertByteToHex (
* FUNCTION: UtConvertByteToAsmHex
*
* PARAMETERS: RawByte - Binary data
- * *Buffer - Pointer to where the hex bytes will be stored
+ * Buffer - Pointer to where the hex bytes will be stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
@@ -344,7 +370,8 @@ UtConvertByteToAsmHex (
*
* FUNCTION: DbgPrint
*
- * PARAMETERS: Fmt - Printf format string
+ * PARAMETERS: Type - Type of output
+ * Fmt - Printf format string
* ... - variable printf list
*
* RETURN: None
@@ -431,6 +458,7 @@ void
UtSetParseOpName (
ACPI_PARSE_OBJECT *Op)
{
+
strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), 12);
}
@@ -464,7 +492,7 @@ UtGetOpName (
*
* FUNCTION: UtDisplaySummary
*
- * PARAMETERS: None
+ * PARAMETERS: FileID - ID of outpout file
*
* RETURN: None
*
@@ -590,7 +618,8 @@ UtGetStringBuffer (
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
{
Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length);
- Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + Length;
+ Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE +
+ Length;
}
Buffer = Gbl_StringCacheNext;
@@ -667,7 +696,7 @@ UtInternalizeName (
*
******************************************************************************/
-void
+static void
UtPadNameWithUnderscores (
char *NameSeg,
char *PaddedNameSeg)
@@ -698,14 +727,14 @@ UtPadNameWithUnderscores (
* PARAMETERS: Op - Parent parse node
* Name - Full ExternalName
*
- * RETURN: Sets the NameSeg field in parent node
+ * RETURN: None; Sets the NameSeg field in parent node
*
* DESCRIPTION: Extract the last nameseg of the ExternalName and store it
* in the NameSeg field of the Op.
*
******************************************************************************/
-void
+static void
UtAttachNameseg (
ACPI_PARSE_OBJECT *Op,
char *Name)
@@ -775,6 +804,10 @@ UtAttachNamepathToOwner (
Op->Asl.ExternalName = NameOp->Asl.Value.String;
+ /* Save the NameOp for possible error reporting later */
+
+ Op->Asl.ParentMethod = (void *) NameOp;
+
/* Last nameseg of the path */
UtAttachNameseg (Op, Op->Asl.ExternalName);
@@ -813,7 +846,8 @@ UtDoConstant (
Status = UtStrtoul64 (String, 0, &Converted);
if (ACPI_FAILURE (Status))
{
- sprintf (ErrBuf, "%s %s\n", "Conversion error:", AcpiFormatException (Status));
+ sprintf (ErrBuf, "%s %s\n", "Conversion error:",
+ AcpiFormatException (Status));
AslCompilererror (ErrBuf);
}
@@ -821,12 +855,15 @@ UtDoConstant (
}
+/* TBD: use version in ACPI CA main code base? */
+
/*******************************************************************************
*
* FUNCTION: UtStrtoul64
*
* PARAMETERS: String - Null terminated string
- * Terminater - Where a pointer to the terminating byte is returned
+ * Terminater - Where a pointer to the terminating byte is
+ * returned
* Base - Radix of the string
*
* RETURN: Converted value
@@ -834,10 +871,8 @@ UtDoConstant (
* DESCRIPTION: Convert a string into an unsigned value.
*
******************************************************************************/
-#define NEGATIVE 1
-#define POSITIVE 0
-ACPI_STATUS
+static ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
@@ -867,9 +902,8 @@ UtStrtoul64 (
return (AE_BAD_PARAMETER);
}
- /*
- * skip over any white space in the buffer:
- */
+ /* Skip over any white space in the buffer: */
+
while (isspace (*String) || *String == '\t')
{
++String;
@@ -977,9 +1011,8 @@ UtStrtoul64 (
}
- /*
- * If a minus sign was present, then "the conversion is negated":
- */
+ /* If a minus sign was present, then "the conversion is negated": */
+
if (Sign == NEGATIVE)
{
ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
OpenPOWER on IntegriCloud