Add support for Intel Sandybridge CPU (northbridge part)
[coreboot.git] / src / northbridge / intel / sandybridge / acpi / igd.asl
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of
9  * the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21
22 Device (GFX0)
23 {
24         Name (_ADR, 0x00020000)
25
26         /* Display Output Switching */
27         Method (_DOS, 1)
28         {
29                 /* Windows 2000 and Windows XP call _DOS to enable/disable
30                  * Display Output Switching during init and while a switch
31                  * is already active
32                  */
33                 Store (And(Arg0, 7), DSEN)
34         }
35
36         /* We try to support as many i945 systems as possible,
37          * so keep the number of DIDs flexible.
38          */
39         Method (_DOD, 0)
40         {
41                 If (LEqual(NDID, 1)) {
42                         Name(DOD1, Package() {
43                                 0xffffffff
44                         })
45                         Store (Or(0x00010000, DID1), Index(DOD1, 0))
46                         Return(DOD1)
47                 }
48
49                 If (LEqual(NDID, 2)) {
50                         Name(DOD2, Package() {
51                                 0xffffffff,
52                                 0xffffffff
53                         })
54                         Store (Or(0x00010000, DID2), Index(DOD2, 0))
55                         Store (Or(0x00010000, DID2), Index(DOD2, 1))
56                         Return(DOD2)
57                 }
58
59                 If (LEqual(NDID, 3)) {
60                         Name(DOD3, Package() {
61                                 0xffffffff,
62                                 0xffffffff,
63                                 0xffffffff
64                         })
65                         Store (Or(0x00010000, DID3), Index(DOD3, 0))
66                         Store (Or(0x00010000, DID3), Index(DOD3, 1))
67                         Store (Or(0x00010000, DID3), Index(DOD3, 2))
68                         Return(DOD3)
69                 }
70
71                 If (LEqual(NDID, 4)) {
72                         Name(DOD4, Package() {
73                                 0xffffffff,
74                                 0xffffffff,
75                                 0xffffffff,
76                                 0xffffffff
77                         })
78                         Store (Or(0x00010000, DID4), Index(DOD4, 0))
79                         Store (Or(0x00010000, DID4), Index(DOD4, 1))
80                         Store (Or(0x00010000, DID4), Index(DOD4, 2))
81                         Store (Or(0x00010000, DID4), Index(DOD4, 3))
82                         Return(DOD4)
83                 }
84
85                 If (LGreater(NDID, 4)) {
86                         Name(DOD5, Package() {
87                                 0xffffffff,
88                                 0xffffffff,
89                                 0xffffffff,
90                                 0xffffffff,
91                                 0xffffffff
92                         })
93                         Store (Or(0x00010000, DID5), Index(DOD5, 0))
94                         Store (Or(0x00010000, DID5), Index(DOD5, 1))
95                         Store (Or(0x00010000, DID5), Index(DOD5, 2))
96                         Store (Or(0x00010000, DID5), Index(DOD5, 3))
97                         Store (Or(0x00010000, DID5), Index(DOD5, 4))
98                         Return(DOD5)
99                 }
100
101                 /* Some error happened, but we have to return something */
102                 Return (Package() {0x00000400})
103         }
104
105         Device(DD01)
106         {
107                 /* Device Unique ID */
108                 Method(_ADR, 0, Serialized)
109                 {
110                         If(LEqual(DID1, 0)) {
111                                 Return (1)
112                         } Else {
113                                 Return (And(0xffff, DID1))
114                         }
115                 }
116
117                 /* Device Current Status */
118                 Method(_DCS, 0)
119                 {
120                         TRAP(1)
121                         If (And(CSTE, 1)) {
122                                 Return (0x1f)
123                         }
124                         Return(0x1d)
125                 }
126
127                 /* Query Device Graphics State */
128                 Method(_DGS, 0)
129                 {
130                         If (And(NSTE, 1)) {
131                                 Return(1)
132                         }
133                         Return(0)
134                 }
135
136                 /* Device Set State */
137                 Method(_DSS, 1)
138                 {
139                         /* If Parameter Arg0 is (1 << 31) | (1 << 30), the
140                          * display switch was completed
141                          */
142                         If (LEqual(And(Arg0, 0xc0000000), 0xc0000000)) {
143                                 Store (NSTE, CSTE)
144                         }
145                 }
146         }
147
148         Device(DD02)
149         {
150                 /* Device Unique ID */
151                 Method(_ADR, 0, Serialized)
152                 {
153                         If(LEqual(DID2, 0)) {
154                                 Return (2)
155                         } Else {
156                                 Return (And(0xffff, DID2))
157                         }
158                 }
159
160                 /* Device Current Status */
161                 Method(_DCS, 0)
162                 {
163                         TRAP(1)
164                         If (And(CSTE, 2)) {
165                                 Return (0x1f)
166                         }
167                         Return(0x1d)
168                 }
169
170                 /* Query Device Graphics State */
171                 Method(_DGS, 0)
172                 {
173                         If (And(NSTE, 2)) {
174                                 Return(1)
175                         }
176                         Return(0)
177                 }
178
179                 /* Device Set State */
180                 Method(_DSS, 1)
181                 {
182                         /* If Parameter Arg0 is (1 << 31) | (1 << 30), the
183                          * display switch was completed
184                          */
185                         If (LEqual(And(Arg0, 0xc0000000), 0xc0000000)) {
186                                 Store (NSTE, CSTE)
187                         }
188                 }
189         }
190
191
192         Device(DD03)
193         {
194                 /* Device Unique ID */
195                 Method(_ADR, 0, Serialized)
196                 {
197                         If(LEqual(DID3, 0)) {
198                                 Return (3)
199                         } Else {
200                                 Return (And(0xffff, DID3))
201                         }
202                 }
203
204                 /* Device Current Status */
205                 Method(_DCS, 0)
206                 {
207                         TRAP(1)
208                         If (And(CSTE, 4)) {
209                                 Return (0x1f)
210                         }
211                         Return(0x1d)
212                 }
213
214                 /* Query Device Graphics State */
215                 Method(_DGS, 0)
216                 {
217                         If (And(NSTE, 4)) {
218                                 Return(1)
219                         }
220                         Return(0)
221                 }
222
223                 /* Device Set State */
224                 Method(_DSS, 1)
225                 {
226                         /* If Parameter Arg0 is (1 << 31) | (1 << 30), the
227                          * display switch was completed
228                          */
229                         If (LEqual(And(Arg0, 0xc0000000), 0xc0000000)) {
230                                 Store (NSTE, CSTE)
231                         }
232                 }
233         }
234
235
236         Device(DD04)
237         {
238                 /* Device Unique ID */
239                 Method(_ADR, 0, Serialized)
240                 {
241                         If(LEqual(DID4, 0)) {
242                                 Return (4)
243                         } Else {
244                                 Return (And(0xffff, DID4))
245                         }
246                 }
247
248                 /* Device Current Status */
249                 Method(_DCS, 0)
250                 {
251                         TRAP(1)
252                         If (And(CSTE, 8)) {
253                                 Return (0x1f)
254                         }
255                         Return(0x1d)
256                 }
257
258                 /* Query Device Graphics State */
259                 Method(_DGS, 0)
260                 {
261                         If (And(NSTE, 4)) {
262                                 Return(1)
263                         }
264                         Return(0)
265                 }
266
267                 /* Device Set State */
268                 Method(_DSS, 1)
269                 {
270                         /* If Parameter Arg0 is (1 << 31) | (1 << 30), the
271                          * display switch was completed
272                          */
273                         If (LEqual(And(Arg0, 0xc0000000), 0xc0000000)) {
274                                 Store (NSTE, CSTE)
275                         }
276                 }
277         }
278
279
280         Device(DD05)
281         {
282                 /* Device Unique ID */
283                 Method(_ADR, 0, Serialized)
284                 {
285                         If(LEqual(DID5, 0)) {
286                                 Return (5)
287                         } Else {
288                                 Return (And(0xffff, DID5))
289                         }
290                 }
291
292                 /* Device Current Status */
293                 Method(_DCS, 0)
294                 {
295                         TRAP(1)
296                         If (And(CSTE, 16)) {
297                                 Return (0x1f)
298                         }
299                         Return(0x1d)
300                 }
301
302                 /* Query Device Graphics State */
303                 Method(_DGS, 0)
304                 {
305                         If (And(NSTE, 4)) {
306                                 Return(1)
307                         }
308                         Return(0)
309                 }
310
311                 /* Device Set State */
312                 Method(_DSS, 1)
313                 {
314                         /* If Parameter Arg0 is (1 << 31) | (1 << 30), the
315                          * display switch was completed
316                          */
317                         If (LEqual(And(Arg0, 0xc0000000), 0xc0000000)) {
318                                 Store (NSTE, CSTE)
319                         }
320                 }
321         }
322
323 }
324