summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-04-20 23:39:48 +0000
committerjkim <jkim@FreeBSD.org>2012-04-20 23:39:48 +0000
commiteb364ef2c90291c41e896d265d93fe21e48d02a7 (patch)
tree79677aa8d9d6e5b97246264fe36dcad25ae471a1
parent1c3442fdc2bf7441ce8d61d4ce8920ce2fdd9c3e (diff)
downloadFreeBSD-src-eb364ef2c90291c41e896d265d93fe21e48d02a7.zip
FreeBSD-src-eb364ef2c90291c41e896d265d93fe21e48d02a7.tar.gz
Import ACPICA 20120420.
-rw-r--r--changes.txt67
-rw-r--r--generate/unix/iasl/Makefile4
-rw-r--r--source/compiler/Makefile4
-rw-r--r--source/compiler/aslcompile.c55
-rw-r--r--source/compiler/aslcompiler.h15
-rw-r--r--source/compiler/aslcompiler.l711
-rw-r--r--source/compiler/aslcompiler.y224
-rw-r--r--source/compiler/aslerror.c21
-rw-r--r--source/compiler/aslfiles.c60
-rw-r--r--source/compiler/aslglobal.h5
-rw-r--r--source/compiler/aslmain.c27
-rw-r--r--source/compiler/aslmap.c2
-rw-r--r--source/compiler/aslrestype1.c8
-rw-r--r--source/compiler/aslstartup.c76
-rw-r--r--source/compiler/aslsupport.l782
-rw-r--r--source/compiler/dtio.c42
-rw-r--r--source/compiler/preprocess.h17
-rw-r--r--source/compiler/prscan.c71
-rw-r--r--source/compiler/prutils.c110
-rw-r--r--source/components/debugger/dbcmds.c19
-rw-r--r--source/components/debugger/dbdisply.c4
-rw-r--r--source/components/debugger/dbstats.c28
-rw-r--r--source/components/debugger/dbutils.c5
-rw-r--r--source/components/events/evmisc.c183
-rw-r--r--source/components/events/evxface.c342
-rw-r--r--source/components/executer/exdump.c29
-rw-r--r--source/components/hardware/hwesleep.c8
-rw-r--r--source/components/utilities/utdelete.c21
-rw-r--r--source/components/utilities/utglobal.c4
-rw-r--r--source/components/utilities/uttrack.c6
-rw-r--r--source/include/acglobal.h3
-rw-r--r--source/include/aclocal.h13
-rw-r--r--source/include/acobject.h7
-rw-r--r--source/include/acpixf.h2
-rw-r--r--source/include/actypes.h4
-rw-r--r--source/tools/acpiexec/aehandlers.c163
-rw-r--r--source/tools/acpisrc/astable.c1
-rw-r--r--tests/misc/grammar.asl14
38 files changed, 1766 insertions, 1391 deletions
diff --git a/changes.txt b/changes.txt
index 69dcdf7..e55e286 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,71 @@
----------------------------------------
+20 April 2012. Summary of changes for version 20120420:
+
+This release is available at www.acpica.org/downloads.
+The ACPI 5.0 specification is available at www.acpi.info.
+
+1) ACPICA Core Subsystem:
+
+Implemented support for multiple notify handlers. This change adds support to
+allow multiple system and device notify handlers on Device, Thermal Zone, and
+Processor objects. This can simplify the host OS notification implementation.
+Also re-worked and restructured the entire notify support code to simplify
+handler installation, handler removal, notify event queuing, and notify
+dispatch to handler(s). Note: there can still only be two global notify
+handlers - one for system notifies and one for device notifies. There are no
+changes to the existing handler install/remove interfaces. Lin Ming, Bob
+Moore, Rafael Wysocki.
+
+Fixed a regression in the package repair code where the object reference
+count was calculated incorrectly. Regression was introduced in the commit
+"Support to add Package wrappers".
+
+Fixed a couple possible memory leaks in the AML parser, in the error recovery
+path. Jesper Juhl, Lin Ming.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
+debug version of the code includes the debug output trace mechanism and has a
+much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total
+ Debug Version: 172.5K Code, 73.2K Data, 245.7K Total
+ Current Release:
+ Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total
+ Debug Version: 172.6K Code, 73.4K Data, 246.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Fixed a problem with the resource descriptor support where the length
+of the StartDependentFn and StartDependentFnNoPrio descriptors were not
+included in cumulative descriptor offset, resulting in incorrect values for
+resource tags within resource descriptors appearing after a StartDependent*
+descriptor. Reported by Petr Vandrovec. ACPICA BZ 949.
+
+iASL and Preprocessor: Implemented full support for the #line directive to
+correctly track original source file line numbers through the .i preprocessor
+output file - for error and warning messages.
+
+iASL: Expand the allowable byte constants for address space IDs. Previously,
+the allowable range was 0x80-0xFF (user-defined spaces), now the range is
+0x0A-0xFF to allow for custom and new IDs without changing the compiler.
+
+iASL: Add option to treat all warnings as errors (-we). ACPICA BZ 948.
+
+iASL: Add option to completely disable the preprocessor (-Pn).
+
+iASL: Now emit all error/warning messages to standard error (stderr) by
+default (instead of the previous stdout).
+
+ASL Test Suite (ASLTS): Reduce iASL warnings due to use of Switch(). Update
+for resource descriptor offset fix above. Update/cleanup error output
+routines. Enable and send iASL errors/warnings to an error logfile
+(error.txt). Send all other iASL output to a logfile (compiler.txt). Fixed
+several extraneous "unrecognized operator" messages.
+
+----------------------------------------
20 March 2012. Summary of changes for version 20120320:
This release is available at www.acpica.org/downloads.
diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile
index c61a5d8..8d9dff7 100644
--- a/generate/unix/iasl/Makefile
+++ b/generate/unix/iasl/Makefile
@@ -217,8 +217,8 @@ $(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS)
#
# Parser and Lexer - intermediate C files
#
-$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l
- ${LEX} ${LFLAGS} -PAslCompiler -o$@ $?
+$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l
+ ${LEX} ${LFLAGS} -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l
$(OBJDIR)/aslcompilerparse.c $(OBJDIR)/aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y
${YACC} ${YFLAGS} -pAslCompiler -o$@ $?
diff --git a/source/compiler/Makefile b/source/compiler/Makefile
index b4c6b45..379f388 100644
--- a/source/compiler/Makefile
+++ b/source/compiler/Makefile
@@ -289,8 +289,8 @@ $(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS)
#
# Parser and Lexer - intermediate C files
#
-aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l
- ${LEX} ${LFLAGS} -PAslCompiler -o$@ $?
+aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l
+ ${LEX} ${LFLAGS} -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l
aslcompilerparse.c aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y
${YACC} ${YFLAGS} -pAslCompiler -o$@ $?
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 6c368a0..8fcca0a 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -242,10 +242,10 @@ CmFlushSourceCode (
while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
{
- InsertLineBuffer ((int) Buffer);
+ AslInsertLineBuffer ((int) Buffer);
}
- ResetCurrentLineBuffer ();
+ AslResetCurrentLineBuffer ();
}
@@ -457,16 +457,20 @@ CmDoCompile (
Event = UtBeginEvent ("Open input and output files");
UtEndEvent (Event);
- /* Preprocessor */
-
Event = UtBeginEvent ("Preprocess input file");
- PrDoPreprocess ();
- UtEndEvent (Event);
- if (Gbl_PreprocessOnly)
+ if (Gbl_PreprocessFlag)
{
- CmCleanupAndExit ();
- return 0;
+ /* Preprocessor */
+
+ PrDoPreprocess ();
+ if (Gbl_PreprocessOnly)
+ {
+ UtEndEvent (Event);
+ CmCleanupAndExit ();
+ return 0;
+ }
}
+ UtEndEvent (Event);
/* Build the parse tree */
@@ -483,8 +487,17 @@ CmDoCompile (
if (!RootNode)
{
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
- NULL, "- Could not resolve parse tree root node");
+ /*
+ * If there are no errors, then we have some sort of
+ * internal problem.
+ */
+ Status = AslCheckForErrorExit ();
+ if (Status == AE_OK)
+ {
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
+ NULL, "- Could not resolve parse tree root node");
+ }
+
goto ErrorExit;
}
@@ -553,14 +566,14 @@ CmDoCompile (
if (Gbl_ParseOnlyFlag)
{
- AePrintErrorLog (ASL_FILE_STDOUT);
- UtDisplaySummary (ASL_FILE_STDOUT);
+ AePrintErrorLog (ASL_FILE_STDERR);
+ UtDisplaySummary (ASL_FILE_STDERR);
if (Gbl_DebugFlag)
{
- /* Print error summary to the debug file */
+ /* Print error summary to the stdout also */
- AePrintErrorLog (ASL_FILE_STDERR);
- UtDisplaySummary (ASL_FILE_STDERR);
+ AePrintErrorLog (ASL_FILE_STDOUT);
+ UtDisplaySummary (ASL_FILE_STDOUT);
}
UtEndEvent (FullCompile);
return 0;
@@ -756,12 +769,12 @@ CmCleanupAndExit (
UINT32 i;
- AePrintErrorLog (ASL_FILE_STDOUT);
+ AePrintErrorLog (ASL_FILE_STDERR);
if (Gbl_DebugFlag)
{
- /* Print error summary to the debug file */
+ /* Print error summary to stdout also */
- AePrintErrorLog (ASL_FILE_STDERR);
+ AePrintErrorLog (ASL_FILE_STDOUT);
}
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
@@ -837,7 +850,9 @@ CmCleanupAndExit (
/* Delete the preprocessor output file (.i) unless -li flag is set */
- if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)
+ if (!Gbl_PreprocessorOutputFlag &&
+ Gbl_PreprocessFlag &&
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)
{
if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename))
{
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 6cc4351..7eef917 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -100,11 +100,11 @@ AslCompilerlex(
void);
void
-ResetCurrentLineBuffer (
+AslResetCurrentLineBuffer (
void);
void
-InsertLineBuffer (
+AslInsertLineBuffer (
int SourceChar);
int
@@ -136,6 +136,11 @@ ACPI_STATUS
AslDoOneFile (
char *Filename);
+ACPI_STATUS
+AslCheckForErrorExit (
+ void);
+
+
/*
* aslcompile - compile mainline
*/
@@ -645,7 +650,11 @@ FlPrintFile (
void
FlSetLineNumber (
- ACPI_PARSE_OBJECT *Op);
+ UINT32 LineNumber);
+
+void
+FlSetFilename (
+ char *Filename);
ACPI_STATUS
FlOpenInputFile (
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 39f94bf..b9c3020 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -58,20 +58,26 @@ YYSTYPE AslCompilerlval;
*/
#define _COMPONENT ACPI_COMPILER
- ACPI_MODULE_NAME ("aslscan")
+ ACPI_MODULE_NAME ("aslscanner")
+
/* Local prototypes */
-char
-comment (void);
-char
-comment2 (void);
-void
+static void
+AslDoLineDirective (void);
+
+static char
+AslDoComment (void);
+
+static char
+AslDoCommentType2 (void);
+
+static char
+AslDoStringLiteral (void);
+
+static void
count (int type);
-char
-literal (void);
-void
-copy (void);
+
/*! [Begin] no source code translation */
@@ -104,10 +110,10 @@ NamePathTail [.]{NameSeg}
[ \t] { count (0); }
-"/*" { if (!comment ()) yyterminate (); }
-"//" { if (!comment2 ()) yyterminate (); }
+"/*" { if (!AslDoComment ()) yyterminate (); }
+"//" { if (!AslDoCommentType2 ()) yyterminate (); }
-"\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); }
+"\"" { if (AslDoStringLiteral ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); }
";" { count (0); return(';'); }
@@ -116,10 +122,16 @@ NamePathTail [.]{NameSeg}
count (1); return (PARSEOP_INTEGER); }
"Include" { count (1); return (PARSEOP_INCLUDE); }
-"#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); }
-"#line" { count (1); return (PARSEOP_LINE_CSTYLE); }
"External" { count (1); return (PARSEOP_EXTERNAL); }
+ /*
+ * The #line directive is emitted by the preprocessor and handled
+ * here in the main iASL lexer - simply set the line number and
+ * optionally the current filename.
+ */
+"#line" { AslDoLineDirective ();}
+
+
/****************************************************************************
*
* Main ASL operators
@@ -634,668 +646,7 @@ NamePathTail [.]{NameSeg}
/*! [End] no source code translation !*/
-typedef struct asl_file_node
-{
- FILE *File;
- UINT32 CurrentLineNumber;
- YY_BUFFER_STATE State;
- char *Filename;
- struct asl_file_node *Next;
-
-} ASL_FILE_NODE;
-
-ASL_FILE_NODE *InputStack = NULL;
-
-
-/*******************************************************************************
- *
- * FUNCTION: AslPopInputFileStack
- *
- * PARAMETERS: None
- *
- * RETURN: 0 if a node was popped, -1 otherwise
- *
- * DESCRIPTION: Pop the top of the input file stack and point the parser to
- * the saved parse buffer contained in the fnode. Also, set the
- * global line counters to the saved values. This function is
- * called when an include file reaches EOF.
- *
- ******************************************************************************/
-
-int
-AslPopInputFileStack (
- void)
-{
- ASL_FILE_NODE *Fnode;
-
-
- Fnode = InputStack;
- DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
-
-
- if (!Fnode)
- {
- return -1;
- }
-
- /* Close the current include file */
-
- fclose (yyin);
-
- /* Update the top-of-stack */
-
- InputStack = Fnode->Next;
-
- /* Reset global line counter and filename */
-
- Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
- Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
-
- /* Point the parser to the popped file */
-
- yy_delete_buffer (YY_CURRENT_BUFFER);
- yy_switch_to_buffer (Fnode->State);
-
- /* All done with this node */
-
- ACPI_FREE (Fnode);
- return 0;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AslPushInputFileStack
- *
- * PARAMETERS: InputFile - Open file pointer
- * Filename - Name of the file
- *
- * RETURN: None
- *
- * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
- * to this file. Called when an include file is successfully
- * opened.
- *
- ******************************************************************************/
-
-void
-AslPushInputFileStack (
- FILE *InputFile,
- char *Filename)
-{
- ASL_FILE_NODE *Fnode;
- YY_BUFFER_STATE State;
-
-
- /* Save the current state in an Fnode */
-
- Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
-
- Fnode->File = yyin;
- Fnode->Next = InputStack;
- Fnode->State = YY_CURRENT_BUFFER;
- Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
- Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
-
- /* Push it on the stack */
-
- InputStack = Fnode;
-
- /* Point the parser to this file */
-
- State = yy_create_buffer (InputFile, YY_BUF_SIZE);
- yy_switch_to_buffer (State);
-
- DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
-
- /* Reset the global line count and filename */
-
- Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
- Gbl_CurrentLineNumber = 1;
- yyin = InputFile;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: ResetCurrentLineBuffer
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
- *
- ******************************************************************************/
-
-void
-ResetCurrentLineBuffer (
- void)
-{
-
- if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
- {
- FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
- Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
- }
-
- Gbl_CurrentLineOffset += Gbl_CurrentColumn;
- Gbl_CurrentColumn = 0;
-
- Gbl_CurrentLineNumber++;
- Gbl_LogicalLineNumber++;
- Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: InsertLineBuffer
- *
- * PARAMETERS: SourceChar - One char from the input ASL source file
- *
- * RETURN: None
- *
- * DESCRIPTION: Put one character of the source file into the temp line buffer
- *
- ******************************************************************************/
-
-#define ASL_SPACES_PER_TAB 4
-
-void
-InsertLineBuffer (
- int SourceChar)
-{
- UINT32 i;
- UINT32 Count = 1;
-
-
- if (SourceChar == EOF)
- {
- return;
- }
-
- Gbl_InputByteCount++;
-
- /* Handle tabs. Convert to spaces */
-
- if (SourceChar == '\t')
- {
- SourceChar = ' ';
- Count = ASL_SPACES_PER_TAB -
- (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
- }
-
-
- for (i = 0; i < Count; i++)
- {
- Gbl_CurrentColumn++;
-
- /* Insert the character into the line buffer */
-
- *Gbl_LineBufPtr = (UINT8) SourceChar;
- Gbl_LineBufPtr++;
-
- if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
- {
-#if 0
- /*
- * Warning if we have split a long source line.
- * <Probably overkill>
- */
- sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE);
- AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
-#endif
-
- ResetCurrentLineBuffer ();
- }
- else if (SourceChar == '\n')
- {
- /* End of line */
-
- ResetCurrentLineBuffer ();
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: count
- *
- * PARAMETERS: yytext - Contains the matched keyword.
- * Type - Keyword/Character type:
- * 0 = anything except a keyword
- * 1 = pseudo-keywords
- * 2 = non-executable ASL keywords
- * 3 = executable ASL keywords
- *
- * RETURN: None
- *
- * DESCRIPTION: Count keywords and put them into the line buffer
- *
- ******************************************************************************/
-
-void
-count (
- int Type)
-{
- int i;
-
-
- switch (Type)
- {
- case 2:
- TotalKeywords++;
- TotalNamedObjects++;
- break;
-
- case 3:
- TotalKeywords++;
- TotalExecutableOpcodes++;
- break;
- }
-
- for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
- {
- InsertLineBuffer (yytext[i]);
- *Gbl_LineBufPtr = 0;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: comment
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Process a standard comment.
- *
- ******************************************************************************/
-
-char
-comment (void)
-{
- char c;
- char c1 = 0;
-
-
- InsertLineBuffer ('/');
- InsertLineBuffer ('*');
-
-loop:
-
- /* Eat chars until end-of-comment */
-
- while ((c = (char) input()) != '*' && c != EOF)
- {
- InsertLineBuffer (c);
- c1 = c;
- }
-
- if (c == EOF)
- {
- goto EarlyEOF;
- }
-
- /*
- * Check for nested comment -- can help catch cases where a previous
- * comment was accidently left unterminated
- */
- if ((c1 == '/') && (c == '*'))
- {
- AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_InputByteCount, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
-
- /* Comment is closed only if the NEXT character is a slash */
-
- InsertLineBuffer (c);
-
- if ((c1 = (char) input()) != '/' && c1 != EOF)
- {
- unput(c1);
- goto loop;
- }
-
- if (c1 == EOF)
- {
- goto EarlyEOF;
- }
-
- InsertLineBuffer (c1);
- return TRUE;
-
-
-EarlyEOF:
- /*
- * Premature End-Of-File
- */
- AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- return (FALSE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: comment
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Process a new "//" comment.
- *
- ******************************************************************************/
-
-char
-comment2 (void)
-{
- char c;
-
-
- InsertLineBuffer ('/');
- InsertLineBuffer ('/');
-
- while ((c = (char) input()) != '\n' && c != EOF)
- {
- InsertLineBuffer (c);
- }
-
- if (c == EOF)
- {
- /* End of file is OK, change to newline. Let parser detect EOF later */
-
- c = '\n';
- }
-
- InsertLineBuffer (c);
- return (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: literal
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Process a string literal (surrounded by quotes)
- *
- ******************************************************************************/
-
-#define ASL_NORMAL_CHAR 0
-#define ASL_ESCAPE_SEQUENCE 1
-#define ASL_OCTAL_CONSTANT 2
-#define ASL_HEX_CONSTANT 3
-
-char
-literal (void)
-{
- char *StringBuffer = MsgBuffer;
- char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
- char *CleanString;
- char StringChar;
- UINT32 State = ASL_NORMAL_CHAR;
- UINT32 i = 0;
- UINT8 Digit;
- char ConvertBuffer[4];
-
-
- /*
- * Eat chars until end-of-literal.
- * NOTE: Put back the original surrounding quotes into the
- * source line buffer.
- */
- InsertLineBuffer ('\"');
- while ((StringChar = (char) input()) != EOF)
- {
- InsertLineBuffer (StringChar);
-
-DoCharacter:
-
- switch (State)
- {
- case ASL_NORMAL_CHAR:
-
- switch (StringChar)
- {
- case '\\':
- /*
- * Special handling for backslash-escape sequence. We will
- * toss the backslash and translate the escape char(s).
- */
- State = ASL_ESCAPE_SEQUENCE;
- continue;
-
- case '\"':
-
- /* String terminator */
-
- goto CompletedString;
- }
- break;
-
-
- case ASL_ESCAPE_SEQUENCE:
-
- State = ASL_NORMAL_CHAR;
- switch (StringChar)
- {
- case 'a':
- StringChar = 0x07; /* BELL */
- break;
-
- case 'b':
- StringChar = 0x08; /* BACKSPACE */
- break;
-
- case 'f':
- StringChar = 0x0C; /* FORMFEED */
- break;
-
- case 'n':
- StringChar = 0x0A; /* LINEFEED */
- break;
-
- case 'r':
- StringChar = 0x0D; /* CARRIAGE RETURN*/
- break;
-
- case 't':
- StringChar = 0x09; /* HORIZONTAL TAB */
- break;
-
- case 'v':
- StringChar = 0x0B; /* VERTICAL TAB */
- break;
-
- case 'x':
- State = ASL_HEX_CONSTANT;
- i = 0;
- continue;
-
- case '\'': /* Single Quote */
- case '\"': /* Double Quote */
- case '\\': /* Backslash */
- break;
-
- default:
-
- /* Check for an octal digit (0-7) */
-
- if (ACPI_IS_OCTAL_DIGIT (StringChar))
- {
- State = ASL_OCTAL_CONSTANT;
- ConvertBuffer[0] = StringChar;
- i = 1;
- continue;
- }
-
- /* Unknown escape sequence issue warning, but use the character */
-
- AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- break;
- }
- break;
-
-
- case ASL_OCTAL_CONSTANT:
-
- /* Up to three octal digits allowed */
-
- if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
- (i > 2))
- {
- /*
- * Reached end of the constant. Convert the assembled ASCII
- * string and resume processing of the next character
- */
- ConvertBuffer[i] = 0;
- Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
-
- /* Check for NULL or non-ascii character (ignore if so) */
-
- if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
- {
- AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
- else
- {
- *StringBuffer = (char) Digit;
- StringBuffer++;
- if (StringBuffer >= EndBuffer)
- {
- goto BufferOverflow;
- }
- }
-
- State = ASL_NORMAL_CHAR;
- goto DoCharacter;
- break;
- }
-
- /* Append another digit of the constant */
-
- ConvertBuffer[i] = StringChar;
- i++;
- continue;
-
-
- case ASL_HEX_CONSTANT:
-
- /* Up to two hex digits allowed */
-
- if (!ACPI_IS_XDIGIT (StringChar) ||
- (i > 1))
- {
- /*
- * Reached end of the constant. Convert the assembled ASCII
- * string and resume processing of the next character
- */
- ConvertBuffer[i] = 0;
- Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
-
- /* Check for NULL or non-ascii character (ignore if so) */
-
- if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
- {
- AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
- else
- {
- *StringBuffer = (char) Digit;
- StringBuffer++;
- if (StringBuffer >= EndBuffer)
- {
- goto BufferOverflow;
- }
- }
-
- State = ASL_NORMAL_CHAR;
- goto DoCharacter;
- break;
- }
-
- /* Append another digit of the constant */
-
- ConvertBuffer[i] = StringChar;
- i++;
- continue;
- }
-
- /* Save the finished character */
-
- *StringBuffer = StringChar;
- StringBuffer++;
- if (StringBuffer >= EndBuffer)
- {
- goto BufferOverflow;
- }
- }
-
- /*
- * Premature End-Of-File
- */
- AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- return (FALSE);
-
-
-CompletedString:
- /*
- * Null terminate the input string and copy string to a new buffer
- */
- *StringBuffer = 0;
-
- CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
- if (!CleanString)
- {
- AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- return (FALSE);
- }
-
- ACPI_STRCPY (CleanString, MsgBuffer);
- AslCompilerlval.s = CleanString;
- return (TRUE);
-
-
-BufferOverflow:
-
- /* Literal was too long */
-
- AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
- return (FALSE);
-}
-
-
+/*
+ * Bring in the scanner support routines
+ */
+#include "aslsupport.l"
diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y
index a9e58f5..1467477 100644
--- a/source/compiler/aslcompiler.y
+++ b/source/compiler/aslcompiler.y
@@ -236,7 +236,6 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_I2C_SERIALBUS
%token <i> PARSEOP_IF
%token <i> PARSEOP_INCLUDE
-%token <i> PARSEOP_INCLUDE_CSTYLE
%token <i> PARSEOP_INCLUDE_END
%token <i> PARSEOP_INCREMENT
%token <i> PARSEOP_INDEX
@@ -261,7 +260,6 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_LEQUAL
%token <i> PARSEOP_LGREATER
%token <i> PARSEOP_LGREATEREQUAL
-%token <i> PARSEOP_LINE_CSTYLE
%token <i> PARSEOP_LLESS
%token <i> PARSEOP_LLESSEQUAL
%token <i> PARSEOP_LNOT
@@ -504,9 +502,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> FieldUnit
%type <n> FieldUnitEntry
%type <n> FieldUnitList
-%type <n> IncludeCStyleTerm
%type <n> IncludeTerm
-%type <n> LineTerm
%type <n> OffsetTerm
%type <n> OptionalAccessAttribTerm
@@ -805,15 +801,19 @@ void * AslLocalAllocate (unsigned int Size);
/*
- * Blocks, Data, and Opcodes
+ * Root rule. Allow multiple #line directives before the definition block
+ * to handle output from preprocessors
*/
-
ASLCode
: DefinitionBlockTerm
| error {YYABORT; $$ = NULL;}
;
/*
+ * Blocks, Data, and Opcodes
+ */
+
+/*
* Note concerning support for "module-level code".
*
* ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
@@ -829,7 +829,7 @@ ASLCode
* of Type1 and Type2 opcodes at module level.
*/
DefinitionBlockTerm
- : PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
+ : PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
String ','
String ','
ByteConst ','
@@ -863,8 +863,6 @@ Term
CompilerDirective
: IncludeTerm {}
- | IncludeCStyleTerm {$$ = NULL;}
- | LineTerm {$$ = NULL;}
| ExternalTerm {}
;
@@ -1148,26 +1146,16 @@ Type6Opcode
;
IncludeTerm
- : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
+ : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
String ')' {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);}
TermList
IncludeEndTerm {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);}
;
IncludeEndTerm
- : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
- ;
-
-IncludeCStyleTerm
- : PARSEOP_INCLUDE_CSTYLE
- String {FlOpenIncludeFile ($2);}
+ : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
;
-LineTerm
- : PARSEOP_LINE_CSTYLE
- Integer {FlSetLineNumber ($2);}
- ;
-
ExternalTerm
: PARSEOP_EXTERNAL '('
NameString
@@ -1184,7 +1172,7 @@ ExternalTerm
BankFieldTerm
- : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
+ : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
NameString
NameStringItem
TermArgItem
@@ -1251,7 +1239,7 @@ ConnectionTerm
;
CreateBitFieldTerm
- : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
+ : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1261,7 +1249,7 @@ CreateBitFieldTerm
;
CreateByteFieldTerm
- : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
+ : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1271,7 +1259,7 @@ CreateByteFieldTerm
;
CreateDWordFieldTerm
- : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
+ : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1281,7 +1269,7 @@ CreateDWordFieldTerm
;
CreateFieldTerm
- : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
+ : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
TermArg
TermArgItem
TermArgItem
@@ -1292,7 +1280,7 @@ CreateFieldTerm
;
CreateQWordFieldTerm
- : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
+ : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1302,7 +1290,7 @@ CreateQWordFieldTerm
;
CreateWordFieldTerm
- : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
+ : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
TermArg
TermArgItem
NameStringItem
@@ -1312,7 +1300,7 @@ CreateWordFieldTerm
;
DataRegionTerm
- : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
+ : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
NameString
TermArgItem
TermArgItem
@@ -1323,7 +1311,7 @@ DataRegionTerm
;
DeviceTerm
- : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
+ : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
NameString
')' '{'
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
@@ -1332,7 +1320,7 @@ DeviceTerm
;
EventTerm
- : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
+ : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
NameString
')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));}
| PARSEOP_EVENT '('
@@ -1340,7 +1328,7 @@ EventTerm
;
FieldTerm
- : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
+ : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
NameString
',' AccessTypeKeyword
',' LockRuleKeyword
@@ -1352,7 +1340,7 @@ FieldTerm
;
FunctionTerm
- : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
NameString
OptionalParameterTypePackage
OptionalParameterTypesPackage
@@ -1366,7 +1354,7 @@ FunctionTerm
;
IndexFieldTerm
- : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
+ : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
NameString
NameStringItem
',' AccessTypeKeyword
@@ -1379,7 +1367,7 @@ IndexFieldTerm
;
MethodTerm
- : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
NameString
OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);}
OptionalSerializeRuleKeyword
@@ -1393,7 +1381,7 @@ MethodTerm
;
MutexTerm
- : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
+ : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
NameString
',' ByteConstExpr
')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
@@ -1402,7 +1390,7 @@ MutexTerm
;
OpRegionTerm
- : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
+ : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
NameString
',' OpRegionSpaceIdTerm
TermArgItem
@@ -1418,7 +1406,7 @@ OpRegionSpaceIdTerm
;
PowerResTerm
- : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
+ : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
NameString
',' ByteConstExpr
',' WordConstExpr
@@ -1429,7 +1417,7 @@ PowerResTerm
;
ProcessorTerm
- : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
+ : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
NameString
',' ByteConstExpr
OptionalDWordConstExpr
@@ -1441,7 +1429,7 @@ ProcessorTerm
;
ThermalZoneTerm
- : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
+ : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
NameString
')' '{'
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
@@ -1454,7 +1442,7 @@ ThermalZoneTerm
AliasTerm
- : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
+ : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
NameString
NameStringItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));}
@@ -1463,7 +1451,7 @@ AliasTerm
;
NameTerm
- : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
+ : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
NameString
',' DataObject
')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
@@ -1472,7 +1460,7 @@ NameTerm
;
ScopeTerm
- : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
+ : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
NameString
')' '{'
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
@@ -1485,19 +1473,19 @@ ScopeTerm
BreakTerm
- : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
+ : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
;
BreakPointTerm
- : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
+ : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
;
ContinueTerm
- : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
+ : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
;
FatalTerm
- : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
+ : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
ByteConstExpr
',' DWordConstExpr
TermArgItem
@@ -1511,7 +1499,7 @@ IfElseTerm
;
IfTerm
- : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
+ : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
TermArg
')' '{'
TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -1522,7 +1510,7 @@ IfTerm
ElseTerm
: {$$ = NULL;}
- | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
+ | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_ELSE '{'
@@ -1531,10 +1519,10 @@ ElseTerm
| PARSEOP_ELSE
error {$$ = AslDoError(); yyclearin;}
- | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
- TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
+ | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
+ TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
')' '{'
- TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);}
+ TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);}
ElseTerm {TrLinkPeerNode ($<n>5,$11);}
{$$ = TrLinkChildren ($<n>3,1,$<n>5);}
@@ -1546,7 +1534,7 @@ ElseTerm
;
LoadTerm
- : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
+ : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
NameString
RequiredTarget
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1555,11 +1543,11 @@ LoadTerm
;
NoOpTerm
- : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
+ : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
;
NotifyTerm
- : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
+ : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
SuperName
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1568,7 +1556,7 @@ NotifyTerm
;
ReleaseTerm
- : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
+ : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RELEASE '('
@@ -1576,7 +1564,7 @@ ReleaseTerm
;
ResetTerm
- : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
+ : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RESET '('
@@ -1584,16 +1572,16 @@ ResetTerm
;
ReturnTerm
- : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
+ : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
OptionalReturnArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
- | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
+ | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
| PARSEOP_RETURN '('
error ')' {$$ = AslDoError(); yyclearin;}
;
SignalTerm
- : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
+ : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_SIGNAL '('
@@ -1601,7 +1589,7 @@ SignalTerm
;
SleepTerm
- : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
+ : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_SLEEP '('
@@ -1609,7 +1597,7 @@ SleepTerm
;
StallTerm
- : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
+ : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_STALL '('
@@ -1617,7 +1605,7 @@ StallTerm
;
SwitchTerm
- : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
+ : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
TermArg
')' '{'
CaseDefaultTermList '}'
@@ -1660,7 +1648,7 @@ CaseTermList
*/
CaseTerm
- : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
+ : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
DataObject
')' '{'
TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -1669,14 +1657,14 @@ CaseTerm
;
DefaultTerm
- : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
+ : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_DEFAULT '{'
error '}' {$$ = AslDoError(); yyclearin;}
;
UnloadTerm
- : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
+ : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_UNLOAD '('
@@ -1684,7 +1672,7 @@ UnloadTerm
;
WhileTerm
- : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
+ : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
TermArg
')' '{' TermList '}'
{$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -1696,7 +1684,7 @@ WhileTerm
/******* Type 2 opcodes *******************************************************/
AcquireTerm
- : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
+ : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
SuperName
',' WordConstExpr
')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);}
@@ -1705,7 +1693,7 @@ AcquireTerm
;
AddTerm
- : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
+ : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
TermArg
TermArgItem
Target
@@ -1715,7 +1703,7 @@ AddTerm
;
AndTerm
- : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
+ : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
TermArg
TermArgItem
Target
@@ -1725,7 +1713,7 @@ AndTerm
;
ConcatTerm
- : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
+ : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
TermArg
TermArgItem
Target
@@ -1745,7 +1733,7 @@ ConcatResTerm
;
CondRefOfTerm
- : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
+ : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
SuperName
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1754,7 +1742,7 @@ CondRefOfTerm
;
CopyObjectTerm
- : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
+ : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
TermArg
',' SimpleTarget
')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
@@ -1763,7 +1751,7 @@ CopyObjectTerm
;
DecTerm
- : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
+ : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_DECREMENT '('
@@ -1771,7 +1759,7 @@ DecTerm
;
DerefOfTerm
- : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
+ : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_DEREFOF '('
@@ -1779,7 +1767,7 @@ DerefOfTerm
;
DivideTerm
- : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
+ : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
TermArg
TermArgItem
Target
@@ -1790,7 +1778,7 @@ DivideTerm
;
FindSetLeftBitTerm
- : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
+ : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1799,7 +1787,7 @@ FindSetLeftBitTerm
;
FindSetRightBitTerm
- : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
+ : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1808,7 +1796,7 @@ FindSetRightBitTerm
;
FromBCDTerm
- : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
+ : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1817,7 +1805,7 @@ FromBCDTerm
;
IncTerm
- : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
+ : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_INCREMENT '('
@@ -1825,7 +1813,7 @@ IncTerm
;
IndexTerm
- : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
+ : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
TermArg
TermArgItem
Target
@@ -1835,7 +1823,7 @@ IndexTerm
;
LAndTerm
- : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
+ : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1844,7 +1832,7 @@ LAndTerm
;
LEqualTerm
- : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+ : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1853,7 +1841,7 @@ LEqualTerm
;
LGreaterTerm
- : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+ : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1862,7 +1850,7 @@ LGreaterTerm
;
LGreaterEqualTerm
- : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
+ : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
TermArg
TermArgItem
')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
@@ -1871,7 +1859,7 @@ LGreaterEqualTerm
;
LLessTerm
- : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
+ : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1880,7 +1868,7 @@ LLessTerm
;
LLessEqualTerm
- : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+ : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
TermArg
TermArgItem
')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
@@ -1889,7 +1877,7 @@ LLessEqualTerm
;
LNotTerm
- : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
+ : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
TermArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_LNOT '('
@@ -1897,7 +1885,7 @@ LNotTerm
;
LNotEqualTerm
- : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+ : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
TermArg
TermArgItem
')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
@@ -1906,7 +1894,7 @@ LNotEqualTerm
;
LoadTableTerm
- : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
+ : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
TermArg
TermArgItem
TermArgItem
@@ -1919,7 +1907,7 @@ LoadTableTerm
;
LOrTerm
- : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
+ : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
TermArg
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -1928,7 +1916,7 @@ LOrTerm
;
MatchTerm
- : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
+ : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
TermArg
',' MatchOpKeyword
TermArgItem
@@ -1941,7 +1929,7 @@ MatchTerm
;
MidTerm
- : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
+ : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
TermArg
TermArgItem
TermArgItem
@@ -1952,7 +1940,7 @@ MidTerm
;
ModTerm
- : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
+ : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
TermArg
TermArgItem
Target
@@ -1962,7 +1950,7 @@ ModTerm
;
MultiplyTerm
- : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
+ : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
TermArg
TermArgItem
Target
@@ -1972,7 +1960,7 @@ MultiplyTerm
;
NAndTerm
- : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
+ : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
TermArg
TermArgItem
Target
@@ -1982,7 +1970,7 @@ NAndTerm
;
NOrTerm
- : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
+ : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
TermArg
TermArgItem
Target
@@ -1992,7 +1980,7 @@ NOrTerm
;
NotTerm
- : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
+ : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2001,7 +1989,7 @@ NotTerm
;
ObjectTypeTerm
- : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
+ : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_OBJECTTYPE '('
@@ -2009,7 +1997,7 @@ ObjectTypeTerm
;
OrTerm
- : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
+ : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
TermArg
TermArgItem
Target
@@ -2023,7 +2011,7 @@ OrTerm
* we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
*/
RefOfTerm
- : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
+ : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));}
| PARSEOP_REFOF '('
@@ -2031,7 +2019,7 @@ RefOfTerm
;
ShiftLeftTerm
- : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
+ : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
TermArg
TermArgItem
Target
@@ -2041,7 +2029,7 @@ ShiftLeftTerm
;
ShiftRightTerm
- : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
+ : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
TermArg
TermArgItem
Target
@@ -2051,7 +2039,7 @@ ShiftRightTerm
;
SizeOfTerm
- : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
+ : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
SuperName
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_SIZEOF '('
@@ -2059,7 +2047,7 @@ SizeOfTerm
;
StoreTerm
- : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
+ : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
TermArg
',' SuperName
')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
@@ -2068,7 +2056,7 @@ StoreTerm
;
SubtractTerm
- : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
+ : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
TermArg
TermArgItem
Target
@@ -2078,15 +2066,15 @@ SubtractTerm
;
TimerTerm
- : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
+ : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
')' {$$ = TrLinkChildren ($<n>3,0);}
- | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
+ | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
| PARSEOP_TIMER '('
error ')' {$$ = AslDoError(); yyclearin;}
;
ToBCDTerm
- : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
+ : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2095,7 +2083,7 @@ ToBCDTerm
;
ToBufferTerm
- : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
+ : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2104,7 +2092,7 @@ ToBufferTerm
;
ToDecimalStringTerm
- : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
+ : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2113,7 +2101,7 @@ ToDecimalStringTerm
;
ToHexStringTerm
- : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
+ : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2122,7 +2110,7 @@ ToHexStringTerm
;
ToIntegerTerm
- : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
+ : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
TermArg
Target
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2131,7 +2119,7 @@ ToIntegerTerm
;
ToStringTerm
- : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
+ : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
TermArg
OptionalCount
Target
@@ -2148,7 +2136,7 @@ ToUUIDTerm
;
WaitTerm
- : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
+ : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
SuperName
TermArgItem
')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
@@ -2157,7 +2145,7 @@ WaitTerm
;
XOrTerm
- : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
+ : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
TermArg
TermArgItem
Target
@@ -2211,8 +2199,8 @@ AddressKeyword
;
AddressSpaceKeyword
- : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
- | RegionSpaceKeyword {}
+ : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);}
+ | RegionSpaceKeyword {}
;
BitsPerByteKeyword
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 4bf47e4..3b384f2 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -259,7 +259,7 @@ AePrintException (
{
if (Gbl_VerboseErrors)
{
- fprintf (OutputFile, "%6s", Enode->Filename);
+ fprintf (OutputFile, "%-8s", Enode->Filename);
if (Enode->LineNumber)
{
@@ -270,12 +270,7 @@ AePrintException (
}
else
{
- if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL)
- fprintf (OutputFile, " %6u: ",
- PrGetLineNumber (Enode->LineNumber));
- else
- fprintf (OutputFile, " %6u: ",
- Enode->LineNumber);
+ fprintf (OutputFile, " %6u: ", Enode->LineNumber);
/*
* If not at EOF, get the corresponding source code line and
@@ -324,16 +319,8 @@ AePrintException (
if (Enode->LineNumber)
{
- if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL)
- {
- fprintf (OutputFile, "(%u) i:%6u : ",
- PrGetLineNumber (Enode->LineNumber), Enode->LineNumber);
- }
- else
- {
- fprintf (OutputFile, "(%u) i:%6u : ",
- Enode->LineNumber, Enode->LineNumber);
- }
+ fprintf (OutputFile, "(%u) i:%6u : ",
+ Enode->LineNumber, Enode->LineNumber);
}
}
}
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 1c2f73f..8f02be3 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -81,12 +81,12 @@ AslAbort (
void)
{
- AePrintErrorLog (ASL_FILE_STDOUT);
+ AePrintErrorLog (ASL_FILE_STDERR);
if (Gbl_DebugFlag)
{
- /* Print error summary to the debug file */
+ /* Print error summary to stdout also */
- AePrintErrorLog (ASL_FILE_STDERR);
+ AePrintErrorLog (ASL_FILE_STDOUT);
}
exit (1);
@@ -388,11 +388,38 @@ FlCloseFile (
void
FlSetLineNumber (
- ACPI_PARSE_OBJECT *Op)
+ UINT32 LineNumber)
+{
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New line number %u (old %u)\n",
+ LineNumber, Gbl_LogicalLineNumber);
+
+ Gbl_CurrentLineNumber = LineNumber;
+ Gbl_LogicalLineNumber = LineNumber;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSetFilename
+ *
+ * PARAMETERS: Op - Parse node for the LINE asl statement
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Set the current filename
+ *
+ ******************************************************************************/
+
+void
+FlSetFilename (
+ char *Filename)
{
- Gbl_CurrentLineNumber = (UINT32) Op->Asl.Value.Integer;
- Gbl_LogicalLineNumber = (UINT32) Op->Asl.Value.Integer;
+ DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New filename %s (old %s)\n",
+ Filename, Gbl_Files[ASL_FILE_INPUT].Filename);
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
}
@@ -548,7 +575,7 @@ FlOpenIncludeFile (
* Flush out the "include ()" statement on this line, start
* the actual include file on the next line
*/
- ResetCurrentLineBuffer ();
+ AslResetCurrentLineBuffer ();
FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n");
Gbl_CurrentLineOffset++;
@@ -770,17 +797,20 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
}
- /* Create the preprocessor output file */
+ /* Create the preprocessor output file if preprocessor enabled */
- Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR);
- if (!Filename)
+ if (Gbl_PreprocessFlag)
{
- AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
- 0, 0, 0, 0, NULL, NULL);
- return (AE_ERROR);
- }
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
- FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b");
+ FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b");
+ }
/* All done for data table compiler */
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 26da48b..64cb76b 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -74,7 +74,7 @@ extern int PrParserdebug;
extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;
-#define ASL_LINE_BUFFER_SIZE 4096
+#define ASL_LINE_BUFFER_SIZE (4096 * 4) /* 16K */
#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 8
@@ -84,6 +84,7 @@ extern char *AslCompilertext;
ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE];
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0);
@@ -99,6 +100,7 @@ ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE);
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);
@@ -118,6 +120,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
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);
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 14a02b4..7fb2b3a 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -96,7 +96,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:Pr:s|t|T:G^v|w|x:z"
+#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:P^r:s|t|T:G^v|w|x:z"
/*******************************************************************************
@@ -124,6 +124,7 @@ Options (
ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
ACPI_OPTION ("-li", "Create preprocessed output file (*.i)");
ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
+ ACPI_OPTION ("-Pn", "Disable preprocessor");
printf ("\nGeneral Output:\n");
ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
@@ -133,6 +134,7 @@ Options (
ACPI_OPTION ("-vr", "Disable remarks");
ACPI_OPTION ("-vs", "Disable signon");
ACPI_OPTION ("-w1 -w2 -w3", "Set warning reporting level");
+ ACPI_OPTION ("-we", "Report warnings as errors");
printf ("\nAML Output Files:\n");
ACPI_OPTION ("-sa -sc", "Create AML in assembler or C source file (*.asm or *.c)");
@@ -671,9 +673,22 @@ AslDoOptions (
break;
- case 'P': /* Preprocess (plus .i file) only */
- Gbl_PreprocessOnly = TRUE;
- Gbl_PreprocessorOutputFlag = TRUE;
+ case 'P': /* Preprocessor options */
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '^': /* Proprocess only, emit (.i) file */
+ Gbl_PreprocessOnly = TRUE;
+ Gbl_PreprocessorOutputFlag = TRUE;
+ break;
+
+ case 'n': /* Disable preprocessor */
+ Gbl_PreprocessFlag = FALSE;
+ break;
+
+ default:
+ printf ("Unknown option: -P%s\n", AcpiGbl_Optarg);
+ return (-1);
+ }
break;
@@ -793,6 +808,10 @@ AslDoOptions (
Gbl_WarningLevel = ASL_WARNING3;
break;
+ case 'e':
+ Gbl_WarningsAsErrors = TRUE;
+ break;
+
default:
printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
return (-1);
diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c
index aa8894a..04fc5386 100644
--- a/source/compiler/aslmap.c
+++ b/source/compiler/aslmap.c
@@ -240,7 +240,6 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* I2CSERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0),
/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
-/* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE),
@@ -265,7 +264,6 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LINE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
diff --git a/source/compiler/aslrestype1.c b/source/compiler/aslrestype1.c
index d137fe3..d7ec6c4 100644
--- a/source/compiler/aslrestype1.c
+++ b/source/compiler/aslrestype1.c
@@ -453,6 +453,10 @@ RsDoStartDependentDescriptor (
PreviousRnode = Rnode;
Descriptor = Rnode->Buffer;
+ /* Increment offset past StartDependent descriptor */
+
+ CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT);
+
/* Descriptor has priority byte */
Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
@@ -545,6 +549,10 @@ RsDoStartDependentNoPriDescriptor (
ASL_RDESC_ST_DEPEND_SIZE;
PreviousRnode = Rnode;
+ /* Increment offset past StartDependentNoPri descriptor */
+
+ CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO);
+
/* Process all child initialization nodes */
State = ACPI_RSTATE_START_DEPENDENT;
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 2bc1ba6..13b7af4 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -404,18 +404,33 @@ AslDoOneFile (
case ASL_INPUT_TYPE_ASCII_DATA:
Status = DtDoCompile ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
if (Gbl_Signature)
{
ACPI_FREE (Gbl_Signature);
Gbl_Signature = NULL;
}
+
+ /* Check if any errors occurred during compile */
+
+ Status = AslCheckForErrorExit ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Cleanup (for next source file) and exit */
+
AeClearErrorLog ();
PrTerminatePreprocessor ();
return (Status);
/*
- * ASL Compilation (Optional)
+ * ASL Compilation
*/
case ASL_INPUT_TYPE_ASCII_ASL:
@@ -427,18 +442,19 @@ AslDoOneFile (
return (Status);
}
- Status = CmDoCompile ();
+ (void) CmDoCompile ();
(void) AcpiTerminate ();
- /*
- * Return non-zero exit code if there have been errors, unless the
- * global ignore error flag has been set
- */
- if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
+ /* Check if any errors occurred during compile */
+
+ Status = AslCheckForErrorExit ();
+ if (ACPI_FAILURE (Status))
{
- return (AE_ERROR);
+ return (Status);
}
+ /* Cleanup (for next source file) and exit */
+
AeClearErrorLog ();
PrTerminatePreprocessor ();
return (AE_OK);
@@ -525,3 +541,47 @@ AslDoOnePathname (
return (Status);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslCheckForErrorExit
+ *
+ * PARAMETERS: None. Examines global exception count array
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Determine if compiler should abort with error status
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AslCheckForErrorExit (
+ void)
+{
+
+ /*
+ * Return non-zero exit code if there have been errors, unless the
+ * global ignore error flag has been set
+ */
+ if (!Gbl_IgnoreErrors)
+ {
+ if (Gbl_ExceptionCount[ASL_ERROR] > 0)
+ {
+ return (AE_ERROR);
+ }
+
+ /* Optionally treat warnings as errors */
+
+ if (Gbl_WarningsAsErrors)
+ {
+ if ((Gbl_ExceptionCount[ASL_WARNING] > 0) ||
+ (Gbl_ExceptionCount[ASL_WARNING2] > 0) ||
+ (Gbl_ExceptionCount[ASL_WARNING3] > 0))
+ {
+ return (AE_ERROR);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l
new file mode 100644
index 0000000..65dd19b
--- /dev/null
+++ b/source/compiler/aslsupport.l
@@ -0,0 +1,782 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslsupport.l - Flex/lex scanner C support routines.
+ * NOTE: Included into aslcompile.l, not compiled by itself.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+/* Configuration */
+
+#define ASL_SPACES_PER_TAB 4
+
+#define ASL_NORMAL_CHAR 0
+#define ASL_ESCAPE_SEQUENCE 1
+#define ASL_OCTAL_CONSTANT 2
+#define ASL_HEX_CONSTANT 3
+
+
+/* File node - used for "Include" operator file stack */
+
+typedef struct asl_file_node
+{
+ FILE *File;
+ UINT32 CurrentLineNumber;
+ YY_BUFFER_STATE State;
+ char *Filename;
+ struct asl_file_node *Next;
+
+} ASL_FILE_NODE;
+
+/* File stack for the "Include" operator (NOT #include operator) */
+
+ASL_FILE_NODE *Gbl_IncludeFileStack = NULL;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoLineDirective
+ *
+ * PARAMETERS: None. Uses input() to access current source code line
+ *
+ * RETURN: Updates global line number and filename
+ *
+ * DESCRIPTION: Handle #line directives emitted by the preprocessor.
+ *
+ * The #line directive is emitted by the preprocesser, and is used to
+ * pass through line numbers from the original source code file to the
+ * preprocessor output file (.i). This allows any compiler-generated
+ * error messages to be displayed with the correct line number.
+ *
+ ******************************************************************************/
+
+static void
+AslDoLineDirective (
+ void)
+{
+ char c;
+ char *Token;
+ UINT32 LineNumber;
+ char *Filename;
+
+
+ /* Eat the entire line that contains the #line directive */
+
+ while ((c = (char) input()) != '\n' && c != EOF)
+ {
+ AslInsertLineBuffer (c);
+ }
+ AslInsertLineBuffer (0);
+
+ /* First argument is the actual line number */
+
+ Token = strtok (Gbl_CurrentLineBuffer, " ");
+ if (!Token)
+ {
+ goto ResetAndExit;
+ }
+
+ /* Convert line number. Subtract one to handle _this_ line */
+
+ LineNumber = (UINT32) UtDoConstant (Token);
+ FlSetLineNumber (LineNumber - 1);
+
+ /* Second argument is the optional filename (in double quotes) */
+
+ Token = strtok (NULL, " \"");
+ if (Token)
+ {
+ Filename = ACPI_ALLOCATE_ZEROED (strlen (Token) + 1);
+ strcpy (Filename, Token);
+ FlSetFilename (Filename);
+ }
+
+ /* Third argument is not supported at this time */
+
+ResetAndExit:
+ AslResetCurrentLineBuffer ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslPopInputFileStack
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: 0 if a node was popped, -1 otherwise
+ *
+ * DESCRIPTION: Pop the top of the input file stack and point the parser to
+ * the saved parse buffer contained in the fnode. Also, set the
+ * global line counters to the saved values. This function is
+ * called when an include file reaches EOF.
+ *
+ ******************************************************************************/
+
+int
+AslPopInputFileStack (
+ void)
+{
+ ASL_FILE_NODE *Fnode;
+
+
+ Fnode = Gbl_IncludeFileStack;
+ DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
+
+ if (!Fnode)
+ {
+ return (-1);
+ }
+
+ /* Close the current include file */
+
+ fclose (yyin);
+
+ /* Update the top-of-stack */
+
+ Gbl_IncludeFileStack = Fnode->Next;
+
+ /* Reset global line counter and filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
+ Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
+
+ /* Point the parser to the popped file */
+
+ yy_delete_buffer (YY_CURRENT_BUFFER);
+ yy_switch_to_buffer (Fnode->State);
+
+ /* All done with this node */
+
+ ACPI_FREE (Fnode);
+ return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslPushInputFileStack
+ *
+ * PARAMETERS: InputFile - Open file pointer
+ * Filename - Name of the file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
+ * to this file. Called when an include file is successfully
+ * opened.
+ *
+ ******************************************************************************/
+
+void
+AslPushInputFileStack (
+ FILE *InputFile,
+ char *Filename)
+{
+ ASL_FILE_NODE *Fnode;
+ YY_BUFFER_STATE State;
+
+
+ /* Save the current state in an Fnode */
+
+ Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
+
+ Fnode->File = yyin;
+ Fnode->Next = Gbl_IncludeFileStack;
+ Fnode->State = YY_CURRENT_BUFFER;
+ Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
+ Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
+
+ /* Push it on the stack */
+
+ Gbl_IncludeFileStack = Fnode;
+
+ /* Point the parser to this file */
+
+ State = yy_create_buffer (InputFile, YY_BUF_SIZE);
+ yy_switch_to_buffer (State);
+
+ DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
+
+ /* Reset the global line count and filename */
+
+ Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
+ Gbl_CurrentLineNumber = 1;
+ yyin = InputFile;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslResetCurrentLineBuffer
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
+ *
+ ******************************************************************************/
+
+void
+AslResetCurrentLineBuffer (
+ void)
+{
+
+ if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
+ {
+ FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
+ Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
+ }
+
+ Gbl_CurrentLineOffset += Gbl_CurrentColumn;
+ Gbl_CurrentColumn = 0;
+
+ Gbl_CurrentLineNumber++;
+ Gbl_LogicalLineNumber++;
+ Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslInsertLineBuffer
+ *
+ * PARAMETERS: SourceChar - One char from the input ASL source file
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Put one character of the source file into the temp line buffer
+ *
+ ******************************************************************************/
+
+void
+AslInsertLineBuffer (
+ int SourceChar)
+{
+ UINT32 i;
+ UINT32 Count = 1;
+
+
+ if (SourceChar == EOF)
+ {
+ return;
+ }
+
+ Gbl_InputByteCount++;
+
+ /* Handle tabs. Convert to spaces */
+
+ if (SourceChar == '\t')
+ {
+ SourceChar = ' ';
+ Count = ASL_SPACES_PER_TAB -
+ (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
+ }
+
+ for (i = 0; i < Count; i++)
+ {
+ Gbl_CurrentColumn++;
+
+ /* Insert the character into the line buffer */
+
+ *Gbl_LineBufPtr = (UINT8) SourceChar;
+ Gbl_LineBufPtr++;
+
+ if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
+ {
+#if 0
+ /*
+ * Warning if we have split a long source line.
+ * <Probably overkill>
+ */
+ sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE);
+ AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
+#endif
+
+ AslResetCurrentLineBuffer ();
+ }
+ else if (SourceChar == '\n')
+ {
+ /* End of line */
+
+ AslResetCurrentLineBuffer ();
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: count
+ *
+ * PARAMETERS: yytext - Contains the matched keyword.
+ * Type - Keyword/Character type:
+ * 0 = anything except a keyword
+ * 1 = pseudo-keywords
+ * 2 = non-executable ASL keywords
+ * 3 = executable ASL keywords
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Count keywords and put them into the line buffer
+ *
+ ******************************************************************************/
+
+static void
+count (
+ int Type)
+{
+ int i;
+
+
+ switch (Type)
+ {
+ case 2:
+ TotalKeywords++;
+ TotalNamedObjects++;
+ break;
+
+ case 3:
+ TotalKeywords++;
+ TotalExecutableOpcodes++;
+ break;
+ }
+
+ for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
+ {
+ AslInsertLineBuffer (yytext[i]);
+ *Gbl_LineBufPtr = 0;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoComment
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a standard comment.
+ *
+ ******************************************************************************/
+
+static char
+AslDoComment (
+ void)
+{
+ char c;
+ char c1 = 0;
+
+
+ AslInsertLineBuffer ('/');
+ AslInsertLineBuffer ('*');
+
+loop:
+
+ /* Eat chars until end-of-comment */
+
+ while ((c = (char) input()) != '*' && c != EOF)
+ {
+ AslInsertLineBuffer (c);
+ c1 = c;
+ }
+
+ if (c == EOF)
+ {
+ goto EarlyEOF;
+ }
+
+ /*
+ * Check for nested comment -- can help catch cases where a previous
+ * comment was accidently left unterminated
+ */
+ if ((c1 == '/') && (c == '*'))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_InputByteCount, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+
+ /* Comment is closed only if the NEXT character is a slash */
+
+ AslInsertLineBuffer (c);
+
+ if ((c1 = (char) input()) != '/' && c1 != EOF)
+ {
+ unput(c1);
+ goto loop;
+ }
+
+ if (c1 == EOF)
+ {
+ goto EarlyEOF;
+ }
+
+ AslInsertLineBuffer (c1);
+ return (TRUE);
+
+
+EarlyEOF:
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoCommentType2
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a new "//" comment.
+ *
+ ******************************************************************************/
+
+static char
+AslDoCommentType2 (
+ void)
+{
+ char c;
+
+
+ AslInsertLineBuffer ('/');
+ AslInsertLineBuffer ('/');
+
+ while ((c = (char) input()) != '\n' && c != EOF)
+ {
+ AslInsertLineBuffer (c);
+ }
+
+ if (c == EOF)
+ {
+ /* End of file is OK, change to newline. Let parser detect EOF later */
+
+ c = '\n';
+ }
+
+ AslInsertLineBuffer (c);
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDoStringLiteral
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a string literal (surrounded by quotes)
+ *
+ ******************************************************************************/
+
+static char
+AslDoStringLiteral (
+ void)
+{
+ char *StringBuffer = MsgBuffer;
+ char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
+ char *CleanString;
+ char StringChar;
+ UINT32 State = ASL_NORMAL_CHAR;
+ UINT32 i = 0;
+ UINT8 Digit;
+ char ConvertBuffer[4];
+
+
+ /*
+ * Eat chars until end-of-literal.
+ * NOTE: Put back the original surrounding quotes into the
+ * source line buffer.
+ */
+ AslInsertLineBuffer ('\"');
+ while ((StringChar = (char) input()) != EOF)
+ {
+ AslInsertLineBuffer (StringChar);
+
+DoCharacter:
+
+ switch (State)
+ {
+ case ASL_NORMAL_CHAR:
+
+ switch (StringChar)
+ {
+ case '\\':
+ /*
+ * Special handling for backslash-escape sequence. We will
+ * toss the backslash and translate the escape char(s).
+ */
+ State = ASL_ESCAPE_SEQUENCE;
+ continue;
+
+ case '\"':
+
+ /* String terminator */
+
+ goto CompletedString;
+ }
+ break;
+
+
+ case ASL_ESCAPE_SEQUENCE:
+
+ State = ASL_NORMAL_CHAR;
+ switch (StringChar)
+ {
+ case 'a':
+ StringChar = 0x07; /* BELL */
+ break;
+
+ case 'b':
+ StringChar = 0x08; /* BACKSPACE */
+ break;
+
+ case 'f':
+ StringChar = 0x0C; /* FORMFEED */
+ break;
+
+ case 'n':
+ StringChar = 0x0A; /* LINEFEED */
+ break;
+
+ case 'r':
+ StringChar = 0x0D; /* CARRIAGE RETURN*/
+ break;
+
+ case 't':
+ StringChar = 0x09; /* HORIZONTAL TAB */
+ break;
+
+ case 'v':
+ StringChar = 0x0B; /* VERTICAL TAB */
+ break;
+
+ case 'x':
+ State = ASL_HEX_CONSTANT;
+ i = 0;
+ continue;
+
+ case '\'': /* Single Quote */
+ case '\"': /* Double Quote */
+ case '\\': /* Backslash */
+ break;
+
+ default:
+
+ /* Check for an octal digit (0-7) */
+
+ if (ACPI_IS_OCTAL_DIGIT (StringChar))
+ {
+ State = ASL_OCTAL_CONSTANT;
+ ConvertBuffer[0] = StringChar;
+ i = 1;
+ continue;
+ }
+
+ /* Unknown escape sequence issue warning, but use the character */
+
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ break;
+ }
+ break;
+
+
+ case ASL_OCTAL_CONSTANT:
+
+ /* Up to three octal digits allowed */
+
+ if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
+ (i > 2))
+ {
+ /*
+ * Reached end of the constant. Convert the assembled ASCII
+ * string and resume processing of the next character
+ */
+ ConvertBuffer[i] = 0;
+ Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
+
+ /* Check for NULL or non-ascii character (ignore if so) */
+
+ if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+ else
+ {
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
+ }
+
+ State = ASL_NORMAL_CHAR;
+ goto DoCharacter;
+ break;
+ }
+
+ /* Append another digit of the constant */
+
+ ConvertBuffer[i] = StringChar;
+ i++;
+ continue;
+
+
+ case ASL_HEX_CONSTANT:
+
+ /* Up to two hex digits allowed */
+
+ if (!ACPI_IS_XDIGIT (StringChar) ||
+ (i > 1))
+ {
+ /*
+ * Reached end of the constant. Convert the assembled ASCII
+ * string and resume processing of the next character
+ */
+ ConvertBuffer[i] = 0;
+ Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
+
+ /* Check for NULL or non-ascii character (ignore if so) */
+
+ if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
+ {
+ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ }
+ else
+ {
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
+ }
+
+ State = ASL_NORMAL_CHAR;
+ goto DoCharacter;
+ break;
+ }
+
+ /* Append another digit of the constant */
+
+ ConvertBuffer[i] = StringChar;
+ i++;
+ continue;
+ }
+
+ /* Save the finished character */
+
+ *StringBuffer = StringChar;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
+ }
+
+ /*
+ * Premature End-Of-File
+ */
+ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+
+
+CompletedString:
+ /*
+ * Null terminate the input string and copy string to a new buffer
+ */
+ *StringBuffer = 0;
+
+ CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
+ if (!CleanString)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+ return (FALSE);
+ }
+
+ ACPI_STRCPY (CleanString, MsgBuffer);
+ AslCompilerlval.s = CleanString;
+ return (TRUE);
+
+
+BufferOverflow:
+
+ /* Literal was too long */
+
+ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
+ return (FALSE);
+}
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c
index 14accfe..6357bfb 100644
--- a/source/compiler/dtio.c
+++ b/source/compiler/dtio.c
@@ -89,6 +89,7 @@ DtDumpBuffer (
#define DT_SLASH_SLASH_COMMENT 4
#define DT_END_COMMENT 5
#define DT_MERGE_LINES 6
+#define DT_ESCAPE_SEQUENCE 7
static UINT32 Gbl_NextLineOffset;
@@ -412,6 +413,7 @@ DtGetNextLine (
BOOLEAN LineNotAllBlanks = FALSE;
UINT32 State = DT_NORMAL_TEXT;
UINT32 CurrentLineOffset;
+ UINT32 BeyondBufferCount;
UINT32 i;
char c;
@@ -503,12 +505,36 @@ DtGetNextLine (
Gbl_CurrentLineBuffer[i] = c;
i++;
- if (c == '"')
+ switch (c)
{
+ case '"':
+ State = DT_NORMAL_TEXT;
+ break;
+
+ case '\\':
+ State = DT_ESCAPE_SEQUENCE;
+ break;
+
+ case '\n':
+ AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n",
+ Gbl_CurrentLineNumber++);
State = DT_NORMAL_TEXT;
+ break;
+
+ default: /* Get next character */
+ break;
}
break;
+ case DT_ESCAPE_SEQUENCE:
+
+ /* Just copy the escaped character. TBD: sufficient for table compiler? */
+
+ Gbl_CurrentLineBuffer[i] = c;
+ i++;
+ State = DT_START_QUOTED_STRING;
+ break;
+
case DT_START_COMMENT:
/* Open comment if this character is an asterisk or slash */
@@ -629,7 +655,19 @@ DtGetNextLine (
}
}
- printf ("ERROR - Input line is too long (max %u)\n", ASL_LINE_BUFFER_SIZE);
+ /* Line is too long for internal buffer. Determine actual length */
+
+ BeyondBufferCount = 1;
+ c = (char) getc (Handle);
+ while (c != '\n')
+ {
+ c = (char) getc (Handle);
+ BeyondBufferCount++;
+ }
+
+ printf ("ERROR - At %u: Input line (%u bytes) is too long (max %u)\n",
+ Gbl_CurrentLineNumber++, ASL_LINE_BUFFER_SIZE + BeyondBufferCount,
+ ASL_LINE_BUFFER_SIZE);
return (ASL_EOF);
}
diff --git a/source/compiler/preprocess.h b/source/compiler/preprocess.h
index 09b7b76..920c0b9 100644
--- a/source/compiler/preprocess.h
+++ b/source/compiler/preprocess.h
@@ -124,13 +124,6 @@ typedef struct pr_file_node
} PR_FILE_NODE;
-typedef struct pr_line_mapping
-{
- UINT32 *Map;
- struct pr_line_mapping *Next;
-
-} PR_LINE_MAPPING;
-
/*
* Globals
@@ -140,7 +133,6 @@ PR_EXTERN char Gbl_MainTokenBuffer[ASL_LINE_BUFFER_SIZE];
PR_EXTERN char Gbl_MacroTokenBuffer[ASL_LINE_BUFFER_SIZE];
PR_EXTERN char Gbl_ExpressionTokenBuffer[ASL_LINE_BUFFER_SIZE];
-PR_EXTERN PR_LINE_MAPPING *Gbl_MapBlockHead;
PR_EXTERN PR_FILE_NODE *Gbl_InputFileList;
PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
PR_EXTERN UINT32 Gbl_PreprocessorLineNumber;
@@ -167,10 +159,6 @@ BOOLEAN
PrDoPreprocess (
void);
-UINT32
-PrGetLineNumber (
- UINT32 PreprocessorLineNumber);
-
UINT64
PrIsDefined (
char *Identifier);
@@ -252,11 +240,6 @@ PrGetNextToken (
char **Next);
void
-PrSetLineNumber (
- UINT32 OriginalLineNumber,
- UINT32 NewLineNumber);
-
-void
PrError (
UINT8 Level,
UINT8 MessageId,
diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c
index 3719ca6..3013951 100644
--- a/source/compiler/prscan.c
+++ b/source/compiler/prscan.c
@@ -161,9 +161,6 @@ PrInitializeGlobals (
Gbl_CurrentLineNumber = 0;
Gbl_PreprocessorLineNumber = 1;
Gbl_PreprocessorError = FALSE;
-
- Gbl_MapBlockHead = UtLocalCalloc (sizeof (PR_LINE_MAPPING));
- Gbl_MapBlockHead->Map = UtLocalCalloc (PR_LINES_PER_BLOCK * sizeof (UINT32));
}
@@ -186,7 +183,6 @@ PrTerminatePreprocessor (
void)
{
PR_DEFINE_INFO *DefineInfo;
- PR_LINE_MAPPING *MapInfo;
/*
@@ -202,17 +198,6 @@ PrTerminatePreprocessor (
ACPI_FREE (DefineInfo->Identifier);
ACPI_FREE (DefineInfo);
}
-
- /* Clear the line number mappings */
-
- while (Gbl_MapBlockHead)
- {
- MapInfo = Gbl_MapBlockHead;
- Gbl_MapBlockHead = MapInfo->Next;
-
- ACPI_FREE (MapInfo->Map);
- ACPI_FREE (MapInfo);
- }
}
@@ -393,8 +378,6 @@ PrPreprocessInputFile (
Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next);
}
- /* Write the possibly modified line to the .i file*/
-
#if 0
/* Line prefix */
FlPrintFile (ASL_FILE_PREPROCESSOR, "/* %14s %.5u i:%.5u */ ",
@@ -402,11 +385,27 @@ PrPreprocessInputFile (
Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber);
#endif
- FlWriteFile (ASL_FILE_PREPROCESSOR, Gbl_CurrentLineBuffer,
- strlen (Gbl_CurrentLineBuffer));
+ /*
+ * Emit a #line directive if necessary, to keep the line numbers in
+ * the (.i) file synchronized with the original source code file, so
+ * that the correct line number appears in any error messages
+ * generated by the actual compiler.
+ */
+ if (Gbl_CurrentLineNumber > (Gbl_PreviousLineNumber + 1))
+ {
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u\n",
+ Gbl_CurrentLineNumber);
+ }
- PrSetLineNumber (Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber);
+ Gbl_PreviousLineNumber = Gbl_CurrentLineNumber;
Gbl_PreprocessorLineNumber++;
+
+ /*
+ * Now we can write the possibly modified source line to the
+ * preprocessor (.i) file
+ */
+ FlWriteFile (ASL_FILE_PREPROCESSOR, Gbl_CurrentLineBuffer,
+ strlen (Gbl_CurrentLineBuffer));
}
}
@@ -546,8 +545,9 @@ PrDoDirective (
if (*(&Gbl_CurrentLineBuffer[TokenOffset]) == '(')
{
#ifndef MACROS_SUPPORTED
- AcpiOsPrintf ("#define macros not supported\n");
- goto SyntaxError;
+ AcpiOsPrintf ("%s ERROR - line %u: #define macros are not supported yet\n",
+ Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber);
+ exit(1);
#else
PrAddMacro (Token, Next);
#endif
@@ -660,6 +660,31 @@ PrDoDirective (
PrOpenIncludeFile (Token);
break;
+ case PR_DIRECTIVE_LINE:
+ TokenOffset = Token - Gbl_MainTokenBuffer;
+
+ Status = PrResolveIntegerExpression (
+ &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
+ "User #line invocation %s\n", Gbl_CurrentLineNumber,
+ Token);
+
+ /* Update local line numbers */
+
+ Gbl_CurrentLineNumber = (UINT32) Value;
+ Gbl_PreviousLineNumber = 0;
+
+ /* Emit #line into the preprocessor file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename);
+ break;
+
case PR_DIRECTIVE_PRAGMA:
/* Only "#pragma message" supported at this time */
@@ -692,8 +717,6 @@ PrDoDirective (
THIS_TOKEN_OFFSET (Token));
break;
- case PR_DIRECTIVE_LINE:
- /* TBD: set line number -- or, do this in main compiler */
default:
/* Should never get here */
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c
index 70a2edc..a7c65bf 100644
--- a/source/compiler/prutils.c
+++ b/source/compiler/prutils.c
@@ -49,100 +49,6 @@
ACPI_MODULE_NAME ("prutils")
-/*******************************************************************************
- *
- * FUNCTION: PrSetLineNumber
- *
- * PARAMETERS: OriginalLineNumber - Line number in original source file,
- * or include file
- * PreprocessorLineNumber - Line number in the preprocessed file
- *
- * RETURN: None
- *
- * DESCRIPTION: Insert this mapping into the mapping data structure, for use
- * in possible error/warning messages.
- *
- * Line number mapping functions.
- * For error messages, we need to keep track of the line number in the
- * original file, versus the preprocessed (.i) file.
- *
- ******************************************************************************/
-
-void
-PrSetLineNumber (
- UINT32 OriginalLineNumber,
- UINT32 PreprocessorLineNumber)
-{
- UINT32 Entry;
- PR_LINE_MAPPING *Block;
- UINT32 Index;
- UINT32 i;
-
-
- Entry = PreprocessorLineNumber / PR_LINES_PER_BLOCK;
- Index = PreprocessorLineNumber % PR_LINES_PER_BLOCK;
- Block = Gbl_MapBlockHead;
-
- for (i = 0; i < Entry; i++)
- {
- /* Allocate new mapping blocks as necessary */
-
- if (!Block->Next)
- {
- Block->Next = UtLocalCalloc (sizeof (PR_LINE_MAPPING));
- Block->Next->Map = UtLocalCalloc (PR_LINES_PER_BLOCK * sizeof (UINT32));
- }
-
- Block = Block->Next;
- }
-
- Block->Map[Index] = OriginalLineNumber;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: PrGetLineNumber
- *
- * PARAMETERS: PreprocessorLineNumber - Line number in the preprocessed file
- * (or, the "logical line number)
- *
- * RETURN: The line number in the original source file or include file.
- *
- * DESCRIPTION: Return the mapped value of a line number in the preprocessed
- * source file to the actual line number in the original source
- * file.
- *
- ******************************************************************************/
-
-UINT32
-PrGetLineNumber (
- UINT32 PreprocessorLineNumber)
-{
- UINT32 Entry;
- PR_LINE_MAPPING *Block;
- UINT32 Index;
- UINT32 i;
-
-
- Entry = PreprocessorLineNumber / PR_LINES_PER_BLOCK;
- Index = PreprocessorLineNumber % PR_LINES_PER_BLOCK;
- Block = Gbl_MapBlockHead;
-
- for (i = 0; i < Entry; i++)
- {
- Block = Block->Next;
- if (!Block)
- {
- /* Bad error, should not happen */
- return (0);
- }
- }
-
- return (Block->Map[Index]);
-}
-
-
/******************************************************************************
*
* FUNCTION: PrGetNextToken
@@ -486,14 +392,20 @@ PrPushInputFileStack (
Gbl_InputFileList = Fnode;
DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
- "Push InputFile Stack, returning %p\n\n",
+ "Push InputFile Stack: handle %p\n\n",
Gbl_CurrentLineNumber, InputFile);
/* Reset the global line count and filename */
Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
- Gbl_CurrentLineNumber = 1;
+ Gbl_PreviousLineNumber = 0;
+ Gbl_CurrentLineNumber = 0;
+
+ /* Emit a new #line directive for the include file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ 1, Filename);
}
@@ -542,6 +454,12 @@ PrPopInputFileStack (
Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
Gbl_Files[ASL_FILE_INPUT].Handle = Fnode->File;
Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
+ Gbl_PreviousLineNumber = 0;
+
+ /* Emit a new #line directive after the include file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ Gbl_CurrentLineNumber + 1, Fnode->Filename);
/* All done with this node */
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c
index ba6181b..459cd91 100644
--- a/source/components/debugger/dbcmds.c
+++ b/source/components/debugger/dbcmds.c
@@ -373,25 +373,20 @@ AcpiDbSendNotify (
return;
}
- /* Decode Named object type */
+ /* Dispatch the notify if legal */
- switch (Node->Type)
+ if (AcpiEvIsNotifyObject (Node))
{
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
-
- /* Send the notify */
-
Status = AcpiEvQueueNotifyRequest (Node, Value);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not queue notify\n");
}
- break;
-
- default:
- AcpiOsPrintf ("Named object is not a device or a thermal object\n");
- break;
+ }
+ else
+ {
+ AcpiOsPrintf ("Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type));
}
}
diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c
index fa943e7..7facc8d 100644
--- a/source/components/debugger/dbdisply.c
+++ b/source/components/debugger/dbdisply.c
@@ -107,8 +107,8 @@ typedef struct acpi_handler_info
static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] =
{
- {&AcpiGbl_SystemNotify.Handler, "System Notifications"},
- {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
+ {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"},
+ {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"},
{&AcpiGbl_TableHandler, "ACPI Table Events"},
{&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
{&AcpiGbl_InterfaceHandler, "OSI Invocations"}
diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c
index 3794935..fcc4998 100644
--- a/source/components/debugger/dbstats.c
+++ b/source/components/debugger/dbstats.c
@@ -227,8 +227,8 @@ AcpiDbEnumerateObject (
case ACPI_TYPE_DEVICE:
- AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[1]);
AcpiDbEnumerateObject (ObjDesc->Device.Handler);
break;
@@ -248,21 +248,21 @@ AcpiDbEnumerateObject (
case ACPI_TYPE_POWER:
- AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[1]);
break;
case ACPI_TYPE_PROCESSOR:
- AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[1]);
AcpiDbEnumerateObject (ObjDesc->Processor.Handler);
break;
case ACPI_TYPE_THERMAL:
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[1]);
AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler);
break;
@@ -522,6 +522,18 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT));
+ AcpiOsPrintf ("\n");
+
+ AcpiOsPrintf ("Generic State %3d\n", sizeof (ACPI_GENERIC_STATE));
+ AcpiOsPrintf ("Common State %3d\n", sizeof (ACPI_COMMON_STATE));
+ AcpiOsPrintf ("Control State %3d\n", sizeof (ACPI_CONTROL_STATE));
+ AcpiOsPrintf ("Update State %3d\n", sizeof (ACPI_UPDATE_STATE));
+ AcpiOsPrintf ("Scope State %3d\n", sizeof (ACPI_SCOPE_STATE));
+ AcpiOsPrintf ("Parse Scope %3d\n", sizeof (ACPI_PSCOPE_STATE));
+ AcpiOsPrintf ("Package State %3d\n", sizeof (ACPI_PKG_STATE));
+ AcpiOsPrintf ("Thread State %3d\n", sizeof (ACPI_THREAD_STATE));
+ AcpiOsPrintf ("Result Values %3d\n", sizeof (ACPI_RESULT_VALUES));
+ AcpiOsPrintf ("Notify Info %3d\n", sizeof (ACPI_NOTIFY_INFO));
break;
diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c
index c44ff2e..cf29b22 100644
--- a/source/components/debugger/dbutils.c
+++ b/source/components/debugger/dbutils.c
@@ -190,10 +190,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length);
- for (i = 0; i < ObjDesc->String.Length; i++)
- {
- AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
- }
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
AcpiOsPrintf ("\n");
break;
diff --git a/source/components/events/evmisc.c b/source/components/events/evmisc.c
index 69a9087..68f751a 100644
--- a/source/components/events/evmisc.c
+++ b/source/components/events/evmisc.c
@@ -111,107 +111,82 @@ AcpiEvQueueNotifyRequest (
UINT32 NotifyValue)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *HandlerObj = NULL;
- ACPI_GENERIC_STATE *NotifyInfo;
+ ACPI_OPERAND_OBJECT *HandlerListHead = NULL;
+ ACPI_GENERIC_STATE *Info;
+ UINT8 HandlerListId = 0;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
- /*
- * For value 0x03 (Ejection Request), may need to run a device method.
- * For value 0x02 (Device Wake), if _PRW exists, may need to run
- * the _PS0 method.
- * For value 0x80 (Status Change) on the power button or sleep button,
- * initiate soft-off or sleep operation.
- *
- * For all cases, simply dispatch the notify to the handler.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
- AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type),
- NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node));
+ /* Are Notifies allowed on this object? */
- /* Get the notify object attached to the NS Node */
-
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (ObjDesc)
+ if (!AcpiEvIsNotifyObject (Node))
{
- /* We have the notify object, Get the correct handler */
-
- switch (Node->Type)
- {
- /* Notify is allowed only on these types */
+ return (AE_TYPE);
+ }
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
- case ACPI_TYPE_PROCESSOR:
+ /* Get the correct notify list type (System or Device) */
- if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
- {
- HandlerObj = ObjDesc->CommonNotify.SystemNotify;
- }
- else
- {
- HandlerObj = ObjDesc->CommonNotify.DeviceNotify;
- }
- break;
+ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
+ {
+ HandlerListId = ACPI_SYSTEM_HANDLER_LIST;
+ }
+ else
+ {
+ HandlerListId = ACPI_DEVICE_HANDLER_LIST;
+ }
- default:
+ /* Get the notify object attached to the namespace Node */
- /* All other types are not supported */
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ /* We have an attached object, Get the correct handler list */
- return (AE_TYPE);
- }
+ HandlerListHead = ObjDesc->CommonNotify.NotifyList[HandlerListId];
}
/*
- * If there is a handler to run, schedule the dispatcher.
- * Check for:
- * 1) Global system notify handler
- * 2) Global device notify handler
- * 3) Per-device notify handler
+ * If there is no notify handler (Global or Local)
+ * for this object, just ignore the notify
*/
- if ((AcpiGbl_SystemNotify.Handler &&
- (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
- (AcpiGbl_DeviceNotify.Handler &&
- (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
- HandlerObj)
+ if (!AcpiGbl_GlobalNotify[HandlerListId].Handler && !HandlerListHead)
{
- NotifyInfo = AcpiUtCreateGenericState ();
- if (!NotifyInfo)
- {
- return (AE_NO_MEMORY);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n",
+ AcpiUtGetNodeName (Node), NotifyValue, Node));
- if (!HandlerObj)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Executing system notify handler for Notify (%4.4s, %X) "
- "node %p\n",
- AcpiUtGetNodeName (Node), NotifyValue, Node));
- }
+ return (AE_OK);
+ }
- NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
- NotifyInfo->Notify.Node = Node;
- NotifyInfo->Notify.Value = (UINT16) NotifyValue;
- NotifyInfo->Notify.HandlerObj = HandlerObj;
+ /* Setup notify info and schedule the notify dispatcher */
- Status = AcpiOsExecute (
- OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtDeleteGenericState (NotifyInfo);
- }
- }
- else
+ Info = AcpiUtCreateGenericState ();
+ if (!Info)
{
- /* There is no notify handler (per-device or system) for this device */
+ return (AE_NO_MEMORY);
+ }
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "No notify handler for Notify (%4.4s, %X) node %p\n",
- AcpiUtGetNodeName (Node), NotifyValue, Node));
+ Info->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
+
+ Info->Notify.Node = Node;
+ Info->Notify.Value = (UINT16) NotifyValue;
+ Info->Notify.HandlerListId = HandlerListId;
+ Info->Notify.HandlerListHead = HandlerListHead;
+ Info->Notify.Global = &AcpiGbl_GlobalNotify[HandlerListId];
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type),
+ NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node));
+
+ Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch,
+ Info);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteGenericState (Info);
}
return (Status);
@@ -235,61 +210,37 @@ static void ACPI_SYSTEM_XFACE
AcpiEvNotifyDispatch (
void *Context)
{
- ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context;
- ACPI_NOTIFY_HANDLER GlobalHandler = NULL;
- void *GlobalContext = NULL;
+ ACPI_GENERIC_STATE *Info = (ACPI_GENERIC_STATE *) Context;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_FUNCTION_ENTRY ();
- /*
- * We will invoke a global notify handler if installed. This is done
- * _before_ we invoke the per-device handler attached to the device.
- */
- if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
- {
- /* Global system notification handler */
+ /* Invoke a global notify handler if installed */
- if (AcpiGbl_SystemNotify.Handler)
- {
- GlobalHandler = AcpiGbl_SystemNotify.Handler;
- GlobalContext = AcpiGbl_SystemNotify.Context;
- }
- }
- else
+ if (Info->Notify.Global->Handler)
{
- /* Global driver notification handler */
-
- if (AcpiGbl_DeviceNotify.Handler)
- {
- GlobalHandler = AcpiGbl_DeviceNotify.Handler;
- GlobalContext = AcpiGbl_DeviceNotify.Context;
- }
+ Info->Notify.Global->Handler (Info->Notify.Node,
+ Info->Notify.Value,
+ Info->Notify.Global->Context);
}
- /* Invoke the system handler first, if present */
+ /* Now invoke the local notify handler(s) if any are installed */
- if (GlobalHandler)
+ HandlerObj = Info->Notify.HandlerListHead;
+ while (HandlerObj)
{
- GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
- GlobalContext);
- }
-
- /* Now invoke the per-device handler, if present */
-
- HandlerObj = NotifyInfo->Notify.HandlerObj;
- if (HandlerObj)
- {
- HandlerObj->Notify.Handler (NotifyInfo->Notify.Node,
- NotifyInfo->Notify.Value,
+ HandlerObj->Notify.Handler (Info->Notify.Node,
+ Info->Notify.Value,
HandlerObj->Notify.Context);
+
+ HandlerObj = HandlerObj->Notify.Next[Info->Notify.HandlerListId];
}
/* All done with the info object */
- AcpiUtDeleteGenericState (NotifyInfo);
+ AcpiUtDeleteGenericState (Info);
}
diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c
index cc558f7..1b709a5 100644
--- a/source/components/events/evxface.c
+++ b/source/components/events/evxface.c
@@ -60,15 +60,21 @@
*
* PARAMETERS: Device - The device for which notifies will be handled
* HandlerType - The type of handler:
- * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
- * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
- * ACPI_ALL_NOTIFY: both system and device
+ * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
+ * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
+ * ACPI_ALL_NOTIFY: Both System and Device
* Handler - Address of the handler
* Context - Value passed to the handler on each GPE
*
* RETURN: Status
*
- * DESCRIPTION: Install a handler for notifies on an ACPI device
+ * DESCRIPTION: Install a handler for notifications on an ACPI Device,
+ * ThermalZone, or Processor object.
+ *
+ * NOTES: The Root namespace object may have only one handler for each
+ * type of notify (System/Device). Device/Thermal/Processor objects
+ * may have one device notify handler, and multiple system notify
+ * handlers.
*
******************************************************************************/
@@ -79,10 +85,11 @@ AcpiInstallNotifyHandler (
ACPI_NOTIFY_HANDLER Handler,
void *Context)
{
+ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device);
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *NotifyObj;
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_STATUS Status;
+ UINT32 i;
ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler);
@@ -90,8 +97,7 @@ AcpiInstallNotifyHandler (
/* Parameter validation */
- if ((!Device) ||
- (!Handler) ||
+ if ((!Device) || (!Handler) || (!HandlerType) ||
(HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -103,135 +109,124 @@ AcpiInstallNotifyHandler (
return_ACPI_STATUS (Status);
}
- /* Convert and validate the device handle */
-
- Node = AcpiNsValidateHandle (Device);
- if (!Node)
- {
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
- }
-
/*
* Root Object:
* Registering a notify handler on the root object indicates that the
* caller wishes to receive notifications for all objects. Note that
- * only one <external> global handler can be regsitered (per notify type).
+ * only one global handler can be registered per notify type.
+ * Ensure that a handler is not already installed.
*/
if (Device == ACPI_ROOT_OBJECT)
{
- /* Make sure the handler is not already installed */
-
- if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
- AcpiGbl_SystemNotify.Handler) ||
- ((HandlerType & ACPI_DEVICE_NOTIFY) &&
- AcpiGbl_DeviceNotify.Handler))
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
{
- Status = AE_ALREADY_EXISTS;
- goto UnlockAndExit;
- }
-
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- AcpiGbl_SystemNotify.Node = Node;
- AcpiGbl_SystemNotify.Handler = Handler;
- AcpiGbl_SystemNotify.Context = Context;
- }
-
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- AcpiGbl_DeviceNotify.Node = Node;
- AcpiGbl_DeviceNotify.Handler = Handler;
- AcpiGbl_DeviceNotify.Context = Context;
+ if (HandlerType & (i+1))
+ {
+ if (AcpiGbl_GlobalNotify[i].Handler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ AcpiGbl_GlobalNotify[i].Handler = Handler;
+ AcpiGbl_GlobalNotify[i].Context = Context;
+ }
}
- /* Global notify handler installed */
+ goto UnlockAndExit; /* Global notify handler installed, all done */
}
/*
* All Other Objects:
- * Caller will only receive notifications specific to the target object.
- * Note that only certain object types can receive notifications.
+ * Caller will only receive notifications specific to the target
+ * object. Note that only certain object types are allowed to
+ * receive notifications.
*/
- else
+
+ /* Are Notifies allowed on this object? */
+
+ if (!AcpiEvIsNotifyObject (Node))
{
- /* Notifies allowed on this object? */
+ Status = AE_TYPE;
+ goto UnlockAndExit;
+ }
+
+ /* Check for an existing internal object, might not exist */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* Create a new object */
- if (!AcpiEvIsNotifyObject (Node))
+ ObjDesc = AcpiUtCreateInternalObject (Node->Type);
+ if (!ObjDesc)
{
- Status = AE_TYPE;
+ Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
- /* Check for an existing internal object */
+ /* Attach new object to the Node, remove local reference */
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (ObjDesc)
+ Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
+ AcpiUtRemoveReference (ObjDesc);
+ if (ACPI_FAILURE (Status))
{
- /* Object exists - make sure there's no handler */
-
- if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
- ObjDesc->CommonNotify.SystemNotify) ||
- ((HandlerType & ACPI_DEVICE_NOTIFY) &&
- ObjDesc->CommonNotify.DeviceNotify))
- {
- Status = AE_ALREADY_EXISTS;
- goto UnlockAndExit;
- }
+ goto UnlockAndExit;
}
- else
- {
- /* Create a new object */
-
- ObjDesc = AcpiUtCreateInternalObject (Node->Type);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
-
- /* Attach new object to the Node */
-
- Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
+ }
- /* Remove local reference to the object */
+ /* Ensure that the handler is not already installed in the lists */
- AcpiUtRemoveReference (ObjDesc);
- if (ACPI_FAILURE (Status))
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
+ {
+ HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
+ while (HandlerObj)
{
- goto UnlockAndExit;
+ if (HandlerObj->Notify.Handler == Handler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ HandlerObj = HandlerObj->Notify.Next[i];
}
}
+ }
- /* Install the handler */
+ /* Create and populate a new notify handler object */
- NotifyObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);
- if (!NotifyObj)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
+ HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);
+ if (!HandlerObj)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
- NotifyObj->Notify.Node = Node;
- NotifyObj->Notify.Handler = Handler;
- NotifyObj->Notify.Context = Context;
+ HandlerObj->Notify.Node = Node;
+ HandlerObj->Notify.HandlerType = HandlerType;
+ HandlerObj->Notify.Handler = Handler;
+ HandlerObj->Notify.Context = Context;
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- ObjDesc->CommonNotify.SystemNotify = NotifyObj;
- }
+ /* Install the handler at the list head(s) */
- if (HandlerType & ACPI_DEVICE_NOTIFY)
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
{
- ObjDesc->CommonNotify.DeviceNotify = NotifyObj;
+ HandlerObj->Notify.Next[i] =
+ ObjDesc->CommonNotify.NotifyList[i];
+
+ ObjDesc->CommonNotify.NotifyList[i] = HandlerObj;
}
+ }
- if (HandlerType == ACPI_ALL_NOTIFY)
- {
- /* Extra ref if installed in both */
+ /* Add an extra reference if handler was installed in both lists */
- AcpiUtAddReference (NotifyObj);
- }
+ if (HandlerType == ACPI_ALL_NOTIFY)
+ {
+ AcpiUtAddReference (HandlerObj);
}
@@ -247,11 +242,11 @@ ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler)
*
* FUNCTION: AcpiRemoveNotifyHandler
*
- * PARAMETERS: Device - The device for which notifies will be handled
+ * PARAMETERS: Device - The device for which the handler is installed
* HandlerType - The type of handler:
- * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
- * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
- * ACPI_ALL_NOTIFY: both system and device
+ * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
+ * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
+ * ACPI_ALL_NOTIFY: Both System and Device
* Handler - Address of the handler
*
* RETURN: Status
@@ -266,10 +261,12 @@ AcpiRemoveNotifyHandler (
UINT32 HandlerType,
ACPI_NOTIFY_HANDLER Handler)
{
- ACPI_OPERAND_OBJECT *NotifyObj;
+ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device);
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_OPERAND_OBJECT *PreviousHandlerObj;
ACPI_STATUS Status;
+ UINT32 i;
ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler);
@@ -277,122 +274,105 @@ AcpiRemoveNotifyHandler (
/* Parameter validation */
- if ((!Device) ||
- (!Handler) ||
+ if ((!Device) || (!Handler) || (!HandlerType) ||
(HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+#ifdef _UNDER_DEVELOPMENT
+ /* Make sure all deferred tasks are completed */
+
+ AcpiOsWaitEventsComplete (NULL);
+#endif
+
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /* Convert and validate the device handle */
-
- Node = AcpiNsValidateHandle (Device);
- if (!Node)
- {
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
- }
-
- /* Root Object */
+ /* Root Object. Global handlers are removed here */
if (Device == ACPI_ROOT_OBJECT)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Removing notify handler for namespace root object\n"));
-
- if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
- !AcpiGbl_SystemNotify.Handler) ||
- ((HandlerType & ACPI_DEVICE_NOTIFY) &&
- !AcpiGbl_DeviceNotify.Handler))
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
{
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
- }
-
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- AcpiGbl_SystemNotify.Node = NULL;
- AcpiGbl_SystemNotify.Handler = NULL;
- AcpiGbl_SystemNotify.Context = NULL;
+ if (HandlerType & (i+1))
+ {
+ if (!AcpiGbl_GlobalNotify[i].Handler ||
+ (AcpiGbl_GlobalNotify[i].Handler != Handler))
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Removing global notify handler\n"));
+
+ AcpiGbl_GlobalNotify[i].Handler = NULL;
+ AcpiGbl_GlobalNotify[i].Context = NULL;
+ }
}
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- AcpiGbl_DeviceNotify.Node = NULL;
- AcpiGbl_DeviceNotify.Handler = NULL;
- AcpiGbl_DeviceNotify.Context = NULL;
- }
+ goto UnlockAndExit;
}
- /* All Other Objects */
+ /* All other objects: Are Notifies allowed on this object? */
- else
+ if (!AcpiEvIsNotifyObject (Node))
{
- /* Notifies allowed on this object? */
+ Status = AE_TYPE;
+ goto UnlockAndExit;
+ }
- if (!AcpiEvIsNotifyObject (Node))
- {
- Status = AE_TYPE;
- goto UnlockAndExit;
- }
+ /* Must have an existing internal object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
- /* Check for an existing internal object */
+ /* Internal object exists. Find the handler and remove it */
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (!ObjDesc)
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
{
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
- }
+ HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
+ PreviousHandlerObj = NULL;
- /* Object exists - make sure there's an existing handler */
+ /* Attempt to find the handler in the handler list */
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- NotifyObj = ObjDesc->CommonNotify.SystemNotify;
- if (!NotifyObj)
+ while (HandlerObj &&
+ (HandlerObj->Notify.Handler != Handler))
{
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
+ PreviousHandlerObj = HandlerObj;
+ HandlerObj = HandlerObj->Notify.Next[i];
}
- if (NotifyObj->Notify.Handler != Handler)
+ if (!HandlerObj)
{
- Status = AE_BAD_PARAMETER;
+ Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
- /* Remove the handler */
-
- ObjDesc->CommonNotify.SystemNotify = NULL;
- AcpiUtRemoveReference (NotifyObj);
- }
+ /* Remove the handler object from the list */
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
- if (!NotifyObj)
+ if (PreviousHandlerObj) /* Handler is not at the list head */
{
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
+ PreviousHandlerObj->Notify.Next[i] =
+ HandlerObj->Notify.Next[i];
}
-
- if (NotifyObj->Notify.Handler != Handler)
+ else /* Handler is at the list head */
{
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
+ ObjDesc->CommonNotify.NotifyList[i] =
+ HandlerObj->Notify.Next[i];
}
- /* Remove the handler */
-
- ObjDesc->CommonNotify.DeviceNotify = NULL;
- AcpiUtRemoveReference (NotifyObj);
+ AcpiUtRemoveReference (HandlerObj);
}
}
diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c
index 4b49cec..0943e66 100644
--- a/source/components/executer/exdump.c
+++ b/source/components/executer/exdump.c
@@ -131,8 +131,8 @@ static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"}
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"}
};
static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
@@ -179,8 +179,8 @@ static ACPI_EXDUMP_INFO AcpiExDumpPower[5] =
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"}
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"}
};
static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
@@ -189,16 +189,16 @@ static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
{ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[1]), "Device Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
};
static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]), "Device Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
};
@@ -258,11 +258,15 @@ static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
};
-static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
+static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[0]), "Next System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"}
};
@@ -1001,10 +1005,7 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[String] Value: ");
- for (i = 0; i < ObjDesc->String.Length; i++)
- {
- AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
- }
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
AcpiOsPrintf ("\n");
break;
diff --git a/source/components/hardware/hwesleep.c b/source/components/hardware/hwesleep.c
index ce7b792..1587af0 100644
--- a/source/components/hardware/hwesleep.c
+++ b/source/components/hardware/hwesleep.c
@@ -132,7 +132,7 @@ AcpiHwExtendedSleep (
/* Clear wake status (WAK_STS) */
- Status = AcpiWrite (ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
+ Status = AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -163,7 +163,7 @@ AcpiHwExtendedSleep (
SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
ACPI_X_SLEEP_TYPE_MASK);
- Status = AcpiWrite ((SleepTypeValue | ACPI_X_SLEEP_ENABLE),
+ Status = AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
&AcpiGbl_FADT.SleepControl);
if (ACPI_FAILURE (Status))
{
@@ -219,7 +219,7 @@ AcpiHwExtendedWakePrep (
SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
ACPI_X_SLEEP_TYPE_MASK);
- (void) AcpiWrite ((SleepTypeValue | ACPI_X_SLEEP_ENABLE),
+ (void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
&AcpiGbl_FADT.SleepControl);
}
@@ -269,7 +269,7 @@ AcpiHwExtendedWake (
* and use it to determine whether the system is rebooting or
* resuming. Clear WAK_STS for compatibility.
*/
- (void) AcpiWrite (ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
+ (void) AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
AcpiGbl_SystemAwakeAndRunning = TRUE;
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c
index 90baa15..fb32611 100644
--- a/source/components/utilities/utdelete.c
+++ b/source/components/utilities/utdelete.c
@@ -167,7 +167,7 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
- /* Walk the notify handler list for this object */
+ /* Walk the address handler list for this object */
HandlerDesc = Object->CommonNotify.Handler;
while (HandlerDesc)
@@ -523,6 +523,7 @@ AcpiUtUpdateObjectReference (
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *StateList = NULL;
ACPI_OPERAND_OBJECT *NextObject = NULL;
+ ACPI_OPERAND_OBJECT *PrevObject;
ACPI_GENERIC_STATE *State;
UINT32 i;
@@ -552,10 +553,20 @@ AcpiUtUpdateObjectReference (
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
- /* Update the notify objects for these types (if present) */
-
- AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
- AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
+ /*
+ * Update the notify objects for these types (if present)
+ * Two lists, system and device notify handlers.
+ */
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ PrevObject = Object->CommonNotify.NotifyList[i];
+ while (PrevObject)
+ {
+ NextObject = PrevObject->Notify.Next[i];
+ AcpiUtUpdateRefCount (PrevObject, Action);
+ PrevObject = NextObject;
+ }
+ }
break;
case ACPI_TYPE_PACKAGE:
diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c
index faccfb2..f913e32 100644
--- a/source/components/utilities/utglobal.c
+++ b/source/components/utilities/utglobal.c
@@ -287,8 +287,8 @@ AcpiUtInitGlobals (
/* Global handlers */
- AcpiGbl_SystemNotify.Handler = NULL;
- AcpiGbl_DeviceNotify.Handler = NULL;
+ AcpiGbl_GlobalNotify[0].Handler = NULL;
+ AcpiGbl_GlobalNotify[1].Handler = NULL;
AcpiGbl_ExceptionHandler = NULL;
AcpiGbl_InitHandler = NULL;
AcpiGbl_TableHandler = NULL;
diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c
index 106cc24..7d58f5c 100644
--- a/source/components/utilities/uttrack.c
+++ b/source/components/utilities/uttrack.c
@@ -633,21 +633,21 @@ AcpiUtDumpAllocations (
switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
{
case ACPI_DESC_TYPE_OPERAND:
- if (Element->Size == sizeof (ACPI_DESC_TYPE_OPERAND))
+ if (Element->Size == sizeof (ACPI_OPERAND_OBJECT))
{
DescriptorType = ACPI_DESC_TYPE_OPERAND;
}
break;
case ACPI_DESC_TYPE_PARSER:
- if (Element->Size == sizeof (ACPI_DESC_TYPE_PARSER))
+ if (Element->Size == sizeof (ACPI_PARSE_OBJECT))
{
DescriptorType = ACPI_DESC_TYPE_PARSER;
}
break;
case ACPI_DESC_TYPE_NAMED:
- if (Element->Size == sizeof (ACPI_DESC_TYPE_NAMED))
+ if (Element->Size == sizeof (ACPI_NAMESPACE_NODE))
{
DescriptorType = ACPI_DESC_TYPE_NAMED;
}
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index edf33d68..79e53d0 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -254,8 +254,7 @@ ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache;
/* Global handlers */
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify;
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify;
+ACPI_EXTERN ACPI_GLOBAL_NOTIFY_HANDLER AcpiGbl_GlobalNotify[2];
ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler;
ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler;
diff --git a/source/include/aclocal.h b/source/include/aclocal.h
index 30c648d..68ea95b 100644
--- a/source/include/aclocal.h
+++ b/source/include/aclocal.h
@@ -716,6 +716,15 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
struct acpi_walk_state *WalkState);
+/* Global handlers for AML Notifies */
+
+typedef struct acpi_global_notify_handler
+{
+ ACPI_NOTIFY_HANDLER Handler;
+ void *Context;
+
+} ACPI_GLOBAL_NOTIFY_HANDLER;
+
/*
* Notify info - used to pass info to the deferred notify
* handler/dispatcher.
@@ -723,8 +732,10 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
typedef struct acpi_notify_info
{
ACPI_STATE_COMMON
+ UINT8 HandlerListId;
ACPI_NAMESPACE_NODE *Node;
- union acpi_operand_object *HandlerObj;
+ union acpi_operand_object *HandlerListHead;
+ ACPI_GLOBAL_NOTIFY_HANDLER *Global;
} ACPI_NOTIFY_INFO;
diff --git a/source/include/acobject.h b/source/include/acobject.h
index 41a8e08..f2f8a1c 100644
--- a/source/include/acobject.h
+++ b/source/include/acobject.h
@@ -246,8 +246,7 @@ typedef struct acpi_object_method
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
- union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
- union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
+ union acpi_operand_object *NotifyList[2]; /* Handlers for system/device notifies */\
union acpi_operand_object *Handler; /* Handler for Address space */
@@ -389,8 +388,10 @@ typedef struct acpi_object_notify_handler
{
ACPI_OBJECT_COMMON_HEADER
ACPI_NAMESPACE_NODE *Node; /* Parent device */
- ACPI_NOTIFY_HANDLER Handler;
+ UINT32 HandlerType; /* Type: Device/System/Both */
+ ACPI_NOTIFY_HANDLER Handler; /* Handler addess */
void *Context;
+ union acpi_operand_object *Next[2]; /* Device and System handler lists */
} ACPI_OBJECT_NOTIFY_HANDLER;
diff --git a/source/include/acpixf.h b/source/include/acpixf.h
index e84d395..7478c78 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -48,7 +48,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20120320
+#define ACPI_CA_VERSION 0x20120420
#include "acconfig.h"
#include "actypes.h"
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 0125347..4a51885 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -708,10 +708,14 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_DEVICE_NOTIFY 0x2
#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
+#define ACPI_NUM_NOTIFY_TYPES 2
#define ACPI_MAX_SYS_NOTIFY 0x7F
#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
+#define ACPI_SYSTEM_HANDLER_LIST 0 /* Used as index, must be SYSTEM_NOTIFY -1 */
+#define ACPI_DEVICE_HANDLER_LIST 1 /* Used as index, must be DEVICE_NOTIFY -1 */
+
/* Address Space (Operation Region) Types */
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index f41dd53..84ed57e 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -49,12 +49,24 @@
/* Local prototypes */
static void
-AeNotifyHandler (
+AeNotifyHandler1 (
ACPI_HANDLE Device,
UINT32 Value,
void *Context);
static void
+AeNotifyHandler2 (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context);
+
+static void
+AeCommonNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ UINT32 HandlerId);
+
+static void
AeDeviceNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
@@ -186,24 +198,51 @@ AeCtrlCHandler (
/******************************************************************************
*
- * FUNCTION: AeNotifyHandler
+ * FUNCTION: AeNotifyHandler(s)
*
* PARAMETERS: Standard notify handler parameters
*
* RETURN: Status
*
- * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
+ * DESCRIPTION: Notify handlers for AcpiExec utility. Used by the ASL
* test suite(s) to communicate errors and other information to
- * this utility via the Notify() operator.
+ * this utility via the Notify() operator. Tests notify handling
+ * and multiple notify handler support.
*
*****************************************************************************/
static void
-AeNotifyHandler (
- ACPI_HANDLE Device,
- UINT32 Value,
- void *Context)
+AeNotifyHandler1 (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context)
+{
+ AeCommonNotifyHandler (Device, Value, 1);
+}
+
+static void
+AeNotifyHandler2 (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context)
{
+ AeCommonNotifyHandler (Device, Value, 2);
+}
+
+static void
+AeCommonNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ UINT32 HandlerId)
+{
+ char *Type;
+
+
+ Type = "Device";
+ if (Value <= ACPI_MAX_SYS_NOTIFY)
+ {
+ Type = "System";
+ }
switch (Value)
{
@@ -237,12 +276,13 @@ AeNotifyHandler (
#endif
default:
- printf ("[AcpiExec] Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
- AcpiUtGetNodeName (Device), Device, Value,
+ printf ("[AcpiExec] Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
+ HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
if (AcpiGbl_DebugFile)
{
- AcpiOsPrintf ("[AcpiExec] Received a system notify, Value 0x%2.2X\n", Value);
+ AcpiOsPrintf ("[AcpiExec] Handler %u: Received a %s notify, Value 0x%2.2X\n",
+ HandlerId, Type, Value);
}
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
@@ -253,6 +293,39 @@ AeNotifyHandler (
/******************************************************************************
*
+ * FUNCTION: AeSystemNotifyHandler
+ *
+ * PARAMETERS: Standard notify handler parameters
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
+ * test suite(s) to communicate errors and other information to
+ * this utility via the Notify() operator.
+ *
+ *****************************************************************************/
+
+static void
+AeSystemNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context)
+{
+
+ printf ("[AcpiExec] Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
+ AcpiUtGetNodeName (Device), Device, Value,
+ AcpiUtGetNotifyName (Value));
+ if (AcpiGbl_DebugFile)
+ {
+ AcpiOsPrintf ("[AcpiExec] Global: Received a System Notify, Value 0x%2.2X\n", Value);
+ }
+
+ (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AeDeviceNotifyHandler
*
* PARAMETERS: Standard notify handler parameters
@@ -272,12 +345,12 @@ AeDeviceNotifyHandler (
void *Context)
{
- printf ("[AcpiExec] Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
+ printf ("[AcpiExec] Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
if (AcpiGbl_DebugFile)
{
- AcpiOsPrintf ("[AcpiExec] Received a device notify, Value 0x%2.2X\n", Value);
+ AcpiOsPrintf ("[AcpiExec] Global: Received a Device Notify, Value 0x%2.2X\n", Value);
}
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
@@ -687,18 +760,18 @@ AeInstallEarlyHandlers (
AcpiFormatException (Status));
}
- /* Install global notify handler */
+ /* Install global notify handlers */
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
- AeNotifyHandler, NULL);
+ AeSystemNotifyHandler, NULL);
if (ACPI_FAILURE (Status))
{
- printf ("Could not install a global notify handler, %s\n",
+ printf ("Could not install a global system notify handler, %s\n",
AcpiFormatException (Status));
}
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_DEVICE_NOTIFY,
- AeDeviceNotifyHandler, NULL);
+ AeDeviceNotifyHandler, NULL);
if (ACPI_FAILURE (Status))
{
printf ("Could not install a global notify handler, %s\n",
@@ -709,7 +782,7 @@ AeInstallEarlyHandlers (
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
- AeNotifyHandler, NULL);
+ AeNotifyHandler1, NULL);
if (ACPI_FAILURE (Status))
{
printf ("Could not install a notify handler, %s\n",
@@ -717,7 +790,7 @@ AeInstallEarlyHandlers (
}
Status = AcpiRemoveNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
- AeNotifyHandler);
+ AeNotifyHandler1);
if (ACPI_FAILURE (Status))
{
printf ("Could not remove a notify handler, %s\n",
@@ -725,20 +798,35 @@ AeInstallEarlyHandlers (
}
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
- AeNotifyHandler, NULL);
+ AeNotifyHandler1, NULL);
AE_CHECK_OK (AcpiInstallNotifyHandler, Status);
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
- AeNotifyHandler);
+ AeNotifyHandler1);
AE_CHECK_OK (AcpiRemoveNotifyHandler, Status);
+#if 0
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
- AeNotifyHandler, NULL);
+ AeNotifyHandler1, NULL);
if (ACPI_FAILURE (Status))
{
printf ("Could not install a notify handler, %s\n",
AcpiFormatException (Status));
}
+#endif
+
+ /* Install two handlers for _SB_ */
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+
+ /* Attempt duplicate handler installation, should fail */
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x77777777));
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
AE_CHECK_OK (AcpiAttachData, Status);
@@ -755,6 +843,37 @@ AeInstallEarlyHandlers (
}
+ Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+
+ Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1);
+ Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler2);
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+ }
+
+ Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+ }
+
/*
* Install handlers that will override the default handlers for some of
* the space IDs.
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 52218be..1f93e33 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -229,6 +229,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_GENERIC_ADDRESS", SRC_TYPE_STRUCT},
{"ACPI_GENERIC_STATE", SRC_TYPE_UNION},
{"ACPI_GET_DEVICES_INFO", SRC_TYPE_STRUCT},
+ {"ACPI_GLOBAL_NOTIFY_HANDLER", SRC_TYPE_STRUCT},
{"ACPI_GPE_BLOCK_INFO", SRC_TYPE_STRUCT},
{"ACPI_GPE_CALLBACK", SRC_TYPE_SIMPLE},
{"ACPI_GPE_DEVICE_INFO", SRC_TYPE_STRUCT},
diff --git a/tests/misc/grammar.asl b/tests/misc/grammar.asl
index 9d1a312..6300e26 100644
--- a/tests/misc/grammar.asl
+++ b/tests/misc/grammar.asl
@@ -9322,6 +9322,7 @@ DefinitionBlock (
{
Store (SMIX, Local0)
+ Notify (\_SB_, 0x29)
If (And (Local0, 0x01))
{ Notify (\_SB_.SMIS, 0x21)}
@@ -9336,6 +9337,17 @@ DefinitionBlock (
} // End Method EVNT
+ Method (NTFY)
+ {
+ Notify (\_SB_, 1)
+ Notify (\_TZ_.TZ1, 2)
+ Notify (\_PR_.CPU0, 3)
+
+ Notify (\_SB_, 0x81)
+ Notify (\_TZ_.TZ1, 0x82)
+ Notify (\_PR_.CPU0, 0x83)
+ }
+
Device (SMIS)
{
Method (BINK)
@@ -9375,6 +9387,7 @@ DefinitionBlock (
// Expect EVNT to generate Notify value we just previously
// stored in BYTE
+
Store (0x20, BYTE)
EVNT ()
Store (0x21, BYTE)
@@ -9384,6 +9397,7 @@ DefinitionBlock (
Store (0x23, BYTE)
EVNT ()
+ NTFY ()
Return (0) // pass
} // End Method TEST
} // Device SMIS
OpenPOWER on IntegriCloud