Merge commit 'tip/perfcounters-for-linus' into oprofile/master
[pandora-kernel.git] / arch / x86 / oprofile / op_x86_model.h
1 /**
2  * @file op_x86_model.h
3  * interface to x86 model-specific MSR operations
4  *
5  * @remark Copyright 2002 OProfile authors
6  * @remark Read the file COPYING
7  *
8  * @author Graydon Hoare
9  * @author Robert Richter <robert.richter@amd.com>
10  */
11
12 #ifndef OP_X86_MODEL_H
13 #define OP_X86_MODEL_H
14
15 #include <asm/types.h>
16 #include <asm/perf_counter.h>
17
18 struct op_msr {
19         unsigned long   addr;
20         u64             saved;
21 };
22
23 struct op_msrs {
24         struct op_msr *counters;
25         struct op_msr *controls;
26 };
27
28 struct pt_regs;
29
30 struct oprofile_operations;
31
32 /* The model vtable abstracts the differences between
33  * various x86 CPU models' perfctr support.
34  */
35 struct op_x86_model_spec {
36         unsigned int    num_counters;
37         unsigned int    num_controls;
38         u64             reserved;
39         u16             event_mask;
40         int             (*init)(struct oprofile_operations *ops);
41         void            (*exit)(void);
42         void            (*fill_in_addresses)(struct op_msrs * const msrs);
43         void            (*setup_ctrs)(struct op_x86_model_spec const *model,
44                                       struct op_msrs const * const msrs);
45         int             (*check_ctrs)(struct pt_regs * const regs,
46                                       struct op_msrs const * const msrs);
47         void            (*start)(struct op_msrs const * const msrs);
48         void            (*stop)(struct op_msrs const * const msrs);
49         void            (*shutdown)(struct op_msrs const * const msrs);
50 };
51
52 struct op_counter_config;
53
54 extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
55                            struct op_counter_config *counter_config);
56
57 extern struct op_x86_model_spec const op_ppro_spec;
58 extern struct op_x86_model_spec const op_p4_spec;
59 extern struct op_x86_model_spec const op_p4_ht2_spec;
60 extern struct op_x86_model_spec const op_amd_spec;
61 extern struct op_x86_model_spec op_arch_perfmon_spec;
62
63 #endif /* OP_X86_MODEL_H */