xref: /freebsd/sys/dev/ixl/ixl_debug.h (revision f4cc2d1710068319774a27d5c5e7ff85856c9278)
11031d839SEric Joyner /******************************************************************************
21031d839SEric Joyner 
3*f4cc2d17SEric Joyner   Copyright (c) 2013-2018, Intel Corporation
41031d839SEric Joyner   All rights reserved.
51031d839SEric Joyner 
61031d839SEric Joyner   Redistribution and use in source and binary forms, with or without
71031d839SEric Joyner   modification, are permitted provided that the following conditions are met:
81031d839SEric Joyner 
91031d839SEric Joyner    1. Redistributions of source code must retain the above copyright notice,
101031d839SEric Joyner       this list of conditions and the following disclaimer.
111031d839SEric Joyner 
121031d839SEric Joyner    2. Redistributions in binary form must reproduce the above copyright
131031d839SEric Joyner       notice, this list of conditions and the following disclaimer in the
141031d839SEric Joyner       documentation and/or other materials provided with the distribution.
151031d839SEric Joyner 
161031d839SEric Joyner    3. Neither the name of the Intel Corporation nor the names of its
171031d839SEric Joyner       contributors may be used to endorse or promote products derived from
181031d839SEric Joyner       this software without specific prior written permission.
191031d839SEric Joyner 
201031d839SEric Joyner   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
211031d839SEric Joyner   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221031d839SEric Joyner   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231031d839SEric Joyner   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
241031d839SEric Joyner   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
251031d839SEric Joyner   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
261031d839SEric Joyner   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
271031d839SEric Joyner   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
281031d839SEric Joyner   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
291031d839SEric Joyner   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
301031d839SEric Joyner   POSSIBILITY OF SUCH DAMAGE.
311031d839SEric Joyner 
321031d839SEric Joyner ******************************************************************************/
331031d839SEric Joyner /*$FreeBSD$*/
341031d839SEric Joyner 
351031d839SEric Joyner #ifndef _IXL_DEBUG_H_
361031d839SEric Joyner #define _IXL_DEBUG_H_
371031d839SEric Joyner 
381031d839SEric Joyner #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x"
391031d839SEric Joyner #define MAC_FORMAT_ARGS(mac_addr) \
401031d839SEric Joyner 	(mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \
411031d839SEric Joyner 	(mac_addr)[4], (mac_addr)[5]
421031d839SEric Joyner #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off")
431031d839SEric Joyner 
441031d839SEric Joyner #ifdef IXL_DEBUG
451031d839SEric Joyner 
461031d839SEric Joyner #define _DBG_PRINTF(S, ...)		printf("%s: " S "\n", __func__, ##__VA_ARGS__)
471031d839SEric Joyner #define _DEV_DBG_PRINTF(dev, S, ...)	device_printf(dev, "%s: " S "\n", __func__, ##__VA_ARGS__)
481031d839SEric Joyner #define _IF_DBG_PRINTF(ifp, S, ...)	if_printf(ifp, "%s: " S "\n", __func__, ##__VA_ARGS__)
491031d839SEric Joyner 
501031d839SEric Joyner /* Defines for printing generic debug information */
511031d839SEric Joyner #define DPRINTF(...)			_DBG_PRINTF(__VA_ARGS__)
521031d839SEric Joyner #define DDPRINTF(...)			_DEV_DBG_PRINTF(__VA_ARGS__)
531031d839SEric Joyner #define IDPRINTF(...)			_IF_DBG_PRINTF(__VA_ARGS__)
541031d839SEric Joyner 
551031d839SEric Joyner /* Defines for printing specific debug information */
561031d839SEric Joyner #define DEBUG_INIT  1
571031d839SEric Joyner #define DEBUG_IOCTL 1
581031d839SEric Joyner #define DEBUG_HW    1
591031d839SEric Joyner 
601031d839SEric Joyner #define INIT_DEBUGOUT(...)		if (DEBUG_INIT) _DBG_PRINTF(__VA_ARGS__)
611031d839SEric Joyner #define INIT_DBG_DEV(...)		if (DEBUG_INIT) _DEV_DBG_PRINTF(__VA_ARGS__)
621031d839SEric Joyner #define INIT_DBG_IF(...)		if (DEBUG_INIT) _IF_DBG_PRINTF(__VA_ARGS__)
631031d839SEric Joyner 
641031d839SEric Joyner #define IOCTL_DEBUGOUT(...)		if (DEBUG_IOCTL) _DBG_PRINTF(__VA_ARGS__)
651031d839SEric Joyner #define IOCTL_DBG_IF2(ifp, S, ...)	if (DEBUG_IOCTL) \
661031d839SEric Joyner 					    if_printf(ifp, S "\n", ##__VA_ARGS__)
671031d839SEric Joyner #define IOCTL_DBG_IF(...)		if (DEBUG_IOCTL) _IF_DBG_PRINTF(__VA_ARGS__)
681031d839SEric Joyner 
691031d839SEric Joyner #define HW_DEBUGOUT(...)		if (DEBUG_HW) _DBG_PRINTF(__VA_ARGS__)
701031d839SEric Joyner 
711031d839SEric Joyner #else /* no IXL_DEBUG */
721031d839SEric Joyner #define DEBUG_INIT  0
731031d839SEric Joyner #define DEBUG_IOCTL 0
741031d839SEric Joyner #define DEBUG_HW    0
751031d839SEric Joyner 
761031d839SEric Joyner #define DPRINTF(...)
771031d839SEric Joyner #define DDPRINTF(...)
781031d839SEric Joyner #define IDPRINTF(...)
791031d839SEric Joyner 
801031d839SEric Joyner #define INIT_DEBUGOUT(...)
811031d839SEric Joyner #define INIT_DBG_DEV(...)
821031d839SEric Joyner #define INIT_DBG_IF(...)
831031d839SEric Joyner #define IOCTL_DEBUGOUT(...)
841031d839SEric Joyner #define IOCTL_DBG_IF2(...)
851031d839SEric Joyner #define IOCTL_DBG_IF(...)
861031d839SEric Joyner #define HW_DEBUGOUT(...)
871031d839SEric Joyner #endif /* IXL_DEBUG */
881031d839SEric Joyner 
891031d839SEric Joyner enum ixl_dbg_mask {
901031d839SEric Joyner 	IXL_DBG_INFO			= 0x00000001,
911031d839SEric Joyner 	IXL_DBG_EN_DIS			= 0x00000002,
921031d839SEric Joyner 	IXL_DBG_AQ			= 0x00000004,
931031d839SEric Joyner 	IXL_DBG_NVMUPD			= 0x00000008,
941031d839SEric Joyner 
951031d839SEric Joyner 	IXL_DBG_IOCTL_KNOWN		= 0x00000010,
961031d839SEric Joyner 	IXL_DBG_IOCTL_UNKNOWN		= 0x00000020,
971031d839SEric Joyner 	IXL_DBG_IOCTL_ALL		= 0x00000030,
981031d839SEric Joyner 
991031d839SEric Joyner 	I40E_DEBUG_RSS			= 0x00000100,
1001031d839SEric Joyner 
1011031d839SEric Joyner 	IXL_DBG_IOV			= 0x00001000,
1021031d839SEric Joyner 	IXL_DBG_IOV_VC			= 0x00002000,
1031031d839SEric Joyner 
1041031d839SEric Joyner 	IXL_DBG_SWITCH_INFO		= 0x00010000,
1051031d839SEric Joyner 	IXL_DBG_I2C			= 0x00020000,
1061031d839SEric Joyner 
1071031d839SEric Joyner 	IXL_DBG_ALL			= 0xFFFFFFFF
1081031d839SEric Joyner };
1091031d839SEric Joyner 
1101031d839SEric Joyner #endif /* _IXL_DEBUG_H_ */
111