aboutsummaryrefslogtreecommitdiff
path: root/source/components/parser
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/parser')
-rw-r--r--source/components/parser/psargs.c30
-rw-r--r--source/components/parser/psloop.c39
-rw-r--r--source/components/parser/psobject.c36
-rw-r--r--source/components/parser/psopcode.c13
-rw-r--r--source/components/parser/psopinfo.c2
-rw-r--r--source/components/parser/psparse.c6
-rw-r--r--source/components/parser/pstree.c9
-rw-r--r--source/components/parser/psutils.c13
8 files changed, 131 insertions, 17 deletions
diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c
index 22f7a2907f15..4fc55b2e1866 100644
--- a/source/components/parser/psargs.c
+++ b/source/components/parser/psargs.c
@@ -47,6 +47,7 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdispat.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psargs")
@@ -208,7 +209,7 @@ AcpiPsGetNextNamestring (
End += 1 + (2 * ACPI_NAME_SIZE);
break;
- case AML_MULTI_NAME_PREFIX_OP:
+ case AML_MULTI_NAME_PREFIX:
/* Multiple name segments, 4 chars each, count in next byte */
@@ -369,7 +370,7 @@ AcpiPsGetNextNamepath (
/* 2) NotFound during a CondRefOf(x) is ok by definition */
- else if (WalkState->Op->Common.AmlOpcode == AML_COND_REF_OF_OP)
+ else if (WalkState->Op->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP)
{
Status = AE_OK;
}
@@ -381,7 +382,7 @@ AcpiPsGetNextNamepath (
*/
else if ((Arg->Common.Parent) &&
((Arg->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
- (Arg->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
+ (Arg->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
{
Status = AE_OK;
}
@@ -543,6 +544,7 @@ AcpiPsGetNextField (
ACPI_FUNCTION_TRACE (PsGetNextField);
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
Aml = ParserState->Aml;
/* Determine field type */
@@ -589,6 +591,7 @@ AcpiPsGetNextField (
/* Decode the field type */
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
switch (Opcode)
{
case AML_INT_NAMEDFIELD_OP:
@@ -599,6 +602,23 @@ AcpiPsGetNextField (
AcpiPsSetName (Field, Name);
ParserState->Aml += ACPI_NAME_SIZE;
+
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
+
+#ifdef ACPI_ASL_COMPILER
+ /*
+ * Because the package length isn't represented as a parse tree object,
+ * take comments surrounding this and add to the previously created
+ * parse node.
+ */
+ if (Field->Common.InlineComment)
+ {
+ Field->Common.NameComment = Field->Common.InlineComment;
+ }
+ Field->Common.InlineComment = AcpiGbl_CurrentInlineComment;
+ AcpiGbl_CurrentInlineComment = NULL;
+#endif
+
/* Get the length which is encoded as a package length */
Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
@@ -655,10 +675,12 @@ AcpiPsGetNextField (
{
ParserState->Aml++;
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
PkgEnd = ParserState->Aml;
PkgLength = AcpiPsGetNextPackageLength (ParserState);
PkgEnd += PkgLength;
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
if (ParserState->Aml < PkgEnd)
{
/* Non-empty list */
@@ -675,6 +697,7 @@ AcpiPsGetNextField (
Opcode = ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
switch (Opcode)
{
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
@@ -703,6 +726,7 @@ AcpiPsGetNextField (
/* Fill in bytelist data */
+ ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
Arg->Named.Value.Size = BufferLength;
Arg->Named.Data = ParserState->Aml;
}
diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c
index be5b2607c7e7..9ff8bcfb77e6 100644
--- a/source/components/parser/psloop.c
+++ b/source/components/parser/psloop.c
@@ -55,6 +55,7 @@
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psloop")
@@ -142,6 +143,22 @@ AcpiPsGetArguments (
{
WalkState->Aml = WalkState->ParserState.Aml;
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_METHOD_OP:
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VARIABLE_PACKAGE_OP:
+ case AML_WHILE_OP:
+
+ break;
+
+ default:
+
+ ASL_CV_CAPTURE_COMMENTS (WalkState);
+ break;
+ }
+
Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
if (ACPI_FAILURE (Status))
@@ -249,7 +266,7 @@ AcpiPsGetArguments (
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
+ case AML_VARIABLE_PACKAGE_OP:
if ((Op->Common.Parent) &&
(Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
@@ -487,6 +504,8 @@ AcpiPsParseLoop (
while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
{
+ ASL_CV_CAPTURE_COMMENTS (WalkState);
+
AmlOpStart = ParserState->Aml;
if (!Op)
{
@@ -520,12 +539,26 @@ AcpiPsParseLoop (
AcpiExStartTraceOpcode (Op, WalkState);
}
-
/*
* Start ArgCount at zero because we don't know if there are
* any args yet
*/
- WalkState->ArgCount = 0;
+ WalkState->ArgCount = 0;
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP:
+ case AML_WORD_OP:
+ case AML_DWORD_OP:
+ case AML_QWORD_OP:
+
+ break;
+
+ default:
+
+ ASL_CV_CAPTURE_COMMENTS (WalkState);
+ break;
+ }
/* Are there any arguments that must be processed? */
diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c
index 7f1a0860f14e..bcc2aa2686dd 100644
--- a/source/components/parser/psobject.c
+++ b/source/components/parser/psobject.c
@@ -45,6 +45,7 @@
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psobject")
@@ -201,6 +202,7 @@ AcpiPsBuildNamedOp (
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
(GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
{
+ ASL_CV_CAPTURE_COMMENTS (WalkState);
Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
if (ACPI_FAILURE (Status))
@@ -212,6 +214,18 @@ AcpiPsBuildNamedOp (
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
+ /* are there any inline comments associated with the NameSeg?? If so, save this. */
+
+ ASL_CV_CAPTURE_COMMENTS (WalkState);
+
+#ifdef ACPI_ASL_COMPILER
+ if (AcpiGbl_CurrentInlineComment != NULL)
+ {
+ UnnamedOp->Common.NameComment = AcpiGbl_CurrentInlineComment;
+ AcpiGbl_CurrentInlineComment = NULL;
+ }
+#endif
+
/*
* Make sure that we found a NAME and didn't run out of arguments
*/
@@ -257,6 +271,28 @@ AcpiPsBuildNamedOp (
AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
+#ifdef ACPI_ASL_COMPILER
+
+ /* save any comments that might be associated with UnnamedOp. */
+
+ (*Op)->Common.InlineComment = UnnamedOp->Common.InlineComment;
+ (*Op)->Common.EndNodeComment = UnnamedOp->Common.EndNodeComment;
+ (*Op)->Common.CloseBraceComment = UnnamedOp->Common.CloseBraceComment;
+ (*Op)->Common.NameComment = UnnamedOp->Common.NameComment;
+ (*Op)->Common.CommentList = UnnamedOp->Common.CommentList;
+ (*Op)->Common.EndBlkComment = UnnamedOp->Common.EndBlkComment;
+ (*Op)->Common.CvFilename = UnnamedOp->Common.CvFilename;
+ (*Op)->Common.CvParentFilename = UnnamedOp->Common.CvParentFilename;
+ (*Op)->Named.Aml = UnnamedOp->Common.Aml;
+
+ UnnamedOp->Common.InlineComment = NULL;
+ UnnamedOp->Common.EndNodeComment = NULL;
+ UnnamedOp->Common.CloseBraceComment = NULL;
+ UnnamedOp->Common.NameComment = NULL;
+ UnnamedOp->Common.CommentList = NULL;
+ UnnamedOp->Common.EndBlkComment = NULL;
+#endif
+
if ((*Op)->Common.AmlOpcode == AML_REGION_OP ||
(*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)
{
diff --git a/source/components/parser/psopcode.c b/source/components/parser/psopcode.c
index 968d7db9df9f..c355c3da791d 100644
--- a/source/components/parser/psopcode.c
+++ b/source/components/parser/psopcode.c
@@ -72,7 +72,7 @@
AML_DEVICE_OP
AML_THERMAL_ZONE_OP
AML_METHOD_OP
- AML_POWER_RES_OP
+ AML_POWER_RESOURCE_OP
AML_PROCESSOR_OP
AML_FIELD_OP
AML_INDEX_FIELD_OP
@@ -98,7 +98,7 @@
AML_DEVICE_OP
AML_THERMAL_ZONE_OP
AML_METHOD_OP
- AML_POWER_RES_OP
+ AML_POWER_RESOURCE_OP
AML_PROCESSOR_OP
AML_FIELD_OP
AML_INDEX_FIELD_OP
@@ -116,7 +116,7 @@
AML_DEVICE_OP
AML_THERMAL_ZONE_OP
AML_METHOD_OP
- AML_POWER_RES_OP
+ AML_POWER_RESOURCE_OP
AML_PROCESSOR_OP
AML_NAME_OP
AML_ALIAS_OP
@@ -139,7 +139,7 @@
AML_DEVICE_OP
AML_THERMAL_ZONE_OP
AML_METHOD_OP
- AML_POWER_RES_OP
+ AML_POWER_RESOURCE_OP
AML_PROCESSOR_OP
AML_NAME_OP
AML_ALIAS_OP
@@ -152,7 +152,7 @@
must be deferred until needed
AML_METHOD_OP
- AML_VAR_PACKAGE_OP
+ AML_VARIABLE_PACKAGE_OP
AML_CREATE_FIELD_OP
AML_CREATE_BIT_FIELD_OP
AML_CREATE_BYTE_FIELD_OP
@@ -337,7 +337,8 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
/* ACPI 6.0 opcodes */
-/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE,/* ? */ AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R)
+/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE,/* ? */ AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
+/* 82 */ ACPI_OP ("Comment", ARGP_COMMENT_OP, ARGI_COMMENT_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT)
/*! [End] no source code translation !*/
};
diff --git a/source/components/parser/psopinfo.c b/source/components/parser/psopinfo.c
index fa4bb1152edf..d8f812945e25 100644
--- a/source/components/parser/psopinfo.c
+++ b/source/components/parser/psopinfo.c
@@ -242,7 +242,7 @@ const UINT8 AcpiGbl_ShortOpIndex[256] =
/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
-/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xA8 */ 0x62, 0x82, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c
index d8ec494a2d75..112a4fcb91f5 100644
--- a/source/components/parser/psparse.c
+++ b/source/components/parser/psparse.c
@@ -114,7 +114,7 @@ AcpiPsPeekOpcode (
Aml = ParserState->Aml;
Opcode = (UINT16) ACPI_GET8 (Aml);
- if (Opcode == AML_EXTENDED_OP_PREFIX)
+ if (Opcode == AML_EXTENDED_PREFIX)
{
/* Extended opcode, get the second opcode byte */
@@ -218,7 +218,7 @@ AcpiPsCompleteThisOp (
(Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) ||
- (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
{
ReplacementOp = AcpiPsAllocOp (
AML_INT_RETURN_VALUE_OP, Op->Common.Aml);
@@ -232,7 +232,7 @@ AcpiPsCompleteThisOp (
{
if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
(Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
- (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+ (Op->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
{
ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode,
Op->Common.Aml);
diff --git a/source/components/parser/pstree.c b/source/components/parser/pstree.c
index 0e150bc563c4..94658cc4cdcd 100644
--- a/source/components/parser/pstree.c
+++ b/source/components/parser/pstree.c
@@ -45,6 +45,7 @@
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("pstree")
@@ -242,6 +243,7 @@ AcpiPsGetDepthNext (
Next = AcpiPsGetArg (Op, 0);
if (Next)
{
+ ASL_CV_LABEL_FILENODE (Next);
return (Next);
}
@@ -250,6 +252,7 @@ AcpiPsGetDepthNext (
Next = Op->Common.Next;
if (Next)
{
+ ASL_CV_LABEL_FILENODE (Next);
return (Next);
}
@@ -262,6 +265,8 @@ AcpiPsGetDepthNext (
Arg = AcpiPsGetArg (Parent, 0);
while (Arg && (Arg != Origin) && (Arg != Op))
{
+
+ ASL_CV_LABEL_FILENODE (Arg);
Arg = Arg->Common.Next;
}
@@ -276,6 +281,7 @@ AcpiPsGetDepthNext (
{
/* Found sibling of parent */
+ ASL_CV_LABEL_FILENODE (Parent->Common.Next);
return (Parent->Common.Next);
}
@@ -283,6 +289,7 @@ AcpiPsGetDepthNext (
Parent = Parent->Common.Parent;
}
+ ASL_CV_LABEL_FILENODE (Next);
return (Next);
}
@@ -331,7 +338,7 @@ AcpiPsGetChild (
Child = AcpiPsGetArg (Op, 1);
break;
- case AML_POWER_RES_OP:
+ case AML_POWER_RESOURCE_OP:
case AML_INDEX_FIELD_OP:
Child = AcpiPsGetArg (Op, 2);
diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c
index 766fd1b8a51a..05699489adc8 100644
--- a/source/components/parser/psutils.c
+++ b/source/components/parser/psutils.c
@@ -45,6 +45,7 @@
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psutils")
@@ -177,6 +178,17 @@ AcpiPsAllocOp (
AcpiPsInitOp (Op, Opcode);
Op->Common.Aml = Aml;
Op->Common.Flags = Flags;
+ ASL_CV_CLEAR_OP_COMMENTS(Op);
+
+ if (Opcode == AML_SCOPE_OP)
+ {
+ AcpiGbl_CurrentScope = Op;
+ }
+ }
+
+ if (Gbl_CaptureComments)
+ {
+ ASL_CV_TRANSFER_COMMENTS (Op);
}
return (Op);
@@ -203,6 +215,7 @@ AcpiPsFreeOp (
ACPI_FUNCTION_NAME (PsFreeOp);
+ ASL_CV_CLEAR_OP_COMMENTS(Op);
if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,