diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2019-07-09 17:17:45 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2019-07-09 17:17:45 +0000 |
commit | 3d51590acd9ce6cfcd823e3d4d340f04ff800228 (patch) | |
tree | d8c7a85f644b22ff2a5e5c9a56190e6798fb381e /source/compiler | |
parent | 08f4234e06d8d6855c0b79c95da98f267ca3554e (diff) |
Notes
Diffstat (limited to 'source/compiler')
-rw-r--r-- | source/compiler/asldefine.h | 16 | ||||
-rw-r--r-- | source/compiler/aslglobal.h | 15 | ||||
-rw-r--r-- | source/compiler/aslload.c | 59 | ||||
-rw-r--r-- | source/compiler/aslmessages.c | 3 | ||||
-rw-r--r-- | source/compiler/aslmessages.h | 1 | ||||
-rw-r--r-- | source/compiler/aslstubs.c | 6 | ||||
-rw-r--r-- | source/compiler/aslsupport.l | 18 |
7 files changed, 98 insertions, 20 deletions
diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index cffb0af1fe52..c511187529ed 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -298,4 +298,20 @@ #define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; #define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; +/* + * Special name segments - these must only be declared at the root scope + */ +#define NAMESEG__PTS "_PTS" +#define NAMESEG__WAK "_WAK" +#define NAMESEG__S0 "_S0_" +#define NAMESEG__S1 "_S1_" +#define NAMESEG__S2 "_S2_" +#define NAMESEG__S3 "_S3_" +#define NAMESEG__S4 "_S4_" +#define NAMESEG__S5 "_S5_" +#define NAMESEG__TTS "_TTS" + +#define MAX_SPECIAL_NAMES 9 + + #endif /* ASLDEFINE.H */ diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 213c540875f5..740f7f34ae51 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -223,13 +223,28 @@ const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS] = "OP_NOT_FOUND_DURING_LOAD" }; +const char *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] = +{ + NAMESEG__PTS, + NAMESEG__WAK, + NAMESEG__S0, + NAMESEG__S1, + NAMESEG__S2, + NAMESEG__S3, + NAMESEG__S4, + NAMESEG__S5, + NAMESEG__TTS +}; + #else extern ASL_FILE_DESC AslGbl_FileDescs [ASL_NUM_FILES]; extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; +extern const char *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES]; #endif + /* * Parser and other externals */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index d1523ab69cc8..4dd2dfd0f561 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -164,6 +164,7 @@ static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); @@ -190,6 +191,10 @@ LdCommonNamespaceEnd ( UINT32 Level, void *Context); +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); /******************************************************************************* * @@ -247,7 +252,8 @@ LdLoadNamespace ( * * FUNCTION: LdLoadFieldElements * - * PARAMETERS: Op - Parent node (Field) + * PARAMETERS: AmlType - Type to search + * Op - Parent node (Field) * WalkState - Current walk state * * RETURN: Status @@ -259,6 +265,7 @@ LdLoadNamespace ( static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { @@ -274,7 +281,7 @@ LdLoadFieldElements ( { Status = AcpiNsLookup (WalkState->ScopeInfo, SourceRegion->Asl.Value.String, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + AmlType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (Status == AE_NOT_FOUND) { @@ -507,11 +514,15 @@ LdNamespace1Begin ( */ switch (Op->Asl.AmlOpcode) { - case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: + + Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState); + return (Status); + + case AML_BANK_FIELD_OP: case AML_FIELD_OP: - Status = LdLoadFieldElements (Op, WalkState); + Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState); return (Status); case AML_INT_CONNECTION_OP: @@ -966,6 +977,10 @@ LdNamespace1Begin ( } } + /* Check special names like _WAK and _PTS */ + + LdCheckSpecialNames (Node, Op); + if (ForceNewScope) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); @@ -1006,6 +1021,42 @@ FinishNode: /******************************************************************************* * + * FUNCTION: LdCheckSpecialNames + * + * PARAMETERS: Node - Node that represents the named object + * Op - Named object declaring this named object + * + * RETURN: None + * + * DESCRIPTION: Check if certain named objects are declared in the incorrect + * scope. Special named objects are listed in + * AslGbl_SpecialNamedObjects and can only be declared at the root + * scope. + * + ******************************************************************************/ + +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + UINT32 i; + + + for (i = 0; i < MAX_SPECIAL_NAMES; i++) + { + if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) && + Node->Parent != AcpiGbl_RootNode) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); + return; + } + } +} + + +/******************************************************************************* + * * FUNCTION: LdNamespace2Begin * * PARAMETERS: ASL_WALK_CALLBACK diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index cf7a7a4f47cb..48c4dbabacef 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -365,7 +365,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length", /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", -/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer" +/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" }; /* Table compiler */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 15613685d192..d998f0fe8eda 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -368,6 +368,7 @@ typedef enum ASL_MSG_TEMPORARY_OBJECT, ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, + ASL_MSG_INVALID_SPECIAL_NAME, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index a54c498c479c..a8f22bd8c803 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -166,12 +166,6 @@ * Things like Events, Global Lock, etc. are not used * by the compiler, so they are stubbed out here. */ -void -AcpiNsExecModuleCodeList ( - void) -{ -} - ACPI_STATUS AcpiNsInitializeObjects ( void) diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 69c1399a9ec4..297bf2ee6bcc 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -220,7 +220,7 @@ AslDoLineDirective ( while ((c = input()) != '\n' && c != EOF) { - *AslGbl_LineBufPtr = c; + *AslGbl_LineBufPtr = (char) c; AslGbl_LineBufPtr++; } *AslGbl_LineBufPtr = 0; @@ -498,7 +498,7 @@ AslInsertLineBuffer ( if (AcpiGbl_CaptureComments) { - CvProcessCommentState (SourceChar); + CvProcessCommentState ((char) SourceChar); } } } @@ -601,7 +601,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } c1 = c; @@ -629,7 +629,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } @@ -720,7 +720,7 @@ AslDoCommentType2 ( AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } } @@ -878,7 +878,7 @@ DoCharacter: if (ACPI_IS_OCTAL_DIGIT (StringChar)) { State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; + ConvertBuffer[0] = (char) StringChar; i = 1; continue; } @@ -934,7 +934,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -978,7 +978,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -989,7 +989,7 @@ DoCharacter: /* Save the finished character */ - *StringBuffer = StringChar; + *StringBuffer = (char) StringChar; StringBuffer++; if (StringBuffer >= EndBuffer) { |