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     * Methods of common use.
30     */
31    /*
32     * Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp.
33     * All rights reserved.
34     *
35     * Redistribution and use in source and binary forms, with or without modification,
36     * are permitted provided that the following conditions are met:
37     *
38     * Redistributions of source code must retain the above copyright notice,
39     * this list of conditions and the following disclaimer.
40     * Redistributions in binary form must reproduce the above copyright notice,
41     * this list of conditions and the following disclaimer in the documentation
42     * and/or other materials provided with the distribution.
43     * Neither the name of Intel Corporation nor the names of its contributors
44     * may be used to endorse or promote products derived from this software
45     * without specific prior written permission.
46     *
47     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50     * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
51     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52     * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
53     * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
55     * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
56     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57     */
58    /*
59     * RefCounts of named objects are incremented
60     * and then decremented just after completions
61     * of operations applied to them - it is true
62     * for the following operations:
63     *
64     * - object used in AML operations except Index one
65     * - object passed as parameter to Method
66     *
67     * The following AML operations increment the RefCounts
68     * of objects which are decremented only while deleting
69     * the objects where the results of these operations are
70     * saved:
71     *
72     * - Index AML operation
73     * - RefOf AML operation
74     */
75    Method (M806, 0, Serialized)
76    {
77        Name (P000, Package (0x40){})
78        Name (P001, Package (0x40){})
79        Name (S000, "01234567890-qwertyuiop[]")
80        Name (B000, Buffer (0x07)
81        {
82             0x10, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17         // .......
83        })
84        Name (I000, 0xABCD0000)
85        Name (I001, 0xABCD0001)
86        Name (I002, 0xABCD0002)
87        Name (I003, 0xABCD0003)
88        Name (I004, 0xABCD0004)
89        Name (I005, 0xABCD0005)
90        Name (I006, 0xABCD0006)
91        Name (I007, 0xABCD0007)
92        Method (M000, 0, NotSerialized)
93        {
94            Store (S000 [0x00], P001 [0x04])
95            Store (S000 [0x00], P001 [0x04])
96        }
97
98        Method (M001, 0, NotSerialized)
99        {
100            Store (B000 [0x00], P001 [0x07])
101            Store (B000 [0x00], P001 [0x07])
102        }
103
104        M000 ()
105        M001 ()
106    }
107
108    Method (M807, 0, Serialized)
109    {
110        Name (P000, Package (0x40){})
111        Name (P001, Package (0x40){})
112        Name (S000, "01234567890-qwertyuiop[]")
113        Name (B000, Buffer (0x07)
114        {
115             0x10, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17         // .......
116        })
117        Name (I000, 0xABCD0000)
118        Name (I001, 0xABCD0001)
119        Name (I002, 0xABCD0002)
120        Name (I003, 0xABCD0003)
121        Name (I004, 0xABCD0004)
122        Name (I005, 0xABCD0005)
123        Name (I006, 0xABCD0006)
124        Name (I007, 0xABCD0007)
125        Method (MM00, 2, NotSerialized)
126        {
127            Method (M000, 0, NotSerialized)
128            {
129                Store (P000 [0x00], P001 [0x00])
130                Store (P000 [0x01], P001 [0x01])
131                Store (P000 [0x02], P001 [0x02])
132                Store (P000 [0x03], P001 [0x03])
133                Store (S000 [0x00], P001 [0x04])
134                Store (S000 [0x01], P001 [0x05])
135                Store (S000 [0x02], P001 [0x06])
136                Store (B000 [0x00], P001 [0x07])
137                Store (B000 [0x01], P001 [0x08])
138                Store (B000 [0x02], P001 [0x09])
139            }
140
141            Method (M001, 0, NotSerialized)
142            {
143                Store (P000 [0x00], P001 [0x00])
144                Store (P000 [0x01], P001 [0x01])
145                Store (P000 [0x02], P001 [0x02])
146                Store (P000 [0x03], P001 [0x03])
147                Store (P001 [0x00], P000 [0x00])
148                Store (P001 [0x01], P000 [0x01])
149                Store (P001 [0x02], P000 [0x02])
150                Store (P001 [0x03], P000 [0x03])
151                Store (S000 [0x00], P001 [0x04])
152                Store (S000 [0x01], P001 [0x05])
153                Store (S000 [0x02], P001 [0x06])
154                Store (B000 [0x00], P001 [0x07])
155                Store (B000 [0x01], P001 [0x08])
156                Store (B000 [0x02], P001 [0x09])
157            }
158
159            Method (M002, 0, NotSerialized)
160            {
161                Store (P000 [0x00], Local0)
162                Store (P000 [0x01], Local1)
163                Store (P000 [0x02], Local2)
164                Store (P000 [0x03], Local3)
165            }
166
167            Method (M003, 4, NotSerialized)
168            {
169                Store (P000 [0x00], Arg0)
170                Store (P000 [0x01], Arg1)
171                Store (P000 [0x02], Arg2)
172                Store (P000 [0x03], Arg3)
173            }
174
175            Method (M004, 4, NotSerialized)
176            {
177                Store (P000 [0x00], P001 [0x00])
178                Store (P000 [0x01], P001 [0x01])
179                Store (P000 [0x02], P001 [0x02])
180                Store (P000 [0x03], P001 [0x03])
181                Store (P001 [0x00], P000 [0x00])
182                Store (P001 [0x01], P000 [0x01])
183                Store (P001 [0x02], P000 [0x02])
184                Store (P001 [0x03], P000 [0x03])
185                Store (S000 [0x00], P001 [0x04])
186                Store (S000 [0x01], P001 [0x05])
187                Store (S000 [0x02], P001 [0x06])
188                Store (B000 [0x00], P001 [0x07])
189                Store (B000 [0x01], P001 [0x08])
190                Store (B000 [0x02], P001 [0x09])
191                Store (P000 [0x00], Local0)
192                Store (P000 [0x01], Local1)
193                Store (P000 [0x02], Local2)
194                Store (P000 [0x03], Local3)
195                Store (P000 [0x00], Arg0)
196                Store (P000 [0x01], Arg1)
197                Store (P000 [0x02], Arg2)
198                Store (P000 [0x03], Arg3)
199            }
200
201            Method (M005, 6, NotSerialized)
202            {
203                Store (Arg0 [0x00], Arg1 [0x00])
204                Store (Arg0 [0x01], Arg1 [0x01])
205                Store (Arg0 [0x02], Arg1 [0x02])
206                Store (Arg0 [0x03], Arg1 [0x03])
207                Store (Arg1 [0x00], Arg0 [0x00])
208                Store (Arg1 [0x01], Arg0 [0x01])
209                Store (Arg1 [0x02], Arg0 [0x02])
210                Store (Arg1 [0x03], Arg0 [0x03])
211                Store (S000 [0x00], P001 [0x04])
212                Store (S000 [0x01], P001 [0x05])
213                Store (S000 [0x02], P001 [0x06])
214                Store (B000 [0x00], P001 [0x07])
215                Store (B000 [0x01], P001 [0x08])
216                Store (B000 [0x02], P001 [0x09])
217                Store (Arg0 [0x00], Local0)
218                Store (Arg0 [0x01], Local1)
219                Store (Arg0 [0x02], Local2)
220                Store (Arg0 [0x03], Local3)
221                Store (Arg0 [0x00], Arg2)
222                Store (Arg0 [0x01], Arg3)
223                Store (Arg0 [0x02], Arg4)
224                Store (Arg0 [0x03], Arg5)
225            }
226
227            M000 ()
228            M001 ()
229            M002 ()
230            M003 (0x00, 0x00, 0x00, 0x00)
231            M004 (0x00, 0x00, 0x00, 0x00)
232            M005 (P000, P001, 0x00, 0x00, 0x00, 0x00)
233            M005 (Arg0, Arg1, 0x00, 0x00, 0x00, 0x00)
234        }
235
236        Method (MM01, 2, NotSerialized)
237        {
238            M000 ()
239            M001 ()
240            M002 ()
241            M003 (0x00, 0x00, 0x00, 0x00)
242            M004 (0x00, 0x00, 0x00, 0x00)
243            M005 (P000, P001, 0x00, 0x00, 0x00, 0x00)
244            M005 (Arg0, Arg1, 0x00, 0x00, 0x00, 0x00)
245        }
246
247        Method (M000, 0, NotSerialized)
248        {
249            Store (P000 [0x00], P001 [0x00])
250            Store (P000 [0x01], P001 [0x01])
251            Store (P000 [0x02], P001 [0x02])
252            Store (P000 [0x03], P001 [0x03])
253        }
254
255        Method (M001, 0, NotSerialized)
256        {
257            Store (P000 [0x00], P001 [0x00])
258            Store (P000 [0x01], P001 [0x01])
259            Store (P000 [0x02], P001 [0x02])
260            Store (P000 [0x03], P001 [0x03])
261            Store (P001 [0x00], P000 [0x00])
262            Store (P001 [0x01], P000 [0x01])
263            Store (P001 [0x02], P000 [0x02])
264            Store (P001 [0x03], P000 [0x03])
265        }
266
267        Method (M002, 0, NotSerialized)
268        {
269            Store (P000 [0x00], Local0)
270            Store (P000 [0x01], Local1)
271            Store (P000 [0x02], Local2)
272            Store (P000 [0x03], Local3)
273        }
274
275        Method (M003, 4, NotSerialized)
276        {
277            Store (P000 [0x00], Arg0)
278            Store (P000 [0x01], Arg1)
279            Store (P000 [0x02], Arg2)
280            Store (P000 [0x03], Arg3)
281        }
282
283        Method (M004, 4, NotSerialized)
284        {
285            Store (P000 [0x00], P001 [0x00])
286            Store (P000 [0x01], P001 [0x01])
287            Store (P000 [0x02], P001 [0x02])
288            Store (P000 [0x03], P001 [0x03])
289            Store (P001 [0x00], P000 [0x00])
290            Store (P001 [0x01], P000 [0x01])
291            Store (P001 [0x02], P000 [0x02])
292            Store (P001 [0x03], P000 [0x03])
293            Store (S000 [0x00], P001 [0x04])
294            Store (S000 [0x01], P001 [0x05])
295            Store (S000 [0x02], P001 [0x06])
296            Store (B000 [0x00], P001 [0x07])
297            Store (B000 [0x01], P001 [0x08])
298            Store (B000 [0x02], P001 [0x09])
299            Store (P000 [0x00], Local0)
300            Store (P000 [0x01], Local1)
301            Store (P000 [0x02], Local2)
302            Store (P000 [0x03], Local3)
303            Store (P000 [0x00], Arg0)
304            Store (P000 [0x01], Arg1)
305            Store (P000 [0x02], Arg2)
306            Store (P000 [0x03], Arg3)
307        }
308
309        Method (M005, 6, NotSerialized)
310        {
311            Store (Arg0 [0x00], Arg1 [0x00])
312            Store (Arg0 [0x01], Arg1 [0x01])
313            Store (Arg0 [0x02], Arg1 [0x02])
314            Store (Arg0 [0x03], Arg1 [0x03])
315            Store (Arg1 [0x00], Arg0 [0x00])
316            Store (Arg1 [0x01], Arg0 [0x01])
317            Store (Arg1 [0x02], Arg0 [0x02])
318            Store (Arg1 [0x03], Arg0 [0x03])
319            Store (S000 [0x00], P001 [0x04])
320            Store (S000 [0x01], P001 [0x05])
321            Store (S000 [0x02], P001 [0x06])
322            Store (B000 [0x00], P001 [0x07])
323            Store (B000 [0x01], P001 [0x08])
324            Store (B000 [0x02], P001 [0x09])
325            Store (Arg0 [0x00], Local0)
326            Store (Arg0 [0x01], Local1)
327            Store (Arg0 [0x02], Local2)
328            Store (Arg0 [0x03], Local3)
329            Store (Arg0 [0x00], Arg2)
330            Store (Arg0 [0x01], Arg3)
331            Store (Arg0 [0x02], Arg4)
332            Store (Arg0 [0x03], Arg5)
333        }
334
335        Method (M006, 0, Serialized)
336        {
337            Name (P000, Package (0x08){})
338            Name (P001, Package (0x08){})
339            P001 [0x00] = RefOf (P000)
340            P000 [0x00] = RefOf (P001)
341            P000 [0x01] = RefOf (P000)
342            P001 [0x01] = RefOf (P001)
343            /* Repeat the same */
344
345            P001 [0x00] = RefOf (P000)
346            P000 [0x00] = RefOf (P001)
347            P000 [0x01] = RefOf (P000)
348            P001 [0x01] = RefOf (P001)
349        }
350
351        M000 ()
352        M001 ()
353        M002 ()
354        M003 (0x00, 0x00, 0x00, 0x00)
355        M004 (0x00, 0x00, 0x00, 0x00)
356        M005 (P000, P001, 0x00, 0x00, 0x00, 0x00)
357        MM00 (P000, P001)
358        MM01 (P000, P001)
359        M006 ()
360    }
361
362    Method (M80F, 0, Serialized)
363    {
364        Name (IG00, 0xABCD0001)
365        Name (IR00, 0xABCD0002)
366        Method (M000, 0, Serialized)
367        {
368            Name (I000, 0xABCD0003)
369            CopyObject (RefOf (I000), IR00) /* \M80F.IR00 */
370        }
371
372        Method (M001, 1, Serialized)
373        {
374            Name (III0, 0xABCD0004)
375            Name (III1, 0xABCD0005)
376            Name (III2, 0xABCD0006)
377            Name (III3, 0xABCD0007)
378            Name (III4, 0xABCD0008)
379            Name (III5, 0xABCD0009)
380            Name (III6, 0xABCD000A)
381            Name (III7, 0xABCD000B)
382            CopyObject (DerefOf (IR00), Local0)
383            If ((Local0 != Arg0))
384            {
385                ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, Arg0)
386            }
387        }
388
389        M000 ()
390        M001 (0xABCD0003)
391    }
392
393    Method (M810, 0, Serialized)
394    {
395        Name (P000, Package (0x04)
396        {
397            0x00,
398            0x01,
399            0x02,
400            0x03
401        })
402        Method (M000, 0, NotSerialized)
403        {
404            Local0 = 0xABCD0009
405            P000 [0x02] = RefOf (Local0)
406        }
407
408        M000 ()
409    }
410
411    Method (M811, 0, Serialized)
412    {
413        Name (P000, Package (0x04)
414        {
415            0x00,
416            0x01,
417            0x02,
418            0x03
419        })
420        Method (M000, 0, NotSerialized)
421        {
422            P000 [0x02] = RefOf (Local0)
423        }
424
425        M000 ()
426    }
427
428    Method (M805, 0, NotSerialized)
429    {
430        SRMT ("m806")
431        M806 ()
432        SRMT ("m807")
433        If (Y135)
434        {
435            M807 ()
436        }
437        Else
438        {
439            BLCK ()
440        }
441
442        SRMT ("m80f")
443        M80F ()
444        SRMT ("m810")
445        M810 ()
446        SRMT ("m811")
447        M811 ()
448    }
449