skdrv2nd.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /******************************************************************************
  2. *
  3. * Name: skdrv2nd.h
  4. * Project: GEnesis, PCI Gigabit Ethernet Adapter
  5. * Version: $Revision: 1.15 $
  6. * Date: $Date: 2003/02/25 14:16:40 $
  7. * Purpose: Second header file for driver and all other modules
  8. *
  9. ******************************************************************************/
  10. /******************************************************************************
  11. *
  12. * (C)Copyright 1998-2003 SysKonnect GmbH.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * The information in this file is provided "AS IS" without warranty.
  20. *
  21. ******************************************************************************/
  22. /******************************************************************************
  23. *
  24. * History:
  25. *
  26. * $Log: skdrv2nd.h,v $
  27. * Revision 1.15 2003/02/25 14:16:40 mlindner
  28. * Fix: Copyright statement
  29. *
  30. * Revision 1.14 2003/02/25 13:26:26 mlindner
  31. * Add: Support for various vendors
  32. *
  33. * Revision 1.13 2002/10/02 12:46:02 mlindner
  34. * Add: Support for Yukon
  35. *
  36. * Revision 1.12.2.2 2001/09/05 12:14:50 mlindner
  37. * add: New hardware revision int
  38. *
  39. * Revision 1.12.2.1 2001/03/12 16:50:59 mlindner
  40. * chg: kernel 2.4 adaption
  41. *
  42. * Revision 1.12 2001/03/01 12:52:15 mlindner
  43. * Fixed ring size
  44. *
  45. * Revision 1.11 2001/02/19 13:28:02 mlindner
  46. * Changed PNMI parameter values
  47. *
  48. * Revision 1.10 2001/01/22 14:16:04 mlindner
  49. * added ProcFs functionality
  50. * Dual Net functionality integrated
  51. * Rlmt networks added
  52. *
  53. * Revision 1.1 2000/10/05 19:46:50 phargrov
  54. * Add directory src/vipk_devs_nonlbl/vipk_sk98lin/
  55. * This is the SysKonnect SK-98xx Gigabit Ethernet driver,
  56. * contributed by SysKonnect.
  57. *
  58. * Revision 1.9 2000/02/21 10:39:55 cgoos
  59. * Added flag for jumbo support usage.
  60. *
  61. * Revision 1.8 1999/11/22 13:50:44 cgoos
  62. * Changed license header to GPL.
  63. * Fixed two comments.
  64. *
  65. * Revision 1.7 1999/09/28 12:38:21 cgoos
  66. * Added CheckQueue to SK_AC.
  67. *
  68. * Revision 1.6 1999/07/27 08:04:05 cgoos
  69. * Added checksumming variables to SK_AC.
  70. *
  71. * Revision 1.5 1999/03/29 12:33:26 cgoos
  72. * Rreversed to fine lock granularity.
  73. *
  74. * Revision 1.4 1999/03/15 12:14:02 cgoos
  75. * Added DriverLock to SK_AC.
  76. * Removed other locks.
  77. *
  78. * Revision 1.3 1999/03/01 08:52:27 cgoos
  79. * Changed pAC->PciDev declaration.
  80. *
  81. * Revision 1.2 1999/02/18 10:57:14 cgoos
  82. * Removed SkDrvTimeStamp prototype.
  83. * Fixed SkGeOsGetTime prototype.
  84. *
  85. * Revision 1.1 1999/02/16 07:41:01 cgoos
  86. * First version.
  87. *
  88. *
  89. *
  90. ******************************************************************************/
  91. /******************************************************************************
  92. *
  93. * Description:
  94. *
  95. * This is the second include file of the driver, which includes all other
  96. * neccessary files and defines all structures and constants used by the
  97. * driver and the common modules.
  98. *
  99. * Include File Hierarchy:
  100. *
  101. * see skge.c
  102. *
  103. ******************************************************************************/
  104. #ifndef __INC_SKDRV2ND_H
  105. #define __INC_SKDRV2ND_H
  106. #include "h/skqueue.h"
  107. #include "h/skgehwt.h"
  108. #include "h/sktimer.h"
  109. #include "h/ski2c.h"
  110. #include "h/skgepnmi.h"
  111. #include "h/skvpd.h"
  112. #include "h/skgehw.h"
  113. #include "h/skgeinit.h"
  114. #include "h/skaddr.h"
  115. #include "h/skgesirq.h"
  116. #include "h/skcsum.h"
  117. #include "h/skrlmt.h"
  118. #include "h/skgedrv.h"
  119. #define SK_PCI_ISCOMPLIANT(result, pdev) { \
  120. result = SK_FALSE; /* default */ \
  121. /* 3Com (0x10b7) */ \
  122. if (pdev->vendor == 0x10b7) { \
  123. /* Gigabit Ethernet Adapter (0x1700) */ \
  124. if ((pdev->device == 0x1700)) { \
  125. result = SK_TRUE; \
  126. } \
  127. /* SysKonnect (0x1148) */ \
  128. } else if (pdev->vendor == 0x1148) { \
  129. /* SK-98xx Gigabit Ethernet Server Adapter (0x4300) */ \
  130. /* SK-98xx V2 Gigabit Ethernet Adapter (0x4320) */ \
  131. if ((pdev->device == 0x4300) || \
  132. (pdev->device == 0x4320)) { \
  133. result = SK_TRUE; \
  134. } \
  135. /* D-Link (0x1186) */ \
  136. } else if (pdev->vendor == 0x1186) { \
  137. /* Gigabit Ethernet Adapter (0x4c00) */ \
  138. if ((pdev->device == 0x4c00)) { \
  139. result = SK_TRUE; \
  140. } \
  141. /* CNet (0x1371) */ \
  142. } else if (pdev->vendor == 0x1371) { \
  143. /* GigaCard Network Adapter (0x434e) */ \
  144. if ((pdev->device == 0x434e)) { \
  145. result = SK_TRUE; \
  146. } \
  147. /* Linksys (0x1737) */ \
  148. } else if (pdev->vendor == 0x1737) { \
  149. /* Gigabit Network Adapter (0x1032) */ \
  150. /* Gigabit Network Adapter (0x1064) */ \
  151. if ((pdev->device == 0x1032) || \
  152. (pdev->device == 0x1064)) { \
  153. result = SK_TRUE; \
  154. } \
  155. } else { \
  156. result = SK_FALSE; \
  157. } \
  158. }
  159. extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned);
  160. extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*);
  161. extern SK_U64 SkOsGetTime(SK_AC*);
  162. extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);
  163. extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);
  164. extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);
  165. extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32);
  166. extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
  167. extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
  168. extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
  169. struct s_DrvRlmtMbuf {
  170. SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */
  171. SK_U8 *pData; /* Data buffer (virtually contig.). */
  172. unsigned Size; /* Data buffer size. */
  173. unsigned Length; /* Length of packet (<= Size). */
  174. SK_U32 PortIdx; /* Receiving/transmitting port. */
  175. #ifdef SK_RLMT_MBUF_PRIVATE
  176. SK_RLMT_MBUF Rlmt; /* Private part for RLMT. */
  177. #endif /* SK_RLMT_MBUF_PRIVATE */
  178. struct sk_buff *pOs; /* Pointer to message block */
  179. };
  180. /*
  181. * ioctl definitions
  182. */
  183. #define SK_IOCTL_BASE (SIOCDEVPRIVATE)
  184. #define SK_IOCTL_GETMIB (SK_IOCTL_BASE + 0)
  185. #define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1)
  186. #define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2)
  187. typedef struct s_IOCTL SK_GE_IOCTL;
  188. struct s_IOCTL {
  189. char* pData;
  190. unsigned int Len;
  191. };
  192. /*
  193. * define sizes of descriptor rings in bytes
  194. */
  195. #if 0
  196. #define TX_RING_SIZE (8*1024)
  197. #define RX_RING_SIZE (24*1024)
  198. #else
  199. #define TX_RING_SIZE (10 * 40)
  200. #define RX_RING_SIZE (10 * 40)
  201. #endif
  202. /*
  203. * Buffer size for ethernet packets
  204. */
  205. #define ETH_BUF_SIZE 1540
  206. #define ETH_MAX_MTU 1514
  207. #define ETH_MIN_MTU 60
  208. #define ETH_MULTICAST_BIT 0x01
  209. #define SK_JUMBO_MTU 9000
  210. /*
  211. * transmit priority selects the queue: LOW=asynchron, HIGH=synchron
  212. */
  213. #define TX_PRIO_LOW 0
  214. #define TX_PRIO_HIGH 1
  215. /*
  216. * alignment of rx/tx descriptors
  217. */
  218. #define DESCR_ALIGN 8
  219. /*
  220. * definitions for pnmi. TODO
  221. */
  222. #define SK_DRIVER_RESET(pAC, IoC) 0
  223. #define SK_DRIVER_SENDEVENT(pAC, IoC) 0
  224. #define SK_DRIVER_SELFTEST(pAC, IoC) 0
  225. /* For get mtu you must add an own function */
  226. #define SK_DRIVER_GET_MTU(pAc,IoC,i) 0
  227. #define SK_DRIVER_SET_MTU(pAc,IoC,i,v) 0
  228. #define SK_DRIVER_PRESET_MTU(pAc,IoC,i,v) 0
  229. /* TX and RX descriptors *****************************************************/
  230. typedef struct s_RxD RXD; /* the receive descriptor */
  231. struct s_RxD {
  232. volatile SK_U32 RBControl; /* Receive Buffer Control */
  233. SK_U32 VNextRxd; /* Next receive descriptor,low dword */
  234. SK_U32 VDataLow; /* Receive buffer Addr, low dword */
  235. SK_U32 VDataHigh; /* Receive buffer Addr, high dword */
  236. SK_U32 FrameStat; /* Receive Frame Status word */
  237. SK_U32 TimeStamp; /* Time stamp from XMAC */
  238. SK_U32 TcpSums; /* TCP Sum 2 / TCP Sum 1 */
  239. SK_U32 TcpSumStarts; /* TCP Sum Start 2 / TCP Sum Start 1 */
  240. RXD *pNextRxd; /* Pointer to next Rxd */
  241. struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
  242. };
  243. typedef struct s_TxD TXD; /* the transmit descriptor */
  244. struct s_TxD {
  245. volatile SK_U32 TBControl; /* Transmit Buffer Control */
  246. SK_U32 VNextTxd; /* Next transmit descriptor,low dword */
  247. SK_U32 VDataLow; /* Transmit Buffer Addr, low dword */
  248. SK_U32 VDataHigh; /* Transmit Buffer Addr, high dword */
  249. SK_U32 FrameStat; /* Transmit Frame Status Word */
  250. SK_U32 TcpSumOfs; /* Reserved / TCP Sum Offset */
  251. SK_U16 TcpSumSt; /* TCP Sum Start */
  252. SK_U16 TcpSumWr; /* TCP Sum Write */
  253. SK_U32 TcpReserved; /* not used */
  254. TXD *pNextTxd; /* Pointer to next Txd */
  255. struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
  256. };
  257. /* definition of flags in descriptor control field */
  258. #define RX_CTRL_OWN_BMU UINT32_C(0x80000000)
  259. #define RX_CTRL_STF UINT32_C(0x40000000)
  260. #define RX_CTRL_EOF UINT32_C(0x20000000)
  261. #define RX_CTRL_EOB_IRQ UINT32_C(0x10000000)
  262. #define RX_CTRL_EOF_IRQ UINT32_C(0x08000000)
  263. #define RX_CTRL_DEV_NULL UINT32_C(0x04000000)
  264. #define RX_CTRL_STAT_VALID UINT32_C(0x02000000)
  265. #define RX_CTRL_TIME_VALID UINT32_C(0x01000000)
  266. #define RX_CTRL_CHECK_DEFAULT UINT32_C(0x00550000)
  267. #define RX_CTRL_CHECK_CSUM UINT32_C(0x00560000)
  268. #define RX_CTRL_LEN_MASK UINT32_C(0x0000FFFF)
  269. #define TX_CTRL_OWN_BMU UINT32_C(0x80000000)
  270. #define TX_CTRL_STF UINT32_C(0x40000000)
  271. #define TX_CTRL_EOF UINT32_C(0x20000000)
  272. #define TX_CTRL_EOB_IRQ UINT32_C(0x10000000)
  273. #define TX_CTRL_EOF_IRQ UINT32_C(0x08000000)
  274. #define TX_CTRL_ST_FWD UINT32_C(0x04000000)
  275. #define TX_CTRL_DISAB_CRC UINT32_C(0x02000000)
  276. #define TX_CTRL_SOFTWARE UINT32_C(0x01000000)
  277. #define TX_CTRL_CHECK_DEFAULT UINT32_C(0x00550000)
  278. #define TX_CTRL_CHECK_CSUM UINT32_C(0x00560000)
  279. #define TX_CTRL_LEN_MASK UINT32_C(0x0000FFFF)
  280. /* The offsets of registers in the TX and RX queue control io area ***********/
  281. #define RX_Q_BUF_CTRL_CNT 0x00
  282. #define RX_Q_NEXT_DESCR_LOW 0x04
  283. #define RX_Q_BUF_ADDR_LOW 0x08
  284. #define RX_Q_BUF_ADDR_HIGH 0x0c
  285. #define RX_Q_FRAME_STAT 0x10
  286. #define RX_Q_TIME_STAMP 0x14
  287. #define RX_Q_CSUM_1_2 0x18
  288. #define RX_Q_CSUM_START_1_2 0x1c
  289. #define RX_Q_CUR_DESCR_LOW 0x20
  290. #define RX_Q_DESCR_HIGH 0x24
  291. #define RX_Q_CUR_ADDR_LOW 0x28
  292. #define RX_Q_CUR_ADDR_HIGH 0x2c
  293. #define RX_Q_CUR_BYTE_CNT 0x30
  294. #define RX_Q_CTRL 0x34
  295. #define RX_Q_FLAG 0x38
  296. #define RX_Q_TEST1 0x3c
  297. #define RX_Q_TEST2 0x40
  298. #define RX_Q_TEST3 0x44
  299. #define TX_Q_BUF_CTRL_CNT 0x00
  300. #define TX_Q_NEXT_DESCR_LOW 0x04
  301. #define TX_Q_BUF_ADDR_LOW 0x08
  302. #define TX_Q_BUF_ADDR_HIGH 0x0c
  303. #define TX_Q_FRAME_STAT 0x10
  304. #define TX_Q_CSUM_START 0x14
  305. #define TX_Q_CSUM_START_POS 0x18
  306. #define TX_Q_RESERVED 0x1c
  307. #define TX_Q_CUR_DESCR_LOW 0x20
  308. #define TX_Q_DESCR_HIGH 0x24
  309. #define TX_Q_CUR_ADDR_LOW 0x28
  310. #define TX_Q_CUR_ADDR_HIGH 0x2c
  311. #define TX_Q_CUR_BYTE_CNT 0x30
  312. #define TX_Q_CTRL 0x34
  313. #define TX_Q_FLAG 0x38
  314. #define TX_Q_TEST1 0x3c
  315. #define TX_Q_TEST2 0x40
  316. #define TX_Q_TEST3 0x44
  317. /* definition of flags in the queue control field */
  318. #define RX_Q_CTRL_POLL_ON 0x00000080
  319. #define RX_Q_CTRL_POLL_OFF 0x00000040
  320. #define RX_Q_CTRL_STOP 0x00000020
  321. #define RX_Q_CTRL_START 0x00000010
  322. #define RX_Q_CTRL_CLR_I_PAR 0x00000008
  323. #define RX_Q_CTRL_CLR_I_EOB 0x00000004
  324. #define RX_Q_CTRL_CLR_I_EOF 0x00000002
  325. #define RX_Q_CTRL_CLR_I_ERR 0x00000001
  326. #define TX_Q_CTRL_POLL_ON 0x00000080
  327. #define TX_Q_CTRL_POLL_OFF 0x00000040
  328. #define TX_Q_CTRL_STOP 0x00000020
  329. #define TX_Q_CTRL_START 0x00000010
  330. #define TX_Q_CTRL_CLR_I_EOB 0x00000004
  331. #define TX_Q_CTRL_CLR_I_EOF 0x00000002
  332. #define TX_Q_CTRL_CLR_I_ERR 0x00000001
  333. /* Interrupt bits in the interrupts source register **************************/
  334. #define IRQ_HW_ERROR 0x80000000
  335. #define IRQ_RESERVED 0x40000000
  336. #define IRQ_PKT_TOUT_RX1 0x20000000
  337. #define IRQ_PKT_TOUT_RX2 0x10000000
  338. #define IRQ_PKT_TOUT_TX1 0x08000000
  339. #define IRQ_PKT_TOUT_TX2 0x04000000
  340. #define IRQ_I2C_READY 0x02000000
  341. #define IRQ_SW 0x01000000
  342. #define IRQ_EXTERNAL_REG 0x00800000
  343. #define IRQ_TIMER 0x00400000
  344. #define IRQ_MAC1 0x00200000
  345. #define IRQ_LINK_SYNC_C_M1 0x00100000
  346. #define IRQ_MAC2 0x00080000
  347. #define IRQ_LINK_SYNC_C_M2 0x00040000
  348. #define IRQ_EOB_RX1 0x00020000
  349. #define IRQ_EOF_RX1 0x00010000
  350. #define IRQ_CHK_RX1 0x00008000
  351. #define IRQ_EOB_RX2 0x00004000
  352. #define IRQ_EOF_RX2 0x00002000
  353. #define IRQ_CHK_RX2 0x00001000
  354. #define IRQ_EOB_SY_TX1 0x00000800
  355. #define IRQ_EOF_SY_TX1 0x00000400
  356. #define IRQ_CHK_SY_TX1 0x00000200
  357. #define IRQ_EOB_AS_TX1 0x00000100
  358. #define IRQ_EOF_AS_TX1 0x00000080
  359. #define IRQ_CHK_AS_TX1 0x00000040
  360. #define IRQ_EOB_SY_TX2 0x00000020
  361. #define IRQ_EOF_SY_TX2 0x00000010
  362. #define IRQ_CHK_SY_TX2 0x00000008
  363. #define IRQ_EOB_AS_TX2 0x00000004
  364. #define IRQ_EOF_AS_TX2 0x00000002
  365. #define IRQ_CHK_AS_TX2 0x00000001
  366. #define DRIVER_IRQS (IRQ_SW | IRQ_EOF_RX1 | IRQ_EOF_RX2 | \
  367. IRQ_EOF_SY_TX1 | IRQ_EOF_AS_TX1 | \
  368. IRQ_EOF_SY_TX2 | IRQ_EOF_AS_TX2)
  369. #define SPECIAL_IRQS (IRQ_HW_ERROR | IRQ_PKT_TOUT_RX1 | IRQ_PKT_TOUT_RX2 | \
  370. IRQ_PKT_TOUT_TX1 | IRQ_PKT_TOUT_TX2 | \
  371. IRQ_I2C_READY | IRQ_EXTERNAL_REG | IRQ_TIMER | \
  372. IRQ_MAC1 | IRQ_LINK_SYNC_C_M1 | \
  373. IRQ_MAC2 | IRQ_LINK_SYNC_C_M2 | \
  374. IRQ_CHK_RX1 | IRQ_CHK_RX2 | \
  375. IRQ_CHK_SY_TX1 | IRQ_CHK_AS_TX1 | \
  376. IRQ_CHK_SY_TX2 | IRQ_CHK_AS_TX2)
  377. #define IRQ_MASK (IRQ_SW | IRQ_EOB_RX1 | IRQ_EOF_RX1 | \
  378. IRQ_EOB_RX2 | IRQ_EOF_RX2 | \
  379. IRQ_EOB_SY_TX1 | IRQ_EOF_SY_TX1 | \
  380. IRQ_EOB_AS_TX1 | IRQ_EOF_AS_TX1 | \
  381. IRQ_EOB_SY_TX2 | IRQ_EOF_SY_TX2 | \
  382. IRQ_EOB_AS_TX2 | IRQ_EOF_AS_TX2 | \
  383. IRQ_HW_ERROR | IRQ_PKT_TOUT_RX1 | IRQ_PKT_TOUT_RX2 | \
  384. IRQ_PKT_TOUT_TX1 | IRQ_PKT_TOUT_TX2 | \
  385. IRQ_I2C_READY | IRQ_EXTERNAL_REG | IRQ_TIMER | \
  386. IRQ_MAC1 | \
  387. IRQ_MAC2 | \
  388. IRQ_CHK_RX1 | IRQ_CHK_RX2 | \
  389. IRQ_CHK_SY_TX1 | IRQ_CHK_AS_TX1 | \
  390. IRQ_CHK_SY_TX2 | IRQ_CHK_AS_TX2)
  391. #define IRQ_HWE_MASK 0x00000FFF /* enable all HW irqs */
  392. typedef struct s_DevNet DEV_NET;
  393. struct s_DevNet {
  394. int PortNr;
  395. int NetNr;
  396. int Mtu;
  397. int Up;
  398. SK_AC *pAC;
  399. };
  400. typedef struct s_TxPort TX_PORT;
  401. struct s_TxPort {
  402. /* the transmit descriptor rings */
  403. caddr_t pTxDescrRing; /* descriptor area memory */
  404. SK_U64 VTxDescrRing; /* descr. area bus virt. addr. */
  405. TXD *pTxdRingHead; /* Head of Tx rings */
  406. TXD *pTxdRingTail; /* Tail of Tx rings */
  407. TXD *pTxdRingPrev; /* descriptor sent previously */
  408. int TxdRingFree; /* # of free entrys */
  409. #if 0
  410. spinlock_t TxDesRingLock; /* serialize descriptor accesses */
  411. #endif
  412. caddr_t HwAddr; /* bmu registers address */
  413. int PortIndex; /* index number of port (0 or 1) */
  414. };
  415. typedef struct s_RxPort RX_PORT;
  416. struct s_RxPort {
  417. /* the receive descriptor rings */
  418. caddr_t pRxDescrRing; /* descriptor area memory */
  419. SK_U64 VRxDescrRing; /* descr. area bus virt. addr. */
  420. RXD *pRxdRingHead; /* Head of Rx rings */
  421. RXD *pRxdRingTail; /* Tail of Rx rings */
  422. RXD *pRxdRingPrev; /* descriptor given to BMU previously */
  423. int RxdRingFree; /* # of free entrys */
  424. #if 0
  425. spinlock_t RxDesRingLock; /* serialize descriptor accesses */
  426. #endif
  427. int RxFillLimit; /* limit for buffers in ring */
  428. caddr_t HwAddr; /* bmu registers address */
  429. int PortIndex; /* index number of port (0 or 1) */
  430. };
  431. typedef struct s_PerStrm PER_STRM;
  432. #define SK_ALLOC_IRQ 0x00000001
  433. /****************************************************************************
  434. * Per board structure / Adapter Context structure:
  435. * Allocated within attach(9e) and freed within detach(9e).
  436. * Contains all 'per device' necessary handles, flags, locks etc.:
  437. */
  438. struct s_AC {
  439. SK_GEINIT GIni; /* GE init struct */
  440. SK_PNMI Pnmi; /* PNMI data struct */
  441. SK_VPD vpd; /* vpd data struct */
  442. SK_QUEUE Event; /* Event queue */
  443. SK_HWT Hwt; /* Hardware Timer control struct */
  444. SK_TIMCTRL Tim; /* Software Timer control struct */
  445. SK_I2C I2c; /* I2C relevant data structure */
  446. SK_ADDR Addr; /* for Address module */
  447. SK_CSUM Csum; /* for checksum module */
  448. SK_RLMT Rlmt; /* for rlmt module */
  449. #if 0
  450. spinlock_t SlowPathLock; /* Normal IRQ lock */
  451. #endif
  452. SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */
  453. int RlmtMode; /* link check mode to set */
  454. int RlmtNets; /* Number of nets */
  455. SK_IOC IoBase; /* register set of adapter */
  456. int BoardLevel; /* level of active hw init (0-2) */
  457. char DeviceStr[80]; /* adapter string from vpd */
  458. SK_U32 AllocFlag; /* flag allocation of resources */
  459. #if 0
  460. struct pci_dev *PciDev; /* for access to pci config space */
  461. SK_U32 PciDevId; /* pci device id */
  462. #else
  463. int PciDev;
  464. #endif
  465. struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
  466. char Name[30]; /* driver name */
  467. struct SK_NET_DEVICE *Next; /* link all devices (for clearing) */
  468. int RxBufSize; /* length of receive buffers */
  469. #if 0
  470. struct net_device_stats stats; /* linux 'netstat -i' statistics */
  471. #endif
  472. int Index; /* internal board index number */
  473. /* adapter RAM sizes for queues of active port */
  474. int RxQueueSize; /* memory used for receive queue */
  475. int TxSQueueSize; /* memory used for sync. tx queue */
  476. int TxAQueueSize; /* memory used for async. tx queue */
  477. int PromiscCount; /* promiscuous mode counter */
  478. int AllMultiCount; /* allmulticast mode counter */
  479. int MulticCount; /* number of different MC */
  480. /* addresses for this board */
  481. /* (may be more than HW can)*/
  482. int HWRevision; /* Hardware revision */
  483. int ActivePort; /* the active XMAC port */
  484. int MaxPorts; /* number of activated ports */
  485. int TxDescrPerRing; /* # of descriptors per tx ring */
  486. int RxDescrPerRing; /* # of descriptors per rx ring */
  487. caddr_t pDescrMem; /* Pointer to the descriptor area */
  488. dma_addr_t pDescrMemDMA; /* PCI DMA address of area */
  489. /* the port structures with descriptor rings */
  490. TX_PORT TxPort[SK_MAX_MACS][2];
  491. RX_PORT RxPort[SK_MAX_MACS];
  492. unsigned int CsOfs1; /* for checksum calculation */
  493. unsigned int CsOfs2; /* for checksum calculation */
  494. SK_U32 CsOfs; /* for checksum calculation */
  495. SK_BOOL CheckQueue; /* check event queue soon */
  496. /* Only for tests */
  497. int PortUp;
  498. int PortDown;
  499. };
  500. #endif /* __INC_SKDRV2ND_H */