summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-12-15 23:48:45 +0000
committerjkim <jkim@FreeBSD.org>2010-12-15 23:48:45 +0000
commit2fc3b5748a5d4d10201709860b52976d8ca9e54d (patch)
tree19ec6d7c2b2313528bbf1a21e92ad809001eb2bb /sys/contrib/dev/acpica/compiler
parentb3be4af10ab7b7e0bb1d47b76abf259823cf5699 (diff)
parent3fe23e61bda19d3fc57ff6366b5cf43d1aa422e1 (diff)
downloadFreeBSD-src-2fc3b5748a5d4d10201709860b52976d8ca9e54d.zip
FreeBSD-src-2fc3b5748a5d4d10201709860b52976d8ca9e54d.tar.gz
Merge ACPICA 20101209.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslanalyze.c41
-rw-r--r--sys/contrib/dev/acpica/compiler/aslerror.c65
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmessages.h7
-rw-r--r--sys/contrib/dev/acpica/compiler/dtutils.c1
4 files changed, 84 insertions, 30 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c
index 20a2e1b..f7e1db2 100644
--- a/sys/contrib/dev/acpica/compiler/aslanalyze.c
+++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c
@@ -684,19 +684,45 @@ AnCheckId (
UINT32 AlphaPrefixLength;
+ /* Only care about string versions of _HID/_CID (integers are legal) */
+
if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
{
return;
}
+ /* For both _HID and _CID, the string must be non-null */
+
Length = strlen (Op->Asl.Value.String);
+ if (!Length)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NULL_STRING,
+ Op, NULL);
+ return;
+ }
/*
- * If _HID/_CID is a string, all characters must be alphanumeric.
- * One of the things we want to catch here is the use of
- * a leading asterisk in the string -- an odd construct
- * that certain platform manufacturers are fond of.
+ * One of the things we want to catch here is the use of a leading
+ * asterisk in the string -- an odd construct that certain platform
+ * manufacturers are fond of. Technically, a leading asterisk is OK
+ * for _CID, but a valid use of this has not been seen.
*/
+ if (*Op->Asl.Value.String == '*')
+ {
+ AslError (ASL_ERROR, ASL_MSG_LEADING_ASTERISK,
+ Op, Op->Asl.Value.String);
+ return;
+ }
+
+ /* _CID strings are bus-specific, no more checks can be performed */
+
+ if (Type == ASL_TYPE_CID)
+ {
+ return;
+ }
+
+ /* For _HID, all characters must be alphanumeric */
+
for (i = 0; Op->Asl.Value.String[i]; i++)
{
if (!isalnum ((int) Op->Asl.Value.String[i]))
@@ -707,13 +733,6 @@ AnCheckId (
}
}
- if (Type == ASL_TYPE_CID)
- {
- /* _CID strings are bus-specific, no more checks can be performed */
-
- return;
- }
-
/* _HID String must be of the form "XXX####" or "ACPI####" */
if ((Length < 7) || (Length > 8))
diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c
index 383e617..cabbcc0 100644
--- a/sys/contrib/dev/acpica/compiler/aslerror.c
+++ b/sys/contrib/dev/acpica/compiler/aslerror.c
@@ -241,6 +241,8 @@ AePrintException (
UINT32 ErrorColumn;
FILE *OutputFile;
FILE *SourceFile;
+ long FileSize;
+ BOOLEAN PrematureEOF = FALSE;
if (Gbl_NoErrors)
@@ -289,6 +291,19 @@ AePrintException (
SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
}
+ if (SourceFile)
+ {
+ /* Determine if the error occurred at source file EOF */
+
+ fseek (SourceFile, 0, SEEK_END);
+ FileSize = ftell (SourceFile);
+
+ if ((long) Enode->LogicalByteOffset >= FileSize)
+ {
+ PrematureEOF = TRUE;
+ }
+ }
+
if (Header)
{
fprintf (OutputFile, "%s", Header);
@@ -307,33 +322,42 @@ AePrintException (
fprintf (OutputFile, " %6u: ", Enode->LineNumber);
/*
- * Seek to the offset in the combined source file, read the source
- * line, and write it to the output.
+ * If not at EOF, get the corresponding source code line and
+ * display it. Don't attempt this if we have a premature EOF
+ * condition.
*/
- Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
- (int) SEEK_SET);
- if (Actual)
- {
- fprintf (OutputFile,
- "[*** iASL: Seek error on source code temp file %s ***]",
- Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
- }
- else
+ if (!PrematureEOF)
{
- RActual = fread (&SourceByte, 1, 1, SourceFile);
- if (!RActual)
+ /*
+ * Seek to the offset in the combined source file, read
+ * the source line, and write it to the output.
+ */
+ Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
+ (int) SEEK_SET);
+ if (Actual)
{
fprintf (OutputFile,
- "[*** iASL: Read error on source code temp file %s ***]",
+ "[*** iASL: Seek error on source code temp file %s ***]",
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
}
-
- else while (RActual && SourceByte && (SourceByte != '\n'))
+ else
{
- fwrite (&SourceByte, 1, 1, OutputFile);
RActual = fread (&SourceByte, 1, 1, SourceFile);
+ if (!RActual)
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Read error on source code temp file %s ***]",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ }
+
+ else while (RActual && SourceByte && (SourceByte != '\n'))
+ {
+ fwrite (&SourceByte, 1, 1, OutputFile);
+ RActual = fread (&SourceByte, 1, 1, SourceFile);
+ }
}
}
+
fprintf (OutputFile, "\n");
}
}
@@ -376,7 +400,7 @@ AePrintException (
ExtraMessage = NULL;
}
- if (Gbl_VerboseErrors)
+ if (Gbl_VerboseErrors && !PrematureEOF)
{
SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
@@ -406,6 +430,11 @@ AePrintException (
fprintf (OutputFile, " (%s)", ExtraMessage);
}
+ if (PrematureEOF)
+ {
+ fprintf (OutputFile, " and premature End-Of-File");
+ }
+
fprintf (OutputFile, "\n");
if (Gbl_VerboseErrors)
{
diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h
index 0457800..c69f7a2 100644
--- a/sys/contrib/dev/acpica/compiler/aslmessages.h
+++ b/sys/contrib/dev/acpica/compiler/aslmessages.h
@@ -258,6 +258,9 @@ typedef enum
ASL_MSG_NULL_DESCRIPTOR,
ASL_MSG_UPPER_CASE,
ASL_MSG_HID_LENGTH,
+ ASL_MSG_NULL_STRING,
+ ASL_MSG_LEADING_ASTERISK,
+
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
ASL_MSG_INVALID_HEX_INTEGER,
@@ -382,7 +385,7 @@ char *AslMessages [] = {
/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
/* ASL_MSG_WRITE */ "Could not write file",
/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct",
-/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored",
+/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed",
/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect",
/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced",
/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
@@ -403,6 +406,8 @@ char *AslMessages [] = {
/* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag",
/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case",
/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters",
+/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string",
+/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk",
/* These messages are used by the data table compiler only */
diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c
index 56ef05b..1414446 100644
--- a/sys/contrib/dev/acpica/compiler/dtutils.c
+++ b/sys/contrib/dev/acpica/compiler/dtutils.c
@@ -573,6 +573,7 @@ DtGetFieldLength (
case ACPI_DMT_UINT8:
case ACPI_DMT_CHKSUM:
case ACPI_DMT_SPACEID:
+ case ACPI_DMT_ACCWIDTH:
case ACPI_DMT_IVRS:
case ACPI_DMT_MADT:
case ACPI_DMT_SRAT:
OpenPOWER on IntegriCloud