1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
/*
* This file is provided under a CDDLv1 license. When using or
* redistributing this file, you may do so under this license.
* In redistributing this file this license must be included
* and no other modification of this header file is permitted.
*
* CDDL LICENSE SUMMARY
*
* Copyright(c) 1999 - 2008 Intel Corporation. All rights reserved.
*
* The contents of this file are subject to the terms of Version
* 1.0 of the Common Development and Distribution License (the "License").
*
* You should have received a copy of the License with this software.
* You can obtain a copy of the License at
* http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms of the CDDLv1.
*/
#ifndef _E1000G_DEBUG_H
#define _E1000G_DEBUG_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Debug message control
* Debug Levels:
* 0x000 - (0) no messages
* 0x001 - (1) Errors
* 0x002 - (2) Warnings
* 0x004 - (4) Information
* 0x008 - (8) Subroutine calls and control flow
* 0x010 - (16) I/O Data (verbose!)
* Variables can be set with entries in the /etc/system file with
* "set e1000g:e1000g_debug=<value>"
* "set e1000g:e1000g_log_mode=<value>"
* The /etc/system file is read only once at boot time, if you change
* it you must reboot for the change to take effect.
*
* It turns on diagnostics if DEBUG is defined (DEBUG also
* enables other debugging code as ASSERT statements...
*/
#include <sys/types.h>
#ifdef DEBUG
#define E1000G_DEBUG
#endif
/*
* By default it will print only to log
*/
#define E1000G_LOG_DISPLAY 0x1
#define E1000G_LOG_PRINT 0x2
#define E1000G_LOG_ALL 0x3
#ifdef E1000G_DEBUG
#define E1000G_ERRS_LEVEL 0x001 /* (1) Errors */
#define E1000G_WARN_LEVEL 0x002 /* (2) Warnings */
#define E1000G_INFO_LEVEL 0x004 /* (4) Information */
#define E1000G_TRACE_LEVEL 0x008 /* (8) Subroutine calls */
#define E1000G_VERBOSE_LEVEL 0x010 /* (16) I/O Data (verbose!) */
#define E1000G_DEBUGLOG_0(Adapter, Level, fmt) \
if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt))
#define E1000G_DEBUGLOG_1(Adapter, Level, fmt, d1) \
if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1))
#define E1000G_DEBUGLOG_2(Adapter, Level, fmt, d1, d2) \
if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1), (d2))
#define E1000G_DEBUGLOG_3(Adapter, Level, fmt, d1, d2, d3) \
if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1),\
(d2), (d3))
#define E1000G_DEBUGLOG_4(Adapter, Level, fmt, d1, d2, d3, d4) \
if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1),\
(d2), (d3), (d4))
#define E1000G_DEBUGLOG_5(Adapter, Level, fmt, d1, d2, d3, d4, d5) \
if (e1000g_debug) e1000g_log((Adapter), (Level), (fmt), (d1),\
(d2), (d3), (d4), (d5))
#define E1000G_DEBUG_STAT_COND(val, cond) if (cond) (val)++;
#define E1000G_DEBUG_STAT(val) (val)++;
#else
#define E1000G_DEBUGLOG_0(Adapter, Level, fmt)
#define E1000G_DEBUGLOG_1(Adapter, Level, fmt, d1)
#define E1000G_DEBUGLOG_2(Adapter, Level, fmt, d1, d2)
#define E1000G_DEBUGLOG_3(Adapter, Level, fmt, d1, d2, d3)
#define E1000G_DEBUGLOG_4(Adapter, Level, fmt, d1, d2, d3, d4)
#define E1000G_DEBUGLOG_5(Adapter, Level, fmt, d1, d2, d3, d4, d5)
#define E1000G_DEBUG_STAT_COND(val, cond)
#define E1000G_DEBUG_STAT(val)
#endif /* E1000G_DEBUG */
#define NAMELEN 31
#define BUFSZ 256
#define E1000G_STAT(val) (val)++;
void e1000g_log(void *, int, char *, ...);
#ifdef E1000G_DEBUG
void eeprom_dump(void *);
void phy_dump(void *);
void mac_dump(void *);
void pciconfig_dump(void *);
void pciconfig_bar(void *, uint32_t, char *);
#endif
#ifdef E1000G_DEBUG
extern int e1000g_debug;
#endif
extern int e1000g_log_mode;
#ifdef __cplusplus
}
#endif
#endif /* _E1000G_DEBUG_H */
|