2005-04-17 06:20:36 +08: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 21:10:32 +08:00
|
|
|
* @author Robert Richter <robert.richter@amd.com>
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OP_X86_MODEL_H
|
|
|
|
#define OP_X86_MODEL_H
|
|
|
|
|
2009-05-25 21:10:32 +08:00
|
|
|
#include <asm/types.h>
|
2009-06-12 23:58:48 +08:00
|
|
|
#include <asm/perf_counter.h>
|
2009-05-25 21:05:50 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct op_msr {
|
2009-06-04 01:09:27 +08:00
|
|
|
unsigned long addr;
|
|
|
|
u64 saved;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct op_msrs {
|
2008-09-05 23:12:36 +08:00
|
|
|
struct op_msr *counters;
|
|
|
|
struct op_msr *controls;
|
2009-07-08 19:49:38 +08:00
|
|
|
struct op_msr *multiplex;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
|
2009-05-25 21:10:32 +08:00
|
|
|
struct oprofile_operations;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* The model vtable abstracts the differences between
|
2007-10-20 07:13:56 +08:00
|
|
|
* various x86 CPU models' perfctr support.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
struct op_x86_model_spec {
|
2009-05-28 08:12:36 +08:00
|
|
|
unsigned int num_counters;
|
|
|
|
unsigned int num_controls;
|
2009-07-08 19:49:38 +08:00
|
|
|
unsigned int num_virt_counters;
|
2009-05-25 21:10:32 +08:00
|
|
|
u64 reserved;
|
|
|
|
u16 event_mask;
|
2009-05-28 08:12:36 +08:00
|
|
|
int (*init)(struct oprofile_operations *ops);
|
|
|
|
void (*exit)(void);
|
|
|
|
void (*fill_in_addresses)(struct op_msrs * const msrs);
|
2009-05-26 01:31:44 +08:00
|
|
|
void (*setup_ctrs)(struct op_x86_model_spec const *model,
|
|
|
|
struct op_msrs const * const msrs);
|
2009-05-28 08:12:36 +08: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 19:49:38 +08: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 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2009-05-25 21:10:32 +08: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 19:04:43 +08:00
|
|
|
extern int op_x86_phys_to_virt(int phys);
|
2009-05-25 21:10:32 +08:00
|
|
|
|
2009-07-09 21:12:35 +08:00
|
|
|
extern struct op_x86_model_spec op_ppro_spec;
|
|
|
|
extern struct op_x86_model_spec op_p4_spec;
|
|
|
|
extern struct op_x86_model_spec op_p4_ht2_spec;
|
|
|
|
extern struct op_x86_model_spec op_amd_spec;
|
2008-08-18 20:50:31 +08:00
|
|
|
extern struct op_x86_model_spec op_arch_perfmon_spec;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* OP_X86_MODEL_H */
|