Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 8... Line 8...
8
/******************************************************************************
8
/******************************************************************************
9
 *
9
 *
10
 * 1. Copyright Notice
10
 * 1. Copyright Notice
11
 *
11
 *
12
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
13
 * All rights reserved.
13
 * All rights reserved.
14
 *
14
 *
15
 * 2. License
15
 * 2. License
16
 *
16
 *
17
 * 2.1. This is your license from Intel Corp. under its intellectual property
17
 * 2.1. This is your license from Intel Corp. under its intellectual property
Line 113... Line 113...
113
 * such license, approval or letter.
113
 * such license, approval or letter.
114
 *
114
 *
115
 *****************************************************************************/
115
 *****************************************************************************/
116
 
116
 
Line 117... Line -...
117
#define YYDEBUG 1
-
 
118
#define YYERROR_VERBOSE 1
-
 
119
 
-
 
120
/*
-
 
121
 * State stack - compiler will fault if it overflows.   (Default was 200)
-
 
122
 */
-
 
123
#define YYINITDEPTH 600
-
 
124
 
-
 
125
#include "aslcompiler.h"
117
#include "aslcompiler.h"
126
#include 
118
#include 
127
#include 
119
#include 
128
#include 
120
#include 
129
#include "acpi.h"
121
#include "acpi.h"
Line 144... Line 136...
144
 *      ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
136
 *      ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
145
 *      ResourceMacroList, and FieldUnitList
137
 *      ResourceMacroList, and FieldUnitList
146
 */
138
 */
147
 
139
 
Line -... Line 140...
-
 
140
void *                      AslLocalAllocate (unsigned int Size);
-
 
141
 
-
 
142
/* Bison/yacc configuration */
Line 148... Line -...
148
 
-
 
149
/*
-
 
150
 * Next statement is important - this makes everything public so that
-
 
151
 * we can access some of the parser tables from other modules
-
 
152
 */
143
 
153
#define static
144
#define static
154
#undef alloca
145
#undef alloca
155
#define alloca      AslLocalAllocate
146
#define alloca              AslLocalAllocate
Line 156... Line -...
156
#define YYERROR_VERBOSE     1
-
 
157
 
147
#define yytname             AslCompilername
-
 
148
 
-
 
149
#define YYINITDEPTH         600             /* State stack depth */
Line 158... Line 150...
158
void *
150
#define YYDEBUG             1               /* Enable debug output */
159
AslLocalAllocate (unsigned int Size);
151
#define YYERROR_VERBOSE     1               /* Verbose error messages */
160
 
152
 
161
/*
153
/*
162
 * The windows version of bison defines this incorrectly as "32768" (Not negative).
154
 * The windows version of bison defines this incorrectly as "32768" (Not negative).
163
 * Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
155
 * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
164
 * instead (#define YYFBAD      32768), so we can define it correctly here.
156
 * instead (#define YYFBAD 32768), so we can define it correctly here.
165
 *
157
 *
166
 * The problem is that if YYFLAG is positive, the extended syntax error messages
-
 
167
 * are disabled.
158
 * The problem is that if YYFLAG is positive, the extended syntax error messages
Line 168... Line -...
168
 */
-
 
169
 
159
 * are disabled.
Line 170... Line -...
170
#define YYFLAG              -32768
-
 
171
 
160
 */
172
 
161
#define YYFLAG              -32768
173
%}
162
 
174
 
-
 
175
 
163
%}
176
/*
164
 
177
 * Declare the type of values in the grammar
165
/*
178
 */
166
 * Declare the type of values in the grammar
179
 
167
 */
Line 180... Line -...
180
%union {
-
 
181
    UINT64              i;
168
%union {
Line 182... Line 169...
182
    char                *s;
169
    UINT64              i;
183
    ACPI_PARSE_OBJECT   *n;
170
    char                *s;
184
}
171
    ACPI_PARSE_OBJECT   *n;
185
 
172
}
186
 
173
 
Line 187... Line -...
187
/*! [Begin] no source code translation */
-
 
188
 
174
/*! [Begin] no source code translation */
189
/*
175
 
190
 * These shift/reduce conflicts are expected. There should be zero
176
/*
191
 * reduce/reduce conflicts.
177
 * These shift/reduce conflicts are expected. There should be zero
192
 */
178
 * reduce/reduce conflicts.
193
%expect 60
179
 */
194
 
-
 
195
 
180
%expect 60
196
/*
181
 
197
 * Token types: These are returned by the lexer
182
/*
198
 *
183
 * Token types: These are returned by the lexer
199
 * NOTE: This list MUST match the AslKeywordMapping table found
184
 *
Line 462... Line 447...
462
%token  PARSEOP_XFERTYPE_16
447
%token  PARSEOP_XFERTYPE_16
463
%token  PARSEOP_XOR
448
%token  PARSEOP_XOR
464
%token  PARSEOP_ZERO
449
%token  PARSEOP_ZERO
465
 
450
 
Line -... Line 451...
-
 
451
/*
-
 
452
 * Special functions. These should probably stay at the end of this
-
 
453
 * table.
-
 
454
 */
-
 
455
%token  PARSEOP___DATE__
-
 
456
%token  PARSEOP___FILE__
-
 
457
%token  PARSEOP___LINE__
Line 466... Line 458...
466
 
458
 
467
/*
459
/*
468
 * Production names
460
 * Production names
Line 765... Line 757...
765
%type  OptionalParameterTypesPackage
757
%type  OptionalParameterTypesPackage
766
%type  OptionalReference
758
%type  OptionalReference
767
%type  OptionalAccessSize
759
%type  OptionalAccessSize
768
 
760
 
Line 769... Line -...
769
 
-
 
770
%type  TermArgItem
761
%type  TermArgItem
771
%type  NameStringItem
762
%type  NameStringItem
Line 772... Line 763...
772
 
763
 
Line 792... Line 783...
792
    : DefinitionBlockTerm
783
    : DefinitionBlockTerm
793
    | error                         {YYABORT; $$ = NULL;}
784
    | error                         {YYABORT; $$ = NULL;}
794
    ;
785
    ;
795
 
786
 
Line -... Line 787...
-
 
787
/*
-
 
788
 * Note concerning support for "module-level code".
-
 
789
 *
-
 
790
 * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
-
 
791
 * methods (the so-called module-level code.) This support was explicitly
-
 
792
 * removed in ACPI 2.0, but this type of code continues to be created by
-
 
793
 * BIOS vendors. In order to support the disassembly and recompilation of
-
 
794
 * such code (and the porting of ASL code to iASL), iASL supports this
-
 
795
 * code in violation of the current ACPI specification.
-
 
796
 *
-
 
797
 * The grammar change to support module-level code is to revert the
-
 
798
 * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
-
 
799
 * original use of {TermList} instead (see below.) This allows the use
-
 
800
 * of Type1 and Type2 opcodes at module level.
-
 
801
 */
796
DefinitionBlockTerm
802
DefinitionBlockTerm
797
    : PARSEOP_DEFINITIONBLOCK '('	{$$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
803
    : PARSEOP_DEFINITIONBLOCK '('	{$$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
798
        String ','
804
        String ','
799
        String ','
805
        String ','
800
        ByteConst ','
806
        ByteConst ','
Line 1533... Line 1539...
1533
ReturnTerm
1539
ReturnTerm
1534
    : PARSEOP_RETURN '('			{$$ = TrCreateLeafNode (PARSEOP_RETURN);}
1540
    : PARSEOP_RETURN '('			{$$ = TrCreateLeafNode (PARSEOP_RETURN);}
1535
        OptionalReturnArg
1541
        OptionalReturnArg
1536
        ')'                         {$$ = TrLinkChildren ($3,1,$4);}
1542
        ')'                         {$$ = TrLinkChildren ($3,1,$4);}
1537
    | PARSEOP_RETURN 				{$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));}
1543
    | PARSEOP_RETURN 				{$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
1538
    | PARSEOP_RETURN '('
1544
    | PARSEOP_RETURN '('
1539
        error ')'                   {$$ = AslDoError(); yyclearin;}
1545
        error ')'                   {$$ = AslDoError(); yyclearin;}
1540
    ;
1546
    ;
Line 1541... Line 1547...
1541
 
1547
 
Line 2387... Line 2393...
2387
ConstExprTerm
2393
ConstExprTerm
2388
    : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
2394
    : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
2389
    | PARSEOP_ONE                   {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
2395
    | PARSEOP_ONE                   {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
2390
    | PARSEOP_ONES                  {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
2396
    | PARSEOP_ONES                  {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
-
 
2397
    | PARSEOP___DATE__              {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
-
 
2398
    | PARSEOP___FILE__              {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
-
 
2399
    | PARSEOP___LINE__              {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
2391
    ;
2400
    ;
Line 2392... Line 2401...
2392
 
2401
 
Line 2393... Line 2402...
2393
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
2402
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
Line 3107... Line 3116...
3107
    | TermArg                       {$$ = $1;}
3116
    | TermArg                       {$$ = $1;}
3108
    ;
3117
    ;
3109
 
3118
 
Line 3110... Line 3119...
3110
OptionalReturnArg
3119
OptionalReturnArg
3111
    :                               {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
3120
    :                               {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);}       /* Placeholder is a ZeroOp object */
3112
    | TermArg                       {$$ = $1;}
3121
    | TermArg                       {$$ = $1;}
3113
    ;
3122
    ;
Line 3114... Line 3123...
3114
 
3123
 
3115
OptionalType
3124
OptionalType
Line 3140... Line 3149...
3140
    : ',' NameString                {$$ = $2;}
3149
    : ',' NameString                {$$ = $2;}
3141
    | ',' error                     {$$ = AslDoError (); yyclearin;}
3150
    | ',' error                     {$$ = AslDoError (); yyclearin;}
3142
    ;
3151
    ;
3143
 
3152
 
Line 3144... Line -...
3144
 
-
 
3145
%%
3153
%%
Line 3146... Line 3154...
3146
 
3154
 
3147
 
3155
 
Line 3185... Line 3193...
3185
 
3193
 
Line 3186... Line 3194...
3186
    return (TrCreateLeafNode (PARSEOP_ERRORNODE));
3194
    return (TrCreateLeafNode (PARSEOP_ERRORNODE));
-
 
3195
 
-
 
3196
}
-
 
3197
 
-
 
3198
 
-
 
3199
/*******************************************************************************
-
 
3200
 *
-
 
3201
 * FUNCTION:    UtGetOpName
-
 
3202
 *
-
 
3203
 * PARAMETERS:  ParseOpcode         - Parser keyword ID
-
 
3204
 *
-
 
3205
 * RETURN:      Pointer to the opcode name
-
 
3206
 *
-
 
3207
 * DESCRIPTION: Get the ascii name of the parse opcode
-
 
3208
 *
-
 
3209
 ******************************************************************************/
-
 
3210
 
-
 
3211
char *
-
 
3212
UtGetOpName (
-
 
3213
    UINT32                  ParseOpcode)
-
 
3214
{
-
 
3215
#ifdef ASL_YYTNAME_START
-
 
3216
    /*
-
 
3217
     * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
-
 
3218
     * Ignore first 8 characters of the name
-
 
3219
     */
-
 
3220
    return ((char *) yytname
-
 
3221
        [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
-
 
3222
#else
-
 
3223
    return ("[Unknown parser generator]");