FreeBSD/Linux Kernel Cross Reference
sys/mips/rmi/debug.h
1 /*-
2 * Copyright (c) 2003-2009 RMI Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of RMI Corporation, nor the names of its contributors,
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * RMI_BSD */
30 #ifndef _RMI_DEBUG_H_
31 #define _RMI_DEBUG_H_
32
33 #include <machine/atomic.h>
34
35 enum {
36 //cacheline 0
37 MSGRNG_INT,
38 MSGRNG_PIC_INT,
39 MSGRNG_MSG,
40 MSGRNG_EXIT_STATUS,
41 MSGRNG_MSG_CYCLES,
42 //cacheline 1
43 NETIF_TX = 8,
44 NETIF_RX,
45 NETIF_TX_COMPLETE,
46 NETIF_TX_COMPLETE_TX,
47 NETIF_RX_CYCLES,
48 NETIF_TX_COMPLETE_CYCLES,
49 NETIF_TX_CYCLES,
50 NETIF_TIMER_START_Q,
51 //NETIF_REG_FRIN,
52 //NETIF_INT_REG,
53 //cacheline 2
54 REPLENISH_ENTER = 16,
55 REPLENISH_ENTER_COUNT,
56 REPLENISH_CPU,
57 REPLENISH_FRIN,
58 REPLENISH_CYCLES,
59 NETIF_STACK_TX,
60 NETIF_START_Q,
61 NETIF_STOP_Q,
62 //cacheline 3
63 USER_MAC_START = 24,
64 USER_MAC_INT = 24,
65 USER_MAC_TX_COMPLETE,
66 USER_MAC_RX,
67 USER_MAC_POLL,
68 USER_MAC_TX,
69 USER_MAC_TX_FAIL,
70 USER_MAC_TX_COUNT,
71 USER_MAC_FRIN,
72 //cacheline 4
73 USER_MAC_TX_FAIL_GMAC_CREDITS = 32,
74 USER_MAC_DO_PAGE_FAULT,
75 USER_MAC_UPDATE_TLB,
76 USER_MAC_UPDATE_BIGTLB,
77 USER_MAC_UPDATE_TLB_PFN0,
78 USER_MAC_UPDATE_TLB_PFN1,
79
80 XLR_MAX_COUNTERS = 40
81 };
82 extern int xlr_counters[MAXCPU][XLR_MAX_COUNTERS];
83 extern __uint32_t msgrng_msg_cycles;
84
85 #ifdef ENABLE_DEBUG
86 #define xlr_inc_counter(x) atomic_add_int(&xlr_counters[PCPU_GET(cpuid)][(x)], 1)
87 #define xlr_dec_counter(x) atomic_subtract_int(&xlr_counters[PCPU_GET(cpuid)][(x)], 1)
88 #define xlr_set_counter(x, value) atomic_set_int(&xlr_counters[PCPU_GET(cpuid)][(x)], (value))
89 #define xlr_get_counter(x) (&xlr_counters[0][(x)])
90
91 #else /* default mode */
92
93 #define xlr_inc_counter(x)
94 #define xlr_dec_counter(x)
95 #define xlr_set_counter(x, value)
96 #define xlr_get_counter(x)
97
98 #endif
99
100 #define dbg_msg(fmt, args...) printf(fmt, ##args)
101 #define dbg_panic(fmt, args...) panic(fmt, ##args)
102
103 #endif
Cache object: 39835089196b09e8d57c2943ff18be05
|