aboutsummaryrefslogtreecommitdiffstats
path: root/source/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-05-19 05:44:32 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-05-19 05:44:32 +0000
commitfa948a817cf9dae39dc632f9bf48a8af37244a0e (patch)
tree83fbd480537714dcce335edc4aed3216f4e57816 /source/compiler
parentb43c4dd5abdb09fe2e7f73f186586b962c9dc9f5 (diff)
downloadsrc-fa948a817cf9dae39dc632f9bf48a8af37244a0e.tar.gz
src-fa948a817cf9dae39dc632f9bf48a8af37244a0e.zip
Import ACPICA 20120518.vendor/acpica/20120518
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=235645 svn path=/vendor-sys/acpica/20120518/; revision=235646; tag=vendor/acpica/20120518
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompile.c47
-rw-r--r--source/compiler/aslcompiler.h9
-rw-r--r--source/compiler/aslcompiler.l1
-rw-r--r--source/compiler/aslcompiler.y2
-rw-r--r--source/compiler/aslerror.c23
-rw-r--r--source/compiler/aslfiles.c108
-rw-r--r--source/compiler/aslmain.c13
-rw-r--r--source/compiler/aslmap.c1
-rw-r--r--source/compiler/aslmessages.h11
-rw-r--r--source/compiler/aslstartup.c2
-rw-r--r--source/compiler/dtio.c18
-rw-r--r--source/compiler/prscan.c2
-rw-r--r--source/compiler/prutils.c15
13 files changed, 205 insertions, 47 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 8fcca0a7cb66..2a87a0162e4f 100644
--- a/source/compiler/aslcompile.c
+++ b/source/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/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 7eef917cd11e..937530dfeb89 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/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/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index b9c3020dd3a0..872063192982 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/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/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y
index 146747777e1f..7df36a841e95 100644
--- a/source/compiler/aslcompiler.y
+++ b/source/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/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 3b384f20674d..cd0875d1ab3d 100644
--- a/source/compiler/aslerror.c
+++ b/source/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/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 8f02be32cff8..64f391f4f0a8 100644
--- a/source/compiler/aslfiles.c
+++ b/source/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/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 7fb2b3ad02d0..ae288b374d17 100644
--- a/source/compiler/aslmain.c
+++ b/source/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/source/compiler/aslmap.c b/source/compiler/aslmap.c
index 04fc53866bd4..240175dc867c 100644
--- a/source/compiler/aslmap.c
+++ b/source/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/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index 45d50da19172..595e5f4c96db 100644
--- a/source/compiler/aslmessages.h
+++ b/source/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/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 13b7af4bfe37..a302164d452b 100644
--- a/source/compiler/aslstartup.c
+++ b/source/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/source/compiler/dtio.c b/source/compiler/dtio.c
index 6357bfbacdda..2b4e433d0e2d 100644
--- a/source/compiler/dtio.c
+++ b/source/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/source/compiler/prscan.c b/source/compiler/prscan.c
index 3013951b06dd..61c5ecc42f76 100644
--- a/source/compiler/prscan.c
+++ b/source/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/source/compiler/prutils.c b/source/compiler/prutils.c
index a7c65bf54e38..b0e1e14626ec 100644
--- a/source/compiler/prutils.c
+++ b/source/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 */