Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ |
| 10 | |
| 11 | #ifndef OP_X86_MODEL_H |
| 12 | #define OP_X86_MODEL_H |
| 13 | |
| 14 | struct op_saved_msr { |
| 15 | unsigned int high; |
| 16 | unsigned int low; |
| 17 | }; |
| 18 | |
| 19 | struct op_msr { |
| 20 | unsigned long addr; |
| 21 | struct op_saved_msr saved; |
| 22 | }; |
| 23 | |
| 24 | struct op_msrs { |
Robert Richter | 25ad2913 | 2008-09-05 17:12:36 +0200 | [diff] [blame] | 25 | struct op_msr *counters; |
| 26 | struct op_msr *controls; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | struct pt_regs; |
| 30 | |
| 31 | /* The model vtable abstracts the differences between |
Simon Arlott | 27b46d7 | 2007-10-20 01:13:56 +0200 | [diff] [blame] | 32 | * various x86 CPU models' perfctr support. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | */ |
| 34 | struct op_x86_model_spec { |
Robert Richter | adf5ec0 | 2008-07-22 21:08:48 +0200 | [diff] [blame] | 35 | int (*init)(struct oprofile_operations *ops); |
| 36 | void (*exit)(void); |
Andi Kleen | 5d44880 | 2008-08-18 14:49:47 +0200 | [diff] [blame] | 37 | unsigned int num_counters; |
| 38 | unsigned int num_controls; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | void (*fill_in_addresses)(struct op_msrs * const msrs); |
| 40 | void (*setup_ctrs)(struct op_msrs const * const msrs); |
| 41 | int (*check_ctrs)(struct pt_regs * const regs, |
| 42 | struct op_msrs const * const msrs); |
| 43 | void (*start)(struct op_msrs const * const msrs); |
| 44 | void (*stop)(struct op_msrs const * const msrs); |
Don Zickus | cb9c448 | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 45 | void (*shutdown)(struct op_msrs const * const msrs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | }; |
| 47 | |
Andi Kleen | 5951290 | 2008-09-29 22:23:33 +0200 | [diff] [blame] | 48 | extern struct op_x86_model_spec op_ppro_spec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | extern struct op_x86_model_spec const op_p4_spec; |
| 50 | extern struct op_x86_model_spec const op_p4_ht2_spec; |
Robert Richter | 6657fe4 | 2008-07-22 21:08:50 +0200 | [diff] [blame] | 51 | extern struct op_x86_model_spec const op_amd_spec; |
Andi Kleen | b991702 | 2008-08-18 14:50:31 +0200 | [diff] [blame] | 52 | extern struct op_x86_model_spec op_arch_perfmon_spec; |
| 53 | |
| 54 | extern void arch_perfmon_setup_counters(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | #endif /* OP_X86_MODEL_H */ |