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     * IRQ() Interrupt Resource Descriptor Macro
32     */
33    Name (P400, Package (0x12)
34    {
35        ResourceTemplate ()
36        {
37            IRQ (Level, ActiveHigh, Exclusive, )
38                {0}
39        },
40
41        ResourceTemplate ()
42        {
43            IRQ (Level, ActiveHigh, Shared, )
44                {1}
45        },
46
47        ResourceTemplate ()
48        {
49            IRQ (Level, ActiveLow, Exclusive, )
50                {2}
51        },
52
53        ResourceTemplate ()
54        {
55            IRQ (Level, ActiveLow, Shared, )
56                {3}
57        },
58
59        ResourceTemplate ()
60        {
61            IRQ (Edge, ActiveHigh, Exclusive, )
62                {4}
63        },
64
65        ResourceTemplate ()
66        {
67            IRQ (Edge, ActiveHigh, Shared, )
68                {5}
69        },
70
71        ResourceTemplate ()
72        {
73            IRQ (Edge, ActiveLow, Exclusive, )
74                {6}
75        },
76
77        ResourceTemplate ()
78        {
79            IRQ (Edge, ActiveLow, Shared, )
80                {7}
81        },
82
83        ResourceTemplate ()
84        {
85            IRQ (Level, ActiveHigh, Exclusive, )
86                {8}
87        },
88
89        ResourceTemplate ()
90        {
91            IRQ (Level, ActiveHigh, Shared, )
92                {9}
93        },
94
95        ResourceTemplate ()
96        {
97            IRQ (Level, ActiveLow, Exclusive, )
98                {10}
99        },
100
101        ResourceTemplate ()
102        {
103            IRQ (Level, ActiveLow, Shared, )
104                {11}
105        },
106
107        ResourceTemplate ()
108        {
109            IRQ (Edge, ActiveHigh, Exclusive, )
110                {12}
111        },
112
113        ResourceTemplate ()
114        {
115            IRQ (Edge, ActiveHigh, Shared, )
116                {13}
117        },
118
119        ResourceTemplate ()
120        {
121            IRQ (Edge, ActiveLow, Exclusive, )
122                {14}
123        },
124
125        ResourceTemplate ()
126        {
127            IRQ (Edge, ActiveLow, Shared, )
128                {15}
129        },
130
131        ResourceTemplate ()
132        {
133            IRQ (Edge, ActiveLow, Exclusive, )
134                {}
135        },
136
137        ResourceTemplate ()
138        {
139            IRQ (Level, ActiveHigh, Exclusive, )
140                {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
141        }
142    })
143    /*
144     ACPI Specification, Revision 3.0, September 2, 2004
145     6.4.2.1   IRQ Descriptor
146     IRQ Descriptor layout (length = 3):
147     Byte 0 (Tag Bits): Value = 00100011B (0x23) (Type = 0, small item name = 0x4, length = 3),
148     Byte 1 (IRQ mask bits[7:0]): IRQ0 <=> bit[0]
149     Byte 2 (IRQ mask bits[15:8]): IRQ8 <=> bit[0]
150     Byte 3 (IRQ Information):
151     Bit[4] 		Interrupt is shareable, _SHR
152     Bit[3]		Interrupt Polarity, _LL
153     0	Active-High - This interrupt is sampled when the signal is high, or true
154     1	Active-Low - This interrupt is sampled when the signal is low, or false.
155     Bit[0]		Interrupt Mode, _HE
156     0	Level-Triggered - Interrupt is triggered in response to signal in a low state.
157     1	Edge-Triggered - Interrupt is triggered in response to a change in signal state
158     from low to high.
159     */
160    Name (P401, Package (0x12)
161    {
162        ResourceTemplate ()
163        {
164            IRQ (Level, ActiveHigh, Exclusive, )
165                {0}
166        },
167
168        ResourceTemplate ()
169        {
170            IRQ (Level, ActiveHigh, Shared, )
171                {1}
172        },
173
174        ResourceTemplate ()
175        {
176            IRQ (Level, ActiveLow, Exclusive, )
177                {2}
178        },
179
180        ResourceTemplate ()
181        {
182            IRQ (Level, ActiveLow, Shared, )
183                {3}
184        },
185
186        ResourceTemplate ()
187        {
188            IRQ (Edge, ActiveHigh, Exclusive, )
189                {4}
190        },
191
192        ResourceTemplate ()
193        {
194            IRQ (Edge, ActiveHigh, Shared, )
195                {5}
196        },
197
198        ResourceTemplate ()
199        {
200            IRQ (Edge, ActiveLow, Exclusive, )
201                {6}
202        },
203
204        ResourceTemplate ()
205        {
206            IRQ (Edge, ActiveLow, Shared, )
207                {7}
208        },
209
210        ResourceTemplate ()
211        {
212            IRQ (Level, ActiveHigh, Exclusive, )
213                {8}
214        },
215
216        ResourceTemplate ()
217        {
218            IRQ (Level, ActiveHigh, Shared, )
219                {9}
220        },
221
222        ResourceTemplate ()
223        {
224            IRQ (Level, ActiveLow, Exclusive, )
225                {10}
226        },
227
228        ResourceTemplate ()
229        {
230            IRQ (Level, ActiveLow, Shared, )
231                {11}
232        },
233
234        ResourceTemplate ()
235        {
236            IRQ (Edge, ActiveHigh, Exclusive, )
237                {12}
238        },
239
240        ResourceTemplate ()
241        {
242            IRQ (Edge, ActiveHigh, Shared, )
243                {13}
244        },
245
246        ResourceTemplate ()
247        {
248            IRQ (Edge, ActiveLow, Exclusive, )
249                {14}
250        },
251
252        ResourceTemplate ()
253        {
254            IRQ (Edge, ActiveLow, Shared, )
255                {15}
256        },
257
258        ResourceTemplate ()
259        {
260            IRQ (Edge, ActiveLow, Exclusive, )
261                {}
262        },
263
264        ResourceTemplate ()
265        {
266            IRQ (Level, ActiveHigh, Exclusive, )
267                {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
268        }
269    })
270    Method (RT01, 0, Serialized)
271    {
272        /* Emit test header, set the filename */
273
274        THDR (__METHOD__, "IRQ Resource Descriptor Macro", "irq.asl")
275        /* Main test case for packages above */
276
277        M330 (__METHOD__, 0x12, "p400", P400, P401)
278        Local0 = ResourceTemplate ()
279            {
280                IRQ (Edge, ActiveLow, Shared, )
281                    {}
282                IRQ (Edge, ActiveLow, Shared, )
283                    {}
284            }
285        M331 (__METHOD__, 0x01, 0x18, 0x18, 0x38, 0x38, "_HE")
286        M331 (__METHOD__, 0x02, 0x1B, 0x1B, 0x3B, 0x3B, "_LL")
287        M331 (__METHOD__, 0x03, 0x1C, 0x1C, 0x3C, 0x3C, "_SHR")
288    }
289