]>
Commit | Line | Data |
---|---|---|
74523b85 MT |
1 | /* |
2 | * This program is free software; you can redistribute it and/or modify | |
3 | * it under the terms of the GNU General Public License as published by | |
4 | * the Free Software Foundation; either version 2 of the License, or | |
5 | * (at your option) any later version. | |
6 | ||
7 | * This program is distributed in the hope that it will be useful, | |
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | * GNU General Public License for more details. | |
11 | ||
12 | * You should have received a copy of the GNU General Public License along | |
13 | * with this program; if not, see <http://www.gnu.org/licenses/>. | |
14 | */ | |
15 | ||
16 | /**************************************************************** | |
17 | * CPU hotplug | |
18 | ****************************************************************/ | |
19 | ||
20 | Scope(\_SB) { | |
21 | /* Objects filled in by run-time generated SSDT */ | |
22 | External(NTFY, MethodObj) | |
23 | External(CPON, PkgObj) | |
24 | ||
25 | /* Methods called by run-time generated SSDT Processor objects */ | |
26 | Method(CPMA, 1, NotSerialized) { | |
27 | // _MAT method - create an madt apic buffer | |
28 | // Arg0 = Processor ID = Local APIC ID | |
29 | // Local0 = CPON flag for this cpu | |
30 | Store(DerefOf(Index(CPON, Arg0)), Local0) | |
31 | // Local1 = Buffer (in madt apic form) to return | |
32 | Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1) | |
33 | // Update the processor id, lapic id, and enable/disable status | |
34 | Store(Arg0, Index(Local1, 2)) | |
35 | Store(Arg0, Index(Local1, 3)) | |
36 | Store(Local0, Index(Local1, 4)) | |
37 | Return (Local1) | |
38 | } | |
39 | Method(CPST, 1, NotSerialized) { | |
40 | // _STA method - return ON status of cpu | |
41 | // Arg0 = Processor ID = Local APIC ID | |
42 | // Local0 = CPON flag for this cpu | |
43 | Store(DerefOf(Index(CPON, Arg0)), Local0) | |
44 | If (Local0) { | |
45 | Return (0xF) | |
46 | } Else { | |
47 | Return (0x0) | |
48 | } | |
49 | } | |
50 | Method(CPEJ, 2, NotSerialized) { | |
51 | // _EJ0 method - eject callback | |
52 | Sleep(200) | |
53 | } | |
54 | ||
55 | /* CPU hotplug notify method */ | |
56 | OperationRegion(PRST, SystemIO, 0xaf00, 32) | |
57 | Field(PRST, ByteAcc, NoLock, Preserve) { | |
58 | PRS, 256 | |
59 | } | |
60 | Method(PRSC, 0) { | |
61 | // Local5 = active cpu bitmap | |
62 | Store(PRS, Local5) | |
63 | // Local2 = last read byte from bitmap | |
64 | Store(Zero, Local2) | |
65 | // Local0 = Processor ID / APIC ID iterator | |
66 | Store(Zero, Local0) | |
67 | While (LLess(Local0, SizeOf(CPON))) { | |
68 | // Local1 = CPON flag for this cpu | |
69 | Store(DerefOf(Index(CPON, Local0)), Local1) | |
70 | If (And(Local0, 0x07)) { | |
71 | // Shift down previously read bitmap byte | |
72 | ShiftRight(Local2, 1, Local2) | |
73 | } Else { | |
74 | // Read next byte from cpu bitmap | |
75 | Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) | |
76 | } | |
77 | // Local3 = active state for this cpu | |
78 | Store(And(Local2, 1), Local3) | |
79 | ||
80 | If (LNotEqual(Local1, Local3)) { | |
81 | // State change - update CPON with new state | |
82 | Store(Local3, Index(CPON, Local0)) | |
83 | // Do CPU notify | |
84 | If (LEqual(Local3, 1)) { | |
85 | NTFY(Local0, 1) | |
86 | } Else { | |
87 | NTFY(Local0, 3) | |
88 | } | |
89 | } | |
90 | Increment(Local0) | |
91 | } | |
92 | } | |
93 | } |