13526Sxy150489 /* 23526Sxy150489 * This file is provided under a CDDLv1 license. When using or 33526Sxy150489 * redistributing this file, you may do so under this license. 43526Sxy150489 * In redistributing this file this license must be included 53526Sxy150489 * and no other modification of this header file is permitted. 63526Sxy150489 * 73526Sxy150489 * CDDL LICENSE SUMMARY 83526Sxy150489 * 93526Sxy150489 * Copyright(c) 1999 - 2007 Intel Corporation. All rights reserved. 103526Sxy150489 * 113526Sxy150489 * The contents of this file are subject to the terms of Version 123526Sxy150489 * 1.0 of the Common Development and Distribution License (the "License"). 133526Sxy150489 * 143526Sxy150489 * You should have received a copy of the License with this software. 153526Sxy150489 * You can obtain a copy of the License at 163526Sxy150489 * http://www.opensolaris.org/os/licensing. 173526Sxy150489 * See the License for the specific language governing permissions 183526Sxy150489 * and limitations under the License. 193526Sxy150489 */ 203526Sxy150489 213526Sxy150489 /* 223526Sxy150489 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 233526Sxy150489 * Use is subject to license terms of the CDDLv1. 243526Sxy150489 */ 253526Sxy150489 263526Sxy150489 #ifndef _E1000G_DEBUG_H 273526Sxy150489 #define _E1000G_DEBUG_H 283526Sxy150489 293526Sxy150489 #pragma ident "%Z%%M% %I% %E% SMI" 303526Sxy150489 313526Sxy150489 #ifdef __cplusplus 323526Sxy150489 extern "C" { 333526Sxy150489 #endif 343526Sxy150489 353526Sxy150489 /* 363526Sxy150489 * Debug message control 373526Sxy150489 * Debug Levels: 383526Sxy150489 * 0x000 - (0) no messages 393526Sxy150489 * 0x001 - (1) Errors 403526Sxy150489 * 0x002 - (2) Warnings 413526Sxy150489 * 0x004 - (4) Information 423526Sxy150489 * 0x008 - (8) Subroutine calls and control flow 433526Sxy150489 * 0x010 - (16) I/O Data (verbose!) 443526Sxy150489 * Variables can be set with entries in the /etc/system file with 454919Sxy150489 * "set e1000g:e1000g_debug=<value>" 464919Sxy150489 * "set e1000g:e1000g_log_mode=<value>" 473526Sxy150489 * The /etc/system file is read only once at boot time, if you change 483526Sxy150489 * it you must reboot for the change to take effect. 493526Sxy150489 * 503526Sxy150489 * It turns on diagnostics if DEBUG is defined (DEBUG also 513526Sxy150489 * enables other debugging code as ASSERT statements... 523526Sxy150489 */ 533526Sxy150489 544919Sxy150489 #ifdef DEBUG 554919Sxy150489 #define E1000G_DEBUG 564919Sxy150489 #endif 573526Sxy150489 584919Sxy150489 /* 594919Sxy150489 * By default it will print only to log 604919Sxy150489 */ 614919Sxy150489 #define E1000G_LOG_DISPLAY 0x1 624919Sxy150489 #define E1000G_LOG_PRINT 0x2 634919Sxy150489 #define E1000G_LOG_ALL 0x3 643526Sxy150489 654919Sxy150489 #ifdef E1000G_DEBUG 664919Sxy150489 674919Sxy150489 #define E1000G_ERRS_LEVEL 0x001 /* (1) Errors */ 684919Sxy150489 #define E1000G_WARN_LEVEL 0x002 /* (2) Warnings */ 694919Sxy150489 #define E1000G_INFO_LEVEL 0x004 /* (4) Information */ 704919Sxy150489 #define E1000G_TRACE_LEVEL 0x008 /* (8) Subroutine calls */ 714919Sxy150489 #define E1000G_VERBOSE_LEVEL 0x010 /* (16) I/O Data (verbose!) */ 724919Sxy150489 734919Sxy150489 #define E1000G_DEBUGLOG_0(Adapter, Level, fmt) \ 743526Sxy150489 if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt)) 753526Sxy150489 764919Sxy150489 #define E1000G_DEBUGLOG_1(Adapter, Level, fmt, d1) \ 773526Sxy150489 if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1)) 783526Sxy150489 794919Sxy150489 #define E1000G_DEBUGLOG_2(Adapter, Level, fmt, d1, d2) \ 803526Sxy150489 if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1), (d2)) 813526Sxy150489 824919Sxy150489 #define E1000G_DEBUGLOG_3(Adapter, Level, fmt, d1, d2, d3) \ 833526Sxy150489 if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1),\ 843526Sxy150489 (d2), (d3)) 853526Sxy150489 864919Sxy150489 #define E1000G_DEBUGLOG_4(Adapter, Level, fmt, d1, d2, d3, d4) \ 873526Sxy150489 if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1),\ 883526Sxy150489 (d2), (d3), (d4)) 893526Sxy150489 904919Sxy150489 #define E1000G_DEBUGLOG_5(Adapter, Level, fmt, d1, d2, d3, d4, d5) \ 913526Sxy150489 if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1),\ 923526Sxy150489 (d2), (d3), (d4), (d5)) 933526Sxy150489 944919Sxy150489 #define E1000G_DEBUG_STAT_COND(val, cond) if (cond) (val)++; 954919Sxy150489 #define E1000G_DEBUG_STAT(val) (val)++; 963526Sxy150489 973526Sxy150489 #else 983526Sxy150489 994919Sxy150489 #define E1000G_DEBUGLOG_0(Adapter, Level, fmt) 1004919Sxy150489 #define E1000G_DEBUGLOG_1(Adapter, Level, fmt, d1) 1014919Sxy150489 #define E1000G_DEBUGLOG_2(Adapter, Level, fmt, d1, d2) 1024919Sxy150489 #define E1000G_DEBUGLOG_3(Adapter, Level, fmt, d1, d2, d3) 1034919Sxy150489 #define E1000G_DEBUGLOG_4(Adapter, Level, fmt, d1, d2, d3, d4) 1044919Sxy150489 #define E1000G_DEBUGLOG_5(Adapter, Level, fmt, d1, d2, d3, d4, d5) 1053526Sxy150489 1064919Sxy150489 #define E1000G_DEBUG_STAT_COND(val, cond) 1074919Sxy150489 #define E1000G_DEBUG_STAT(val) 1083526Sxy150489 1094919Sxy150489 #endif /* E1000G_DEBUG */ 1103526Sxy150489 1113526Sxy150489 #define NAMELEN 31 1123526Sxy150489 #define BUFSZ 256 1133526Sxy150489 1144919Sxy150489 #define E1000G_STAT(val) (val)++; 1154919Sxy150489 116*5082Syy150190 void e1000g_log(void *, int, char *, ...); 117*5082Syy150190 118*5082Syy150190 #ifdef E1000G_DEBUG 119*5082Syy150190 void eeprom_dump(void *); 120*5082Syy150190 void phy_dump(void *); 121*5082Syy150190 void mac_dump(void *); 122*5082Syy150190 void pciconfig_dump(void *); 123*5082Syy150190 #endif 1243526Sxy150489 1254919Sxy150489 #ifdef E1000G_DEBUG 1264919Sxy150489 extern int e1000g_debug; 1274919Sxy150489 #endif 1284919Sxy150489 extern int e1000g_log_mode; 1294061Sxy150489 1303526Sxy150489 #ifdef __cplusplus 1313526Sxy150489 } 1323526Sxy150489 #endif 1333526Sxy150489 1343526Sxy150489 #endif /* _E1000G_DEBUG_H */ 135