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 #ifdef CONFIG_ACPI_PROCFS
44 #include <linux/proc_fs.h>
45 #include <linux/seq_file.h>
47 #include <linux/dmi.h>
48 #include <linux/moduleparam.h>
49 #include <linux/cpuidle.h>
50 #include <linux/slab.h>
53 #include <asm/system.h>
55 #include <asm/delay.h>
56 #include <asm/uaccess.h>
57 #include <asm/processor.h>
61 #include <acpi/acpi_bus.h>
62 #include <acpi/acpi_drivers.h>
63 #include <acpi/processor.h>
65 #define PREFIX "ACPI: "
67 #define ACPI_PROCESSOR_CLASS "processor"
68 #define ACPI_PROCESSOR_DEVICE_NAME "Processor"
69 #define ACPI_PROCESSOR_FILE_INFO "info"
70 #define ACPI_PROCESSOR_FILE_THROTTLING "throttling"
71 #define ACPI_PROCESSOR_FILE_LIMIT "limit"
72 #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
73 #define ACPI_PROCESSOR_NOTIFY_POWER 0x81
74 #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
76 #define ACPI_PROCESSOR_LIMIT_USER 0
77 #define ACPI_PROCESSOR_LIMIT_THERMAL 1
79 #define _COMPONENT ACPI_PROCESSOR_COMPONENT
80 ACPI_MODULE_NAME("processor_driver");
82 MODULE_AUTHOR("Paul Diefenbaugh");
83 MODULE_DESCRIPTION("ACPI Processor Driver");
84 MODULE_LICENSE("GPL");
86 static int acpi_processor_add(struct acpi_device
*device
);
87 static int acpi_processor_remove(struct acpi_device
*device
, int type
);
88 static void acpi_processor_notify(struct acpi_device
*device
, u32 event
);
89 static acpi_status
acpi_processor_hotadd_init(acpi_handle handle
, int *p_cpu
);
90 static int acpi_processor_handle_eject(struct acpi_processor
*pr
);
93 static const struct acpi_device_id processor_device_ids
[] = {
94 {ACPI_PROCESSOR_OBJECT_HID
, 0},
98 MODULE_DEVICE_TABLE(acpi
, processor_device_ids
);
100 static struct acpi_driver acpi_processor_driver
= {
102 .class = ACPI_PROCESSOR_CLASS
,
103 .ids
= processor_device_ids
,
105 .add
= acpi_processor_add
,
106 .remove
= acpi_processor_remove
,
107 .suspend
= acpi_processor_suspend
,
108 .resume
= acpi_processor_resume
,
109 .notify
= acpi_processor_notify
,
113 #define INSTALL_NOTIFY_HANDLER 1
114 #define UNINSTALL_NOTIFY_HANDLER 2
116 DEFINE_PER_CPU(struct acpi_processor
*, processors
);
117 EXPORT_PER_CPU_SYMBOL(processors
);
119 struct acpi_processor_errata errata __read_mostly
;
121 /* --------------------------------------------------------------------------
123 -------------------------------------------------------------------------- */
125 static int acpi_processor_errata_piix4(struct pci_dev
*dev
)
135 * Note that 'dev' references the PIIX4 ACPI Controller.
138 switch (dev
->revision
) {
140 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4 A-step\n"));
143 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4 B-step\n"));
146 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4E\n"));
149 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found PIIX4M\n"));
152 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found unknown PIIX4\n"));
156 switch (dev
->revision
) {
158 case 0: /* PIIX4 A-step */
159 case 1: /* PIIX4 B-step */
161 * See specification changes #13 ("Manual Throttle Duty Cycle")
162 * and #14 ("Enabling and Disabling Manual Throttle"), plus
163 * erratum #5 ("STPCLK# Deassertion Time") from the January
164 * 2002 PIIX4 specification update. Applies to only older
167 errata
.piix4
.throttle
= 1;
172 * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA
173 * Livelock") from the January 2002 PIIX4 specification update.
174 * Applies to all PIIX4 models.
180 * Find the PIIX4 IDE Controller and get the Bus Master IDE
181 * Status register address. We'll use this later to read
182 * each IDE controller's DMA status to make sure we catch all
185 dev
= pci_get_subsys(PCI_VENDOR_ID_INTEL
,
186 PCI_DEVICE_ID_INTEL_82371AB
,
187 PCI_ANY_ID
, PCI_ANY_ID
, NULL
);
189 errata
.piix4
.bmisx
= pci_resource_start(dev
, 4);
196 * Find the PIIX4 ISA Controller and read the Motherboard
197 * DMA controller's status to see if Type-F (Fast) DMA mode
198 * is enabled (bit 7) on either channel. Note that we'll
199 * disable C3 support if this is enabled, as some legacy
200 * devices won't operate well if fast DMA is disabled.
202 dev
= pci_get_subsys(PCI_VENDOR_ID_INTEL
,
203 PCI_DEVICE_ID_INTEL_82371AB_0
,
204 PCI_ANY_ID
, PCI_ANY_ID
, NULL
);
206 pci_read_config_byte(dev
, 0x76, &value1
);
207 pci_read_config_byte(dev
, 0x77, &value2
);
208 if ((value1
& 0x80) || (value2
& 0x80))
209 errata
.piix4
.fdma
= 1;
216 if (errata
.piix4
.bmisx
)
217 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
218 "Bus master activity detection (BM-IDE) erratum enabled\n"));
219 if (errata
.piix4
.fdma
)
220 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
221 "Type-F DMA livelock erratum (C3 disabled)\n"));
226 static int acpi_processor_errata(struct acpi_processor
*pr
)
229 struct pci_dev
*dev
= NULL
;
238 dev
= pci_get_subsys(PCI_VENDOR_ID_INTEL
,
239 PCI_DEVICE_ID_INTEL_82371AB_3
, PCI_ANY_ID
,
242 result
= acpi_processor_errata_piix4(dev
);
249 #ifdef CONFIG_ACPI_PROCFS
250 static struct proc_dir_entry
*acpi_processor_dir
= NULL
;
252 static int __cpuinit
acpi_processor_add_fs(struct acpi_device
*device
)
254 struct proc_dir_entry
*entry
= NULL
;
257 if (!acpi_device_dir(device
)) {
258 acpi_device_dir(device
) = proc_mkdir(acpi_device_bid(device
),
260 if (!acpi_device_dir(device
))
264 /* 'throttling' [R/W] */
265 entry
= proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING
,
266 S_IFREG
| S_IRUGO
| S_IWUSR
,
267 acpi_device_dir(device
),
268 &acpi_processor_throttling_fops
,
269 acpi_driver_data(device
));
274 static int acpi_processor_remove_fs(struct acpi_device
*device
)
277 if (acpi_device_dir(device
)) {
278 remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING
,
279 acpi_device_dir(device
));
280 remove_proc_entry(acpi_device_bid(device
), acpi_processor_dir
);
281 acpi_device_dir(device
) = NULL
;
287 static inline int acpi_processor_add_fs(struct acpi_device
*device
)
291 static inline int acpi_processor_remove_fs(struct acpi_device
*device
)
296 /* --------------------------------------------------------------------------
298 -------------------------------------------------------------------------- */
300 static int acpi_processor_get_info(struct acpi_device
*device
)
302 acpi_status status
= 0;
303 union acpi_object object
= { 0 };
304 struct acpi_buffer buffer
= { sizeof(union acpi_object
), &object
};
305 struct acpi_processor
*pr
;
306 int cpu_index
, device_declaration
= 0;
307 static int cpu0_initialized
;
309 pr
= acpi_driver_data(device
);
313 if (num_online_cpus() > 1)
316 acpi_processor_errata(pr
);
319 * Check to see if we have bus mastering arbitration control. This
320 * is required for proper C3 usage (to maintain cache coherency).
322 if (acpi_gbl_FADT
.pm2_control_block
&& acpi_gbl_FADT
.pm2_control_length
) {
323 pr
->flags
.bm_control
= 1;
324 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
325 "Bus mastering arbitration control present\n"));
327 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
328 "No bus mastering arbitration control\n"));
330 if (!strcmp(acpi_device_hid(device
), ACPI_PROCESSOR_OBJECT_HID
)) {
331 /* Declared with "Processor" statement; match ProcessorID */
332 status
= acpi_evaluate_object(pr
->handle
, NULL
, NULL
, &buffer
);
333 if (ACPI_FAILURE(status
)) {
334 printk(KERN_ERR PREFIX
"Evaluating processor object\n");
339 * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
340 * >>> 'acpi_get_processor_id(acpi_id, &id)' in
343 pr
->acpi_id
= object
.processor
.proc_id
;
346 * Declared with "Device" statement; match _UID.
347 * Note that we don't handle string _UIDs yet.
349 unsigned long long value
;
350 status
= acpi_evaluate_integer(pr
->handle
, METHOD_NAME__UID
,
352 if (ACPI_FAILURE(status
)) {
353 printk(KERN_ERR PREFIX
354 "Evaluating processor _UID [%#x]\n", status
);
357 device_declaration
= 1;
360 cpu_index
= acpi_get_cpuid(pr
->handle
, device_declaration
, pr
->acpi_id
);
362 /* Handle UP system running SMP kernel, with no LAPIC in MADT */
363 if (!cpu0_initialized
&& (cpu_index
== -1) &&
364 (num_online_cpus() == 1)) {
368 cpu0_initialized
= 1;
373 * Extra Processor objects may be enumerated on MP systems with
374 * less than the max # of CPUs. They should be ignored _iff
375 * they are physically not present.
379 (acpi_processor_hotadd_init(pr
->handle
, &pr
->id
))) {
384 * On some boxes several processors use the same processor bus id.
385 * But they are located in different scope. For example:
388 * Rename the processor device bus id. And the new bus id will be
389 * generated as the following format:
392 sprintf(acpi_device_bid(device
), "CPU%X", pr
->id
);
393 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Processor [%d:%d]\n", pr
->id
,
396 if (!object
.processor
.pblk_address
)
397 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "No PBLK (NULL address)\n"));
398 else if (object
.processor
.pblk_length
!= 6)
399 printk(KERN_ERR PREFIX
"Invalid PBLK length [%d]\n",
400 object
.processor
.pblk_length
);
402 pr
->throttling
.address
= object
.processor
.pblk_address
;
403 pr
->throttling
.duty_offset
= acpi_gbl_FADT
.duty_offset
;
404 pr
->throttling
.duty_width
= acpi_gbl_FADT
.duty_width
;
406 pr
->pblk
= object
.processor
.pblk_address
;
409 * We don't care about error returns - we just try to mark
410 * these reserved so that nobody else is confused into thinking
411 * that this region might be unused..
413 * (In particular, allocating the IO range for Cardbus)
415 request_region(pr
->throttling
.address
, 6, "ACPI CPU throttle");
419 * If ACPI describes a slot number for this CPU, we can use it
420 * ensure we get the right value in the "physical id" field
423 status
= acpi_evaluate_object(pr
->handle
, "_SUN", NULL
, &buffer
);
424 if (ACPI_SUCCESS(status
))
425 arch_fix_phys_package_id(pr
->id
, object
.integer
.value
);
430 static DEFINE_PER_CPU(void *, processor_device_array
);
432 static void acpi_processor_notify(struct acpi_device
*device
, u32 event
)
434 struct acpi_processor
*pr
= acpi_driver_data(device
);
441 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE
:
442 saved
= pr
->performance_platform_limit
;
443 acpi_processor_ppc_has_changed(pr
, 1);
444 if (saved
== pr
->performance_platform_limit
)
446 acpi_bus_generate_proc_event(device
, event
,
447 pr
->performance_platform_limit
);
448 acpi_bus_generate_netlink_event(device
->pnp
.device_class
,
449 dev_name(&device
->dev
), event
,
450 pr
->performance_platform_limit
);
452 case ACPI_PROCESSOR_NOTIFY_POWER
:
453 acpi_processor_cst_has_changed(pr
);
454 acpi_bus_generate_proc_event(device
, event
, 0);
455 acpi_bus_generate_netlink_event(device
->pnp
.device_class
,
456 dev_name(&device
->dev
), event
, 0);
458 case ACPI_PROCESSOR_NOTIFY_THROTTLING
:
459 acpi_processor_tstate_has_changed(pr
);
460 acpi_bus_generate_proc_event(device
, event
, 0);
461 acpi_bus_generate_netlink_event(device
->pnp
.device_class
,
462 dev_name(&device
->dev
), event
, 0);
464 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
465 "Unsupported event [0x%x]\n", event
));
472 static int acpi_cpu_soft_notify(struct notifier_block
*nfb
,
473 unsigned long action
, void *hcpu
)
475 unsigned int cpu
= (unsigned long)hcpu
;
476 struct acpi_processor
*pr
= per_cpu(processors
, cpu
);
478 if (action
== CPU_ONLINE
&& pr
) {
479 acpi_processor_ppc_has_changed(pr
, 0);
480 acpi_processor_cst_has_changed(pr
);
481 acpi_processor_tstate_has_changed(pr
);
486 static struct notifier_block acpi_cpu_notifier
=
488 .notifier_call
= acpi_cpu_soft_notify
,
491 static int __cpuinit
acpi_processor_add(struct acpi_device
*device
)
493 struct acpi_processor
*pr
= NULL
;
495 struct sys_device
*sysdev
;
497 pr
= kzalloc(sizeof(struct acpi_processor
), GFP_KERNEL
);
501 if (!zalloc_cpumask_var(&pr
->throttling
.shared_cpu_map
, GFP_KERNEL
)) {
506 pr
->handle
= device
->handle
;
507 strcpy(acpi_device_name(device
), ACPI_PROCESSOR_DEVICE_NAME
);
508 strcpy(acpi_device_class(device
), ACPI_PROCESSOR_CLASS
);
509 device
->driver_data
= pr
;
511 result
= acpi_processor_get_info(device
);
513 /* Processor is physically not present */
518 if (pr
->id
>= setup_max_cpus
&& pr
->id
!= 0)
522 BUG_ON((pr
->id
>= nr_cpu_ids
) || (pr
->id
< 0));
526 * ACPI id of processors can be reported wrongly by the BIOS.
527 * Don't trust it blindly
529 if (per_cpu(processor_device_array
, pr
->id
) != NULL
&&
530 per_cpu(processor_device_array
, pr
->id
) != device
) {
531 printk(KERN_WARNING
"BIOS reported wrong ACPI id "
532 "for the processor\n");
534 goto err_free_cpumask
;
536 per_cpu(processor_device_array
, pr
->id
) = device
;
538 per_cpu(processors
, pr
->id
) = pr
;
540 result
= acpi_processor_add_fs(device
);
542 goto err_free_cpumask
;
544 sysdev
= get_cpu_sysdev(pr
->id
);
545 if (sysfs_create_link(&device
->dev
.kobj
, &sysdev
->kobj
, "sysdev")) {
550 #ifdef CONFIG_CPU_FREQ
551 acpi_processor_ppc_has_changed(pr
, 0);
553 acpi_processor_get_throttling_info(pr
);
554 acpi_processor_get_limit_info(pr
);
557 if (cpuidle_get_driver() == &acpi_idle_driver
)
558 acpi_processor_power_init(pr
, device
);
560 pr
->cdev
= thermal_cooling_device_register("Processor", device
,
561 &processor_cooling_ops
);
562 if (IS_ERR(pr
->cdev
)) {
563 result
= PTR_ERR(pr
->cdev
);
567 dev_dbg(&device
->dev
, "registered as cooling_device%d\n",
570 result
= sysfs_create_link(&device
->dev
.kobj
,
571 &pr
->cdev
->device
.kobj
,
574 printk(KERN_ERR PREFIX
"Create sysfs link\n");
575 goto err_thermal_unregister
;
577 result
= sysfs_create_link(&pr
->cdev
->device
.kobj
,
581 printk(KERN_ERR PREFIX
"Create sysfs link\n");
582 goto err_remove_sysfs
;
588 sysfs_remove_link(&device
->dev
.kobj
, "thermal_cooling");
589 err_thermal_unregister
:
590 thermal_cooling_device_unregister(pr
->cdev
);
592 acpi_processor_power_exit(pr
, device
);
594 acpi_processor_remove_fs(device
);
596 free_cpumask_var(pr
->throttling
.shared_cpu_map
);
601 static int acpi_processor_remove(struct acpi_device
*device
, int type
)
603 struct acpi_processor
*pr
= NULL
;
606 if (!device
|| !acpi_driver_data(device
))
609 pr
= acpi_driver_data(device
);
611 if (pr
->id
>= nr_cpu_ids
)
614 if (type
== ACPI_BUS_REMOVAL_EJECT
) {
615 if (acpi_processor_handle_eject(pr
))
619 acpi_processor_power_exit(pr
, device
);
621 sysfs_remove_link(&device
->dev
.kobj
, "sysdev");
623 acpi_processor_remove_fs(device
);
626 sysfs_remove_link(&device
->dev
.kobj
, "thermal_cooling");
627 sysfs_remove_link(&pr
->cdev
->device
.kobj
, "device");
628 thermal_cooling_device_unregister(pr
->cdev
);
632 per_cpu(processors
, pr
->id
) = NULL
;
633 per_cpu(processor_device_array
, pr
->id
) = NULL
;
636 free_cpumask_var(pr
->throttling
.shared_cpu_map
);
642 #ifdef CONFIG_ACPI_HOTPLUG_CPU
643 /****************************************************************************
644 * Acpi processor hotplug support *
645 ****************************************************************************/
647 static int is_processor_present(acpi_handle handle
)
650 unsigned long long sta
= 0;
653 status
= acpi_evaluate_integer(handle
, "_STA", NULL
, &sta
);
655 if (ACPI_SUCCESS(status
) && (sta
& ACPI_STA_DEVICE_PRESENT
))
659 * _STA is mandatory for a processor that supports hot plug
661 if (status
== AE_NOT_FOUND
)
662 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
663 "Processor does not support hot plug\n"));
665 ACPI_EXCEPTION((AE_INFO
, status
,
666 "Processor Device is not present"));
671 int acpi_processor_device_add(acpi_handle handle
, struct acpi_device
**device
)
674 struct acpi_device
*pdev
;
677 if (acpi_get_parent(handle
, &phandle
)) {
681 if (acpi_bus_get_device(phandle
, &pdev
)) {
685 if (acpi_bus_add(device
, pdev
, handle
, ACPI_BUS_TYPE_PROCESSOR
)) {
692 static void __ref
acpi_processor_hotplug_notify(acpi_handle handle
,
693 u32 event
, void *data
)
695 struct acpi_processor
*pr
;
696 struct acpi_device
*device
= NULL
;
701 case ACPI_NOTIFY_BUS_CHECK
:
702 case ACPI_NOTIFY_DEVICE_CHECK
:
703 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
704 "Processor driver received %s event\n",
705 (event
== ACPI_NOTIFY_BUS_CHECK
) ?
706 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"));
708 if (!is_processor_present(handle
))
711 if (acpi_bus_get_device(handle
, &device
)) {
712 result
= acpi_processor_device_add(handle
, &device
);
714 printk(KERN_ERR PREFIX
715 "Unable to add the device\n");
719 case ACPI_NOTIFY_EJECT_REQUEST
:
720 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
721 "received ACPI_NOTIFY_EJECT_REQUEST\n"));
723 if (acpi_bus_get_device(handle
, &device
)) {
724 printk(KERN_ERR PREFIX
725 "Device don't exist, dropping EJECT\n");
728 pr
= acpi_driver_data(device
);
730 printk(KERN_ERR PREFIX
731 "Driver data is NULL, dropping EJECT\n");
736 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
737 "Unsupported event [0x%x]\n", event
));
745 processor_walk_namespace_cb(acpi_handle handle
,
746 u32 lvl
, void *context
, void **rv
)
749 int *action
= context
;
750 acpi_object_type type
= 0;
752 status
= acpi_get_type(handle
, &type
);
753 if (ACPI_FAILURE(status
))
756 if (type
!= ACPI_TYPE_PROCESSOR
)
760 case INSTALL_NOTIFY_HANDLER
:
761 acpi_install_notify_handler(handle
,
763 acpi_processor_hotplug_notify
,
766 case UNINSTALL_NOTIFY_HANDLER
:
767 acpi_remove_notify_handler(handle
,
769 acpi_processor_hotplug_notify
);
778 static acpi_status
acpi_processor_hotadd_init(acpi_handle handle
, int *p_cpu
)
781 if (!is_processor_present(handle
)) {
785 if (acpi_map_lsapic(handle
, p_cpu
))
788 if (arch_register_cpu(*p_cpu
)) {
789 acpi_unmap_lsapic(*p_cpu
);
796 static int acpi_processor_handle_eject(struct acpi_processor
*pr
)
798 if (cpu_online(pr
->id
))
801 arch_unregister_cpu(pr
->id
);
802 acpi_unmap_lsapic(pr
->id
);
806 static acpi_status
acpi_processor_hotadd_init(acpi_handle handle
, int *p_cpu
)
810 static int acpi_processor_handle_eject(struct acpi_processor
*pr
)
817 void acpi_processor_install_hotplug_notify(void)
819 #ifdef CONFIG_ACPI_HOTPLUG_CPU
820 int action
= INSTALL_NOTIFY_HANDLER
;
821 acpi_walk_namespace(ACPI_TYPE_PROCESSOR
,
824 processor_walk_namespace_cb
, NULL
, &action
, NULL
);
826 register_hotcpu_notifier(&acpi_cpu_notifier
);
830 void acpi_processor_uninstall_hotplug_notify(void)
832 #ifdef CONFIG_ACPI_HOTPLUG_CPU
833 int action
= UNINSTALL_NOTIFY_HANDLER
;
834 acpi_walk_namespace(ACPI_TYPE_PROCESSOR
,
837 processor_walk_namespace_cb
, NULL
, &action
, NULL
);
839 unregister_hotcpu_notifier(&acpi_cpu_notifier
);
843 * We keep the driver loaded even when ACPI is not running.
844 * This is needed for the powernow-k8 driver, that works even without
845 * ACPI, but needs symbols from this driver
848 static int __init
acpi_processor_init(void)
855 memset(&errata
, 0, sizeof(errata
));
857 #ifdef CONFIG_ACPI_PROCFS
858 acpi_processor_dir
= proc_mkdir(ACPI_PROCESSOR_CLASS
, acpi_root_dir
);
859 if (!acpi_processor_dir
)
863 if (!cpuidle_register_driver(&acpi_idle_driver
)) {
864 printk(KERN_DEBUG
"ACPI: %s registered with cpuidle\n",
865 acpi_idle_driver
.name
);
867 printk(KERN_DEBUG
"ACPI: acpi_idle yielding to %s\n",
868 cpuidle_get_driver()->name
);
871 result
= acpi_bus_register_driver(&acpi_processor_driver
);
875 acpi_processor_install_hotplug_notify();
877 acpi_thermal_cpufreq_init();
879 acpi_processor_ppc_init();
881 acpi_processor_throttling_init();
886 cpuidle_unregister_driver(&acpi_idle_driver
);
888 #ifdef CONFIG_ACPI_PROCFS
889 remove_proc_entry(ACPI_PROCESSOR_CLASS
, acpi_root_dir
);
895 static void __exit
acpi_processor_exit(void)
900 acpi_processor_ppc_exit();
902 acpi_thermal_cpufreq_exit();
904 acpi_processor_uninstall_hotplug_notify();
906 acpi_bus_unregister_driver(&acpi_processor_driver
);
908 cpuidle_unregister_driver(&acpi_idle_driver
);
910 #ifdef CONFIG_ACPI_PROCFS
911 remove_proc_entry(ACPI_PROCESSOR_CLASS
, acpi_root_dir
);
917 module_init(acpi_processor_init
);
918 module_exit(acpi_processor_exit
);
920 MODULE_ALIAS("processor");