ahgrammar.c revision 1.1.1.2 1 1.1 christos /******************************************************************************
2 1.1 christos *
3 1.1 christos * Module Name: ahgrammar - AML grammar items
4 1.1 christos *
5 1.1 christos *****************************************************************************/
6 1.1 christos
7 1.1 christos /*
8 1.1.1.2 christos * Copyright (C) 2000 - 2017, Intel Corp.
9 1.1 christos * All rights reserved.
10 1.1 christos *
11 1.1 christos * Redistribution and use in source and binary forms, with or without
12 1.1 christos * modification, are permitted provided that the following conditions
13 1.1 christos * are met:
14 1.1 christos * 1. Redistributions of source code must retain the above copyright
15 1.1 christos * notice, this list of conditions, and the following disclaimer,
16 1.1 christos * without modification.
17 1.1 christos * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1 christos * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1 christos * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1 christos * including a substantially similar Disclaimer requirement for further
21 1.1 christos * binary redistribution.
22 1.1 christos * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1 christos * of any contributors may be used to endorse or promote products derived
24 1.1 christos * from this software without specific prior written permission.
25 1.1 christos *
26 1.1 christos * Alternatively, this software may be distributed under the terms of the
27 1.1 christos * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1 christos * Software Foundation.
29 1.1 christos *
30 1.1 christos * NO WARRANTY
31 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1 christos * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1 christos * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1 christos * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1 christos * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1 christos * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1 christos * POSSIBILITY OF SUCH DAMAGES.
42 1.1 christos */
43 1.1 christos
44 1.1 christos #include "acpihelp.h"
45 1.1 christos
46 1.1.1.2 christos const AH_AML_TYPE Gbl_AmlTypesInfo[] =
47 1.1 christos {
48 1.1 christos {"ComputationalData",
49 1.1 christos "ComputationalData :=\n"
50 1.1 christos "ByteConst | WordConst | DWordConst | QWordConst |\n"
51 1.1 christos "String | ConstObj | RevisionOp | DefBuffer\n\n"
52 1.1 christos "DataObject := ComputationalData | DefPackage | DefVarPackage\n"
53 1.1 christos "DataRefObject := DataObject | ObjectReference | DDBHandle\n\n"
54 1.1 christos
55 1.1 christos "ByteConst := BytePrefix ByteData\n"
56 1.1 christos "BytePrefix := 0x0A\n"
57 1.1 christos "ByteList := Nothing | <ByteData ByteList>\n"
58 1.1 christos "ByteData := 0x00 - 0xFF\n\n"
59 1.1 christos
60 1.1 christos "WordConst := WordPrefix WordData\n"
61 1.1 christos "WordPrefix := 0x0B\n"
62 1.1 christos "WordData := 0x0000-0xFFFF\n\n"
63 1.1 christos
64 1.1 christos "DWordConst := DWordPrefix DWordData\n"
65 1.1 christos "DWordPrefix := 0x0C\n"
66 1.1 christos "DWordData := 0x00000000-0xFFFFFFFF\n\n"
67 1.1 christos
68 1.1 christos "QWordConst := QWordPrefix QWordData\n"
69 1.1 christos "QWordPrefix := 0x0E\n"
70 1.1 christos "QWordData := 0x0000000000000000-0xFFFFFFFFFFFFFFFF\n\n"
71 1.1 christos
72 1.1 christos "String := StringPrefix AsciiCharList NullChar\n"
73 1.1 christos "StringPrefix := 0x0D\n"
74 1.1 christos "AsciiCharList := Nothing | <AsciiChar AsciiCharList>\n"
75 1.1 christos "AsciiChar := 0x01 - 0x7F\n"
76 1.1 christos "NullChar := 0x00\n\n"
77 1.1 christos
78 1.1 christos "ConstObj := ZeroOp | OneOp | OnesOp\n\n"},
79 1.1 christos
80 1.1 christos {"DefinitionBlock",
81 1.1 christos "DefinitionBlockHeader :=\n"
82 1.1 christos "TableSignature TableLength SpecCompliance Checksum\n"
83 1.1 christos "OemID OemTableID OemRevision CreatorID CreatorRevision\n\n"
84 1.1 christos
85 1.1 christos "TableSignature := AsciiChar AsciiChar AsciiChar AsciiChar\n"
86 1.1 christos "TableLength := DWordData\n"
87 1.1 christos "// Length of the table in bytes including\n"
88 1.1 christos "// the block header.\n\n"
89 1.1 christos
90 1.1 christos "SpecCompliance := ByteData\n"
91 1.1 christos "// The revision of the structure\n\n"
92 1.1 christos
93 1.1 christos "CheckSum := ByteData\n"
94 1.1 christos "// Byte checksum of the entire table\n\n"
95 1.1 christos
96 1.1 christos "OemID := ByteData(6)\n"
97 1.1 christos "// OEM ID of up to 6 characters. If the OEM\n"
98 1.1 christos "// ID is shorter than 6 characters, it\n"
99 1.1 christos "// can be terminated with a NULL\n"
100 1.1 christos "// character.\n\n"
101 1.1 christos
102 1.1 christos "OemTableID := ByteData(8)\n"
103 1.1 christos "// OEM Table ID of up to 8 characters. If\n"
104 1.1 christos "// the OEM Table ID is shorter than 8\n"
105 1.1 christos "// characters, it can be terminated with\n"
106 1.1 christos "// a NULL character.\n"
107 1.1 christos "OemRevision := DWordData\n"
108 1.1 christos "// OEM Table Revision\n\n"
109 1.1 christos "CreatorID := DWordData\n"
110 1.1 christos "// Vendor ID of the ASL compiler\n"
111 1.1 christos "CreatorRevision := DWordData\n"
112 1.1 christos "// Revision of the ASL compiler\n"},
113 1.1 christos
114 1.1 christos {"FieldFlags",
115 1.1 christos "FieldFlags := ByteData\n"
116 1.1 christos "// bits 0-3: AccessType\n"
117 1.1 christos "// 0 AnyAcc\n"
118 1.1 christos "// 1 ByteAcc\n"
119 1.1 christos "// 2 WordAcc\n"
120 1.1 christos "// 3 DWordAcc\n"
121 1.1 christos "// 4 QWordAcc\n"
122 1.1 christos "// 5 BufferAcc\n"
123 1.1 christos "// 6 Reserved\n"
124 1.1 christos "// 7 Reserved\n"
125 1.1 christos "// bit 4: LockRule\n"
126 1.1 christos "// 0 NoLock\n"
127 1.1 christos "// 1 Lock\n"
128 1.1 christos "// bits 5-6: UpdateRule\n"
129 1.1 christos "// 0 Preserve\n"
130 1.1 christos "// 1 WriteAsOnes\n"
131 1.1 christos "// 2 WriteAsZeros\n"
132 1.1 christos "// bit 7:\n"
133 1.1 christos "// 0 Reserved (must be 0)\n"},
134 1.1 christos
135 1.1 christos {"FieldList",
136 1.1 christos "FieldList := Nothing | <FieldElement FieldList>\n\n"
137 1.1 christos "FieldElement := NamedField | ReservedField | AccessField |\n"
138 1.1 christos " ExtendedAccessField | ConnectField\n\n"
139 1.1 christos "NamedField := NameSeg PkgLength\n"
140 1.1 christos "ReservedField := 0x00 PkgLength\n\n"
141 1.1 christos
142 1.1 christos "AccessField := 0x01 AccessType\n"
143 1.1 christos "AccessField := 0x01 AccessType AccessAttrib\n\n"
144 1.1 christos
145 1.1 christos "AccessType := ByteData\n"
146 1.1 christos "// Bits 0:3 - Same as AccessType bits of FieldFlags.\n"
147 1.1 christos "// Bits 4:5 - Reserved\n"
148 1.1 christos "// Bits 7:6 - 0 = AccessAttribute\n"
149 1.1 christos "// Normal Access Attributes\n"
150 1.1 christos "// 1 = AttribBytes (x)\n"
151 1.1 christos "// 2 = AttribRawBytes (x)\n"
152 1.1 christos "// 3 = AttribRawProcessBytes (x)\n"
153 1.1 christos "// Note: 'x' is encoded as bits 0:7 of the AccessAttrib byte.\n\n"
154 1.1 christos
155 1.1 christos "AccessAttrib := ByteData\n"
156 1.1 christos "// bits 0:7: Byte length\n"
157 1.1 christos "//\n"
158 1.1 christos "// If AccessType is BufferAcc for the SMB or\n"
159 1.1 christos "// GPIO OpRegions, AccessAttrib can be one of\n"
160 1.1 christos "// the following values:\n"
161 1.1 christos "// 0x02 AttribQuick\n"
162 1.1 christos "// 0x04 AttribSendReceive\n"
163 1.1 christos "// 0x06 AttribByte\n"
164 1.1 christos "// 0x08 AttribWord\n"
165 1.1 christos "// 0x0A AttribBlock\n"
166 1.1 christos "// 0x0C AttribProcessCall\n"
167 1.1 christos "// 0x0D AttribBlockProcessCall\n\n"
168 1.1 christos
169 1.1 christos "ExtendedAccessField := 0x03 AccessType ExtendedAccessAttrib AccessLength\n"
170 1.1 christos "ExtendedAccessAttrib := ByteData\n"
171 1.1 christos "// 0x0B AttribBytes\n"
172 1.1 christos "// 0x0E AttribRawBytes\n"
173 1.1 christos "// 0x0F AttribRawProcess\n\n"
174 1.1 christos
175 1.1 christos "ConnectField := 0x02 NameString> | <0x02 BufferData\n"},
176 1.1 christos
177 1.1 christos {"MatchOpcode",
178 1.1 christos "DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand StartIndex\n"
179 1.1 christos "MatchOp := 0x89\n"
180 1.1 christos "SearchPkg := TermArg => Package\n"
181 1.1 christos "MatchOpcode := ByteData\n"
182 1.1 christos "// 0 MTR\n"
183 1.1 christos "// 1 MEQ\n"
184 1.1 christos "// 2 MLE\n"
185 1.1 christos "// 3 MLT\n"
186 1.1 christos "// 4 MGE\n"
187 1.1 christos "// 5 MGT\n"},
188 1.1 christos
189 1.1 christos {"MethodFlags",
190 1.1 christos "DefMethod := MethodOp PkgLength NameString MethodFlags TermList\n"
191 1.1 christos "MethodOp := 0x14\n"
192 1.1 christos "MethodFlags := ByteData\n"
193 1.1 christos "// bit 0-2: ArgCount (0-7)\n"
194 1.1 christos "// bit 3: SerializeFlag\n"
195 1.1 christos "// 0 NotSerialized\n"
196 1.1 christos "// 1 Serialized\n"
197 1.1 christos "// bit 4-7: SyncLevel (0x00-0x0f)\n"},
198 1.1 christos
199 1.1 christos {"Miscellaneous",
200 1.1 christos "ZeroOp := 0x00\n"
201 1.1 christos "OneOp := 0x01\n"
202 1.1 christos "OnesOp := 0xFF\n"
203 1.1 christos "RevisionOp := ExtOpPrefix 0x30\n"
204 1.1 christos "ExtOpPrefix := 0x5B\n"},
205 1.1 christos
206 1.1 christos {"NameSeg",
207 1.1 christos "NameSeg := <LeadNameChar NameChar NameChar NameChar>\n"
208 1.1 christos "// Note: NameSegs shorter than 4 characters are filled with\n"
209 1.1 christos "// trailing underscores.\n\n"
210 1.1 christos "NameChar := DigitChar | LeadNameChar\n"
211 1.1 christos "LeadNameChar := 'A'-'Z' | '_' (0x41 - 0x5A) | (0x5F)\n"
212 1.1 christos "DigitChar := '0'-'9' (0x30 - 0x39)\n"},
213 1.1 christos
214 1.1 christos {"NameString",
215 1.1 christos "NameString := <RootChar NamePath> | <PrefixPath NamePath>\n"
216 1.1 christos "PrefixPath := Nothing | <ParentPrefixChar PrefixPath>\n"
217 1.1 christos "RootChar := '\\' (0x5C)\n"
218 1.1 christos "ParentPrefixChar := '^' (0x5E)\n"},
219 1.1 christos
220 1.1 christos {"NamePath",
221 1.1 christos "NamePath := NameSeg | DualNamePath | MultiNamePath | NullName\n"
222 1.1 christos "DualNamePath := DualNamePrefix NameSeg NameSeg\n"
223 1.1 christos "DualNamePrefix := 0x2E\n"
224 1.1 christos "MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount)\n"
225 1.1 christos "MultiNamePrefix := 0x2F\n"
226 1.1 christos "SegCount := ByteData\n"
227 1.1 christos "// Note: SegCount can be from 1 to 255. For example: MultiNamePrefix(35)\n"
228 1.1 christos "// is encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total\n"
229 1.1 christos "// encoding length will be 1 + 1 + (35 * 4) = 142. Notice that:\n"
230 1.1 christos "// DualNamePrefix NameSeg NameSeg has a smaller encoding than the\n"
231 1.1 christos "// encoding of: MultiNamePrefix(2) NameSeg NameSeg\n\n"
232 1.1 christos
233 1.1 christos "SimpleName := NameString | ArgObj | LocalObj\n"
234 1.1 christos "SuperName := SimpleName | DebugObj | Type6Opcode\n"
235 1.1 christos "NullName := 0x00\n"
236 1.1 christos "Target := SuperName | NullName\n"},
237 1.1 christos
238 1.1 christos {"PkgLength",
239 1.1 christos "PkgLength := PkgLeadByte |\n"
240 1.1 christos "<PkgLeadByte ByteData> |\n"
241 1.1 christos "<PkgLeadByte ByteData ByteData> |\n"
242 1.1 christos "<PkgLeadByte ByteData ByteData ByteData>\n\n"
243 1.1 christos
244 1.1 christos "PkgLeadByte :=\n"
245 1.1 christos "bit 7-6: Count of ByteData that follows (0-3)\n"
246 1.1 christos "bit 5-4: Only used if (PkgLength < 63)\n"
247 1.1 christos "bit 3-0: Least significant package length nybble\n"
248 1.1 christos "// Note: The high 2 bits of the first byte reveal how many follow bytes\n"
249 1.1 christos "// are in the PkgLength. If the PkgLength has only one byte, bit 0 through 5\n"
250 1.1 christos "// are used to encode the package length (in other words, values 0-63). If\n"
251 1.1 christos "// the package length value is more than 63, more than one byte must be\n"
252 1.1 christos "// used for the encoding in which case bit 4 and 5 of the PkgLeadByte are\n"
253 1.1 christos "// reserved and must be zero. If the multiple bytes encoding is used, bits\n"
254 1.1 christos "// 0-3 of the PkgLeadByte become the least significant 4 bits of the\n"
255 1.1 christos "// resulting package length value. The next ByteData will become the next\n"
256 1.1 christos "// least significant 8 bits of the resulting value and so on, up to 3\n"
257 1.1 christos "// ByteData bytes. Thus, the maximum package length is 2**28.\n"},
258 1.1 christos
259 1.1 christos {"RegionSpace",
260 1.1 christos "RegionSpace := ByteData\n"
261 1.1 christos "// 0x00 SystemMemory\n"
262 1.1 christos "// 0x01 SystemIO\n"
263 1.1 christos "// 0x02 PCI_Config\n"
264 1.1 christos "// 0x03 EmbeddedControl\n"
265 1.1 christos "// 0x04 SMBus\n"
266 1.1 christos "// 0x05 SystemCMOS\n"
267 1.1 christos "// 0x06 PciBarTarget\n"
268 1.1 christos "// 0x07 IPMI\n"
269 1.1 christos "// 0x08 GeneralPurposeIO\n"
270 1.1 christos "// 0x09 GenericSerialBus\n"
271 1.1 christos "// 0x0A Platform Communications Channel\n"
272 1.1 christos "// 0x0B-0x7E: Reserved\n"
273 1.1 christos "// 0x7F: Functional Fixed Hardware\n"
274 1.1 christos "// 0x80-0xBF: Reserved\n"
275 1.1 christos "// 0xC0-0xFF: OEM Defined\n"},
276 1.1 christos
277 1.1 christos {"TermObj",
278 1.1 christos "TermObj := NameSpaceModifierObj | NamedObj | Type1Opcode | Type2Opcode\n"
279 1.1 christos "TermList := Nothing | <TermObj TermList>\n\n"
280 1.1 christos
281 1.1 christos "MethodInvocation := NameString TermArgList\n"
282 1.1 christos "TermArgList := Nothing | <TermArg TermArgList>\n"
283 1.1 christos "TermArg := Type2Opcode | DataObject | ArgObj | LocalObj\n\n"
284 1.1 christos
285 1.1 christos "ObjectList := Nothing | <Object ObjectList>\n"
286 1.1 christos "Object := NameSpaceModifierObj | NamedObj\n"},
287 1.1 christos
288 1.1 christos {NULL, NULL}
289 1.1 christos };
290