mb/google/brya/uldrenite: Add WWAN RW350R-GL power on sequence
[coreboot2.git] / src / arch / x86 / acpi / globutil.asl
blob8f530f4bd58b8512a350e4f83b00fefe18dfd4db
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /*
4 Scope(\_SB) {
5         #include "globutil.asl"
7 */
9 /* string compare functions */
10 Method(MIN, 2)
12         if (Arg0 < Arg1) {
13                 Return(Arg0)
14         } else {
15                 Return(Arg1)
16         }
19 Method(SLEN, 1)
21         Local0 = Arg0
22         Return(Sizeof(Local0))
25 Method(S2BF, 1, Serialized)
27         Local0 = SLEN(Arg0) + 1
28         Name(BUFF, Buffer(Local0) {})
29         BUFF = Arg0
30         Return(BUFF)
33 /* Strong string compare.  Checks both length and content */
34 Method(SCMP, 2)
36         Local0 = S2BF(Arg0)
37         Local1 = S2BF(Arg1)
38         Local4 = 0
39         Local5 = SLEN(Arg0)
40         Local6 = SLEN(Arg1)
41         Local7 = MIN(Local5, Local6)
43         While(Local4 < Local7) {
44                 Local2 = Derefof(Local0[Local4])
45                 Local3 = Derefof(Local1[Local4])
46                 if (Local2 > Local3) {
47                         Return(1)
48                 } else {
49                         if (Local2 < Local3) {
50                                 Return(Ones)
51                         }
52                 }
53                 Local4++
54         }
55         if (Local4 < Local5) {
56                 Return(1)
57         } else {
58                 if (Local4 < Local6) {
59                         Return(Ones)
60                 } else {
61                         Return(Zero)
62                 }
63         }
66 /* Weak string compare.  Checks to find Arg1 at beginning of Arg0.
67 * Fails if length(Arg0) < length(Arg1).  Returns 0 on Fail, 1 on
68 * Pass.
70 Method(WCMP, 2)
72         Local0 = S2BF(Arg0)
73         Local1 = S2BF(Arg1)
74         if (SLEN(Arg0) < SLEN(Arg1)) {
75                 Return(0)
76         }
77         Local2 = 0
78         Local3 = SLEN(Arg1)
80         While(Local2 < Local3) {
81                 if (Derefof(Local0[Local2]) != Derefof(Local1[Local2])) {
82                         Return(0)
83                 }
84                 Local2++
85         }
86         Return(1)
89 /* ARG0 = IRQ Number(0-15)
90 * Returns Bit Map
92 Method(I2BM, 1)
94         Local0 = 0
95         if (ARG0 != 0) {
96                 Local1 = 1
97                 Local0 = Local1 << ARG0
98         }
99         Return(Local0)