b9b06f2ab64ff53e15706f85f03104b8e2553738
[seabios.git] / src / acpi-dsdt.dsl
1 /*
2  * Bochs/QEMU ACPI DSDT ASL definition
3  *
4  * Copyright (c) 2006 Fabrice Bellard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License version 2 as published by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 ACPI_EXTRACT_ALL_CODE AmlCode
21
22 DefinitionBlock (
23     "acpi-dsdt.aml",    // Output Filename
24     "DSDT",             // Signature
25     0x01,               // DSDT Compliance Revision
26     "BXPC",             // OEMID
27     "BXDSDT",           // TABLE ID
28     0x1                 // OEM Revision
29     )
30 {
31
32
33 /****************************************************************
34  * Debugging
35  ****************************************************************/
36
37     Scope (\)
38     {
39         /* Debug Output */
40         OperationRegion (DBG, SystemIO, 0x0402, 0x01)
41         Field (DBG, ByteAcc, NoLock, Preserve)
42         {
43             DBGB,   8,
44         }
45
46         /* Debug method - use this method to send output to the QEMU
47          * BIOS debug port.  This method handles strings, integers,
48          * and buffers.  For example: DBUG("abc") DBUG(0x123) */
49         Method(DBUG, 1) {
50             ToHexString(Arg0, Local0)
51             ToBuffer(Local0, Local0)
52             Subtract(SizeOf(Local0), 1, Local1)
53             Store(Zero, Local2)
54             While (LLess(Local2, Local1)) {
55                 Store(DerefOf(Index(Local0, Local2)), DBGB)
56                 Increment(Local2)
57             }
58             Store(0x0A, DBGB)
59         }
60     }
61
62
63 /****************************************************************
64  * PCI Bus definition
65  ****************************************************************/
66
67     Scope(\_SB) {
68         Device(PCI0) {
69             Name (_HID, EisaId ("PNP0A03"))
70             Name (_ADR, 0x00)
71             Name (_UID, 1)
72             Name(_PRT, Package() {
73                 /* PCI IRQ routing table, example from ACPI 2.0a specification,
74                    section 6.2.8.1 */
75                 /* Note: we provide the same info as the PCI routing
76                    table of the Bochs BIOS */
77 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
78        Package() { nr##ffff, 0, lnk0, 0 }, \
79        Package() { nr##ffff, 1, lnk1, 0 }, \
80        Package() { nr##ffff, 2, lnk2, 0 }, \
81        Package() { nr##ffff, 3, lnk3, 0 }
82
83 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
84 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
85 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
86 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
87                prt_slot0(0x0000),
88                /* Device 1 is power mgmt device, and can only use irq 9 */
89                prt_slot(0x0001, LNKS, LNKB, LNKC, LNKD),
90                prt_slot2(0x0002),
91                prt_slot3(0x0003),
92                prt_slot0(0x0004),
93                prt_slot1(0x0005),
94                prt_slot2(0x0006),
95                prt_slot3(0x0007),
96                prt_slot0(0x0008),
97                prt_slot1(0x0009),
98                prt_slot2(0x000a),
99                prt_slot3(0x000b),
100                prt_slot0(0x000c),
101                prt_slot1(0x000d),
102                prt_slot2(0x000e),
103                prt_slot3(0x000f),
104                prt_slot0(0x0010),
105                prt_slot1(0x0011),
106                prt_slot2(0x0012),
107                prt_slot3(0x0013),
108                prt_slot0(0x0014),
109                prt_slot1(0x0015),
110                prt_slot2(0x0016),
111                prt_slot3(0x0017),
112                prt_slot0(0x0018),
113                prt_slot1(0x0019),
114                prt_slot2(0x001a),
115                prt_slot3(0x001b),
116                prt_slot0(0x001c),
117                prt_slot1(0x001d),
118                prt_slot2(0x001e),
119                prt_slot3(0x001f),
120             })
121
122             OperationRegion(PCST, SystemIO, 0xae00, 0x08)
123             Field (PCST, DWordAcc, NoLock, WriteAsZeros)
124             {
125                 PCIU, 32,
126                 PCID, 32,
127             }
128
129             OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
130             Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
131             {
132                 B0EJ, 32,
133             }
134
135             OperationRegion(RMVC, SystemIO, 0xae0c, 0x04)
136             Field(RMVC, DWordAcc, NoLock, WriteAsZeros)
137             {
138                 PCRM, 32,
139             }
140
141             Name (_CRS, ResourceTemplate ()
142             {
143                 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
144                     0x0000,             // Address Space Granularity
145                     0x0000,             // Address Range Minimum
146                     0x00FF,             // Address Range Maximum
147                     0x0000,             // Address Translation Offset
148                     0x0100,             // Address Length
149                     ,, )
150                 IO (Decode16,
151                     0x0CF8,             // Address Range Minimum
152                     0x0CF8,             // Address Range Maximum
153                     0x01,               // Address Alignment
154                     0x08,               // Address Length
155                     )
156                 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
157                     0x0000,             // Address Space Granularity
158                     0x0000,             // Address Range Minimum
159                     0x0CF7,             // Address Range Maximum
160                     0x0000,             // Address Translation Offset
161                     0x0CF8,             // Address Length
162                     ,, , TypeStatic)
163                 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
164                     0x0000,             // Address Space Granularity
165                     0x0D00,             // Address Range Minimum
166                     0xFFFF,             // Address Range Maximum
167                     0x0000,             // Address Translation Offset
168                     0xF300,             // Address Length
169                     ,, , TypeStatic)
170                 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
171                     0x00000000,         // Address Space Granularity
172                     0x000A0000,         // Address Range Minimum
173                     0x000BFFFF,         // Address Range Maximum
174                     0x00000000,         // Address Translation Offset
175                     0x00020000,         // Address Length
176                     ,, , AddressRangeMemory, TypeStatic)
177                 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
178                     0x00000000,         // Address Space Granularity
179                     0xE0000000,         // Address Range Minimum
180                     0xFEBFFFFF,         // Address Range Maximum
181                     0x00000000,         // Address Translation Offset
182                     0x1EC00000,         // Address Length
183                     ,, , AddressRangeMemory, TypeStatic)
184             })
185         }
186     }
187
188
189 /****************************************************************
190  * HPET
191  ****************************************************************/
192
193     Scope(\_SB) {
194         Device(HPET) {
195             Name(_HID,  EISAID("PNP0103"))
196             Name(_UID, 0)
197             Method (_STA, 0, NotSerialized) {
198                     Return(0x0F)
199             }
200             Name(_CRS, ResourceTemplate() {
201                 DWordMemory(
202                     ResourceConsumer, PosDecode, MinFixed, MaxFixed,
203                     NonCacheable, ReadWrite,
204                     0x00000000,
205                     0xFED00000,
206                     0xFED003FF,
207                     0x00000000,
208                     0x00000400 /* 1K memory: FED00000 - FED003FF */
209                 )
210             })
211         }
212     }
213
214
215 /****************************************************************
216  * VGA
217  ****************************************************************/
218
219     Scope(\_SB.PCI0) {
220         Device (VGA) {
221                  Name (_ADR, 0x00020000)
222                  OperationRegion(PCIC, PCI_Config, Zero, 0x4)
223                  Field(PCIC, DWordAcc, NoLock, Preserve) {
224                          VEND, 32
225                  }
226                  Method (_S1D, 0, NotSerialized)
227                  {
228                          Return (0x00)
229                  }
230                  Method (_S2D, 0, NotSerialized)
231                  {
232                          Return (0x00)
233                  }
234                  Method (_S3D, 0, NotSerialized)
235                  {
236                          If (LEqual(VEND, 0x1001b36)) {
237                                  Return (0x03)           // QXL
238                          } Else {
239                                  Return (0x00)
240                          }
241                  }
242                  Method(_RMV) { Return (0x00) }
243         }
244     }
245
246
247 /****************************************************************
248  * PIIX3 ISA bridge
249  ****************************************************************/
250
251     Scope(\_SB.PCI0) {
252         Device (ISA) {
253             Name (_ADR, 0x00010000)
254             Method(_RMV) { Return (0x00) }
255
256             /* PIIX PCI to ISA irq remapping */
257             OperationRegion (P40C, PCI_Config, 0x60, 0x04)
258         }
259     }
260
261
262 /****************************************************************
263  * SuperIO devices (kbd, mouse, etc.)
264  ****************************************************************/
265
266     Scope(\_SB.PCI0.ISA) {
267             /* Real-time clock */
268             Device (RTC)
269             {
270                 Name (_HID, EisaId ("PNP0B00"))
271                 Name (_CRS, ResourceTemplate ()
272                 {
273                     IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
274                     IRQNoFlags () {8}
275                     IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
276                 })
277             }
278
279             /* Keyboard seems to be important for WinXP install */
280             Device (KBD)
281             {
282                 Name (_HID, EisaId ("PNP0303"))
283                 Method (_STA, 0, NotSerialized)
284                 {
285                     Return (0x0f)
286                 }
287
288                 Method (_CRS, 0, NotSerialized)
289                 {
290                      Name (TMP, ResourceTemplate ()
291                      {
292                     IO (Decode16,
293                         0x0060,             // Address Range Minimum
294                         0x0060,             // Address Range Maximum
295                         0x01,               // Address Alignment
296                         0x01,               // Address Length
297                         )
298                     IO (Decode16,
299                         0x0064,             // Address Range Minimum
300                         0x0064,             // Address Range Maximum
301                         0x01,               // Address Alignment
302                         0x01,               // Address Length
303                         )
304                     IRQNoFlags ()
305                         {1}
306                     })
307                     Return (TMP)
308                 }
309             }
310
311             /* PS/2 mouse */
312             Device (MOU)
313             {
314                 Name (_HID, EisaId ("PNP0F13"))
315                 Method (_STA, 0, NotSerialized)
316                 {
317                     Return (0x0f)
318                 }
319
320                 Method (_CRS, 0, NotSerialized)
321                 {
322                     Name (TMP, ResourceTemplate ()
323                     {
324                          IRQNoFlags () {12}
325                     })
326                     Return (TMP)
327                 }
328             }
329
330             /* PS/2 floppy controller */
331             Device (FDC0)
332             {
333                 Name (_HID, EisaId ("PNP0700"))
334                 Method (_STA, 0, NotSerialized)
335                 {
336                     Return (0x0F)
337                 }
338                 Method (_CRS, 0, NotSerialized)
339                 {
340                     Name (BUF0, ResourceTemplate ()
341                     {
342                         IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
343                         IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
344                         IRQNoFlags () {6}
345                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
346                     })
347                     Return (BUF0)
348                 }
349             }
350
351             /* Parallel port */
352             Device (LPT)
353             {
354                 Name (_HID, EisaId ("PNP0400"))
355                 Method (_STA, 0, NotSerialized)
356                 {
357                     Store (\_SB.PCI0.PX13.DRSA, Local0)
358                     And (Local0, 0x80000000, Local0)
359                     If (LEqual (Local0, 0))
360                     {
361                         Return (0x00)
362                     }
363                     Else
364                     {
365                         Return (0x0F)
366                     }
367                 }
368                 Method (_CRS, 0, NotSerialized)
369                 {
370                     Name (BUF0, ResourceTemplate ()
371                     {
372                         IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
373                         IRQNoFlags () {7}
374                     })
375                     Return (BUF0)
376                 }
377             }
378
379             /* Serial Ports */
380             Device (COM1)
381             {
382                 Name (_HID, EisaId ("PNP0501"))
383                 Name (_UID, 0x01)
384                 Method (_STA, 0, NotSerialized)
385                 {
386                     Store (\_SB.PCI0.PX13.DRSC, Local0)
387                     And (Local0, 0x08000000, Local0)
388                     If (LEqual (Local0, 0))
389                     {
390                         Return (0x00)
391                     }
392                     Else
393                     {
394                         Return (0x0F)
395                     }
396                 }
397                 Method (_CRS, 0, NotSerialized)
398                 {
399                     Name (BUF0, ResourceTemplate ()
400                     {
401                         IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
402                         IRQNoFlags () {4}
403                     })
404                     Return (BUF0)
405                 }
406             }
407
408             Device (COM2)
409             {
410                 Name (_HID, EisaId ("PNP0501"))
411                 Name (_UID, 0x02)
412                 Method (_STA, 0, NotSerialized)
413                 {
414                     Store (\_SB.PCI0.PX13.DRSC, Local0)
415                     And (Local0, 0x80000000, Local0)
416                     If (LEqual (Local0, 0))
417                     {
418                         Return (0x00)
419                     }
420                     Else
421                     {
422                         Return (0x0F)
423                     }
424                 }
425                 Method (_CRS, 0, NotSerialized)
426                 {
427                     Name (BUF0, ResourceTemplate ()
428                     {
429                         IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
430                         IRQNoFlags () {3}
431                     })
432                     Return (BUF0)
433                 }
434             }
435     }
436
437
438 /****************************************************************
439  * PIIX4 PM
440  ****************************************************************/
441
442     Scope(\_SB.PCI0) {
443         Device (PX13) {
444             Name (_ADR, 0x00010003)
445
446             OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
447             Field (P13C, DWordAcc, NoLock, Preserve)
448             {
449                 DRSA, 32,
450                 DRSB, 32,
451                 DRSC, 32,
452                 DRSE, 32,
453                 DRSF, 32,
454                 DRSG, 32,
455                 DRSH, 32,
456                 DRSI, 32,
457                 DRSJ, 32
458             }
459         }
460     }
461
462
463 /****************************************************************
464  * PCI hotplug
465  ****************************************************************/
466
467     Scope(\_SB.PCI0) {
468         /* Methods called by bulk generated PCI devices below */
469         Method (PRMV, 1, NotSerialized) {
470             // _RMV method - check if device can be removed
471             If (And(\_SB.PCI0.PCRM, ShiftLeft(1, Arg0))) {
472                 Return (0x1)
473             }
474             Return (0x0)
475         }
476
477 #define gen_pci_device(slot)                                    \
478         Device(SL##slot) {                                      \
479             Name (_ADR, 0x##slot##0000)                         \
480             Method (_RMV) { Return (PRMV(0x##slot)) }           \
481             Name (_SUN, 0x##slot)                               \
482         }
483
484         /* VGA (slot 1) and ISA bus (slot 2) defined above */
485         gen_pci_device(03)
486         gen_pci_device(04)
487         gen_pci_device(05)
488         gen_pci_device(06)
489         gen_pci_device(07)
490         gen_pci_device(08)
491         gen_pci_device(09)
492         gen_pci_device(0a)
493         gen_pci_device(0b)
494         gen_pci_device(0c)
495         gen_pci_device(0d)
496         gen_pci_device(0e)
497         gen_pci_device(0f)
498         gen_pci_device(10)
499         gen_pci_device(11)
500         gen_pci_device(12)
501         gen_pci_device(13)
502         gen_pci_device(14)
503         gen_pci_device(15)
504         gen_pci_device(16)
505         gen_pci_device(17)
506         gen_pci_device(18)
507         gen_pci_device(19)
508         gen_pci_device(1a)
509         gen_pci_device(1b)
510         gen_pci_device(1c)
511         gen_pci_device(1d)
512         gen_pci_device(1e)
513         gen_pci_device(1f)
514
515         /* Methods called by bulk generated hotplug devices below */
516         Method (PCEJ, 1, NotSerialized) {
517             // _EJ0 method - eject callback
518             Store(ShiftLeft(1, Arg0), B0EJ)
519             Return (0x0)
520         }
521
522         /* Bulk generated PCI hotplug devices */
523 #define hotplug_slot(slot)                              \
524         Device (S##slot) {                              \
525            Name (_ADR, 0x##slot##0000)                  \
526            Method (_EJ0, 1) { Return(PCEJ(0x##slot)) }  \
527            Name (_SUN, 0x##slot)                        \
528         }
529
530         hotplug_slot(01)
531         hotplug_slot(02)
532         hotplug_slot(03)
533         hotplug_slot(04)
534         hotplug_slot(05)
535         hotplug_slot(06)
536         hotplug_slot(07)
537         hotplug_slot(08)
538         hotplug_slot(09)
539         hotplug_slot(0a)
540         hotplug_slot(0b)
541         hotplug_slot(0c)
542         hotplug_slot(0d)
543         hotplug_slot(0e)
544         hotplug_slot(0f)
545         hotplug_slot(10)
546         hotplug_slot(11)
547         hotplug_slot(12)
548         hotplug_slot(13)
549         hotplug_slot(14)
550         hotplug_slot(15)
551         hotplug_slot(16)
552         hotplug_slot(17)
553         hotplug_slot(18)
554         hotplug_slot(19)
555         hotplug_slot(1a)
556         hotplug_slot(1b)
557         hotplug_slot(1c)
558         hotplug_slot(1d)
559         hotplug_slot(1e)
560         hotplug_slot(1f)
561
562         /* PCI hotplug notify method */
563         Method(PCNF, 0) {
564             // Local0 = iterator
565             Store (Zero, Local0)
566             While (LLess(Local0, 31)) {
567                 Increment(Local0)
568                 If (And(PCIU, ShiftLeft(1, Local0))) {
569                     PCNT(Local0, 1)
570                 }
571                 If (And(PCID, ShiftLeft(1, Local0))) {
572                     PCNT(Local0, 3)
573                 }
574             }
575             Return(One)
576         }
577
578 #define gen_pci_hotplug(slot)   \
579             If (LEqual(Arg0, 0x##slot)) { Notify(S##slot, Arg1) }
580
581         Method(PCNT, 2) {
582             gen_pci_hotplug(01)
583             gen_pci_hotplug(02)
584             gen_pci_hotplug(03)
585             gen_pci_hotplug(04)
586             gen_pci_hotplug(05)
587             gen_pci_hotplug(06)
588             gen_pci_hotplug(07)
589             gen_pci_hotplug(08)
590             gen_pci_hotplug(09)
591             gen_pci_hotplug(0a)
592             gen_pci_hotplug(0b)
593             gen_pci_hotplug(0c)
594             gen_pci_hotplug(0d)
595             gen_pci_hotplug(0e)
596             gen_pci_hotplug(0f)
597             gen_pci_hotplug(10)
598             gen_pci_hotplug(11)
599             gen_pci_hotplug(12)
600             gen_pci_hotplug(13)
601             gen_pci_hotplug(14)
602             gen_pci_hotplug(15)
603             gen_pci_hotplug(16)
604             gen_pci_hotplug(17)
605             gen_pci_hotplug(18)
606             gen_pci_hotplug(19)
607             gen_pci_hotplug(1a)
608             gen_pci_hotplug(1b)
609             gen_pci_hotplug(1c)
610             gen_pci_hotplug(1d)
611             gen_pci_hotplug(1e)
612             gen_pci_hotplug(1f)
613         }
614     }
615
616
617 /****************************************************************
618  * PCI IRQs
619  ****************************************************************/
620
621     Scope(\_SB) {
622         Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
623         {
624             PRQ0,   8,
625             PRQ1,   8,
626             PRQ2,   8,
627             PRQ3,   8
628         }
629
630         Method (IQST, 1, NotSerialized) {
631             // _STA method - get status
632             If (And (0x80, Arg0)) {
633                 Return (0x09)
634             }
635             Return (0x0B)
636         }
637         Method (IQDI, 1, NotSerialized) {
638             // _DIS method - disable interrupt
639             Or(DerefOf(Arg0), 0x80, Arg0)
640         }
641         Method (IQCR, 1, NotSerialized) {
642             // _CRS method - get current settings
643             Name (PRR0, ResourceTemplate ()
644             {
645                 Interrupt (, Level, ActiveHigh, Shared)
646                     { 0 }
647             })
648             CreateDWordField (PRR0, 0x05, PRRI)
649             If (LLess (Arg0, 0x80)) {
650                 Store (Arg0, PRRI)
651             }
652             Return (PRR0)
653         }
654         Method (IQSR, 2, NotSerialized) {
655             // _SRS method - set interrupt
656             CreateDWordField (Arg1, 0x05, PRRI)
657             Store (PRRI, Arg0)
658         }
659
660         Device(LNKA) {
661             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
662             Name(_UID, 1)
663             Name(_PRS, ResourceTemplate(){
664                 Interrupt (, Level, ActiveHigh, Shared)
665                     { 5, 10, 11 }
666             })
667             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
668             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
669             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
670             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) }
671         }
672         Device(LNKB) {
673             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
674             Name(_UID, 2)
675             Name(_PRS, ResourceTemplate(){
676                 Interrupt (, Level, ActiveHigh, Shared)
677                     { 5, 10, 11 }
678             })
679             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
680             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) }
681             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
682             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) }
683         }
684         Device(LNKC) {
685             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
686             Name(_UID, 3)
687             Name(_PRS, ResourceTemplate() {
688                 Interrupt (, Level, ActiveHigh, Shared)
689                     { 5, 10, 11 }
690             })
691             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
692             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) }
693             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
694             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) }
695         }
696         Device(LNKD) {
697             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
698             Name(_UID, 4)
699             Name(_PRS, ResourceTemplate() {
700                 Interrupt (, Level, ActiveHigh, Shared)
701                     { 5, 10, 11 }
702             })
703             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
704             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) }
705             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
706             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) }
707         }
708         Device(LNKS) {
709             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
710             Name(_UID, 5)
711             Name(_PRS, ResourceTemplate() {
712                 Interrupt (, Level, ActiveHigh, Shared)
713                     { 9 }
714             })
715             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
716             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
717             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
718         }
719     }
720
721
722 /****************************************************************
723  * Suspend
724  ****************************************************************/
725
726     /*
727      * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
728      * must match piix4 emulation.
729      */
730     Name (\_S3, Package (0x04)
731     {
732         0x01,  /* PM1a_CNT.SLP_TYP */
733         0x01,  /* PM1b_CNT.SLP_TYP */
734         Zero,  /* reserved */
735         Zero   /* reserved */
736     })
737     Name (\_S4, Package (0x04)
738     {
739         Zero,  /* PM1a_CNT.SLP_TYP */
740         Zero,  /* PM1b_CNT.SLP_TYP */
741         Zero,  /* reserved */
742         Zero   /* reserved */
743     })
744     Name (\_S5, Package (0x04)
745     {
746         Zero,  /* PM1a_CNT.SLP_TYP */
747         Zero,  /* PM1b_CNT.SLP_TYP */
748         Zero,  /* reserved */
749         Zero   /* reserved */
750     })
751
752
753 /****************************************************************
754  * CPU hotplug
755  ****************************************************************/
756
757     Scope(\_SB) {
758         /* Objects filled in by run-time generated SSDT */
759         External(NTFY, MethodObj)
760         External(CPON, PkgObj)
761
762         /* Methods called by run-time generated SSDT Processor objects */
763         Method (CPMA, 1, NotSerialized) {
764             // _MAT method - create an madt apic buffer
765             // Local0 = CPON flag for this cpu
766             Store(DerefOf(Index(CPON, Arg0)), Local0)
767             // Local1 = Buffer (in madt apic form) to return
768             Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
769             // Update the processor id, lapic id, and enable/disable status
770             Store(Arg0, Index(Local1, 2))
771             Store(Arg0, Index(Local1, 3))
772             Store(Local0, Index(Local1, 4))
773             Return (Local1)
774         }
775         Method (CPST, 1, NotSerialized) {
776             // _STA method - return ON status of cpu
777             // Local0 = CPON flag for this cpu
778             Store(DerefOf(Index(CPON, Arg0)), Local0)
779             If (Local0) { Return(0xF) } Else { Return(0x0) }
780         }
781         Method (CPEJ, 2, NotSerialized) {
782             // _EJ0 method - eject callback
783             Sleep(200)
784         }
785
786         /* CPU hotplug notify method */
787         OperationRegion(PRST, SystemIO, 0xaf00, 32)
788         Field (PRST, ByteAcc, NoLock, Preserve)
789         {
790             PRS, 256
791         }
792         Method(PRSC, 0) {
793             // Local5 = active cpu bitmap
794             Store (PRS, Local5)
795             // Local2 = last read byte from bitmap
796             Store (Zero, Local2)
797             // Local0 = cpuid iterator
798             Store (Zero, Local0)
799             While (LLess(Local0, SizeOf(CPON))) {
800                 // Local1 = CPON flag for this cpu
801                 Store(DerefOf(Index(CPON, Local0)), Local1)
802                 If (And(Local0, 0x07)) {
803                     // Shift down previously read bitmap byte
804                     ShiftRight(Local2, 1, Local2)
805                 } Else {
806                     // Read next byte from cpu bitmap
807                     Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
808                 }
809                 // Local3 = active state for this cpu
810                 Store(And(Local2, 1), Local3)
811
812                 If (LNotEqual(Local1, Local3)) {
813                     // State change - update CPON with new state
814                     Store(Local3, Index(CPON, Local0))
815                     // Do CPU notify
816                     If (LEqual(Local3, 1)) {
817                         NTFY(Local0, 1)
818                     } Else {
819                         NTFY(Local0, 3)
820                     }
821                 }
822                 Increment(Local0)
823             }
824             Return(One)
825         }
826     }
827
828
829 /****************************************************************
830  * General purpose events
831  ****************************************************************/
832
833     Scope (\_GPE)
834     {
835         Name(_HID, "ACPI0006")
836
837         Method(_L00) {
838             Return(0x01)
839         }
840         Method(_L01) {
841             // PCI hotplug event
842             Return(\_SB.PCI0.PCNF())
843         }
844         Method(_L02) {
845             // CPU hotplug event
846             Return(\_SB.PRSC())
847         }
848         Method(_L03) {
849             Return(0x01)
850         }
851         Method(_L04) {
852             Return(0x01)
853         }
854         Method(_L05) {
855             Return(0x01)
856         }
857         Method(_L06) {
858             Return(0x01)
859         }
860         Method(_L07) {
861             Return(0x01)
862         }
863         Method(_L08) {
864             Return(0x01)
865         }
866         Method(_L09) {
867             Return(0x01)
868         }
869         Method(_L0A) {
870             Return(0x01)
871         }
872         Method(_L0B) {
873             Return(0x01)
874         }
875         Method(_L0C) {
876             Return(0x01)
877         }
878         Method(_L0D) {
879             Return(0x01)
880         }
881         Method(_L0E) {
882             Return(0x01)
883         }
884         Method(_L0F) {
885             Return(0x01)
886         }
887     }
888 }