x86: cpa self-test, WARN_ON()
[wrt350n-kernel.git] / arch / powerpc / oprofile / cell / pr_util.h
blob22e4e8d4eb2c706daa7ad3481e87e4cc10afaf2b
1 /*
2 * Cell Broadband Engine OProfile Support
4 * (C) Copyright IBM Corporation 2006
6 * Author: Maynard Johnson <maynardj@us.ibm.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
14 #ifndef PR_UTIL_H
15 #define PR_UTIL_H
17 #include <linux/cpumask.h>
18 #include <linux/oprofile.h>
19 #include <asm/cell-pmu.h>
20 #include <asm/cell-regs.h>
21 #include <asm/spu.h>
23 /* Defines used for sync_start */
24 #define SKIP_GENERIC_SYNC 0
25 #define SYNC_START_ERROR -1
26 #define DO_GENERIC_SYNC 1
28 struct spu_overlay_info { /* map of sections within an SPU overlay */
29 unsigned int vma; /* SPU virtual memory address from elf */
30 unsigned int size; /* size of section from elf */
31 unsigned int offset; /* offset of section into elf file */
32 unsigned int buf;
35 struct vma_to_fileoffset_map { /* map of sections within an SPU program */
36 struct vma_to_fileoffset_map *next; /* list pointer */
37 unsigned int vma; /* SPU virtual memory address from elf */
38 unsigned int size; /* size of section from elf */
39 unsigned int offset; /* offset of section into elf file */
40 unsigned int guard_ptr;
41 unsigned int guard_val;
43 * The guard pointer is an entry in the _ovly_buf_table,
44 * computed using ovly.buf as the index into the table. Since
45 * ovly.buf values begin at '1' to reference the first (or 0th)
46 * entry in the _ovly_buf_table, the computation subtracts 1
47 * from ovly.buf.
48 * The guard value is stored in the _ovly_buf_table entry and
49 * is an index (starting at 1) back to the _ovly_table entry
50 * that is pointing at this _ovly_buf_table entry. So, for
51 * example, for an overlay scenario with one overlay segment
52 * and two overlay sections:
53 * - Section 1 points to the first entry of the
54 * _ovly_buf_table, which contains a guard value
55 * of '1', referencing the first (index=0) entry of
56 * _ovly_table.
57 * - Section 2 points to the second entry of the
58 * _ovly_buf_table, which contains a guard value
59 * of '2', referencing the second (index=1) entry of
60 * _ovly_table.
65 /* The three functions below are for maintaining and accessing
66 * the vma-to-fileoffset map.
68 struct vma_to_fileoffset_map *create_vma_map(const struct spu *spu,
69 u64 objectid);
70 unsigned int vma_map_lookup(struct vma_to_fileoffset_map *map,
71 unsigned int vma, const struct spu *aSpu,
72 int *grd_val);
73 void vma_map_free(struct vma_to_fileoffset_map *map);
76 * Entry point for SPU profiling.
77 * cycles_reset is the SPU_CYCLES count value specified by the user.
79 int start_spu_profiling(unsigned int cycles_reset);
81 void stop_spu_profiling(void);
84 /* add the necessary profiling hooks */
85 int spu_sync_start(void);
87 /* remove the hooks */
88 int spu_sync_stop(void);
90 /* Record SPU program counter samples to the oprofile event buffer. */
91 void spu_sync_buffer(int spu_num, unsigned int *samples,
92 int num_samples);
94 void set_spu_profiling_frequency(unsigned int freq_khz, unsigned int cycles_reset);
96 #endif /* PR_UTIL_H */