Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


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