Debian Codegraph @

tests/aslts/src/runtime/collections/functional/region/dtregions.asl

raw
1 /*
2 * Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 /*
29 * Data Table Region declarations
30 */
31 /*
32 * On testing following issues should be covered:
33 * - String objects can be used as DataTableRegion arguments,
34 * - global and dynamic DataTableRegion declarations,
35 * - check of the Table Length on access to appropriate Fields,
36 * - any table referenced in XSDT can be accessed,
37 * - computational data is allowed to be DataTableRegion arguments,
38 * - possibility to write into appropriate Fields.
39 *
40 * Can not be tested following issues:
41 * - providing of DataTableRegions to be "in memory marked by
42 * AddressRangeReserved or AddressRangeNVS".
43 */
44 Name (Z142, 0x8E)
45 Device (DTR0)
46 {
47 DataTableRegion (DR00, "DSDT", "", "")
48 DataTableRegion (DR01, "SSDT", "", "")
49 /* This SSDT must be identical to SSDT1 in the AcpiExec utility */
50
51 Name (SSDT, Buffer (0x3E)
52 {
53 /* 0000 */ 0x53, 0x53, 0x44, 0x54, 0x3E, 0x00, 0x00, 0x00, // SSDT>...
54 /* 0008 */ 0x02, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x6C, 0x00, // ..Intel.
55 /* 0010 */ 0x73, 0x73, 0x64, 0x74, 0x31, 0x00, 0x00, 0x00, // ssdt1...
56 /* 0018 */ 0x01, 0x00, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, // ....INTL
57 /* 0020 */ 0x20, 0x06, 0x12, 0x20, 0x14, 0x19, 0x5F, 0x54, // .. .._T
58 /* 0028 */ 0x39, 0x38, 0x01, 0x70, 0x0D, 0x53, 0x53, 0x44, // 98.p.SSD
59 /* 0030 */ 0x54, 0x31, 0x20, 0x2D, 0x20, 0x5F, 0x54, 0x39, // T1 - _T9
60 /* 0038 */ 0x38, 0x00, 0x5B, 0x31, 0xA4, 0x00 // 8.[1..
61 })
62 Name (NFLG, 0x02) /* Number of turn on/off Flag values */
63 Name (IRSK, 0x00) /* Counter of the Invalid RSKs */
64 Name (IFLG, 0x00) /* Counter of the Invalid Flags */
65 Name (VRSK, 0x00) /* Counter of the Valid RSK 0x07 */
66 Name (ERSK, 0x02) /* Expected Counters of the Valid RSK */
67 Name (VFLG, /* Counters of the Valid Flags */Package (NFLG)
68 {
69 0x00,
70 0x00
71 })
72 /* Specific DataTable Regions availability notification Method */
73 /* \DTR0._REG(RegionSpaceKeyword, Flag) */
74 OperationRegion (JUNK, SystemMemory, 0x2000, 0x0100)
75 Method (_REG, 2, Serialized) // _REG: Region Availability
76 {
77 Name (DBGF, 0x01)
78 If (DBGF)
79 {
80 DNAM (Arg0, Arg1, "\\DTR0._REG")
81 }
82
83 /*
84 * 0x7E is the SpaceID for DataTableRegions (subject to change
85 * with new releases of ACPI specification -- because this
86 * ID is an internal-ACPICA-only ID)
87 */
88 If ((Arg0 == 0x7E))
89 {
90 VRSK++
91 }
92 Else
93 {
94 IRSK++
95 }
96
97 If ((Arg1 < NFLG))
98 {
99 Local1 = VFLG [Arg1]
100 Local2 = RefOf (Local1)
101 DerefOf (Local2) = (DerefOf (Local1) + 0x01)
102 }
103 Else
104 {
105 IFLG++
106 }
107 }
108 }
109
110 /* Global DataTableRegions */
111
112 Method (M7F0, 1, NotSerialized)
113 {
114 Concatenate (Arg0, "-m7f0", Arg0)
115 \DTR0._REG (0x0101, 0x02)
116 If ((\DTR0.IRSK != 0x01))
117 {
118 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, \DTR0.IRSK, 0x01)
119 }
120
121 If ((\DTR0.IFLG != 0x01))
122 {
123 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, \DTR0.IFLG, 0x01)
124 }
125
126 If ((\DTR0.VRSK != 0x02))
127 {
128 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, \DTR0.VRSK, 0x02)
129 }
130
131 If ((DerefOf (\DTR0.VFLG [0x01]) != 0x02))
132 {
133 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, DerefOf (\DTR0.VFLG [0x01]), 0x02)
134 }
135 }
136
137 /* Dynamic DataTableRegions */
138 /* m7f1(CallChain) */
139 /* CallChain: String */
140 Method (M7F1, 1, Serialized)
141 {
142 Name (NFLG, 0x02) /* Number of turn on/off Flag values */
143 Name (IRSK, 0x00) /* Counter of the Invalid RSKs */
144 Name (IFLG, 0x00) /* Counter of the Invalid Flags */
145 Name (VRSK, 0x00) /* Counter of the Valid RSK 0x7E (DataTableRegion) */
146 Name (ERSK, 0x02) /* Expected Counters of the Valid RSK */
147 Name (VFLG, /* Counters of the Valid Flags */Package (NFLG)
148 {
149 0x00,
150 0x00
151 })
152 /* Specific DataTable Regions availability notification Method */
153 /* \m7f1._REG(RegionSpaceKeyword, Flag) */
154 OperationRegion (JUNK, SystemMemory, 0x2000, 0x0100)
155 Method (_REG, 2, Serialized) // _REG: Region Availability
156 {
157 Name (DBGF, 0x01)
158 If (DBGF)
159 {
160 DNAM (Arg0, Arg1, "\\m7f1._REG")
161 }
162
163 /* DataTableRegion is SpaceID 0x7E */
164
165 If ((Arg0 == 0x7E))
166 {
167 VRSK++
168 }
169 Else
170 {
171 IRSK++
172 }
173
174 If ((Arg1 < NFLG))
175 {
176 Local1 = VFLG [Arg1]
177 Local2 = RefOf (Local1)
178 DerefOf (Local2) = (DerefOf (Local1) + 0x01)
179 }
180 Else
181 {
182 IFLG++
183 }
184 }
185
186 Concatenate (Arg0, "-m7f1", Arg0)
187 If ((VRSK != 0x00))
188 {
189 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, VRSK, 0x00)
190 }
191
192 If ((DerefOf (VFLG [0x01]) != 0x00))
193 {
194 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, DerefOf (VFLG [0x01]), 0x00)
195 }
196
197 DataTableRegion (DR00, "SSDT", "", "")
198 If ((IRSK != 0x00))
199 {
200 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, IRSK, 0x00)
201 }
202
203 If ((IFLG != 0x00))
204 {
205 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, IFLG, 0x00)
206 }
207
208 _REG (0x0101, 0x02)
209 If ((IRSK != 0x01))
210 {
211 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, IRSK, 0x01)
212 }
213
214 If ((IFLG != 0x01))
215 {
216 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, IFLG, 0x01)
217 }
218
219 If ((VRSK != 0x01))
220 {
221 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, VRSK, 0x01)
222 }
223
224 If ((DerefOf (VFLG [0x01]) != 0x01))
225 {
226 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, DerefOf (VFLG [0x01]), 0x01)
227 }
228 }
229
230 /* DataTableRegion Lengths */
231 /* m7f2(CallChain) */
232 /* CallChain: String */
233 Method (M7F2, 1, Serialized)
234 {
235 Concatenate (Arg0, "-m7f2", Arg0)
236 Field (\DTR0.DR01, AnyAcc, NoLock, Preserve)
237 {
238 FU01, 496
239 }
240
241 /* 0x1F0 == length of SSDT */
242
243 Local0 = RefOf (FU01)
244 Local1 = RefOf (Local0)
245 Local2 = DerefOf (Local0)
246 CH03 (Arg0, Z142, __LINE__, 0x00, 0x00)
247 Local3 = \DTR0.SSDT
248 If ((Local2 != Local3))
249 {
250 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local2, Local3)
251 }
252 }
253
254 /* Check non-constant DataTableRegion *String arguments */
255 /* m7f3(CallChain) */
256 /* CallChain: String */
257 Method (M7F3, 1, Serialized)
258 {
259 Name (S000, "SSDT")
260 Name (S001, "")
261 Name (S002, "")
262 Method (M000, 1, Serialized)
263 {
264 DataTableRegion (DR00, "SSDT", "", "")
265 Field (DR00, AnyAcc, NoLock, Preserve)
266 {
267 FU01, 496
268 }
269
270 /* 0x1F0 == length of SSDT */
271
272 Local0 = FU01 /* \M7F3.M000.FU01 */
273 Local1 = \DTR0.SSDT
274 If ((Local0 != Local1))
275 {
276 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local0, Local1)
277 }
278 }
279
280 /* ArgX */
281
282 Method (M001, 4, Serialized)
283 {
284 DataTableRegion (DR00, Arg1, Arg2, Arg3)
285 Field (DR00, AnyAcc, NoLock, Preserve)
286 {
287 FU01, 496
288 }
289
290 /* 0x1F0 == length of SSDT */
291
292 Local0 = FU01 /* \M7F3.M001.FU01 */
293 Local1 = \DTR0.SSDT
294 If ((Local0 != Local1))
295 {
296 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local0, Local1)
297 }
298 }
299
300 /* Named */
301
302 Method (M002, 1, Serialized)
303 {
304 DataTableRegion (DR00, S000, S001, S002)
305 Field (DR00, AnyAcc, NoLock, Preserve)
306 {
307 FU01, 496
308 }
309
310 /* 0x1F0 == length of SSDT */
311
312 Local0 = FU01 /* \M7F3.M002.FU01 */
313 Local1 = \DTR0.SSDT
314 If ((Local0 != Local1))
315 {
316 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local0, Local1)
317 }
318 }
319
320 /* LocalX */
321
322 Method (M003, 1, Serialized)
323 {
324 Local2 = S000 /* \M7F3.S000 */
325 Local3 = S001 /* \M7F3.S001 */
326 Local4 = S002 /* \M7F3.S002 */
327 DataTableRegion (DR00, Local2, Local3, Local4)
328 Field (DR00, AnyAcc, NoLock, Preserve)
329 {
330 FU01, 496
331 }
332
333 /* 0x1F0 == length of SSDT */
334
335 Local0 = FU01 /* \M7F3.M003.FU01 */
336 Local1 = \DTR0.SSDT
337 If ((Local0 != Local1))
338 {
339 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local0, Local1)
340 }
341 }
342
343 /* Expression */
344
345 Method (M004, 1, Serialized)
346 {
347 Local2 = "SS"
348 Local3 = "DT"
349 DataTableRegion (DR00, Concatenate (Local2, Local3), Mid (S000, 0x01, 0x00), S002)
350 Field (DR00, AnyAcc, NoLock, Preserve)
351 {
352 FU01, 496
353 }
354
355 /* 0x1F0 == length of SSDT */
356
357 Local0 = FU01 /* \M7F3.M004.FU01 */
358 Local1 = \DTR0.SSDT
359 If ((Local0 != Local1))
360 {
361 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local0, Local1)
362 }
363 }
364
365 Concatenate (Arg0, "-m7f1", Arg0)
366 M000 (Arg0)
367 M001 (Arg0, "SSDT", "", "")
368 M002 (Arg0)
369 M003 (Arg0)
370 M004 (Arg0)
371 }
372
373 /* Check different Table signatures */
374 /* m7f4(CallChain) */
375 /* CallChain: String */
376 Method (M7F4, 1, NotSerialized)
377 {
378 Method (M000, 3, Serialized)
379 {
380 DataTableRegion (DR00, Arg1, "", "")
381 Field (DR00, AnyAcc, NoLock, Preserve)
382 {
383 FU00, 32
384 }
385
386 Local0 = ToString (FU00, 0x04)
387 If ((Local0 != Arg1))
388 {
389 ERR (Arg0, Z142, __LINE__, 0x00, 0x00, Local0, Arg1)
390 }
391 }
392
393 Concatenate (Arg0, "-m7f4", Arg0)
394 M000 (Arg0, "DSDT", 0x1B)
395 M000 (Arg0, "SSDT", 0x1C)
396 /* no RSDT in simulator */
397 /*m000(arg0, "RSDT", 29) */
398 M000 (Arg0, "TEST", 0x1E)
399 M000 (Arg0, "BAD!", 0x1F)
400 M000 (Arg0, "FACP", 0x20)
401 M000 (Arg0, "SSDT", 0x21)
402 M000 (Arg0, "OEM1", 0x22)
403 }
404
405 Method (DRC0, 0, Serialized)
406 {
407 /* Global DataTableRegions */
408
409 SRMT ("m7f0")
410 M7F0 (__METHOD__)
411 /* Dynamic DataTableRegions */
412
413 SRMT ("m7f1")
414 M7F1 (__METHOD__)
415 /* DataTableRegion Lengths */
416
417 SRMT ("m7f2")
418 M7F2 (__METHOD__)
419 /* Non-constant DataTableRegion *String arguments */
420
421 SRMT ("m7f3")
422 If (Y223)
423 {
424 M7F3 (__METHOD__)
425 }
426 Else
427 {
428 BLCK ()
429 }
430
431 /* Different Table signatures */
432
433 SRMT ("m7f4")
434 If (Y223)
435 {
436 M7F4 (__METHOD__)
437 }
438 Else
439 {
440 BLCK ()
441 }
442 }