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     * PinGroupFunction Resource Descriptor Macro
32     */
33    Name (P462, Package (0x07)
34    {
35        ResourceTemplate ()
36        {
37            PinGroupFunction (Exclusive, 0x1000, "\\_SB.GPO1", 0x00,
38                "group0", ResourceConsumer, ,
39                RawDataBuffer (0x04)  // Vendor Data
40                {
41                    0x0A, 0x0B, 0x0C, 0x0D
42                })
43        },
44
45        ResourceTemplate ()
46        {
47            PinGroupFunction (Exclusive, 0x1234, "\\_SB.GPO1", 0x00,
48                "group1", ResourceConsumer, ,
49                RawDataBuffer (0x04)  // Vendor Data
50                {
51                    0x0A, 0x0B, 0x0C, 0x0D
52                })
53        },
54
55        ResourceTemplate ()
56        {
57            PinGroupFunction (Shared, 0x1000, "\\_SB.GPO1", 0x00,
58                "group0", ResourceConsumer, ,
59                RawDataBuffer (0x04)  // Vendor Data
60                {
61                    0x0A, 0x0B, 0x0C, 0x0D
62                })
63        },
64
65        ResourceTemplate ()
66        {
67            PinGroupFunction (Shared, 0x1234, "\\_SB.GPO1", 0x00,
68                "group1", ResourceConsumer, ,
69                RawDataBuffer (0x04)  // Vendor Data
70                {
71                    0x0A, 0x0B, 0x0C, 0x0D
72                })
73        },
74
75        ResourceTemplate ()
76        {
77            PinGroupFunction (Shared, 0x1000, "\\_SB.GPO1", 0x00,
78                "group0", ResourceConsumer, ,)
79        },
80
81        ResourceTemplate ()
82        {
83            PinGroupFunction (Shared, 0x1234, "\\_SB.GPO1", 0x00,
84                "group1", ResourceConsumer, ,)
85        },
86
87        ResourceTemplate ()
88        {
89            PinGroupFunction (Exclusive, 0x1234, "\\_SB.GPO1", 0x00,
90                "group0", ResourceConsumer, ,)
91        }
92    })
93    Name (P463, Package (0x07)
94    {
95        ResourceTemplate ()
96        {
97            PinGroupFunction (Exclusive, 0x1000, "\\_SB.GPO1", 0x00,
98                "group0", ResourceConsumer, ,
99                RawDataBuffer (0x04)  // Vendor Data
100                {
101                    0x0A, 0x0B, 0x0C, 0x0D
102                })
103        },
104
105        ResourceTemplate ()
106        {
107            PinGroupFunction (Exclusive, 0x1234, "\\_SB.GPO1", 0x00,
108                "group1", ResourceConsumer, ,
109                RawDataBuffer (0x04)  // Vendor Data
110                {
111                    0x0A, 0x0B, 0x0C, 0x0D
112                })
113        },
114
115        ResourceTemplate ()
116        {
117            PinGroupFunction (Shared, 0x1000, "\\_SB.GPO1", 0x00,
118                "group0", ResourceConsumer, ,
119                RawDataBuffer (0x04)  // Vendor Data
120                {
121                    0x0A, 0x0B, 0x0C, 0x0D
122                })
123        },
124
125        ResourceTemplate ()
126        {
127            PinGroupFunction (Shared, 0x1234, "\\_SB.GPO1", 0x00,
128                "group1", ResourceConsumer, ,
129                RawDataBuffer (0x04)  // Vendor Data
130                {
131                    0x0A, 0x0B, 0x0C, 0x0D
132                })
133        },
134
135        ResourceTemplate ()
136        {
137            PinGroupFunction (Shared, 0x1000, "\\_SB.GPO1", 0x00,
138                "group0", ResourceConsumer, ,)
139        },
140
141        ResourceTemplate ()
142        {
143            PinGroupFunction (Shared, 0x1234, "\\_SB.GPO1", 0x00,
144                "group1", ResourceConsumer, ,)
145        },
146
147        ResourceTemplate ()
148        {
149            PinGroupFunction (Exclusive, 0x1234, "\\_SB.GPO1", 0x00,
150                "group0", ResourceConsumer, ,)
151        }
152    })
153    Method (RT29, 0, Serialized)
154    {
155        /* Emit test header, set the filename */
156
157        THDR (__METHOD__, "PinGroupFunction Resource Descriptor Macro", "pingroupfunction.asl")
158        /* The main test packages must have the same number of entries */
159
160        If ((SizeOf (P462) != SizeOf (P463)))
161        {
162            ERR (__METHOD__, 0xB3, __LINE__, 0x00, 0x00, 0x00, "Incorrect package length")
163            Return (Zero)
164        }
165
166        /* Main test case for packages above */
167
168        M330 (__METHOD__, SizeOf (P462), "P462", P462, P463)
169                    /* Check resource descriptor tag offsets */
170
171Local0 = ResourceTemplate ()
172            {
173                PinGroupFunction (Shared, 0x1234, "\\_SB.GPO1", 0x00,
174                    "group0", ResourceConsumer, ,
175                    RawDataBuffer (0x04)  // Vendor Data
176                    {
177                        0x0A, 0x0B, 0x0C, 0x0D
178                    })
179                PinGroupFunction (Shared, 0x1234, "\\_SB.GPO1", 0x00,
180                    "group0", ResourceConsumer, ,
181                    RawDataBuffer (0x04)  // Vendor Data
182                    {
183                        0x0A, 0x0B, 0x0C, 0x0D
184                    })
185            }
186        M331 (__METHOD__, 0x01, 0x20, 0x20, 0x0150, 0x0150, "_SHR")
187        M331 (__METHOD__, 0x01, 0x30, 0x30, 0x0160, 0x0160, "_FUN")
188        M331 (__METHOD__, 0x01, 0x0110, 0x0110, 0x0240, 0x0240, "_VEN")
189    }
190