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     * DMA Resource Descriptor Macro
32     */
33    Name (P404, Package (0x1B)
34    {
35        ResourceTemplate ()
36        {
37            DMA (Compatibility, NotBusMaster, Transfer8, )
38                {0}
39        },
40
41        ResourceTemplate ()
42        {
43            DMA (Compatibility, NotBusMaster, Transfer8_16, )
44                {1}
45        },
46
47        ResourceTemplate ()
48        {
49            DMA (Compatibility, NotBusMaster, Transfer16, )
50                {2}
51        },
52
53        ResourceTemplate ()
54        {
55            DMA (Compatibility, BusMaster, Transfer8, )
56                {3}
57        },
58
59        ResourceTemplate ()
60        {
61            DMA (Compatibility, BusMaster, Transfer8_16, )
62                {4}
63        },
64
65        ResourceTemplate ()
66        {
67            DMA (Compatibility, BusMaster, Transfer16, )
68                {5}
69        },
70
71        ResourceTemplate ()
72        {
73            DMA (TypeA, NotBusMaster, Transfer8, )
74                {6}
75        },
76
77        ResourceTemplate ()
78        {
79            DMA (TypeA, NotBusMaster, Transfer8_16, )
80                {7}
81        },
82
83        ResourceTemplate ()
84        {
85            DMA (TypeA, NotBusMaster, Transfer16, )
86                {0}
87        },
88
89        ResourceTemplate ()
90        {
91            DMA (TypeA, BusMaster, Transfer8, )
92                {1}
93        },
94
95        ResourceTemplate ()
96        {
97            DMA (TypeA, BusMaster, Transfer8_16, )
98                {2}
99        },
100
101        ResourceTemplate ()
102        {
103            DMA (TypeA, BusMaster, Transfer16, )
104                {3}
105        },
106
107        ResourceTemplate ()
108        {
109            DMA (TypeB, NotBusMaster, Transfer8, )
110                {4}
111        },
112
113        ResourceTemplate ()
114        {
115            DMA (TypeB, NotBusMaster, Transfer8_16, )
116                {5}
117        },
118
119        ResourceTemplate ()
120        {
121            DMA (TypeB, NotBusMaster, Transfer16, )
122                {6}
123        },
124
125        ResourceTemplate ()
126        {
127            DMA (TypeB, BusMaster, Transfer8, )
128                {7}
129        },
130
131        ResourceTemplate ()
132        {
133            DMA (TypeB, BusMaster, Transfer8_16, )
134                {0}
135        },
136
137        ResourceTemplate ()
138        {
139            DMA (TypeB, BusMaster, Transfer16, )
140                {1}
141        },
142
143        ResourceTemplate ()
144        {
145            DMA (TypeF, NotBusMaster, Transfer8, )
146                {2}
147        },
148
149        ResourceTemplate ()
150        {
151            DMA (TypeF, NotBusMaster, Transfer8_16, )
152                {3}
153        },
154
155        ResourceTemplate ()
156        {
157            DMA (TypeF, NotBusMaster, Transfer16, )
158                {4}
159        },
160
161        ResourceTemplate ()
162        {
163            DMA (TypeF, BusMaster, Transfer8, )
164                {5}
165        },
166
167        ResourceTemplate ()
168        {
169            DMA (TypeF, BusMaster, Transfer8_16, )
170                {6}
171        },
172
173        ResourceTemplate ()
174        {
175            DMA (TypeF, BusMaster, Transfer16, )
176                {7}
177        },
178
179        ResourceTemplate ()
180        {
181            DMA (TypeF, BusMaster, Transfer16, )
182                {}
183        },
184
185        ResourceTemplate ()
186        {
187            DMA (TypeF, BusMaster, Transfer16, )
188                {0,1,2,3,4,5,6,7}
189        },
190
191        ResourceTemplate ()
192        {
193            DMA (TypeF, BusMaster, Transfer8, )
194                {5}
195        }
196    })
197    /*
198     ACPI Specification, Revision 3.0, September 2, 2004
199     6.4.2.2   DMA Descriptor
200     DMA Descriptor layout:
201     Byte 0 (Tag Bits): Value = 00101010B (0x2a) (Type = 0, small item name = 0x5, length = 2)
202     Byte 1 (DMA channel mask bits[7:0]): DMA0 <=> bit[0]
203     Byte 2 (DMA Information):
204     Bits[6:5]	DMA channel speed supported, _TYP
205     00	Indicates compatibility mode
206     01	Indicates Type A DMA as described in the EISA
207     10	Indicates Type B DMA
208     11	Indicates Type F
209     Bit[2] 		Logical device bus master status, _BM
210     0	Logical device is not a bus master
211     1	Logical device is a bus master
212     Bits[1:0]	DMA transfer type preference, _SIZ
213     00	8-bit only
214     01	8- and 16-bit
215     10	16-bit only
216     11	Reserved
217     */
218    Name (P405, Package (0x1B)
219    {
220        ResourceTemplate ()
221        {
222            DMA (Compatibility, NotBusMaster, Transfer8, )
223                {0}
224        },
225
226        ResourceTemplate ()
227        {
228            DMA (Compatibility, NotBusMaster, Transfer8_16, )
229                {1}
230        },
231
232        ResourceTemplate ()
233        {
234            DMA (Compatibility, NotBusMaster, Transfer16, )
235                {2}
236        },
237
238        ResourceTemplate ()
239        {
240            DMA (Compatibility, BusMaster, Transfer8, )
241                {3}
242        },
243
244        ResourceTemplate ()
245        {
246            DMA (Compatibility, BusMaster, Transfer8_16, )
247                {4}
248        },
249
250        ResourceTemplate ()
251        {
252            DMA (Compatibility, BusMaster, Transfer16, )
253                {5}
254        },
255
256        ResourceTemplate ()
257        {
258            DMA (TypeA, NotBusMaster, Transfer8, )
259                {6}
260        },
261
262        ResourceTemplate ()
263        {
264            DMA (TypeA, NotBusMaster, Transfer8_16, )
265                {7}
266        },
267
268        ResourceTemplate ()
269        {
270            DMA (TypeA, NotBusMaster, Transfer16, )
271                {0}
272        },
273
274        ResourceTemplate ()
275        {
276            DMA (TypeA, BusMaster, Transfer8, )
277                {1}
278        },
279
280        ResourceTemplate ()
281        {
282            DMA (TypeA, BusMaster, Transfer8_16, )
283                {2}
284        },
285
286        ResourceTemplate ()
287        {
288            DMA (TypeA, BusMaster, Transfer16, )
289                {3}
290        },
291
292        ResourceTemplate ()
293        {
294            DMA (TypeB, NotBusMaster, Transfer8, )
295                {4}
296        },
297
298        ResourceTemplate ()
299        {
300            DMA (TypeB, NotBusMaster, Transfer8_16, )
301                {5}
302        },
303
304        ResourceTemplate ()
305        {
306            DMA (TypeB, NotBusMaster, Transfer16, )
307                {6}
308        },
309
310        ResourceTemplate ()
311        {
312            DMA (TypeB, BusMaster, Transfer8, )
313                {7}
314        },
315
316        ResourceTemplate ()
317        {
318            DMA (TypeB, BusMaster, Transfer8_16, )
319                {0}
320        },
321
322        ResourceTemplate ()
323        {
324            DMA (TypeB, BusMaster, Transfer16, )
325                {1}
326        },
327
328        ResourceTemplate ()
329        {
330            DMA (TypeF, NotBusMaster, Transfer8, )
331                {2}
332        },
333
334        ResourceTemplate ()
335        {
336            DMA (TypeF, NotBusMaster, Transfer8_16, )
337                {3}
338        },
339
340        ResourceTemplate ()
341        {
342            DMA (TypeF, NotBusMaster, Transfer16, )
343                {4}
344        },
345
346        ResourceTemplate ()
347        {
348            DMA (TypeF, BusMaster, Transfer8, )
349                {5}
350        },
351
352        ResourceTemplate ()
353        {
354            DMA (TypeF, BusMaster, Transfer8_16, )
355                {6}
356        },
357
358        ResourceTemplate ()
359        {
360            DMA (TypeF, BusMaster, Transfer16, )
361                {7}
362        },
363
364        ResourceTemplate ()
365        {
366            DMA (TypeF, BusMaster, Transfer16, )
367                {}
368        },
369
370        ResourceTemplate ()
371        {
372            DMA (TypeF, BusMaster, Transfer16, )
373                {0,1,2,3,4,5,6,7}
374        },
375
376        ResourceTemplate ()
377        {
378            DMA (TypeF, BusMaster, Transfer8, )
379                {5}
380        }
381    })
382    Method (RT03, 0, Serialized)
383    {
384        /* Emit test header, set the filename */
385
386        THDR (__METHOD__, "DMA Resource Descriptor Macro", "dma.asl")
387        /* Main test case for packages above */
388
389        M330 (__METHOD__, 0x1B, "p404", P404, P405)
390        Local0 = ResourceTemplate ()
391            {
392                DMA (Compatibility, NotBusMaster, Transfer8, )
393                    {}
394                DMA (Compatibility, NotBusMaster, Transfer8, )
395                    {}
396            }
397        M331 (__METHOD__, 0x01, 0x15, 0x15, 0x2D, 0x2D, "_TYP")
398        M331 (__METHOD__, 0x02, 0x12, 0x12, 0x2A, 0x2A, "_BM")
399        M331 (__METHOD__, 0x03, 0x10, 0x10, 0x28, 0x28, "_SIZ")
400    }
401