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     * FixedDma Resource Descriptor Macro
32     */
33    Name (P450, Package (0x08)
34    {
35        ResourceTemplate ()
36        {
37            FixedDMA (0xF1F2, 0x1234, Width8bit, )
38        },
39
40        ResourceTemplate ()
41        {
42            FixedDMA (0xE1E2, 0x000F, Width16bit, )
43        },
44
45        ResourceTemplate ()
46        {
47            FixedDMA (0xD1D2, 0x00F0, Width32bit, )
48        },
49
50        ResourceTemplate ()
51        {
52            FixedDMA (0xC1C2, 0x0F00, Width64bit, )
53        },
54
55        ResourceTemplate ()
56        {
57            FixedDMA (0xB1B2, 0xF000, Width128bit, )
58        },
59
60        ResourceTemplate ()
61        {
62            FixedDMA (0xA1A2, 0xFFFF, Width256bit, )
63        },
64
65        ResourceTemplate ()
66        {
67            FixedDMA (0x9192, 0x11D7, Width32bit, )
68        },
69
70        ResourceTemplate ()
71        {
72            FixedDMA (0x8182, 0x11D7, Width32bit, )
73        }
74    })
75    Name (P451, Package (0x08)
76    {
77        ResourceTemplate ()
78        {
79            FixedDMA (0xF1F2, 0x1234, Width8bit, )
80        },
81
82        ResourceTemplate ()
83        {
84            FixedDMA (0xE1E2, 0x000F, Width16bit, )
85        },
86
87        ResourceTemplate ()
88        {
89            FixedDMA (0xD1D2, 0x00F0, Width32bit, )
90        },
91
92        ResourceTemplate ()
93        {
94            FixedDMA (0xC1C2, 0x0F00, Width64bit, )
95        },
96
97        ResourceTemplate ()
98        {
99            FixedDMA (0xB1B2, 0xF000, Width128bit, )
100        },
101
102        ResourceTemplate ()
103        {
104            FixedDMA (0xA1A2, 0xFFFF, Width256bit, )
105        },
106
107        ResourceTemplate ()
108        {
109            FixedDMA (0x9192, 0x11D7, Width32bit, )
110        },
111
112        ResourceTemplate ()
113        {
114            FixedDMA (0x8182, 0x11D7, Width32bit, )
115        }
116    })
117    Method (RT20, 0, Serialized)
118    {
119        /* Emit test header, set the filename */
120
121        THDR (__METHOD__, "FixedDMA Resource Descriptor Macro", "fixeddma.asl")
122        /* The main test packages must have the same number of entries */
123
124        If ((SizeOf (P450) != SizeOf (P451)))
125        {
126            ERR (__METHOD__, 0xB1, __LINE__, 0x00, 0x00, 0x00, "Incorrect package length")
127            Return (Zero)
128        }
129
130        /* Main test case for packages above */
131
132        M330 (__METHOD__, SizeOf (P450), "p450", P450, P451)
133        /* Check resource descriptor tag offsets */
134
135        Local0 = ResourceTemplate ()
136            {
137                FixedDMA (0xE1E2, 0x000F, Width16bit, )
138                FixedDMA (0xD1D2, 0x00F0, Width32bit, )
139            }
140        M331 (__METHOD__, 0x01, 0x08, 0x08, 0x38, 0x38, "_DMA")
141        M331 (__METHOD__, 0x02, 0x18, 0x18, 0x48, 0x48, "_TYP")
142        M331 (__METHOD__, 0x03, 0x28, 0x28, 0x58, 0x58, "_SIZ")
143    }
144