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     * Bug 167:
30     *
31     * SUMMARY: Manipulation test PASS but started reporting suspicious diagnostic
32     *
33     * Check that messages doesn't occur...
34     * but since it was due to the incorrect size of Package
35     * generated in that case we do this test as runtime test
36     * (but not ACTION_REQUIRED type).
37     *
38     * NOTE:    checking of AE_AML_METHOD_LIMIT limits (32 and 256)
39     *          should be performed in a separate tests (see plan/addition).
40     *
41     * This is regression.
42     * It did not take place earlier.
43     * Our test (manipulation) results in PASS, and no exceptions,
44     * but some diagnostic information is suspicious (see below).
45     * The anomalies are revealed by the test package.asl,
46     * methods m1f3 and m203. See attachment.
47     * .........
48     */
49    /* gr1.asl */
50    Method (MF54, 0, Serialized)
51    {
52        Name (P000, Package (0x0100)
53        {
54            0x01,
55            0x02,
56            0x03,
57            0x04,
58            0x05,
59            0x06,
60            0x07,
61            0x08,
62            0x09,
63            0x0A,
64            0x0B,
65            0x0C,
66            0x0D,
67            0x0E,
68            0x0F,
69            0x10,
70            0x11,
71            0x12,
72            0x13,
73            0x14,
74            0x15,
75            0x16,
76            0x17,
77            0x18,
78            0x19,
79            0x1A,
80            0x1B,
81            0x1C,
82            0x1D,
83            0x1E,
84            0x1F,
85            0x20,
86            0x21,
87            0x22,
88            0x23,
89            0x24,
90            0x25,
91            0x26,
92            0x27,
93            0x28,
94            0x29,
95            0x2A,
96            0x2B,
97            0x2C,
98            0x2D,
99            0x2E,
100            0x2F,
101            0x30,
102            0x31,
103            0x32,
104            0x33,
105            0x34,
106            0x35,
107            0x36,
108            0x37,
109            0x38,
110            0x39,
111            0x3A,
112            0x3B,
113            0x3C,
114            0x3D,
115            0x3E,
116            0x3F,
117            0x40,
118            0x41,
119            0x42,
120            0x43,
121            0x44,
122            0x45,
123            0x46,
124            0x47,
125            0x48,
126            0x49,
127            0x4A,
128            0x4B,
129            0x4C,
130            0x4D,
131            0x4E,
132            0x4F,
133            0x50,
134            0x51,
135            0x52,
136            0x53,
137            0x54,
138            0x55,
139            0x56,
140            0x57,
141            0x58,
142            0x59,
143            0x5A,
144            0x5B,
145            0x5C,
146            0x5D,
147            0x5E,
148            0x5F,
149            0x60,
150            0x61,
151            0x62,
152            0x63,
153            0x64,
154            0x65,
155            0x66,
156            0x67,
157            0x68,
158            0x69,
159            0x6A,
160            0x6B,
161            0x6C,
162            0x6D,
163            0x6E,
164            0x6F,
165            0x70,
166            0x71,
167            0x72,
168            0x73,
169            0x74,
170            0x75,
171            0x76,
172            0x77,
173            0x78,
174            0x79,
175            0x7A,
176            0x7B,
177            0x7C,
178            0x7D,
179            0x7E,
180            0x7F,
181            0x80,
182            0x81,
183            0x82,
184            0x83,
185            0x84,
186            0x85,
187            0x86,
188            0x87,
189            0x88,
190            0x89,
191            0x8A,
192            0x8B,
193            0x8C,
194            0x8D,
195            0x8E,
196            0x8F,
197            0x90,
198            0x91,
199            0x92,
200            0x93,
201            0x94,
202            0x95,
203            0x96,
204            0x97,
205            0x98,
206            0x99,
207            0x9A,
208            0x9B,
209            0x9C,
210            0x9D,
211            0x9E,
212            0x9F,
213            0xA0,
214            0xA1,
215            0xA2,
216            0xA3,
217            0xA4,
218            0xA5,
219            0xA6,
220            0xA7,
221            0xA8,
222            0xA9,
223            0xAA,
224            0xAB,
225            0xAC,
226            0xAD,
227            0xAE,
228            0xAF,
229            0xB0,
230            0xB1,
231            0xB2,
232            0xB3,
233            0xB4,
234            0xB5,
235            0xB6,
236            0xB7,
237            0xB8,
238            0xB9,
239            0xBA,
240            0xBB,
241            0xBC,
242            0xBD,
243            0xBE,
244            0xBF,
245            0xC0,
246            0xC1,
247            0xC2,
248            0xC3,
249            0xC4,
250            0xC5,
251            0xC6,
252            0xC7,
253            0xC8,
254            0xC9,
255            0xCA,
256            0xCB,
257            0xCC,
258            0xCD,
259            0xCE,
260            0xCF,
261            0xD0,
262            0xD1,
263            0xD2,
264            0xD3,
265            0xD4,
266            0xD5,
267            0xD6,
268            0xD7,
269            0xD8,
270            0xD9,
271            0xDA,
272            0xDB,
273            0xDC,
274            0xDD,
275            0xDE,
276            0xDF,
277            0xE0,
278            0xE1,
279            0xE2,
280            0xE3,
281            0xE4,
282            0xE5,
283            0xE6,
284            0xE7,
285            0xE8,
286            0xE9,
287            0xEA,
288            0xEB,
289            0xEC,
290            0xED,
291            0xEE,
292            0xEF,
293            0xF0,
294            0xF1,
295            0xF2,
296            0xF3,
297            0xF4,
298            0xF5,
299            0xF6,
300            0xF7,
301            0xF8,
302            0xF9,
303            0xFA,
304            0xFB,
305            0xFC,
306            0xFD,
307            0xFE,
308            0xFF,
309            0x0100
310        })
311        Local0 = SizeOf (P000)
312        If ((Local0 != 0x0100))
313        {
314            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, 0x0100)
315        }
316        Else
317        {
318            Local1 = 0x01
319            Local2 = 0x00
320            While (Local0)
321            {
322                Local3 = DerefOf (P000 [Local2])
323                If ((Local3 != Local1))
324                {
325                    ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local3, Local1)
326                    Break
327                }
328
329                Local0--
330                Local1++
331                Local2++
332            }
333
334            If (!Local0)
335            {
336                Debug = "Ok"
337            }
338        }
339    }
340
341    /* gr2.asl */
342
343    Method (MF55, 1, NotSerialized)
344    {
345        If (Arg0)
346        {
347            Return ((Arg0 * MF55 ((Arg0 - 0x01))))
348        }
349        Else
350        {
351            Return (0x01)
352        }
353    }
354
355    Method (MF56, 0, NotSerialized)
356    {
357        Debug = "mf55(4):"
358        MF55 (0x04)
359        Debug = "mf55(25):"
360        MF55 (0x19)
361    }
362
363    /* gr3.asl */
364
365    Method (MF57, 0, Serialized)
366    {
367        Name (I000, 0x00)
368        Method (MM00, 1, NotSerialized)
369        {
370            I000++
371            If (Arg0)
372            {
373                MM01 ()
374            }
375        }
376
377        Method (MM01, 0, NotSerialized)
378        {
379            MM00 (0x00)
380        }
381
382        I000 = 0x00
383        MM00 (0x00)
384        If ((I000 != 0x01))
385        {
386            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, I000, 0x01)
387        }
388
389        I000 = 0x00
390        MM00 (0x01)
391        If ((I000 != 0x02))
392        {
393            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, I000, 0x02)
394        }
395    }
396