mirror of
https://github.com/acpica/acpica/
synced 2025-01-24 18:32:04 +03:00
New command line options
date 2002.04.25.17.44.00; author rmoore1; state Exp;
This commit is contained in:
parent
0cbf0e7d8c
commit
25b6657b7b
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslutils -- compiler utilities
|
||||
* $Revision: 1.42 $
|
||||
* $Revision: 1.46 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -118,6 +118,7 @@
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "acnamesp.h"
|
||||
#include "amlcode.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslutils")
|
||||
@ -130,6 +131,36 @@ extern const char * const yytname[];
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiPsDisplayConstantOpcodes
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Print AML opcodes that can be used in constant expressions.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
UtDisplayConstantOpcodes (
|
||||
void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
printf ("Constant expression opcode information\n\n");
|
||||
|
||||
for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++)
|
||||
{
|
||||
if (AcpiGbl_AmlOpInfo[i].Flags & AML_CONSTANT)
|
||||
{
|
||||
printf ("%s\n", AcpiGbl_AmlOpInfo[i].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtLocalCalloc
|
||||
@ -186,7 +217,7 @@ UtBeginEvent (
|
||||
char *Name)
|
||||
{
|
||||
|
||||
AslGbl_Events[Event].StartTime = AcpiOsGetTimer();
|
||||
AslGbl_Events[Event].StartTime = (time_t) AcpiOsGetTimer();
|
||||
AslGbl_Events[Event].EventName = Name;
|
||||
AslGbl_Events[Event].Valid = TRUE;
|
||||
}
|
||||
@ -209,7 +240,7 @@ UtEndEvent (
|
||||
UINT32 Event)
|
||||
{
|
||||
|
||||
AslGbl_Events[Event].EndTime = AcpiOsGetTimer();
|
||||
AslGbl_Events[Event].EndTime = (time_t) AcpiOsGetTimer();
|
||||
}
|
||||
|
||||
|
||||
@ -267,8 +298,8 @@ UtConvertByteToHex (
|
||||
Buffer[0] = '0';
|
||||
Buffer[1] = 'x';
|
||||
|
||||
Buffer[2] = hex[(RawByte >> 4) & 0xF];
|
||||
Buffer[3] = hex[RawByte & 0xF];
|
||||
Buffer[2] = (UINT8) hex[(RawByte >> 4) & 0xF];
|
||||
Buffer[3] = (UINT8) hex[RawByte & 0xF];
|
||||
}
|
||||
|
||||
|
||||
@ -294,8 +325,8 @@ UtConvertByteToAsmHex (
|
||||
|
||||
Buffer[0] = '0';
|
||||
|
||||
Buffer[1] = hex[(RawByte >> 4) & 0xF];
|
||||
Buffer[2] = hex[RawByte & 0xF];
|
||||
Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF];
|
||||
Buffer[2] = (UINT8) hex[RawByte & 0xF];
|
||||
Buffer[3] = 'h';
|
||||
}
|
||||
|
||||
@ -314,7 +345,7 @@ UtConvertByteToAsmHex (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
void
|
||||
DbgPrint (
|
||||
UINT32 Type,
|
||||
char *Fmt,
|
||||
@ -327,18 +358,18 @@ DbgPrint (
|
||||
|
||||
if (!Gbl_DebugFlag)
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Type == ASL_PARSE_OUTPUT) &&
|
||||
(!(AslCompilerdebug)))
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
vfprintf (stderr, Fmt, Args);
|
||||
(void) vfprintf (stderr, Fmt, Args);
|
||||
va_end (Args);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -365,7 +396,7 @@ UtPrintFormattedName (
|
||||
|
||||
DbgPrint (ASL_TREE_OUTPUT,
|
||||
"%*s %-16.16s", (3 * Level), " ",
|
||||
yytname[ParseOpcode-255]);
|
||||
UtGetOpName (ParseOpcode));
|
||||
|
||||
if (Level < TEXT_OFFSET)
|
||||
{
|
||||
@ -375,6 +406,26 @@ UtPrintFormattedName (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtSetParseOpName
|
||||
*
|
||||
* PARAMETERS: Op
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Insert the ascii name of the parse opcode
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
UtSetParseOpName (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), 12);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtGetOpName
|
||||
@ -392,7 +443,7 @@ UtGetOpName (
|
||||
UINT32 ParseOpcode)
|
||||
{
|
||||
|
||||
return (char *) yytname [ParseOpcode - 255];
|
||||
return ((char *) yytname [ParseOpcode - 255] + 8);
|
||||
}
|
||||
|
||||
|
||||
@ -421,12 +472,6 @@ UtDisplaySummary (
|
||||
CompilerId, CompilerVersion, __DATE__);
|
||||
}
|
||||
|
||||
/* Error summary */
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"Compilation complete. %d Errors %d Warnings\n",
|
||||
Gbl_ExceptionCount[ASL_ERROR], Gbl_ExceptionCount[ASL_WARNING]);
|
||||
|
||||
/* Input/Output summary */
|
||||
|
||||
FlPrintFile (FileId,
|
||||
@ -443,6 +488,12 @@ UtDisplaySummary (
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
|
||||
TotalNamedObjects, TotalExecutableOpcodes);
|
||||
}
|
||||
|
||||
/* Error summary */
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"Compilation complete. %d Errors %d Warnings\n",
|
||||
Gbl_ExceptionCount[ASL_ERROR], Gbl_ExceptionCount[ASL_WARNING]);
|
||||
}
|
||||
|
||||
|
||||
@ -450,19 +501,19 @@ UtDisplaySummary (
|
||||
*
|
||||
* FUNCTION: UtDisplaySummary
|
||||
*
|
||||
* PARAMETERS: Node - Integer parse node
|
||||
* PARAMETERS: Op - Integer parse node
|
||||
* LowValue - Smallest allowed value
|
||||
* HighValue - Largest allowed value
|
||||
*
|
||||
* RETURN: Node if OK, otherwise NULL
|
||||
* RETURN: Op if OK, otherwise NULL
|
||||
*
|
||||
* DESCRIPTION: Check integer for an allowable range
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_PARSE_NODE *
|
||||
ACPI_PARSE_OBJECT *
|
||||
UtCheckIntegerRange (
|
||||
ASL_PARSE_NODE *Node,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 LowValue,
|
||||
UINT32 HighValue)
|
||||
{
|
||||
@ -470,17 +521,17 @@ UtCheckIntegerRange (
|
||||
char Buffer[64];
|
||||
|
||||
|
||||
if (!Node)
|
||||
if (!Op)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (Node->Value.Integer64 < LowValue)
|
||||
if (Op->Asl.Value.Integer < LowValue)
|
||||
{
|
||||
ParseError = "Value below valid range";
|
||||
}
|
||||
|
||||
if (Node->Value.Integer64 > HighValue)
|
||||
if (Op->Asl.Value.Integer > HighValue)
|
||||
{
|
||||
ParseError = "Value above valid range";
|
||||
}
|
||||
@ -489,12 +540,12 @@ UtCheckIntegerRange (
|
||||
{
|
||||
sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue);
|
||||
AslCompilererror (Buffer);
|
||||
TrReleaseNode (Node);
|
||||
TrReleaseNode (Op);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return Node;
|
||||
return Op;
|
||||
}
|
||||
|
||||
|
||||
@ -589,8 +640,8 @@ UtInternalizeName (
|
||||
*
|
||||
* FUNCTION: UtAttachNamepathToOwner
|
||||
*
|
||||
* PARAMETERS: Node - Parent parse node
|
||||
* NameNode - Node that contains the name
|
||||
* PARAMETERS: Op - Parent parse node
|
||||
* NameOp - Node that contains the name
|
||||
*
|
||||
* RETURN: Sets the ExternalName and Namepath in the parent node
|
||||
*
|
||||
@ -602,15 +653,15 @@ UtInternalizeName (
|
||||
|
||||
void
|
||||
UtAttachNamepathToOwner (
|
||||
ASL_PARSE_NODE *Node,
|
||||
ASL_PARSE_NODE *NameNode)
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_PARSE_OBJECT *NameOp)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
Node->ExternalName = NameNode->Value.String;
|
||||
Op->Asl.ExternalName = NameOp->Asl.Value.String;
|
||||
|
||||
Status = UtInternalizeName (NameNode->Value.String, &Node->Namepath);
|
||||
Status = UtInternalizeName (NameOp->Asl.Value.String, &Op->Asl.Namepath);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* TBD: abort on no memory */
|
||||
@ -673,10 +724,8 @@ UtStrtoul64 (
|
||||
UINT32 Base,
|
||||
ACPI_INTEGER *RetInteger)
|
||||
{
|
||||
UINT32 converted = 0;
|
||||
UINT32 index;
|
||||
UINT32 sign;
|
||||
NATIVE_CHAR *StringStart;
|
||||
UINT32 Index;
|
||||
UINT32 Sign;
|
||||
ACPI_INTEGER ReturnValue = 0;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
@ -700,11 +749,8 @@ UtStrtoul64 (
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the value of the pointer to the buffer's first
|
||||
* character, save the current errno value, and then
|
||||
* skip over any white space in the buffer:
|
||||
*/
|
||||
StringStart = String;
|
||||
while (isspace (*String) || *String == '\t')
|
||||
{
|
||||
++String;
|
||||
@ -716,17 +762,17 @@ UtStrtoul64 (
|
||||
*/
|
||||
if (*String == '-')
|
||||
{
|
||||
sign = NEGATIVE;
|
||||
Sign = NEGATIVE;
|
||||
++String;
|
||||
}
|
||||
else if (*String == '+')
|
||||
{
|
||||
++String;
|
||||
sign = POSITIVE;
|
||||
Sign = POSITIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = POSITIVE;
|
||||
Sign = POSITIVE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -775,14 +821,14 @@ UtStrtoul64 (
|
||||
{
|
||||
if (isdigit (*String))
|
||||
{
|
||||
index = *String - '0';
|
||||
Index = ((UINT8) *String) - '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
index = toupper (*String);
|
||||
if (isupper (index))
|
||||
Index = (UINT8) toupper (*String);
|
||||
if (isupper ((char) Index))
|
||||
{
|
||||
index = index - 'A' + 10;
|
||||
Index = Index - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -790,14 +836,14 @@ UtStrtoul64 (
|
||||
}
|
||||
}
|
||||
|
||||
if (index >= Base)
|
||||
if (Index >= Base)
|
||||
{
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
/* Check to see if value is out of range: */
|
||||
|
||||
if (ReturnValue > ((ACPI_INTEGER_MAX - (ACPI_INTEGER) index) /
|
||||
if (ReturnValue > ((ACPI_INTEGER_MAX - (ACPI_INTEGER) Index) /
|
||||
(ACPI_INTEGER) Base))
|
||||
{
|
||||
goto ErrorExit;
|
||||
@ -805,8 +851,7 @@ UtStrtoul64 (
|
||||
else
|
||||
{
|
||||
ReturnValue *= Base;
|
||||
ReturnValue += index;
|
||||
converted = 1;
|
||||
ReturnValue += Index;
|
||||
}
|
||||
|
||||
++String;
|
||||
@ -816,7 +861,7 @@ UtStrtoul64 (
|
||||
/*
|
||||
* If a minus sign was present, then "the conversion is negated":
|
||||
*/
|
||||
if (sign == NEGATIVE)
|
||||
if (Sign == NEGATIVE)
|
||||
{
|
||||
ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
|
||||
}
|
||||
@ -840,6 +885,9 @@ ErrorExit:
|
||||
Status = AE_BAD_HEX_CONSTANT;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Base validated above */
|
||||
break;
|
||||
}
|
||||
|
||||
return (Status);
|
||||
|
Loading…
Reference in New Issue
Block a user