• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/arch/x86/oprofile/
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/perf_event.h>
17
18struct op_msr {
19	unsigned long	addr;
20	u64		saved;
21};
22
23struct op_msrs {
24	struct op_msr *counters;
25	struct op_msr *controls;
26	struct op_msr *multiplex;
27};
28
29struct pt_regs;
30
31struct oprofile_operations;
32
33/* The model vtable abstracts the differences between
34 * various x86 CPU models' perfctr support.
35 */
36struct op_x86_model_spec {
37	unsigned int	num_counters;
38	unsigned int	num_controls;
39	unsigned int	num_virt_counters;
40	u64		reserved;
41	u16		event_mask;
42	int		(*init)(struct oprofile_operations *ops);
43	int		(*fill_in_addresses)(struct op_msrs * const msrs);
44	void		(*setup_ctrs)(struct op_x86_model_spec const *model,
45				      struct op_msrs const * const msrs);
46	void		(*cpu_down)(void);
47	int		(*check_ctrs)(struct pt_regs * const regs,
48				      struct op_msrs const * const msrs);
49	void		(*start)(struct op_msrs const * const msrs);
50	void		(*stop)(struct op_msrs const * const msrs);
51	void		(*shutdown)(struct op_msrs const * const msrs);
52#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
53	void		(*switch_ctrl)(struct op_x86_model_spec const *model,
54				       struct op_msrs const * const msrs);
55#endif
56};
57
58struct op_counter_config;
59
60static inline void op_x86_warn_in_use(int counter)
61{
62	/*
63	 * The warning indicates an already running counter. If
64	 * oprofile doesn't collect data, then try using a different
65	 * performance counter on your platform to monitor the desired
66	 * event. Delete counter #%d from the desired event by editing
67	 * the /usr/share/oprofile/%s/<cpu>/events file. If the event
68	 * cannot be monitored by any other counter, contact your
69	 * hardware or BIOS vendor.
70	 */
71	pr_warning("oprofile: counter #%d on cpu #%d may already be used\n",
72		   counter, smp_processor_id());
73}
74
75static inline void op_x86_warn_reserved(int counter)
76{
77	pr_warning("oprofile: counter #%d is already reserved\n", counter);
78}
79
80extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
81			   struct op_counter_config *counter_config);
82extern int op_x86_phys_to_virt(int phys);
83extern int op_x86_virt_to_phys(int virt);
84
85extern struct op_x86_model_spec op_ppro_spec;
86extern struct op_x86_model_spec op_p4_spec;
87extern struct op_x86_model_spec op_p4_ht2_spec;
88extern struct op_x86_model_spec op_amd_spec;
89extern struct op_x86_model_spec op_arch_perfmon_spec;
90
91#endif /* OP_X86_MODEL_H */
92