gei82543End.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:35k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* gei82543End.h - Intel 8254x network interface header */
  2. /* Copyright 1990-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01g,28may02,jln add TX_RESTART_TRUE and TX_RESTART_NONE
  7. 01f,20apr02,jln support 82540/5/6 spr # 76739
  8. 01e,31jan02,jln change len of device name (spr#73010) 
  9. 01d,05dec01,jln add definitions for TBI compatibility workaround
  10. 01c,01oct01,jln move device ID definition to sysGei82543End.c
  11. 01b,01apr01,jln clean up after code review (partial spr#65326)
  12. 01a,08Jan01,jln written
  13. */
  14. #ifndef __INCGEI82543Endh
  15. #define __INCGEI82543Endh
  16. /* includes */
  17. #include "etherLib.h"
  18. #include "miiLib.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  23. #pragma align 1  /* tell gcc960 not to optimize alignments */
  24. #endif    /* CPU_FAMILY==I960 */
  25. /* define */
  26. #define UNKNOWN -1
  27.                  
  28. #ifndef PHYS_TO_BUS_ADDR
  29. #define PHYS_TO_BUS_ADDR(unit,physAddr)                                   
  30.     ((int) pDrvCtrl->adaptor.sysLocalToBus ?                                  
  31.     (*pDrvCtrl->adaptor.sysLocalToBus) (unit, physAddr) : physAddr)
  32. #endif /* PHYS_TO_BUS_ADDR */
  33. #ifndef BUS_TO_PHYS_ADDR
  34. #define BUS_TO_PHYS_ADDR(unit,busAddr)                                     
  35.     ((int) pDrvCtrl->adaptor.sysBusToLocal ?                                  
  36.     (*pDrvCtrl->adaptor.sysBusToLocal)(unit, busAddr) : busAddr)
  37. #endif /* BUS_TO_PHYS_ADDR */
  38. #define TX_DESC_TYPE_CLEAN              0   /* TX descriptor type */
  39. #define TX_DESC_TYPE_COPY               1      /* -- copy/chain/EOP */
  40. #define TX_DESC_TYPE_CHAIN              2
  41. #define TX_DESC_TYPE_EOP                3
  42. /* TX descriptors structure */
  43. #define TXDESC_BUFADRLOW_OFFSET         0   /* buf mem low offset */
  44. #define TXDESC_BUFADRHIGH_OFFSET        4   /* buf mem high offset */
  45. #define TXDESC_LENGTH_OFFSET            8   /* buf length offset */
  46. #define TXDESC_CSO_OFFSET               10  /* checksum offset */
  47. #define TXDESC_CMD_OFFSET               11  /* command offset */
  48. #define TXDESC_STATUS_OFFSET            12  /* status offset */
  49. #define TXDESC_CSS_OFFSET               13  /* cksum start */
  50. #define TXDESC_SPECIAL_OFFSET           14  /* special field */
  51. #define TXDESC_SIZE                     16  /* descriptor size */
  52. #define TXDESC_CTX_IPCSS_OFFSET         0   /* CXT descriptor IPCSS */
  53. #define TXDESC_CTX_TUCSS_OFFSET         4   /* CXT descriptor TUCSS */
  54. /* RX descriptor structure */
  55. #define RXDESC_BUFADRLOW_OFFSET         0   /* buf mem low offset */
  56. #define RXDESC_BUFADRHIGH_OFFSET        4   /* buf mem high offset */
  57. #define RXDESC_LENGTH_OFFSET            8   /* length offset */
  58. #define RXDESC_CHKSUM_OFFSET            10  /* cksum offset */
  59. #define RXDESC_STATUS_OFFSET            12  /* status offset */
  60. #define RXDESC_ERROR_OFFSET             13  /* error offset */
  61. #define RXDESC_SPECIAL_OFFSET           14  /* special offset */
  62. #define RXDESC_SIZE                     16  /* descriptor size */
  63. #define TX_ETHER_PHY_SIZE               (EH_SIZE + ETHERMTU + 2)
  64. #define PRO1000_PCI_VENDOR_ID           0x8086 /* Intel vendor ID */
  65. #define PRO1000_PCI_DEVICE_ID           0x1001 /* device ID */
  66. #define PRO1000F_PCI_SUBSYSTEM_ID       0x1003 /* device subsystem ID */
  67. #define PRO1000T_PCI_SUBSYSTEM_ID       0x1004
  68. #define PRO1000T_PCI_DEVICE_ID          0x1004 /* bizard case */
  69. #define PRO1000F_BOARD                  0x1003 /* backward compatible */
  70. #define PRO1000T_BOARD                  0x1003 /* backward compatible */
  71. #define INTEL_PCI_VENDOR_ID             0x8086
  72. #define PRO1000_546_BOARD               0x100e /* 82540/82545/82546 MAC */
  73. #define PRO1000_544_BOARD               0x1008 /* 82544 MAC */
  74. #define PRO1000_543_BOARD               0x1003 /* 82543 MAC */
  75. #define GEI_COPPER_MEDIA                1
  76. #define GEI_FIBER_MEDIA                 2
  77. #define GEI_PHY_GMII_TYPE               1
  78. #define DEFAULT_RXRES_PROCESS_FACTOR    2
  79. #define DEFAULT_TIMER_INTERVAL          2       /* 2 seconds */
  80. #define DEFAULT_DRV_FLAGS               0
  81. #define DEFAULT_LOAN_RXBUF_FACTOR       4
  82. #define DEFAULT_MBLK_NUM_FACTOR         4
  83. #define DEFAULT_MBUF_COPY_SIZE          256
  84. #define DEFAULT_NUM_TXDES               24
  85. #define DEFAULT_NUM_RXDES               24
  86. #define DEFAULT_RXINT_DELAY             0
  87. #define DEFAULT_MULTI_FILTER_TYPE       MULTI_FILTER_TYPE_47_36
  88. #define DEFAULT_FLOW_CONTRL             FLOW_CONTRL_HW
  89. #define DEFAULT_TX_REPORT               TX_REPORT_RS
  90. #define DEFAULT_TIPG_IPGT_F             6
  91. #define DEFAULT_TIPG_IPGT_T             8
  92. #define DEFAULT_TIPG_IPGR1              8
  93. #define DEFAULT_TIPG_IPGR2              6
  94. #define GEI543_MAX_DEV_UNIT             4
  95. /* flags available to config system */ 
  96. #define GEI_END_SET_TIMER               0x0001 /* use a watchdog timer */   
  97. #define GEI_END_SET_RX_PRIORITY         0x0002 /* RX has higher priority (543 only) */
  98. #define GEI_END_FREE_RESOURCE_DELAY     0x0004 /* allow delay to free loaned TX cluster */ 
  99. #define GEI_END_JUMBO_FRAME_SUPPORT     0x0008 /* Jumbo Frame allowed */
  100. #define GEI_END_RX_IP_XSUM              0x0010 /* RX IP XSUM allowed, not supported */
  101. #define GEI_END_RX_TCPUDP_XSUM          0x0020 /* RX TCP XSUM allowed, not supported */
  102. #define GEI_END_TX_IP_XSUM              0x0040 /* TX IP XSUM allowed, not supported */
  103. #define GEI_END_TX_TCPUDP_XSUM          0x0080 /* TX TCP XSUM allowed, not supported */
  104. #define GEI_END_TX_TCP_SEGMENTATION     0x0100 /* TX TCP segmentation, not supported */
  105. #define GEI_END_TBI_COMPATIBILITY       0x0200 /* TBI compatibility workaround (543 only) */
  106. #define GEI_END_USER_MEM_FOR_DESC_ONLY  0x0400 /* cacheable user mem for RX descriptors only */ 
  107. #define GEI_DEFAULT_RXDES_NUM           0x40
  108. #define GEI_DEFAULT_TXDES_NUM           0x80
  109. #define GEI_DEFAULT_USR_FLAG            (GEI_END_SET_TIMER | 
  110.                                          GEI_END_SET_RX_PRIORITY | 
  111.                                          GEI_END_FREE_RESOURCE_DELAY)
  112. #define GEI_DEFAULT_ETHERHEADER         (SIZEOF_ETHERHEADER)
  113. #define GEI_MAX_FRAME_SIZE              16288 /* based on default RX/TX 
  114.                                                buffer configuration */
  115. #define GEI_MAX_JUMBO_MTU_SIZE          (GEI_MAX_FRAME_SIZE - 
  116.                                          GEI_DEFAULT_ETHERHEADER - 
  117.                                          ETHER_CRC_LENGTH)   
  118. #define GEI_DEFAULT_JUMBO_MTU_SIZE      9000      /* 9000 bytes */
  119. #define AVAIL_TX_INT                    (INT_TXDW_BIT)
  120. #define AVAIL_RX_INT                    (INT_RXO_BIT | INT_RXTO_BIT)
  121. #define AVAIL_RX_TX_INT                 (AVAIL_TX_INT | AVAIL_RX_INT)
  122. #define AVAIL_LINK_INT                  (INT_LSC_BIT)
  123. #define INT_LINK_CHECK                  (AVAIL_LINK_INT | INT_RXCFG_BIT)
  124. #define INTEL_82543GC_VALID_INT         (AVAIL_RX_TX_INT | INT_LINK_CHECK | INT_TXDLOW_BIT)
  125.  
  126. #define MAX_TXINT_DELAY                 65536
  127. #define MAX_RXINT_DELAY                 65536
  128. #define MIN_TXINT_DELAY                 1
  129. #define TXINT_DELAY_LESS                5
  130. #define TXINT_DELAY_MORE                512 
  131. #define ETHER_CRC_LENGTH                4
  132. #define RX_CRC_LEN                      ETHER_CRC_LENGTH
  133. #define MAX_ETHER_PACKET_SIZE           1514 
  134. #define MIN_ETHER_PACKET_SIZE           60
  135. #define ETHER_ADDRESS_SIZE              6
  136. #define CARRIER_EXTENSION_BYTE          0x0f
  137. #define INTEL_82543GC_MTA_NUM           128
  138. #define INTEL_82543GC_MULTIPLE_DES      8
  139. #define TX_COLLISION_THRESHOLD          16
  140. #define FDX_COLLISION_DISTANCE          64
  141. #define HDX_COLLISION_DISTANCE          64
  142. #define BIG_HDX_COLLISION_DISTANCE      512
  143. #define NUM_RAR                         16
  144. #define NUM_MTA                         128
  145. #define NUM_VLAN                        128
  146. #define MAX_NUM_MULTI                   (NUM_RAR + NUM_MTA - 1)
  147. #define MULTI_FILTER_TYPE_47_36         0
  148. #define MULTI_FILTER_TYPE_46_35         1
  149. #define MULTI_FILTER_TYPE_45_34         2
  150. #define MULTI_FILTER_TYPE_43_32         3
  151. #define FLOW_CONTRL_NONE                0
  152. #define FLOW_CONTRL_TRANSMIT            1
  153. #define FLOW_CONTRL_RECEIVE             2
  154. #define FLOW_CONTRL_ALL                 3
  155. #define FLOW_CONTRL_HW                  0xf
  156. #define TX_REPORT_RS                    1
  157. #define TX_REPORT_RPS                   2
  158. #define DMA_RX_PRIORITY                 1
  159. #define DMA_FAIR_RX_TX                  2
  160. #define FULL_DUPLEX_MODE                1
  161. #define HALF_DUPLEX_MODE                2
  162. #define DUPLEX_HW                       3
  163. #define DEFAULT_DUPLEX_MODE             FULL_DUPLEX_MODE
  164. #define END_SPEED_10M                   10000000    /* 10Mbs */
  165. #define END_SPEED_100M                  100000000   /* 100Mbs */
  166. #define END_SPEED_1000M                 1000000000  /* 1000Mbs */
  167. #define END_SPEED                       END_SPEED_1000M
  168. #define DEVICE_NAME                     "gei" 
  169. #define DEVICE_NAME_LENGTH              4 
  170. #define TYPE_PRO1000F_PCI               1
  171. #define TYPE_PRO1000T_PCI               2
  172. #define GEI82543_HW_AUTO                0x1
  173. #define GEI82543_FORCE_LINK             0x2
  174. /* general flags */
  175. #define FLAG_POLLING_MODE               0x0001
  176. #define FLAG_PROMISC_MODE               0x0002
  177. #define FLAG_ALLMULTI_MODE              0x0004
  178. #define FLAG_MULTICAST_MODE             0x0008
  179. #define FLAG_BROADCAST_MODE             0x0010
  180. /* misc */
  181. #define TX_RESTART_NONE                 0x4000 /* muxTxRestart not scheduled */
  182. #define TX_RESTART_TRUE                 0x8000 /* muxTxRestart is scheduled */
  183. #define LINK_STATUS_OK                  0
  184. #define LINK_STATUS_ERROR               1
  185. #define LINK_STATUS_UNKNOWN             2
  186. #define FREE_ALL_AUTO                   1
  187. #define FREE_ALL_FORCE                  2
  188. #define TX_LOAN_TRANSMIT                1
  189. #define TX_COPY_TRANSMIT                2
  190. #define LINK_TIMEOUT_IN_QUAR_SEC        12 /* 3s */
  191. #define GEI_MII_PHY_CAP_FLAGS           (MII_PHY_10 | MII_PHY_100 | 
  192.                                          MII_PHY_FD | MII_PHY_HD | 
  193.                                          MII_PHY_1000T_FD)
  194. /* register area */
  195. /* TX registers */
  196. #define INTEL_82543GC_TDBAL             0x3800  /* Tx Descriptor Base Low */
  197. #define INTEL_82543GC_TDBAH             0x3804  /* Tx Descriptor Base High */
  198. #define INTEL_82543GC_TDLEN             0x3808  /* Tx Descriptor Length */
  199. #define INTEL_82543GC_TDH               0x3810  /* Tx Descriptor Head */
  200. #define INTEL_82543GC_TDT               0x3818  /* Tx Descriptor Tail */
  201. /* RX registers */
  202. #define INTEL_82543GC_RDBAL             0x2800  /* Rx Descriptor Base Low */
  203. #define INTEL_82543GC_RDBAH             0x2804  /* Rx Descriptor Base High */
  204. #define INTEL_82543GC_RDLEN             0x2808  /* Rx Descriptor Length */
  205. #define INTEL_82543GC_RDH               0x2810  /* Rx Descriptor Head */
  206. #define INTEL_82543GC_RDT               0x2818  /* Rx Descriptor Tail */
  207. /* Interrupt registers */
  208. #define INTEL_82543GC_ICR               0xc0    /* Interrupt Cause Read */
  209. #define INTEL_82543GC_ICS               0xc8    /* Interrupt Cause Set */
  210. #define INTEL_82543GC_IMS               0xd0    /* Interrupt Mask Set/Read */
  211. #define INTEL_82543GC_IMC               0xD8    /* Interrupt Mask Clear */
  212. #define INTEL_82543GC_CTRL              0x0     /* Device Control */
  213. #define INTEL_82543GC_STATUS            0x8 /* Device Status */
  214. #define INTEL_82543GC_EECD              0x10    /* EEPROM/Flash Data */
  215. #define INTEL_82543GC_CTRL_EXT          0x18    /* Extended Device Control */
  216. #define INTEL_82543GC_MDI               0x20    /* MDI Control */
  217. #define INTEL_82543GC_FCAL              0x28    /* Flow Control Adr Low */
  218. #define INTEL_82543GC_FCAH              0x2c    /* Flow Control Adr High */
  219. #define INTEL_82543GC_FCT               0x30    /* Flow Control Type */
  220. #define INTEL_82543GC_VET               0x38    /* VLAN EtherType */
  221. #define INTEL_82546EB_ITR               0xc4    /* register for 82540/5/6 MAC only, 
  222.                                                    interrupt throttle register */
  223. #define INTEL_82543GC_RCTL              0x100   /* Receive Control */
  224. #define INTEL_82543GC_FCTTV             0x170   /* Flow Ctrl TX Timer Value */
  225. #define INTEL_82543GC_TXCW              0x178   /* TX Configuration Word */
  226. #define INTEL_82543GC_RXCW              0x180   /* RX Configuration Word */
  227. #define INTEL_82543GC_TCTL              0x400   /* TX control */
  228. #define INTEL_82543GC_TIPG              0x410   /* Transmit IPG */
  229. #define INTEL_82543GC_PBA               0x1000  /* Packet Buffer Allocation */
  230. #define INTEL_82543GC_FCRTL             0x2160  /* Flow ctrl RX Threshold Lo*/
  231. #define INTEL_82543GC_FCRTH             0x2168  /* Flow ctrl RX Threshold hi*/
  232. #define INTEL_82543GC_RDTR              0x2820  /* Rx Delay Timer Ring */
  233. #define INTEL_82546EB_RADV              0x282C  /* register for 82540/5/6 MAC only,
  234.                                                    absolute Rx Delay Timer register */
  235. #define INTEL_82543GC_TIDV              0x3820  /* Tx Interrupt Delay Value */
  236. #define INTEL_82543GC_TXDCTL            0x3828  /* Transmit descriptor control */
  237. #define INTEL_82546EB_TADV              0x382C  /* register for 82540/5/6 MAC only,
  238.                                                    absolute Tx Interrupt Delay register */
  239. #define INTEL_82543GC_RXCSUM            0x5000  /* Receive Checksum control */
  240. #define INTEL_82543GC_MTA               0x5200  /* Multicast Table Array */
  241. #define INTEL_82543GC_RAL               0x5400  /* Rx Adr Low */
  242. #define INTEL_82543GC_RAH               0x5404  /* Rx Adr High */
  243. #define INTEL_82543GC_VLAN              0x5600  /* VLAN Filter Table Array */
  244. /* Statistic Registers */
  245. #define INTEL_82543GC_CRCERRS           0x4000
  246. #define INTEL_82543GC_ALGNERRC          0x4004
  247. #define INTEL_82543GC_SYMERRS           0x4008
  248. #define INTEL_82543GC_RXERRC            0x400c
  249. #define INTEL_82543GC_MPC               0x4010
  250. #define INTEL_82543GC_SCC               0x4014
  251. #define INTEL_82543GC_ECOL              0x4018
  252. #define INTEL_82543GC_MCC               0x401c
  253. #define INTEL_82543GC_LATECOL           0x4020
  254. #define INTEL_82543GC_COLC              0x4028
  255. #define INTEL_82543GC_TUC               0x402c
  256. #define INTEL_82543GC_DC                0x4030
  257. #define INTEL_82543GC_TNCRS             0x4034
  258. #define INTEL_82543GC_SEC               0x4038
  259. #define INTEL_82543GC_CEXTEER           0x403c
  260. #define INTEL_82543GC_RLEC              0x4040
  261. #define INTEL_82543GC_XONRXC            0x4048
  262. #define INTEL_82543GC_XONTXC            0x404c
  263. #define INTEL_82543GC_XOFFRXC           0x4050
  264. #define INTEL_82543GC_XOFFTXC           0x4054
  265. #define INTEL_82543GC_FCRUC             0x4058
  266. #define INTEL_82543GC_PRC64             0x405c
  267. #define INTEL_82543GC_PRC127            0x4060
  268. #define INTEL_82543GC_PRC255            0x4064
  269. #define INTEL_82543GC_PRC511            0x4068
  270. #define INTEL_82543GC_PRC1023           0x406c
  271. #define INTEL_82543GC_PRC1522           0x4070
  272. #define INTEL_82543GC_GPRC              0x4074
  273. #define INTEL_82543GC_BPRC              0x4078
  274. #define INTEL_82543GC_MPRC              0x407c
  275. #define INTEL_82543GC_GPTC              0x4080
  276. #define INTEL_82543GC_GORL              0x4088
  277. #define INTEL_82543GC_GORH              0x408c
  278. #define INTEL_82543GC_GOTL              0x4090
  279. #define INTEL_82543GC_GOTH              0x4094
  280. #define INTEL_82543GC_RNBC              0x40a0
  281. #define INTEL_82543GC_RUC               0x40a4
  282. #define INTEL_82543GC_RFC               0x40a8
  283. #define INTEL_82543GC_ROC               0x40ac
  284. #define INTEL_82543GC_RJC               0x40b0
  285. #define INTEL_82543GC_TORL              0x40c0
  286. #define INTEL_82543GC_TORH              0x40c4
  287. #define INTEL_82543GC_TOTL              0x40c8
  288. #define INTEL_82543GC_TOTH              0x40cc
  289. #define INTEL_82543GC_TPR               0x40d0
  290. #define INTEL_82543GC_TPT               0x40d4
  291. #define INTEL_82543GC_PTC64             0x40d8
  292. #define INTEL_82543GC_PTC127            0x40dc
  293. #define INTEL_82543GC_PTC255            0x40e0
  294. #define INTEL_82543GC_PTC511            0x40e4
  295. #define INTEL_82543GC_PTC1023           0x40e8
  296. #define INTEL_82543GC_PTC1522           0x40ec
  297. #define INTEL_82543GC_MPTC              0x40f0
  298. #define INTEL_82543GC_BPTC              0x40f4
  299. #define INTEL_82543GC_TSCTC             0x40f8
  300. #define INTEL_82543GC_TSCTFC            0x40fc
  301. #define INTEL_82543GC_RDFH              0x2410
  302. #define INTEL_82543GC_RDFT              0x2418
  303. #define INTEL_82543GC_RDFHS             0x2420
  304. #define INTEL_82543GC_RDFTS             0x2428
  305. #define INTEL_82543GC_RDFPC             0x2430
  306. #define INTEL_82543GC_TDFH              0x3410
  307. #define INTEL_82543GC_TDFT              0x3418
  308. #define INTEL_82543GC_TDFHS             0x3420
  309. #define INTEL_82543GC_TDFTS             0x3428
  310. #define INTEL_82543GC_TDFPC             0x3430
  311. /* Rx Configuration Word Field */
  312. #define RXCW_C_BIT                      0x20000000
  313. /* EEPROM Structure */
  314. #define EEPROM_WORD_SIZE                0x40      /* 0-0x3f */
  315. #define EEPROM_SUM                      0xBABA
  316. #define EEPROM_INDEX_SIZE               0x40
  317. #define EEPROM_INDEX_BITS               6
  318. #define EEPROM_CMD_BITS                 3
  319. #define EEPROM_DATA_BITS                16
  320. #define EEPROM_READ_OPCODE              0x6
  321. #define EEPROM_WRITE_OPCODE             0x5
  322. #define EEPROM_ERASE_OPCODE             0x7
  323. #define EEPROM_IA_ADDRESS               0x0
  324. #define EEPROM_ICW1                     0xa
  325. #define EEPROM_ICW1_SWDPIO_BITS         0x1e0
  326. #define EEPROM_ICW1_SWDPIO_SHIFT        5
  327. #define EEPROM_ICW1_ILOS_BIT            0x10
  328. #define EEPROM_ICW1_FRCSPD_BIT          0x800
  329. #define EEPROM_ICW1_ILOS_SHIFT          4
  330. #define EEPROM_ICW2                     0xf
  331. #define EEPROM_ICW2_PAUSE_BITS          0x3000
  332. #define EEPROM_ICW2_ASM_DIR             0x2000
  333. #define EEPROM_ICW2_SWDPIO_EXE_BITS     0xf0
  334. #define EEPROM_ICW2_SWDPIO_EXE_SHIFT    4
  335. #define BAR0_64_BIT                     0x04
  336. /* TX Descriptor Command Fields */
  337. #define TXD_CMD_EOP                     0x01
  338. #define TXD_CMD_IFCS                    0x02
  339. #define TXD_CMD_IC                      0x04
  340. #define TXD_CMD_RS                      0x08
  341. #define TXD_CMD_RPS                     0x10
  342. #define TXD_CMD_DEXT                    0x20
  343. #define TXD_CMD_VLE                     0x40
  344. #define TXD_CMD_IDE                     0x80
  345. /* for TX context descriptor only */
  346. #define TXD_CMD_TCP                     0x01
  347. #define TXD_CMD_IP                    0x02
  348. #define TXD_CMD_TSE                     0x04
  349. /* TX Descriptor Status Fields */
  350. #define TXD_STAT_DD                     0x01
  351. #define TXD_STAT_EC                     0x02
  352. #define TXD_STAT_LC                     0x04
  353. #define TXD_STAT_TU                     0x08
  354. /* TX Data Descriptor POPTS fields */
  355. #define TXD_DATA_POPTS_IXSM_BIT         0x01
  356. #define TXD_DATA_POPTS_TXSM_BIT         0x02
  357. /* TX Data Descriptor DTYP Fileld */ 
  358. #define TXD_DTYP_BIT                    0x01
  359. /* RX Descriptor Status Field */
  360. #define RXD_STAT_DD                     0x01
  361. #define RXD_STAT_EOP                    0x02
  362. #define RXD_STAT_IXSM                   0x04
  363. #define RXD_STAT_VP                     0x08
  364. #define RXD_STAT_RSV                    0x10
  365. #define RXD_STAT_TCPCS                  0x20
  366. #define RXD_STAT_IPCS                   0x40
  367. #define RXD_STAT_PIF                    0x80
  368. /* RX Descriptor Error Field */
  369. #define RXD_ERROR_CE                    0x01        /* CRC or Align error */
  370. #define RXD_ERROR_SE                    0x02        /* Symbol error */
  371. #define RXD_ERROR_SEQ                   0x04        /* Sequence error */
  372. #define RXD_ERROR_RSV                   0x08        /* reserved */
  373. #define RXD_ERROR_CXE                   0x10        /* Carrier ext error */
  374. #define RXD_ERROR_TCPE                  0x20        /* TCP/UDP CKSUM error */
  375. #define RXD_ERROR_IPE                   0x40        /* IP CKSUM error */
  376. #define RXD_ERROR_RXE                   0x80        /* RX data error */
  377. /* Interrupt Register Fields */
  378. #define INT_TXDW_BIT                    0x01        /* TX descriptor write-back */        
  379. #define INT_TXQE_BIT                    0x02        /* TX ring empty */
  380. #define INT_LSC_BIT                     0x04        /* link change interrupt */
  381. #define INT_RXSEQ_BIT                   0x08        /* RX sequence error */
  382. #define INT_RXDMT0_BIT                  0x10        /* RX descriptor Mini Threshold */
  383. #define INT_RXO_BIT                     0x40        /* RX FIFO overrun */
  384. #define INT_RXTO_BIT                    0x80        /* RX timer interrupt */
  385. #define INT_MDAC_BIT                    0x200       /* MDIO complete interrupt */
  386. #define INT_RXCFG_BIT                   0x400       /* Receiving /C/ ordered set */
  387. #define INT_GPI0_BIT                    0x800       /* GPIO 0 interrupt (543 MAC) */
  388. #define INT_GPI1_BIT                    0x1000      /* PHY (544 MAC) or GPIO1 (543) interrupt */ 
  389. #define INT_GPI2_BIT                    0x2000      /* GPIO2 interrupt */
  390. #define INT_GPI3_BIT                    0x4000      /* GPIO3 interrupt */
  391. #define INT_TXDLOW_BIT                  0x8000      /* TX descriptor low threshold hit */
  392. /* IMS register */ 
  393. #define IMS_TXDW_BIT                    0x01
  394. #define IMS_TXQE_BIT                    0x02
  395. #define IMS_LSC_BIT                     0x04
  396. #define IMS_RXSEQ_BIT                   0x08
  397. #define IMS_RXDMT0_BIT                  0x10
  398. #define IMS_RXO_BIT                     0x40
  399. #define IMS_RXTO_BIT                    0x80
  400. #define IMS_MDAC_BIT                    0x200
  401. #define IMS_RXCFG_BIT                   0x400
  402. #define IMS_TXDLOW_BIT                  0x8000
  403. /* IMC register */
  404. #define IMC_ALL_BITS                    0xffffffff
  405. #define IMC_TXDW_BIT                    0x01
  406. #define IMC_TXQE_BIT                    0x02
  407. #define IMC_LSC_BIT                     0x04
  408. #define IMC_RXSEQ_BIT                   0x08
  409. #define IMC_RXDMT0_BIT                  0x10
  410. #define IMC_RXO_BIT                     0x40
  411. #define IMC_RXTO_BIT                    0x80
  412. #define IMC_MDAC_BIT                    0x200
  413. #define IMC_RXCFG_BIT                   0x400
  414. #define IMC_TXDLOW_BIT                  0x8000
  415. /* ICR register */
  416. #define ICR_TXDW_BIT                    0x01
  417. #define ICR_TXQE_BIT                    0x02
  418. #define ICR_LSC_BIT                     0x04
  419. #define ICR_RXSEQ_BIT                   0x08
  420. #define ICR_RXDMT0_BIT                  0x10
  421. #define ICR_RXO_BIT                     0x40
  422. #define ICR_RXTO_BIT                    0x80
  423. #define ICR_MDAC_BIT                    0x200
  424. #define ICR_RXCFG_BIT                   0x400
  425. #define ICR_TXDLOW_BIT                  0x8000
  426. /* EEPROM Register Fields */
  427. #define EECD_SK_BIT                     0x1
  428. #define EECD_CS_BIT                     0x2
  429. #define EECD_DI_BIT                     0x4
  430. #define EECD_DO_BIT                     0x8
  431. #define EECD_REQ_BIT                    0x40
  432. #define EECD_GNT_BIT                    0x80
  433. #define EECD_PRES_BIT                   0x100
  434. #define EECD_SIZE_BIT                   0x200
  435. /* RAT field */
  436. #define RAH_AV_BIT                      0x80000000
  437. /* Control Register Field */
  438. #define CTRL_FD_BIT                     0x1
  439. #define CTRL_PRIOR_BIT                  0x4
  440. #define CTRL_ASDE_BIT                   0x20
  441. #define CTRL_SLU_BIT                    0x40
  442. #define CTRL_ILOS_BIT                   0x80
  443. #define CTRL_SPD_100_BIT                0x100
  444. #define CTRL_SPD_1000_BIT               0x200
  445. #define CTRL_FRCSPD_BIT                 0x800
  446. #define CTRL_FRCDPX_BIT                 0x1000
  447. #define CTRL_SWDPIN0_BIT                0x40000
  448. #define CTRL_SWDPIN1_BIT                0x80000
  449. #define CTRL_SWDPIN2_BIT                0x100000
  450. #define CTRL_SWDPIN3_BIT                0x200000
  451. #define CTRL_SWDPIO0_BIT                0x400000
  452. #define CTRL_SWDPIO1_BIT                0x800000
  453. #define CTRL_SWDPIO2_BIT                0x1000000
  454. #define CTRL_SWDPIO3_BIT                0x2000000
  455. #define CTRL_RST_BIT                    0x4000000
  456. #define CTRL_RFCE_BIT                   0x8000000
  457. #define CTRL_TFCE_BIT                   0x10000000
  458. #define CTRL_PHY_RST_BIT                0x80000000
  459. #define CTRL_MDC_BIT                    CTRL_SWDPIN3_BIT
  460. #define CTRL_MDIO_BIT                   CTRL_SWDPIN2_BIT
  461. #define CTRL_MDC_DIR_BIT                CTRL_SWDPIO3_BIT
  462. #define CTRL_MDIO_DIR_BIT               CTRL_SWDPIO2_BIT
  463. #define CTRL_SPEED_MASK                 0x300
  464. #define CTRL_SWDPIOLO_SHIFT             22
  465. #define CTRL_ILOS_SHIFT                 7
  466. /* Receive Control Register Fields */
  467. #define RCTL_MO_SHIFT                   12
  468. #define RCTL_BSIZE_2048                 0
  469. #define RCTL_BSIZE_4096                 0x00030000
  470. #define RCTL_BSIZE_8192                 0x00020000
  471. #define RCTL_BSIZE_16384                0x00010000
  472. #define RCTL_EN_BIT                     0x00000002
  473. #define RCTL_SBP_BIT                    0x00000004
  474. #define RCTL_UPE_BIT                    0x00000008
  475. #define RCTL_MPE_BIT                    0x00000010
  476. #define RCTL_LPE_BIT                    0x00000020
  477. #define RCTL_BAM_BIT                    0x00008000
  478. #define RCTL_BSEX_BIT                   0x02000000
  479. /* MDI register fields */
  480. #define MDI_WRITE_BIT                   0x4000000
  481. #define MDI_READ_BIT                    0x8000000
  482. #define MDI_READY_BIT                   0x10000000
  483. #define MDI_ERR_BIT                     0x40000000
  484. #define MDI_REG_SHIFT                   16
  485. #define MDI_PHY_SHIFT                   21
  486. /* Flow Control Field and Initial value */
  487. #define FCRTL_XONE_BIT                  0x80000000
  488. #define FLOW_CONTROL_LOW_ADR            0x00c28001
  489. #define FLOW_CONTROL_HIGH_ADR           0x00000100
  490. #define FLOW_CONTROL_TYPE               0x8808
  491. #define FLOW_CONTROL_TIMER_VALUE        0x100
  492. #define FLOW_CONTROL_LOW_THRESH         0x4000
  493. #define FLOW_CONTROL_HIGH_THRESH        0x8000
  494. /* Extended Control Register Fields */
  495. #define CTRL_EXT_SWDPIN4_BIT            0x10
  496. #define CTRL_EXT_SWDPIN5_BIT            0x20
  497. #define CTRL_EXT_SWDPIN6_BIT            0x40
  498. #define CTRL_EXT_SWDPIN7_BIT            0x80
  499. #define CTRL_EXT_SWDPIO4_BIT            0x100
  500. #define CTRL_EXT_SWDPIO5_BIT            0x200
  501. #define CTRL_EXT_SWDPIO6_BIT            0x400
  502. #define CTRL_EXT_SWDPIO7_BIT            0x800
  503. #define CTRL_EXT_SWDPIOHI_SHIFT         8
  504. #define CTRL_PHY_RESET_DIR4_BIT         CTRL_EXT_SWDPIO4_BIT
  505. #define CTRL_PHY_RESET4_BIT             CTRL_EXT_SWDPIN4_BIT
  506. /* Status Register Fields */
  507. #define STATUS_FD_BIT                   0x1
  508. #define STATUS_LU_BIT                   0x2
  509. #define STATUS_TBIMODE_BIT              0x20
  510. #define STATUS_SPEED_100_BIT            0x40
  511. #define STATUS_SPEED_1000_BIT           0x80
  512. /* TX control Regsiter Fields */
  513. #define TCTL_EN_BIT                     0x2
  514. #define TCTL_PSP_BIT                    0x8
  515. #define TCTL_PBE_BIT                    0x800000
  516. #define TCTL_COLD_BIT                   0x3ff000
  517. #define TCTL_COLD_SHIFT                 12
  518. #define TCLT_CT_SHIFT                   4
  519. /* TIPG Register Fields */
  520. #define TIPG_IPGR1_SHIFT                10
  521. #define TIPG_IPGR2_SHIFT                20
  522. /* RDTR Register Field */
  523. #define RDTR_FPD_BIT                    0x80000000
  524. /* TX Configuration Word fields */
  525. #define TXCW_ANE_BIT                    0x80000000
  526. #define TXCW_FD_BIT                     0x20
  527. #define TXCW_ASM_DIR                    0x100
  528. #define TXCW_PAUSE_BITS                 0x180
  529. /* RXCSUM register field */
  530. #define RXCSUM_IPOFL_BIT                0x0100
  531. #define RXCSUM_TUOFL_BIT                0x0200
  532. /* PHY's Registers And Initial Value*/
  533. #define PHY_PREAMBLE                    0xFFFFFFFF
  534. #define PHY_PREAMBLE_SIZE               32
  535. #define PHY_WR_OP                       0x01
  536. #define PHY_RD_OP                       0x02
  537. #define PHY_TURNAR                      0x02
  538. #define PHY_MARK                        0x01
  539. #define CL_OVERHEAD                     4
  540. /* Type define */
  541. typedef struct txDescManager TX_DESCTL;
  542. typedef TX_DESCTL * P_TX_DESCTL; 
  543. struct txDescManager    
  544.     {
  545.     M_BLK_ID  mBlk;             /* location for mBlk */
  546.     UINT32    txType;           /* TX desc type */
  547.     }; 
  548. typedef struct devDrv_stat
  549.     {
  550.     UINT32 rxtxHandlerNum;      /* num of rxtx handle routine was called per sec */ 
  551.     UINT32 rxIntCount; /* num of rx interrupt per sec */
  552.     UINT32 txIntCount; /* num of tx interrupt per sec */
  553.     UINT32 rxORunIntCount; /* num of rx overrun interrupt per sec */
  554.     UINT32 rxPacketNum;         /* num of rx packet per sec */
  555.     UINT32 txPacketNum;         /* num of tx packet per sec */
  556.     UINT32 rxPacketDrvErr; /* num of pkt rx error on driver per sec */
  557.     } DEVDRV_STAT;
  558. typedef struct dev_Timer
  559.     {
  560.     UINT32 rdtrVal;             /* RDTR, unit of 1.024ns */
  561.     UINT32 radvVal;             /* RADV, unit of 1.024us */
  562.     UINT32 itrVal;              /* ITR,  unit of 256 ns  */
  563.     UINT32 tidvVal;             /* TIDV, unit of 1.024us */
  564.     UINT32 tadvVal;             /* TADV, unit of 1.024us */
  565.     UINT32 watchDogIntVal;      /* interval of watchdog, unit of second */
  566.     } DEV_TIMER;
  567. struct adapter_info 
  568.     {
  569.     int    vector;          /* interrupt vector */
  570.     UINT32 regBaseLow;      /* register PCI base address - low  */
  571.     UINT32 regBaseHigh;     /* register PCI base address - high */
  572.     UINT32 flashBase;       /* flash PCI base address */
  573.     BOOL   adr64;           /* indictor of 64 bit address */
  574.     UINT32 boardType;       /* board type */
  575.     UINT32 phyType;         /* PHY type (MII/GMII) */
  576.     UINT32 delayUnit;       /* delay unit(in ns) for the delay function */
  577.     FUNCPTR delayFunc;      /* BSP specified delay function */        
  578.     STATUS (*intEnable)(int);    /* board specific interrupt enable routine */
  579.     STATUS (*intDisable)(int);   /* board specific interrupt disable routine */
  580.     STATUS (*intAck) (int);      /* interrupt ack */
  581.     void   (*phySpecInit)(PHY_INFO *, UINT8); /* vendor specified PHY's init */
  582.     UINT32 (*sysLocalToBus)(int,UINT32);
  583.     UINT32 (*sysBusToLocal)(int,UINT32);
  584.     FUNCPTR intConnect;     /* interrupt connect function */ 
  585.     FUNCPTR intDisConnect;  /* interrupt disconnect function */
  586.     UINT16  eeprom_icw1;    /* ICW1 in EEPROM */
  587.     UINT16  eeprom_icw2;    /* ICW2 in EEPROM */
  588.     UCHAR   enetAddr[6];    /* Ether address for this adaptor */ 
  589.     UCHAR   reserved1[2];   /* reserved */
  590.     FUNCPTR phyDelayRtn;    /* phy delay function */ 
  591.     UINT32  phyMaxDelay;    /* max phy detection retry */
  592.     UINT32  phyDelayParm;   /* delay parameter for phy delay function */
  593.     UINT32  phyAddr;        /* phy Addr */
  594.     BOOL   (*sysGeiDynaTimerSetup)(struct adapter_info *); /* adjust device's timer dynamically */
  595.     BOOL   (*sysGeiInitTimerSetup)(struct adapter_info *); /* set the device's timer initially */
  596.     DEVDRV_STAT devDrvStat;       /* statistic data for devices */
  597.     DEV_TIMER   devTimerUpdate;   /* timer register value for update */
  598.     };
  599. typedef struct adapter_info ADAPTOR_INFO;
  600. /* structure for Statistic registers */
  601. typedef struct sta_reg 
  602.     {
  603.     UINT32    crcerrs;       /* CRC error count */
  604.     UINT32    algnerrc;      /* alignment err count */
  605.     UINT32    symerrs;       /* symbol err count */
  606.     UINT32    rxerrc;        /* rx err count */
  607.     UINT32    mpc;           /* missed packet count */
  608.     UINT32    scc;           /* single collision count */
  609.     UINT32    ecol;          /* excessive collision count */
  610.     UINT32    mcc;           /* multi collision count */
  611.     UINT32    latecol;       /* later collision count */
  612.     UINT32    colc;          /* collision count */
  613.     UINT32    tuc;           /* tx underun count */
  614.     UINT32    dc;            /* defer count */
  615.     UINT32    tncrs;         /* tx - no crs count */
  616.     UINT32    sec;           /* sequence err count */
  617.     UINT32    cexteer;       /* carrier extension count */
  618.     UINT32    rlec;          /* rx length error count */
  619.     UINT32    xonrxc;        /* XON receive count */
  620.     UINT32    xontxc;        /* XON transmit count */
  621.     UINT32    xoffrxc;       /* XOFF receive count */
  622.     UINT32    xofftxc;       /* XFF transmit count */
  623.     UINT32    fcruc;         /* FC received unsupported count */
  624.     UINT32    prc64;         /* packet rx (64 byte) count */
  625.     UINT32    prc127;        /* packet rx (65 - 127 byte) count */
  626.     UINT32    prc255;        /* packet rx (128 - 255 byte) count */
  627.     UINT32    prc511;        /* packet rx (256 - 511 byte) count */
  628.     UINT32    prc1023;       /* packet rx (512 - 1023 byte) count */
  629.     UINT32    prc1522;       /* packet rx (1024 - 1522 byte) count */
  630.     UINT32    gprc;          /* good packet received count */
  631.     UINT32    bprc;          /* broadcast packet received count */
  632.     UINT32    mprc;          /* Multicast packet received count */
  633.     UINT32    gptc;          /* good packet transmit count */
  634.     UINT32    gorl;          /* good octets receive count (low) */
  635.     UINT32    gorh;          /* good octets received count (high) */
  636.     UINT32    gotl;          /* good octets transmit count (lo) */
  637.     UINT32    goth;          /* good octets transmit count (hi) */
  638.     UINT32    rnbc;          /* receive no buffer count */
  639.     UINT32    ruc;           /* receive undersize count */
  640.     UINT32    rfc;           /* receive fragment count */
  641.     UINT32    roc;           /* receive oversize count */
  642.     UINT32    rjc;           /* receive Jabber count */
  643.     UINT32    torl;          /* total octets received (lo) */
  644.     UINT32    torh;          /* total octets received (hi) */
  645.     UINT32    totl;          /* total octets transmit (lo) */
  646.     UINT32    toth;          /* total octets transmit (hi) */
  647.     UINT32    tpr;           /* total packet received */
  648.     UINT32    tpt;           /* total packet transmit */
  649.     UINT32    ptc64;         /* packet transmit (64 byte) count */
  650.     UINT32    ptc127;        /* packet transmit (65-127 byte) count */
  651.     UINT32    ptc255;        /* packet transmit (128-255 byte) count */  
  652.     UINT32    ptc511;        /* packet transmit (256-511 byte) count */
  653.     UINT32    ptc1023;       /* packet transmit (512-1023 byte) count */
  654.     UINT32    ptc1522;       /* packet transmit (1024-1522 byte) count */
  655.     UINT32    mptc;          /* Multicast packet transmit count */
  656.     UINT32    bptc;          /* Broadcast packet transmit count */
  657.     UINT32    tsctc;         /* TCP segmentation context tx count */
  658.     UINT32    tsctfc;        /* TCP segmentation context tx fail count */      
  659.     UINT32    rdfh;          /* rx data FIFO head */
  660.     UINT32    rdft;          /* rx data FIFO tail */
  661.     UINT32    rdfhs;         /* rx data FIFO head saved register */
  662.     UINT32    rdfts;         /* rx data FIFO tail saved register */
  663.     UINT32    rdfpc;         /* rx data FIFO packet count */
  664.     UINT32    tdfh;          /* tx data FIFO head */
  665.     UINT32    tdft;          /* tx data FIFO tail */
  666.     UINT32    tdfhs;         /* tx data FIFO head saved register */
  667.     UINT32    tdfts;         /* tx data FIFO tail saved register */
  668.     UINT32    tdfpc;         /* tx data FIFO packet count */
  669.     } STA_REG;
  670. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  671. #pragma align 0                 /* turn off alignment requirement */
  672. #endif  /* CPU_FAMILY==I960 */
  673. #if defined(__STDC__) || defined(__cplusplus)
  674. IMPORT END_OBJ * gei82543EndLoad (char * initString);
  675. #else
  676. IMPORT END_OBJ * gei82543EndLoad ();
  677. #endif /* defined(__STDC__) || defined(__cplusplus) */
  678. #ifdef __cplusplus
  679. }
  680. #endif
  681. #endif /* __INCGEI82543Endh */