1 | /* $Id: vbox-cpuhotplug.dsl 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox ACPI
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | DefinitionBlock ("SSDT-cpuhotplug.aml", "SSDT", 1, "VBOX ", "VBOXCPUT", 2)
|
---|
29 | {
|
---|
30 | External(CPUC)
|
---|
31 | External(CPUL)
|
---|
32 | External(CPEV)
|
---|
33 | External(CPET)
|
---|
34 |
|
---|
35 | // Method to check for the CPU status
|
---|
36 | Method(CPCK, 1)
|
---|
37 | {
|
---|
38 | Store (Arg0, CPUC)
|
---|
39 | Return(LEqual(CPUL, 0x01))
|
---|
40 | }
|
---|
41 |
|
---|
42 | // Method to notify the VMM that a CPU is not
|
---|
43 | // in use anymore and can be safely removed.
|
---|
44 | // Using the extra method here because the CPUL
|
---|
45 | // register identifer clashes with the CPUL object defined
|
---|
46 | // below making iasl starting with version 20150930 fail.
|
---|
47 | //
|
---|
48 | // Think of CPLO as "CPU Lock Open"
|
---|
49 | Method(CPLO, 1)
|
---|
50 | {
|
---|
51 | Store(Arg0, CPUL)
|
---|
52 | }
|
---|
53 |
|
---|
54 | Scope (\_SB)
|
---|
55 | {
|
---|
56 |
|
---|
57 | #define GENERATE_CPU_OBJECT(id, sck, sckuid, cpu)<NL> \
|
---|
58 | Device (sck) \
|
---|
59 | { \
|
---|
60 | Name (_HID, "ACPI0004") \
|
---|
61 | Name (_UID, sckuid) \
|
---|
62 | \
|
---|
63 | <NL> \
|
---|
64 | Processor (cpu, /* Name */ \
|
---|
65 | id, /* Id */ \
|
---|
66 | 0x0, /* Processor IO ports range start */ \
|
---|
67 | 0x0 /* Processor IO ports range length */ \
|
---|
68 | ) \
|
---|
69 | { \
|
---|
70 | Name (_HID, "ACPI0007") \
|
---|
71 | Name (_UID, id) \
|
---|
72 | Name (_PXM, 0x00) \
|
---|
73 | <NL> \
|
---|
74 | Method(_MAT, 0, Serialized) \
|
---|
75 | { \
|
---|
76 | Name (APIC, Buffer (8) {0x00, 0x08, id, id}) \
|
---|
77 | IF (CPCK(id)) \
|
---|
78 | { \
|
---|
79 | Store (One, Index (APIC, 4)) \
|
---|
80 | } \
|
---|
81 | Else \
|
---|
82 | { \
|
---|
83 | Store (Zero, Index (APIC, 4)) \
|
---|
84 | } \
|
---|
85 | Return (APIC) \
|
---|
86 | } \
|
---|
87 | <NL> \
|
---|
88 | Method(_STA) /* Used for device presence detection */ \
|
---|
89 | { \
|
---|
90 | IF (CPCK(id)) \
|
---|
91 | { \
|
---|
92 | Return (0xF) \
|
---|
93 | } \
|
---|
94 | Else \
|
---|
95 | { \
|
---|
96 | Return (0x0) \
|
---|
97 | } \
|
---|
98 | } \
|
---|
99 | <NL> \
|
---|
100 | Method(_EJ0, 1) \
|
---|
101 | { \
|
---|
102 | CPLO(id) /* Unlock the CPU */ \
|
---|
103 | Return \
|
---|
104 | } \
|
---|
105 | } \
|
---|
106 | } \
|
---|
107 |
|
---|
108 | GENERATE_CPU_OBJECT(0x00, SCK0, "SCKCPU0", CPU0)
|
---|
109 | GENERATE_CPU_OBJECT(0x01, SCK1, "SCKCPU1", CPU1)
|
---|
110 | GENERATE_CPU_OBJECT(0x02, SCK2, "SCKCPU2", CPU2)
|
---|
111 | GENERATE_CPU_OBJECT(0x03, SCK3, "SCKCPU3", CPU3)
|
---|
112 | GENERATE_CPU_OBJECT(0x04, SCK4, "SCKCPU4", CPU4)
|
---|
113 | GENERATE_CPU_OBJECT(0x05, SCK5, "SCKCPU5", CPU5)
|
---|
114 | GENERATE_CPU_OBJECT(0x06, SCK6, "SCKCPU6", CPU6)
|
---|
115 | GENERATE_CPU_OBJECT(0x07, SCK7, "SCKCPU7", CPU7)
|
---|
116 | GENERATE_CPU_OBJECT(0x08, SCK8, "SCKCPU8", CPU8)
|
---|
117 | GENERATE_CPU_OBJECT(0x09, SCK9, "SCKCPU9", CPU9)
|
---|
118 | GENERATE_CPU_OBJECT(0x0a, SCKA, "SCKCPUA", CPUA)
|
---|
119 | GENERATE_CPU_OBJECT(0x0b, SCKB, "SCKCPUB", CPUB)
|
---|
120 | GENERATE_CPU_OBJECT(0x0c, SCKC, "SCKCPUC", CPUC)
|
---|
121 | GENERATE_CPU_OBJECT(0x0d, SCKD, "SCKCPUD", CPUD)
|
---|
122 | GENERATE_CPU_OBJECT(0x0e, SCKE, "SCKCPUE", CPUE)
|
---|
123 | GENERATE_CPU_OBJECT(0x0f, SCKF, "SCKCPUF", CPUF)
|
---|
124 | GENERATE_CPU_OBJECT(0x10, SCKG, "SCKCPUG", CPUG)
|
---|
125 | GENERATE_CPU_OBJECT(0x11, SCKH, "SCKCPUH", CPUH)
|
---|
126 | GENERATE_CPU_OBJECT(0x12, SCKI, "SCKCPUI", CPUI)
|
---|
127 | GENERATE_CPU_OBJECT(0x13, SCKJ, "SCKCPUJ", CPUJ)
|
---|
128 | GENERATE_CPU_OBJECT(0x14, SCKK, "SCKCPUK", CPUK)
|
---|
129 | GENERATE_CPU_OBJECT(0x15, SCKL, "SCKCPUL", CPUL)
|
---|
130 | GENERATE_CPU_OBJECT(0x16, SCKM, "SCKCPUM", CPUM)
|
---|
131 | GENERATE_CPU_OBJECT(0x17, SCKN, "SCKCPUN", CPUN)
|
---|
132 | GENERATE_CPU_OBJECT(0x18, SCKO, "SCKCPUO", CPUO)
|
---|
133 | GENERATE_CPU_OBJECT(0x19, SCKP, "SCKCPUP", CPUP)
|
---|
134 | GENERATE_CPU_OBJECT(0x1a, SCKQ, "SCKCPUQ", CPUQ)
|
---|
135 | GENERATE_CPU_OBJECT(0x1b, SCKR, "SCKCPUR", CPUR)
|
---|
136 | GENERATE_CPU_OBJECT(0x1c, SCKS, "SCKCPUS", CPUS)
|
---|
137 | GENERATE_CPU_OBJECT(0x1d, SCKT, "SCKCPUT", CPUT)
|
---|
138 | GENERATE_CPU_OBJECT(0x1e, SCKU, "SCKCPUU", CPUU)
|
---|
139 | GENERATE_CPU_OBJECT(0x1f, SCKV, "SCKCPUV", CPUV)
|
---|
140 |
|
---|
141 | #undef GENERATE_CPU_OBJECT
|
---|
142 | }
|
---|
143 |
|
---|
144 | Scope (\_GPE)
|
---|
145 | {
|
---|
146 |
|
---|
147 | #define CHECK_CPU(cpu, sck, cpuname) \
|
---|
148 | IF (LEqual(Local0, cpu)) \
|
---|
149 | { \
|
---|
150 | Notify (\_SB.sck.cpuname, Local1) \
|
---|
151 | } \
|
---|
152 |
|
---|
153 | // GPE bit 1 handler
|
---|
154 | // GPE.1 must be set and SCI raised when
|
---|
155 | // processor info changed and CPU must be
|
---|
156 | // re-evaluated
|
---|
157 | Method (_L01, 0, NotSerialized)
|
---|
158 | {
|
---|
159 | Store(CPEV, Local0)
|
---|
160 | Store(CPET, Local1)
|
---|
161 |
|
---|
162 | CHECK_CPU(0x01, SCK1, CPU1)
|
---|
163 | CHECK_CPU(0x02, SCK2, CPU2)
|
---|
164 | CHECK_CPU(0x03, SCK3, CPU3)
|
---|
165 | CHECK_CPU(0x04, SCK4, CPU4)
|
---|
166 | CHECK_CPU(0x05, SCK5, CPU5)
|
---|
167 | CHECK_CPU(0x06, SCK6, CPU6)
|
---|
168 | CHECK_CPU(0x07, SCK7, CPU7)
|
---|
169 | CHECK_CPU(0x08, SCK8, CPU8)
|
---|
170 | CHECK_CPU(0x09, SCK9, CPU9)
|
---|
171 | CHECK_CPU(0x0a, SCKA, CPUA)
|
---|
172 | CHECK_CPU(0x0b, SCKB, CPUB)
|
---|
173 | CHECK_CPU(0x0c, SCKC, CPUC)
|
---|
174 | CHECK_CPU(0x0d, SCKD, CPUD)
|
---|
175 | CHECK_CPU(0x0e, SCKE, CPUE)
|
---|
176 | CHECK_CPU(0x0f, SCKF, CPUF)
|
---|
177 | CHECK_CPU(0x10, SCKG, CPUG)
|
---|
178 | CHECK_CPU(0x11, SCKH, CPUH)
|
---|
179 | CHECK_CPU(0x12, SCKI, CPUI)
|
---|
180 | CHECK_CPU(0x13, SCKJ, CPUJ)
|
---|
181 | CHECK_CPU(0x14, SCKK, CPUK)
|
---|
182 | CHECK_CPU(0x15, SCKL, CPUL)
|
---|
183 | CHECK_CPU(0x16, SCKM, CPUM)
|
---|
184 | CHECK_CPU(0x17, SCKN, CPUN)
|
---|
185 | CHECK_CPU(0x18, SCKO, CPUO)
|
---|
186 | CHECK_CPU(0x19, SCKP, CPUP)
|
---|
187 | CHECK_CPU(0x1a, SCKQ, CPUQ)
|
---|
188 | CHECK_CPU(0x1b, SCKR, CPUR)
|
---|
189 | CHECK_CPU(0x1c, SCKS, CPUS)
|
---|
190 | CHECK_CPU(0x1d, SCKT, CPUT)
|
---|
191 | CHECK_CPU(0x1e, SCKU, CPUU)
|
---|
192 | CHECK_CPU(0x1f, SCKV, CPUV)
|
---|
193 | }
|
---|
194 |
|
---|
195 | #undef CHECK_CPU
|
---|
196 | }
|
---|
197 |
|
---|
198 | }
|
---|
199 |
|
---|
200 | /*
|
---|
201 | * Local Variables:
|
---|
202 | * comment-start: "//"
|
---|
203 | * End:
|
---|
204 | */
|
---|