svn commit: r220681 - head/sys/contrib/dev/acpica/compiler

Jung-uk Kim jkim at FreeBSD.org
Fri Apr 15 21:38:24 UTC 2011


Author: jkim
Date: Fri Apr 15 21:38:24 2011
New Revision: 220681
URL: http://svn.freebsd.org/changeset/base/220681

Log:
  Re-merge with ACPICA vendor source.

Modified:
  head/sys/contrib/dev/acpica/compiler/aslcompiler.y
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/dtparser.y
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.y
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompiler.y	Fri Apr 15 21:33:45 2011	(r220680)
+++ head/sys/contrib/dev/acpica/compiler/aslcompiler.y	Fri Apr 15 21:38:24 2011	(r220681)
@@ -43,14 +43,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#define YYDEBUG 1
-#define YYERROR_VERBOSE 1
-
-/*
- * State stack - compiler will fault if it overflows.   (Default was 200)
- */
-#define YYINITDEPTH 600
-
 #include <contrib/dev/acpica/compiler/aslcompiler.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -74,45 +66,40 @@
  *      ResourceMacroList, and FieldUnitList
  */
 
+void *                      AslLocalAllocate (unsigned int Size);
+
+/* Bison/yacc configuration */
 
-/*
- * Next statement is important - this makes everything public so that
- * we can access some of the parser tables from other modules
- */
 #define static
 #undef alloca
-#define alloca      AslLocalAllocate
-#define YYERROR_VERBOSE     1
+#define alloca              AslLocalAllocate
+#define yytname             AslCompilername
 
-void *
-AslLocalAllocate (unsigned int Size);
+#define YYINITDEPTH         600             /* State stack depth */
+#define YYDEBUG             1               /* Enable debug output */
+#define YYERROR_VERBOSE     1               /* Verbose error messages */
 
 /*
  * The windows version of bison defines this incorrectly as "32768" (Not negative).
- * Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
- * instead (#define YYFBAD      32768), so we can define it correctly here.
+ * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
+ * instead (#define YYFBAD 32768), so we can define it correctly here.
  *
  * The problem is that if YYFLAG is positive, the extended syntax error messages
  * are disabled.
  */
-
 #define YYFLAG              -32768
 
-
 %}
 
-
 /*
  * Declare the type of values in the grammar
  */
-
 %union {
     UINT64              i;
     char                *s;
     ACPI_PARSE_OBJECT   *n;
 }
 
-
 /*! [Begin] no source code translation */
 
 /*
@@ -121,14 +108,12 @@ AslLocalAllocate (unsigned int Size);
  */
 %expect 60
 
-
 /*
  * Token types: These are returned by the lexer
  *
  * NOTE: This list MUST match the AslKeywordMapping table found
  *       in aslmap.c EXACTLY!  Double check any changes!
  */
-
 %token <i> PARSEOP_ACCESSAS
 %token <i> PARSEOP_ACCESSATTRIB_BLOCK
 %token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
@@ -3138,3 +3123,32 @@ AslDoError (void)
     return (TrCreateLeafNode (PARSEOP_ERRORNODE));
 
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    UtGetOpName
+ *
+ * PARAMETERS:  ParseOpcode         - Parser keyword ID
+ *
+ * RETURN:      Pointer to the opcode name
+ *
+ * DESCRIPTION: Get the ascii name of the parse opcode
+ *
+ ******************************************************************************/
+
+char *
+UtGetOpName (
+    UINT32                  ParseOpcode)
+{
+#ifdef ASL_YYTNAME_START
+    /*
+     * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
+     * Ignore first 8 characters of the name
+     */
+    return ((char *) yytname
+        [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
+#else
+    return ("[Unknown parser generator]");
+#endif
+}

Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asldefine.h	Fri Apr 15 21:33:45 2011	(r220680)
+++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Fri Apr 15 21:38:24 2011	(r220681)
@@ -66,12 +66,23 @@
 #define ASL_STRING_CACHE_SIZE       32768
 
 #define ASL_FIRST_PARSE_OPCODE      PARSEOP_ACCESSAS
-#define ASL_YYTNAME_START           3
-
 #define ASL_PARSE_OPCODE_BASE       PARSEOP_ACCESSAS        /* First Lex type */
 
 
 /*
+ * Per-parser-generator configuration. These values are used to cheat and
+ * directly access the bison/yacc token name table (yyname or yytname).
+ * Note: These values are the index in yyname for the first lex token
+ * (PARSEOP_ACCCESSAS).
+ */
+#if defined (YYBISON)
+#define ASL_YYTNAME_START           3   /* Bison */
+#elif defined (YYBYACC)
+#define ASL_YYTNAME_START           257 /* Berkeley yacc */
+#endif
+
+
+/*
  * Macros
  */
 #define ASL_RESDESC_OFFSET(m)       ACPI_OFFSET (AML_RESOURCE, m)
@@ -97,6 +108,7 @@
 
 /* filename suffixes for output files */
 
+#define FILE_SUFFIX_PREPROCESSOR    "i"
 #define FILE_SUFFIX_AML_CODE        "aml"
 #define FILE_SUFFIX_LISTING         "lst"
 #define FILE_SUFFIX_HEX_DUMP        "hex"

Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslutils.c	Fri Apr 15 21:33:45 2011	(r220680)
+++ head/sys/contrib/dev/acpica/compiler/aslutils.c	Fri Apr 15 21:38:24 2011	(r220681)
@@ -53,13 +53,6 @@
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("aslutils")
 
-#ifdef _USE_BERKELEY_YACC
-extern const char * const       AslCompilername[];
-static const char * const       *yytname = &AslCompilername[254];
-#else
-extern const char * const       yytname[];
-#endif
-
 char                        AslHexLookup[] =
 {
     '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
@@ -444,32 +437,6 @@ UtSetParseOpName (
 
 /*******************************************************************************
  *
- * FUNCTION:    UtGetOpName
- *
- * PARAMETERS:  ParseOpcode         - Parser keyword ID
- *
- * RETURN:      Pointer to the opcode name
- *
- * DESCRIPTION: Get the ascii name of the parse opcode
- *
- ******************************************************************************/
-
-char *
-UtGetOpName (
-    UINT32                  ParseOpcode)
-{
-
-    /*
-     * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
-     * Ignore first 8 characters of the name
-     */
-    return ((char *) yytname
-        [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
-}
-
-
-/*******************************************************************************
- *
  * FUNCTION:    UtDisplaySummary
  *
  * PARAMETERS:  FileID          - ID of outpout file

Modified: head/sys/contrib/dev/acpica/compiler/dtparser.y
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/dtparser.y	Fri Apr 15 21:33:45 2011	(r220680)
+++ head/sys/contrib/dev/acpica/compiler/dtparser.y	Fri Apr 15 21:38:24 2011	(r220681)
@@ -42,22 +42,26 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#define YYDEBUG 1
-#define YYERROR_VERBOSE 1
-
 #include <contrib/dev/acpica/compiler/aslcompiler.h>
 #include <contrib/dev/acpica/compiler/dtcompiler.h>
 
-#define _COMPONENT          ACPI_COMPILER
+#define _COMPONENT          DT_COMPILER
         ACPI_MODULE_NAME    ("dtparser")
 
-UINT64                  DtParserResult;    /* Global for expression return value */
-
-int DtParserlex (void);
-int DtParserparse (void);
-extern char*            DtParsertext;
-extern void             DtParsererror (char const * msg);
-#define YYFLAG          -32768
+int                         DtParserlex (void);
+int                         DtParserparse (void);
+void                        DtParsererror (char const *msg);
+extern char                 *DtParsertext;
+extern DT_FIELD             *Gbl_CurrentField;
+
+UINT64                      DtParserResult; /* Expression return value */
+
+/* Bison/yacc configuration */
+
+#define yytname             DtParsername
+#define YYDEBUG             1               /* Enable debug output */
+#define YYERROR_VERBOSE     1               /* Verbose error messages */
+#define YYFLAG              -32768
 
 %}
 
@@ -67,6 +71,8 @@ extern void             DtParsererror (c
      UINT32                 op;
 }
 
+/*! [Begin] no source code translation */
+
 %type  <value>  Expression
 
 %token <op>     EXPOP_EOF
@@ -164,17 +170,14 @@ Expression
     ;
 %%
 
+/*! [End] no source code translation !*/
+
 /*
  * Local support functions, including parser entry point
  */
-extern DT_FIELD                 *Gbl_CurrentField;
 #define PR_FIRST_PARSE_OPCODE   EXPOP_EOF
 #define PR_YYTNAME_START        3
 
-#ifdef _USE_BERKELEY_YACC
-#define yytname DtParsername
-#endif
-
 
 /******************************************************************************
  *
@@ -213,13 +216,16 @@ char *
 DtGetOpName (
     UINT32                  ParseOpcode)
 {
-
+#ifdef ASL_YYTNAME_START
     /*
      * First entries (PR_YYTNAME_START) in yytname are special reserved names.
      * Ignore first 6 characters of name (EXPOP_)
      */
     return ((char *) yytname
         [(ParseOpcode - PR_FIRST_PARSE_OPCODE) + PR_YYTNAME_START] + 6);
+#else
+    return ("[Unknown parser generator]");
+#endif
 }
 
 


More information about the svn-src-all mailing list