OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-mips/] [sibyte/] [trace_prof.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/*
2
 * Copyright (C) 2001 Broadcom Corporation
3
 *
4
 * This program is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU General Public License
6
 * as published by the Free Software Foundation; either version 2
7
 * of the License, or (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 */
18
 
19
#ifndef __ASM_SIBYTE_TRACE_PROF_H
20
#define __ASM_SIBYTE_TRACE_PROF_H
21
 
22
#if SBPROF_TB_DEBUG
23
#define DBG(a) a
24
#else
25
#define DBG(a)
26
#endif
27
 
28
#define SBPROF_TB_MAJOR 240
29
#define DEVNAME "bcm1250_tbprof"
30
 
31
typedef u_int64_t tb_sample_t[6*256];
32
 
33
struct sbprof_tb {
34
        int          open;
35
        tb_sample_t *sbprof_tbbuf;
36
        int          next_tb_sample;
37
 
38
        volatile int tb_enable;
39
        volatile int tb_armed;
40
 
41
        wait_queue_head_t tb_sync;
42
        wait_queue_head_t tb_read;
43
};
44
 
45
#define MAX_SAMPLE_BYTES (24*1024*1024)
46
#define MAX_TBSAMPLE_BYTES (12*1024*1024)
47
 
48
#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
49
#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
50
#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
51
 
52
/* IOCTLs */
53
#define SBPROF_ZBSTART          _IOW('s', 0, int)
54
#define SBPROF_ZBSTOP           _IOW('s', 1, int)
55
#define SBPROF_ZBWAITFULL       _IOW('s', 2, int)
56
 
57
/***************************************************************************
58
 * Routines for gathering ZBbus profiles using trace buffer
59
 ***************************************************************************/
60
 
61
/* Requires: Already called zclk_timer_init with a value that won't
62
             saturate 40 bits.  No subsequent use of SCD performance counters
63
             or trace buffer.
64
   Effect:   Starts gathering random ZBbus profiles using trace buffer. */
65
static int sbprof_zbprof_start(struct file *filp);
66
 
67
/* Effect: Stops collection of ZBbus profiles */
68
static int sbprof_zbprof_stop(void);
69
 
70
 
71
/***************************************************************************
72
 * Routines for using 40-bit SCD cycle counter
73
 *
74
 * Client responsible for either handling interrupts or making sure
75
 * the cycles counter never saturates, e.g., by doing
76
 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
77
 ***************************************************************************/
78
 
79
/* Configures SCD counter 0 to count ZCLKs starting from val;
80
   Configures SCD counters1,2,3 to count nothing.
81
   Must not be called while gathering ZBbus profiles.
82
 
83
unsigned long long val; */
84
#define zclk_timer_init(val) \
85
  __asm__ __volatile__ (".set push;" \
86
                        ".set mips64;" \
87
                        "la   $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
88
                        "sd   %0, 0x10($8);"   /* write val to counter0 */ \
89
                        "sd   %1, 0($8);"      /* config counter0 for zclks*/ \
90
                        ".set pop" \
91
                        : /* no outputs */ \
92
                                                     /* enable, counter0 */ \
93
                        : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
94
                        : /* modifies */ "$8" )
95
 
96
 
97
/* Reads SCD counter 0 and puts result in value
98
   unsigned long long val; */
99
#define zclk_get(val) \
100
  __asm__ __volatile__ (".set push;" \
101
                        ".set mips64;" \
102
                        "la   $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
103
                        "ld   %0, 0x10($8);"   /* write val to counter0 */ \
104
                        ".set pop" \
105
                        : /* outputs */ "=r"(val) \
106
                        : /* inputs */ \
107
                        : /* modifies */ "$8" )
108
 
109
#endif /* __ASM_SIBYTE_TRACE_PROF_H */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.