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 type conversion and manipulation
30     *
31     * Find Object Match
32     */
33    /*
34     This is the initial point of designing the test of
35     functionality of Match operator not covered by match1.asl
36     (match1.asl - Match operator with Integer only).
37     */
38    /*
39     Prepare one Method (m330,m332...) with all the
40     p000,p001... mix differently the contents, so
41     traveling will be different...
42     */
43    /*
44     * Digital map of operations:
45     *
46     *                     MTR MEQ MLE MLT MGE MGT
47     *                       0   1   2   3   4   5
48     *                    ------------------------
49     * always TRUE ) MTR 0| 00  01  02  03  04  05
50     *          == ) MEQ 1| 10  11  12  13  14  15
51     *          <= ) MLE 2| 20  21  22  23  24  25
52     *          <  ) MLT 3| 30  31  32  33  34  35
53     *          >= ) MGE 4| 40  41  42  43  44  45
54     *          >  ) MGT 5| 50  51  52  53  54  55
55     *                    ------------------------
56     */
57    Name (Z075, 0x4B)
58    /*
59     // The same as m0df and m0e0 but all the values
60     // of Cases are in one Package
61     Method(m330, 1)
62     {
63     Name(i000, 0x12)
64     Name(s000, "12")
65     Name(b000, Buffer() {0x12})
66     Name(p000, Package() {0x12})
67     OperationRegion(r000, SystemMemory, 0x100, 0x100)
68     Field(r000, ByteAcc, NoLock, Preserve) { f000, 8 }
69     Device(d000) {}
70     Event(e000)
71     Method(m000) { return (0x12) }
72     Mutex(mx00, 0)
73     PowerResource(pwr0, 1, 0) {Method(m001){return (0)}}
74     Processor(prc0, 0, 0xFFFFFFFF, 0) {}
75     ThermalZone(tz00) {}
76     CreateField(b000, 0, 8, bf00)
77     Name(p001, Package(32) {
78     i000, s000, b000, p000, f000, d000, e000, m000,
79     mx00, r000, pwr0, prc0, tz00, bf00,
80     })
81     //	Store(0x12, Index(p001, 31))
82     Store(Match(p000, MEQ, arg0, MEQ, arg0, 0), Local0)
83     return (Local0)
84     }
85     Method(m331, 1)
86     {
87     Store(m330(0x12), Local0)
88     if (LNotEqual(Local0, Ones)) {
89     err(arg0, z075, __LINE__, 0, 0, Local0, Ones)
90     }
91     }
92     */
93    /*
94     // The same as m0df and m0e0 but all the values
95     // of Cases are in one Package
96     Method(m330, 1)
97     {
98     Name(p000, Package() {
99     // Buffer
100     Buffer(1){10},
101     Buffer(2){11,12},
102     Buffer() {13,14,15},
103     Buffer(2){16,17,18},
104     Buffer(3){19,20},
105     Buffer(3){21,22,23},
106     Buffer(4){24,25,26,27},
107     Buffer(5){28,29,30,31,32},
108     Buffer(8){33,34,35,36,37,38,39,40},
109     Buffer(){0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0},
110     Buffer(9){41,42,43,44,45,46,47,48,49},
111     Buffer(67){0x7d},
112     Buffer() {
113     0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,
114     0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
115     0x00,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
116     0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
117     0x10,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
118     0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
119     0x20,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
120     0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
121     0x30,0x41,0x42},
122     Buffer(67) {
123     0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,
124     0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
125     0x00,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
126     0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
127     0x10,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
128     0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
129     0x20,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
130     0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
131     0x30,0x41,0x42},
132     Buffer(4){0,0,0,0},
133     Buffer(8){0,0,0,0,0,0,0,0},
134     Buffer(4){0xff,0xff,0xff,0xff},
135     Buffer(9){0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
136     Buffer(8){0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
137     Buffer(5){0xff,0xff,0xff,0xff,0xff},
138     Buffer(1){0xff},
139     Buffer(1){},
140     Buffer(5){},
141     Buffer(9){},
142     Buffer(9){0xab, 0xcd, 0xef},
143     // String
144     "0321",
145     "321",
146     "ba9876",
147     "c179b3fe",
148     "fe7cb391d650a284",
149     "ffffffff",
150     "ffffffffffffffff",
151     "ffffffffff",
152     "ff",
153     "987654321",
154     "0xfe7cb3",
155     // Integer
156     0321,
157     9876543210,
158     0xc179b3fe,
159     0xfe7cb391d650a284,
160     0,
161     0xffffffff,
162     0xffffffffffffffff,
163     0xff,
164     0xabcdef
165     })
166     Store(Match(p000, MEQ, arg0, MEQ, arg0, 0), Local0)
167     return (Local0)
168     }
169     Method(m331, 1)
170     {
171     // Integer
172     Store(m330(0321), Local0)
173     if (LNotEqual(Local0, 36)) {
174     err(arg0, z075, __LINE__, Local0, 36)
175     }
176     Store(m330(0xd1), Local0)
177     if (LNotEqual(Local0, 36)) {
178     err(arg0, z075, __LINE__, Local0, 36)
179     }
180     Store(m330(9876543210), Local0)
181     if (F64) {
182     if (LNotEqual(Local0, 37)) {
183     err(arg0, z075, __LINE__, Local0, 37)
184     }
185     } else {
186     if (LNotEqual(Local0, 45)) {
187     err(arg0, z075, __LINE__, Local0, 45)
188     }
189     }
190     Store(m330(0xc179b3fe), Local0)
191     if (LNotEqual(Local0, 28)) {
192     err(arg0, z075, __LINE__, Local0, 28)
193     }
194     Store(m330(0xfe7cb391d650a284), Local0)
195     if (LNotEqual(Local0, 29)) {
196     err(arg0, z075, __LINE__, Local0, 29)
197     }
198     Store(m330(0), Local0)
199     if (LNotEqual(Local0, 14)) {
200     err(arg0, z075, __LINE__, Local0, 14)
201     }
202     Store(m330(0xffffffff), Local0)
203     if (LNotEqual(Local0, 16)) {
204     err(arg0, z075, __LINE__, Local0, 16)
205     }
206     Store(m330(0xffffffffffffffff), Local0)
207     if (F64) {
208     if (LNotEqual(Local0, 17)) {
209     err(arg0, z075, __LINE__, Local0, 17)
210     }
211     } else {
212     if (LNotEqual(Local0, 16)) {
213     err(arg0, z075, __LINE__, Local0, 16)
214     }
215     }
216     Store(m330(0xff), Local0)
217     if (LNotEqual(Local0, 20)) {
218     err(arg0, z075, __LINE__, Local0, 20)
219     }
220     Store(m330(0xabcdef), Local0)
221     if (LNotEqual(Local0, 44)) {
222     err(arg0, z075, __LINE__, Local0, 44)
223     }
224     }
225     // The same as m0e3 and m0e4 but all the values
226     // of Cases are in one Package
227     Method(m332, 1)
228     {
229     Name(p000, Package() {
230     // Integer
231     0321,
232     9876543210,
233     0xc179b3fe,
234     0xfe7cb391d650a284,
235     0,
236     0xffffffff,
237     0xffffffffffffffff,
238     0xff,
239     0xabcdef,
240     // Buffer
241     Buffer(1){10},
242     Buffer(2){11,12},
243     Buffer() {13,14,15},
244     Buffer(2){16,17,18},
245     Buffer(3){19,20},
246     Buffer(3){21,22,23},
247     Buffer(4){24,25,26,27},
248     Buffer(5){28,29,30,31,32},
249     Buffer(8){33,34,35,36,37,38,39,40},
250     Buffer(){0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0},
251     Buffer(9){41,42,43,44,45,46,47,48,49},
252     Buffer(67){0x7d},
253     Buffer() {
254     0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,
255     0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
256     0x00,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
257     0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
258     0x10,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
259     0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
260     0x20,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
261     0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
262     0x30,0x41,0x42},
263     Buffer(67) {
264     0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,
265     0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
266     0x00,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
267     0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
268     0x10,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
269     0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
270     0x20,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
271     0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
272     0x30,0x41,0x42},
273     Buffer(4){0,0,0,0},
274     Buffer(8){0,0,0,0,0,0,0,0},
275     Buffer(4){0xff,0xff,0xff,0xff},
276     Buffer(9){0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
277     Buffer(8){0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
278     Buffer(5){0xff,0xff,0xff,0xff,0xff},
279     Buffer(1){0xff},
280     Buffer(1){},
281     Buffer(5){},
282     Buffer(9){},
283     Buffer(9){0xab, 0xcd, 0xef},
284     // String
285     "0321",
286     "321",
287     "ba9876",
288     "c179b3fe",
289     "fe7cb391d650a284",
290     "ffffffff",
291     "ffffffffffffffffff",
292     "ffffffffffffffff",
293     "ffffffffff",
294     "ff",
295     "fe7cb391d650a2841",
296     "987654321",
297     "0xfe7cb3",
298     "1234q",
299     "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdf",
300     "",
301     " ",
302     "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?",
303     "abcdef",
304     "ABCDEF",
305     })
306     Store(Match(p000, MEQ, arg0, MEQ, arg0, 0), Local0)
307     return (Local0)
308     }
309     Method(m333, 1)
310     {
311     // String
312     if (0) {
313     Store(m332("0321"), Local0)
314     if (LNotEqual(Local0, 34)) {
315     err(arg0, z075, __LINE__, Local0, 34)
316     }
317     Store(m332("321"), Local0)
318     if (LNotEqual(Local0, 34)) {
319     err(arg0, z075, __LINE__, Local0, 34)
320     }
321     Store(m332("ba9876"), Local0)
322     if (LNotEqual(Local0, 36)) {
323     err(arg0, z075, __LINE__, Local0, 36)
324     }
325     Store(m332("c179b3fe"), Local0)
326     if (LNotEqual(Local0, 2)) {
327     err(arg0, z075, __LINE__, Local0, 2)
328     }
329     Store(m332("fe7cb391d650a284"), Local0)
330     if (LNotEqual(Local0, 3)) {
331     err(arg0, z075, __LINE__, Local0, 3)
332     }
333     Store(m332("ffffffff"), Local0)
334     if (LNotEqual(Local0, 5)) {
335     err(arg0, z075, __LINE__, Local0, 5)
336     }
337     }
338     Store(m332("ffffffffffffffffff"), Local0)
339     if (LNotEqual(Local0, 40)) {
340     err(arg0, z075, __LINE__, Local0, 40)
341     }
342     if (0) {
343     Store(m332("ffffffffffffffff"), Local0)
344     if (LNotEqual(Local0, 41)) {
345     err(arg0, z075, __LINE__, Local0, 41)
346     }
347     Store(m332("ffffffffff"), Local0)
348     if (LNotEqual(Local0, 42)) {
349     err(arg0, z075, __LINE__, Local0, 42)
350     }
351     Store(m332("ff"), Local0)
352     if (LNotEqual(Local0, 43)) {
353     err(arg0, z075, __LINE__, Local0, 43)
354     }
355     Store(m332("fe7cb391d650a2841"), Local0)
356     if (LNotEqual(Local0, 44)) {
357     err(arg0, z075, __LINE__, Local0, 44)
358     }
359     Store(m332("987654321"), Local0)
360     if (LNotEqual(Local0, 45)) {
361     err(arg0, z075, __LINE__, Local0, 45)
362     }
363     Store(m332("0xfe7cb3"), Local0)
364     if (LNotEqual(Local0, 46)) {
365     err(arg0, z075, __LINE__, Local0, 46)
366     }
367     Store(m332("1234q"), Local0)
368     if (LNotEqual(Local0, 47)) {
369     err(arg0, z075, __LINE__, Local0, 47)
370     }
371     Store(m332(BIG0), Local0)
372     if (LNotEqual(Local0, 48)) {
373     err(arg0, z075, __LINE__, Local0, 48)
374     }
375     Store(m332(""), Local0)
376     if (LNotEqual(Local0, 49)) {
377     err(arg0, z075, __LINE__, Local0, 49)
378     }
379     Store(m332(" "), Local0)
380     if (LNotEqual(Local0, 50)) {
381     err(arg0, z075, __LINE__, Local0, 50)
382     }
383     Store(m332(ALL0), Local0)
384     if (LNotEqual(Local0, 51)) {
385     err(arg0, z075, __LINE__, Local0, 51)
386     }
387     Store(m332("abcdef"), Local0)
388     if (LNotEqual(Local0, 52)) {
389     err(arg0, z075, __LINE__, Local0, 52)
390     }
391     Store(m332("ABCDEF"), Local0)
392     if (LNotEqual(Local0, 53)) {
393     err(arg0, z075, __LINE__, Local0, 53)
394     }
395     }
396     }
397     */
398    /* Run-method */
399    Method (MAT1, 0, Serialized)
400    {
401        Debug = "TEST: MAT1, Find Object Match"
402        /*	m331(ts) */
403    /*	m333(ts) */
404    }
405