aboutsummaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-11-14 22:20:16 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-11-14 22:20:16 +0000
commitc2463a8709e5b3a5ce54c09d35b4820a756b0fc5 (patch)
tree2ffc551e57f0545a17c165d729c1438a26236f60 /source/compiler
parent31aa864e8c068201d58aad3a8f82ddb51df11015 (diff)
downloadsrc-c2463a8709e5b3a5ce54c09d35b4820a756b0fc5.tar.gz
src-c2463a8709e5b3a5ce54c09d35b4820a756b0fc5.zip
Import ACPICA 20121114.vendor/acpica/20121114
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=243044 svn path=/vendor-sys/acpica/20121114/; revision=243045; tag=vendor/acpica/20121114
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompile.c15
-rw-r--r--source/compiler/aslcompiler.h4
-rw-r--r--source/compiler/aslerror.c16
-rw-r--r--source/compiler/aslfiles.c26
-rw-r--r--source/compiler/aslglobal.h1
-rw-r--r--source/compiler/asllisting.c45
-rw-r--r--source/compiler/asllookup.c11
-rw-r--r--source/compiler/aslmain.c8
-rw-r--r--source/compiler/aslstartup.c7
-rw-r--r--source/compiler/dttemplate.c27
-rw-r--r--source/compiler/prutils.c15
-rw-r--r--source/compiler/readme.txt21
12 files changed, 139 insertions, 57 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index f0fd3293d55a..269c1bffaf6d 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -50,6 +50,15 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcompile")
+/*
+ * Main parser entry
+ * External is here in case the parser emits the same external in the
+ * generated header. (Newer versions of Bison)
+ */
+int
+AslCompilerparse(
+ void);
+
/* Local prototypes */
static void
@@ -274,7 +283,7 @@ FlConsumeAnsiComment (
BOOLEAN ClosingComment = FALSE;
- while (fread (&Byte, 1, 1, Handle))
+ while (fread (&Byte, 1, 1, Handle) == 1)
{
/* Scan until comment close is found */
@@ -317,7 +326,7 @@ FlConsumeNewComment (
UINT8 Byte;
- while (fread (&Byte, 1, 1, Handle))
+ while (fread (&Byte, 1, 1, Handle) == 1)
{
Status->Offset++;
@@ -368,7 +377,7 @@ FlCheckForAscii (
/* Read the entire file */
- while (fread (&Byte, 1, 1, Handle))
+ while (fread (&Byte, 1, 1, Handle) == 1)
{
/* Ignore comment fields (allow non-ascii within) */
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 98dc27d2216e..d591b46e4a3a 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -86,10 +86,6 @@
/*
* Main ASL parser - generated from flex/bison, lex/yacc, etc.
*/
-int
-AslCompilerparse(
- void);
-
ACPI_PARSE_OBJECT *
AslDoError (
void);
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 74c220d1214f..a8187fd2ae55 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -294,7 +294,7 @@ AePrintException (
else
{
RActual = fread (&SourceByte, 1, 1, SourceFile);
- if (!RActual)
+ if (RActual != 1)
{
fprintf (OutputFile,
"[*** iASL: Read error on source code temp file %s ***]",
@@ -304,8 +304,20 @@ AePrintException (
{
while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256))
{
- fwrite (&SourceByte, 1, 1, OutputFile);
+ if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
+ {
+ printf ("[*** iASL: Write error on output file ***]\n");
+ return;
+ }
+
RActual = fread (&SourceByte, 1, 1, SourceFile);
+ if (RActual != 1)
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Read error on source code temp file %s ***]",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ return;
+ }
Total++;
}
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 3a3de3819e0e..f63504af4540 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -143,15 +143,14 @@ FlOpenFile (
File = fopen (Filename, Mode);
-
- Gbl_Files[FileId].Filename = Filename;
- Gbl_Files[FileId].Handle = File;
-
if (!File)
{
FlFileError (FileId, ASL_MSG_OPEN);
AslAbort ();
}
+
+ Gbl_Files[FileId].Filename = Filename;
+ Gbl_Files[FileId].Handle = File;
}
@@ -216,7 +215,7 @@ FlReadFile (
/* Read and check for error */
Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle);
- if (Actual != Length)
+ if (Actual < Length)
{
if (feof (Gbl_Files[FileId].Handle))
{
@@ -659,16 +658,17 @@ FlOpenIncludeWithPrefix (
/* Attempt to open the file, push if successful */
IncludeFile = fopen (Pathname, "r");
- if (IncludeFile)
+ if (!IncludeFile)
{
- /* Push the include file on the open input file stack */
-
- AslPushInputFileStack (IncludeFile, Pathname);
- return (IncludeFile);
+ fprintf (stderr, "Could not open include file %s\n", Pathname);
+ ACPI_FREE (Pathname);
+ return (NULL);
}
- ACPI_FREE (Pathname);
- return (NULL);
+ /* Push the include file on the open input file stack */
+
+ AslPushInputFileStack (IncludeFile, Pathname);
+ return (IncludeFile);
}
@@ -952,7 +952,7 @@ FlOpenMiscOutputFiles (
return (AE_OK);
}
- /* Create/Open a combined source output file */
+ /* Create/Open a combined source output file */
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
if (!Filename)
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 987ed1c2a2cf..101b23d35482 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -137,7 +137,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
-ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c
index 339cc01ac4c6..b70bcf8ab8d5 100644
--- a/source/compiler/asllisting.c
+++ b/source/compiler/asllisting.c
@@ -135,6 +135,10 @@ LsTreeWriteWalk (
UINT32 Level,
void *Context);
+static UINT32
+LsReadAmlOutputFile (
+ UINT8 *Buffer);
+
/*******************************************************************************
*
@@ -1282,6 +1286,38 @@ LsDoHexOutput (
/*******************************************************************************
*
+ * FUNCTION: LsReadAmlOutputFile
+ *
+ * PARAMETERS: Buffer - Where to return data
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Read a line of the AML output prior to formatting the data
+ *
+ ******************************************************************************/
+
+static UINT32
+LsReadAmlOutputFile (
+ UINT8 *Buffer)
+{
+ UINT32 Actual;
+
+
+ Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE,
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+
+ if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle))
+ {
+ FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
+ AslAbort ();
+ }
+
+ return (Actual);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: LsDoHexOutputC
*
* PARAMETERS: None
@@ -1319,8 +1355,7 @@ LsDoHexOutputC (
{
/* Read enough bytes needed for one output line */
- LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ LineLength = LsReadAmlOutputFile (FileData);
if (!LineLength)
{
break;
@@ -1407,8 +1442,7 @@ LsDoHexOutputAsl (
{
/* Read enough bytes needed for one output line */
- LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ LineLength = LsReadAmlOutputFile (FileData);
if (!LineLength)
{
break;
@@ -1494,8 +1528,7 @@ LsDoHexOutputAsm (
{
/* Read enough bytes needed for one output line */
- LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ LineLength = LsReadAmlOutputFile (FileData);
if (!LineLength)
{
break;
diff --git a/source/compiler/asllookup.c b/source/compiler/asllookup.c
index 8bd93559bc51..f051879b3bfa 100644
--- a/source/compiler/asllookup.c
+++ b/source/compiler/asllookup.c
@@ -329,16 +329,19 @@ LsDoOneNamespaceObject (
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
- if (Node->Flags & 0x80)
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Field Offset 0x%.4X Bits 0x%.4X Bytes] ",
+ Node->Value, Node->Value / 8);
+
+ if (Node->Flags & ANOBJ_IS_REFERENCED)
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
- " [Field Offset 0x%.4X Bits 0x%.4X Bytes]",
- Node->Value, Node->Value / 8);
+ "Referenced");
}
else
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
- " [Field Offset 0x%.4X Bytes]", Node->Value);
+ "Name not referenced");
}
break;
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 09eb9fcf702e..c832211544ed 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -100,7 +100,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z"
+#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z"
/*******************************************************************************
@@ -171,7 +171,6 @@ Options (
ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it");
ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)");
ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution");
- ACPI_OPTION ("-2", "Emit ACPI 2.0 compatible ASL code");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
@@ -473,11 +472,6 @@ AslDoOptions (
break;
- case '2': /* ACPI 2.0 compatibility mode */
- Gbl_Acpi2 = TRUE;
- break;
-
-
case 'b': /* Debug output options */
switch (AcpiGbl_Optarg[0])
{
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 4d556f274622..fbc005c74053 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -337,6 +337,13 @@ AslDoOneFile (
return (Status);
}
+#if 0
+ /* TBD: Handle additional output files for disassembler */
+
+ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
+ LsDisplayNamespace ();
+#endif
+
/* Shutdown compiler and ACPICA subsystem */
AeClearErrorLog ();
diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c
index 60844f030002..28fe072ef30f 100644
--- a/source/compiler/dttemplate.c
+++ b/source/compiler/dttemplate.c
@@ -280,6 +280,7 @@ DtCreateOneTemplate (
char *DisasmFilename;
FILE *File;
ACPI_STATUS Status = AE_OK;
+ ACPI_SIZE Actual;
/* New file will have a .asl suffix */
@@ -334,18 +335,32 @@ DtCreateOneTemplate (
}
else
{
- /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */
+ /* Special ACPI tables - DSDT, SSDT, FADT, RSDP */
AcpiOsPrintf (" */\n\n");
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
{
- fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File);
+ Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File);
+ if (Actual != sizeof (TemplateDsdt) -1)
+ {
+ fprintf (stderr,
+ "Could not write to output file %s\n", DisasmFilename);
+ Status = AE_ERROR;
+ goto Cleanup;
+ }
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
{
- fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File);
+ Actual = fwrite (TemplateSsdt, 1, sizeof (TemplateSsdt) -1, File);
+ if (Actual != sizeof (TemplateSsdt) -1)
+ {
+ fprintf (stderr,
+ "Could not write to output file %s\n", DisasmFilename);
+ Status = AE_ERROR;
+ goto Cleanup;
+ }
}
- else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateFacs));
@@ -359,7 +374,8 @@ DtCreateOneTemplate (
{
fprintf (stderr,
"%4.4s, Unrecognized ACPI table signature\n", Signature);
- return (AE_ERROR);
+ Status = AE_ERROR;
+ goto Cleanup;
}
}
@@ -367,6 +383,7 @@ DtCreateOneTemplate (
"Created ACPI table template for [%4.4s], written to \"%s\"\n",
Signature, DisasmFilename);
+Cleanup:
fclose (File);
AcpiOsRedirectOutput (stdout);
ACPI_FREE (DisasmFilename);
diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c
index 9ec851a90d99..15027088ffa4 100644
--- a/source/compiler/prutils.c
+++ b/source/compiler/prutils.c
@@ -337,16 +337,17 @@ PrOpenIncludeWithPrefix (
/* Attempt to open the file, push if successful */
IncludeFile = fopen (Pathname, "r");
- if (IncludeFile)
+ if (!IncludeFile)
{
- /* Push the include file on the open input file stack */
-
- PrPushInputFileStack (IncludeFile, Pathname);
- return (IncludeFile);
+ fprintf (stderr, "Could not open include file %s\n", Pathname);
+ ACPI_FREE (Pathname);
+ return (NULL);
}
- ACPI_FREE (Pathname);
- return (NULL);
+ /* Push the include file on the open input file stack */
+
+ PrPushInputFileStack (IncludeFile, Pathname);
+ return (IncludeFile);
}
diff --git a/source/compiler/readme.txt b/source/compiler/readme.txt
index d891cd16a329..e47b99beac7a 100644
--- a/source/compiler/readme.txt
+++ b/source/compiler/readme.txt
@@ -2,6 +2,9 @@
* Miscellaneous instructions for building and using the iASL compiler.
*/
+Last update: 24 October 2012
+
+
1) Generating iASL from source
------------------------------
@@ -23,20 +26,28 @@ be installed):
constant expressions.
3) The "common" source directory that is used for all ACPI components.
+
+1a) Notes for Linux/Unix generation
+-----------------------------------
+
On Linux/Unix systems, the following commands will build the compiler:
cd acpica (or cd acpica/generate/unix)
make clean
make iasl
-On Windows, the Visual Studio 2008 project file appears in this directory:
+iASL has been generated with these versions of Flex/Bison:
+
+ Flex: Version 2.5.32
+ Bison: Version 2.6.2
- generate/msvc9/AcpiComponents.sln
+1b) Notes for Windows generation
+--------------------------------
+On Windows, the Visual Studio 2008 project file appears in this directory:
-1a) Notes for Windows GNU Flex and GNU Bison
---------------------------------------------
+ generate/msvc9/AcpiComponents.sln
The Windows versions of GNU Flex/Bison must be installed, and they must
be installed in a directory that contains no embedded spaces in the
@@ -56,7 +67,7 @@ the updated $PATH.
iASL has been generated with these versions of Flex/Bison for Windows:
- Flex for Windows: V2.5.4
+ Flex for Windows: V2.5.4a
Bison for Windows: V2.4.1
Flex is available at: http://gnuwin32.sourceforge.net/packages/flex.htm