acpi: add ssdt for pci 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
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         /* Methods called by hotplug devices */
478         Method (PCEJ, 1, NotSerialized) {
479             // _EJ0 method - eject callback
480             Store(ShiftLeft(1, Arg0), B0EJ)
481             Return (0x0)
482         }
483
484         /* Hotplug notification method supplied by SSDT */
485         External (\_SB.PCI0.PCNT, MethodObj)
486
487         /* PCI hotplug notify method */
488         Method(PCNF, 0) {
489             // Local0 = iterator
490             Store (Zero, Local0)
491             While (LLess(Local0, 31)) {
492                 Increment(Local0)
493                 If (And(PCIU, ShiftLeft(1, Local0))) {
494                     PCNT(Local0, 1)
495                 }
496                 If (And(PCID, ShiftLeft(1, Local0))) {
497                     PCNT(Local0, 3)
498                 }
499             }
500             Return(One)
501         }
502
503     }
504
505
506 /****************************************************************
507  * PCI IRQs
508  ****************************************************************/
509
510     Scope(\_SB) {
511         Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
512         {
513             PRQ0,   8,
514             PRQ1,   8,
515             PRQ2,   8,
516             PRQ3,   8
517         }
518
519         Method (IQST, 1, NotSerialized) {
520             // _STA method - get status
521             If (And (0x80, Arg0)) {
522                 Return (0x09)
523             }
524             Return (0x0B)
525         }
526         Method (IQDI, 1, NotSerialized) {
527             // _DIS method - disable interrupt
528             Or(DerefOf(Arg0), 0x80, Arg0)
529         }
530         Method (IQCR, 1, NotSerialized) {
531             // _CRS method - get current settings
532             Name (PRR0, ResourceTemplate ()
533             {
534                 Interrupt (, Level, ActiveHigh, Shared)
535                     { 0 }
536             })
537             CreateDWordField (PRR0, 0x05, PRRI)
538             If (LLess (Arg0, 0x80)) {
539                 Store (Arg0, PRRI)
540             }
541             Return (PRR0)
542         }
543         Method (IQSR, 2, NotSerialized) {
544             // _SRS method - set interrupt
545             CreateDWordField (Arg1, 0x05, PRRI)
546             Store (PRRI, Arg0)
547         }
548
549         Device(LNKA) {
550             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
551             Name(_UID, 1)
552             Name(_PRS, ResourceTemplate(){
553                 Interrupt (, Level, ActiveHigh, Shared)
554                     { 5, 10, 11 }
555             })
556             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
557             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
558             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
559             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) }
560         }
561         Device(LNKB) {
562             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
563             Name(_UID, 2)
564             Name(_PRS, ResourceTemplate(){
565                 Interrupt (, Level, ActiveHigh, Shared)
566                     { 5, 10, 11 }
567             })
568             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
569             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) }
570             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
571             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) }
572         }
573         Device(LNKC) {
574             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
575             Name(_UID, 3)
576             Name(_PRS, ResourceTemplate() {
577                 Interrupt (, Level, ActiveHigh, Shared)
578                     { 5, 10, 11 }
579             })
580             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
581             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) }
582             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
583             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) }
584         }
585         Device(LNKD) {
586             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
587             Name(_UID, 4)
588             Name(_PRS, ResourceTemplate() {
589                 Interrupt (, Level, ActiveHigh, Shared)
590                     { 5, 10, 11 }
591             })
592             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
593             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) }
594             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
595             Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) }
596         }
597         Device(LNKS) {
598             Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
599             Name(_UID, 5)
600             Name(_PRS, ResourceTemplate() {
601                 Interrupt (, Level, ActiveHigh, Shared)
602                     { 9 }
603             })
604             Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
605             Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
606             Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
607         }
608     }
609
610
611 /****************************************************************
612  * Suspend
613  ****************************************************************/
614
615     /*
616      * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
617      * must match piix4 emulation.
618      */
619     Name (\_S3, Package (0x04)
620     {
621         0x01,  /* PM1a_CNT.SLP_TYP */
622         0x01,  /* PM1b_CNT.SLP_TYP */
623         Zero,  /* reserved */
624         Zero   /* reserved */
625     })
626     Name (\_S4, Package (0x04)
627     {
628         Zero,  /* PM1a_CNT.SLP_TYP */
629         Zero,  /* PM1b_CNT.SLP_TYP */
630         Zero,  /* reserved */
631         Zero   /* reserved */
632     })
633     Name (\_S5, Package (0x04)
634     {
635         Zero,  /* PM1a_CNT.SLP_TYP */
636         Zero,  /* PM1b_CNT.SLP_TYP */
637         Zero,  /* reserved */
638         Zero   /* reserved */
639     })
640
641
642 /****************************************************************
643  * CPU hotplug
644  ****************************************************************/
645
646     Scope(\_SB) {
647         /* Objects filled in by run-time generated SSDT */
648         External(NTFY, MethodObj)
649         External(CPON, PkgObj)
650
651         /* Methods called by run-time generated SSDT Processor objects */
652         Method (CPMA, 1, NotSerialized) {
653             // _MAT method - create an madt apic buffer
654             // Local0 = CPON flag for this cpu
655             Store(DerefOf(Index(CPON, Arg0)), Local0)
656             // Local1 = Buffer (in madt apic form) to return
657             Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
658             // Update the processor id, lapic id, and enable/disable status
659             Store(Arg0, Index(Local1, 2))
660             Store(Arg0, Index(Local1, 3))
661             Store(Local0, Index(Local1, 4))
662             Return (Local1)
663         }
664         Method (CPST, 1, NotSerialized) {
665             // _STA method - return ON status of cpu
666             // Local0 = CPON flag for this cpu
667             Store(DerefOf(Index(CPON, Arg0)), Local0)
668             If (Local0) { Return(0xF) } Else { Return(0x0) }
669         }
670         Method (CPEJ, 2, NotSerialized) {
671             // _EJ0 method - eject callback
672             Sleep(200)
673         }
674
675         /* CPU hotplug notify method */
676         OperationRegion(PRST, SystemIO, 0xaf00, 32)
677         Field (PRST, ByteAcc, NoLock, Preserve)
678         {
679             PRS, 256
680         }
681         Method(PRSC, 0) {
682             // Local5 = active cpu bitmap
683             Store (PRS, Local5)
684             // Local2 = last read byte from bitmap
685             Store (Zero, Local2)
686             // Local0 = cpuid iterator
687             Store (Zero, Local0)
688             While (LLess(Local0, SizeOf(CPON))) {
689                 // Local1 = CPON flag for this cpu
690                 Store(DerefOf(Index(CPON, Local0)), Local1)
691                 If (And(Local0, 0x07)) {
692                     // Shift down previously read bitmap byte
693                     ShiftRight(Local2, 1, Local2)
694                 } Else {
695                     // Read next byte from cpu bitmap
696                     Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
697                 }
698                 // Local3 = active state for this cpu
699                 Store(And(Local2, 1), Local3)
700
701                 If (LNotEqual(Local1, Local3)) {
702                     // State change - update CPON with new state
703                     Store(Local3, Index(CPON, Local0))
704                     // Do CPU notify
705                     If (LEqual(Local3, 1)) {
706                         NTFY(Local0, 1)
707                     } Else {
708                         NTFY(Local0, 3)
709                     }
710                 }
711                 Increment(Local0)
712             }
713             Return(One)
714         }
715     }
716
717
718 /****************************************************************
719  * General purpose events
720  ****************************************************************/
721
722     Scope (\_GPE)
723     {
724         Name(_HID, "ACPI0006")
725
726         Method(_L00) {
727             Return(0x01)
728         }
729         Method(_L01) {
730             // PCI hotplug event
731             Return(\_SB.PCI0.PCNF())
732         }
733         Method(_L02) {
734             // CPU hotplug event
735             Return(\_SB.PRSC())
736         }
737         Method(_L03) {
738             Return(0x01)
739         }
740         Method(_L04) {
741             Return(0x01)
742         }
743         Method(_L05) {
744             Return(0x01)
745         }
746         Method(_L06) {
747             Return(0x01)
748         }
749         Method(_L07) {
750             Return(0x01)
751         }
752         Method(_L08) {
753             Return(0x01)
754         }
755         Method(_L09) {
756             Return(0x01)
757         }
758         Method(_L0A) {
759             Return(0x01)
760         }
761         Method(_L0B) {
762             Return(0x01)
763         }
764         Method(_L0C) {
765             Return(0x01)
766         }
767         Method(_L0D) {
768             Return(0x01)
769         }
770         Method(_L0E) {
771             Return(0x01)
772         }
773         Method(_L0F) {
774             Return(0x01)
775         }
776     }
777 }