move new files out from platform support patch
[openwrt/staging/yousong.git] / target / linux / ubicom32 / files / arch / ubicom32 / mach-common / profile.h
1 /*
2 * arch/ubicom32/mach-common/profile.h
3 * Private data for the profile module
4 *
5 * (C) Copyright 2009, Ubicom, Inc.
6 *
7 * This file is part of the Ubicom32 Linux Kernel Port.
8 *
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
22 *
23 * Ubicom32 implementation derived from (with many thanks):
24 * arch/m68knommu
25 * arch/blackfin
26 * arch/parisc
27 */
28
29 #include <linux/types.h>
30 #include <asm/devtree.h>
31 #include "profpkt.h"
32
33 #ifndef _PROFILE_H_
34 #define _PROFILE_H_
35
36 #define PROFILE_MAX_THREADS 16
37 #define PROFILE_MAX_SAMPLES 1024
38
39 struct profile_sample;
40 struct oprofile_sample;
41
42 /*
43 * values chosen so all counter values fit in a single UDP packet
44 */
45 #define PROFILE_NODE_MAX_COUNTERS 32
46
47 struct profile_counter {
48 char name[PROFILE_COUNTER_NAME_LENGTH];
49 unsigned int value;
50 };
51
52 struct profilenode {
53 struct devtree_node dn;
54 volatile u32_t enabled; /* Is the profiler enabled to take samples? */
55 volatile u32_t busy; /* set when the samples are being read by the driver */
56 volatile u32_t rate; /* What is the sampling rate? */
57 volatile u32_t enabled_threads; /* which threads were enabled at the last sample time */
58 volatile u32_t hrt; /* HRT threads */
59 volatile u32_t profiler_thread; /* thread running the profile sampler */
60 volatile u32_t clocks; /* system clock timer at last sample */
61 volatile u32_t clock_freq; /* clock frequency in Hz */
62 volatile u32_t ddr_freq; /* memory frequency */
63 volatile u32_t cpu_id; /* chip_id register */
64 volatile u32_t inst_count[PROFILE_MAX_THREADS]; /* sampled instruction counts at most recent sample */
65 volatile u32_t stats[4]; /* contents of the cache statistics counters */
66 volatile u16_t head; /* sample taker puts samples here */
67 volatile u16_t tail; /* packet filler takes samples here */
68 volatile u16_t count; /* number of valid samples */
69 volatile u16_t max_samples; /* how many samples can be in the samples array */
70 struct profile_sample *samples; /* samples array allocated by the linux driver */
71 volatile u32_t num_counters; /* how many registered performance counters */
72 volatile struct profile_counter counters[PROFILE_NODE_MAX_COUNTERS];
73
74 /* unimplemented interface for future oprofile work */
75 volatile u16_t oprofile_head; /* sample taker puts samples here */
76 volatile u16_t oprofile_tail; /* packet filler takes samples here */
77 volatile u16_t oprofile_count; /* how many oprofile sampels are are in use */
78 volatile u16_t oprofile_max_samples; /* samples array size for oprofile samples */
79 struct oprofile_sample *oprofile_samples; /* oprofile sample buffer */
80 };
81
82 #endif