ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / i386 / oprofile / init.c
1 /**
2  * @file init.c
3  *
4  * @remark Copyright 2002 OProfile authors
5  * @remark Read the file COPYING
6  *
7  * @author John Levon <levon@movementarian.org>
8  */
9
10 #include <linux/oprofile.h>
11 #include <linux/init.h>
12 #include <linux/errno.h>
13  
14 /* We support CPUs that have performance counters like the Pentium Pro
15  * with the NMI mode driver.
16  */
17  
18 extern int nmi_init(struct oprofile_operations ** ops);
19 extern int nmi_timer_init(struct oprofile_operations **ops);
20 extern void nmi_exit(void);
21
22 int __init oprofile_arch_init(struct oprofile_operations ** ops)
23 {
24         int ret = -ENODEV;
25 #ifdef CONFIG_X86_LOCAL_APIC
26         ret = nmi_init(ops);
27 #endif
28
29 #ifdef CONFIG_X86_IO_APIC
30         if (ret < 0)
31                 ret = nmi_timer_init(ops);
32 #endif
33         return ret;
34 }
35
36
37 void oprofile_arch_exit(void)
38 {
39 #ifdef CONFIG_X86_LOCAL_APIC
40         nmi_exit();
41 #endif
42 }