summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2019-10-18 18:00:41 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2019-10-18 18:00:41 +0000
commit858f47305dae045d81f39451ade697ba99b3266f (patch)
tree67a913169f2c94028780a7a2a0c84fc9f84e8c60 /source/compiler
parente63852a7532181a14cec2928b31af2209e98414a (diff)
Notes
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslanalyze.c2
-rw-r--r--source/compiler/aslbtypes.c1
-rw-r--r--source/compiler/aslkeywords.y2
-rw-r--r--source/compiler/aslload.c13
-rw-r--r--source/compiler/aslmessages.c5
-rw-r--r--source/compiler/aslmessages.h3
-rw-r--r--source/compiler/aslmethod.c20
-rw-r--r--source/compiler/aslnamesp.c4
-rw-r--r--source/compiler/aslprepkg.c2
-rw-r--r--source/compiler/aslresource.c2
-rw-r--r--source/compiler/aslrestype2.c3
-rw-r--r--source/compiler/aslrestype2s.c1
-rw-r--r--source/compiler/aslutils.c2
-rw-r--r--source/compiler/cvdisasm.c9
-rw-r--r--source/compiler/cvparser.c1
-rw-r--r--source/compiler/dtcompile.c15
-rw-r--r--source/compiler/dtcompiler.h39
-rw-r--r--source/compiler/dtcompilerparser.l20
-rw-r--r--source/compiler/dtcompilerparser.y50
-rw-r--r--source/compiler/dtfield.c127
-rw-r--r--source/compiler/dtio.c98
-rw-r--r--source/compiler/dttable2.c23
22 files changed, 268 insertions, 174 deletions
diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c
index 58da5e2eec7c..0482775f424e 100644
--- a/source/compiler/aslanalyze.c
+++ b/source/compiler/aslanalyze.c
@@ -569,7 +569,7 @@ ApCheckForGpeNameConflict (
/* Need a null-terminated string version of NameSeg */
- ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg);
+ ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);
Name[ACPI_NAMESEG_SIZE] = 0;
/*
diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c
index ed607f3bee9e..d7caea53f3ba 100644
--- a/source/compiler/aslbtypes.c
+++ b/source/compiler/aslbtypes.c
@@ -474,7 +474,6 @@ AnFormatBtype (
strcat (Buffer, "|");
}
- First = FALSE;
strcat (Buffer, "Resource");
}
}
diff --git a/source/compiler/aslkeywords.y b/source/compiler/aslkeywords.y
index a19b6425be0b..a505dc029468 100644
--- a/source/compiler/aslkeywords.y
+++ b/source/compiler/aslkeywords.y
@@ -202,7 +202,7 @@ AddressKeyword
;
AddressSpaceKeyword
- : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);}
+ : ByteConst {$$ = UtCheckIntegerRange ($1, ACPI_NUM_PREDEFINED_REGIONS, 0xFF);}
| RegionSpaceKeyword {}
;
diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c
index d918c0cc76ff..db6c2d41eeef 100644
--- a/source/compiler/aslload.c
+++ b/source/compiler/aslload.c
@@ -526,13 +526,12 @@ LdNamespace1Begin (
case AML_INT_CONNECTION_OP:
-
if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
{
break;
}
- Arg = Op->Asl.Child;
+ Arg = Op->Asl.Child;
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
WalkState, &Node);
@@ -541,15 +540,6 @@ LdNamespace1Begin (
break;
}
- if (Node->Type == ACPI_TYPE_BUFFER)
- {
- Arg->Asl.Node = Node;
-
- Arg = Node->Op->Asl.Child; /* Get namepath */
- Arg = Arg->Asl.Next; /* Get actual buffer */
- Arg = Arg->Asl.Child; /* Buffer length */
- Arg = Arg->Asl.Next; /* RAW_DATA buffer */
- }
break;
default:
@@ -576,7 +566,6 @@ LdNamespace1Begin (
* These opcodes are guaranteed to have a parent.
* Examine the parent opcode.
*/
- Status = AE_OK;
ParentOp = Op->Asl.Parent;
OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode);
diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c
index 8dd989ca9ce3..d132935234f2 100644
--- a/source/compiler/aslmessages.c
+++ b/source/compiler/aslmessages.c
@@ -387,7 +387,10 @@ const char *AslTableCompilerMsgs [] =
/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
-/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero"
+/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
+/* ASL_MSG_INVALID_LABEL */ "Invalid field label detected",
+/* ASL_MSG_BUFFER_LIST */ "Invalid buffer initializer list",
+/* ASL_MSG_ENTRY_LIST */ "Invalid entry initializer list"
};
/* Preprocessor */
diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index 55473fb5395f..47e5bf4314d8 100644
--- a/source/compiler/aslmessages.h
+++ b/source/compiler/aslmessages.h
@@ -387,6 +387,9 @@ typedef enum
ASL_MSG_UNKNOWN_SUBTABLE,
ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_ZERO_VALUE,
+ ASL_MSG_INVALID_LABEL,
+ ASL_MSG_BUFFER_LIST,
+ ASL_MSG_ENTRY_LIST,
/* These messages are used by the Preprocessor only */
diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c
index 98884bc37ef8..667eaaaf8a81 100644
--- a/source/compiler/aslmethod.c
+++ b/source/compiler/aslmethod.c
@@ -199,6 +199,8 @@ MtMethodAnalysisWalkBegin (
ACPI_PARSE_OBJECT *NextType;
ACPI_PARSE_OBJECT *NextParamType;
UINT8 ActualArgs = 0;
+ BOOLEAN HidExists;
+ BOOLEAN AdrExists;
/* Build cross-reference output file if requested */
@@ -535,12 +537,26 @@ MtMethodAnalysisWalkBegin (
case PARSEOP_DEVICE:
- if (!ApFindNameInDeviceTree (METHOD_NAME__HID, Op) &&
- !ApFindNameInDeviceTree (METHOD_NAME__ADR, Op))
+ /* Check usage of _HID and _ADR objects */
+
+ HidExists = ApFindNameInDeviceTree (METHOD_NAME__HID, Op);
+ AdrExists = ApFindNameInDeviceTree (METHOD_NAME__ADR, Op);
+
+ if (!HidExists && !AdrExists)
{
AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
"Device object requires a _HID or _ADR in same scope");
}
+ else if (HidExists && AdrExists)
+ {
+ /*
+ * According to the ACPI spec, "A device object must contain
+ * either an _HID object or an _ADR object, but should not contain
+ * both".
+ */
+ AslError (ASL_WARNING, ASL_MSG_MULTIPLE_TYPES, Op,
+ "Device object requires either a _HID or _ADR, but not both");
+ }
break;
case PARSEOP_EVENT:
diff --git a/source/compiler/aslnamesp.c b/source/compiler/aslnamesp.c
index b5af0cb31be8..e38e397ff8b6 100644
--- a/source/compiler/aslnamesp.c
+++ b/source/compiler/aslnamesp.c
@@ -234,6 +234,10 @@ NsDisplayNamespace (
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL,
NULL, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* Print the full pathname for each namespace node */
diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c
index f55bb5e806e4..77969430cb07 100644
--- a/source/compiler/aslprepkg.c
+++ b/source/compiler/aslprepkg.c
@@ -458,7 +458,7 @@ ApCheckPackage (
for (i = 0; i < Package->RetInfo4.Count1; ++i)
{
- Status = ApCheckObjectType (Predefined->Info.Name, Op,
+ ApCheckObjectType (Predefined->Info.Name, Op,
Package->RetInfo4.ObjectType1, i);
Op = Op->Asl.Next;
}
diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c
index 82de51098e82..57b6440f2c12 100644
--- a/source/compiler/aslresource.c
+++ b/source/compiler/aslresource.c
@@ -1226,7 +1226,7 @@ RsDoResourceTemplate (
BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN;
BufferOp->Asl.AmlOpcodeLength = 0;
BufferOp->Asl.AmlLength = CurrentByteOffset;
- BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next;
+ BufferOp->Asl.Value.Buffer = ACPI_CAST_PTR (UINT8, HeadRnode.Next);
BufferOp->Asl.CompileFlags |= OP_IS_RESOURCE_DATA;
UtSetParseOpName (BufferOp);
diff --git a/source/compiler/aslrestype2.c b/source/compiler/aslrestype2.c
index 5b8f026e8f24..0652272ff3be 100644
--- a/source/compiler/aslrestype2.c
+++ b/source/compiler/aslrestype2.c
@@ -487,10 +487,7 @@ RsDoInterruptDescriptor (
if (StringLength && ResSourceString)
{
-
strcpy ((char *) Rover, (char *) ResSourceString);
- Rover = ACPI_ADD_PTR (
- AML_RESOURCE, &(Rover->ByteItem), StringLength);
Descriptor->ExtendedIrq.ResourceLength = (UINT16)
(Descriptor->ExtendedIrq.ResourceLength + StringLength);
diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c
index 2308505436b3..410ff2b2c7f6 100644
--- a/source/compiler/aslrestype2s.c
+++ b/source/compiler/aslrestype2s.c
@@ -674,7 +674,6 @@ RsDoGpioIoDescriptor (
ResSourceLength = RsGetStringDataLength (InitializerOp);
VendorLength = RsGetBufferDataLength (InitializerOp);
InterruptLength = RsGetInterruptDataLength (InitializerOp, 10);
- PinList = InterruptList;
DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
ResSourceLength + VendorLength + InterruptLength;
diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c
index ed2948d04365..0faaec03dd8d 100644
--- a/source/compiler/aslutils.c
+++ b/source/compiler/aslutils.c
@@ -223,7 +223,7 @@ UtQueryForOverwrite (
char *Pathname)
{
struct stat StatInfo;
- int InChar = 0x34;
+ int InChar;
if (!stat (Pathname, &StatInfo))
diff --git a/source/compiler/cvdisasm.c b/source/compiler/cvdisasm.c
index 3ff636f84f62..5396b3c33142 100644
--- a/source/compiler/cvdisasm.c
+++ b/source/compiler/cvdisasm.c
@@ -544,8 +544,11 @@ CvSwitchFiles(
Current = Current->Parent;
}
- /* Redirect output to Op->Common.CvFilename */
+ if (FNode)
+ {
+ /* Redirect output to Op->Common.CvFilename */
- AcpiOsRedirectOutput (FNode->File);
- AcpiGbl_CurrentFilename = FNode->Filename;
+ AcpiOsRedirectOutput (FNode->File);
+ AcpiGbl_CurrentFilename = FNode->Filename;
+ }
}
diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c
index ca970b50a1cc..9a2f0f9c2217 100644
--- a/source/compiler/cvparser.c
+++ b/source/compiler/cvparser.c
@@ -912,7 +912,6 @@ CvCaptureCommentsOnly (
/* Not a valid comment option. Revert the AML */
- Aml -= 2;
goto DefBlock;
} /* End switch statement */
diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c
index b6a144feb2bf..bdd8c1b70b8d 100644
--- a/source/compiler/dtcompile.c
+++ b/source/compiler/dtcompile.c
@@ -276,7 +276,10 @@ DtDoCompile (
if (ACPI_FAILURE (Status))
{
- FileNode->ParserErrorDetected = TRUE;
+ if (FileNode)
+ {
+ FileNode->ParserErrorDetected = TRUE;
+ }
/* TBD: temporary error message. Msgs should come from function above */
@@ -572,7 +575,7 @@ DtCompileTable (
ACPI_STATUS Status = AE_OK;
- if (!Field)
+ if (!Field || !Info)
{
return (AE_BAD_PARAMETER);
}
@@ -643,6 +646,14 @@ DtCompileTable (
FieldType = DtGetFieldType (Info);
AslGbl_InputFieldCount++;
+ if (FieldType != DT_FIELD_TYPE_INLINE_SUBTABLE &&
+ strcmp (Info->Name, LocalField->Name))
+ {
+ sprintf (AslGbl_MsgBuffer, "found \"%s\" expected \"%s\"",
+ LocalField->Name, Info->Name);
+ DtError (ASL_ERROR, ASL_MSG_INVALID_LABEL, LocalField, AslGbl_MsgBuffer);
+ }
+
switch (FieldType)
{
case DT_FIELD_TYPE_FLAGS_INTEGER:
diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h
index 639c22cb7273..7c78b55bafa7 100644
--- a/source/compiler/dtcompiler.h
+++ b/source/compiler/dtcompiler.h
@@ -210,6 +210,17 @@ typedef struct dt_field
#define DT_FIELD_NOT_ALLOCATED 1
+/*
+ * Structure used for each individual key or value
+ */
+typedef struct dt_table_unit
+{
+ char *Value; /* Field value (from name : value) */
+ UINT32 Line; /* Line number for this field */
+ UINT32 Column; /* Start column for field value */
+
+} DT_TABLE_UNIT;
+
/*
* Structure used for individual subtables within an ACPI table
@@ -292,14 +303,6 @@ DtCompilePadding (
UINT32 Length,
DT_SUBTABLE **RetSubtable);
-void
-DtCreateField (
- char *Name,
- char *Value,
- UINT32 Line,
- UINT32 Offset,
- UINT32 Column,
- UINT32 NameColumn);
/* dtio - binary and text input/output */
@@ -437,6 +440,26 @@ DtCompileFlag (
ACPI_DMTABLE_INFO *Info);
+/* dtfield - DT_FIELD operations */
+
+void
+DtLinkField (
+ DT_FIELD *Field);
+
+void
+DtCreateField (
+ DT_TABLE_UNIT *FieldKey,
+ DT_TABLE_UNIT *FieldValue,
+ UINT32 Offset);
+
+DT_TABLE_UNIT *
+DtCreateTableUnit (
+ char *Data,
+ UINT32 Line,
+ UINT32 Column);
+
+
+
/* dtparser - lex/yacc files */
UINT64 DtCompilerParserResult; /* Expression return value */
diff --git a/source/compiler/dtcompilerparser.l b/source/compiler/dtcompilerparser.l
index 0d68f41e4b2d..28dcf6af84bf 100644
--- a/source/compiler/dtcompilerparser.l
+++ b/source/compiler/dtcompilerparser.l
@@ -161,18 +161,20 @@ YYSTYPE DtCompilerlval;
/* handle locations */
int DtCompilerParsercolumn = 1;
+int DtLabelByteOffset = 0;
int DtCompilerParserByteOffset = 0;
+UINT32 DtTokenFirstLine = 0;
+UINT32 DtTokenFirstColumn = 0;
+
#define YY_USER_ACTION \
- DtCompilerParserlloc.first_line = DtCompilerParserlloc.last_line = DtCompilerParserlineno; \
- DtCompilerParserlloc.first_column = DtCompilerParsercolumn; \
- DtCompilerParserlloc.first_byte_offset = DtCompilerParserByteOffset; \
- DtCompilerParserlloc.last_column = DtCompilerParsercolumn + DtCompilerParserleng-1; \
+ DtTokenFirstLine = DtCompilerParserlineno; \
+ DtTokenFirstColumn = DtCompilerParsercolumn; \
DtCompilerParsercolumn += DtCompilerParserleng; \
DtCompilerParserByteOffset += DtCompilerParserleng; \
DbgPrint (ASL_PARSE_OUTPUT,\
- "user action occurred. DtCompilerParserlloc.first_line: %u offset: %u\n",\
- DtCompilerParserlloc.first_line, DtCompilerParserlloc.first_byte_offset);
+ "user action occurred. DtCompilerParserlloc.first_line: %u\n",\
+ DtTokenFirstLine);
%}
%option nounput noinput yylineno
@@ -236,7 +238,11 @@ CommentField {LabelName}{WhiteSpace}*:{WhiteSpace}{Comment}?$
int size = strlen (DtCompilerParsertext);
s=UtLocalCacheCalloc (size + 1);
AcpiUtSafeStrncpy (s, DtCompilerParsertext, size + 1);
- DtCompilerParserlval.s = s;
+ DtCompilerParserlval.u = (DT_TABLE_UNIT *) UtLocalCacheCalloc (sizeof (DT_TABLE_UNIT));
+ DtCompilerParserlval.u->Value = s;
+ DtCompilerParserlval.u->Line = DtCompilerParserlineno;
+ DtCompilerParserlval.u->Column = DtCompilerParsercolumn;
+ DtLabelByteOffset = DtCompilerParserByteOffset;
DbgPrint (ASL_PARSE_OUTPUT, "Label: %s\n", s);
return (DT_PARSEOP_LABEL);
}
diff --git a/source/compiler/dtcompilerparser.y b/source/compiler/dtcompilerparser.y
index ba9d2827e5aa..43eba4e9c8f6 100644
--- a/source/compiler/dtcompilerparser.y
+++ b/source/compiler/dtcompilerparser.y
@@ -169,9 +169,13 @@ void DtCompilerParsererror (char const *msg);
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;
+extern UINT32 DtTokenFirstColumn;
+
/* Bison/yacc configuration */
#define yytname DtCompilerParsername
@@ -186,42 +190,30 @@ extern UINT64 DtCompilerParserlineno; /* Current line number */
%}
-%code requires {
-
- typedef struct YYLTYPE {
- int first_line;
- int last_line;
- int first_column;
- int last_column;
- int first_byte_offset;
- } YYLTYPE;
-
- #define YYLTYPE_IS_DECLARED 1
-}
-
%union {
char *s;
DT_FIELD *f;
+ DT_TABLE_UNIT *u;
}
%type <f> Table
-%token <s> DT_PARSEOP_DATA
-%token <s> DT_PARSEOP_LABEL
-%token <s> DT_PARSEOP_STRING_DATA
-%token <s> DT_PARSEOP_LINE_CONTINUATION
-%type <s> Data
-%type <s> Datum
-%type <s> MultiLineData
-%type <s> MultiLineDataList
+%token <u> DT_PARSEOP_DATA
+%token <u> DT_PARSEOP_LABEL
+%token <u> DT_PARSEOP_STRING_DATA
+%token <u> DT_PARSEOP_LINE_CONTINUATION
+%type <u> Data
+%type <u> Datum
+%type <u> MultiLineData
+%type <u> MultiLineDataList
%%
Table
:
- FieldList { DtCompilerParserResult = 5;}
+ FieldList { }
;
FieldList
@@ -230,7 +222,7 @@ FieldList
;
Field
- : DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, (@3).first_line, (@1).first_byte_offset, (@1).first_column, (@3).first_column); }
+ : DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, DtLabelByteOffset); }
;
Data
@@ -240,7 +232,7 @@ Data
;
MultiLineDataList
- : MultiLineDataList MultiLineData { $$ = AcpiUtStrcat(AcpiUtStrcat($1, " "), $2); } /* combine the strings with strcat */
+ : MultiLineDataList MultiLineData { $$ = DtCreateTableUnit (AcpiUtStrcat(AcpiUtStrcat($1->Value, " "), $2->Value), $1->Line, $1->Column); } /* combine the strings with strcat */
| MultiLineData { $$ = $1; }
;
@@ -249,8 +241,14 @@ MultiLineData
;
Datum
- : DT_PARSEOP_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); }
- | DT_PARSEOP_STRING_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); }
+ : DT_PARSEOP_DATA {
+ DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s);
+ $$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn);
+ }
+ | DT_PARSEOP_STRING_DATA {
+ DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s);
+ $$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn);
+ }
;
diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c
index 1f7167618dc4..18d44110d507 100644
--- a/source/compiler/dtfield.c
+++ b/source/compiler/dtfield.c
@@ -576,6 +576,14 @@ DtCompileBuffer (
StringValue = DtNormalizeBuffer (StringValue, &Count);
Substring = StringValue;
+ if (Count != ByteLength)
+ {
+ sprintf(AslGbl_MsgBuffer,
+ "Found %u values, must match expected count: %u",
+ Count, ByteLength);
+ DtError (ASL_ERROR, ASL_MSG_BUFFER_LIST, Field, AslGbl_MsgBuffer);
+ goto Exit;
+ }
/* Each element of StringValue is now three chars (2 hex + 1 space) */
@@ -721,3 +729,122 @@ DtCompileFlag (
*Buffer |= (UINT8) (Value << BitPosition);
}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCreateField
+ *
+ * PARAMETERS: Name
+ * Value
+ * Line
+ * Offset
+ * Column
+ * NameColumn
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a field
+ *
+ *****************************************************************************/
+
+void
+DtCreateField (
+ DT_TABLE_UNIT *FieldKey,
+ DT_TABLE_UNIT *FieldValue,
+ UINT32 Offset)
+{
+ DT_FIELD *Field = UtFieldCacheCalloc ();
+
+
+ Field->StringLength = 0;
+ if (FieldKey->Value)
+ {
+ Field->Name =
+ strcpy (UtLocalCacheCalloc (strlen (FieldKey->Value) + 1), FieldKey->Value);
+ }
+
+ if (FieldValue->Value)
+ {
+ Field->StringLength = strlen (FieldValue->Value);
+ Field->Value =
+ strcpy (UtLocalCacheCalloc (Field->StringLength + 1), FieldValue->Value);
+ }
+
+ Field->Line = FieldValue->Line;
+ Field->ByteOffset = Offset;
+ Field->NameColumn = FieldKey->Column;
+ Field->Column = FieldValue->Column;
+ DtLinkField (Field);
+
+ DtDumpFieldList (AslGbl_FieldList);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCreateTableUnit
+ *
+ * PARAMETERS: Data
+ * Line
+ * Column
+ *
+ * RETURN: a table unit
+ *
+ * DESCRIPTION: Create a table unit
+ *
+ *****************************************************************************/
+
+DT_TABLE_UNIT *
+DtCreateTableUnit (
+ char *Data,
+ UINT32 Line,
+ UINT32 Column)
+{
+ DT_TABLE_UNIT *Unit = (DT_TABLE_UNIT *) UtFieldCacheCalloc ();
+
+
+ Unit->Value = Data;
+ Unit->Line = Line;
+ Unit->Column = Column;
+ return (Unit);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtLinkField
+ *
+ * PARAMETERS: Field - New field object to link
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Link one field name and value to the list
+ *
+ *****************************************************************************/
+
+void
+DtLinkField (
+ DT_FIELD *Field)
+{
+ DT_FIELD *Prev;
+ DT_FIELD *Next;
+
+
+ Prev = Next = AslGbl_FieldList;
+
+ while (Next)
+ {
+ Prev = Next;
+ Next = Next->Next;
+ }
+
+ if (Prev)
+ {
+ Prev->Next = Field;
+ }
+ else
+ {
+ AslGbl_FieldList = Field;
+ }
+}
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c
index d027353c71ce..b596fda8b87d 100644
--- a/source/compiler/dtio.c
+++ b/source/compiler/dtio.c
@@ -162,10 +162,6 @@ static char *
DtTrim (
char *String);
-static void
-DtLinkField (
- DT_FIELD *Field);
-
static ACPI_STATUS
DtParseLine (
char *LineBuffer,
@@ -299,45 +295,6 @@ DtTrim (
/******************************************************************************
*
- * FUNCTION: DtLinkField
- *
- * PARAMETERS: Field - New field object to link
- *
- * RETURN: None
- *
- * DESCRIPTION: Link one field name and value to the list
- *
- *****************************************************************************/
-
-static void
-DtLinkField (
- DT_FIELD *Field)
-{
- DT_FIELD *Prev;
- DT_FIELD *Next;
-
-
- Prev = Next = AslGbl_FieldList;
-
- while (Next)
- {
- Prev = Next;
- Next = Next->Next;
- }
-
- if (Prev)
- {
- Prev->Next = Field;
- }
- else
- {
- AslGbl_FieldList = Field;
- }
-}
-
-
-/******************************************************************************
- *
* FUNCTION: DtParseLine
*
* PARAMETERS: LineBuffer - Current source code line
@@ -495,59 +452,6 @@ DtParseLine (
/******************************************************************************
*
- * FUNCTION: DtCreateField
- *
- * PARAMETERS: Name
- * Value
- * Line
- * Offset
- * Column
- * NameColumn
- *
- * RETURN: None
- *
- * DESCRIPTION: Create a field
- *
- *****************************************************************************/
-
-void
-DtCreateField (
- char *Name,
- char *Value,
- UINT32 Line,
- UINT32 Offset,
- UINT32 Column,
- UINT32 NameColumn)
-{
- DT_FIELD *Field = UtFieldCacheCalloc ();
-
-
- Field->StringLength = 0;
- if (Name)
- {
- Field->Name =
- strcpy (UtLocalCacheCalloc (strlen (Name) + 1), Name);
- }
-
- if (Value)
- {
- Field->StringLength = strlen (Value);
- Field->Value =
- strcpy (UtLocalCacheCalloc (Field->StringLength + 1), Value);
- }
-
- Field->Line = Line;
- Field->ByteOffset = Offset;
- Field->NameColumn = NameColumn;
- Field->Column = Column;
- DtLinkField (Field);
-
- DtDumpFieldList (AslGbl_FieldList);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: DtGetNextLine
*
* PARAMETERS: Handle - Open file handle for the source file
@@ -840,7 +744,6 @@ DtGetNextLine (
case '\n':
- CurrentLineOffset = AslGbl_NextLineOffset;
AslGbl_NextLineOffset = (UINT32) ftell (Handle);
AslGbl_CurrentLineNumber++;
break;
@@ -882,7 +785,6 @@ DtGetNextLine (
/* Ignore newline, this will merge the lines */
- CurrentLineOffset = AslGbl_NextLineOffset;
AslGbl_NextLineOffset = (UINT32) ftell (Handle);
AslGbl_CurrentLineNumber++;
State = DT_NORMAL_TEXT;
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index 04f48cc0ca99..bbaaafaa763b 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -1474,13 +1474,14 @@ DtCompileSdev (
Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
Namesp->VendorDataLength =
(UINT16) Subtable->Length;
+
+ /* Final size of entire namespace structure */
+
+ SdevHeader->Length = (UINT16)(sizeof(ACPI_SDEV_NAMESPACE) +
+ Subtable->Length + Namesp->DeviceIdLength);
}
}
- /* Final size of entire namespace structure */
-
- SdevHeader->Length = (UINT16) (sizeof (ACPI_SDEV_NAMESPACE) +
- Subtable->Length + Namesp->DeviceIdLength);
break;
case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
@@ -1620,7 +1621,9 @@ DtCompileSlit (
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *FieldList;
+ DT_FIELD *EndOfFieldList = NULL;
UINT32 Localities;
+ UINT32 LocalityListLength;
UINT8 *LocalityBuffer;
@@ -1636,6 +1639,7 @@ DtCompileSlit (
Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
LocalityBuffer = UtLocalCalloc (Localities);
+ LocalityListLength = 0;
/* Compile each locality buffer */
@@ -1645,11 +1649,22 @@ DtCompileSlit (
DtCompileBuffer (LocalityBuffer,
FieldList->Value, FieldList, Localities);
+ LocalityListLength++;
DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
DtInsertSubtable (ParentTable, Subtable);
+ EndOfFieldList = FieldList;
FieldList = FieldList->Next;
}
+ if (LocalityListLength != Localities)
+ {
+ sprintf(AslGbl_MsgBuffer,
+ "Found %u entries, must match LocalityCount: %u",
+ LocalityListLength, Localities);
+ DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
+ return (AE_LIMIT);
+ }
+
ACPI_FREE (LocalityBuffer);
return (AE_OK);
}