blob: a290a4c457fc6332ff8df2cd8b0cd156f7cf7d3c [file] [log] [blame]
Saket Sinhabccdf1d2015-08-22 12:20:57 +05301/* CPU hotplug */
2
3Scope(\_SB) {
4 /* Objects filled in by run-time generated SSDT */
5 External(NTFY, MethodObj)
6 External(CPON, PkgObj)
7
8 /* Methods called by run-time generated SSDT Processor objects */
9 Method(CPMA, 1, NotSerialized) {
10 /*
11 * _MAT method - create an madt apic buffer
12 * Arg0 = Processor ID = Local APIC ID
13 * Local0 = CPON flag for this cpu
14 */
15 Store(DerefOf(Index(CPON, Arg0)), Local0)
16 /* Local1 = Buffer (in madt apic form) to return */
17 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
18 /* Update the processor id, lapic id, and enable/disable status */
19 Store(Arg0, Index(Local1, 2))
20 Store(Arg0, Index(Local1, 3))
21 Store(Local0, Index(Local1, 4))
22 Return (Local1)
23 }
24 Method(CPST, 1, NotSerialized) {
25 /*
26 * _STA method - return ON status of cpu
27 * Arg0 = Processor ID = Local APIC ID
28 * Local0 = CPON flag for this cpu
29 */
30 Store(DerefOf(Index(CPON, Arg0)), Local0)
31 If (Local0) {
32 Return (0xf)
33 } Else {
34 Return (0x0)
35 }
36 }
37 Method(CPEJ, 2, NotSerialized) {
38 /* _EJ0 method - eject callback */
39 Sleep(200)
40 }
41
42 /* CPU hotplug notify method */
43 OperationRegion(PRST, SystemIO, 0xaf00, 32)
44 Field(PRST, ByteAcc, NoLock, Preserve) {
45 PRS, 256
46 }
47 Method(PRSC, 0) {
48 /* Local5 = active cpu bitmap */
49 Store(PRS, Local5)
50 /* Local2 = last read byte from bitmap */
51 Store(Zero, Local2)
52 /* Local0 = Processor ID / APIC ID iterator */
53 Store(Zero, Local0)
54 While (LLess(Local0, SizeOf(CPON))) {
55 /* Local1 = CPON flag for this cpu */
56 Store(DerefOf(Index(CPON, Local0)), Local1)
57 If (And(Local0, 0x07)) {
58 /* Shift down previously read bitmap byte */
59 ShiftRight(Local2, 1, Local2)
60 } Else {
61 /* Read next byte from cpu bitmap */
62 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
63 }
64 /* Local3 = active state for this cpu */
65 Store(And(Local2, 1), Local3)
66
67 If (LNotEqual(Local1, Local3)) {
68 /* State change - update CPON with new state */
69 Store(Local3, Index(CPON, Local0))
70 /* Do CPU notify */
71 If (LEqual(Local3, 1)) {
72 NTFY(Local0, 1)
73 } Else {
74 NTFY(Local0, 3)
75 }
76 }
77 Increment(Local0)
78 }
79 }
80}