aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-05-24 23:12:30 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-05-24 23:12:30 +0000
commita7a3b383f2f828cd59ad5f58d318da892ad53868 (patch)
tree9dd2174199f7139519d2253a1b845832de100537 /sys/contrib/dev/acpica/compiler
parent62b5b6ecd00aae623415a177d0a1a3a599cbfdf5 (diff)
parentfa948a817cf9dae39dc632f9bf48a8af37244a0e (diff)
downloadsrc-a7a3b383f2f828cd59ad5f58d318da892ad53868.tar.gz
src-a7a3b383f2f828cd59ad5f58d318da892ad53868.zip
Merge ACPICA 20120518.
Notes
Notes: svn path=/head/; revision=235945
Diffstat (limited to 'sys/contrib/dev/acpica/compiler')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompile.c47
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.h9
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.l1
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.y2
-rw-r--r--sys/contrib/dev/acpica/compiler/aslerror.c23
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfiles.c108
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmain.c13
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmap.c1
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmessages.h11
-rw-r--r--sys/contrib/dev/acpica/compiler/aslstartup.c2
-rw-r--r--sys/contrib/dev/acpica/compiler/dtio.c18
-rw-r--r--sys/contrib/dev/acpica/compiler/prscan.c2
-rw-r--r--sys/contrib/dev/acpica/compiler/prutils.c15
13 files changed, 205 insertions, 47 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c
index 50eaf4ef26a2..736f0070a9bb 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompile.c
+++ b/sys/contrib/dev/acpica/compiler/aslcompile.c
@@ -59,12 +59,12 @@ CmFlushSourceCode (
static void
FlConsumeAnsiComment (
- ASL_FILE_INFO *FileInfo,
+ FILE *Handle,
ASL_FILE_STATUS *Status);
static void
FlConsumeNewComment (
- ASL_FILE_INFO *FileInfo,
+ FILE *Handle,
ASL_FILE_STATUS *Status);
@@ -253,7 +253,8 @@ CmFlushSourceCode (
*
* FUNCTION: FlConsume*
*
- * PARAMETERS: FileInfo - Points to an open input file
+ * PARAMETERS: Handle - Open input file
+ * Status - File current status struct
*
* RETURN: Number of lines consumed
*
@@ -263,14 +264,14 @@ CmFlushSourceCode (
static void
FlConsumeAnsiComment (
- ASL_FILE_INFO *FileInfo,
+ FILE *Handle,
ASL_FILE_STATUS *Status)
{
UINT8 Byte;
BOOLEAN ClosingComment = FALSE;
- while (fread (&Byte, 1, 1, FileInfo->Handle))
+ while (fread (&Byte, 1, 1, Handle))
{
/* Scan until comment close is found */
@@ -307,13 +308,13 @@ FlConsumeAnsiComment (
static void
FlConsumeNewComment (
- ASL_FILE_INFO *FileInfo,
+ FILE *Handle,
ASL_FILE_STATUS *Status)
{
UINT8 Byte;
- while (fread (&Byte, 1, 1, FileInfo->Handle))
+ while (fread (&Byte, 1, 1, Handle))
{
Status->Offset++;
@@ -332,7 +333,9 @@ FlConsumeNewComment (
*
* FUNCTION: FlCheckForAscii
*
- * PARAMETERS: FileInfo - Points to an open input file
+ * PARAMETERS: Handle - Open input file
+ * Filename - Input filename
+ * DisplayErrors - TRUE if error messages desired
*
* RETURN: Status
*
@@ -347,7 +350,9 @@ FlConsumeNewComment (
ACPI_STATUS
FlCheckForAscii (
- ASL_FILE_INFO *FileInfo)
+ FILE *Handle,
+ char *Filename,
+ BOOLEAN DisplayErrors)
{
UINT8 Byte;
ACPI_SIZE BadBytes = 0;
@@ -360,7 +365,7 @@ FlCheckForAscii (
/* Read the entire file */
- while (fread (&Byte, 1, 1, FileInfo->Handle))
+ while (fread (&Byte, 1, 1, Handle))
{
/* Ignore comment fields (allow non-ascii within) */
@@ -370,12 +375,12 @@ FlCheckForAscii (
if (Byte == '*')
{
- FlConsumeAnsiComment (FileInfo, &Status);
+ FlConsumeAnsiComment (Handle, &Status);
}
if (Byte == '/')
{
- FlConsumeNewComment (FileInfo, &Status);
+ FlConsumeNewComment (Handle, &Status);
}
/* Reset */
@@ -391,7 +396,7 @@ FlCheckForAscii (
if (!ACPI_IS_ASCII (Byte))
{
- if (BadBytes < 10)
+ if ((BadBytes < 10) && (DisplayErrors))
{
AcpiOsPrintf (
"Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n",
@@ -413,20 +418,24 @@ FlCheckForAscii (
/* Seek back to the beginning of the source file */
- fseek (FileInfo->Handle, 0, SEEK_SET);
+ fseek (Handle, 0, SEEK_SET);
/* Were there any non-ASCII characters in the file? */
if (BadBytes)
{
- AcpiOsPrintf (
- "%u non-ASCII characters found in input source text, could be a binary file\n",
- BadBytes);
- AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename);
+ if (DisplayErrors)
+ {
+ AcpiOsPrintf (
+ "%u non-ASCII characters found in input source text, could be a binary file\n",
+ BadBytes);
+ AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename);
+ }
+
return (AE_BAD_CHARACTER);
}
- /* File is OK */
+ /* File is OK (100% ASCII) */
return (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h
index bb29468f7600..03e1e149f502 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.h
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -166,7 +166,9 @@ CmCleanupAndExit (
ACPI_STATUS
FlCheckForAscii (
- ASL_FILE_INFO *FileInfo);
+ FILE *Handle,
+ char *Filename,
+ BOOLEAN DisplayErrors);
/*
@@ -608,6 +610,11 @@ void
FlAddIncludeDirectory (
char *Dir);
+char *
+FlMergePathnames (
+ char *PrefixDir,
+ char *FilePathname);
+
void
FlOpenIncludeFile (
ACPI_PARSE_OBJECT *Op);
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l
index 68391269d76b..5b9ff122e189 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.l
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l
@@ -523,6 +523,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 */
+"PCC" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* ACPI 5.0 */
"FFixedHW" { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); }
/* ResourceTypeKeyword: Resource Usage - Resource Descriptors */
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y
index 0c53c2375af0..2688390f7879 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.y
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y
@@ -363,6 +363,7 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_REGIONSPACE_IO
%token <i> PARSEOP_REGIONSPACE_IPMI
%token <i> PARSEOP_REGIONSPACE_MEM
+%token <i> PARSEOP_REGIONSPACE_PCC
%token <i> PARSEOP_REGIONSPACE_PCI
%token <i> PARSEOP_REGIONSPACE_PCIBAR
%token <i> PARSEOP_REGIONSPACE_SMBUS
@@ -2359,6 +2360,7 @@ RegionSpaceKeyword
| PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);}
| PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);}
| PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);}
+ | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);}
| PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);}
;
diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c
index 9173d4659b3f..a11cf5cd9fd4 100644
--- a/sys/contrib/dev/acpica/compiler/aslerror.c
+++ b/sys/contrib/dev/acpica/compiler/aslerror.c
@@ -315,12 +315,16 @@ AePrintException (
}
else
{
+ /*
+ * Less verbose version of the error message, enabled via the
+ * -vi switch. The format is compatible with MS Visual Studio.
+ */
fprintf (OutputFile, "%s", Enode->Filename);
if (Enode->LineNumber)
{
- fprintf (OutputFile, "(%u) i:%6u : ",
- Enode->LineNumber, Enode->LineNumber);
+ fprintf (OutputFile, "(%u) : ",
+ Enode->LineNumber);
}
}
}
@@ -335,9 +339,18 @@ AePrintException (
{
/* Decode the message ID */
- fprintf (OutputFile, "%s %4.4d - ",
- AslErrorLevel[Enode->Level],
- Enode->MessageId + ((Enode->Level+1) * 1000));
+ if (Gbl_VerboseErrors)
+ {
+ fprintf (OutputFile, "%s %4.4d - ",
+ AslErrorLevel[Enode->Level],
+ Enode->MessageId + ((Enode->Level+1) * 1000));
+ }
+ else /* IDE case */
+ {
+ fprintf (OutputFile, "%s %4.4d:",
+ AslErrorLevelIde[Enode->Level],
+ Enode->MessageId + ((Enode->Level+1) * 1000));
+ }
MainMessage = AslMessages[Enode->MessageId];
ExtraMessage = Enode->Message;
diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c
index e3d8a1a0b787..b1ec21006808 100644
--- a/sys/contrib/dev/acpica/compiler/aslfiles.c
+++ b/sys/contrib/dev/acpica/compiler/aslfiles.c
@@ -492,6 +492,107 @@ FlAddIncludeDirectory (
/*******************************************************************************
*
+ * FUNCTION: FlMergePathnames
+ *
+ * PARAMETERS: PrefixDir - Prefix directory pathname. Can be NULL or
+ * a zero length string.
+ * FilePathname - The include filename from the source ASL.
+ *
+ * RETURN: Merged pathname string
+ *
+ * DESCRIPTION: Merge two pathnames that (probably) have common elements, to
+ * arrive at a minimal length string. Merge can occur if the
+ * FilePathname is relative to the PrefixDir.
+ *
+ ******************************************************************************/
+
+char *
+FlMergePathnames (
+ char *PrefixDir,
+ char *FilePathname)
+{
+ char *CommonPath;
+ char *Pathname;
+ char *LastElement;
+
+
+ DbgPrint (ASL_PARSE_OUTPUT, "Include: Prefix path - \"%s\"\n"
+ "Include: FilePathname - \"%s\"\n",
+ PrefixDir, FilePathname);
+
+ /*
+ * If there is no prefix directory or if the file pathname is absolute,
+ * just return the original file pathname
+ */
+ if (!PrefixDir || (!*PrefixDir) ||
+ (*FilePathname == '/') ||
+ (FilePathname[1] == ':'))
+ {
+ Pathname = ACPI_ALLOCATE (strlen (FilePathname) + 1);
+ strcpy (Pathname, FilePathname);
+ goto ConvertBackslashes;
+ }
+
+ /* Need a local copy of the prefix directory path */
+
+ CommonPath = ACPI_ALLOCATE (strlen (PrefixDir) + 1);
+ strcpy (CommonPath, PrefixDir);
+
+ /*
+ * Walk forward through the file path, and simultaneously backward
+ * through the prefix directory path until there are no more
+ * relative references at the start of the file path.
+ */
+ while (*FilePathname && (!strncmp (FilePathname, "../", 3)))
+ {
+ /* Remove last element of the prefix directory path */
+
+ LastElement = strrchr (CommonPath, '/');
+ if (!LastElement)
+ {
+ goto ConcatenatePaths;
+ }
+
+ *LastElement = 0; /* Terminate CommonPath string */
+ FilePathname += 3; /* Point to next path element */
+ }
+
+ /*
+ * Remove the last element of the prefix directory path (it is the same as
+ * the first element of the file pathname), and build the final merged
+ * pathname.
+ */
+ LastElement = strrchr (CommonPath, '/');
+ if (LastElement)
+ {
+ *LastElement = 0;
+ }
+
+ /* Build the final merged pathname */
+
+ConcatenatePaths:
+ Pathname = ACPI_ALLOCATE_ZEROED (strlen (CommonPath) + strlen (FilePathname) + 2);
+ if (LastElement && *CommonPath)
+ {
+ strcpy (Pathname, CommonPath);
+ strcat (Pathname, "/");
+ }
+ strcat (Pathname, FilePathname);
+ ACPI_FREE (CommonPath);
+
+ /* Convert all backslashes to normal slashes */
+
+ConvertBackslashes:
+ UtConvertBackslashes (Pathname);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "Include: Merged Pathname - \"%s\"\n",
+ Pathname);
+ return (Pathname);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: FlOpenIncludeWithPrefix
*
* PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero
@@ -515,12 +616,9 @@ FlOpenIncludeWithPrefix (
/* Build the full pathname to the file */
- Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1);
-
- strcpy (Pathname, PrefixDir);
- strcat (Pathname, Filename);
+ Pathname = FlMergePathnames (PrefixDir, Filename);
- DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n",
+ DbgPrint (ASL_PARSE_OUTPUT, "Include: Opening file - \"%s\"\n\n",
Pathname);
/* Attempt to open the file, push if successful */
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
index b5d944eb8837..4b6b99f5f0d5 100644
--- a/sys/contrib/dev/acpica/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -765,9 +765,18 @@ AslDoOptions (
break;
case 'i':
- /* Less verbose error messages */
-
+ /*
+ * Support for integrated development environment(s).
+ *
+ * 1) No compiler signon
+ * 2) Send stderr messages to stdout
+ * 3) Less verbose error messages (single line only for each)
+ * 4) Error/warning messages are formatted appropriately to
+ * be recognized by MS Visual Studio
+ */
Gbl_VerboseErrors = FALSE;
+ Gbl_DoSignon = FALSE;
+ Gbl_Files[ASL_FILE_STDERR].Handle = stdout;
break;
case 'o':
diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c
index 46d612c5b850..5278888830f5 100644
--- a/sys/contrib/dev/acpica/compiler/aslmap.c
+++ b/sys/contrib/dev/acpica/compiler/aslmap.c
@@ -367,6 +367,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_IO, 0, 0),
/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_IPMI, 0, 0),
/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_MEMORY, 0, 0),
+/* REGIONSPACE_PCC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PLATFORM_COMM, 0, 0),
/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_CONFIG, 0, 0),
/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_BAR_TARGET, 0, 0),
/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SMBUS, 0, 0),
diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h
index 45d50da19172..595e5f4c96db 100644
--- a/sys/contrib/dev/acpica/compiler/aslmessages.h
+++ b/sys/contrib/dev/acpica/compiler/aslmessages.h
@@ -402,7 +402,7 @@ char *AslMessages [] = {
};
-char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
+const char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
"Warning ",
"Warning ",
"Warning ",
@@ -411,6 +411,15 @@ char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
"Optimize"
};
+const char *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = {
+ "warning ",
+ "warning ",
+ "warning ",
+ "error ",
+ "remark ",
+ "optimize"
+};
+
#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */
#endif /* ASL_EXCEPTIONS */
diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c
index 9c5ef15f3ffc..4011bde599af 100644
--- a/sys/contrib/dev/acpica/compiler/aslstartup.c
+++ b/sys/contrib/dev/acpica/compiler/aslstartup.c
@@ -227,7 +227,7 @@ AslDetectSourceFileType (
/* Check for 100% ASCII source file (comments are ignored) */
- Status = FlCheckForAscii (Info);
+ Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE);
if (ACPI_FAILURE (Status))
{
printf ("Non-ascii input file - %s\n", Info->Filename);
diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c
index 633ed2d9a58f..1d08389d15c3 100644
--- a/sys/contrib/dev/acpica/compiler/dtio.c
+++ b/sys/contrib/dev/acpica/compiler/dtio.c
@@ -427,7 +427,6 @@ DtGetNextLine (
{
case DT_START_QUOTED_STRING:
case DT_SLASH_ASTERISK_COMMENT:
- case DT_SLASH_SLASH_COMMENT:
AcpiOsPrintf ("**** EOF within comment/string %u\n", State);
break;
@@ -436,7 +435,22 @@ DtGetNextLine (
break;
}
- return (ASL_EOF);
+ /* Standalone EOF is OK */
+
+ if (i == 0)
+ {
+ return (ASL_EOF);
+ }
+
+ /*
+ * Received an EOF in the middle of a line. Terminate the
+ * line with a newline. The next call to this function will
+ * return a standalone EOF. Thus, the upper parsing software
+ * never has to deal with an EOF within a valid line (or
+ * the last line does not get tossed on the floor.)
+ */
+ c = '\n';
+ State = DT_NORMAL_TEXT;
}
switch (State)
diff --git a/sys/contrib/dev/acpica/compiler/prscan.c b/sys/contrib/dev/acpica/compiler/prscan.c
index a47f07f3e583..233e45a38ad6 100644
--- a/sys/contrib/dev/acpica/compiler/prscan.c
+++ b/sys/contrib/dev/acpica/compiler/prscan.c
@@ -654,7 +654,7 @@ PrDoDirective (
}
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
- "Start #include file %s\n", Gbl_CurrentLineNumber,
+ "Start #include file \"%s\"\n", Gbl_CurrentLineNumber,
Token, Gbl_CurrentLineNumber);
PrOpenIncludeFile (Token);
diff --git a/sys/contrib/dev/acpica/compiler/prutils.c b/sys/contrib/dev/acpica/compiler/prutils.c
index 0bbd8f5a3b26..8f9f24dc0181 100644
--- a/sys/contrib/dev/acpica/compiler/prutils.c
+++ b/sys/contrib/dev/acpica/compiler/prutils.c
@@ -246,13 +246,11 @@ PrOpenIncludeFile (
ASL_INCLUDE_DIR *NextDir;
- /*
- * start the actual include file on the next line
- */
+ /* Start the actual include file on the next line */
+
Gbl_CurrentLineOffset++;
/* Attempt to open the include file */
-
/* If the file specifies an absolute path, just open it */
if ((Filename[0] == '/') ||
@@ -330,13 +328,10 @@ PrOpenIncludeWithPrefix (
/* Build the full pathname to the file */
- Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1);
+ Pathname = FlMergePathnames (PrefixDir, Filename);
- strcpy (Pathname, PrefixDir);
- strcat (Pathname, Filename);
-
- DbgPrint (ASL_PARSE_OUTPUT, "\n" PR_PREFIX_ID
- "Opening include file: path %s\n",
+ DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
+ "Include: Opening file - \"%s\"\n",
Gbl_CurrentLineNumber, Pathname);
/* Attempt to open the file, push if successful */