9da57d7b0ddd8d73b676ce12c040362132cdd538bt/*
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * CDDL HEADER START
9da57d7b0ddd8d73b676ce12c040362132cdd538bt *
19843f01b1bef3453f717c23c8f89fb9313f6749Paul Guo * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * The contents of this file are subject to the terms of the
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * Common Development and Distribution License (the "License").
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * You may not use this file except in compliance with the License.
9da57d7b0ddd8d73b676ce12c040362132cdd538bt *
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * You can obtain a copy of the license at:
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * http://www.opensolaris.org/os/licensing.
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * See the License for the specific language governing permissions
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * and limitations under the License.
9da57d7b0ddd8d73b676ce12c040362132cdd538bt *
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * When using or redistributing this file, you may do so under the
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * License only. No other modification of this header is permitted.
9da57d7b0ddd8d73b676ce12c040362132cdd538bt *
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * If applicable, add the following below this CDDL HEADER, with the
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * fields enclosed by brackets "[]" replaced with your own identifying
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * information: Portions Copyright [yyyy] [name of copyright owner]
9da57d7b0ddd8d73b676ce12c040362132cdd538bt *
9da57d7b0ddd8d73b676ce12c040362132cdd538bt * CDDL HEADER END
9da57d7b0ddd8d73b676ce12c040362132cdd538bt */
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt/*
19843f01b1bef3453f717c23c8f89fb9313f6749Paul Guo * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China * Use is subject to license terms.
9da57d7b0ddd8d73b676ce12c040362132cdd538bt */
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent/*
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent */
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#ifndef _IXGBE_DEBUG_H
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define _IXGBE_DEBUG_H
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#ifdef __cplusplus
9da57d7b0ddd8d73b676ce12c040362132cdd538btextern "C" {
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#endif
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#ifdef DEBUG
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUG
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#endif
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#ifdef IXGBE_DEBUG
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_0(adapter, fmt) \
9da57d7b0ddd8d73b676ce12c040362132cdd538bt ixgbe_log((adapter), (fmt))
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_1(adapter, fmt, d1) \
9da57d7b0ddd8d73b676ce12c040362132cdd538bt ixgbe_log((adapter), (fmt), (d1))
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2) \
9da57d7b0ddd8d73b676ce12c040362132cdd538bt ixgbe_log((adapter), (fmt), (d1), (d2))
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3) \
9da57d7b0ddd8d73b676ce12c040362132cdd538bt ixgbe_log((adapter), (fmt), (d1), (d2), (d3))
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6) \
9da57d7b0ddd8d73b676ce12c040362132cdd538bt ixgbe_log((adapter), (fmt), (d1), (d2), (d3), (d4), (d5), (d6))
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUG_STAT_COND(val, cond) if (cond) (val)++;
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUG_STAT(val) (val)++;
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#else
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_0(adapter, fmt)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_1(adapter, fmt, d1)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUG_STAT_COND(val, cond)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#define IXGBE_DEBUG_STAT(val)
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#endif /* IXGBE_DEBUG */
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#ifdef IXGBE_DEBUG
9da57d7b0ddd8d73b676ce12c040362132cdd538btvoid ixgbe_pci_dump(void *);
9da57d7b0ddd8d73b676ce12c040362132cdd538btvoid ixgbe_dump_interrupt(void *, char *);
9da57d7b0ddd8d73b676ce12c040362132cdd538btvoid ixgbe_dump_addr(void *, char *, const uint8_t *);
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT(S) \
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China IXGBE_DEBUGLOG_0(NULL, S)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT1(S, A) \
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China IXGBE_DEBUGLOG_1(NULL, S, A)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT2(S, A, B) \
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China IXGBE_DEBUGLOG_2(NULL, S, A, B)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT3(S, A, B, C) \
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China IXGBE_DEBUGLOG_3(NULL, S, A, B, C)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT6(S, A, B, C, D, E, F) \
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China IXGBE_DEBUGLOG_6(NULL, S, A, B, C, D, E, F)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_ERROR_INVALID_STATE "INVALID STATE"
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_ERROR_POLLING "POLLING ERROR"
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_ERROR_CAUTION "CAUTION"
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_ERROR_SOFTWARE "SOFTWARE ERROR"
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_ERROR_ARGUMENT "BAD ARGUMENT"
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_ERROR_UNSUPPORTED "UNSUPPORTED"
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define ERROR_REPORT1(S, A) DEBUGOUT(S ":" A)
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define ERROR_REPORT2(S, A, B) DEBUGOUT1(S ":" A, B)
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define ERROR_REPORT3(S, A, B, C) DEBUGOUT2(S ":" A, B, C)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#else
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT(S)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT1(S, A)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT2(S, A, B)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT3(S, A, B, C)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#define DEBUGOUT6(S, A, B, C, D, E, F)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define ERROR_REPORT1(S, A)
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define ERROR_REPORT2(S, A, B)
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define ERROR_REPORT3(S, A, B, C)
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China#endif /* IXGBE_DEBUG */
73cd555c10e70dac413ae4b40de8450a291750acBin Tu - Sun Microsystems - Beijing China
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent/*
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * DEBUGFUNC() is used to print the function call information, however since
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * DTrace in illumos can be used to trace function calls, this function is
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * not useful in illumos, and DEBUGFUNC() can spam a large number of
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * function call system logs (see CR6918426). We sould eliminate
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * DEBUGFUNC(), but since DEBUGFUNC() is used by the shared code
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * (maintained by Intel) which is used and shared by ixgbe drivers in
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * different OSes, we can not remove it, so in illumos just simply define
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent * it as blank.
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent */
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define DEBUGFUNC(F)
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent#define IXGBE_STAT(val) (val)++;
dc0cb1cda72a989d92d813e487cdff59f629aa3fDale Ghent
9da57d7b0ddd8d73b676ce12c040362132cdd538btextern void ixgbe_log(void *, const char *, ...);
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#ifdef __cplusplus
9da57d7b0ddd8d73b676ce12c040362132cdd538bt}
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#endif
9da57d7b0ddd8d73b676ce12c040362132cdd538bt
9da57d7b0ddd8d73b676ce12c040362132cdd538bt#endif /* _IXGBE_DEBUG_H */