1
2
3
4
5
6
7
8
9
10 #ifndef PR_UTIL_H
11 #define PR_UTIL_H
12
13 #include <linux/cpumask.h>
14 #include <linux/oprofile.h>
15 #include <asm/cell-pmu.h>
16 #include <asm/cell-regs.h>
17 #include <asm/spu.h>
18
19
20 #define SKIP_GENERIC_SYNC 0
21 #define SYNC_START_ERROR -1
22 #define DO_GENERIC_SYNC 1
23 #define SPUS_PER_NODE 8
24 #define DEFAULT_TIMER_EXPIRE (HZ / 10)
25
26 extern struct delayed_work spu_work;
27 extern int spu_prof_running;
28
29 #define TRACE_ARRAY_SIZE 1024
30
31 extern spinlock_t oprof_spu_smpl_arry_lck;
32
33 struct spu_overlay_info {
34 unsigned int vma;
35 unsigned int size;
36 unsigned int offset;
37 unsigned int buf;
38 };
39
40 struct vma_to_fileoffset_map {
41 struct vma_to_fileoffset_map *next;
42 unsigned int vma;
43 unsigned int size;
44 unsigned int offset;
45 unsigned int guard_ptr;
46 unsigned int guard_val;
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 };
69
70 struct spu_buffer {
71 int last_guard_val;
72 int ctx_sw_seen;
73 unsigned long *buff;
74 unsigned int head, tail;
75 };
76
77
78
79
80
81 struct vma_to_fileoffset_map *create_vma_map(const struct spu *spu,
82 unsigned long objectid);
83 unsigned int vma_map_lookup(struct vma_to_fileoffset_map *map,
84 unsigned int vma, const struct spu *aSpu,
85 int *grd_val);
86 void vma_map_free(struct vma_to_fileoffset_map *map);
87
88
89
90
91
92 int start_spu_profiling_cycles(unsigned int cycles_reset);
93 void start_spu_profiling_events(void);
94
95 void stop_spu_profiling_cycles(void);
96 void stop_spu_profiling_events(void);
97
98
99 int spu_sync_start(void);
100
101
102 int spu_sync_stop(void);
103
104
105 void spu_sync_buffer(int spu_num, unsigned int *samples,
106 int num_samples);
107
108 void set_spu_profiling_frequency(unsigned int freq_khz, unsigned int cycles_reset);
109
110 #endif