pc: acpi: cpuhp: move CPMA() method into SSDT
[qemu/ar7.git] / hw / i386 / acpi-dsdt-cpu-hotplug.dsl
blob97391914178497d2f1bfa11fe142fd2ef841b58e
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.
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.
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  */
16 /****************************************************************
17  * CPU hotplug
18  ****************************************************************/
20 Scope(\_SB) {
21     /* Objects filled in by run-time generated SSDT */
22     External(NTFY, MethodObj)
23     External(CPON, PkgObj)
24     External(PRS, FieldUnitObj)
26     /* Methods called by run-time generated SSDT Processor objects */
27     Method(CPST, 1, NotSerialized) {
28         // _STA method - return ON status of cpu
29         // Arg0 = Processor ID = Local APIC ID
30         // Local0 = CPON flag for this cpu
31         Store(DerefOf(Index(CPON, Arg0)), Local0)
32         If (Local0) {
33             Return (0xF)
34         } Else {
35             Return (0x0)
36         }
37     }
39     Method(PRSC, 0) {
40         // Local5 = active cpu bitmap
41         Store(PRS, Local5)
42         // Local2 = last read byte from bitmap
43         Store(Zero, Local2)
44         // Local0 = Processor ID / APIC ID iterator
45         Store(Zero, Local0)
46         While (LLess(Local0, SizeOf(CPON))) {
47             // Local1 = CPON flag for this cpu
48             Store(DerefOf(Index(CPON, Local0)), Local1)
49             If (And(Local0, 0x07)) {
50                 // Shift down previously read bitmap byte
51                 ShiftRight(Local2, 1, Local2)
52             } Else {
53                 // Read next byte from cpu bitmap
54                 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
55             }
56             // Local3 = active state for this cpu
57             Store(And(Local2, 1), Local3)
59             If (LNotEqual(Local1, Local3)) {
60                 // State change - update CPON with new state
61                 Store(Local3, Index(CPON, Local0))
62                 // Do CPU notify
63                 If (LEqual(Local3, 1)) {
64                     NTFY(Local0, 1)
65                 } Else {
66                     NTFY(Local0, 3)
67                 }
68             }
69             Increment(Local0)
70         }
71     }