1/*-
2 * Copyright(c) 2002-2011 Exar Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification are permitted provided the following conditions are met:
7 *
8 *    1. Redistributions of source code must retain the above copyright notice,
9 *       this list of conditions and the following disclaimer.
10 *
11 *    2. Redistributions in binary form must reproduce the above copyright
12 *       notice, this list of conditions and the following disclaimer in the
13 *       documentation and/or other materials provided with the distribution.
14 *
15 *    3. Neither the name of the Exar Corporation nor the names of its
16 *       contributors may be used to endorse or promote products derived from
17 *       this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31/*$FreeBSD$*/
32
33#ifndef	VXGE_DEBUG_H
34#define	VXGE_DEBUG_H
35
36__EXTERN_BEGIN_DECLS
37
38/*
39 * __FUNCTION__ is, together with __PRETTY_FUNCTION__ or something similar,
40 * a gcc extension. we'll have to #if defined around that, and provide some
41 * meaningful replacement for those, so to make some gcc versions happier
42 */
43#ifndef	__func__
44#if defined(__FUNCTION__)
45#define	__func__ __FUNCTION__
46#else
47#define	__func__ " "
48#endif
49#endif
50
51#define	NULL_HLDEV					NULL
52#define	NULL_VPID					0xFFFFFFFF
53
54#define	VXGE_DEBUG_MODULE_MASK_DEF			0xFFFFFFFF
55#define	VXGE_DEBUG_LEVEL_DEF				VXGE_TRACE
56
57extern u32 g_debug_level;
58
59#ifndef	VXGE_DEBUG_MODULE_MASK
60#define	VXGE_DEBUG_MODULE_MASK				0
61#endif
62
63/*
64 * enum vxge_debug_level_e
65 * @VXGE_NONE: debug disabled
66 * @VXGE_ERR: all errors going to be logged out
67 * @VXGE_INFO: all errors plus all kind of info tracing print outs
68 *		going to be logged out. noisy.
69 * @VXGE_TRACE: all errors, all info plus all function entry and exit
70 *		and parameters. Very noisy
71 *
72 * This enumeration going to be used to switch between different
73 * debug levels during runtime if DEBUG macro defined during
74 * compilation. If DEBUG macro not defined than code will be
75 * compiled out.
76 */
77typedef enum vxge_debug_level_e {
78	VXGE_NONE   = 0x0,
79	VXGE_ERR    = 0x1,
80	VXGE_INFO   = 0x2,
81	VXGE_TRACE  = 0x4,
82} vxge_debug_level_e;
83
84/*
85 * @VXGE_COMPONENT_HAL_DEVICE: do debug for vxge core device module
86 * @VXGE_COMPONENT_HAL_DEVICE_IRQ: do debug for vxge core device module in ISR
87 * @VXGE_COMPONENT_HAL_VAPTH: do debug for vxge core virtual path module
88 * @VXGE_COMPONENT_HAL_VAPTH_ISR: do debug for vxge core virtual path module in
89 *		ISR
90 * @VXGE_COMPONENT_HAL_CONFIG: do debug for vxge core config module
91 * @VXGE_COMPONENT_HAL_MM: do debug for vxge core memory module
92 * @VXGE_COMPONENT_HAL_POOL: do debug for vxge core memory pool module
93 * @VXGE_COMPONENT_HAL_QUEUE: do debug for vxge core queue module
94 * @VXGE_COMPONENT_HAL_BITMAP: do debug for vxge core BITMAP module
95 * @VXGE_COMPONENT_HAL_CHANNEL: do debug for vxge core channel module
96 * @VXGE_COMPONENT_HAL_FIFO: do debug for vxge core fifo module
97 * @VXGE_COMPONENT_HAL_RING: do debug for vxge core ring module
98 * @VXGE_COMPONENT_HAL_DMQ: do debug for vxge core DMQ module
99 * @VXGE_COMPONENT_HAL_UMQ: do debug for vxge core UMQ module
100 * @VXGE_COMPONENT_HAL_SQ: do debug for vxge core SQ module
101 * @VXGE_COMPONENT_HAL_SRQ: do debug for vxge core SRQ module
102 * @VXGE_COMPONENT_HAL_CQRQ: do debug for vxge core CRQ module
103 * @VXGE_COMPONENT_HAL_NCE: do debug for vxge core NCE module
104 * @VXGE_COMPONENT_HAL_STAG: do debug for vxge core STAG module
105 * @VXGE_COMPONENT_HAL_TCP: do debug for vxge core TCP module
106 * @VXGE_COMPONENT_HAL_LRO: do debug for vxge core LRO module
107 * @VXGE_COMPONENT_HAL_SPDM: do debug for vxge core SPDM module
108 * @VXGE_COMPONENT_HAL_SESSION: do debug for vxge core SESSION module
109 * @VXGE_COMPONENT_HAL_STATS: do debug for vxge core statistics module
110 * @VXGE_COMPONENT_HAL_MRPCIM: do debug for vxge KMA core mrpcim module
111 * @VXGE_COMPONENT_HAL_SRPCIM: do debug for vxge KMA core srpcim module
112 * @VXGE_COMPONENT_OSDEP: do debug for vxge KMA os dependent parts
113 * @VXGE_COMPONENT_LL: do debug for vxge link layer module
114 * @VXGE_COMPONENT_ULD: do debug for vxge upper layer driver
115 * @VXGE_COMPONENT_ALL: activate debug for all modules with no exceptions
116 *
117 * This enumeration going to be used to distinguish modules
118 * or libraries during compilation and runtime.  Makefile must declare
119 * VXGE_DEBUG_MODULE_MASK macro and set it to proper value.
120 */
121#define	VXGE_COMPONENT_HAL_DEVICE			0x00000001
122#define	VXGE_COMPONENT_HAL_DEVICE_IRQ			0x00000002
123#define	VXGE_COMPONENT_HAL_VPATH			0x00000004
124#define	VXGE_COMPONENT_HAL_VPATH_IRQ			0x00000008
125#define	VXGE_COMPONENT_HAL_CONFIG			0x00000010
126#define	VXGE_COMPONENT_HAL_MM				0x00000020
127#define	VXGE_COMPONENT_HAL_POOL				0x00000040
128#define	VXGE_COMPONENT_HAL_QUEUE			0x00000080
129#define	VXGE_COMPONENT_HAL_BITMAP			0x00000100
130#define	VXGE_COMPONENT_HAL_CHANNEL			0x00000200
131#define	VXGE_COMPONENT_HAL_FIFO				0x00000400
132#define	VXGE_COMPONENT_HAL_RING				0x00000800
133#define	VXGE_COMPONENT_HAL_DMQ				0x00001000
134#define	VXGE_COMPONENT_HAL_UMQ				0x00002000
135#define	VXGE_COMPONENT_HAL_SQ				0x00004000
136#define	VXGE_COMPONENT_HAL_SRQ				0x00008000
137#define	VXGE_COMPONENT_HAL_CQRQ				0x00010000
138#define	VXGE_COMPONENT_HAL_NCE				0x00020000
139#define	VXGE_COMPONENT_HAL_STAG				0x00040000
140#define	VXGE_COMPONENT_HAL_TCP				0x00080000
141#define	VXGE_COMPONENT_HAL_LRO				0x00100000
142#define	VXGE_COMPONENT_HAL_SPDM				0x00200000
143#define	VXGE_COMPONENT_HAL_SESSION			0x00400000
144#define	VXGE_COMPONENT_HAL_STATS			0x00800000
145#define	VXGE_COMPONENT_HAL_MRPCIM			0x01000000
146#define	VXGE_COMPONENT_HAL_MRPCIM_IRQ			0x02000000
147#define	VXGE_COMPONENT_HAL_SRPCIM			0x04000000
148#define	VXGE_COMPONENT_HAL_SRPCIM_IRQ			0x08000000
149#define	VXGE_COMPONENT_HAL_DRIVER			0x10000000
150
151/* space for CORE_XXX */
152#define	VXGE_COMPONENT_OSDEP				0x20000000
153#define	VXGE_COMPONENT_LL				0x40000000
154#define	VXGE_COMPONENT_ULD				0x80000000
155#define	VXGE_COMPONENT_ALL				0xffffffff
156
157__EXTERN_END_DECLS
158
159#endif	/* VXGE_DEBUG_H */
160