]>
Commit | Line | Data |
---|---|---|
7152b1d0 WD |
1 | /****************************************************************************** |
2 | * | |
3 | * Name: skdrv1st.h | |
4 | * Project: GEnesis, PCI Gigabit Ethernet Adapter | |
5 | * Version: $Revision: 1.11 $ | |
6 | * Date: $Date: 2003/02/25 14:16:40 $ | |
7 | * Purpose: First header file for driver and all other modules | |
8 | * | |
9 | ******************************************************************************/ | |
10 | ||
11 | /****************************************************************************** | |
12 | * | |
13 | * (C)Copyright 1998-2003 SysKonnect GmbH. | |
14 | * | |
15 | * This program is free software; you can redistribute it and/or modify | |
16 | * it under the terms of the GNU General Public License as published by | |
17 | * the Free Software Foundation; either version 2 of the License, or | |
18 | * (at your option) any later version. | |
19 | * | |
20 | * The information in this file is provided "AS IS" without warranty. | |
21 | * | |
22 | ******************************************************************************/ | |
23 | ||
24 | /****************************************************************************** | |
25 | * | |
26 | * History: | |
27 | * | |
28 | * $Log: skdrv1st.h,v $ | |
29 | * Revision 1.11 2003/02/25 14:16:40 mlindner | |
30 | * Fix: Copyright statement | |
42d1f039 | 31 | * |
7152b1d0 WD |
32 | * Revision 1.10 2002/10/02 12:46:02 mlindner |
33 | * Add: Support for Yukon | |
42d1f039 | 34 | * |
7152b1d0 WD |
35 | * Revision 1.9.2.2 2001/12/07 12:06:42 mlindner |
36 | * Fix: malloc -> slab changes | |
42d1f039 | 37 | * |
7152b1d0 WD |
38 | * Revision 1.9.2.1 2001/03/12 16:50:59 mlindner |
39 | * chg: kernel 2.4 adaption | |
42d1f039 | 40 | * |
7152b1d0 WD |
41 | * Revision 1.9 2001/01/22 14:16:04 mlindner |
42 | * added ProcFs functionality | |
43 | * Dual Net functionality integrated | |
44 | * Rlmt networks added | |
42d1f039 | 45 | * |
7152b1d0 WD |
46 | * Revision 1.8 2000/02/21 12:19:18 cgoos |
47 | * Added default for SK_DEBUG_CHKMOD/_CHKCAT | |
42d1f039 | 48 | * |
7152b1d0 WD |
49 | * Revision 1.7 1999/11/22 13:50:00 cgoos |
50 | * Changed license header to GPL. | |
51 | * Added overwrite for several functions. | |
52 | * Removed linux 2.0.x definitions. | |
53 | * Removed PCI vendor ID definition (now in kernel). | |
42d1f039 | 54 | * |
7152b1d0 WD |
55 | * Revision 1.6 1999/07/27 08:03:33 cgoos |
56 | * Changed SK_IN/OUT macros to readX/writeX instead of memory | |
57 | * accesses (necessary for ALPHA). | |
42d1f039 | 58 | * |
7152b1d0 WD |
59 | * Revision 1.5 1999/07/23 12:10:21 cgoos |
60 | * Removed SK_RLMT_SLOW_LOOKAHEAD define. | |
42d1f039 | 61 | * |
7152b1d0 WD |
62 | * Revision 1.4 1999/07/14 12:31:13 cgoos |
63 | * Added SK_RLMT_SLOW_LOOKAHEAD define. | |
42d1f039 | 64 | * |
7152b1d0 WD |
65 | * Revision 1.3 1999/04/07 10:12:54 cgoos |
66 | * Added check for KERNEL and OPTIMIZATION defines. | |
42d1f039 | 67 | * |
7152b1d0 WD |
68 | * Revision 1.2 1999/03/01 08:51:47 cgoos |
69 | * Fixed pcibios_read/write definitions. | |
42d1f039 | 70 | * |
7152b1d0 WD |
71 | * Revision 1.1 1999/02/16 07:40:49 cgoos |
72 | * First version. | |
42d1f039 WD |
73 | * |
74 | * | |
7152b1d0 WD |
75 | * |
76 | ******************************************************************************/ | |
77 | ||
78 | /****************************************************************************** | |
79 | * | |
80 | * Description: | |
81 | * | |
82 | * This is the first include file of the driver, which includes all | |
83 | * neccessary system header files and some of the GEnesis header files. | |
84 | * It also defines some basic items. | |
85 | * | |
86 | * Include File Hierarchy: | |
87 | * | |
88 | * see skge.c | |
89 | * | |
90 | ******************************************************************************/ | |
91 | ||
92 | #ifndef __INC_SKDRV1ST_H | |
93 | #define __INC_SKDRV1ST_H | |
94 | ||
95 | #if 0 | |
96 | /* Check kernel version */ | |
97 | #include <linux/version.h> | |
98 | #if (LINUX_VERSION_CODE > 0x020300) | |
99 | #endif | |
100 | #endif | |
101 | ||
102 | typedef struct s_AC SK_AC; | |
103 | ||
104 | /* override some default functions with optimized linux functions */ | |
105 | ||
106 | #define SK_PNMI_STORE_U16(p,v) memcpy((char*)(p),(char*)&(v),2) | |
107 | #define SK_PNMI_STORE_U32(p,v) memcpy((char*)(p),(char*)&(v),4) | |
108 | #define SK_PNMI_STORE_U64(p,v) memcpy((char*)(p),(char*)&(v),8) | |
109 | #define SK_PNMI_READ_U16(p,v) memcpy((char*)&(v),(char*)(p),2) | |
110 | #define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),2) | |
111 | #define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),2) | |
112 | ||
113 | #define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff) | |
114 | ||
115 | #define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6)) | |
116 | ||
117 | ||
118 | #if !defined(__OPTIMIZE__) || !defined(__KERNEL__) | |
119 | #warning You must compile this file with the correct options! | |
120 | #warning See the last lines of the source file. | |
121 | #error You must compile this driver with "-O". | |
122 | #endif | |
123 | ||
124 | #if 0 | |
125 | #include <linux/version.h> | |
126 | #endif | |
127 | #include <linux/types.h> | |
128 | #if 0 | |
129 | #include <linux/kernel.h> | |
130 | #endif | |
131 | #include <linux/string.h> | |
132 | #if 0 | |
133 | #include <linux/errno.h> | |
134 | #include <linux/ioport.h> | |
135 | #include <linux/slab.h> | |
136 | #include <linux/interrupt.h> | |
137 | #include <linux/pci.h> | |
138 | #endif | |
139 | #include <asm/byteorder.h> | |
140 | #include <asm/bitops.h> | |
141 | #include <asm/io.h> | |
142 | #if 0 | |
143 | #include <linux/netdevice.h> | |
144 | #include <linux/etherdevice.h> | |
145 | #include <linux/skbuff.h> | |
146 | ||
147 | #include <linux/init.h> | |
148 | #include <asm/uaccess.h> | |
149 | #include <net/checksum.h> | |
150 | #endif | |
151 | ||
152 | #include "h/sktypes.h" | |
153 | #include "h/skerror.h" | |
154 | #include "h/skdebug.h" | |
155 | #include "h/lm80.h" | |
156 | #include "h/xmac_ii.h" | |
157 | ||
158 | #include "u-boot_compat.h" | |
159 | ||
160 | #ifdef __LITTLE_ENDIAN | |
161 | #define SK_LITTLE_ENDIAN | |
162 | #else | |
163 | #define SK_BIG_ENDIAN | |
164 | #endif | |
165 | ||
166 | #if 0 | |
167 | #define SK_NET_DEVICE net_device | |
168 | #else | |
169 | #define SK_NET_DEVICE eth_device | |
170 | #endif | |
171 | ||
172 | ||
173 | /* we use gethrtime(), return unit: nanoseconds */ | |
174 | #if 0 | |
175 | #define SK_TICKS_PER_SEC HZ | |
176 | #else | |
177 | #define SK_TICKS_PER_SEC CFG_HZ | |
178 | #endif | |
179 | ||
180 | #define SK_MEM_MAPPED_IO | |
181 | ||
42d1f039 | 182 | /* #define SK_RLMT_SLOW_LOOKAHEAD */ |
7152b1d0 WD |
183 | |
184 | #define SK_MAX_MACS 2 | |
185 | #define SK_MAX_NETS 2 | |
186 | ||
187 | #define SK_IOC char* | |
188 | ||
189 | typedef struct s_DrvRlmtMbuf SK_MBUF; | |
190 | ||
191 | #define SK_CONST64 INT64_C | |
192 | #define SK_CONSTU64 UINT64_C | |
193 | ||
194 | #define SK_MEMCPY(dest,src,size) memcpy(dest,src,size) | |
195 | #define SK_MEMCMP(s1,s2,size) memcmp(s1,s2,size) | |
196 | #define SK_MEMSET(dest,val,size) memset(dest,val,size) | |
197 | #define SK_STRLEN(pStr) strlen((char*)(pStr)) | |
198 | #define SK_STRNCPY(pDest,pSrc,size) strncpy((char*)(pDest),(char*)(pSrc),size) | |
199 | #define SK_STRCMP(pStr1,pStr2) strcmp((char*)(pStr1),(char*)(pStr2)) | |
200 | ||
201 | /* macros to access the adapter */ | |
42d1f039 WD |
202 | #define SK_OUT8(b,a,v) writeb((v), ((b)+(a))) |
203 | #define SK_OUT16(b,a,v) writew((v), ((b)+(a))) | |
204 | #define SK_OUT32(b,a,v) writel((v), ((b)+(a))) | |
7152b1d0 WD |
205 | #define SK_IN8(b,a,pv) (*(pv) = readb((b)+(a))) |
206 | #define SK_IN16(b,a,pv) (*(pv) = readw((b)+(a))) | |
207 | #define SK_IN32(b,a,pv) (*(pv) = readl((b)+(a))) | |
208 | ||
209 | #define int8_t char | |
210 | #define int16_t short | |
211 | #define int32_t long | |
212 | #define int64_t long long | |
213 | #define uint8_t u_char | |
214 | #define uint16_t u_short | |
215 | #define uint32_t u_long | |
216 | #define uint64_t unsigned long long | |
217 | #define t_scalar_t int | |
218 | #define t_uscalar_t unsigned int | |
219 | #define uintptr_t unsigned long | |
220 | ||
221 | #define __CONCAT__(A,B) A##B | |
222 | ||
223 | #define INT32_C(a) __CONCAT__(a,L) | |
224 | #define INT64_C(a) __CONCAT__(a,LL) | |
225 | #define UINT32_C(a) __CONCAT__(a,UL) | |
226 | #define UINT64_C(a) __CONCAT__(a,ULL) | |
227 | ||
228 | #ifdef DEBUG | |
229 | #define SK_DBG_PRINTF printk | |
230 | #ifndef SK_DEBUG_CHKMOD | |
231 | #define SK_DEBUG_CHKMOD 0 | |
232 | #endif | |
233 | #ifndef SK_DEBUG_CHKCAT | |
234 | #define SK_DEBUG_CHKCAT 0 | |
235 | #endif | |
236 | /* those come from the makefile */ | |
237 | #define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD) | |
238 | #define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT) | |
239 | ||
240 | extern void SkDbgPrintf(const char *format,...); | |
241 | ||
242 | #define SK_DBGMOD_DRV 0x00010000 | |
243 | ||
244 | /**** possible driver debug categories ********************************/ | |
245 | #define SK_DBGCAT_DRV_ENTRY 0x00010000 | |
246 | #define SK_DBGCAT_DRV_SAP 0x00020000 | |
247 | #define SK_DBGCAT_DRV_MCA 0x00040000 | |
248 | #define SK_DBGCAT_DRV_TX_PROGRESS 0x00080000 | |
249 | #define SK_DBGCAT_DRV_RX_PROGRESS 0x00100000 | |
250 | #define SK_DBGCAT_DRV_PROGRESS 0x00200000 | |
251 | #define SK_DBGCAT_DRV_MSG 0x00400000 | |
252 | #define SK_DBGCAT_DRV_PROM 0x00800000 | |
253 | #define SK_DBGCAT_DRV_TX_FRAME 0x01000000 | |
254 | #define SK_DBGCAT_DRV_ERROR 0x02000000 | |
255 | #define SK_DBGCAT_DRV_INT_SRC 0x04000000 | |
256 | #define SK_DBGCAT_DRV_EVENT 0x08000000 | |
257 | ||
258 | #endif | |
259 | ||
260 | #define SK_ERR_LOG SkErrorLog | |
261 | ||
262 | extern void SkErrorLog(SK_AC*, int, int, char*); | |
263 | ||
264 | #endif |