xref: /netbsd-src/sys/external/bsd/acpica/dist/compiler/aslhelpers.y (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 NoEcho('
2 /******************************************************************************
3  *
4  * Module Name: aslhelpers.y - helper and option terms
5  *
6  *****************************************************************************/
7 
8 /*
9  * Copyright (C) 2000 - 2018, Intel Corp.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions, and the following disclaimer,
17  *    without modification.
18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19  *    substantially similar to the "NO WARRANTY" disclaimer below
20  *    ("Disclaimer") and any redistribution must be conditioned upon
21  *    including a substantially similar Disclaimer requirement for further
22  *    binary redistribution.
23  * 3. Neither the names of the above-listed copyright holders nor the names
24  *    of any contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * Alternatively, this software may be distributed under the terms of the
28  * GNU General Public License ("GPL") version 2 as published by the Free
29  * Software Foundation.
30  *
31  * NO WARRANTY
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42  * POSSIBILITY OF SUCH DAMAGES.
43  */
44 
45 ')
46 
47 
48 /*******************************************************************************
49  *
50  * ASL Helper Terms
51  *
52  ******************************************************************************/
53 
54 OptionalBusMasterKeyword
55     : ','                                   {$$ = TrCreateLeafOp (
56                                                 PARSEOP_BUSMASTERTYPE_MASTER);}
57     | ',' PARSEOP_BUSMASTERTYPE_MASTER      {$$ = TrCreateLeafOp (
58                                                 PARSEOP_BUSMASTERTYPE_MASTER);}
59     | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER   {$$ = TrCreateLeafOp (
60                                                 PARSEOP_BUSMASTERTYPE_NOTMASTER);}
61     ;
62 
63 OptionalAccessAttribTerm
64     :                               {$$ = NULL;}
65     | ','                           {$$ = NULL;}
66     | ',' ByteConstExpr             {$$ = $2;}
67     | ',' AccessAttribKeyword       {$$ = $2;}
68     ;
69 
70 OptionalAccessSize
71     :                               {$$ = TrCreateValuedLeafOp (
72                                         PARSEOP_BYTECONST, 0);}
73     | ','                           {$$ = TrCreateValuedLeafOp (
74                                         PARSEOP_BYTECONST, 0);}
75     | ',' ByteConstExpr             {$$ = $2;}
76     ;
77 
78 OptionalAddressingMode
79     : ','                           {$$ = NULL;}
80     | ',' AddressingModeKeyword     {$$ = $2;}
81     ;
82 
83 OptionalAddressRange
84     :                               {$$ = NULL;}
85     | ','                           {$$ = NULL;}
86     | ',' AddressKeyword            {$$ = $2;}
87     ;
88 
89 OptionalBitsPerByte
90     : ','                           {$$ = NULL;}
91     | ',' BitsPerByteKeyword        {$$ = $2;}
92     ;
93 
94 OptionalBuffer_Last
95     :                               {$$ = NULL;}
96     | ','                           {$$ = NULL;}
97     | ',' RawDataBufferTerm         {$$ = $2;}
98     ;
99 
100 OptionalByteConstExpr
101     :                               {$$ = NULL;}
102     | ','                           {$$ = NULL;}
103     | ',' ByteConstExpr             {$$ = $2;}
104     ;
105 
106 OptionalDecodeType
107     : ','                           {$$ = NULL;}
108     | ',' DecodeKeyword             {$$ = $2;}
109     ;
110 
111 OptionalDevicePolarity
112     : ','                           {$$ = NULL;}
113     | ',' DevicePolarityKeyword     {$$ = $2;}
114     ;
115 
116 OptionalDWordConstExpr
117     :                               {$$ = NULL;}
118     | ','                           {$$ = NULL;}
119     | ',' DWordConstExpr            {$$ = $2;}
120     ;
121 
122 OptionalEndian
123     : ','                           {$$ = NULL;}
124     | ',' EndianKeyword             {$$ = $2;}
125     ;
126 
127 OptionalFlowControl
128     : ','                           {$$ = NULL;}
129     | ',' FlowControlKeyword        {$$ = $2;}
130     ;
131 
132 OptionalIoRestriction
133     : ','                           {$$ = NULL;}
134     | ',' IoRestrictionKeyword      {$$ = $2;}
135     ;
136 
137 OptionalListString
138     :                               {$$ = TrCreateValuedLeafOp (
139                                         PARSEOP_STRING_LITERAL,
140                                         ACPI_TO_INTEGER (""));}   /* Placeholder is a NULL string */
141     | ','                           {$$ = TrCreateValuedLeafOp (
142                                         PARSEOP_STRING_LITERAL,
143                                         ACPI_TO_INTEGER (""));}   /* Placeholder is a NULL string */
144     | ',' TermArg                   {$$ = $2;}
145     ;
146 
147 OptionalMaxType
148     : ','                           {$$ = NULL;}
149     | ',' MaxKeyword                {$$ = $2;}
150     ;
151 
152 OptionalMemType
153     : ','                           {$$ = NULL;}
154     | ',' MemTypeKeyword            {$$ = $2;}
155     ;
156 
157 OptionalMinType
158     : ','                           {$$ = NULL;}
159     | ',' MinKeyword                {$$ = $2;}
160     ;
161 
162 OptionalNameString
163     :                               {$$ = NULL;}
164     | ','                           {$$ = NULL;}
165     | ',' NameString                {$$ = $2;}
166     ;
167 
168 OptionalNameString_Last
169     :                               {$$ = NULL;}
170     | ','                           {$$ = NULL;}
171     | ',' NameString                {$$ = $2;}
172     ;
173 
174 OptionalNameString_First
175     :                               {$$ = TrCreateLeafOp (
176                                         PARSEOP_ZERO);}
177     | NameString                    {$$ = $1;}
178     ;
179 
180 OptionalObjectTypeKeyword
181     :                               {$$ = TrCreateLeafOp (
182                                         PARSEOP_OBJECTTYPE_UNK);}
183     | ',' ObjectTypeKeyword         {$$ = $2;}
184     ;
185 
186 OptionalParityType
187     : ','                           {$$ = NULL;}
188     | ',' ParityTypeKeyword         {$$ = $2;}
189     ;
190 
191 OptionalQWordConstExpr
192     :                               {$$ = NULL;}
193     | ','                           {$$ = NULL;}
194     | ',' QWordConstExpr            {$$ = $2;}
195     ;
196 
197 OptionalRangeType
198     : ','                           {$$ = NULL;}
199     | ',' RangeTypeKeyword          {$$ = $2;}
200     ;
201 
202 OptionalReadWriteKeyword
203     :                                   {$$ = TrCreateLeafOp (
204                                             PARSEOP_READWRITETYPE_BOTH);}
205     | PARSEOP_READWRITETYPE_BOTH        {$$ = TrCreateLeafOp (
206                                             PARSEOP_READWRITETYPE_BOTH);}
207     | PARSEOP_READWRITETYPE_READONLY    {$$ = TrCreateLeafOp (
208                                             PARSEOP_READWRITETYPE_READONLY);}
209     ;
210 
211 OptionalResourceType_First
212     :                               {$$ = TrCreateLeafOp (
213                                         PARSEOP_RESOURCETYPE_CONSUMER);}
214     | ResourceTypeKeyword           {$$ = $1;}
215     ;
216 
217 OptionalResourceType
218     :                               {$$ = TrCreateLeafOp (
219                                         PARSEOP_RESOURCETYPE_CONSUMER);}
220     | ','                           {$$ = TrCreateLeafOp (
221                                         PARSEOP_RESOURCETYPE_CONSUMER);}
222     | ',' ResourceTypeKeyword       {$$ = $2;}
223     ;
224 
225 /* Same as above except default is producer */
226 OptionalProducerResourceType
227     :                               {$$ = TrCreateLeafOp (
228                                         PARSEOP_RESOURCETYPE_PRODUCER);}
229     | ','                           {$$ = TrCreateLeafOp (
230                                         PARSEOP_RESOURCETYPE_PRODUCER);}
231     | ',' ResourceTypeKeyword       {$$ = $2;}
232     ;
233 
234 OptionalSlaveMode
235     : ','                           {$$ = NULL;}
236     | ',' SlaveModeKeyword          {$$ = $2;}
237     ;
238 
239 OptionalShareType
240     :                               {$$ = NULL;}
241     | ','                           {$$ = NULL;}
242     | ',' ShareTypeKeyword          {$$ = $2;}
243     ;
244 
245 OptionalShareType_First
246     :                               {$$ = NULL;}
247     | ShareTypeKeyword              {$$ = $1;}
248     ;
249 
250 OptionalStopBits
251     : ','                           {$$ = NULL;}
252     | ',' StopBitsKeyword           {$$ = $2;}
253     ;
254 
255 OptionalStringData
256     :                               {$$ = NULL;}
257     | ','                           {$$ = NULL;}
258     | ',' StringData                {$$ = $2;}
259     ;
260 
261 OptionalTranslationType_Last
262     :                               {$$ = NULL;}
263     | ','                           {$$ = NULL;}
264     | ',' TranslationKeyword        {$$ = $2;}
265     ;
266 
267 OptionalType
268     :                               {$$ = NULL;}
269     | ','                           {$$ = NULL;}
270     | ',' TypeKeyword               {$$ = $2;}
271     ;
272 
273 OptionalType_Last
274     :                               {$$ = NULL;}
275     | ','                           {$$ = NULL;}
276     | ',' TypeKeyword               {$$ = $2;}
277     ;
278 
279 OptionalWireMode
280     : ','                           {$$ = NULL;}
281     | ',' WireModeKeyword           {$$ = $2;}
282     ;
283 
284 OptionalWordConstExpr
285     : ','                           {$$ = NULL;}
286     | ',' WordConstExpr             {$$ = $2;}
287     ;
288 
289 OptionalXferSize
290     :                               {$$ = TrCreateValuedLeafOp (
291                                         PARSEOP_XFERSIZE_32, 2);}
292     | ','                           {$$ = TrCreateValuedLeafOp (
293                                         PARSEOP_XFERSIZE_32, 2);}
294     | ',' XferSizeKeyword           {$$ = $2;}
295     ;
296