2 * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $)
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
10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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.
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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>
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>
47 #include <linux/cpuidle.h>
48 #include <linux/slab.h>
51 #include <asm/system.h>
53 #include <asm/delay.h>
54 #include <asm/uaccess.h>
55 #include <asm/processor.h>
59 #include <acpi/acpi_bus.h>
60 #include <acpi/acpi_drivers.h>
61 #include <acpi/processor.h>
63 #define PREFIX "ACPI: "
65 #define ACPI_PROCESSOR_CLASS "processor"
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
72 #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
74 #define ACPI_PROCESSOR_LIMIT_USER 0
75 #define ACPI_PROCESSOR_LIMIT_THERMAL 1
77 #define _COMPONENT ACPI_PROCESSOR_COMPONENT
78 ACPI_MODULE_NAME("processor_driver");
80 MODULE_AUTHOR("Paul Diefenbaugh");
81 MODULE_DESCRIPTION("ACPI Processor Driver");
82 MODULE_LICENSE("GPL");
84 static int acpi_processor_add(struct acpi_device
*device
);
85 static int acpi_processor_remove(struct acpi_device
*device
, int type
);
86 static void acpi_processor_notify(struct acpi_device
*device
, u32 event
);
87 static acpi_status
acpi_processor_hotadd_init(acpi_handle handle
, int *p_cpu
);
88 static int acpi_processor_handle_eject(struct acpi_processor
*pr
);
91 static const struct acpi_device_id processor_device_ids
[] = {
92 {ACPI_PROCESSOR_OBJECT_HID
, 0},
96 MODULE_DEVICE_TABLE(acpi
, processor_device_ids
);
98 static struct acpi_driver acpi_processor_driver
= {
100 .class = ACPI_PROCESSOR_CLASS
,
101 .ids
= processor_device_ids
,
103 .add
= acpi_processor_add
,
104 .remove
= acpi_processor_remove
,
105 .suspend
= acpi_processor_suspend
,
106 .resume
= acpi_processor_resume
,
107 .notify
= acpi_processor_notify
,
111 #define INSTALL_NOTIFY_HANDLER 1
112 #define UNINSTALL_NOTIFY_HANDLER 2
114 DEFINE_PER_CPU(struct acpi_processor
*, processors
);
115 EXPORT_PER_CPU_SYMBOL(processors
);
117 struct acpi_processor_errata errata __read_mostly
;
119 /* --------------------------------------------------------------------------
121 -------------------------------------------------------------------------- */
123 static int acpi_processor_errata_piix4(struct pci_dev
*dev
)
133 * Note that 'dev' references the PIIX4 ACPI Controller.
136 switch (dev
->revision
) {
138 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4 A-step\n"));
141 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4 B-step\n"));
144 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4E\n"));
147 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4M\n"));
150 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found unknown PIIX4\n"));
154 switch (dev
->revision
) {
156 case 0: /* PIIX4 A-step */
157 case 1: /* PIIX4 B-step */
159 * See specification changes #13 ("Manual Throttle Duty Cycle")
160 * and #14 ("Enabling and Disabling Manual Throttle"), plus
161 * erratum #5 ("STPCLK# Deassertion Time") from the January
162 * 2002 PIIX4 specification update. Applies to only older
165 errata
.piix4
.throttle
= 1;
170 * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA
171 * Livelock") from the January 2002 PIIX4 specification update.
172 * Applies to all PIIX4 models.
178 * Find the PIIX4 IDE Controller and get the Bus Master IDE
179 * Status register address. We'll use this later to read
180 * each IDE controller's DMA status to make sure we catch all
183 dev
= pci_get_subsys(PCI_VENDOR_ID_INTEL
,
184 PCI_DEVICE_ID_INTEL_82371AB
,
185 PCI_ANY_ID
, PCI_ANY_ID
, NULL
);
187 errata
.piix4
.bmisx
= pci_resource_start(dev
, 4);
194 * Find the PIIX4 ISA Controller and read the Motherboard
195 * DMA controller's status to see if Type-F (Fast) DMA mode
196 * is enabled (bit 7) on either channel. Note that we'll
197 * disable C3 support if this is enabled, as some legacy
198 * devices won't operate well if fast DMA is disabled.
200 dev
= pci_get_subsys(PCI_VENDOR_ID_INTEL
,
201 PCI_DEVICE_ID_INTEL_82371AB_0
,
202 PCI_ANY_ID
, PCI_ANY_ID
, NULL
);
204 pci_read_config_byte(dev
, 0x76, &value1
);
205 pci_read_config_byte(dev
, 0x77, &value2
);
206 if ((value1
& 0x80) || (value2
& 0x80))
207 errata
.piix4
.fdma
= 1;
214 if (errata
.piix4
.bmisx
)
215 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
216 "Bus master activity detection (BM-IDE) erratum enabled\n"));
217 if (errata
.piix4
.fdma
)
218 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
219 "Type-F DMA livelock erratum (C3 disabled)\n"));
224 static int acpi_processor_errata(struct acpi_processor
*pr
)
227 struct pci_dev
*dev
= NULL
;
236 dev
= pci_get_subsys(PCI_VENDOR_ID_INTEL
,
237 PCI_DEVICE_ID_INTEL_82371AB_3
, PCI_ANY_ID
,
240 result
= acpi_processor_errata_piix4(dev
);
247 static struct proc_dir_entry
*acpi_processor_dir
= NULL
;
249 static int __cpuinit
acpi_processor_add_fs(struct acpi_device
*device
)
251 struct proc_dir_entry
*entry
= NULL
;
254 if (!acpi_device_dir(device
)) {
255 acpi_device_dir(device
) = proc_mkdir(acpi_device_bid(device
),
257 if (!acpi_device_dir(device
))
261 /* 'throttling' [R/W] */
262 entry
= proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING
,
263 S_IFREG
| S_IRUGO
| S_IWUSR
,
264 acpi_device_dir(device
),
265 &acpi_processor_throttling_fops
,
266 acpi_driver_data(device
));
271 static int acpi_processor_remove_fs(struct acpi_device
*device
)
274 if (acpi_device_dir(device
)) {
275 remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING
,
276 acpi_device_dir(device
));
277 remove_proc_entry(acpi_device_bid(device
), acpi_processor_dir
);
278 acpi_device_dir(device
) = NULL
;
284 /* --------------------------------------------------------------------------
286 -------------------------------------------------------------------------- */
288 static int acpi_processor_get_info(struct acpi_device
*device
)
290 acpi_status status
= 0;
291 union acpi_object object
= { 0 };
292 struct acpi_buffer buffer
= { sizeof(union acpi_object
), &object
};
293 struct acpi_processor
*pr
;
294 int cpu_index
, device_declaration
= 0;
295 static int cpu0_initialized
;
297 pr
= acpi_driver_data(device
);
301 if (num_online_cpus() > 1)
304 acpi_processor_errata(pr
);
307 * Check to see if we have bus mastering arbitration control. This
308 * is required for proper C3 usage (to maintain cache coherency).
310 if (acpi_gbl_FADT
.pm2_control_block
&& acpi_gbl_FADT
.pm2_control_length
) {
311 pr
->flags
.bm_control
= 1;
312 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
313 "Bus mastering arbitration control present\n"));
315 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
316 "No bus mastering arbitration control\n"));
318 if (!strcmp(acpi_device_hid(device
), ACPI_PROCESSOR_OBJECT_HID
)) {
319 /* Declared with "Processor" statement; match ProcessorID */
320 status
= acpi_evaluate_object(pr
->handle
, NULL
, NULL
, &buffer
);
321 if (ACPI_FAILURE(status
)) {
322 printk(KERN_ERR PREFIX
"Evaluating processor object\n");
327 * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
328 * >>> 'acpi_get_processor_id(acpi_id, &id)' in
331 pr
->acpi_id
= object
.processor
.proc_id
;
334 * Declared with "Device" statement; match _UID.
335 * Note that we don't handle string _UIDs yet.
337 unsigned long long value
;
338 status
= acpi_evaluate_integer(pr
->handle
, METHOD_NAME__UID
,
340 if (ACPI_FAILURE(status
)) {
341 printk(KERN_ERR PREFIX
342 "Evaluating processor _UID [%#x]\n", status
);
345 device_declaration
= 1;
348 cpu_index
= acpi_get_cpuid(pr
->handle
, device_declaration
, pr
->acpi_id
);
350 /* Handle UP system running SMP kernel, with no LAPIC in MADT */
351 if (!cpu0_initialized
&& (cpu_index
== -1) &&
352 (num_online_cpus() == 1)) {
356 cpu0_initialized
= 1;
361 * Extra Processor objects may be enumerated on MP systems with
362 * less than the max # of CPUs. They should be ignored _iff
363 * they are physically not present.
367 (acpi_processor_hotadd_init(pr
->handle
, &pr
->id
))) {
372 * On some boxes several processors use the same processor bus id.
373 * But they are located in different scope. For example:
376 * Rename the processor device bus id. And the new bus id will be
377 * generated as the following format:
380 sprintf(acpi_device_bid(device
), "CPU%X", pr
->id
);
381 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Processor [%d:%d]\n", pr
->id
,
384 if (!object
.processor
.pblk_address
)
385 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "No PBLK (NULL address)\n"));
386 else if (object
.processor
.pblk_length
!= 6)
387 printk(KERN_ERR PREFIX
"Invalid PBLK length [%d]\n",
388 object
.processor
.pblk_length
);
390 pr
->throttling
.address
= object
.processor
.pblk_address
;
391 pr
->throttling
.duty_offset
= acpi_gbl_FADT
.duty_offset
;
392 pr
->throttling
.duty_width
= acpi_gbl_FADT
.duty_width
;
394 pr
->pblk
= object
.processor
.pblk_address
;
397 * We don't care about error returns - we just try to mark
398 * these reserved so that nobody else is confused into thinking
399 * that this region might be unused..
401 * (In particular, allocating the IO range for Cardbus)
403 request_region(pr
->throttling
.address
, 6, "ACPI CPU throttle");
407 * If ACPI describes a slot number for this CPU, we can use it
408 * ensure we get the right value in the "physical id" field
411 status
= acpi_evaluate_object(pr
->handle
, "_SUN", NULL
, &buffer
);
412 if (ACPI_SUCCESS(status
))
413 arch_fix_phys_package_id(pr
->id
, object
.integer
.value
);
418 static DEFINE_PER_CPU(void *, processor_device_array
);
420 static void acpi_processor_notify(struct acpi_device
*device
, u32 event
)
422 struct acpi_processor
*pr
= acpi_driver_data(device
);
429 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE
:
430 saved
= pr
->performance_platform_limit
;
431 acpi_processor_ppc_has_changed(pr
, 1);
432 if (saved
== pr
->performance_platform_limit
)
434 acpi_bus_generate_proc_event(device
, event
,
435 pr
->performance_platform_limit
);
436 acpi_bus_generate_netlink_event(device
->pnp
.device_class
,
437 dev_name(&device
->dev
), event
,
438 pr
->performance_platform_limit
);
440 case ACPI_PROCESSOR_NOTIFY_POWER
:
441 acpi_processor_cst_has_changed(pr
);
442 acpi_bus_generate_proc_event(device
, event
, 0);
443 acpi_bus_generate_netlink_event(device
->pnp
.device_class
,
444 dev_name(&device
->dev
), event
, 0);
446 case ACPI_PROCESSOR_NOTIFY_THROTTLING
:
447 acpi_processor_tstate_has_changed(pr
);
448 acpi_bus_generate_proc_event(device
, event
, 0);
449 acpi_bus_generate_netlink_event(device
->pnp
.device_class
,
450 dev_name(&device
->dev
), event
, 0);
452 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
453 "Unsupported event [0x%x]\n", event
));
460 static int acpi_cpu_soft_notify(struct notifier_block
*nfb
,
461 unsigned long action
, void *hcpu
)
463 unsigned int cpu
= (unsigned long)hcpu
;
464 struct acpi_processor
*pr
= per_cpu(processors
, cpu
);
466 if (action
== CPU_ONLINE
&& pr
) {
467 acpi_processor_ppc_has_changed(pr
, 0);
468 acpi_processor_cst_has_changed(pr
);
469 acpi_processor_tstate_has_changed(pr
);
474 static struct notifier_block acpi_cpu_notifier
=
476 .notifier_call
= acpi_cpu_soft_notify
,
479 static int __cpuinit
acpi_processor_add(struct acpi_device
*device
)
481 struct acpi_processor
*pr
= NULL
;
483 struct sys_device
*sysdev
;
485 pr
= kzalloc(sizeof(struct acpi_processor
), GFP_KERNEL
);
489 if (!zalloc_cpumask_var(&pr
->throttling
.shared_cpu_map
, GFP_KERNEL
)) {
494 pr
->handle
= device
->handle
;
495 strcpy(acpi_device_name(device
), ACPI_PROCESSOR_DEVICE_NAME
);
496 strcpy(acpi_device_class(device
), ACPI_PROCESSOR_CLASS
);
497 device
->driver_data
= pr
;
499 result
= acpi_processor_get_info(device
);
501 /* Processor is physically not present */
506 if (pr
->id
>= setup_max_cpus
&& pr
->id
!= 0)
510 BUG_ON((pr
->id
>= nr_cpu_ids
) || (pr
->id
< 0));
514 * ACPI id of processors can be reported wrongly by the BIOS.
515 * Don't trust it blindly
517 if (per_cpu(processor_device_array
, pr
->id
) != NULL
&&
518 per_cpu(processor_device_array
, pr
->id
) != device
) {
519 printk(KERN_WARNING
"BIOS reported wrong ACPI id "
520 "for the processor\n");
522 goto err_free_cpumask
;
524 per_cpu(processor_device_array
, pr
->id
) = device
;
526 per_cpu(processors
, pr
->id
) = pr
;
528 result
= acpi_processor_add_fs(device
);
530 goto err_free_cpumask
;
532 sysdev
= get_cpu_sysdev(pr
->id
);
533 if (sysfs_create_link(&device
->dev
.kobj
, &sysdev
->kobj
, "sysdev")) {
538 #ifdef CONFIG_CPU_FREQ
539 acpi_processor_ppc_has_changed(pr
, 0);
541 acpi_processor_get_throttling_info(pr
);
542 acpi_processor_get_limit_info(pr
);
545 if (cpuidle_get_driver() == &acpi_idle_driver
)
546 acpi_processor_power_init(pr
, device
);
548 pr
->cdev
= thermal_cooling_device_register("Processor", device
,
549 &processor_cooling_ops
);
550 if (IS_ERR(pr
->cdev
)) {
551 result
= PTR_ERR(pr
->cdev
);
555 dev_dbg(&device
->dev
, "registered as cooling_device%d\n",
558 result
= sysfs_create_link(&device
->dev
.kobj
,
559 &pr
->cdev
->device
.kobj
,
562 printk(KERN_ERR PREFIX
"Create sysfs link\n");
563 goto err_thermal_unregister
;
565 result
= sysfs_create_link(&pr
->cdev
->device
.kobj
,
569 printk(KERN_ERR PREFIX
"Create sysfs link\n");
570 goto err_remove_sysfs
;
576 sysfs_remove_link(&device
->dev
.kobj
, "thermal_cooling");
577 err_thermal_unregister
:
578 thermal_cooling_device_unregister(pr
->cdev
);
580 acpi_processor_power_exit(pr
, device
);
582 acpi_processor_remove_fs(device
);
584 free_cpumask_var(pr
->throttling
.shared_cpu_map
);
589 static int acpi_processor_remove(struct acpi_device
*device
, int type
)
591 struct acpi_processor
*pr
= NULL
;
594 if (!device
|| !acpi_driver_data(device
))
597 pr
= acpi_driver_data(device
);
599 if (pr
->id
>= nr_cpu_ids
)
602 if (type
== ACPI_BUS_REMOVAL_EJECT
) {
603 if (acpi_processor_handle_eject(pr
))
607 acpi_processor_power_exit(pr
, device
);
609 sysfs_remove_link(&device
->dev
.kobj
, "sysdev");
611 acpi_processor_remove_fs(device
);
614 sysfs_remove_link(&device
->dev
.kobj
, "thermal_cooling");
615 sysfs_remove_link(&pr
->cdev
->device
.kobj
, "device");
616 thermal_cooling_device_unregister(pr
->cdev
);
620 per_cpu(processors
, pr
->id
) = NULL
;
621 per_cpu(processor_device_array
, pr
->id
) = NULL
;
624 free_cpumask_var(pr
->throttling
.shared_cpu_map
);
630 #ifdef CONFIG_ACPI_HOTPLUG_CPU
631 /****************************************************************************
632 * Acpi processor hotplug support *
633 ****************************************************************************/
635 static int is_processor_present(acpi_handle handle
)
638 unsigned long long sta
= 0;
641 status
= acpi_evaluate_integer(handle
, "_STA", NULL
, &sta
);
643 if (ACPI_SUCCESS(status
) && (sta
& ACPI_STA_DEVICE_PRESENT
))
647 * _STA is mandatory for a processor that supports hot plug
649 if (status
== AE_NOT_FOUND
)
650 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
651 "Processor does not support hot plug\n"));
653 ACPI_EXCEPTION((AE_INFO
, status
,
654 "Processor Device is not present"));
659 int acpi_processor_device_add(acpi_handle handle
, struct acpi_device
**device
)
662 struct acpi_device
*pdev
;
665 if (acpi_get_parent(handle
, &phandle
)) {
669 if (acpi_bus_get_device(phandle
, &pdev
)) {
673 if (acpi_bus_add(device
, pdev
, handle
, ACPI_BUS_TYPE_PROCESSOR
)) {
680 static void __ref
acpi_processor_hotplug_notify(acpi_handle handle
,
681 u32 event
, void *data
)
683 struct acpi_processor
*pr
;
684 struct acpi_device
*device
= NULL
;
689 case ACPI_NOTIFY_BUS_CHECK
:
690 case ACPI_NOTIFY_DEVICE_CHECK
:
691 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
692 "Processor driver received %s event\n",
693 (event
== ACPI_NOTIFY_BUS_CHECK
) ?
694 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"));
696 if (!is_processor_present(handle
))
699 if (acpi_bus_get_device(handle
, &device
)) {
700 result
= acpi_processor_device_add(handle
, &device
);
702 printk(KERN_ERR PREFIX
703 "Unable to add the device\n");
707 case ACPI_NOTIFY_EJECT_REQUEST
:
708 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
709 "received ACPI_NOTIFY_EJECT_REQUEST\n"));
711 if (acpi_bus_get_device(handle
, &device
)) {
712 printk(KERN_ERR PREFIX
713 "Device don't exist, dropping EJECT\n");
716 pr
= acpi_driver_data(device
);
718 printk(KERN_ERR PREFIX
719 "Driver data is NULL, dropping EJECT\n");
724 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
725 "Unsupported event [0x%x]\n", event
));
733 processor_walk_namespace_cb(acpi_handle handle
,
734 u32 lvl
, void *context
, void **rv
)
737 int *action
= context
;
738 acpi_object_type type
= 0;
740 status
= acpi_get_type(handle
, &type
);
741 if (ACPI_FAILURE(status
))
744 if (type
!= ACPI_TYPE_PROCESSOR
)
748 case INSTALL_NOTIFY_HANDLER
:
749 acpi_install_notify_handler(handle
,
751 acpi_processor_hotplug_notify
,
754 case UNINSTALL_NOTIFY_HANDLER
:
755 acpi_remove_notify_handler(handle
,
757 acpi_processor_hotplug_notify
);
766 static acpi_status
acpi_processor_hotadd_init(acpi_handle handle
, int *p_cpu
)
769 if (!is_processor_present(handle
)) {
773 if (acpi_map_lsapic(handle
, p_cpu
))
776 if (arch_register_cpu(*p_cpu
)) {
777 acpi_unmap_lsapic(*p_cpu
);
784 static int acpi_processor_handle_eject(struct acpi_processor
*pr
)
786 if (cpu_online(pr
->id
))
789 arch_unregister_cpu(pr
->id
);
790 acpi_unmap_lsapic(pr
->id
);
794 static acpi_status
acpi_processor_hotadd_init(acpi_handle handle
, int *p_cpu
)
798 static int acpi_processor_handle_eject(struct acpi_processor
*pr
)
805 void acpi_processor_install_hotplug_notify(void)
807 #ifdef CONFIG_ACPI_HOTPLUG_CPU
808 int action
= INSTALL_NOTIFY_HANDLER
;
809 acpi_walk_namespace(ACPI_TYPE_PROCESSOR
,
812 processor_walk_namespace_cb
, NULL
, &action
, NULL
);
814 register_hotcpu_notifier(&acpi_cpu_notifier
);
818 void acpi_processor_uninstall_hotplug_notify(void)
820 #ifdef CONFIG_ACPI_HOTPLUG_CPU
821 int action
= UNINSTALL_NOTIFY_HANDLER
;
822 acpi_walk_namespace(ACPI_TYPE_PROCESSOR
,
825 processor_walk_namespace_cb
, NULL
, &action
, NULL
);
827 unregister_hotcpu_notifier(&acpi_cpu_notifier
);
831 * We keep the driver loaded even when ACPI is not running.
832 * This is needed for the powernow-k8 driver, that works even without
833 * ACPI, but needs symbols from this driver
836 static int __init
acpi_processor_init(void)
843 memset(&errata
, 0, sizeof(errata
));
845 acpi_processor_dir
= proc_mkdir(ACPI_PROCESSOR_CLASS
, acpi_root_dir
);
846 if (!acpi_processor_dir
)
849 if (!cpuidle_register_driver(&acpi_idle_driver
)) {
850 printk(KERN_DEBUG
"ACPI: %s registered with cpuidle\n",
851 acpi_idle_driver
.name
);
853 printk(KERN_DEBUG
"ACPI: acpi_idle yielding to %s\n",
854 cpuidle_get_driver()->name
);
857 result
= acpi_bus_register_driver(&acpi_processor_driver
);
861 acpi_processor_install_hotplug_notify();
863 acpi_thermal_cpufreq_init();
865 acpi_processor_ppc_init();
867 acpi_processor_throttling_init();
872 cpuidle_unregister_driver(&acpi_idle_driver
);
874 remove_proc_entry(ACPI_PROCESSOR_CLASS
, acpi_root_dir
);
879 static void __exit
acpi_processor_exit(void)
884 acpi_processor_ppc_exit();
886 acpi_thermal_cpufreq_exit();
888 acpi_processor_uninstall_hotplug_notify();
890 acpi_bus_unregister_driver(&acpi_processor_driver
);
892 cpuidle_unregister_driver(&acpi_idle_driver
);
894 remove_proc_entry(ACPI_PROCESSOR_CLASS
, acpi_root_dir
);
899 module_init(acpi_processor_init
);
900 module_exit(acpi_processor_exit
);
902 EXPORT_SYMBOL(acpi_processor_set_thermal_limit
);
904 MODULE_ALIAS("processor");