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     * Resource Descriptor macros
30     *
31     * PinFunction Resource Descriptor Macro
32     */
33    Name (P45C, Package (0x09)
34    {
35        ResourceTemplate ()
36        {
37            PinFunction (Exclusive, PullDefault, 0x1000, "\\_SB.GPO1", 0x00,
38                ResourceConsumer, ,
39                RawDataBuffer (0x04)  // Vendor Data
40                {
41                    0x0A, 0x0B, 0x0C, 0x0D
42                })
43                {   // Pin list
44                    0x0001,
45                    0x0002,
46                    0x0003
47                }
48        },
49
50        ResourceTemplate ()
51        {
52            PinFunction (Exclusive, PullDown, 0x2000, "\\_SB.GPO1", 0x00,
53                ResourceConsumer, ,
54                RawDataBuffer (0x04)  // Vendor Data
55                {
56                    0x0A, 0x0B, 0x0C, 0x0D
57                })
58                {   // Pin list
59                    0x0001,
60                    0x0002,
61                    0x0003
62                }
63        },
64
65        ResourceTemplate ()
66        {
67            PinFunction (Exclusive, PullUp, 0x3000, "\\_SB.GPO1", 0x00,
68                ResourceConsumer, ,
69                RawDataBuffer (0x04)  // Vendor Data
70                {
71                    0x0A, 0x0B, 0x0C, 0x0D
72                })
73                {   // Pin list
74                    0x0001,
75                    0x0002,
76                    0x0003
77                }
78        },
79
80        ResourceTemplate ()
81        {
82            PinFunction (Exclusive, PullNone, 0x4000, "\\_SB.GPO1", 0x00,
83                ResourceConsumer, ,
84                RawDataBuffer (0x04)  // Vendor Data
85                {
86                    0x0A, 0x0B, 0x0C, 0x0D
87                })
88                {   // Pin list
89                    0x0001,
90                    0x0002,
91                    0x0003
92                }
93        },
94
95        ResourceTemplate ()
96        {
97            PinFunction (Shared, PullDefault, 0x1000, "\\_SB.GPO1", 0x00,
98                ResourceConsumer, ,
99                RawDataBuffer (0x04)  // Vendor Data
100                {
101                    0x0A, 0x0B, 0x0C, 0x0D
102                })
103                {   // Pin list
104                    0x0001,
105                    0x0002,
106                    0x0003
107                }
108        },
109
110        ResourceTemplate ()
111        {
112            PinFunction (Shared, PullDown, 0x2000, "\\_SB.GPO1", 0x00,
113                ResourceConsumer, ,
114                RawDataBuffer (0x04)  // Vendor Data
115                {
116                    0x0A, 0x0B, 0x0C, 0x0D
117                })
118                {   // Pin list
119                    0x0001,
120                    0x0002,
121                    0x0003
122                }
123        },
124
125        ResourceTemplate ()
126        {
127            PinFunction (Shared, PullUp, 0x3000, "\\_SB.GPO1", 0x00,
128                ResourceConsumer, ,
129                RawDataBuffer (0x04)  // Vendor Data
130                {
131                    0x0A, 0x0B, 0x0C, 0x0D
132                })
133                {   // Pin list
134                    0x0001,
135                    0x0002,
136                    0x0003
137                }
138        },
139
140        ResourceTemplate ()
141        {
142            PinFunction (Shared, PullNone, 0x4000, "\\_SB.GPO1", 0x00,
143                ResourceConsumer, ,
144                RawDataBuffer (0x04)  // Vendor Data
145                {
146                    0x0A, 0x0B, 0x0C, 0x0D
147                })
148                {   // Pin list
149                    0x0001,
150                    0x0002,
151                    0x0003
152                }
153        },
154
155        ResourceTemplate ()
156        {
157            PinFunction (Exclusive, PullNone, 0xABCD, "\\_SB.GPO1", 0x00,
158                ResourceConsumer, ,)
159                {   // Pin list
160                    0x0011
161                }
162        }
163    })
164    Name (P45D, Package (0x09)
165    {
166        ResourceTemplate ()
167        {
168            PinFunction (Exclusive, PullDefault, 0x1000, "\\_SB.GPO1", 0x00,
169                ResourceConsumer, ,
170                RawDataBuffer (0x04)  // Vendor Data
171                {
172                    0x0A, 0x0B, 0x0C, 0x0D
173                })
174                {   // Pin list
175                    0x0001,
176                    0x0002,
177                    0x0003
178                }
179        },
180
181        ResourceTemplate ()
182        {
183            PinFunction (Exclusive, PullDown, 0x2000, "\\_SB.GPO1", 0x00,
184                ResourceConsumer, ,
185                RawDataBuffer (0x04)  // Vendor Data
186                {
187                    0x0A, 0x0B, 0x0C, 0x0D
188                })
189                {   // Pin list
190                    0x0001,
191                    0x0002,
192                    0x0003
193                }
194        },
195
196        ResourceTemplate ()
197        {
198            PinFunction (Exclusive, PullUp, 0x3000, "\\_SB.GPO1", 0x00,
199                ResourceConsumer, ,
200                RawDataBuffer (0x04)  // Vendor Data
201                {
202                    0x0A, 0x0B, 0x0C, 0x0D
203                })
204                {   // Pin list
205                    0x0001,
206                    0x0002,
207                    0x0003
208                }
209        },
210
211        ResourceTemplate ()
212        {
213            PinFunction (Exclusive, PullNone, 0x4000, "\\_SB.GPO1", 0x00,
214                ResourceConsumer, ,
215                RawDataBuffer (0x04)  // Vendor Data
216                {
217                    0x0A, 0x0B, 0x0C, 0x0D
218                })
219                {   // Pin list
220                    0x0001,
221                    0x0002,
222                    0x0003
223                }
224        },
225
226        ResourceTemplate ()
227        {
228            PinFunction (Shared, PullDefault, 0x1000, "\\_SB.GPO1", 0x00,
229                ResourceConsumer, ,
230                RawDataBuffer (0x04)  // Vendor Data
231                {
232                    0x0A, 0x0B, 0x0C, 0x0D
233                })
234                {   // Pin list
235                    0x0001,
236                    0x0002,
237                    0x0003
238                }
239        },
240
241        ResourceTemplate ()
242        {
243            PinFunction (Shared, PullDown, 0x2000, "\\_SB.GPO1", 0x00,
244                ResourceConsumer, ,
245                RawDataBuffer (0x04)  // Vendor Data
246                {
247                    0x0A, 0x0B, 0x0C, 0x0D
248                })
249                {   // Pin list
250                    0x0001,
251                    0x0002,
252                    0x0003
253                }
254        },
255
256        ResourceTemplate ()
257        {
258            PinFunction (Shared, PullUp, 0x3000, "\\_SB.GPO1", 0x00,
259                ResourceConsumer, ,
260                RawDataBuffer (0x04)  // Vendor Data
261                {
262                    0x0A, 0x0B, 0x0C, 0x0D
263                })
264                {   // Pin list
265                    0x0001,
266                    0x0002,
267                    0x0003
268                }
269        },
270
271        ResourceTemplate ()
272        {
273            PinFunction (Shared, PullNone, 0x4000, "\\_SB.GPO1", 0x00,
274                ResourceConsumer, ,
275                RawDataBuffer (0x04)  // Vendor Data
276                {
277                    0x0A, 0x0B, 0x0C, 0x0D
278                })
279                {   // Pin list
280                    0x0001,
281                    0x0002,
282                    0x0003
283                }
284        },
285
286        ResourceTemplate ()
287        {
288            PinFunction (Exclusive, PullNone, 0xABCD, "\\_SB.GPO1", 0x00,
289                ResourceConsumer, ,)
290                {   // Pin list
291                    0x0011
292                }
293        }
294    })
295    Method (RT26, 0, Serialized)
296    {
297        /* Emit test header, set the filename */
298
299        THDR (__METHOD__, "PinFunction Resource Descriptor Macro", "pinfunction.asl")
300        /* The main test packages must have the same number of entries */
301
302        If ((SizeOf (P45C) != SizeOf (P45D)))
303        {
304            ERR (__METHOD__, 0xB3, __LINE__, 0x00, 0x00, 0x00, "Incorrect package length")
305            Return (Zero)
306        }
307
308        /* Main test case for packages above */
309
310        M330 (__METHOD__, SizeOf (P45C), "P45C", P45C, P45D)
311                    /* Check resource descriptor tag offsets */
312
313Local0 = ResourceTemplate ()
314            {
315                PinFunction (Exclusive, PullDefault, 0x1234, "\\_SB.GPO1", 0x00,
316                    ResourceConsumer, ,
317                    RawDataBuffer (0x04)  // Vendor Data
318                    {
319                        0x0A, 0x0B, 0x0C, 0x0D
320                    })
321                    {   // Pin list
322                        0x0001,
323                        0x0002,
324                        0x0003
325                    }
326                PinFunction (Exclusive, PullDefault, 0x1234, "\\_SB.GPO1", 0x00,
327                    ResourceConsumer, ,
328                    RawDataBuffer (0x04)  // Vendor Data
329                    {
330                        0x0A, 0x0B, 0x0C, 0x0D
331                    })
332                    {   // Pin list
333                        0x0001,
334                        0x0002,
335                        0x0003
336                    }
337            }
338        M331 (__METHOD__, 0x01, 0x20, 0x20, 0x0150, 0x0150, "_SHR")
339        M331 (__METHOD__, 0x02, 0x30, 0x30, 0x0160, 0x0160, "_PPI")
340        M331 (__METHOD__, 0x03, 0x38, 0x38, 0x0168, 0x0168, "_FUN")
341        M331 (__METHOD__, 0x04, 0x0110, 0x0110, 0x0240, 0x0240, "_VEN")
342    }
343