blob: bd8157d12ff003a65283df07b5a9caeecf2ac8b4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
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
14struct op_saved_msr {
15 unsigned int high;
16 unsigned int low;
17};
18
19struct op_msr {
20 unsigned long addr;
21 struct op_saved_msr saved;
22};
23
24struct op_msrs {
Robert Richter25ad2912008-09-05 17:12:36 +020025 struct op_msr *counters;
26 struct op_msr *controls;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027};
28
29struct pt_regs;
30
31/* The model vtable abstracts the differences between
Simon Arlott27b46d72007-10-20 01:13:56 +020032 * various x86 CPU models' perfctr support.
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 */
34struct op_x86_model_spec {
Robert Richter06552cc2009-05-28 02:12:36 +020035 unsigned int num_counters;
36 unsigned int num_controls;
37 int (*init)(struct oprofile_operations *ops);
38 void (*exit)(void);
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);
45 void (*shutdown)(struct op_msrs const * const msrs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046};
47
Robert Richter849620f2009-05-14 17:10:52 +020048extern struct op_x86_model_spec const op_ppro_spec;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049extern struct op_x86_model_spec const op_p4_spec;
50extern struct op_x86_model_spec const op_p4_ht2_spec;
Robert Richter6657fe42008-07-22 21:08:50 +020051extern struct op_x86_model_spec const op_amd_spec;
Andi Kleenb9917022008-08-18 14:50:31 +020052extern struct op_x86_model_spec op_arch_perfmon_spec;
53
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#endif /* OP_X86_MODEL_H */