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 161:
30     *
31     * SUMMARY: Named object passed as a BitIndex or NumBits to CreateField causes hang
32     *
33     * ROOT CAUSE
34     */
35    /* Global CreateField declarations */
36    Method (MD8F, 0, NotSerialized)
37    {
38        If ((BF32 != Buffer(){0x14}))
39        {
40            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF32, Buffer(){0x14})
41        }
42
43        If ((BF33 != Buffer(){0x15, 0x16}))
44        {
45            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF33, Buffer(){0x15, 0x16})
46        }
47    }
48
49    Method (MD90, 0, NotSerialized)
50    {
51        If ((BF34 != Buffer() {0x18}))
52        {
53            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF34, Buffer(){0x18})
54        }
55
56        If ((BF35 != Buffer() {0x19}))
57        {
58            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF35, Buffer(){0x19})
59        }
60    }
61
62    Method (MD91, 0, NotSerialized)
63    {
64        If ((BF36 != Buffer() {0x1A}))
65        {
66            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF36, Buffer(){0x1A})
67        }
68
69        If ((BF37 != Buffer(){0x1B, 0x1C}))
70        {
71            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF37, Buffer(){0x1B, 0x1C})
72        }
73    }
74
75    /* Local CreateField declarations, another buffer than used in md8f-md91 */
76
77    Method (MD92, 0, NotSerialized)
78    {
79        CreateField (BD02, 0x20, ID03, BF32)
80        CreateField (BD02, 0x28, (ID03 + 0x08), BF33)
81        If ((BF32 != Buffer(){0x14}))
82        {
83            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF32, Buffer(){0x14})
84        }
85
86        If ((BF33 != Buffer(){0x15, 0x16}))
87        {
88            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF33, Buffer(){0x15, 0x16})
89        }
90    }
91
92    Method (MD93, 0, NotSerialized)
93    {
94        CreateField (BD02, ID04, 0x08, BF34)
95        CreateField (BD02, (ID04 + 0x08), 0x08, BF35)
96        If ((BF34 != Buffer() {0x18}))
97        {
98            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF34, Buffer(){0x18})
99        }
100
101        If ((BF35 != Buffer() {0x19}))
102        {
103            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF35, Buffer(){0x19})
104        }
105    }
106
107    Method (MD94, 0, NotSerialized)
108    {
109        CreateField (BD02, ID05, ID06, BF36)
110        CreateField (BD02, (ID07 + 0x08), (ID08 + 0x08), BF37)
111        If ((BF36 != Buffer() {0x1A}))
112        {
113            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF36, Buffer(){0x1A})
114        }
115
116        If ((BF37 != Buffer(){0x1B, 0x1C}))
117        {
118            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF37, Buffer(){0x1B, 0x1C})
119        }
120    }
121
122    /* Local CreateField declarations, the same buffer that used in md8f-md91 */
123
124    Method (MD95, 0, NotSerialized)
125    {
126        CreateField (BD03, 0x20, ID03, BF32)
127        CreateField (BD03, 0x28, (ID03 + 0x08), BF33)
128        If ((BF32 != Buffer(){0x14}))
129        {
130            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF32, Buffer(){0x14})
131        }
132
133        If ((BF33 != Buffer(){0x15, 0x16}))
134        {
135            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF33, Buffer(){0x15, 0x16})
136        }
137    }
138
139    Method (MD96, 0, NotSerialized)
140    {
141        CreateField (BD03, ID04, 0x08, BF34)
142        CreateField (BD03, (ID04 + 0x08), 0x08, BF35)
143        If ((BF34 != Buffer() {0x18}))
144        {
145            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF34, Buffer(){0x18})
146        }
147
148        If ((BF35 != Buffer() {0x19}))
149        {
150            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF35, Buffer(){0x19})
151        }
152    }
153
154    Method (MD97, 0, NotSerialized)
155    {
156        CreateField (BD03, ID05, ID06, BF36)
157        CreateField (BD03, (ID07 + 0x08), (ID08 + 0x08), BF37)
158        If ((BF36 != Buffer() {0x1A}))
159        {
160            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF36, Buffer(){0x1A})
161        }
162
163        If ((BF37 != Buffer(){0x1B, 0x1C}))
164        {
165            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, BF37, Buffer(){0x1B, 0x1C})
166        }
167    }
168
169    Method (M075, 6, Serialized)
170    {
171        Name (B000, Buffer (0x08)
172        {
173             0x5D, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18   // ].......
174        })
175        If ((Arg0 != 0x01))
176        {
177            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg0, 0x01)
178        }
179
180        If ((Arg1 != 0x5D))
181        {
182            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg1, 0x5D)
183        }
184
185        If ((Arg2 != 0x125D))
186        {
187            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg2, 0x125D)
188        }
189
190        If ((Arg3 != 0x1413125D))
191        {
192            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg3, 0x1413125D)
193        }
194
195        If (F64)
196        {
197            If ((Arg4 != 0x181716151413125D))
198            {
199                ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg4, 0x181716151413125D)
200            }
201        }
202        ElseIf ((Arg4 != B000))
203        {
204            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg4, B000)
205        }
206
207        If ((Arg5 != Buffer(){0x5D}))
208        {
209            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg5, Buffer(){0x5D})
210        }
211    }
212
213    Method (M076, 2, NotSerialized)
214    {
215        If ((Arg0 != Buffer(){0x5D}))
216        {
217            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg0, Buffer(){0x5D})
218        }
219
220        If ((Arg1 != Buffer(){0x5D}))
221        {
222            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Arg1, Buffer(){0x5D})
223        }
224    }
225
226    Method (MD98, 0, NotSerialized)
227    {
228        MD8F ()
229        MD90 ()
230        MD91 ()
231        MD92 ()
232        MD93 ()
233        MD94 ()
234        MD95 ()
235        MD96 ()
236        MD97 ()
237    }
238
239    Method (MF7F, 0, NotSerialized)
240    {
241        SRMT ("mf7f-0")
242        M075 (BF40, BF41, BF42, BF43, BF44, BF45)
243        SRMT ("mf7f-1")
244        M075 (BF46, BF47, BF48, BF49, BF4A, BF4B)
245        M076 (BF4C, BF4D)
246    }
247
248    Method (M077, 0, Serialized)
249    {
250        CreateBitField (BD03, 0x08, BF40)
251        CreateByteField (BD03, 0x01, BF41)
252        CreateWordField (BD03, 0x01, BF42)
253        CreateDWordField (BD03, 0x01, BF43)
254        CreateQWordField (BD03, 0x01, BF44)
255        CreateField (BD03, 0x08, 0x08, BF45)
256        Name (ID21, 0x01)
257        Name (ID22, 0x08)
258        CreateBitField (BD03, ID22, BF46)
259        CreateByteField (BD03, ID21, BF47)
260        CreateWordField (BD03, ID21, BF48)
261        CreateDWordField (BD03, ID21, BF49)
262        CreateQWordField (BD03, ID21, BF4A)
263        CreateField (BD03, 0x08, ID22, BF4B)
264        CreateField (BD03, ID22, 0x08, BF4C)
265        CreateField (BD03, ID22, ID22, BF4D)
266        SRMT ("m077-0")
267        M075 (BF40, BF41, BF42, BF43, BF44, BF45)
268        SRMT ("m077-1")
269        M075 (BF46, BF47, BF48, BF49, BF4A, BF4B)
270        M076 (BF4C, BF4D)
271    }
272
273    Method (MF83, 0, NotSerialized)
274    {
275        Local0 = 0x01
276        Local1 = 0x08
277        CreateBitField (BD03, Local1, BF46)
278        CreateByteField (BD03, Local0, BF47)
279        CreateWordField (BD03, Local0, BF48)
280        CreateDWordField (BD03, Local0, BF49)
281        CreateQWordField (BD03, Local0, BF4A)
282        CreateField (BD03, 0x08, Local1, BF4B)
283        CreateField (BD03, Local1, 0x08, BF4C)
284        CreateField (BD03, Local1, Local1, BF4D)
285        SRMT ("mf83")
286        M075 (BF46, BF47, BF48, BF49, BF4A, BF4B)
287        M076 (BF4C, BF4D)
288    }
289
290    Method (MF84, 2, NotSerialized)
291    {
292        CreateBitField (BD03, Arg1, BF46)
293        CreateByteField (BD03, Arg0, BF47)
294        CreateWordField (BD03, Arg0, BF48)
295        CreateDWordField (BD03, Arg0, BF49)
296        CreateQWordField (BD03, Arg0, BF4A)
297        CreateField (BD03, 0x08, Arg1, BF4B)
298        CreateField (BD03, Arg1, 0x08, BF4C)
299        CreateField (BD03, Arg1, Arg1, BF4D)
300        SRMT ("mf84")
301        M075 (BF46, BF47, BF48, BF49, BF4A, BF4B)
302        M076 (BF4C, BF4D)
303    }
304