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     *  String
30     *
31     * (verify exceptions caused by the imprope use of String type objects)
32     */
33    Name (Z094, 0x5E)
34    Name (S100, "1")
35    /* Expected exceptions: */
36    /* */
37    /* 47 - AE_AML_OPERAND_TYPE */
38    /*  5 - AE_NOT_FOUND (when DerefOf(String)) */
39    /* */
40    /* Note: String can be used with DerefOf and Index */
41    Method (M4B2, 1, Serialized)
42    {
43        Name (S000, "2")
44        /* Local Named Object */
45
46        Method (M000, 1, Serialized)
47        {
48            Name (S000, "3")
49            /* DerefOf */
50
51            If (Y083)
52            {
53                Local1 = DerefOf (S000)
54                CH06 (Arg0, 0x00, 0x2F)
55            }
56
57            /* Index */
58
59            Local1 = S000 [0x00]
60            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
61            /* ConcatenateResTemplate */
62
63            ConcatenateResTemplate (S000, Buffer (0x02)
64                {
65                     0x79, 0x00                                       // y.
66                }, Local1)
67            CH06 (Arg0, 0x03, 0x2F)
68            ConcatenateResTemplate (Buffer (0x02)
69                {
70                     0x79, 0x00                                       // y.
71                }, S000, Local1)
72            CH06 (Arg0, 0x04, 0x2F)
73        }
74
75        /* Global Named Object */
76
77        Method (M001, 1, NotSerialized)
78        {
79            If (Y083)
80            {
81                Local1 = DerefOf (S100)
82                CH06 (Arg0, 0x05, 0x2F)
83            }
84
85            /* Index */
86
87            Local1 = S100 [0x00]
88            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
89            /* ConcatenateResTemplate */
90
91            ConcatenateResTemplate (S100, Buffer (0x02)
92                {
93                     0x79, 0x00                                       // y.
94                }, Local1)
95            CH06 (Arg0, 0x08, 0x2F)
96            ConcatenateResTemplate (Buffer (0x02)
97                {
98                     0x79, 0x00                                       // y.
99                }, S100, Local1)
100            CH06 (Arg0, 0x09, 0x2F)
101        }
102
103        /* Argument */
104
105        Method (M002, 2, NotSerialized)
106        {
107            /* DerefOf */
108
109            Local1 = DerefOf (Arg1)
110            CH06 (Arg0, 0x0A, 0x2F)
111            /* Release */
112
113            Release (Arg1)
114            CH06 (Arg0, 0x0B, 0x2F)
115            /* Reset */
116
117            Reset (Arg1)
118            CH06 (Arg0, 0x0C, 0x2F)
119            /* Signal */
120
121            Signal (Arg1)
122            CH06 (Arg0, 0x0D, 0x2F)
123            /* Acquire */
124
125            Local1 = Acquire (Arg1, 0x0000)
126            CH06 (Arg0, 0x0E, 0x2F)
127            /* ConcatenateResTemplate */
128
129            ConcatenateResTemplate (Arg1, Buffer (0x02)
130                {
131                     0x79, 0x00                                       // y.
132                }, Local1)
133            CH06 (Arg0, 0x11, 0x2F)
134            ConcatenateResTemplate (Buffer (0x02)
135                {
136                     0x79, 0x00                                       // y.
137                }, Arg1, Local1)
138            CH06 (Arg0, 0x12, 0x2F)
139            /* Index */
140
141            Local1 = Arg1 [0x00]
142            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
143            /* Wait */
144
145            Local1 = Wait (Arg1, 0x00)
146            CH06 (Arg0, 0x13, 0x2F)
147            /* Match */
148
149            Local1 = Match (Arg1, MTR, 0x00, MTR, 0x00, 0x00)
150            CH06 (Arg0, 0x14, 0x2F)
151        }
152
153        /* Local */
154
155        Method (M003, 1, NotSerialized)
156        {
157            Local0 = "3"
158            /* DerefOf */
159
160            Local1 = DerefOf (Local0)
161            CH06 (Arg0, 0x15, 0x2F)
162            /* Release */
163
164            Release (Local0)
165            CH06 (Arg0, 0x16, 0x2F)
166            /* Reset */
167
168            Reset (Local0)
169            CH06 (Arg0, 0x17, 0x2F)
170            /* Signal */
171
172            Signal (Local0)
173            CH06 (Arg0, 0x18, 0x2F)
174            /* Acquire */
175
176            Local1 = Acquire (Local0, 0x0000)
177            CH06 (Arg0, 0x19, 0x2F)
178            /* ConcatenateResTemplate */
179
180            ConcatenateResTemplate (Local0, Buffer (0x02)
181                {
182                     0x79, 0x00                                       // y.
183                }, Local1)
184            CH06 (Arg0, 0x1C, 0x2F)
185            ConcatenateResTemplate (Buffer (0x02)
186                {
187                     0x79, 0x00                                       // y.
188                }, Local0, Local1)
189            CH06 (Arg0, 0x1D, 0x2F)
190            /* Index */
191
192            Local1 = Local0 [0x00]
193            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
194            /* Wait */
195
196            Local1 = Wait (Local0, 0x00)
197            CH06 (Arg0, 0x1E, 0x2F)
198            /* Match */
199
200            Local1 = Match (Local0, MTR, 0x00, MTR, 0x00, 0x00)
201            CH06 (Arg0, 0x1F, 0x2F)
202        }
203
204        /* An element of Package */
205
206        Method (M004, 1, Serialized)
207        {
208            Name (P000, Package (0x01)
209            {
210                "3"
211            })
212            /* DeRefOf(Index(Package, Ind)) */
213
214            Local1 = DerefOf (DerefOf (P000 [0x00]))
215            CH06 (Arg0, 0x20, 0x05)
216            Store (DerefOf (P000 [0x00]) [0x00], Local1)
217            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
218            Local1 = Match (DerefOf (P000 [0x00]), MTR, 0x00, MTR, 0x00,
219                0x00)
220            CH06 (Arg0, 0x21, 0x2F)
221            /* DeRefOf(Index(Package, Ind, Dest)) */
222
223            Local1 = DerefOf (DerefOf (Local0 = P000 [0x00]))
224            CH06 (Arg0, 0x22, 0x05)
225            Store (DerefOf (Local0 = P000 [0x00]) [0x00], Local1)
226            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
227            Local1 = Match (DerefOf (Local0 = P000 [0x00]), MTR, 0x00, MTR, 0x00,
228                0x00)
229            CH06 (Arg0, 0x23, 0x2F)
230        }
231
232        /* Reference to Object */
233
234        Method (M005, 2, NotSerialized)
235        {
236            Debug = Arg0
237            Debug = Arg1
238            Local0 = ObjectType (Arg1)
239            If ((Local0 != 0x02))
240            {
241                ERR (Arg0, Z094, __LINE__, 0x00, 0x00, Local0, 0x02)
242                Return (0x01)
243            }
244
245            Local1 = DerefOf (Arg1)
246            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
247            Local1 = DerefOf (DerefOf (Arg1))
248            CH06 (Arg0, 0x25, 0x05)
249            Store (DerefOf (Arg1) [0x00], Local1)
250            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
251            Local1 = Match (DerefOf (Arg1), MTR, 0x00, MTR, 0x00, 0x00)
252            CH06 (Arg0, 0x26, 0x2F)
253            Return (0x00)
254        }
255
256        /* Result of Method invocation */
257
258        Method (M006, 1, Serialized)
259        {
260            Name (I000, 0x00) /* Label to check m000 invocations */
261            Method (M000, 1, NotSerialized)
262            {
263                I000 = Arg0
264                Local0 = "3"
265                Return (Local0)
266            }
267
268            Method (CH00, 2, NotSerialized)
269            {
270                If ((I000 != Arg1))
271                {
272                    ERR (Arg0, Z094, __LINE__, 0x00, 0x00, I000, Arg1)
273                }
274            }
275
276            Local1 = DerefOf (M000 (0x01))
277            CH06 (Arg0, 0x28, 0x05)
278            CH00 (Arg0, 0x01)
279            Release (M000 (0x02))
280            CH06 (Arg0, 0x29, 0x2F)
281            If (Y600)
282            {
283                CH00 (Arg0, 0x02)
284            }
285
286            Reset (M000 (0x03))
287            CH06 (Arg0, 0x2A, 0x2F)
288            If (Y600)
289            {
290                CH00 (Arg0, 0x03)
291            }
292
293            Signal (M000 (0x04))
294            CH06 (Arg0, 0x2B, 0x2F)
295            If (Y600)
296            {
297                CH00 (Arg0, 0x04)
298            }
299
300            Local1 = Acquire (M000 (0x05), 0x0000)
301            CH06 (Arg0, 0x2C, 0x2F)
302            If (Y600)
303            {
304                CH00 (Arg0, 0x05)
305            }
306
307            CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
308            Store (M000 (0x06) [0x00], Local1)
309            If (Y900)
310            {
311                CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
312                CH00 (Arg0, 0x06)
313            }
314            Else
315            {
316                CH04 (__METHOD__, 0x00, 0x55, Z094, __LINE__, 0x00, 0x00) /* AE_INDEX_TO_NOT_ATTACHED */
317            }
318
319            Local1 = Wait (M000 (0x07), 0x00)
320            CH06 (Arg0, 0x2D, 0x2F)
321            If (Y600)
322            {
323                CH00 (Arg0, 0x07)
324            }
325
326            Local1 = Match (M000 (0x08), MTR, 0x00, MTR, 0x00, 0x00)
327            CH06 (Arg0, 0x2E, 0x2F)
328            CH00 (Arg0, 0x08)
329        }
330
331        /* Reference to Object as Result of Method invocation */
332
333        Method (M007, 1, Serialized)
334        {
335            Name (S000, "3")
336            Name (I000, 0x00) /* Label to check m000 invocations */
337            Method (M000, 2, NotSerialized)
338            {
339                I000 = Arg0
340                If ((Arg1 == 0x00))
341                {
342                    Local0 = RefOf (S100)
343                }
344                ElseIf ((Arg1 == 0x01))
345                {
346                    Local0 = RefOf (S000)
347                }
348
349                Return (Local0)
350            }
351
352            Method (CH00, 2, NotSerialized)
353            {
354                If ((I000 != Arg1))
355                {
356                    ERR (Arg0, Z094, __LINE__, 0x00, 0x00, I000, Arg1)
357                }
358            }
359
360            Name (LPN0, 0x02)
361            Name (LPC0, 0x00)
362            While (LPN0)
363            {
364                Local0 = (0x03 * LPC0) /* \M4B2.M007.LPC0 */
365                I000 = 0x00
366                Local1 = DerefOf (M000 (0x01, LPC0))
367                CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
368                CH00 (Arg0, 0x01)
369                Local1 = DerefOf (DerefOf (M000 (0x02, LPC0)))
370                CH06 (Arg0, (0x30 + Local0), 0x2F)
371                CH00 (Arg0, 0x02)
372                Store (DerefOf (M000 (0x03, LPC0)) [0x00], Local1)
373                CH06 (Arg0, (0x31 + Local0), 0x2F)
374                CH00 (Arg0, 0x03)
375                Local1 = Match (DerefOf (M000 (0x04, LPC0)), MTR, 0x00, MTR, 0x00, 0x00)
376                CH06 (Arg0, (0x32 + Local0), 0x2F)
377                CH00 (Arg0, 0x04)
378                LPN0--
379                LPC0++
380            }
381        }
382
383        CH03 (__METHOD__, Z094, __LINE__, 0x00, 0x00)
384        /* Local Named Object */
385
386        M000 (__METHOD__)
387        /* Global Named Object */
388
389        M001 (__METHOD__)
390        /* Argument */
391
392        M002 (__METHOD__, "2")
393        /* Local */
394
395        M003 (__METHOD__)
396        /* An element of Package */
397
398        M004 (__METHOD__)
399        /* Reference to Local Named Object */
400
401        M005 (Concatenate (__METHOD__, "-m005-RefLocName"), RefOf (S000))
402        Local0 = RefOf (S000)
403        M005 (Concatenate (__METHOD__, "-m005-RefLocName2"), Local0)
404        CondRefOf (S000, Local0)
405        M005 (Concatenate (__METHOD__, "-m005-CondRefLocName"), Local0)
406        M005 (Concatenate (__METHOD__, "-m005-RefGlobName"), RefOf (S100))
407        Local0 = RefOf (S100)
408        M005 (Concatenate (__METHOD__, "-m005-RefGlobName2"), Local0)
409        CondRefOf (S100, Local0)
410        M005 (Concatenate (__METHOD__, "-m005-CondRefGlobName"), Local0)
411        /* Reference to Local */
412
413        Local0 = "2"
414        M005 (Concatenate (__METHOD__, "-m005-RefLocal"), RefOf (Local0))
415        Local1 = RefOf (Local0)
416        M005 (Concatenate (__METHOD__, "-m005-RefLocal2"), Local1)
417        CondRefOf (Local0, Local1)
418        M005 (Concatenate (__METHOD__, "-m005-CondRefLocal"), Local1)
419        /* Reference to Arg */
420
421        M005 (Concatenate (__METHOD__, "-m005-RefArg"), RefOf (Arg0))
422        Local0 = RefOf (Arg0)
423        M005 (Concatenate (__METHOD__, "-m005-RefArg2"), Local0)
424        CondRefOf (Arg0, Local0)
425        M005 (Concatenate (__METHOD__, "-m005-CondRefArg"), Local0)
426        /* Index to Package */
427
428        Name (P000, Package (0x01)
429        {
430            "2"
431        })
432        If (Y113)
433        {
434            M005 (Concatenate (__METHOD__, "-m005-Index"), P000 [0x00])
435        }
436
437        Store (P000 [0x00], Local0)
438        M005 (Concatenate (__METHOD__, "-m005-Index2"), Local0)
439        If (Y113)
440        {
441            M005 (Concatenate (__METHOD__, "-m005-Index3"), Local0 = P000 [0x00])
442        }
443
444        Local0 = P000 [0x00]
445        M005 (Concatenate (__METHOD__, "-m005-Index4"), Local0)
446        Local1 = Local0 = P000 [0x00]
447        M005 (Concatenate (__METHOD__, "-m005-Index5"), Local1)
448        /* Result of Method invocation */
449
450        M006 (__METHOD__)
451        /* Reference to Object as Result of Method invocation */
452
453        If (Y500)
454        {
455            M007 (__METHOD__)
456        }
457    }
458