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