1/******************************************************************************
2 * DSDT for Xen with Qemu device model
3 *
4 * Copyright (c) 2004, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; version 2.1 only. with the special
9 * exception on linking described in file 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 Lesser General Public License for more details.
15 */
16
17DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
18{
19    Name (\PMBS, 0x0C00)
20    Name (\PMLN, 0x08)
21    Name (\IOB1, 0x00)
22    Name (\IOL1, 0x00)
23    Name (\APCB, 0xFEC00000)
24    Name (\APCL, 0x00010000)
25    Name (\PUID, 0x00)
26
27
28    Scope (\_SB)
29    {
30
31        /* Fix HCT test for 0x400 pci memory:
32         * - need to report low 640 MB mem as motherboard resource
33         */
34       Device(MEM0)
35       {
36           Name(_HID, EISAID("PNP0C02"))
37           Name(_CRS, ResourceTemplate() {
38               QWordMemory(
39                    ResourceConsumer, PosDecode, MinFixed,
40                    MaxFixed, Cacheable, ReadWrite,
41                    0x00000000,
42                    0x00000000,
43                    0x0009ffff,
44                    0x00000000,
45                    0x000a0000)
46           })
47       }
48
49       Device (PCI0)
50       {
51           Name (_HID, EisaId ("PNP0A03"))
52           Name (_UID, 0x00)
53           Name (_ADR, 0x00)
54           Name (_BBN, 0x00)
55
56           /* Make cirrues VGA S3 suspend/resume work in Windows XP/2003 */
57           Device (VGA)
58           {
59               Name (_ADR, 0x00020000)
60
61               Method (_S1D, 0, NotSerialized)
62               {
63                   Return (0x00)
64               }
65               Method (_S2D, 0, NotSerialized)
66               {
67                   Return (0x00)
68               }
69               Method (_S3D, 0, NotSerialized)
70               {
71                   Return (0x00)
72               }
73           }
74
75           Method (_CRS, 0, NotSerialized)
76           {
77               Store (ResourceTemplate ()
78               {
79                   /* bus number is from 0 - 255*/
80                   WordBusNumber(
81                        ResourceProducer, MinFixed, MaxFixed, SubDecode,
82                        0x0000,
83                        0x0000,
84                        0x00FF,
85                        0x0000,
86                        0x0100)
87                    IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
88                    WordIO(
89                        ResourceProducer, MinFixed, MaxFixed, PosDecode,
90                        EntireRange,
91                        0x0000,
92                        0x0000,
93                        0x0CF7,
94                        0x0000,
95                        0x0CF8)
96                    WordIO(
97                        ResourceProducer, MinFixed, MaxFixed, PosDecode,
98                        EntireRange,
99                        0x0000,
100                        0x0D00,
101                        0xFFFF,
102                        0x0000,
103                        0xF300)
104
105                    /* reserve memory for pci devices */
106                    DWordMemory(
107                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
108                        WriteCombining, ReadWrite,
109                        0x00000000,
110                        0x000A0000,
111                        0x000BFFFF,
112                        0x00000000,
113                        0x00020000)
114
115                    DWordMemory(
116                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
117                        NonCacheable, ReadWrite,
118                        0x00000000,
119                        0xF0000000,
120                        0xF4FFFFFF,
121                        0x00000000,
122                        0x05000000,
123                        ,, _Y01)
124
125                    QWordMemory (
126                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
127                        NonCacheable, ReadWrite,
128                        0x0000000000000000,
129                        0x0000000FFFFFFFF0,
130                        0x0000000FFFFFFFFF,
131                        0x0000000000000000,
132                        0x0000000000000010,
133                        ,, _Y02)
134
135                }, Local1)
136
137                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MIN, MMIN)
138                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MAX, MMAX)
139                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._LEN, MLEN)
140
141                Store(\_SB.PMIN, MMIN)
142                Store(\_SB.PLEN, MLEN)
143                Add(MMIN, MLEN, MMAX)
144                Subtract(MMAX, One, MMAX)
145
146                /*
147                 * WinXP / Win2K3 blue-screen for operations on 64-bit values.
148                 * Therefore we need to split the 64-bit calculations needed
149                 * here, but different iasl versions evaluate name references
150                 * to integers differently:
151                 * Year (approximate)          2006    2008    2012
152                 * \_SB.PCI0._CRS._Y02         zero   valid   valid
153                 * \_SB.PCI0._CRS._Y02._MIN   valid   valid    huge
154                 */
155                If(LEqual(Zero, \_SB.PCI0._CRS._Y02)) {
156                    Subtract(\_SB.PCI0._CRS._Y02._MIN, 14, Local0)
157                } Else {
158                    Store(\_SB.PCI0._CRS._Y02, Local0)
159                }
160                CreateDWordField(Local1, Add(Local0, 14), MINL)
161                CreateDWordField(Local1, Add(Local0, 18), MINH)
162                CreateDWordField(Local1, Add(Local0, 22), MAXL)
163                CreateDWordField(Local1, Add(Local0, 26), MAXH)
164                CreateDWordField(Local1, Add(Local0, 38), LENL)
165                CreateDWordField(Local1, Add(Local0, 42), LENH)
166
167                Store(\_SB.LMIN, MINL)
168                Store(\_SB.HMIN, MINH)
169                Store(\_SB.LLEN, LENL)
170                Store(\_SB.HLEN, LENH)
171                Add(MINL, LENL, MAXL)
172                Add(MINH, LENH, MAXH)
173                If(LLess(MAXL, MINL)) {
174                    Add(MAXH, One, MAXH)
175                }
176                If(LOr(MINH, LENL)) {
177                    If(LEqual(MAXL, 0)) {
178                        Subtract(MAXH, One, MAXH)
179                    }
180                    Subtract(MAXL, One, MAXL)
181                }
182
183                Return (Local1)
184            }
185
186            Device(HPET) {
187                Name(_HID,  EISAID("PNP0103"))
188                Name(_UID, 0)
189                Method (_STA, 0, NotSerialized) {
190                    If(LEqual(\_SB.HPET, 0)) {
191                        Return(0x00)
192                    } Else {
193                        Return(0x0F)
194                    }
195                }
196                Name(_CRS, ResourceTemplate() {
197                    DWordMemory(
198                        ResourceConsumer, PosDecode, MinFixed, MaxFixed,
199                        NonCacheable, ReadWrite,
200                        0x00000000,
201                        0xFED00000,
202                        0xFED003FF,
203                        0x00000000,
204                        0x00000400 /* 1K memory: FED00000 - FED003FF */
205                    )
206                })
207            }
208
209            Device (ISA)
210            {
211                Name (_ADR, 0x00010000) /* device 1, fn 0 */
212
213                OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
214                Scope(\) {
215                    Field (\_SB.PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
216                        PIRA, 8,
217                        PIRB, 8,
218                        PIRC, 8,
219                        PIRD, 8
220                    }
221                }
222                Device (SYSR)
223                {
224                    Name (_HID, EisaId ("PNP0C02"))
225                    Name (_UID, 0x01)
226                    Name (CRS, ResourceTemplate ()
227                    {
228                        /* TODO: list hidden resources */
229                        IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
230                        IO (Decode16, 0x0022, 0x0022, 0x00, 0x0C)
231                        IO (Decode16, 0x0030, 0x0030, 0x00, 0x10)
232                        IO (Decode16, 0x0044, 0x0044, 0x00, 0x1C)
233                        IO (Decode16, 0x0062, 0x0062, 0x00, 0x02)
234                        IO (Decode16, 0x0065, 0x0065, 0x00, 0x0B)
235                        IO (Decode16, 0x0072, 0x0072, 0x00, 0x0E)
236                        IO (Decode16, 0x0080, 0x0080, 0x00, 0x01)
237                        IO (Decode16, 0x0084, 0x0084, 0x00, 0x03)
238                        IO (Decode16, 0x0088, 0x0088, 0x00, 0x01)
239                        IO (Decode16, 0x008C, 0x008C, 0x00, 0x03)
240                        IO (Decode16, 0x0090, 0x0090, 0x00, 0x10)
241                        IO (Decode16, 0x00A2, 0x00A2, 0x00, 0x1C)
242                        IO (Decode16, 0x00E0, 0x00E0, 0x00, 0x10)
243                        IO (Decode16, 0x08A0, 0x08A0, 0x00, 0x04)
244                        IO (Decode16, 0x0CC0, 0x0CC0, 0x00, 0x10)
245                        IO (Decode16, 0x04D0, 0x04D0, 0x00, 0x02)
246                    })
247                    Method (_CRS, 0, NotSerialized)
248                    {
249                        Return (CRS)
250                    }
251                }
252
253                Device (PIC)
254                {
255                    Name (_HID, EisaId ("PNP0000"))
256                    Name (_CRS, ResourceTemplate ()
257                    {
258                        IO (Decode16, 0x0020, 0x0020, 0x01, 0x02)
259                        IO (Decode16, 0x00A0, 0x00A0, 0x01, 0x02)
260                        IRQNoFlags () {2}
261                    })
262                }
263
264                Device (DMA0)
265                {
266                    Name (_HID, EisaId ("PNP0200"))
267                    Name (_CRS, ResourceTemplate ()
268                    {
269                        DMA (Compatibility, BusMaster, Transfer8) {4}
270                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x10)
271                        IO (Decode16, 0x0081, 0x0081, 0x00, 0x03)
272                        IO (Decode16, 0x0087, 0x0087, 0x00, 0x01)
273                        IO (Decode16, 0x0089, 0x0089, 0x00, 0x03)
274                        IO (Decode16, 0x008F, 0x008F, 0x00, 0x01)
275                        IO (Decode16, 0x00C0, 0x00C0, 0x00, 0x20)
276                        IO (Decode16, 0x0480, 0x0480, 0x00, 0x10)
277                    })
278                }
279
280                Device (TMR)
281                {
282                    Name (_HID, EisaId ("PNP0100"))
283                    Name (_CRS, ResourceTemplate ()
284                    {
285                        IO (Decode16, 0x0040, 0x0040, 0x00, 0x04)
286                        IRQNoFlags () {0}
287                    })
288                }
289
290                Device (RTC)
291                {
292                    Name (_HID, EisaId ("PNP0B00"))
293                    Name (_CRS, ResourceTemplate ()
294                    {
295                        IO (Decode16, 0x0070, 0x0070, 0x00, 0x02)
296                        IRQNoFlags () {8}
297                    })
298                }
299
300                Device (SPKR)
301                {
302                    Name (_HID, EisaId ("PNP0800"))
303                    Name (_CRS, ResourceTemplate ()
304                    {
305                        IO (Decode16, 0x0061, 0x0061, 0x00, 0x01)
306                    })
307                }
308
309                Device (PS2M)
310                {
311                    Name (_HID, EisaId ("PNP0F13"))
312                    Name (_CID, 0x130FD041)
313                    Method (_STA, 0, NotSerialized)
314                    {
315                        Return (0x0F)
316                    }
317
318                    Name (_CRS, ResourceTemplate ()
319                    {
320                        IRQNoFlags () {12}
321                    })
322                }
323
324                Device (PS2K)
325                {
326                    Name (_HID, EisaId ("PNP0303"))
327                    Name (_CID, 0x0B03D041)
328                    Method (_STA, 0, NotSerialized)
329                    {
330                        Return (0x0F)
331                    }
332
333                    Name (_CRS, ResourceTemplate ()
334                    {
335                        IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
336                        IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
337                        IRQNoFlags () {1}
338                    })
339                }
340
341                Device (FDC0)
342                {
343                    Name (_HID, EisaId ("PNP0700"))
344                    Method (_STA, 0, NotSerialized)
345                    {
346                          Return (0x0F)
347                    }
348
349                    Name (_CRS, ResourceTemplate ()
350                    {
351                        IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
352                        IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
353                        IRQNoFlags () {6}
354                        DMA (Compatibility, NotBusMaster, Transfer8) {2}
355                    })
356                }
357
358                Device (UAR1)
359                {
360                    Name (_HID, EisaId ("PNP0501"))
361                    Name (_UID, 0x01)
362                    Method (_STA, 0, NotSerialized)
363                    {
364                        If(LEqual(\_SB.UAR1, 0)) {
365                            Return(0x00)
366                        } Else {
367                            Return(0x0F)
368                        }
369                    }
370
371                    Name (_CRS, ResourceTemplate()
372                    {
373                        IO (Decode16, 0x03F8, 0x03F8, 8, 8)
374                        IRQNoFlags () {4}
375                    })
376                }
377
378                Device (UAR2)
379                {
380                    Name (_HID, EisaId ("PNP0501"))
381                    Name (_UID, 0x02)
382                    Method (_STA, 0, NotSerialized)
383                    {
384                        If(LEqual(\_SB.UAR2, 0)) {
385                            Return(0x00)
386                        } Else {
387                            Return(0x0F)
388                        }
389                    }
390
391                    Name (_CRS, ResourceTemplate()
392                    {
393                        IO (Decode16, 0x02F8, 0x02F8, 8, 8)
394                        IRQNoFlags () {3}
395                    })
396                }
397
398                Device (LTP1)
399                {
400                    Name (_HID, EisaId ("PNP0400"))
401                    Name (_UID, 0x02)
402                    Method (_STA, 0, NotSerialized)
403                    {
404                        If(LEqual(\_SB.LTP1, 0)) {
405                            Return(0x00)
406                        } Else {
407                            Return(0x0F)
408                        }
409                    }
410
411                    Name (_CRS, ResourceTemplate()
412                    {
413                        IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
414                        IRQNoFlags () {7}
415                    })
416                }
417
418                Device(VGID) {
419                    Name(_HID, EisaId ("XEN0000"))
420                    Name(_UID, 0x00)
421                    Name(_CID, "VM_Gen_Counter")
422                    Name(_DDN, "VM_Gen_Counter")
423                    Method(_STA, 0, NotSerialized)
424                    {
425                        If(LEqual(\_SB.VGIA, 0x00000000)) {
426                            Return(0x00)
427                        } Else {
428                            Return(0x0F)
429                        }
430                    }
431                    Name(PKG, Package ()
432                    {
433                        0x00000000,
434                        0x00000000
435                    })
436                    Method(ADDR, 0, NotSerialized)
437                    {
438                        Store(\_SB.VGIA, Index(PKG, 0))
439                        Return(PKG)
440                    }
441                }
442            }
443        }
444    }
445    /* _S3 and _S4 are in separate SSDTs */
446    Name (\_S5, Package (0x04) {
447        0x00,  /* PM1a_CNT.SLP_TYP */
448        0x00,  /* PM1b_CNT.SLP_TYP */
449        0x00,  /* reserved */
450        0x00   /* reserved */
451    })
452    Name(PICD, 0)
453    Method(_PIC, 1) {
454        Store(Arg0, PICD)
455    }
456}
457