2005-04-17 02:20:36 +04:00
|
|
|
/**
|
|
|
|
* @file op_x86_model.h
|
|
|
|
* interface to x86 model-specific MSR operations
|
|
|
|
*
|
|
|
|
* @remark Copyright 2002 OProfile authors
|
|
|
|
* @remark Read the file COPYING
|
|
|
|
*
|
|
|
|
* @author Graydon Hoare
|
2009-05-25 17:10:32 +04:00
|
|
|
* @author Robert Richter <robert.richter@amd.com>
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OP_X86_MODEL_H
|
|
|
|
#define OP_X86_MODEL_H
|
|
|
|
|
2009-05-25 17:10:32 +04:00
|
|
|
#include <asm/types.h>
|
2009-06-12 19:58:48 +04:00
|
|
|
#include <asm/perf_counter.h>
|
2009-05-25 17:05:50 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
struct op_msr {
|
2009-06-03 21:09:27 +04:00
|
|
|
unsigned long addr;
|
|
|
|
u64 saved;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct op_msrs {
|
2008-09-05 19:12:36 +04:00
|
|
|
struct op_msr *counters;
|
|
|
|
struct op_msr *controls;
|
2009-07-08 15:49:38 +04:00
|
|
|
struct op_msr *multiplex;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
|
2009-05-25 17:10:32 +04:00
|
|
|
struct oprofile_operations;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* The model vtable abstracts the differences between
|
2007-10-20 03:13:56 +04:00
|
|
|
* various x86 CPU models' perfctr support.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
struct op_x86_model_spec {
|
2009-05-28 04:12:36 +04:00
|
|
|
unsigned int num_counters;
|
|
|
|
unsigned int num_controls;
|
2009-07-08 15:49:38 +04:00
|
|
|
unsigned int num_virt_counters;
|
|
|
|
unsigned int num_virt_controls;
|
2009-05-25 17:10:32 +04:00
|
|
|
u64 reserved;
|
|
|
|
u16 event_mask;
|
2009-05-28 04:12:36 +04:00
|
|
|
int (*init)(struct oprofile_operations *ops);
|
|
|
|
void (*exit)(void);
|
|
|
|
void (*fill_in_addresses)(struct op_msrs * const msrs);
|
2009-05-25 21:31:44 +04:00
|
|
|
void (*setup_ctrs)(struct op_x86_model_spec const *model,
|
|
|
|
struct op_msrs const * const msrs);
|
2009-05-28 04:12:36 +04:00
|
|
|
int (*check_ctrs)(struct pt_regs * const regs,
|
|
|
|
struct op_msrs const * const msrs);
|
|
|
|
void (*start)(struct op_msrs const * const msrs);
|
|
|
|
void (*stop)(struct op_msrs const * const msrs);
|
|
|
|
void (*shutdown)(struct op_msrs const * const msrs);
|
2009-07-08 15:49:38 +04:00
|
|
|
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
|
|
|
|
void (*switch_ctrl)(struct op_x86_model_spec const *model,
|
|
|
|
struct op_msrs const * const msrs);
|
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2009-05-25 17:10:32 +04:00
|
|
|
struct op_counter_config;
|
|
|
|
|
|
|
|
extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
|
|
|
|
struct op_counter_config *counter_config);
|
2009-07-16 15:04:43 +04:00
|
|
|
extern int op_x86_phys_to_virt(int phys);
|
2009-05-25 17:10:32 +04:00
|
|
|
|
2009-05-14 19:10:52 +04:00
|
|
|
extern struct op_x86_model_spec const op_ppro_spec;
|
2005-04-17 02:20:36 +04:00
|
|
|
extern struct op_x86_model_spec const op_p4_spec;
|
|
|
|
extern struct op_x86_model_spec const op_p4_ht2_spec;
|
2008-07-22 23:08:50 +04:00
|
|
|
extern struct op_x86_model_spec const op_amd_spec;
|
2008-08-18 16:50:31 +04:00
|
|
|
extern struct op_x86_model_spec op_arch_perfmon_spec;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif /* OP_X86_MODEL_H */
|