summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2014-02-17 17:10:41 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2014-02-17 17:10:41 +0000
commit526d99544ba42a5a2155021975b3b97da425819e (patch)
treef33eb960cbd87cb5fa516e45153eb6351dc8ea2e /source/compiler
parent7bf0bd8c239ae7e6cb5c98382db85377146519d6 (diff)
Notes
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompiler.h8
-rw-r--r--source/compiler/aslerror.c33
-rw-r--r--source/compiler/aslfileio.c113
-rw-r--r--source/compiler/aslglobal.h2
-rw-r--r--source/compiler/aslmain.c11
-rw-r--r--source/compiler/aslmessages.h2
-rw-r--r--source/compiler/asloptions.c8
-rw-r--r--source/compiler/aslpredef.c10
-rw-r--r--source/compiler/aslprepkg.c24
-rw-r--r--source/compiler/aslstartup.c4
-rw-r--r--source/compiler/asltransform.c9
-rw-r--r--source/compiler/dtfield.c34
-rw-r--r--source/compiler/dttemplate.h4
-rw-r--r--source/compiler/prmacros.c13
14 files changed, 171 insertions, 104 deletions
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 91f6fad686cf..526dfb88e566 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -280,6 +280,10 @@ ApCheckRegMethod (
* aslerror - error handling/reporting
*/
void
+AslAbort (
+ void);
+
+void
AslError (
UINT8 Level,
UINT8 MessageId,
@@ -703,10 +707,6 @@ TrLinkPeerNodes (
* aslfiles - File I/O support
*/
void
-AslAbort (
- void);
-
-void
FlAddIncludeDirectory (
char *Dir);
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 77b167b5d71e..a60f608f29b2 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -56,6 +56,36 @@ AeAddToErrorLog (
/*******************************************************************************
*
+ * FUNCTION: AslAbort
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the error log and abort the compiler. Used for serious
+ * I/O errors.
+ *
+ ******************************************************************************/
+
+void
+AslAbort (
+ void)
+{
+
+ AePrintErrorLog (ASL_FILE_STDERR);
+ if (Gbl_DebugFlag)
+ {
+ /* Print error summary to stdout also */
+
+ AePrintErrorLog (ASL_FILE_STDOUT);
+ }
+
+ exit (1);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AeClearErrorLog
*
* PARAMETERS: None
@@ -817,7 +847,8 @@ AslError (
/* Check if user wants to ignore this exception */
- if (AslIsExceptionDisabled (Level, MessageId))
+ if (Gbl_AllExceptionsDisabled ||
+ AslIsExceptionDisabled (Level, MessageId))
{
return;
}
diff --git a/source/compiler/aslfileio.c b/source/compiler/aslfileio.c
index 2485ec35f609..90072f1fffe0 100644
--- a/source/compiler/aslfileio.c
+++ b/source/compiler/aslfileio.c
@@ -46,35 +46,9 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslfileio")
-
-/*******************************************************************************
- *
- * FUNCTION: AslAbort
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the error log and abort the compiler. Used for serious
- * I/O errors.
- *
- ******************************************************************************/
-
-void
-AslAbort (
- void)
-{
-
- AePrintErrorLog (ASL_FILE_STDERR);
- if (Gbl_DebugFlag)
- {
- /* Print error summary to stdout also */
-
- AePrintErrorLog (ASL_FILE_STDOUT);
- }
-
- exit (1);
-}
+long
+UtGetFileSize (
+ FILE *fp);
/*******************************************************************************
@@ -141,13 +115,73 @@ FlOpenFile (
/*******************************************************************************
*
+ * FUNCTION: UtGetFileSize
+ *
+ * PARAMETERS: fp - Open file handle
+ *
+ * RETURN: File Size. -1 on error.
+ *
+ * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
+ * TBD: This function should be used to replace other similar
+ * functions in ACPICA.
+ *
+ ******************************************************************************/
+
+long
+UtGetFileSize (
+ FILE *fp)
+{
+ long FileSize;
+ long CurrentOffset;
+
+
+ CurrentOffset = ftell (fp);
+ if (CurrentOffset < 0)
+ {
+ goto OffsetError;
+ }
+
+ if (fseek (fp, 0, SEEK_END))
+ {
+ goto SeekError;
+ }
+
+ FileSize = ftell (fp);
+ if (FileSize < 0)
+ {
+ goto OffsetError;
+ }
+
+ /* Restore file pointer */
+
+ if (fseek (fp, CurrentOffset, SEEK_SET))
+ {
+ goto SeekError;
+ }
+
+ return (FileSize);
+
+
+OffsetError:
+ perror ("Could not get file offset");
+ return (-1);
+
+SeekError:
+ perror ("Could not seek file");
+ return (-1);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: FlGetFileSize
*
* PARAMETERS: FileId - Index into file info array
*
* RETURN: File Size
*
- * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
+ * DESCRIPTION: Get current file size. Uses common seek-to-EOF function.
+ * File must be open. Aborts compiler on error.
*
******************************************************************************/
@@ -155,21 +189,16 @@ UINT32
FlGetFileSize (
UINT32 FileId)
{
- FILE *fp;
- UINT32 FileSize;
- long Offset;
-
+ long FileSize;
- fp = Gbl_Files[FileId].Handle;
- Offset = ftell (fp);
- fseek (fp, 0, SEEK_END);
- FileSize = (UINT32) ftell (fp);
-
- /* Restore file pointer */
+ FileSize = UtGetFileSize (Gbl_Files[FileId].Handle);
+ if (FileSize == -1)
+ {
+ AslAbort();
+ }
- fseek (fp, Offset, SEEK_SET);
- return (FileSize);
+ return ((UINT32) FileSize);
}
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 20248548be15..2707f4da8d42 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -159,7 +159,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
-ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
@@ -170,6 +169,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId,
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE);
#define HEX_OUTPUT_NONE 0
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 20468e520b58..6f81d21d2c05 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -158,7 +158,6 @@ Usage (
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 ("-fe <file>", "Specify external symbol declaration file");
- ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
@@ -319,16 +318,6 @@ main (
/* Perform global actions first/only */
- if (Gbl_GetAllTables)
- {
- Status = AslDoOneFile (NULL);
- if (ACPI_FAILURE (Status))
- {
- return (-1);
- }
- return (0);
- }
-
if (Gbl_DisassembleAll)
{
while (argv[Index1])
diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index ae066e2e0a1b..a97766ce3b99 100644
--- a/source/compiler/aslmessages.h
+++ b/source/compiler/aslmessages.h
@@ -445,7 +445,7 @@ char *AslMessages [] =
/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents",
-/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero",
+/* ASL_MSG_RESERVED_VALUE */ "Reserved field",
/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c
index 296356583d0e..7d73d20c4953 100644
--- a/source/compiler/asloptions.c
+++ b/source/compiler/asloptions.c
@@ -118,8 +118,7 @@ AslCommandLine (
/* Next parameter must be the input filename */
if (!argv[AcpiGbl_Optind] &&
- !Gbl_DisasmFlag &&
- !Gbl_GetAllTables)
+ !Gbl_DisasmFlag)
{
printf ("Missing input filename\n");
BadCommandLine = TRUE;
@@ -318,9 +317,8 @@ AslDoOptions (
case 'g': /* Get all ACPI tables */
- Gbl_GetAllTables = TRUE;
- Gbl_DoCompile = FALSE;
- break;
+ printf ("-g option is deprecated, use acpidump utility instead\n");
+ exit (1);
case 'h':
diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c
index bdede7b294cb..33f6be9d41f4 100644
--- a/source/compiler/aslpredef.c
+++ b/source/compiler/aslpredef.c
@@ -251,10 +251,16 @@ ApCheckPredefinedReturnValue (
const ACPI_PREDEFINED_INFO *ThisName;
- /* Check parent method for a match against the predefined name list */
-
+ /*
+ * Check parent method for a match against the predefined name list.
+ *
+ * Note: Disable compiler errors/warnings because any errors will be
+ * caught when analyzing the parent method. Eliminates duplicate errors.
+ */
+ Gbl_AllExceptionsDisabled = TRUE;
Index = ApCheckForPredefinedName (MethodInfo->Op,
MethodInfo->Op->Asl.NameSeg);
+ Gbl_AllExceptionsDisabled = FALSE;
switch (Index)
{
diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c
index 85c44befb889..c05d19016ce3 100644
--- a/source/compiler/aslprepkg.c
+++ b/source/compiler/aslprepkg.c
@@ -169,7 +169,7 @@ ApCheckPackage (
{
case ACPI_PTYPE1_FIXED:
/*
- * The package count is fixed and there are no sub-packages
+ * The package count is fixed and there are no subpackages
*
* If package is too small, exit.
* If package is larger than expected, issue warning but continue
@@ -194,7 +194,7 @@ ApCheckPackage (
case ACPI_PTYPE1_VAR:
/*
- * The package count is variable, there are no sub-packages,
+ * The package count is variable, there are no subpackages,
* and all elements must be of the same type
*/
for (i = 0; i < Count; i++)
@@ -207,7 +207,7 @@ ApCheckPackage (
case ACPI_PTYPE1_OPTION:
/*
- * The package count is variable, there are no sub-packages.
+ * The package count is variable, there are no subpackages.
* There are a fixed number of required elements, and a variable
* number of optional elements.
*
@@ -251,7 +251,7 @@ ApCheckPackage (
Op = Op->Asl.Next;
Count--;
- /* Examine the sub-packages */
+ /* Examine the subpackages */
ApCheckPackageList (Predefined->Info.Name, Op,
Package, 1, Count);
@@ -259,7 +259,7 @@ ApCheckPackage (
case ACPI_PTYPE2_PKG_COUNT:
- /* First element is the (Integer) count of sub-packages to follow */
+ /* First element is the (Integer) count of subpackages to follow */
Status = ApCheckObjectType (Predefined->Info.Name, Op,
ACPI_RTYPE_INTEGER, 0);
@@ -283,7 +283,7 @@ ApCheckPackage (
Op = Op->Asl.Next;
- /* Examine the sub-packages */
+ /* Examine the subpackages */
ApCheckPackageList (Predefined->Info.Name, Op,
Package, 1, Count);
@@ -296,10 +296,10 @@ ApCheckPackage (
case ACPI_PTYPE2_FIX_VAR:
/*
* These types all return a single Package that consists of a
- * variable number of sub-Packages.
+ * variable number of subpackages.
*/
- /* Examine the sub-packages */
+ /* Examine the subpackages */
ApCheckPackageList (Predefined->Info.Name, Op,
Package, 0, Count);
@@ -494,7 +494,7 @@ ApCheckPackageList (
case ACPI_PTYPE2_FIXED:
- /* Each sub-package has a fixed length */
+ /* Each subpackage has a fixed length */
ExpectedCount = Package->RetInfo2.Count;
if (Count < ExpectedCount)
@@ -517,7 +517,7 @@ ApCheckPackageList (
case ACPI_PTYPE2_MIN:
- /* Each sub-package has a variable but minimum length */
+ /* Each subpackage has a variable but minimum length */
ExpectedCount = Package->RetInfo.Count1;
if (Count < ExpectedCount)
@@ -527,7 +527,7 @@ ApCheckPackageList (
break;
}
- /* Check the type of each sub-package element */
+ /* Check the type of each subpackage element */
ApCheckPackageElements (PredefinedName, Op,
Package->RetInfo.ObjectType1, Count, 0, 0);
@@ -576,7 +576,7 @@ ApCheckPackageList (
Count = ExpectedCount;
}
- /* Check the type of each sub-package element */
+ /* Check the type of each subpackage element */
Op = Op->Asl.Next;
ApCheckPackageElements (PredefinedName, Op,
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 995cadef2ae8..1ed69724d2b0 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -251,7 +251,7 @@ AslDoDisassembly (
AcpiGbl_DbOpt_disasm = TRUE;
Status = AdAmlDisassemble (AslToFile,
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix,
- &Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_GetAllTables);
+ &Gbl_Files[ASL_FILE_INPUT].Filename);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -331,7 +331,7 @@ AslDoOneFile (
/*
* AML Disassembly (Optional)
*/
- if (Gbl_DisasmFlag || Gbl_GetAllTables)
+ if (Gbl_DisasmFlag)
{
Status = AslDoDisassembly ();
if (Status != AE_CTRL_CONTINUE)
diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c
index b22e4e1d3ae7..9615fe6c6e47 100644
--- a/source/compiler/asltransform.c
+++ b/source/compiler/asltransform.c
@@ -450,10 +450,6 @@ TrDoSwitch (
{
/* Add an ELSE to complete the previous CASE */
- if (!Conditional)
- {
- return;
- }
NewOp = TrCreateLeafNode (PARSEOP_ELSE);
NewOp->Asl.Parent = Conditional->Asl.Parent;
TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent);
@@ -620,11 +616,6 @@ TrDoSwitch (
{
/* Convert the DEFAULT node to an ELSE */
- if (!Conditional)
- {
- return;
- }
-
TrAmlInitNode (DefaultOp, PARSEOP_ELSE);
DefaultOp->Asl.Parent = Conditional->Asl.Parent;
diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c
index 14e7485116d7..ff77242127c5 100644
--- a/source/compiler/dtfield.c
+++ b/source/compiler/dtfield.c
@@ -311,21 +311,37 @@ DtCompileInteger (
return;
}
- /* Ensure that reserved fields are set to zero */
- /* TBD: should we set to zero, or just make this an ERROR? */
- /* TBD: Probably better to use a flag */
+ /*
+ * Ensure that reserved fields are set properly. Note: uses
+ * the DT_NON_ZERO flag to indicate that the reserved value
+ * must be exactly one. Otherwise, the value must be zero.
+ * This is sufficient for now.
+ */
+
+ /* TBD: Should use a flag rather than compare "Reserved" */
- if (!ACPI_STRCMP (Field->Name, "Reserved") &&
- (Value != 0))
+ if (!ACPI_STRCMP (Field->Name, "Reserved"))
{
- DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field,
- "Setting to zero");
- Value = 0;
+ if (Flags & DT_NON_ZERO)
+ {
+ if (Value != 1)
+ {
+ DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field,
+ "Must be one, setting to one");
+ Value = 1;
+ }
+ }
+ else if (Value != 0)
+ {
+ DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field,
+ "Must be zero, setting to zero");
+ Value = 0;
+ }
}
/* Check if the value must be non-zero */
- if ((Value == 0) && (Flags & DT_NON_ZERO))
+ else if ((Flags & DT_NON_ZERO) && (Value == 0))
{
DtError (ASL_ERROR, ASL_MSG_ZERO_VALUE, Field, NULL);
}
diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h
index 990d919448e0..84da13a1319e 100644
--- a/source/compiler/dttemplate.h
+++ b/source/compiler/dttemplate.h
@@ -897,10 +897,10 @@ const unsigned char TemplateSpcr[] =
const unsigned char TemplateSpmi[] =
{
0x53,0x50,0x4D,0x49,0x41,0x00,0x00,0x00, /* 00000000 "SPMIA..." */
- 0x04,0xED,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x04,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
- 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x14,0x01,0x14,0x20,0x00,0x01,0x00,0x00, /* 00000020 "... ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
diff --git a/source/compiler/prmacros.c b/source/compiler/prmacros.c
index 7c5f731e14f5..63bde607cf1b 100644
--- a/source/compiler/prmacros.c
+++ b/source/compiler/prmacros.c
@@ -360,7 +360,7 @@ PrAddMacro (
if (ArgCount >= PR_MAX_MACRO_ARGS)
{
PrError (ASL_ERROR, ASL_MSG_TOO_MANY_ARGUMENTS, TokenOffset);
- return;
+ goto ErrorExit;
}
}
@@ -400,7 +400,7 @@ PrAddMacro (
PrError (ASL_ERROR, ASL_MSG_TOO_MANY_ARGUMENTS,
THIS_TOKEN_OFFSET (Token));
- return;
+ goto ErrorExit;
}
break;
}
@@ -432,7 +432,7 @@ AddMacroToList:
THIS_TOKEN_OFFSET (Name));
}
- return;
+ goto ErrorExit;
}
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
@@ -451,6 +451,13 @@ AddMacroToList:
DefineInfo->Args = Args;
DefineInfo->ArgCount = ArgCount;
}
+
+ return;
+
+
+ErrorExit:
+ ACPI_FREE (Args);
+ return;
}