1331722Seadler/*
2250340Sdavidcs * Copyright (c) 2011-2013 Qlogic Corporation
3227064Sbz * All rights reserved.
4227064Sbz *
5227064Sbz *  Redistribution and use in source and binary forms, with or without
6227064Sbz *  modification, are permitted provided that the following conditions
7227064Sbz *  are met:
8227064Sbz *
9227064Sbz *  1. Redistributions of source code must retain the above copyright
10227064Sbz *     notice, this list of conditions and the following disclaimer.
11227064Sbz *  2. Redistributions in binary form must reproduce the above copyright
12227064Sbz *     notice, this list of conditions and the following disclaimer in the
13227064Sbz *     documentation and/or other materials provided with the distribution.
14227064Sbz *
15227064Sbz *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16227064Sbz *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17227064Sbz *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18227064Sbz *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19227064Sbz *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20227064Sbz *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21227064Sbz *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22227064Sbz *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23227064Sbz *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24227064Sbz *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25227064Sbz *  POSSIBILITY OF SUCH DAMAGE.
26227064Sbz *
27227064Sbz * $FreeBSD$
28227064Sbz */
29227064Sbz
30227064Sbz/*
31227064Sbz * File : qla_dbg.h
32227064Sbz * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
33227064Sbz */
34227064Sbz
35227064Sbz#ifndef _QL_DBG_H_
36227064Sbz#define _QL_DBG_H_
37227064Sbz
38227064Sbzextern uint32_t dbg_level;
39227064Sbz
40227064Sbzextern void qla_dump_buf8(qla_host_t *ha, char *str, void *dbuf,
41227064Sbz		uint32_t len);
42227064Sbzextern void qla_dump_buf16(qla_host_t *ha, char *str, void *dbuf,
43227064Sbz		uint32_t len16);
44227064Sbzextern void qla_dump_buf32(qla_host_t *ha, char *str, void *dbuf,
45227064Sbz		uint32_t len32);
46227064Sbz
47227064Sbz
48227064Sbz#define DBG 1
49227064Sbz
50227064Sbz#if DBG
51227064Sbz
52227064Sbz#define QL_DPRINT1(x)	if (dbg_level & 0x0001) device_printf x
53227064Sbz#define QL_DPRINT2(x)	if (dbg_level & 0x0002) device_printf x
54227064Sbz#define QL_DPRINT4(x)	if (dbg_level & 0x0004) device_printf x
55227064Sbz#define QL_DPRINT8(x)	if (dbg_level & 0x0008) device_printf x
56227064Sbz#define QL_DPRINT10(x)	if (dbg_level & 0x0010) device_printf x
57227064Sbz#define QL_DPRINT20(x)	if (dbg_level & 0x0020) device_printf x
58227064Sbz#define QL_DPRINT40(x)	if (dbg_level & 0x0040) device_printf x
59227064Sbz#define QL_DPRINT80(x)	if (dbg_level & 0x0080) device_printf x
60227064Sbz
61227064Sbz#define QL_DUMP_BUFFER8(h, s, b, n) if (dbg_level & 0x08000000)\
62227064Sbz					qla_dump_buf8(h, s, b, n)
63227064Sbz#define QL_DUMP_BUFFER16(h, s, b, n) if (dbg_level & 0x08000000)\
64227064Sbz					qla_dump_buf16(h, s, b, n)
65227064Sbz#define QL_DUMP_BUFFER32(h, s, b, n) if (dbg_level & 0x08000000)\
66227064Sbz					qla_dump_buf32(h, s, b, n)
67227064Sbz
68227064Sbz#else
69227064Sbz
70227064Sbz#define QL_DPRINT1(x)
71227064Sbz#define QL_DPRINT2(x)
72227064Sbz#define QL_DPRINT4(x)
73227064Sbz#define QL_DPRINT8(x)
74227064Sbz#define QL_DPRINT10(x)
75227064Sbz#define QL_DPRINT20(x)
76227064Sbz#define QL_DPRINT40(x)
77227064Sbz#define QL_DPRINT80(x)
78227064Sbz
79227064Sbz#define QL_DUMP_BUFFER8(h, s, b, n)
80227064Sbz#define QL_DUMP_BUFFER16(h, s, b, n)
81227064Sbz#define QL_DUMP_BUFFER32(h, s, b, n)
82227064Sbz
83227064Sbz#endif
84227064Sbz
85227064Sbz#endif /* #ifndef _QL_DBG_H_ */
86