1221167Sgnn/*-
2221167Sgnn * Copyright(c) 2002-2011 Exar Corp.
3221167Sgnn * All rights reserved.
4221167Sgnn *
5221167Sgnn * Redistribution and use in source and binary forms, with or without
6221167Sgnn * modification are permitted provided the following conditions are met:
7221167Sgnn *
8221167Sgnn *    1. Redistributions of source code must retain the above copyright notice,
9221167Sgnn *       this list of conditions and the following disclaimer.
10221167Sgnn *
11221167Sgnn *    2. Redistributions in binary form must reproduce the above copyright
12221167Sgnn *       notice, this list of conditions and the following disclaimer in the
13221167Sgnn *       documentation and/or other materials provided with the distribution.
14221167Sgnn *
15221167Sgnn *    3. Neither the name of the Exar Corporation nor the names of its
16221167Sgnn *       contributors may be used to endorse or promote products derived from
17221167Sgnn *       this software without specific prior written permission.
18221167Sgnn *
19221167Sgnn * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20221167Sgnn * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21221167Sgnn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22221167Sgnn * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23221167Sgnn * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24221167Sgnn * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25221167Sgnn * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26221167Sgnn * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27221167Sgnn * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28221167Sgnn * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29221167Sgnn * POSSIBILITY OF SUCH DAMAGE.
30221167Sgnn */
31221167Sgnn/*$FreeBSD$*/
32221167Sgnn
33221167Sgnn#ifndef	VXGE_DEBUG_H
34221167Sgnn#define	VXGE_DEBUG_H
35221167Sgnn
36221167Sgnn__EXTERN_BEGIN_DECLS
37221167Sgnn
38221167Sgnn/*
39221167Sgnn * __FUNCTION__ is, together with __PRETTY_FUNCTION__ or something similar,
40221167Sgnn * a gcc extension. we'll have to #if defined around that, and provide some
41221167Sgnn * meaningful replacement for those, so to make some gcc versions happier
42221167Sgnn */
43221167Sgnn#ifndef	__func__
44221167Sgnn#if defined(__FUNCTION__)
45221167Sgnn#define	__func__ __FUNCTION__
46221167Sgnn#else
47221167Sgnn#define	__func__ " "
48221167Sgnn#endif
49221167Sgnn#endif
50221167Sgnn
51221167Sgnn#define	NULL_HLDEV					NULL
52221167Sgnn#define	NULL_VPID					0xFFFFFFFF
53221167Sgnn
54221167Sgnn#define	VXGE_DEBUG_MODULE_MASK_DEF			0xFFFFFFFF
55221167Sgnn#define	VXGE_DEBUG_LEVEL_DEF				VXGE_TRACE
56221167Sgnn
57221167Sgnnextern u32 g_debug_level;
58221167Sgnn
59221167Sgnn#ifndef	VXGE_DEBUG_MODULE_MASK
60221167Sgnn#define	VXGE_DEBUG_MODULE_MASK				0
61221167Sgnn#endif
62221167Sgnn
63221167Sgnn/*
64221167Sgnn * enum vxge_debug_level_e
65221167Sgnn * @VXGE_NONE: debug disabled
66221167Sgnn * @VXGE_ERR: all errors going to be logged out
67221167Sgnn * @VXGE_INFO: all errors plus all kind of info tracing print outs
68221167Sgnn *		going to be logged out. noisy.
69221167Sgnn * @VXGE_TRACE: all errors, all info plus all function entry and exit
70221167Sgnn *		and parameters. Very noisy
71221167Sgnn *
72221167Sgnn * This enumeration going to be used to switch between different
73221167Sgnn * debug levels during runtime if DEBUG macro defined during
74221167Sgnn * compilation. If DEBUG macro not defined than code will be
75221167Sgnn * compiled out.
76221167Sgnn */
77221167Sgnntypedef enum vxge_debug_level_e {
78221167Sgnn	VXGE_NONE   = 0x0,
79221167Sgnn	VXGE_ERR    = 0x1,
80221167Sgnn	VXGE_INFO   = 0x2,
81221167Sgnn	VXGE_TRACE  = 0x4,
82221167Sgnn} vxge_debug_level_e;
83221167Sgnn
84221167Sgnn/*
85221167Sgnn * @VXGE_COMPONENT_HAL_DEVICE: do debug for vxge core device module
86221167Sgnn * @VXGE_COMPONENT_HAL_DEVICE_IRQ: do debug for vxge core device module in ISR
87221167Sgnn * @VXGE_COMPONENT_HAL_VAPTH: do debug for vxge core virtual path module
88221167Sgnn * @VXGE_COMPONENT_HAL_VAPTH_ISR: do debug for vxge core virtual path module in
89221167Sgnn *		ISR
90221167Sgnn * @VXGE_COMPONENT_HAL_CONFIG: do debug for vxge core config module
91221167Sgnn * @VXGE_COMPONENT_HAL_MM: do debug for vxge core memory module
92221167Sgnn * @VXGE_COMPONENT_HAL_POOL: do debug for vxge core memory pool module
93221167Sgnn * @VXGE_COMPONENT_HAL_QUEUE: do debug for vxge core queue module
94221167Sgnn * @VXGE_COMPONENT_HAL_BITMAP: do debug for vxge core BITMAP module
95221167Sgnn * @VXGE_COMPONENT_HAL_CHANNEL: do debug for vxge core channel module
96221167Sgnn * @VXGE_COMPONENT_HAL_FIFO: do debug for vxge core fifo module
97221167Sgnn * @VXGE_COMPONENT_HAL_RING: do debug for vxge core ring module
98221167Sgnn * @VXGE_COMPONENT_HAL_DMQ: do debug for vxge core DMQ module
99221167Sgnn * @VXGE_COMPONENT_HAL_UMQ: do debug for vxge core UMQ module
100221167Sgnn * @VXGE_COMPONENT_HAL_SQ: do debug for vxge core SQ module
101221167Sgnn * @VXGE_COMPONENT_HAL_SRQ: do debug for vxge core SRQ module
102221167Sgnn * @VXGE_COMPONENT_HAL_CQRQ: do debug for vxge core CRQ module
103221167Sgnn * @VXGE_COMPONENT_HAL_NCE: do debug for vxge core NCE module
104221167Sgnn * @VXGE_COMPONENT_HAL_STAG: do debug for vxge core STAG module
105221167Sgnn * @VXGE_COMPONENT_HAL_TCP: do debug for vxge core TCP module
106221167Sgnn * @VXGE_COMPONENT_HAL_LRO: do debug for vxge core LRO module
107221167Sgnn * @VXGE_COMPONENT_HAL_SPDM: do debug for vxge core SPDM module
108221167Sgnn * @VXGE_COMPONENT_HAL_SESSION: do debug for vxge core SESSION module
109221167Sgnn * @VXGE_COMPONENT_HAL_STATS: do debug for vxge core statistics module
110221167Sgnn * @VXGE_COMPONENT_HAL_MRPCIM: do debug for vxge KMA core mrpcim module
111221167Sgnn * @VXGE_COMPONENT_HAL_SRPCIM: do debug for vxge KMA core srpcim module
112221167Sgnn * @VXGE_COMPONENT_OSDEP: do debug for vxge KMA os dependent parts
113221167Sgnn * @VXGE_COMPONENT_LL: do debug for vxge link layer module
114221167Sgnn * @VXGE_COMPONENT_ULD: do debug for vxge upper layer driver
115221167Sgnn * @VXGE_COMPONENT_ALL: activate debug for all modules with no exceptions
116221167Sgnn *
117221167Sgnn * This enumeration going to be used to distinguish modules
118221167Sgnn * or libraries during compilation and runtime.  Makefile must declare
119221167Sgnn * VXGE_DEBUG_MODULE_MASK macro and set it to proper value.
120221167Sgnn */
121221167Sgnn#define	VXGE_COMPONENT_HAL_DEVICE			0x00000001
122221167Sgnn#define	VXGE_COMPONENT_HAL_DEVICE_IRQ			0x00000002
123221167Sgnn#define	VXGE_COMPONENT_HAL_VPATH			0x00000004
124221167Sgnn#define	VXGE_COMPONENT_HAL_VPATH_IRQ			0x00000008
125221167Sgnn#define	VXGE_COMPONENT_HAL_CONFIG			0x00000010
126221167Sgnn#define	VXGE_COMPONENT_HAL_MM				0x00000020
127221167Sgnn#define	VXGE_COMPONENT_HAL_POOL				0x00000040
128221167Sgnn#define	VXGE_COMPONENT_HAL_QUEUE			0x00000080
129221167Sgnn#define	VXGE_COMPONENT_HAL_BITMAP			0x00000100
130221167Sgnn#define	VXGE_COMPONENT_HAL_CHANNEL			0x00000200
131221167Sgnn#define	VXGE_COMPONENT_HAL_FIFO				0x00000400
132221167Sgnn#define	VXGE_COMPONENT_HAL_RING				0x00000800
133221167Sgnn#define	VXGE_COMPONENT_HAL_DMQ				0x00001000
134221167Sgnn#define	VXGE_COMPONENT_HAL_UMQ				0x00002000
135221167Sgnn#define	VXGE_COMPONENT_HAL_SQ				0x00004000
136221167Sgnn#define	VXGE_COMPONENT_HAL_SRQ				0x00008000
137221167Sgnn#define	VXGE_COMPONENT_HAL_CQRQ				0x00010000
138221167Sgnn#define	VXGE_COMPONENT_HAL_NCE				0x00020000
139221167Sgnn#define	VXGE_COMPONENT_HAL_STAG				0x00040000
140221167Sgnn#define	VXGE_COMPONENT_HAL_TCP				0x00080000
141221167Sgnn#define	VXGE_COMPONENT_HAL_LRO				0x00100000
142221167Sgnn#define	VXGE_COMPONENT_HAL_SPDM				0x00200000
143221167Sgnn#define	VXGE_COMPONENT_HAL_SESSION			0x00400000
144221167Sgnn#define	VXGE_COMPONENT_HAL_STATS			0x00800000
145221167Sgnn#define	VXGE_COMPONENT_HAL_MRPCIM			0x01000000
146221167Sgnn#define	VXGE_COMPONENT_HAL_MRPCIM_IRQ			0x02000000
147221167Sgnn#define	VXGE_COMPONENT_HAL_SRPCIM			0x04000000
148221167Sgnn#define	VXGE_COMPONENT_HAL_SRPCIM_IRQ			0x08000000
149221167Sgnn#define	VXGE_COMPONENT_HAL_DRIVER			0x10000000
150221167Sgnn
151221167Sgnn/* space for CORE_XXX */
152221167Sgnn#define	VXGE_COMPONENT_OSDEP				0x20000000
153221167Sgnn#define	VXGE_COMPONENT_LL				0x40000000
154221167Sgnn#define	VXGE_COMPONENT_ULD				0x80000000
155221167Sgnn#define	VXGE_COMPONENT_ALL				0xffffffff
156221167Sgnn
157221167Sgnn__EXTERN_END_DECLS
158221167Sgnn
159221167Sgnn#endif	/* VXGE_DEBUG_H */
160