1/******************************************************************************
2 *
3 * Module Name: ahgrammar - AML grammar items
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
27 *
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************/
115
116#include "acpihelp.h"
117
118const AH_AML_TYPE           AmlTypesInfo[] =
119{
120    {"ComputationalData",
121        "ComputationalData :=\n"
122        "ByteConst | WordConst | DWordConst | QWordConst |\n"
123        "String | ConstObj | RevisionOp | DefBuffer\n\n"
124        "DataObject := ComputationalData | DefPackage | DefVarPackage\n"
125        "DataRefObject := DataObject | ObjectReference | DDBHandle\n\n"
126
127        "ByteConst := BytePrefix ByteData\n"
128        "BytePrefix := 0x0A\n"
129        "ByteList := Nothing | <ByteData ByteList>\n"
130        "ByteData := 0x00 - 0xFF\n\n"
131
132        "WordConst := WordPrefix WordData\n"
133        "WordPrefix := 0x0B\n"
134        "WordData := 0x0000-0xFFFF\n\n"
135
136        "DWordConst := DWordPrefix DWordData\n"
137        "DWordPrefix := 0x0C\n"
138        "DWordData := 0x00000000-0xFFFFFFFF\n\n"
139
140        "QWordConst := QWordPrefix QWordData\n"
141        "QWordPrefix := 0x0E\n"
142        "QWordData := 0x0000000000000000-0xFFFFFFFFFFFFFFFF\n\n"
143
144        "String := StringPrefix AsciiCharList NullChar\n"
145        "StringPrefix := 0x0D\n"
146        "AsciiCharList := Nothing | <AsciiChar AsciiCharList>\n"
147        "AsciiChar := 0x01 - 0x7F\n"
148        "NullChar := 0x00\n\n"
149
150        "ConstObj := ZeroOp | OneOp | OnesOp\n\n"},
151
152    {"DefinitionBlock",
153        "DefinitionBlockHeader :=\n"
154        "TableSignature TableLength SpecCompliance Checksum\n"
155        "OemID OemTableID OemRevision CreatorID CreatorRevision\n\n"
156
157        "TableSignature := AsciiChar AsciiChar AsciiChar AsciiChar\n"
158        "TableLength := DWordData\n"
159        "// Length of the table in bytes including\n"
160        "// the block header.\n\n"
161
162        "SpecCompliance := ByteData\n"
163        "// The revision of the structure\n\n"
164
165        "CheckSum := ByteData\n"
166        "// Byte checksum of the entire table\n\n"
167
168        "OemID := ByteData(6)\n"
169        "// OEM ID of up to 6 characters. If the OEM\n"
170        "// ID is shorter than 6 characters, it\n"
171        "// can be terminated with a NULL\n"
172        "// character.\n\n"
173
174        "OemTableID := ByteData(8)\n"
175        "// OEM Table ID of up to 8 characters. If\n"
176        "// the OEM Table ID is shorter than 8\n"
177        "// characters, it can be terminated with\n"
178        "// a NULL character.\n"
179        "OemRevision := DWordData\n"
180        "// OEM Table Revision\n\n"
181        "CreatorID := DWordData\n"
182        "// Vendor ID of the ASL compiler\n"
183        "CreatorRevision := DWordData\n"
184        "// Revision of the ASL compiler\n"},
185
186    {"FieldFlags",
187        "FieldFlags := ByteData\n"
188        "// bits 0-3: AccessType\n"
189        "//     0 AnyAcc\n"
190        "//     1 ByteAcc\n"
191        "//     2 WordAcc\n"
192        "//     3 DWordAcc\n"
193        "//     4 QWordAcc\n"
194        "//     5 BufferAcc\n"
195        "//     6 Reserved\n"
196        "//     7 Reserved\n"
197        "// bit 4: LockRule\n"
198        "//     0 NoLock\n"
199        "//     1 Lock\n"
200        "// bits 5-6: UpdateRule\n"
201        "//     0 Preserve\n"
202        "//     1 WriteAsOnes\n"
203        "//     2 WriteAsZeros\n"
204        "// bit 7:\n"
205        "//     0 Reserved (must be 0)\n"},
206
207    {"FieldList",
208        "FieldList := Nothing | <FieldElement FieldList>\n\n"
209        "FieldElement := NamedField | ReservedField | AccessField |\n"
210        "    ExtendedAccessField | ConnectField\n\n"
211        "NamedField := NameSeg PkgLength\n"
212        "ReservedField := 0x00 PkgLength\n\n"
213
214        "AccessField := 0x01 AccessType\n"
215        "AccessField := 0x01 AccessType AccessAttrib\n\n"
216
217        "AccessType := ByteData\n"
218        "// Bits 0:3 - Same as AccessType bits of FieldFlags.\n"
219        "// Bits 4:5 - Reserved\n"
220        "// Bits 7:6 - 0 = AccessAttribute\n"
221        "//     Normal Access Attributes\n"
222        "//     1 = AttribBytes (x)\n"
223        "//     2 = AttribRawBytes (x)\n"
224        "//     3 = AttribRawProcessBytes (x)\n"
225        "//     Note: 'x' is encoded as bits 0:7 of the AccessAttrib byte.\n\n"
226
227        "AccessAttrib := ByteData\n"
228        "// bits 0:7: Byte length\n"
229        "//\n"
230        "// If AccessType is BufferAcc for the SMB or\n"
231        "// GPIO OpRegions, AccessAttrib can be one of\n"
232        "// the following values:\n"
233        "// 0x02 AttribQuick\n"
234        "// 0x04 AttribSendReceive\n"
235        "// 0x06 AttribByte\n"
236        "// 0x08 AttribWord\n"
237        "// 0x0A AttribBlock\n"
238        "// 0x0C AttribProcessCall\n"
239        "// 0x0D AttribBlockProcessCall\n\n"
240
241        "ExtendedAccessField := 0x03 AccessType ExtendedAccessAttrib AccessLength\n"
242        "ExtendedAccessAttrib := ByteData\n"
243        "// 0x0B AttribBytes\n"
244        "// 0x0E AttribRawBytes\n"
245        "// 0x0F AttribRawProcess\n\n"
246
247        "ConnectField := 0x02 NameString> | <0x02 BufferData\n"},
248
249    {"MatchOpcode",
250        "DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand StartIndex\n"
251        "MatchOp := 0x89\n"
252        "SearchPkg := TermArg => Package\n"
253        "MatchOpcode := ByteData\n"
254        "// 0 MTR\n"
255        "// 1 MEQ\n"
256        "// 2 MLE\n"
257        "// 3 MLT\n"
258        "// 4 MGE\n"
259        "// 5 MGT\n"},
260
261   {"MethodFlags",
262        "DefMethod := MethodOp PkgLength NameString MethodFlags TermList\n"
263        "MethodOp := 0x14\n"
264        "MethodFlags := ByteData\n"
265        "// bit 0-2: ArgCount (0-7)\n"
266        "// bit 3: SerializeFlag\n"
267        "//   0 NotSerialized\n"
268        "//   1 Serialized\n"
269        "// bit 4-7: SyncLevel (0x00-0x0f)\n"},
270
271    {"Miscellaneous",
272        "ZeroOp := 0x00\n"
273        "OneOp := 0x01\n"
274        "OnesOp := 0xFF\n"
275        "RevisionOp := ExtOpPrefix 0x30\n"
276        "ExtOpPrefix := 0x5B\n"},
277
278    {"NameSeg",
279        "NameSeg := <LeadNameChar NameChar NameChar NameChar>\n"
280        "// Note: NameSegs shorter than 4 characters are filled with\n"
281        "// trailing underscores.\n\n"
282        "NameChar := DigitChar | LeadNameChar\n"
283        "LeadNameChar := 'A'-'Z' | '_' (0x41 - 0x5A) | (0x5F)\n"
284        "DigitChar := '0'-'9' (0x30 - 0x39)\n"},
285
286    {"NameString",
287        "NameString := <RootChar NamePath> | <PrefixPath NamePath>\n"
288        "PrefixPath := Nothing | <ParentPrefixChar PrefixPath>\n"
289        "RootChar := '\\' (0x5C)\n"
290        "ParentPrefixChar := '^' (0x5E)\n"},
291
292    {"NamePath",
293        "NamePath := NameSeg | DualNamePath | MultiNamePath | NullName\n"
294        "DualNamePath := DualNamePrefix NameSeg NameSeg\n"
295        "DualNamePrefix := 0x2E\n"
296        "MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount)\n"
297        "MultiNamePrefix := 0x2F\n"
298        "SegCount := ByteData\n"
299        "// Note: SegCount can be from 1 to 255. For example: MultiNamePrefix(35)\n"
300        "// is encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total\n"
301        "// encoding length will be 1 + 1 + (35 * 4) = 142. Notice that:\n"
302        "// DualNamePrefix NameSeg NameSeg has a smaller encoding than the\n"
303        "// encoding of: MultiNamePrefix(2) NameSeg NameSeg\n\n"
304
305        "SimpleName := NameString | ArgObj | LocalObj\n"
306        "SuperName := SimpleName | DebugObj | Type6Opcode\n"
307        "NullName := 0x00\n"
308        "Target := SuperName | NullName\n"},
309
310    {"PkgLength",
311        "PkgLength := PkgLeadByte |\n"
312        "<PkgLeadByte ByteData> |\n"
313        "<PkgLeadByte ByteData ByteData> |\n"
314        "<PkgLeadByte ByteData ByteData ByteData>\n\n"
315
316        "PkgLeadByte :=\n"
317        "bit 7-6: Count of ByteData that follows (0-3)\n"
318        "bit 5-4: Only used if (PkgLength < 63)\n"
319        "bit 3-0: Least significant package length nybble\n"
320        "// Note: The high 2 bits of the first byte reveal how many follow bytes\n"
321        "// are in the PkgLength. If the PkgLength has only one byte, bit 0 through 5\n"
322        "// are used to encode the package length (in other words, values 0-63). If\n"
323        "// the package length value is more than 63, more than one byte must be\n"
324        "// used for the encoding in which case bit 4 and 5 of the PkgLeadByte are\n"
325        "// reserved and must be zero. If the multiple bytes encoding is used, bits\n"
326        "// 0-3 of the PkgLeadByte become the least significant 4 bits of the\n"
327        "// resulting package length value. The next ByteData will become the next\n"
328        "// least significant 8 bits of the resulting value and so on, up to 3\n"
329        "// ByteData bytes. Thus, the maximum package length is 2**28.\n"},
330
331    {"RegionSpace",
332        "RegionSpace := ByteData\n"
333        "// 0x00 SystemMemory\n"
334        "// 0x01 SystemIO\n"
335        "// 0x02 PCI_Config\n"
336        "// 0x03 EmbeddedControl\n"
337        "// 0x04 SMBus\n"
338        "// 0x05 SystemCMOS\n"
339        "// 0x06 PciBarTarget\n"
340        "// 0x07 IPMI\n"
341        "// 0x08 GeneralPurposeIO\n"
342        "// 0x09 GenericSerialBus\n"
343        "// 0x0A Platform Communications Channel\n"
344        "// 0x0B-0x7E: Reserved\n"
345        "// 0x7F: Functional Fixed Hardware\n"
346        "// 0x80-0xBF: Reserved\n"
347        "// 0xC0-0xFF: OEM Defined\n"},
348
349    {"TermObj",
350        "TermObj := NameSpaceModifierObj | NamedObj | Type1Opcode | Type2Opcode\n"
351        "TermList := Nothing | <TermObj TermList>\n\n"
352
353        "MethodInvocation := NameString TermArgList\n"
354        "TermArgList := Nothing | <TermArg TermArgList>\n"
355        "TermArg := Type2Opcode | DataObject | ArgObj | LocalObj\n\n"
356
357        "ObjectList := Nothing | <Object ObjectList>\n"
358        "Object := NameSpaceModifierObj | NamedObj\n"},
359
360    {NULL, NULL}
361};
362