summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-08-16 20:54:52 +0000
committerjkim <jkim@FreeBSD.org>2012-08-16 20:54:52 +0000
commit7d706dc46f20aa3d7d386cd3f3df8e786e35e3cf (patch)
treea652303191b07ca59b5281e3606555d7db951183 /sys/contrib/dev/acpica/compiler
parentef6535e51ea1bac50944a3194c4e3ee845e9b696 (diff)
parent08e6f22ac3350a67c38e9b42b5dce2a7d5fa08b4 (diff)
downloadFreeBSD-src-7d706dc46f20aa3d7d386cd3f3df8e786e35e3cf.zip
FreeBSD-src-7d706dc46f20aa3d7d386cd3f3df8e786e35e3cf.tar.gz
Merge ACPICA 20120816.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.h5
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.y146
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfold.c129
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmessages.h2
-rw-r--r--sys/contrib/dev/acpica/compiler/asltree.c86
-rw-r--r--sys/contrib/dev/acpica/compiler/aslutils.c55
6 files changed, 263 insertions, 160 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h
index 03e1e14..15ede1d 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.h
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -594,6 +594,11 @@ TrSetNodeFlags (
UINT32 Flags);
ACPI_PARSE_OBJECT *
+TrSetNodeAmlLength (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Length);
+
+ACPI_PARSE_OBJECT *
TrLinkPeerNodes (
UINT32 NumPeers,
...);
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y
index 2688390..de830d4 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.y
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y
@@ -560,7 +560,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> SwitchTerm
%type <n> UnloadTerm
%type <n> WhileTerm
-//%type <n> CaseTermList
+/* %type <n> CaseTermList */
/* Type 2 opcodes */
@@ -2507,30 +2507,38 @@ ConstExprTerm
| PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
;
+/*
+ * The NODE_COMPILE_TIME_CONST flag in the following constant expressions
+ * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
+ * to simple integers. It is an error if these types of expressions cannot be
+ * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
+ * Note: The required byte length of the constant is passed through to the
+ * constant folding code in the node AmlLength field.
+ */
ByteConstExpr
- : Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
- | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
+ : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
+ | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
| ByteConst {}
;
WordConstExpr
- : Type3Opcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
- | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
+ : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
+ | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
| WordConst {}
;
DWordConstExpr
- : Type3Opcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
- | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
+ : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
+ | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
| DWordConst {}
;
QWordConstExpr
- : Type3Opcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
- | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
+ : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
+ | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
| ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
| QWordConst {}
;
@@ -2839,10 +2847,10 @@ ExtendedSpaceTerm
FixedDmaTerm
: PARSEOP_FIXEDDMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);}
- WordConstExpr // 04: DMA RequestLines
- ',' WordConstExpr // 06: DMA Channels
- OptionalXferSize // 07: DMA TransferSize
- OptionalNameString // 08: DescriptorName
+ WordConstExpr /* 04: DMA RequestLines */
+ ',' WordConstExpr /* 06: DMA Channels */
+ OptionalXferSize /* 07: DMA TransferSize */
+ OptionalNameString /* 08: DescriptorName */
')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);}
| PARSEOP_FIXEDDMA '('
error ')' {$$ = AslDoError(); yyclearin;}
@@ -2860,16 +2868,16 @@ FixedIOTerm
GpioIntTerm
: PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);}
- InterruptTypeKeyword // 04: InterruptType
- ',' InterruptLevel // 06: InterruptLevel
- OptionalShareType // 07: SharedType
- ',' PinConfigByte // 09: PinConfig
- OptionalWordConstExpr // 10: DebounceTimeout
- ',' StringData // 12: ResourceSource
- OptionalByteConstExpr // 13: ResourceSourceIndex
- OptionalResourceType // 14: ResourceType
- OptionalNameString // 15: DescriptorName
- OptionalBuffer_Last // 16: VendorData
+ InterruptTypeKeyword /* 04: InterruptType */
+ ',' InterruptLevel /* 06: InterruptLevel */
+ OptionalShareType /* 07: SharedType */
+ ',' PinConfigByte /* 09: PinConfig */
+ OptionalWordConstExpr /* 10: DebounceTimeout */
+ ',' StringData /* 12: ResourceSource */
+ OptionalByteConstExpr /* 13: ResourceSourceIndex */
+ OptionalResourceType /* 14: ResourceType */
+ OptionalNameString /* 15: DescriptorName */
+ OptionalBuffer_Last /* 16: VendorData */
')' '{'
DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);}
| PARSEOP_GPIO_INT '('
@@ -2878,16 +2886,16 @@ GpioIntTerm
GpioIoTerm
: PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);}
- OptionalShareType_First // 04: SharedType
- ',' PinConfigByte // 06: PinConfig
- OptionalWordConstExpr // 07: DebounceTimeout
- OptionalWordConstExpr // 08: DriveStrength
- OptionalIoRestriction // 09: IoRestriction
- ',' StringData // 11: ResourceSource
- OptionalByteConstExpr // 12: ResourceSourceIndex
- OptionalResourceType // 13: ResourceType
- OptionalNameString // 14: DescriptorName
- OptionalBuffer_Last // 15: VendorData
+ OptionalShareType_First /* 04: SharedType */
+ ',' PinConfigByte /* 06: PinConfig */
+ OptionalWordConstExpr /* 07: DebounceTimeout */
+ OptionalWordConstExpr /* 08: DriveStrength */
+ OptionalIoRestriction /* 09: IoRestriction */
+ ',' StringData /* 11: ResourceSource */
+ OptionalByteConstExpr /* 12: ResourceSourceIndex */
+ OptionalResourceType /* 13: ResourceType */
+ OptionalNameString /* 14: DescriptorName */
+ OptionalBuffer_Last /* 15: VendorData */
')' '{'
DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);}
| PARSEOP_GPIO_IO '('
@@ -2896,15 +2904,15 @@ GpioIoTerm
I2cSerialBusTerm
: PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);}
- WordConstExpr // 04: SlaveAddress
- OptionalSlaveMode // 05: SlaveMode
- ',' DWordConstExpr // 07: ConnectionSpeed
- OptionalAddressingMode // 08: AddressingMode
- ',' StringData // 10: ResourceSource
- OptionalByteConstExpr // 11: ResourceSourceIndex
- OptionalResourceType // 12: ResourceType
- OptionalNameString // 13: DescriptorName
- OptionalBuffer_Last // 14: VendorData
+ WordConstExpr /* 04: SlaveAddress */
+ OptionalSlaveMode /* 05: SlaveMode */
+ ',' DWordConstExpr /* 07: ConnectionSpeed */
+ OptionalAddressingMode /* 08: AddressingMode */
+ ',' StringData /* 10: ResourceSource */
+ OptionalByteConstExpr /* 11: ResourceSourceIndex */
+ OptionalResourceType /* 12: ResourceType */
+ OptionalNameString /* 13: DescriptorName */
+ OptionalBuffer_Last /* 14: VendorData */
')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);}
| PARSEOP_I2C_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
@@ -3077,19 +3085,19 @@ RegisterTerm
SpiSerialBusTerm
: PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);}
- WordConstExpr // 04: DeviceSelection
- OptionalDevicePolarity // 05: DevicePolarity
- OptionalWireMode // 06: WireMode
- ',' ByteConstExpr // 08: DataBitLength
- OptionalSlaveMode // 09: SlaveMode
- ',' DWordConstExpr // 11: ConnectionSpeed
- ',' ClockPolarityKeyword // 13: ClockPolarity
- ',' ClockPhaseKeyword // 15: ClockPhase
- ',' StringData // 17: ResourceSource
- OptionalByteConstExpr // 18: ResourceSourceIndex
- OptionalResourceType // 19: ResourceType
- OptionalNameString // 20: DescriptorName
- OptionalBuffer_Last // 21: VendorData
+ WordConstExpr /* 04: DeviceSelection */
+ OptionalDevicePolarity /* 05: DevicePolarity */
+ OptionalWireMode /* 06: WireMode */
+ ',' ByteConstExpr /* 08: DataBitLength */
+ OptionalSlaveMode /* 09: SlaveMode */
+ ',' DWordConstExpr /* 11: ConnectionSpeed */
+ ',' ClockPolarityKeyword /* 13: ClockPolarity */
+ ',' ClockPhaseKeyword /* 15: ClockPhase */
+ ',' StringData /* 17: ResourceSource */
+ OptionalByteConstExpr /* 18: ResourceSourceIndex */
+ OptionalResourceType /* 19: ResourceType */
+ OptionalNameString /* 20: DescriptorName */
+ OptionalBuffer_Last /* 21: VendorData */
')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);}
| PARSEOP_SPI_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
@@ -3115,20 +3123,20 @@ StartDependentFnTerm
UartSerialBusTerm
: PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);}
- DWordConstExpr // 04: ConnectionSpeed
- OptionalBitsPerByte // 05: BitsPerByte
- OptionalStopBits // 06: StopBits
- ',' ByteConstExpr // 08: LinesInUse
- OptionalEndian // 09: Endianess
- OptionalParityType // 10: Parity
- OptionalFlowControl // 11: FlowControl
- ',' WordConstExpr // 13: Rx BufferSize
- ',' WordConstExpr // 15: Tx BufferSize
- ',' StringData // 17: ResourceSource
- OptionalByteConstExpr // 18: ResourceSourceIndex
- OptionalResourceType // 19: ResourceType
- OptionalNameString // 20: DescriptorName
- OptionalBuffer_Last // 21: VendorData
+ DWordConstExpr /* 04: ConnectionSpeed */
+ OptionalBitsPerByte /* 05: BitsPerByte */
+ OptionalStopBits /* 06: StopBits */
+ ',' ByteConstExpr /* 08: LinesInUse */
+ OptionalEndian /* 09: Endianess */
+ OptionalParityType /* 10: Parity */
+ OptionalFlowControl /* 11: FlowControl */
+ ',' WordConstExpr /* 13: Rx BufferSize */
+ ',' WordConstExpr /* 15: Tx BufferSize */
+ ',' StringData /* 17: ResourceSource */
+ OptionalByteConstExpr /* 18: ResourceSourceIndex */
+ OptionalResourceType /* 19: ResourceType */
+ OptionalNameString /* 20: DescriptorName */
+ OptionalBuffer_Last /* 21: VendorData */
')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);}
| PARSEOP_UART_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c
index 61a2944..888a94a 100644
--- a/sys/contrib/dev/acpica/compiler/aslfold.c
+++ b/sys/contrib/dev/acpica/compiler/aslfold.c
@@ -73,6 +73,11 @@ OpcAmlCheckForConstant (
UINT32 Level,
void *Context);
+static void
+OpcUpdateIntegerNode (
+ ACPI_PARSE_OBJECT *Op,
+ UINT64 Value);
+
/*******************************************************************************
*
@@ -214,14 +219,14 @@ OpcAmlCheckForConstant (
{
/*
* We are looking at at normal expression to see if it can be
- * reduced. It can't. No error
+ * reduced. It can't. No error
*/
return (AE_TYPE);
}
/*
* This is an expression that MUST reduce to a constant, and it
- * can't be reduced. This is an error
+ * can't be reduced. This is an error
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
@@ -319,17 +324,17 @@ OpcAmlConstantWalk (
return AE_NO_MEMORY;
}
- WalkState->NextOp = NULL;
- WalkState->Params = NULL;
- WalkState->CallerReturnDesc = &ObjDesc;
- WalkState->WalkType = WalkType;
+ WalkState->NextOp = NULL;
+ WalkState->Params = NULL;
+ WalkState->WalkType = WalkType;
+ WalkState->CallerReturnDesc = &ObjDesc;
/*
* Examine the entire subtree -- all nodes must be constants
* or type 3/4/5 opcodes
*/
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,
- OpcAmlCheckForConstant, NULL, WalkState);
+ OpcAmlCheckForConstant, NULL, WalkState);
/*
* Did we find an entire subtree that contains all constants and type 3/4/5
@@ -369,7 +374,7 @@ OpcAmlConstantWalk (
/* Hand off the subtree to the AML interpreter */
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE,
- OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
+ OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
Op->Common.Parent = OriginalParentOp;
/* TBD: we really *should* release the RootOp node */
@@ -382,22 +387,26 @@ OpcAmlConstantWalk (
Status = AcpiDsResultPop (&ObjDesc, WalkState);
}
+
+ /* Check for error from the ACPICA core */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AslCoreSubsystemError (Op, Status,
+ "Failure during constant evaluation", FALSE);
+ }
}
if (ACPI_FAILURE (Status))
{
/* We could not resolve the subtree for some reason */
- AslCoreSubsystemError (Op, Status,
- "Failure during constant evaluation", FALSE);
AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op,
Op->Asl.ParseOpName);
- /* Set the subtree value to ZERO anyway. Eliminates further errors */
+ /* Set the subtree value to ZERO anyway. Eliminates further errors */
- Op->Asl.ParseOpcode = PARSEOP_INTEGER;
- Op->Common.Value.Integer = 0;
- OpcSetOptimalIntegerSize (Op);
+ OpcUpdateIntegerNode (Op, 0);
}
else
{
@@ -412,21 +421,20 @@ OpcAmlConstantWalk (
{
case ACPI_TYPE_INTEGER:
- Op->Asl.ParseOpcode = PARSEOP_INTEGER;
- Op->Common.Value.Integer = ObjDesc->Integer.Value;
- OpcSetOptimalIntegerSize (Op);
+ OpcUpdateIntegerNode (Op, ObjDesc->Integer.Value);
DbgPrint (ASL_PARSE_OUTPUT,
- "Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+ "Constant expression reduced to (%s) %8.8X%8.8X\n",
+ Op->Asl.ParseOpName,
+ ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
break;
case ACPI_TYPE_STRING:
- Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
- Op->Common.AmlOpcode = AML_STRING_OP;
- Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
+ Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
+ Op->Common.AmlOpcode = AML_STRING_OP;
+ Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
Op->Common.Value.String = ObjDesc->String.Pointer;
DbgPrint (ASL_PARSE_OUTPUT,
@@ -438,18 +446,18 @@ OpcAmlConstantWalk (
case ACPI_TYPE_BUFFER:
- Op->Asl.ParseOpcode = PARSEOP_BUFFER;
- Op->Common.AmlOpcode = AML_BUFFER_OP;
- Op->Asl.CompileFlags = NODE_AML_PACKAGE;
+ Op->Asl.ParseOpcode = PARSEOP_BUFFER;
+ Op->Common.AmlOpcode = AML_BUFFER_OP;
+ Op->Asl.CompileFlags = NODE_AML_PACKAGE;
UtSetParseOpName (Op);
/* Child node is the buffer length */
RootOp = TrAllocateNode (PARSEOP_INTEGER);
- RootOp->Asl.AmlOpcode = AML_DWORD_OP;
+ RootOp->Asl.AmlOpcode = AML_DWORD_OP;
RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
- RootOp->Asl.Parent = Op;
+ RootOp->Asl.Parent = Op;
(void) OpcSetOptimalIntegerSize (RootOp);
@@ -460,10 +468,10 @@ OpcAmlConstantWalk (
/* Peer to the child is the raw buffer data */
RootOp = TrAllocateNode (PARSEOP_RAW_DATA);
- RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
- RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
- RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
- RootOp->Asl.Parent = Op->Asl.Parent;
+ RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+ RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
+ RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
+ RootOp->Asl.Parent = Op->Asl.Parent;
Op->Asl.Next = RootOp;
Op = RootOp;
@@ -476,7 +484,7 @@ OpcAmlConstantWalk (
default:
printf ("Unsupported return type: %s\n",
- AcpiUtGetObjectTypeName (ObjDesc));
+ AcpiUtGetObjectTypeName (ObjDesc));
break;
}
}
@@ -485,7 +493,62 @@ OpcAmlConstantWalk (
Op->Asl.Child = NULL;
AcpiDsDeleteWalkState (WalkState);
-
return (AE_CTRL_DEPTH);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcUpdateIntegerNode
+ *
+ * PARAMETERS: Op - Current parse object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Update node to the correct integer type.
+ *
+ ******************************************************************************/
+
+static void
+OpcUpdateIntegerNode (
+ ACPI_PARSE_OBJECT *Op,
+ UINT64 Value)
+{
+
+ Op->Common.Value.Integer = Value;
+
+ /*
+ * The AmlLength is used by the parser to indicate a constant,
+ * (if non-zero). Length is either (1/2/4/8)
+ */
+ switch (Op->Asl.AmlLength)
+ {
+ case 1:
+ TrUpdateNode (PARSEOP_BYTECONST, Op);
+ Op->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ break;
+
+ case 2:
+ TrUpdateNode (PARSEOP_WORDCONST, Op);
+ Op->Asl.AmlOpcode = AML_RAW_DATA_WORD;
+ break;
+
+ case 4:
+ TrUpdateNode (PARSEOP_DWORDCONST, Op);
+ Op->Asl.AmlOpcode = AML_RAW_DATA_DWORD;
+ break;
+
+ case 8:
+ TrUpdateNode (PARSEOP_QWORDCONST, Op);
+ Op->Asl.AmlOpcode = AML_RAW_DATA_QWORD;
+ break;
+
+ case 0:
+ default:
+ OpcSetOptimalIntegerSize (Op);
+ TrUpdateNode (PARSEOP_INTEGER, Op);
+ break;
+ }
+
+ Op->Asl.AmlLength = 0;
+}
diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h
index 595e5f4..4c4e79a 100644
--- a/sys/contrib/dev/acpica/compiler/aslmessages.h
+++ b/sys/contrib/dev/acpica/compiler/aslmessages.h
@@ -197,6 +197,7 @@ typedef enum
ASL_MSG_UPPER_CASE,
ASL_MSG_VENDOR_LIST,
ASL_MSG_WRITE,
+ ASL_MSG_RANGE,
/* These messages are used by the Preprocessor only */
@@ -371,6 +372,7 @@ char *AslMessages [] = {
/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case",
/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
/* ASL_MSG_WRITE */ "Could not write file",
+/* ASL_MSG_RANGE */ "Constant out of range",
/* Preprocessor */
diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c
index 8e3e970..916a7e4 100644
--- a/sys/contrib/dev/acpica/compiler/asltree.c
+++ b/sys/contrib/dev/acpica/compiler/asltree.c
@@ -68,9 +68,9 @@ TrGetNodeFlagName (
*
* PARAMETERS: None
*
- * RETURN: New parse node. Aborts on allocation failure
+ * RETURN: New parse node. Aborts on allocation failure
*
- * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
+ * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
* dynamic memory manager for performance reasons (This has a
* major impact on the speed of the compiler.)
*
@@ -98,7 +98,7 @@ TrGetNextNode (
*
* PARAMETERS: ParseOpcode - Opcode to be assigned to the node
*
- * RETURN: New parse node. Aborts on allocation failure
+ * RETURN: New parse node. Aborts on allocation failure
*
* DESCRIPTION: Allocate and initialize a new parse node for the parse tree
*
@@ -133,7 +133,7 @@ TrAllocateNode (
*
* RETURN: None
*
- * DESCRIPTION: "release" a node. In truth, nothing is done since the node
+ * DESCRIPTION: "release" a node. In truth, nothing is done since the node
* is part of a larger buffer
*
******************************************************************************/
@@ -156,9 +156,9 @@ TrReleaseNode (
*
* RETURN: The updated node
*
- * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to
+ * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to
* change an opcode to DEFAULT_ARG so that the node is ignored
- * during the code generation. Also used to set generic integers
+ * during the code generation. Also used to set generic integers
* to a specific size (8, 16, 32, or 64 bits)
*
******************************************************************************/
@@ -186,19 +186,21 @@ TrUpdateNode (
switch (ParseOpcode)
{
case PARSEOP_BYTECONST:
- Op->Asl.Value.Integer = 0xFF;
+ Op->Asl.Value.Integer = ACPI_UINT8_MAX;
break;
case PARSEOP_WORDCONST:
- Op->Asl.Value.Integer = 0xFFFF;
+ Op->Asl.Value.Integer = ACPI_UINT16_MAX;
break;
case PARSEOP_DWORDCONST:
- Op->Asl.Value.Integer = 0xFFFFFFFF;
+ Op->Asl.Value.Integer = ACPI_UINT32_MAX;
break;
+ /* Don't need to do the QWORD case */
+
default:
- /* Don't care about others, don't need to check QWORD */
+ /* Don't care about others */
break;
}
}
@@ -213,15 +215,18 @@ TrUpdateNode (
switch (ParseOpcode)
{
case PARSEOP_BYTECONST:
- Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
+ UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
+ Op->Asl.Value.Integer &= ACPI_UINT8_MAX;
break;
case PARSEOP_WORDCONST:
- Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
+ UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
+ Op->Asl.Value.Integer &= ACPI_UINT16_MAX;
break;
case PARSEOP_DWORDCONST:
- Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
+ UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
+ Op->Asl.Value.Integer &= ACPI_UINT32_MAX;
break;
default:
@@ -315,7 +320,7 @@ TrGetNodeFlagName (
*
* RETURN: The updated parser op
*
- * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
+ * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
*
******************************************************************************/
@@ -335,8 +340,41 @@ TrSetNodeFlags (
}
Op->Asl.CompileFlags |= Flags;
+ return (Op);
+}
- return Op;
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrSetNodeAmlLength
+ *
+ * PARAMETERS: Op - An existing parse node
+ * Length - AML Length
+ *
+ * RETURN: The updated parser op
+ *
+ * DESCRIPTION: Set the AML Length in a node. Used by the parser to indicate
+ * the presence of a node that must be reduced to a fixed length
+ * constant.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrSetNodeAmlLength (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Length)
+{
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nSetNodeAmlLength: Op %p, %8.8X\n", Op, Length);
+
+ if (!Op)
+ {
+ return NULL;
+ }
+
+ Op->Asl.AmlLength = Length;
+ return (Op);
}
@@ -376,7 +414,7 @@ TrSetEndLineNumber (
*
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
*
- * RETURN: Pointer to the new node. Aborts on allocation failure
+ * RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a simple leaf node (no children or peers, and no value
* assigned to the node)
@@ -406,7 +444,7 @@ TrCreateLeafNode (
*
* PARAMETERS: ParseOpcode - The constant opcode
*
- * RETURN: Pointer to the new node. Aborts on allocation failure
+ * RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a leaf node (no children or peers) for one of the
* special constants - __LINE__, __FILE__, and __DATE__.
@@ -488,7 +526,7 @@ TrCreateConstantLeafNode (
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
* Value - Value to be assigned to the node
*
- * RETURN: Pointer to the new node. Aborts on allocation failure
+ * RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a leaf node (no children or peers) with a value
* assigned to it
@@ -553,9 +591,9 @@ TrCreateValuedLeafNode (
* PARAMETERS: ParseOpcode - Opcode to be assigned to the node
* NumChildren - Number of children to follow
* ... - A list of child nodes to link to the new
- * node. NumChildren long.
+ * node. NumChildren long.
*
- * RETURN: Pointer to the new node. Aborts on allocation failure
+ * RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a new parse node and link together a list of child
* nodes underneath the new node.
@@ -621,7 +659,7 @@ TrCreateNode (
/*
* If child is NULL, this means that an optional argument
- * was omitted. We must create a placeholder with a special
+ * was omitted. We must create a placeholder with a special
* opcode (DEFAULT_ARG) so that the code generator will know
* that it must emit the correct default for this argument
*/
@@ -675,7 +713,7 @@ TrCreateNode (
* PARAMETERS: Op - An existing parse node
* NumChildren - Number of children to follow
* ... - A list of child nodes to link to the new
- * node. NumChildren long.
+ * node. NumChildren long.
*
* RETURN: The updated (linked) node
*
@@ -745,7 +783,7 @@ TrLinkChildren (
/*
* If child is NULL, this means that an optional argument
- * was omitted. We must create a placeholder with a special
+ * was omitted. We must create a placeholder with a special
* opcode (DEFAULT_ARG) so that the code generator will know
* that it must emit the correct default for this argument
*/
@@ -800,7 +838,7 @@ TrLinkChildren (
*
* RETURN: Op1 or the non-null node.
*
- * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null.
+ * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null.
*
******************************************************************************/
diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c
index eb1d13d..db9c784 100644
--- a/sys/contrib/dev/acpica/compiler/aslutils.c
+++ b/sys/contrib/dev/acpica/compiler/aslutils.c
@@ -105,34 +105,34 @@ UtAttachNameseg (
*
******************************************************************************/
+#define ACPI_TABLE_HELP_FORMAT "%8u) %s %s\n"
+
void
UtDisplaySupportedTables (
void)
{
ACPI_DMTABLE_DATA *TableData;
- UINT32 i = 6;
+ UINT32 i;
- printf ("\nACPI tables supported by iASL subsystems in "
- "version %8.8X:\n"
- " ASL and Data Table compilers\n"
- " AML and Data Table disassemblers\n"
- " ACPI table template generator\n\n", ACPI_CA_VERSION);
+ printf ("\nACPI tables supported by iASL version %8.8X:\n"
+ " (Compiler, Disassembler, Template Generator)\n\n",
+ ACPI_CA_VERSION);
/* Special tables */
- printf ("%8u) %s %s\n", 1, ACPI_SIG_DSDT, "Differentiated System Description Table");
- printf ("%8u) %s %s\n", 2, ACPI_SIG_SSDT, "Secondary System Description Table");
- printf ("%8u) %s %s\n", 3, ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)");
- printf ("%8u) %s %s\n", 4, ACPI_SIG_FACS, "Firmware ACPI Control Structure");
- printf ("%8u) %s %s\n", 5, ACPI_RSDP_NAME, "Root System Description Pointer");
+ printf (" Special tables and AML tables:\n");
+ printf (ACPI_TABLE_HELP_FORMAT, 1, ACPI_RSDP_NAME, "Root System Description Pointer");
+ printf (ACPI_TABLE_HELP_FORMAT, 2, ACPI_SIG_FACS, "Firmware ACPI Control Structure");
+ printf (ACPI_TABLE_HELP_FORMAT, 3, ACPI_SIG_DSDT, "Differentiated System Description Table");
+ printf (ACPI_TABLE_HELP_FORMAT, 4, ACPI_SIG_SSDT, "Secondary System Description Table");
/* All data tables with common table header */
- for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
+ printf ("\n Standard ACPI data tables:\n");
+ for (TableData = AcpiDmTableData, i = 5; TableData->Signature; TableData++, i++)
{
- printf ("%8u) %s %s\n", i, TableData->Signature, TableData->Name);
- i++;
+ printf (ACPI_TABLE_HELP_FORMAT, i, TableData->Signature, TableData->Name);
}
}
@@ -591,36 +591,23 @@ UtCheckIntegerRange (
UINT32 LowValue,
UINT32 HighValue)
{
- char *ParseError = NULL;
- char Buffer[64];
-
if (!Op)
{
return NULL;
}
- if (Op->Asl.Value.Integer < LowValue)
- {
- ParseError = "Value below valid range";
- Op->Asl.Value.Integer = LowValue;
- }
-
- if (Op->Asl.Value.Integer > HighValue)
+ if ((Op->Asl.Value.Integer < LowValue) ||
+ (Op->Asl.Value.Integer > HighValue))
{
- ParseError = "Value above valid range";
- Op->Asl.Value.Integer = HighValue;
- }
+ sprintf (MsgBuffer, "0x%X, allowable: 0x%X-0x%X",
+ (UINT32) Op->Asl.Value.Integer, LowValue, HighValue);
- if (ParseError)
- {
- sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue);
- AslCompilererror (Buffer);
-
- return NULL;
+ AslError (ASL_ERROR, ASL_MSG_RANGE, Op, MsgBuffer);
+ return (NULL);
}
- return Op;
+ return (Op);
}
OpenPOWER on IntegriCloud