summaryrefslogtreecommitdiff
path: root/source/compiler/aslfold.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-06-16 19:48:16 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-06-16 19:48:16 +0000
commit8811b910b092027f905013bced1da3e87c6b07b9 (patch)
treeb0c56a23f2d8877b9431deb3cab73df3c1913fb7 /source/compiler/aslfold.c
parent0c85196b0c51b4e5eba8fcace026f947f9112c9e (diff)
Notes
Diffstat (limited to 'source/compiler/aslfold.c')
-rw-r--r--source/compiler/aslfold.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c
index 8c11860e6813..6baa081359d8 100644
--- a/source/compiler/aslfold.c
+++ b/source/compiler/aslfold.c
@@ -380,10 +380,12 @@ TrSimpleConstantReduction (
return (Status);
}
+ /* Disconnect any existing children, install new constant */
+
+ Op->Asl.Child = NULL;
TrInstallReducedConstant (Op, ObjDesc);
UtSetParseOpName (Op);
- Op->Asl.Child = NULL;
return (AE_OK);
}
@@ -547,7 +549,8 @@ TrInstallReducedConstant (
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT *ObjDesc)
{
- ACPI_PARSE_OBJECT *RootOp;
+ ACPI_PARSE_OBJECT *LengthOp;
+ ACPI_PARSE_OBJECT *DataOp;
TotalFolds++;
@@ -574,17 +577,22 @@ TrInstallReducedConstant (
Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
Op->Common.AmlOpcode = AML_STRING_OP;
- Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
+ Op->Asl.AmlLength = strlen (ObjDesc->String.Pointer) + 1;
Op->Common.Value.String = ObjDesc->String.Pointer;
DbgPrint (ASL_PARSE_OUTPUT,
"Constant expression reduced to (STRING) %s\n\n",
Op->Common.Value.String);
-
break;
case ACPI_TYPE_BUFFER:
-
+ /*
+ * Create a new parse subtree of the form:
+ *
+ * BUFFER (Buffer AML opcode)
+ * INTEGER (Buffer length in bytes)
+ * RAW_DATA (Buffer byte data)
+ */
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
Op->Asl.CompileFlags = NODE_AML_PACKAGE;
@@ -592,28 +600,24 @@ TrInstallReducedConstant (
/* Child node is the buffer length */
- RootOp = TrAllocateNode (PARSEOP_INTEGER);
+ LengthOp = TrAllocateNode (PARSEOP_INTEGER);
- RootOp->Asl.AmlOpcode = AML_DWORD_OP;
- RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
- RootOp->Asl.Parent = Op;
+ LengthOp->Asl.AmlOpcode = AML_DWORD_OP;
+ LengthOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
+ LengthOp->Asl.Parent = Op;
+ (void) OpcSetOptimalIntegerSize (LengthOp);
- (void) OpcSetOptimalIntegerSize (RootOp);
-
- Op->Asl.Child = RootOp;
- Op = RootOp;
- UtSetParseOpName (Op);
+ Op->Asl.Child = LengthOp;
- /* Peer to the child is the raw buffer data */
+ /* Next 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;
+ DataOp = TrAllocateNode (PARSEOP_RAW_DATA);
+ DataOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+ DataOp->Asl.AmlLength = ObjDesc->Buffer.Length;
+ DataOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
+ DataOp->Asl.Parent = Op;
- Op->Asl.Next = RootOp;
- Op = RootOp;
+ LengthOp->Asl.Next = DataOp;
DbgPrint (ASL_PARSE_OUTPUT,
"Constant expression reduced to (BUFFER) length %X\n\n",