16621Sbt150084 /* 26621Sbt150084 * CDDL HEADER START 36621Sbt150084 * 4*12003SPaul.Guo@Sun.COM * Copyright(c) 2007-2010 Intel Corporation. All rights reserved. 56621Sbt150084 * The contents of this file are subject to the terms of the 66621Sbt150084 * Common Development and Distribution License (the "License"). 76621Sbt150084 * You may not use this file except in compliance with the License. 86621Sbt150084 * 96621Sbt150084 * You can obtain a copy of the license at: 106621Sbt150084 * http://www.opensolaris.org/os/licensing. 116621Sbt150084 * See the License for the specific language governing permissions 126621Sbt150084 * and limitations under the License. 136621Sbt150084 * 146621Sbt150084 * When using or redistributing this file, you may do so under the 156621Sbt150084 * License only. No other modification of this header is permitted. 166621Sbt150084 * 176621Sbt150084 * If applicable, add the following below this CDDL HEADER, with the 186621Sbt150084 * fields enclosed by brackets "[]" replaced with your own identifying 196621Sbt150084 * information: Portions Copyright [yyyy] [name of copyright owner] 206621Sbt150084 * 216621Sbt150084 * CDDL HEADER END 226621Sbt150084 */ 236621Sbt150084 246621Sbt150084 /* 25*12003SPaul.Guo@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 269353SSamuel.Tu@Sun.COM * Use is subject to license terms. 276621Sbt150084 */ 286621Sbt150084 296621Sbt150084 #ifndef _IXGBE_DEBUG_H 306621Sbt150084 #define _IXGBE_DEBUG_H 316621Sbt150084 326621Sbt150084 #ifdef __cplusplus 336621Sbt150084 extern "C" { 346621Sbt150084 #endif 356621Sbt150084 366621Sbt150084 376621Sbt150084 #ifdef DEBUG 386621Sbt150084 #define IXGBE_DEBUG 396621Sbt150084 #endif 406621Sbt150084 416621Sbt150084 #ifdef IXGBE_DEBUG 426621Sbt150084 436621Sbt150084 #define IXGBE_DEBUGLOG_0(adapter, fmt) \ 446621Sbt150084 ixgbe_log((adapter), (fmt)) 456621Sbt150084 #define IXGBE_DEBUGLOG_1(adapter, fmt, d1) \ 466621Sbt150084 ixgbe_log((adapter), (fmt), (d1)) 476621Sbt150084 #define IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2) \ 486621Sbt150084 ixgbe_log((adapter), (fmt), (d1), (d2)) 496621Sbt150084 #define IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3) \ 506621Sbt150084 ixgbe_log((adapter), (fmt), (d1), (d2), (d3)) 516621Sbt150084 #define IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6) \ 526621Sbt150084 ixgbe_log((adapter), (fmt), (d1), (d2), (d3), (d4), (d5), (d6)) 536621Sbt150084 546621Sbt150084 #define IXGBE_DEBUG_STAT_COND(val, cond) if (cond) (val)++; 556621Sbt150084 #define IXGBE_DEBUG_STAT(val) (val)++; 566621Sbt150084 576621Sbt150084 #else 586621Sbt150084 596621Sbt150084 #define IXGBE_DEBUGLOG_0(adapter, fmt) 606621Sbt150084 #define IXGBE_DEBUGLOG_1(adapter, fmt, d1) 616621Sbt150084 #define IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2) 626621Sbt150084 #define IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3) 636621Sbt150084 #define IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6) 646621Sbt150084 656621Sbt150084 #define IXGBE_DEBUG_STAT_COND(val, cond) 666621Sbt150084 #define IXGBE_DEBUG_STAT(val) 676621Sbt150084 686621Sbt150084 #endif /* IXGBE_DEBUG */ 696621Sbt150084 706621Sbt150084 #define IXGBE_STAT(val) (val)++; 716621Sbt150084 726621Sbt150084 #ifdef IXGBE_DEBUG 736621Sbt150084 746621Sbt150084 void ixgbe_pci_dump(void *); 756621Sbt150084 void ixgbe_dump_interrupt(void *, char *); 766621Sbt150084 void ixgbe_dump_addr(void *, char *, const uint8_t *); 776621Sbt150084 786621Sbt150084 #endif /* IXGBE_DEBUG */ 796621Sbt150084 809353SSamuel.Tu@Sun.COM #ifdef IXGBE_DEBUG 819353SSamuel.Tu@Sun.COM 829353SSamuel.Tu@Sun.COM #define DEBUGOUT(S) \ 839353SSamuel.Tu@Sun.COM IXGBE_DEBUGLOG_0(NULL, S) 849353SSamuel.Tu@Sun.COM #define DEBUGOUT1(S, A) \ 859353SSamuel.Tu@Sun.COM IXGBE_DEBUGLOG_1(NULL, S, A) 869353SSamuel.Tu@Sun.COM #define DEBUGOUT2(S, A, B) \ 879353SSamuel.Tu@Sun.COM IXGBE_DEBUGLOG_2(NULL, S, A, B) 889353SSamuel.Tu@Sun.COM #define DEBUGOUT3(S, A, B, C) \ 899353SSamuel.Tu@Sun.COM IXGBE_DEBUGLOG_3(NULL, S, A, B, C) 909353SSamuel.Tu@Sun.COM #define DEBUGOUT6(S, A, B, C, D, E, F) \ 919353SSamuel.Tu@Sun.COM IXGBE_DEBUGLOG_6(NULL, S, A, B, C, D, E, F) 929353SSamuel.Tu@Sun.COM 93*12003SPaul.Guo@Sun.COM /* 94*12003SPaul.Guo@Sun.COM * DEBUGFUNC() is used to print the function call information, however since 95*12003SPaul.Guo@Sun.COM * Dtrace in Solaris can be used to trace function calls, this function is 96*12003SPaul.Guo@Sun.COM * not useful in Solaris, and DEBUGFUNC() can spam a large number of 97*12003SPaul.Guo@Sun.COM * function call system logs (see CR6918426). We sould eliminate 98*12003SPaul.Guo@Sun.COM * DEBUGFUNC(), but since DEBUGFUNC() is used by the shared code 99*12003SPaul.Guo@Sun.COM * (maintained by Intel) which is used and shared by ixgbe drivers in 100*12003SPaul.Guo@Sun.COM * different OSes, we can not remove it, so in Solaris just simply define 101*12003SPaul.Guo@Sun.COM * it as blank. 102*12003SPaul.Guo@Sun.COM */ 103*12003SPaul.Guo@Sun.COM #define DEBUGFUNC(F) 1049353SSamuel.Tu@Sun.COM 1059353SSamuel.Tu@Sun.COM #else 1069353SSamuel.Tu@Sun.COM 1079353SSamuel.Tu@Sun.COM #define DEBUGOUT(S) 1089353SSamuel.Tu@Sun.COM #define DEBUGOUT1(S, A) 1099353SSamuel.Tu@Sun.COM #define DEBUGOUT2(S, A, B) 1109353SSamuel.Tu@Sun.COM #define DEBUGOUT3(S, A, B, C) 1119353SSamuel.Tu@Sun.COM #define DEBUGOUT6(S, A, B, C, D, E, F) 1129353SSamuel.Tu@Sun.COM 1139353SSamuel.Tu@Sun.COM #define DEBUGFUNC(F) 1149353SSamuel.Tu@Sun.COM 1159353SSamuel.Tu@Sun.COM #endif /* IXGBE_DEBUG */ 1169353SSamuel.Tu@Sun.COM 1176621Sbt150084 extern void ixgbe_log(void *, const char *, ...); 1186621Sbt150084 1196621Sbt150084 #ifdef __cplusplus 1206621Sbt150084 } 1216621Sbt150084 #endif 1226621Sbt150084 1236621Sbt150084 #endif /* _IXGBE_DEBUG_H */ 124