]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $) | |
3 | * | |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | |
6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> | |
7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | |
8 | * - Added processor hotplug support | |
9 | * | |
10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
11 | * | |
12 | * This program is free software; you can redistribute it and/or modify | |
13 | * it under the terms of the GNU General Public License as published by | |
14 | * the Free Software Foundation; either version 2 of the License, or (at | |
15 | * your option) any later version. | |
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 along | |
23 | * with this program; if not, write to the Free Software Foundation, Inc., | |
24 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
25 | * | |
26 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
27 | * TBD: | |
28 | * 1. Make # power states dynamic. | |
29 | * 2. Support duty_cycle values that span bit 4. | |
30 | * 3. Optimize by having scheduler determine business instead of | |
31 | * having us try to calculate it here. | |
32 | * 4. Need C1 timing -- must modify kernel (IRQ handler) to get this. | |
33 | */ | |
34 | ||
35 | #include <linux/kernel.h> | |
36 | #include <linux/module.h> | |
37 | #include <linux/init.h> | |
38 | #include <linux/types.h> | |
39 | #include <linux/pci.h> | |
40 | #include <linux/pm.h> | |
41 | #include <linux/cpufreq.h> | |
42 | #include <linux/cpu.h> | |
43 | #include <linux/proc_fs.h> | |
44 | #include <linux/seq_file.h> | |
45 | #include <linux/dmi.h> | |
46 | #include <linux/moduleparam.h> | |
4f86d3a8 | 47 | #include <linux/cpuidle.h> |
5a0e3ad6 | 48 | #include <linux/slab.h> |
1da177e4 LT |
49 | |
50 | #include <asm/io.h> | |
51 | #include <asm/system.h> | |
52 | #include <asm/cpu.h> | |
53 | #include <asm/delay.h> | |
54 | #include <asm/uaccess.h> | |
55 | #include <asm/processor.h> | |
56 | #include <asm/smp.h> | |
57 | #include <asm/acpi.h> | |
58 | ||
59 | #include <acpi/acpi_bus.h> | |
60 | #include <acpi/acpi_drivers.h> | |
61 | #include <acpi/processor.h> | |
62 | ||
a192a958 LB |
63 | #define PREFIX "ACPI: " |
64 | ||
1da177e4 | 65 | #define ACPI_PROCESSOR_CLASS "processor" |
1da177e4 LT |
66 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" |
67 | #define ACPI_PROCESSOR_FILE_INFO "info" | |
68 | #define ACPI_PROCESSOR_FILE_THROTTLING "throttling" | |
69 | #define ACPI_PROCESSOR_FILE_LIMIT "limit" | |
70 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 | |
71 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 | |
01854e69 | 72 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 |
1da177e4 LT |
73 | |
74 | #define ACPI_PROCESSOR_LIMIT_USER 0 | |
75 | #define ACPI_PROCESSOR_LIMIT_THERMAL 1 | |
76 | ||
1da177e4 | 77 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
0131aa3d | 78 | ACPI_MODULE_NAME("processor_driver"); |
1da177e4 | 79 | |
f52fd66d | 80 | MODULE_AUTHOR("Paul Diefenbaugh"); |
7cda93e0 | 81 | MODULE_DESCRIPTION("ACPI Processor Driver"); |
1da177e4 LT |
82 | MODULE_LICENSE("GPL"); |
83 | ||
4be44fcd | 84 | static int acpi_processor_add(struct acpi_device *device); |
4be44fcd | 85 | static int acpi_processor_remove(struct acpi_device *device, int type); |
74cad4ee | 86 | #ifdef CONFIG_ACPI_PROCFS |
1da177e4 | 87 | static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); |
74cad4ee | 88 | #endif |
7ec0a729 | 89 | static void acpi_processor_notify(struct acpi_device *device, u32 event); |
1da177e4 LT |
90 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); |
91 | static int acpi_processor_handle_eject(struct acpi_processor *pr); | |
01854e69 | 92 | |
1da177e4 | 93 | |
1ba90e3a | 94 | static const struct acpi_device_id processor_device_ids[] = { |
ad93a765 | 95 | {ACPI_PROCESSOR_OBJECT_HID, 0}, |
9eccbc2f | 96 | {"ACPI0007", 0}, |
1ba90e3a TR |
97 | {"", 0}, |
98 | }; | |
99 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | |
100 | ||
1da177e4 | 101 | static struct acpi_driver acpi_processor_driver = { |
c2b6705b | 102 | .name = "processor", |
4be44fcd | 103 | .class = ACPI_PROCESSOR_CLASS, |
1ba90e3a | 104 | .ids = processor_device_ids, |
4be44fcd LB |
105 | .ops = { |
106 | .add = acpi_processor_add, | |
107 | .remove = acpi_processor_remove, | |
b04e7bdb TG |
108 | .suspend = acpi_processor_suspend, |
109 | .resume = acpi_processor_resume, | |
7ec0a729 | 110 | .notify = acpi_processor_notify, |
4be44fcd | 111 | }, |
1da177e4 LT |
112 | }; |
113 | ||
114 | #define INSTALL_NOTIFY_HANDLER 1 | |
115 | #define UNINSTALL_NOTIFY_HANDLER 2 | |
74cad4ee | 116 | #ifdef CONFIG_ACPI_PROCFS |
d7508032 | 117 | static const struct file_operations acpi_processor_info_fops = { |
cf7acfab | 118 | .owner = THIS_MODULE, |
4be44fcd LB |
119 | .open = acpi_processor_info_open_fs, |
120 | .read = seq_read, | |
121 | .llseek = seq_lseek, | |
122 | .release = single_release, | |
1da177e4 | 123 | }; |
74cad4ee | 124 | #endif |
1da177e4 | 125 | |
706546d0 | 126 | DEFINE_PER_CPU(struct acpi_processor *, processors); |
0f1d683f NC |
127 | EXPORT_PER_CPU_SYMBOL(processors); |
128 | ||
9f222718 | 129 | struct acpi_processor_errata errata __read_mostly; |
1da177e4 | 130 | |
1da177e4 LT |
131 | /* -------------------------------------------------------------------------- |
132 | Errata Handling | |
133 | -------------------------------------------------------------------------- */ | |
134 | ||
4be44fcd | 135 | static int acpi_processor_errata_piix4(struct pci_dev *dev) |
1da177e4 | 136 | { |
4be44fcd LB |
137 | u8 value1 = 0; |
138 | u8 value2 = 0; | |
1da177e4 | 139 | |
1da177e4 LT |
140 | |
141 | if (!dev) | |
d550d98d | 142 | return -EINVAL; |
1da177e4 LT |
143 | |
144 | /* | |
145 | * Note that 'dev' references the PIIX4 ACPI Controller. | |
146 | */ | |
147 | ||
44c10138 | 148 | switch (dev->revision) { |
1da177e4 LT |
149 | case 0: |
150 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); | |
151 | break; | |
152 | case 1: | |
153 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n")); | |
154 | break; | |
155 | case 2: | |
156 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n")); | |
157 | break; | |
158 | case 3: | |
159 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n")); | |
160 | break; | |
161 | default: | |
162 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n")); | |
163 | break; | |
164 | } | |
165 | ||
44c10138 | 166 | switch (dev->revision) { |
1da177e4 LT |
167 | |
168 | case 0: /* PIIX4 A-step */ | |
169 | case 1: /* PIIX4 B-step */ | |
170 | /* | |
171 | * See specification changes #13 ("Manual Throttle Duty Cycle") | |
172 | * and #14 ("Enabling and Disabling Manual Throttle"), plus | |
173 | * erratum #5 ("STPCLK# Deassertion Time") from the January | |
174 | * 2002 PIIX4 specification update. Applies to only older | |
175 | * PIIX4 models. | |
176 | */ | |
177 | errata.piix4.throttle = 1; | |
178 | ||
179 | case 2: /* PIIX4E */ | |
180 | case 3: /* PIIX4M */ | |
181 | /* | |
182 | * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA | |
183 | * Livelock") from the January 2002 PIIX4 specification update. | |
184 | * Applies to all PIIX4 models. | |
185 | */ | |
186 | ||
187 | /* | |
188 | * BM-IDE | |
189 | * ------ | |
190 | * Find the PIIX4 IDE Controller and get the Bus Master IDE | |
191 | * Status register address. We'll use this later to read | |
192 | * each IDE controller's DMA status to make sure we catch all | |
193 | * DMA activity. | |
194 | */ | |
195 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | |
4be44fcd LB |
196 | PCI_DEVICE_ID_INTEL_82371AB, |
197 | PCI_ANY_ID, PCI_ANY_ID, NULL); | |
1da177e4 LT |
198 | if (dev) { |
199 | errata.piix4.bmisx = pci_resource_start(dev, 4); | |
200 | pci_dev_put(dev); | |
201 | } | |
202 | ||
203 | /* | |
204 | * Type-F DMA | |
205 | * ---------- | |
206 | * Find the PIIX4 ISA Controller and read the Motherboard | |
207 | * DMA controller's status to see if Type-F (Fast) DMA mode | |
208 | * is enabled (bit 7) on either channel. Note that we'll | |
209 | * disable C3 support if this is enabled, as some legacy | |
210 | * devices won't operate well if fast DMA is disabled. | |
211 | */ | |
212 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | |
4be44fcd LB |
213 | PCI_DEVICE_ID_INTEL_82371AB_0, |
214 | PCI_ANY_ID, PCI_ANY_ID, NULL); | |
1da177e4 LT |
215 | if (dev) { |
216 | pci_read_config_byte(dev, 0x76, &value1); | |
217 | pci_read_config_byte(dev, 0x77, &value2); | |
218 | if ((value1 & 0x80) || (value2 & 0x80)) | |
219 | errata.piix4.fdma = 1; | |
220 | pci_dev_put(dev); | |
221 | } | |
222 | ||
223 | break; | |
224 | } | |
225 | ||
226 | if (errata.piix4.bmisx) | |
227 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4be44fcd | 228 | "Bus master activity detection (BM-IDE) erratum enabled\n")); |
1da177e4 LT |
229 | if (errata.piix4.fdma) |
230 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4be44fcd | 231 | "Type-F DMA livelock erratum (C3 disabled)\n")); |
1da177e4 | 232 | |
d550d98d | 233 | return 0; |
1da177e4 LT |
234 | } |
235 | ||
8713cbef | 236 | static int acpi_processor_errata(struct acpi_processor *pr) |
1da177e4 | 237 | { |
4be44fcd LB |
238 | int result = 0; |
239 | struct pci_dev *dev = NULL; | |
1da177e4 | 240 | |
1da177e4 LT |
241 | |
242 | if (!pr) | |
d550d98d | 243 | return -EINVAL; |
1da177e4 LT |
244 | |
245 | /* | |
246 | * PIIX4 | |
247 | */ | |
248 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | |
4be44fcd LB |
249 | PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, |
250 | PCI_ANY_ID, NULL); | |
1da177e4 LT |
251 | if (dev) { |
252 | result = acpi_processor_errata_piix4(dev); | |
253 | pci_dev_put(dev); | |
254 | } | |
255 | ||
d550d98d | 256 | return result; |
1da177e4 LT |
257 | } |
258 | ||
1da177e4 LT |
259 | /* -------------------------------------------------------------------------- |
260 | FS Interface (/proc) | |
261 | -------------------------------------------------------------------------- */ | |
262 | ||
74cad4ee | 263 | #ifdef CONFIG_ACPI_PROCFS |
4be44fcd | 264 | static struct proc_dir_entry *acpi_processor_dir = NULL; |
1da177e4 LT |
265 | |
266 | static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) | |
267 | { | |
50dd0969 | 268 | struct acpi_processor *pr = seq->private; |
1da177e4 | 269 | |
1da177e4 LT |
270 | |
271 | if (!pr) | |
272 | goto end; | |
273 | ||
274 | seq_printf(seq, "processor id: %d\n" | |
4be44fcd LB |
275 | "acpi id: %d\n" |
276 | "bus mastering control: %s\n" | |
277 | "power management: %s\n" | |
278 | "throttling control: %s\n" | |
279 | "limit interface: %s\n", | |
280 | pr->id, | |
281 | pr->acpi_id, | |
282 | pr->flags.bm_control ? "yes" : "no", | |
283 | pr->flags.power ? "yes" : "no", | |
284 | pr->flags.throttling ? "yes" : "no", | |
285 | pr->flags.limit ? "yes" : "no"); | |
286 | ||
287 | end: | |
d550d98d | 288 | return 0; |
1da177e4 LT |
289 | } |
290 | ||
291 | static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) | |
292 | { | |
293 | return single_open(file, acpi_processor_info_seq_show, | |
4be44fcd | 294 | PDE(inode)->data); |
1da177e4 LT |
295 | } |
296 | ||
bf8b4542 | 297 | static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) |
1da177e4 | 298 | { |
4be44fcd | 299 | struct proc_dir_entry *entry = NULL; |
1da177e4 | 300 | |
1da177e4 LT |
301 | |
302 | if (!acpi_device_dir(device)) { | |
303 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | |
4be44fcd | 304 | acpi_processor_dir); |
1da177e4 | 305 | if (!acpi_device_dir(device)) |
d550d98d | 306 | return -ENODEV; |
1da177e4 | 307 | } |
1da177e4 LT |
308 | |
309 | /* 'info' [R] */ | |
cf7acfab DL |
310 | entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, |
311 | S_IRUGO, acpi_device_dir(device), | |
312 | &acpi_processor_info_fops, | |
313 | acpi_driver_data(device)); | |
1da177e4 | 314 | if (!entry) |
d550d98d | 315 | return -EIO; |
1da177e4 LT |
316 | |
317 | /* 'throttling' [R/W] */ | |
cf7acfab DL |
318 | entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING, |
319 | S_IFREG | S_IRUGO | S_IWUSR, | |
320 | acpi_device_dir(device), | |
321 | &acpi_processor_throttling_fops, | |
322 | acpi_driver_data(device)); | |
1da177e4 | 323 | if (!entry) |
d550d98d | 324 | return -EIO; |
1da177e4 LT |
325 | |
326 | /* 'limit' [R/W] */ | |
cf7acfab DL |
327 | entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT, |
328 | S_IFREG | S_IRUGO | S_IWUSR, | |
329 | acpi_device_dir(device), | |
330 | &acpi_processor_limit_fops, | |
331 | acpi_driver_data(device)); | |
1da177e4 | 332 | if (!entry) |
d550d98d | 333 | return -EIO; |
d550d98d | 334 | return 0; |
1da177e4 | 335 | } |
4be44fcd | 336 | static int acpi_processor_remove_fs(struct acpi_device *device) |
1da177e4 | 337 | { |
1da177e4 LT |
338 | |
339 | if (acpi_device_dir(device)) { | |
4be44fcd LB |
340 | remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, |
341 | acpi_device_dir(device)); | |
1da177e4 | 342 | remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, |
4be44fcd LB |
343 | acpi_device_dir(device)); |
344 | remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, | |
345 | acpi_device_dir(device)); | |
1da177e4 LT |
346 | remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); |
347 | acpi_device_dir(device) = NULL; | |
348 | } | |
349 | ||
d550d98d | 350 | return 0; |
1da177e4 | 351 | } |
74cad4ee ZY |
352 | #else |
353 | static inline int acpi_processor_add_fs(struct acpi_device *device) | |
354 | { | |
355 | return 0; | |
356 | } | |
357 | static inline int acpi_processor_remove_fs(struct acpi_device *device) | |
358 | { | |
359 | return 0; | |
360 | } | |
361 | #endif | |
1da177e4 | 362 | |
1da177e4 LT |
363 | /* -------------------------------------------------------------------------- |
364 | Driver Interface | |
365 | -------------------------------------------------------------------------- */ | |
366 | ||
b26e9286 | 367 | static int acpi_processor_get_info(struct acpi_device *device) |
1da177e4 | 368 | { |
4be44fcd LB |
369 | acpi_status status = 0; |
370 | union acpi_object object = { 0 }; | |
371 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | |
b26e9286 MS |
372 | struct acpi_processor *pr; |
373 | int cpu_index, device_declaration = 0; | |
4be44fcd | 374 | static int cpu0_initialized; |
1da177e4 | 375 | |
b26e9286 | 376 | pr = acpi_driver_data(device); |
1da177e4 | 377 | if (!pr) |
d550d98d | 378 | return -EINVAL; |
1da177e4 LT |
379 | |
380 | if (num_online_cpus() > 1) | |
381 | errata.smp = TRUE; | |
382 | ||
383 | acpi_processor_errata(pr); | |
384 | ||
385 | /* | |
386 | * Check to see if we have bus mastering arbitration control. This | |
387 | * is required for proper C3 usage (to maintain cache coherency). | |
388 | */ | |
cee324b1 | 389 | if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) { |
1da177e4 LT |
390 | pr->flags.bm_control = 1; |
391 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4be44fcd LB |
392 | "Bus mastering arbitration control present\n")); |
393 | } else | |
1da177e4 | 394 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
4be44fcd | 395 | "No bus mastering arbitration control\n")); |
1da177e4 | 396 | |
6cc73b48 BH |
397 | if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) { |
398 | /* Declared with "Processor" statement; match ProcessorID */ | |
399 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); | |
400 | if (ACPI_FAILURE(status)) { | |
401 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); | |
402 | return -ENODEV; | |
403 | } | |
404 | ||
405 | /* | |
406 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | |
407 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in | |
408 | * arch/xxx/acpi.c | |
409 | */ | |
410 | pr->acpi_id = object.processor.proc_id; | |
411 | } else { | |
b26e9286 MS |
412 | /* |
413 | * Declared with "Device" statement; match _UID. | |
414 | * Note that we don't handle string _UIDs yet. | |
415 | */ | |
27663c58 | 416 | unsigned long long value; |
11bf04c4 AS |
417 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, |
418 | NULL, &value); | |
419 | if (ACPI_FAILURE(status)) { | |
b26e9286 MS |
420 | printk(KERN_ERR PREFIX |
421 | "Evaluating processor _UID [%#x]\n", status); | |
11bf04c4 AS |
422 | return -ENODEV; |
423 | } | |
b26e9286 | 424 | device_declaration = 1; |
11bf04c4 | 425 | pr->acpi_id = value; |
11bf04c4 | 426 | } |
2e9d5e4e | 427 | cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id); |
1da177e4 | 428 | |
4be44fcd | 429 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
df42baa0 | 430 | if (!cpu0_initialized && (cpu_index == -1) && |
4be44fcd LB |
431 | (num_online_cpus() == 1)) { |
432 | cpu_index = 0; | |
433 | } | |
434 | ||
435 | cpu0_initialized = 1; | |
436 | ||
437 | pr->id = cpu_index; | |
438 | ||
439 | /* | |
440 | * Extra Processor objects may be enumerated on MP systems with | |
441 | * less than the max # of CPUs. They should be ignored _iff | |
442 | * they are physically not present. | |
443 | */ | |
f18c5a08 | 444 | if (pr->id == -1) { |
4be44fcd LB |
445 | if (ACPI_FAILURE |
446 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { | |
d550d98d | 447 | return -ENODEV; |
4be44fcd LB |
448 | } |
449 | } | |
7a04b849 ZY |
450 | /* |
451 | * On some boxes several processors use the same processor bus id. | |
452 | * But they are located in different scope. For example: | |
453 | * \_SB.SCK0.CPU0 | |
454 | * \_SB.SCK1.CPU0 | |
455 | * Rename the processor device bus id. And the new bus id will be | |
456 | * generated as the following format: | |
457 | * CPU+CPU ID. | |
458 | */ | |
459 | sprintf(acpi_device_bid(device), "CPU%X", pr->id); | |
1da177e4 | 460 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, |
4be44fcd | 461 | pr->acpi_id)); |
1da177e4 LT |
462 | |
463 | if (!object.processor.pblk_address) | |
464 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); | |
465 | else if (object.processor.pblk_length != 6) | |
6468463a LB |
466 | printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n", |
467 | object.processor.pblk_length); | |
1da177e4 LT |
468 | else { |
469 | pr->throttling.address = object.processor.pblk_address; | |
cee324b1 AS |
470 | pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset; |
471 | pr->throttling.duty_width = acpi_gbl_FADT.duty_width; | |
1da177e4 LT |
472 | |
473 | pr->pblk = object.processor.pblk_address; | |
474 | ||
475 | /* | |
476 | * We don't care about error returns - we just try to mark | |
477 | * these reserved so that nobody else is confused into thinking | |
478 | * that this region might be unused.. | |
479 | * | |
480 | * (In particular, allocating the IO range for Cardbus) | |
481 | */ | |
482 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); | |
483 | } | |
484 | ||
fe086a7b AC |
485 | /* |
486 | * If ACPI describes a slot number for this CPU, we can use it | |
487 | * ensure we get the right value in the "physical id" field | |
488 | * of /proc/cpuinfo | |
489 | */ | |
490 | status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer); | |
491 | if (ACPI_SUCCESS(status)) | |
492 | arch_fix_phys_package_id(pr->id, object.integer.value); | |
493 | ||
d550d98d | 494 | return 0; |
1da177e4 LT |
495 | } |
496 | ||
706546d0 | 497 | static DEFINE_PER_CPU(void *, processor_device_array); |
cd8e2b48 | 498 | |
7ec0a729 | 499 | static void acpi_processor_notify(struct acpi_device *device, u32 event) |
1da177e4 | 500 | { |
7ec0a729 | 501 | struct acpi_processor *pr = acpi_driver_data(device); |
e790cc8b | 502 | int saved; |
1da177e4 LT |
503 | |
504 | if (!pr) | |
d550d98d | 505 | return; |
1da177e4 | 506 | |
1da177e4 LT |
507 | switch (event) { |
508 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | |
e790cc8b | 509 | saved = pr->performance_platform_limit; |
d81c45e1 | 510 | acpi_processor_ppc_has_changed(pr, 1); |
e790cc8b AS |
511 | if (saved == pr->performance_platform_limit) |
512 | break; | |
14e04fb3 | 513 | acpi_bus_generate_proc_event(device, event, |
4be44fcd | 514 | pr->performance_platform_limit); |
962ce8ca | 515 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
0794469d | 516 | dev_name(&device->dev), event, |
962ce8ca | 517 | pr->performance_platform_limit); |
1da177e4 LT |
518 | break; |
519 | case ACPI_PROCESSOR_NOTIFY_POWER: | |
520 | acpi_processor_cst_has_changed(pr); | |
14e04fb3 | 521 | acpi_bus_generate_proc_event(device, event, 0); |
962ce8ca | 522 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
0794469d | 523 | dev_name(&device->dev), event, 0); |
1da177e4 | 524 | break; |
01854e69 LY |
525 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: |
526 | acpi_processor_tstate_has_changed(pr); | |
14e04fb3 | 527 | acpi_bus_generate_proc_event(device, event, 0); |
962ce8ca | 528 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
0794469d | 529 | dev_name(&device->dev), event, 0); |
1da177e4 LT |
530 | default: |
531 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4be44fcd | 532 | "Unsupported event [0x%x]\n", event)); |
1da177e4 LT |
533 | break; |
534 | } | |
535 | ||
d550d98d | 536 | return; |
1da177e4 LT |
537 | } |
538 | ||
729c6ba3 VP |
539 | static int acpi_cpu_soft_notify(struct notifier_block *nfb, |
540 | unsigned long action, void *hcpu) | |
541 | { | |
542 | unsigned int cpu = (unsigned long)hcpu; | |
706546d0 | 543 | struct acpi_processor *pr = per_cpu(processors, cpu); |
729c6ba3 VP |
544 | |
545 | if (action == CPU_ONLINE && pr) { | |
d81c45e1 | 546 | acpi_processor_ppc_has_changed(pr, 0); |
729c6ba3 VP |
547 | acpi_processor_cst_has_changed(pr); |
548 | acpi_processor_tstate_has_changed(pr); | |
549 | } | |
550 | return NOTIFY_OK; | |
551 | } | |
552 | ||
553 | static struct notifier_block acpi_cpu_notifier = | |
554 | { | |
555 | .notifier_call = acpi_cpu_soft_notify, | |
556 | }; | |
557 | ||
941b10fa | 558 | static int __cpuinit acpi_processor_add(struct acpi_device *device) |
1da177e4 | 559 | { |
4be44fcd | 560 | struct acpi_processor *pr = NULL; |
970b0492 BH |
561 | int result = 0; |
562 | struct sys_device *sysdev; | |
1da177e4 | 563 | |
36bcbec7 | 564 | pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); |
1da177e4 | 565 | if (!pr) |
d550d98d | 566 | return -ENOMEM; |
1da177e4 | 567 | |
eaa95840 | 568 | if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { |
2fdf66b4 RR |
569 | kfree(pr); |
570 | return -ENOMEM; | |
571 | } | |
572 | ||
1da177e4 LT |
573 | pr->handle = device->handle; |
574 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | |
575 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | |
db89b4f0 | 576 | device->driver_data = pr; |
1da177e4 | 577 | |
b26e9286 | 578 | result = acpi_processor_get_info(device); |
1da177e4 LT |
579 | if (result) { |
580 | /* Processor is physically not present */ | |
d550d98d | 581 | return 0; |
1da177e4 LT |
582 | } |
583 | ||
75cbfb97 TR |
584 | #ifdef CONFIG_SMP |
585 | if (pr->id >= setup_max_cpus && pr->id != 0) | |
586 | return 0; | |
587 | #endif | |
588 | ||
fbb43ab0 | 589 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); |
1da177e4 | 590 | |
cd8e2b48 VP |
591 | /* |
592 | * Buggy BIOS check | |
593 | * ACPI id of processors can be reported wrongly by the BIOS. | |
594 | * Don't trust it blindly | |
595 | */ | |
706546d0 MT |
596 | if (per_cpu(processor_device_array, pr->id) != NULL && |
597 | per_cpu(processor_device_array, pr->id) != device) { | |
4fdb2a05 | 598 | printk(KERN_WARNING "BIOS reported wrong ACPI id " |
0eacee58 | 599 | "for the processor\n"); |
970b0492 BH |
600 | result = -ENODEV; |
601 | goto err_free_cpumask; | |
cd8e2b48 | 602 | } |
706546d0 | 603 | per_cpu(processor_device_array, pr->id) = device; |
cd8e2b48 | 604 | |
706546d0 | 605 | per_cpu(processors, pr->id) = pr; |
1da177e4 LT |
606 | |
607 | result = acpi_processor_add_fs(device); | |
608 | if (result) | |
970b0492 | 609 | goto err_free_cpumask; |
1da177e4 | 610 | |
9f1eb99c | 611 | sysdev = get_cpu_sysdev(pr->id); |
d4e05261 BH |
612 | if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { |
613 | result = -EFAULT; | |
614 | goto err_remove_fs; | |
615 | } | |
9f1eb99c | 616 | |
0ac3c571 | 617 | #ifdef CONFIG_CPU_FREQ |
d81c45e1 | 618 | acpi_processor_ppc_has_changed(pr, 0); |
0ac3c571 ZY |
619 | #endif |
620 | acpi_processor_get_throttling_info(pr); | |
621 | acpi_processor_get_limit_info(pr); | |
622 | ||
05131ecc | 623 | |
541adf7c LB |
624 | if (cpuidle_get_driver() == &acpi_idle_driver) |
625 | acpi_processor_power_init(pr, device); | |
1da177e4 | 626 | |
d9460fd2 ZR |
627 | pr->cdev = thermal_cooling_device_register("Processor", device, |
628 | &processor_cooling_ops); | |
d76628c6 TS |
629 | if (IS_ERR(pr->cdev)) { |
630 | result = PTR_ERR(pr->cdev); | |
d4e05261 | 631 | goto err_power_exit; |
d76628c6 | 632 | } |
9030062f | 633 | |
13c41157 | 634 | dev_dbg(&device->dev, "registered as cooling_device%d\n", |
fc3a8828 | 635 | pr->cdev->id); |
9030062f JL |
636 | |
637 | result = sysfs_create_link(&device->dev.kobj, | |
638 | &pr->cdev->device.kobj, | |
639 | "thermal_cooling"); | |
d4e05261 | 640 | if (result) { |
9030062f | 641 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
d4e05261 BH |
642 | goto err_thermal_unregister; |
643 | } | |
9030062f JL |
644 | result = sysfs_create_link(&pr->cdev->device.kobj, |
645 | &device->dev.kobj, | |
646 | "device"); | |
d4e05261 | 647 | if (result) { |
9030062f | 648 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
d4e05261 BH |
649 | goto err_remove_sysfs; |
650 | } | |
d9460fd2 | 651 | |
d550d98d | 652 | return 0; |
d4e05261 BH |
653 | |
654 | err_remove_sysfs: | |
655 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | |
656 | err_thermal_unregister: | |
657 | thermal_cooling_device_unregister(pr->cdev); | |
658 | err_power_exit: | |
659 | acpi_processor_power_exit(pr, device); | |
660 | err_remove_fs: | |
661 | acpi_processor_remove_fs(device); | |
970b0492 BH |
662 | err_free_cpumask: |
663 | free_cpumask_var(pr->throttling.shared_cpu_map); | |
1da177e4 | 664 | |
d550d98d | 665 | return result; |
1da177e4 LT |
666 | } |
667 | ||
4be44fcd | 668 | static int acpi_processor_remove(struct acpi_device *device, int type) |
1da177e4 | 669 | { |
4be44fcd | 670 | struct acpi_processor *pr = NULL; |
1da177e4 | 671 | |
1da177e4 LT |
672 | |
673 | if (!device || !acpi_driver_data(device)) | |
d550d98d | 674 | return -EINVAL; |
1da177e4 | 675 | |
50dd0969 | 676 | pr = acpi_driver_data(device); |
1da177e4 | 677 | |
2fdf66b4 RR |
678 | if (pr->id >= nr_cpu_ids) |
679 | goto free; | |
1da177e4 LT |
680 | |
681 | if (type == ACPI_BUS_REMOVAL_EJECT) { | |
682 | if (acpi_processor_handle_eject(pr)) | |
d550d98d | 683 | return -EINVAL; |
1da177e4 LT |
684 | } |
685 | ||
686 | acpi_processor_power_exit(pr, device); | |
687 | ||
9f1eb99c ZR |
688 | sysfs_remove_link(&device->dev.kobj, "sysdev"); |
689 | ||
1da177e4 LT |
690 | acpi_processor_remove_fs(device); |
691 | ||
f28bb45e ZY |
692 | if (pr->cdev) { |
693 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | |
694 | sysfs_remove_link(&pr->cdev->device.kobj, "device"); | |
695 | thermal_cooling_device_unregister(pr->cdev); | |
696 | pr->cdev = NULL; | |
697 | } | |
d9460fd2 | 698 | |
706546d0 MT |
699 | per_cpu(processors, pr->id) = NULL; |
700 | per_cpu(processor_device_array, pr->id) = NULL; | |
2fdf66b4 RR |
701 | |
702 | free: | |
703 | free_cpumask_var(pr->throttling.shared_cpu_map); | |
1da177e4 LT |
704 | kfree(pr); |
705 | ||
d550d98d | 706 | return 0; |
1da177e4 LT |
707 | } |
708 | ||
709 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | |
710 | /**************************************************************************** | |
711 | * Acpi processor hotplug support * | |
712 | ****************************************************************************/ | |
713 | ||
4be44fcd | 714 | static int is_processor_present(acpi_handle handle) |
1da177e4 | 715 | { |
4be44fcd | 716 | acpi_status status; |
27663c58 | 717 | unsigned long long sta = 0; |
1da177e4 | 718 | |
1da177e4 LT |
719 | |
720 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | |
cfaf3747 ZR |
721 | |
722 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) | |
723 | return 1; | |
724 | ||
d0ce46f5 ZR |
725 | /* |
726 | * _STA is mandatory for a processor that supports hot plug | |
727 | */ | |
728 | if (status == AE_NOT_FOUND) | |
729 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
730 | "Processor does not support hot plug\n")); | |
731 | else | |
732 | ACPI_EXCEPTION((AE_INFO, status, | |
733 | "Processor Device is not present")); | |
cfaf3747 | 734 | return 0; |
1da177e4 LT |
735 | } |
736 | ||
1da177e4 | 737 | static |
4be44fcd | 738 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) |
1da177e4 | 739 | { |
4be44fcd LB |
740 | acpi_handle phandle; |
741 | struct acpi_device *pdev; | |
1da177e4 | 742 | |
1da177e4 LT |
743 | |
744 | if (acpi_get_parent(handle, &phandle)) { | |
d550d98d | 745 | return -ENODEV; |
1da177e4 LT |
746 | } |
747 | ||
748 | if (acpi_bus_get_device(phandle, &pdev)) { | |
d550d98d | 749 | return -ENODEV; |
1da177e4 LT |
750 | } |
751 | ||
752 | if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { | |
d550d98d | 753 | return -ENODEV; |
1da177e4 LT |
754 | } |
755 | ||
d550d98d | 756 | return 0; |
1da177e4 LT |
757 | } |
758 | ||
b95e9e8d SR |
759 | static void __ref acpi_processor_hotplug_notify(acpi_handle handle, |
760 | u32 event, void *data) | |
1da177e4 | 761 | { |
4be44fcd LB |
762 | struct acpi_processor *pr; |
763 | struct acpi_device *device = NULL; | |
1da177e4 LT |
764 | int result; |
765 | ||
1da177e4 LT |
766 | |
767 | switch (event) { | |
768 | case ACPI_NOTIFY_BUS_CHECK: | |
769 | case ACPI_NOTIFY_DEVICE_CHECK: | |
d6f882e1 GC |
770 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
771 | "Processor driver received %s event\n", | |
4be44fcd | 772 | (event == ACPI_NOTIFY_BUS_CHECK) ? |
d6f882e1 | 773 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); |
1da177e4 LT |
774 | |
775 | if (!is_processor_present(handle)) | |
776 | break; | |
777 | ||
778 | if (acpi_bus_get_device(handle, &device)) { | |
779 | result = acpi_processor_device_add(handle, &device); | |
780 | if (result) | |
6468463a LB |
781 | printk(KERN_ERR PREFIX |
782 | "Unable to add the device\n"); | |
1da177e4 LT |
783 | break; |
784 | } | |
4be44fcd | 785 | break; |
1da177e4 | 786 | case ACPI_NOTIFY_EJECT_REQUEST: |
4be44fcd LB |
787 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
788 | "received ACPI_NOTIFY_EJECT_REQUEST\n")); | |
1da177e4 LT |
789 | |
790 | if (acpi_bus_get_device(handle, &device)) { | |
6468463a LB |
791 | printk(KERN_ERR PREFIX |
792 | "Device don't exist, dropping EJECT\n"); | |
1da177e4 LT |
793 | break; |
794 | } | |
795 | pr = acpi_driver_data(device); | |
796 | if (!pr) { | |
6468463a LB |
797 | printk(KERN_ERR PREFIX |
798 | "Driver data is NULL, dropping EJECT\n"); | |
d550d98d | 799 | return; |
1da177e4 | 800 | } |
1da177e4 LT |
801 | break; |
802 | default: | |
803 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4be44fcd | 804 | "Unsupported event [0x%x]\n", event)); |
1da177e4 LT |
805 | break; |
806 | } | |
807 | ||
d550d98d | 808 | return; |
1da177e4 LT |
809 | } |
810 | ||
811 | static acpi_status | |
812 | processor_walk_namespace_cb(acpi_handle handle, | |
4be44fcd | 813 | u32 lvl, void *context, void **rv) |
1da177e4 | 814 | { |
4be44fcd | 815 | acpi_status status; |
1da177e4 | 816 | int *action = context; |
4be44fcd | 817 | acpi_object_type type = 0; |
1da177e4 LT |
818 | |
819 | status = acpi_get_type(handle, &type); | |
820 | if (ACPI_FAILURE(status)) | |
4be44fcd | 821 | return (AE_OK); |
1da177e4 LT |
822 | |
823 | if (type != ACPI_TYPE_PROCESSOR) | |
4be44fcd | 824 | return (AE_OK); |
1da177e4 | 825 | |
4be44fcd | 826 | switch (*action) { |
1da177e4 LT |
827 | case INSTALL_NOTIFY_HANDLER: |
828 | acpi_install_notify_handler(handle, | |
4be44fcd LB |
829 | ACPI_SYSTEM_NOTIFY, |
830 | acpi_processor_hotplug_notify, | |
831 | NULL); | |
1da177e4 LT |
832 | break; |
833 | case UNINSTALL_NOTIFY_HANDLER: | |
834 | acpi_remove_notify_handler(handle, | |
4be44fcd LB |
835 | ACPI_SYSTEM_NOTIFY, |
836 | acpi_processor_hotplug_notify); | |
1da177e4 LT |
837 | break; |
838 | default: | |
839 | break; | |
840 | } | |
841 | ||
4be44fcd | 842 | return (AE_OK); |
1da177e4 LT |
843 | } |
844 | ||
4be44fcd | 845 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) |
1da177e4 | 846 | { |
1da177e4 LT |
847 | |
848 | if (!is_processor_present(handle)) { | |
d550d98d | 849 | return AE_ERROR; |
1da177e4 LT |
850 | } |
851 | ||
852 | if (acpi_map_lsapic(handle, p_cpu)) | |
d550d98d | 853 | return AE_ERROR; |
1da177e4 LT |
854 | |
855 | if (arch_register_cpu(*p_cpu)) { | |
856 | acpi_unmap_lsapic(*p_cpu); | |
d550d98d | 857 | return AE_ERROR; |
1da177e4 LT |
858 | } |
859 | ||
d550d98d | 860 | return AE_OK; |
1da177e4 LT |
861 | } |
862 | ||
4be44fcd | 863 | static int acpi_processor_handle_eject(struct acpi_processor *pr) |
1da177e4 | 864 | { |
b62b8ef9 ZR |
865 | if (cpu_online(pr->id)) |
866 | cpu_down(pr->id); | |
867 | ||
1da177e4 LT |
868 | arch_unregister_cpu(pr->id); |
869 | acpi_unmap_lsapic(pr->id); | |
4be44fcd | 870 | return (0); |
1da177e4 LT |
871 | } |
872 | #else | |
4be44fcd | 873 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) |
1da177e4 LT |
874 | { |
875 | return AE_ERROR; | |
876 | } | |
4be44fcd | 877 | static int acpi_processor_handle_eject(struct acpi_processor *pr) |
1da177e4 | 878 | { |
4be44fcd | 879 | return (-EINVAL); |
1da177e4 LT |
880 | } |
881 | #endif | |
882 | ||
1da177e4 LT |
883 | static |
884 | void acpi_processor_install_hotplug_notify(void) | |
885 | { | |
886 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | |
887 | int action = INSTALL_NOTIFY_HANDLER; | |
888 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | |
4be44fcd LB |
889 | ACPI_ROOT_OBJECT, |
890 | ACPI_UINT32_MAX, | |
2263576c | 891 | processor_walk_namespace_cb, NULL, &action, NULL); |
1da177e4 | 892 | #endif |
729c6ba3 | 893 | register_hotcpu_notifier(&acpi_cpu_notifier); |
1da177e4 LT |
894 | } |
895 | ||
1da177e4 LT |
896 | static |
897 | void acpi_processor_uninstall_hotplug_notify(void) | |
898 | { | |
899 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | |
900 | int action = UNINSTALL_NOTIFY_HANDLER; | |
901 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | |
4be44fcd LB |
902 | ACPI_ROOT_OBJECT, |
903 | ACPI_UINT32_MAX, | |
2263576c | 904 | processor_walk_namespace_cb, NULL, &action, NULL); |
1da177e4 | 905 | #endif |
729c6ba3 | 906 | unregister_hotcpu_notifier(&acpi_cpu_notifier); |
1da177e4 LT |
907 | } |
908 | ||
909 | /* | |
910 | * We keep the driver loaded even when ACPI is not running. | |
911 | * This is needed for the powernow-k8 driver, that works even without | |
912 | * ACPI, but needs symbols from this driver | |
913 | */ | |
914 | ||
4be44fcd | 915 | static int __init acpi_processor_init(void) |
1da177e4 | 916 | { |
4be44fcd | 917 | int result = 0; |
1da177e4 | 918 | |
ce8442b5 YL |
919 | if (acpi_disabled) |
920 | return 0; | |
921 | ||
1da177e4 LT |
922 | memset(&errata, 0, sizeof(errata)); |
923 | ||
74cad4ee | 924 | #ifdef CONFIG_ACPI_PROCFS |
1da177e4 LT |
925 | acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); |
926 | if (!acpi_processor_dir) | |
83822fc9 | 927 | return -ENOMEM; |
74cad4ee | 928 | #endif |
541adf7c | 929 | |
26717172 | 930 | if (!cpuidle_register_driver(&acpi_idle_driver)) { |
541adf7c LB |
931 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", |
932 | acpi_idle_driver.name); | |
26717172 LB |
933 | } else { |
934 | printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s", | |
935 | cpuidle_get_driver()->name); | |
936 | } | |
4f86d3a8 | 937 | |
1da177e4 | 938 | result = acpi_bus_register_driver(&acpi_processor_driver); |
4f86d3a8 LB |
939 | if (result < 0) |
940 | goto out_cpuidle; | |
1da177e4 LT |
941 | |
942 | acpi_processor_install_hotplug_notify(); | |
943 | ||
944 | acpi_thermal_cpufreq_init(); | |
945 | ||
946 | acpi_processor_ppc_init(); | |
947 | ||
1180509f ZY |
948 | acpi_processor_throttling_init(); |
949 | ||
d550d98d | 950 | return 0; |
4f86d3a8 LB |
951 | |
952 | out_cpuidle: | |
953 | cpuidle_unregister_driver(&acpi_idle_driver); | |
954 | ||
74cad4ee | 955 | #ifdef CONFIG_ACPI_PROCFS |
4f86d3a8 | 956 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); |
74cad4ee | 957 | #endif |
4f86d3a8 LB |
958 | |
959 | return result; | |
1da177e4 LT |
960 | } |
961 | ||
4be44fcd | 962 | static void __exit acpi_processor_exit(void) |
1da177e4 | 963 | { |
ce8442b5 YL |
964 | if (acpi_disabled) |
965 | return; | |
966 | ||
1da177e4 LT |
967 | acpi_processor_ppc_exit(); |
968 | ||
969 | acpi_thermal_cpufreq_exit(); | |
970 | ||
971 | acpi_processor_uninstall_hotplug_notify(); | |
972 | ||
973 | acpi_bus_unregister_driver(&acpi_processor_driver); | |
974 | ||
4f86d3a8 LB |
975 | cpuidle_unregister_driver(&acpi_idle_driver); |
976 | ||
74cad4ee | 977 | #ifdef CONFIG_ACPI_PROCFS |
1da177e4 | 978 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); |
74cad4ee | 979 | #endif |
1da177e4 | 980 | |
d550d98d | 981 | return; |
1da177e4 LT |
982 | } |
983 | ||
1da177e4 LT |
984 | module_init(acpi_processor_init); |
985 | module_exit(acpi_processor_exit); | |
986 | ||
987 | EXPORT_SYMBOL(acpi_processor_set_thermal_limit); | |
988 | ||
989 | MODULE_ALIAS("processor"); |