x86/oprofile: replace CTRL_SET_*ACTIVE macros
[safe/jmp/linux-2.6] / 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/intel_arch_perfmon.h>
17
18 #define CTR_IS_RESERVED(msrs, c)        ((msrs)->counters[(c)].addr ? 1 : 0)
19 #define CTRL_IS_RESERVED(msrs, c)       ((msrs)->controls[(c)].addr ? 1 : 0)
20
21 struct op_saved_msr {
22         unsigned int high;
23         unsigned int low;
24 };
25
26 struct op_msr {
27         unsigned long addr;
28         struct op_saved_msr saved;
29 };
30
31 struct op_msrs {
32         struct op_msr *counters;
33         struct op_msr *controls;
34 };
35
36 struct pt_regs;
37
38 struct oprofile_operations;
39
40 /* The model vtable abstracts the differences between
41  * various x86 CPU models' perfctr support.
42  */
43 struct op_x86_model_spec {
44         unsigned int    num_counters;
45         unsigned int    num_controls;
46         u64             reserved;
47         u16             event_mask;
48         int             (*init)(struct oprofile_operations *ops);
49         void            (*exit)(void);
50         void            (*fill_in_addresses)(struct op_msrs * const msrs);
51         void            (*setup_ctrs)(struct op_x86_model_spec const *model,
52                                       struct op_msrs const * const msrs);
53         int             (*check_ctrs)(struct pt_regs * const regs,
54                                       struct op_msrs const * const msrs);
55         void            (*start)(struct op_msrs const * const msrs);
56         void            (*stop)(struct op_msrs const * const msrs);
57         void            (*shutdown)(struct op_msrs const * const msrs);
58 };
59
60 struct op_counter_config;
61
62 extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
63                            struct op_counter_config *counter_config);
64
65 extern struct op_x86_model_spec const op_ppro_spec;
66 extern struct op_x86_model_spec const op_p4_spec;
67 extern struct op_x86_model_spec const op_p4_ht2_spec;
68 extern struct op_x86_model_spec const op_amd_spec;
69 extern struct op_x86_model_spec op_arch_perfmon_spec;
70
71 #endif /* OP_X86_MODEL_H */