11031d839SEric Joyner /****************************************************************************** 21031d839SEric Joyner 3f4cc2d17SEric 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 341031d839SEric Joyner #ifndef _IXL_DEBUG_H_ 351031d839SEric Joyner #define _IXL_DEBUG_H_ 361031d839SEric Joyner 371031d839SEric Joyner #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x" 381031d839SEric Joyner #define MAC_FORMAT_ARGS(mac_addr) \ 391031d839SEric Joyner (mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \ 401031d839SEric Joyner (mac_addr)[4], (mac_addr)[5] 411031d839SEric Joyner #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off") 421031d839SEric Joyner 431031d839SEric Joyner #ifdef IXL_DEBUG 441031d839SEric Joyner 451031d839SEric Joyner #define _DBG_PRINTF(S, ...) printf("%s: " S "\n", __func__, ##__VA_ARGS__) 461031d839SEric Joyner #define _DEV_DBG_PRINTF(dev, S, ...) device_printf(dev, "%s: " S "\n", __func__, ##__VA_ARGS__) 471031d839SEric Joyner #define _IF_DBG_PRINTF(ifp, S, ...) if_printf(ifp, "%s: " S "\n", __func__, ##__VA_ARGS__) 481031d839SEric Joyner 491031d839SEric Joyner /* Defines for printing generic debug information */ 501031d839SEric Joyner #define DPRINTF(...) _DBG_PRINTF(__VA_ARGS__) 511031d839SEric Joyner #define DDPRINTF(...) _DEV_DBG_PRINTF(__VA_ARGS__) 521031d839SEric Joyner #define IDPRINTF(...) _IF_DBG_PRINTF(__VA_ARGS__) 531031d839SEric Joyner 541031d839SEric Joyner /* Defines for printing specific debug information */ 551031d839SEric Joyner #define DEBUG_INIT 1 561031d839SEric Joyner #define DEBUG_IOCTL 1 571031d839SEric Joyner #define DEBUG_HW 1 581031d839SEric Joyner 591031d839SEric Joyner #define INIT_DEBUGOUT(...) if (DEBUG_INIT) _DBG_PRINTF(__VA_ARGS__) 601031d839SEric Joyner #define INIT_DBG_DEV(...) if (DEBUG_INIT) _DEV_DBG_PRINTF(__VA_ARGS__) 611031d839SEric Joyner #define INIT_DBG_IF(...) if (DEBUG_INIT) _IF_DBG_PRINTF(__VA_ARGS__) 621031d839SEric Joyner 631031d839SEric Joyner #define IOCTL_DEBUGOUT(...) if (DEBUG_IOCTL) _DBG_PRINTF(__VA_ARGS__) 641031d839SEric Joyner #define IOCTL_DBG_IF2(ifp, S, ...) if (DEBUG_IOCTL) \ 651031d839SEric Joyner if_printf(ifp, S "\n", ##__VA_ARGS__) 661031d839SEric Joyner #define IOCTL_DBG_IF(...) if (DEBUG_IOCTL) _IF_DBG_PRINTF(__VA_ARGS__) 671031d839SEric Joyner 681031d839SEric Joyner #define HW_DEBUGOUT(...) if (DEBUG_HW) _DBG_PRINTF(__VA_ARGS__) 691031d839SEric Joyner 701031d839SEric Joyner #else /* no IXL_DEBUG */ 711031d839SEric Joyner #define DEBUG_INIT 0 721031d839SEric Joyner #define DEBUG_IOCTL 0 731031d839SEric Joyner #define DEBUG_HW 0 741031d839SEric Joyner 751031d839SEric Joyner #define DPRINTF(...) 761031d839SEric Joyner #define DDPRINTF(...) 771031d839SEric Joyner #define IDPRINTF(...) 781031d839SEric Joyner 791031d839SEric Joyner #define INIT_DEBUGOUT(...) 801031d839SEric Joyner #define INIT_DBG_DEV(...) 811031d839SEric Joyner #define INIT_DBG_IF(...) 821031d839SEric Joyner #define IOCTL_DEBUGOUT(...) 831031d839SEric Joyner #define IOCTL_DBG_IF2(...) 841031d839SEric Joyner #define IOCTL_DBG_IF(...) 851031d839SEric Joyner #define HW_DEBUGOUT(...) 861031d839SEric Joyner #endif /* IXL_DEBUG */ 871031d839SEric Joyner 881031d839SEric Joyner enum ixl_dbg_mask { 891031d839SEric Joyner IXL_DBG_INFO = 0x00000001, 901031d839SEric Joyner IXL_DBG_EN_DIS = 0x00000002, 911031d839SEric Joyner IXL_DBG_AQ = 0x00000004, 921031d839SEric Joyner IXL_DBG_NVMUPD = 0x00000008, 9377c1fcecSEric Joyner IXL_DBG_FILTER = 0x00000010, 941031d839SEric Joyner 9577c1fcecSEric Joyner IXL_DEBUG_RSS = 0x00000100, 961031d839SEric Joyner 971031d839SEric Joyner IXL_DBG_IOV = 0x00001000, 981031d839SEric Joyner IXL_DBG_IOV_VC = 0x00002000, 991031d839SEric Joyner 1001031d839SEric Joyner IXL_DBG_SWITCH_INFO = 0x00010000, 1011031d839SEric Joyner IXL_DBG_I2C = 0x00020000, 1021031d839SEric Joyner 103*ba2f531fSKrzysztof Galazka IXL_DBG_LINK = 0x00100000, 104*ba2f531fSKrzysztof Galazka 1051031d839SEric Joyner IXL_DBG_ALL = 0xFFFFFFFF 1061031d839SEric Joyner }; 1071031d839SEric Joyner 1083f74c027SEric Joyner enum iavf_dbg_mask { 1093f74c027SEric Joyner IAVF_DBG_INFO = 0x00000001, 1103f74c027SEric Joyner IAVF_DBG_EN_DIS = 0x00000002, 1113f74c027SEric Joyner IAVF_DBG_AQ = 0x00000004, 1123f74c027SEric Joyner IAVF_DBG_INIT = 0x00000008, 1133f74c027SEric Joyner IAVF_DBG_FILTER = 0x00000010, 11477c1fcecSEric Joyner 1153f74c027SEric Joyner IAVF_DEBUG_RSS = 0x00000100, 11677c1fcecSEric Joyner 1173f74c027SEric Joyner IAVF_DBG_VC = 0x00001000, 11877c1fcecSEric Joyner 1193f74c027SEric Joyner IAVF_DBG_SWITCH_INFO = 0x00010000, 12077c1fcecSEric Joyner 1213f74c027SEric Joyner IAVF_DBG_ALL = 0xFFFFFFFF 12277c1fcecSEric Joyner }; 12377c1fcecSEric Joyner 1241031d839SEric Joyner #endif /* _IXL_DEBUG_H_ */ 125