summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompile.c1
-rw-r--r--source/compiler/aslcompiler.h8
-rw-r--r--source/compiler/aslcompiler.l20
-rw-r--r--source/compiler/asldefine.h1
-rw-r--r--source/compiler/aslerror.c125
-rw-r--r--source/compiler/aslglobal.h1
-rw-r--r--source/compiler/aslload.c88
-rw-r--r--source/compiler/asloptions.c2
-rw-r--r--source/compiler/asltypes.h31
-rw-r--r--source/compiler/dtcompiler.h1
-rw-r--r--source/compiler/dtcompilerparser.l1
-rw-r--r--source/compiler/dtcompilerparser.y1
-rw-r--r--source/compiler/dtparser.l2
-rw-r--r--source/compiler/dttable1.c10
-rw-r--r--source/compiler/dtutils.c3
-rw-r--r--source/compiler/prparser.l2
16 files changed, 260 insertions, 37 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 9481b6bb2d607..787a54444475e 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -283,6 +283,7 @@ CmDoCompile (
LsDumpParseTree ();
+ UtEndEvent (Event);
UtEndEvent (FullCompile);
return (AE_OK);
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 9bebc3801d793..82d777d843b95 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -488,7 +488,7 @@ AslCheckExpectedExceptions (
void);
ACPI_STATUS
-AslExpectException (
+AslLogExpectedException (
char *MessageIdString);
ACPI_STATUS
@@ -501,10 +501,16 @@ AslDisableException (
BOOLEAN
AslIsExceptionIgnored (
+ char *Filename,
+ UINT32 LineNumber,
UINT8 Level,
UINT16 MessageId);
void
+AslLogExpectedExceptionByLine (
+ char *MessageIdString);
+
+void
AslCoreSubsystemError (
ACPI_PARSE_OBJECT *Op,
ACPI_STATUS Status,
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 797f989915cf9..4c3fbde3ae937 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -156,7 +156,6 @@
#include <stdlib.h>
#include <string.h>
-YYSTYPE AslCompilerlval;
/*
* Generation: Use the following command line:
@@ -195,6 +194,7 @@ count (int type);
LeadNameChar [A-Za-z_]
DigitChar [0-9]
+ErrorCode [(][ ]*[1-9][0-9][0-9][0-9][ ]*[)]
OctalChar [0-7]
HexDigitChar [A-Fa-f0-9]
RootChar [\\]
@@ -692,7 +692,7 @@ NamePathTail [.]{NameSeg}
"IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); }
"GeneralPurposeIo" { count (0); return (PARSEOP_REGIONSPACE_GPIO); } /* ACPI 5.0 */
"GenericSerialBus" { count (0); return (PARSEOP_REGIONSPACE_GSBUS); } /* ACPI 5.0 */
-"PlatformCommChannel" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* ACPI 5.0 */
+"PCC" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* ACPI 5.0 */
"FFixedHW" { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); }
/* ResourceTypeKeyword: Resource Usage - Resource Descriptors */
@@ -810,6 +810,22 @@ NamePathTail [.]{NameSeg}
"__LINE__" { count (0); return (PARSEOP___LINE__); }
"__PATH__" { count (0); return (PARSEOP___PATH__); }
"__METHOD__" { count (0); return (PARSEOP___METHOD__); }
+"__EXPECT__"{ErrorCode} { char *s;
+ int index = 0;
+ count (0);
+ while (!isdigit (AslCompilertext[index]))
+ {
+ index++;
+ }
+
+ /*
+ * The eror code is contained inside the
+ * {ErrorCode} pattern. Extract it and log it
+ * as the expected error code.
+ */
+ s = UtLocalCacheCalloc (ASL_ERROR_CODE_LENGTH + 1);
+ memcpy (s, AslCompilertext + index, ASL_ERROR_CODE_LENGTH);
+ AslLogExpectedExceptionByLine (s); }
{NameSeg} { char *s;
count (0);
diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h
index 12a4cdd560ffc..2627a58a06cfe 100644
--- a/source/compiler/asldefine.h
+++ b/source/compiler/asldefine.h
@@ -227,6 +227,7 @@
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)
+#define ASL_ERROR_CODE_LENGTH 4
/* Listings */
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 1931fffcf1233..8fae779d639e5 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -162,6 +162,8 @@ AeAddToErrorLog (
static BOOLEAN
AslIsExceptionExpected (
+ char *Filename,
+ UINT32 LineNumber,
UINT8 Level,
UINT16 MessageId);
@@ -170,7 +172,8 @@ AslIsExceptionDisabled (
UINT8 Level,
UINT16 MessageId);
-static void AslInitEnode (
+static void
+AslInitEnode (
ASL_ERROR_MSG **Enode,
UINT8 Level,
UINT16 MessageId,
@@ -956,7 +959,7 @@ AslCommonError (
{
/* Check if user wants to ignore this exception */
- if (AslIsExceptionIgnored (Level, MessageId))
+ if (AslIsExceptionIgnored (Filename, LogicalLineNumber, Level, MessageId))
{
return;
}
@@ -1087,6 +1090,8 @@ GetModifiedLevel (
BOOLEAN
AslIsExceptionIgnored (
+ char *Filename,
+ UINT32 LineNumber,
UINT8 Level,
UINT16 MessageId)
{
@@ -1096,7 +1101,8 @@ AslIsExceptionIgnored (
/* Note: this allows exception to be disabled and expected */
ExceptionIgnored = AslIsExceptionDisabled (Level, MessageId);
- ExceptionIgnored |= AslIsExceptionExpected (Level, MessageId);
+ ExceptionIgnored |=
+ AslIsExceptionExpected (Filename, LineNumber, Level, MessageId);
return (AslGbl_AllExceptionsDisabled || ExceptionIgnored);
}
@@ -1104,7 +1110,7 @@ AslIsExceptionIgnored (
/*******************************************************************************
*
- * FUNCTION: AslCheckExpectException
+ * FUNCTION: AslCheckExpectedException
*
* PARAMETERS: none
*
@@ -1120,6 +1126,8 @@ AslCheckExpectedExceptions (
void)
{
UINT8 i;
+ ASL_EXPECTED_MSG_NODE *Current = AslGbl_ExpectedErrorCodeList;
+ ASL_LOCATION_NODE *LocationNode;
for (i = 0; i < AslGbl_ExpectedMessagesIndex; ++i)
@@ -1130,12 +1138,32 @@ AslCheckExpectedExceptions (
AslGbl_ExpectedMessages[i].MessageIdStr);
}
}
+
+ while (Current)
+ {
+ LocationNode = Current->LocationList;
+
+ while (LocationNode)
+ {
+ if (!LocationNode->MessageReceived)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_EXCEPTION_NOT_RECEIVED,
+ LocationNode->LineNumber, LocationNode->LineNumber,
+ LocationNode->LogicalByteOffset, LocationNode->Column,
+ LocationNode->Filename, Current->MessageIdStr);
+ }
+
+ LocationNode = LocationNode->Next;
+ }
+
+ Current = Current->Next;
+ }
}
/*******************************************************************************
*
- * FUNCTION: AslExpectException
+ * FUNCTION: AslLogExpectedException
*
* PARAMETERS: MessageIdString - ID of excepted exception during compile
*
@@ -1148,7 +1176,7 @@ AslCheckExpectedExceptions (
******************************************************************************/
ACPI_STATUS
-AslExpectException (
+AslLogExpectedException (
char *MessageIdString)
{
UINT32 MessageId;
@@ -1184,6 +1212,61 @@ AslExpectException (
/*******************************************************************************
*
+ * FUNCTION: AslLogExpectedExceptionByLine
+ *
+ * PARAMETERS: MessageIdString - ID of excepted exception during compile
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter a message ID into the global expected messages table
+ * based on file and line number. If these messages are not raised
+ * during the compilation, throw an error.
+ *
+ ******************************************************************************/
+
+void
+AslLogExpectedExceptionByLine (
+ char *MessageIdString)
+{
+ ASL_LOCATION_NODE *NewErrorLocationNode;
+ ASL_EXPECTED_MSG_NODE *Current = AslGbl_ExpectedErrorCodeList;
+ UINT32 MessageId;
+
+
+ NewErrorLocationNode = UtLocalCalloc (sizeof (ASL_LOCATION_NODE));
+
+ NewErrorLocationNode->LineNumber = AslGbl_CurrentLineNumber;
+ NewErrorLocationNode->Filename = AslGbl_Files[ASL_FILE_INPUT].Filename;
+ NewErrorLocationNode->LogicalByteOffset = AslGbl_CurrentLineOffset;
+ NewErrorLocationNode->Column = AslGbl_CurrentColumn;
+
+ MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
+
+ /* search the existing list for a matching message ID */
+
+ while (Current && Current->MessageId != MessageId )
+ {
+ Current = Current->Next;
+ }
+ if (!Current)
+ {
+ /* ID was not found, create a new node for this message ID */
+
+ Current = UtLocalCalloc (sizeof (ASL_EXPECTED_MSG_NODE));
+
+ Current->Next = AslGbl_ExpectedErrorCodeList;
+ Current->MessageIdStr = MessageIdString;
+ Current->MessageId = MessageId;
+ AslGbl_ExpectedErrorCodeList = Current;
+ }
+
+ NewErrorLocationNode->Next = Current->LocationList;
+ Current->LocationList = NewErrorLocationNode;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AslDisableException
*
* PARAMETERS: MessageIdString - ID to be disabled
@@ -1272,6 +1355,7 @@ AslElevateException (
return (AE_OK);
}
+
/*******************************************************************************
*
* FUNCTION: AslIsExceptionDisabled
@@ -1288,9 +1372,13 @@ AslElevateException (
static BOOLEAN
AslIsExceptionExpected (
+ char *Filename,
+ UINT32 LineNumber,
UINT8 Level,
UINT16 MessageId)
{
+ ASL_EXPECTED_MSG_NODE *Current = AslGbl_ExpectedErrorCodeList;
+ ASL_LOCATION_NODE *CurrentErrorLocation;
UINT32 EncodedMessageId;
UINT32 i;
@@ -1308,6 +1396,28 @@ AslIsExceptionExpected (
}
}
+ while (Current && Current->MessageId != EncodedMessageId)
+ {
+ Current = Current->Next;
+ }
+ if (!Current)
+ {
+ return (FALSE);
+ }
+
+ CurrentErrorLocation = Current->LocationList;
+
+ while (CurrentErrorLocation)
+ {
+ if (!strcmp (CurrentErrorLocation->Filename, Filename) &&
+ CurrentErrorLocation->LineNumber == LineNumber)
+ {
+ return (CurrentErrorLocation->MessageReceived = TRUE);
+ }
+
+ CurrentErrorLocation = CurrentErrorLocation->Next;
+ }
+
return (FALSE);
}
@@ -1410,7 +1520,8 @@ AslDualParseOpError (
/* Check if user wants to ignore this exception */
- if (AslIsExceptionIgnored (Level, MainMsgId) || !MainOp)
+ if (!MainOp || AslIsExceptionIgnored (MainOp->Asl.Filename,
+ MainOp->Asl.LogicalLineNumber, Level, MainMsgId))
{
return;
}
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 1a66dea919520..231ed87677bdd 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -420,6 +420,7 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_TableSignature, "NO
ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_TableId, "NO_ID");
ASL_EXTERN ASL_FILE_INFO ASL_INIT_GLOBAL (*AslGbl_Files, NULL);
ASL_EXTERN ASL_GLOBAL_FILE_NODE ASL_INIT_GLOBAL (*AslGbl_FilesList, NULL);
+ASL_EXTERN ASL_EXPECTED_MSG_NODE ASL_INIT_GLOBAL (*AslGbl_ExpectedErrorCodeList, NULL);
/* Specific to the -q option */
diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c
index 0d26c641d92ec..bd2fc97745ca4 100644
--- a/source/compiler/aslload.c
+++ b/source/compiler/aslload.c
@@ -1022,6 +1022,74 @@ FinishNode:
*
* FUNCTION: LdAnalyzeExternals
*
+ * PARAMETERS: Type1
+ * Type2
+ *
+ * RETURN: BOOLEAN
+ *
+ * DESCRIPTION: Match Type1 and Type2 with the assumption that one might be
+ * using external types and another might be using local types.
+ * This should be used to compare the types found in external
+ * declarations with types found in other external declarations or
+ * named object declaration. This should not be used to match two
+ * object type declarations.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+LdTypesMatchExternType (
+ ACPI_OBJECT_TYPE Type1,
+ ACPI_OBJECT_TYPE Type2)
+{
+ BOOLEAN Type1IsLocal = Type1 > ACPI_TYPE_EXTERNAL_MAX;
+ BOOLEAN Type2IsLocal = Type2 > ACPI_TYPE_EXTERNAL_MAX;
+ ACPI_OBJECT_TYPE ExternalType;
+ ACPI_OBJECT_TYPE LocalType;
+
+
+ /*
+ * The inputs could represent types that are local to ACPICA or types that
+ * are known externally. Some local types, such as the OperationRegion
+ * field units, are defined with more granularity than ACPICA local types.
+ *
+ * Therefore, map the local types to the external types before matching.
+ */
+ if (Type1IsLocal && !Type2IsLocal)
+ {
+ LocalType = Type1;
+ ExternalType = Type2;
+ }
+ else if (!Type1IsLocal && Type2IsLocal)
+ {
+ LocalType = Type2;
+ ExternalType = Type1;
+ }
+ else
+ {
+ return (Type1 == Type2);
+ }
+
+ switch (LocalType)
+ {
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ LocalType = ACPI_TYPE_FIELD_UNIT;
+ break;
+
+ default:
+ break;
+ }
+
+ return (LocalType == ExternalType);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LdAnalyzeExternals
+ *
* PARAMETERS: Node - Node that represents the named object
* Op - Named object declaring this named object
* ExternalOpType - Type of ExternalOp
@@ -1072,12 +1140,12 @@ LdAnalyzeExternals (
if ((ActualOpType != ACPI_TYPE_ANY) &&
(ActualExternalOpType != ACPI_TYPE_ANY) &&
- (ActualExternalOpType != ActualOpType))
+ !LdTypesMatchExternType (ActualExternalOpType, ActualOpType))
{
if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL &&
Node->Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
{
- AslDualParseOpError (ASL_ERROR,
+ AslDualParseOpError (ASL_WARNING,
ASL_MSG_DUPLICATE_EXTERN_MISMATCH, Op, NULL,
ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, Node->Op, NULL);
}
@@ -1094,7 +1162,7 @@ LdAnalyzeExternals (
ExternalOp = Node->Op;
ActualOp = Op;
}
- AslDualParseOpError (ASL_ERROR,
+ AslDualParseOpError (ASL_WARNING,
ASL_MSG_DECLARATION_TYPE_MISMATCH, ExternalOp, NULL,
ASL_MSG_TYPE_MISMATCH_FOUND_HERE, ActualOp, NULL);
}
@@ -1139,18 +1207,8 @@ LdAnalyzeExternals (
{
/* Allow update of externals of unknown type. */
- if (AcpiNsOpensScope (ExternalOpType))
- {
- Node->Type = (UINT8) ExternalOpType;
- Status = AE_OK;
- }
- else
- {
- sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
- AcpiUtGetTypeName (Node->Type));
- AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer);
- Status = AE_ERROR;
- }
+ Node->Type = (UINT8) ExternalOpType;
+ Status = AE_OK;
}
return (Status);
diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c
index e3b3f8e744c28..4bf9465ba5b7e 100644
--- a/source/compiler/asloptions.c
+++ b/source/compiler/asloptions.c
@@ -948,7 +948,7 @@ AslDoOptions (
return (-1);
}
- Status = AslExpectException (AcpiGbl_Optarg);
+ Status = AslLogExpectedException (AcpiGbl_Optarg);
if (ACPI_FAILURE (Status))
{
return (-1);
diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h
index cd54dbc05f782..33c547e4e5e8e 100644
--- a/source/compiler/asltypes.h
+++ b/source/compiler/asltypes.h
@@ -381,12 +381,37 @@ typedef struct asl_error_msg
typedef struct asl_expected_message
{
- UINT32 MessageId;
- char *MessageIdStr;
- BOOLEAN MessageReceived;
+ UINT32 MessageId;
+ char *MessageIdStr;
+ BOOLEAN MessageReceived;
} ASL_EXPECTED_MESSAGE;
+/*
+ * An entry in the line-based expected messages list
+ *
+ * TBD: might be possible to merge this with ASL_EXPECTED_MESSAGE
+ */
+typedef struct asl_expected_msg_node
+{
+ struct asl_expected_msg_node *Next;
+ UINT32 MessageId;
+ char *MessageIdStr;
+ struct asl_location_node *LocationList;
+
+} ASL_EXPECTED_MSG_NODE;
+
+typedef struct asl_location_node
+{
+ struct asl_location_node *Next;
+ char *Filename;
+ UINT32 LineNumber;
+ UINT32 Column;
+ UINT32 LogicalByteOffset;
+ BOOLEAN MessageReceived;
+
+} ASL_LOCATION_NODE;
+
/* An entry in the listing file stack (for include files) */
diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h
index 9d9008a851c51..18de92ff648ce 100644
--- a/source/compiler/dtcompiler.h
+++ b/source/compiler/dtcompiler.h
@@ -461,7 +461,6 @@ DtCreateTableUnit (
/* dtparser - lex/yacc files */
-UINT64 DtCompilerParserResult; /* Expression return value */
int
DtCompilerParserparse (
void);
diff --git a/source/compiler/dtcompilerparser.l b/source/compiler/dtcompilerparser.l
index 28dcf6af84bfc..ecc07c4847edb 100644
--- a/source/compiler/dtcompilerparser.l
+++ b/source/compiler/dtcompilerparser.l
@@ -153,7 +153,6 @@
#include "aslcompiler.h"
#include "dtcompilerparser.y.h"
-YYSTYPE DtCompilerlval;
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("dtcompilerscanner")
diff --git a/source/compiler/dtcompilerparser.y b/source/compiler/dtcompilerparser.y
index 43eba4e9c8f6c..e97e2a90e1d75 100644
--- a/source/compiler/dtcompilerparser.y
+++ b/source/compiler/dtcompilerparser.y
@@ -170,7 +170,6 @@ extern char *DtCompilerParsertext;
extern DT_FIELD *AslGbl_CurrentField;
extern int DtLabelByteOffset;
-extern UINT64 DtCompilerParserResult; /* Expression return value */
extern UINT64 DtCompilerParserlineno; /* Current line number */
extern UINT32 DtTokenFirstLine;
diff --git a/source/compiler/dtparser.l b/source/compiler/dtparser.l
index ff7df507fa4e5..631921df8d2ce 100644
--- a/source/compiler/dtparser.l
+++ b/source/compiler/dtparser.l
@@ -208,7 +208,7 @@ NewLine [\n]
/*
* Local support functions
*/
-YY_BUFFER_STATE LexBuffer;
+static YY_BUFFER_STATE LexBuffer;
/******************************************************************************
*
diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c
index c7256b77a35bf..33df4dc2c9825 100644
--- a/source/compiler/dttable1.c
+++ b/source/compiler/dttable1.c
@@ -1967,11 +1967,16 @@ DtCompileIvrs (
switch (IvrsHeader->Type)
{
- case ACPI_IVRS_TYPE_HARDWARE:
+ case ACPI_IVRS_TYPE_HARDWARE1:
InfoTable = AcpiDmTableInfoIvrs0;
break;
+ case ACPI_IVRS_TYPE_HARDWARE2:
+
+ InfoTable = AcpiDmTableInfoIvrs01;
+ break;
+
case ACPI_IVRS_TYPE_MEMORY1:
case ACPI_IVRS_TYPE_MEMORY2:
case ACPI_IVRS_TYPE_MEMORY3:
@@ -1994,7 +1999,8 @@ DtCompileIvrs (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE)
+ if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE1 ||
+ IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE2)
{
while (*PFieldList &&
!strcmp ((*PFieldList)->Name, "Entry Type"))
diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c
index 067d0ece2c1b4..bb07894e28134 100644
--- a/source/compiler/dtutils.c
+++ b/source/compiler/dtutils.c
@@ -189,7 +189,8 @@ DtError (
/* Check if user wants to ignore this exception */
- if (AslIsExceptionIgnored (Level, MessageId))
+ if (AslIsExceptionIgnored (AslGbl_Files[ASL_FILE_INPUT].Filename,
+ FieldObject->Line, Level, MessageId))
{
return;
}
diff --git a/source/compiler/prparser.l b/source/compiler/prparser.l
index 65595fa81f4ee..8752d3fcf59a8 100644
--- a/source/compiler/prparser.l
+++ b/source/compiler/prparser.l
@@ -224,7 +224,7 @@ Identifier [a-zA-Z][0-9a-zA-Z]*
/*
* Local support functions
*/
-YY_BUFFER_STATE LexBuffer;
+static YY_BUFFER_STATE LexBuffer;
/******************************************************************************