ewrk3.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. /*
  2. Written 1994 by David C. Davies.
  3. Copyright 1994 Digital Equipment Corporation.
  4. This software may be used and distributed according to the terms of the
  5. GNU General Public License, incorporated herein by reference.
  6. The author may be reached as davies@wanton.lkg.dec.com or Digital
  7. Equipment Corporation, 550 King Street, Littleton MA 01460.
  8. =========================================================================
  9. */
  10. /*
  11. ** I/O Address Register Map
  12. */
  13. #define EWRK3_CSR iobase+0x00 /* Control and Status Register */
  14. #define EWRK3_CR iobase+0x01 /* Control Register */
  15. #define EWRK3_ICR iobase+0x02 /* Interrupt Control Register */
  16. #define EWRK3_TSR iobase+0x03 /* Transmit Status Register */
  17. #define EWRK3_RSVD1 iobase+0x04 /* RESERVED */
  18. #define EWRK3_RSVD2 iobase+0x05 /* RESERVED */
  19. #define EWRK3_FMQ iobase+0x06 /* Free Memory Queue */
  20. #define EWRK3_FMQC iobase+0x07 /* Free Memory Queue Counter */
  21. #define EWRK3_RQ iobase+0x08 /* Receive Queue */
  22. #define EWRK3_RQC iobase+0x09 /* Receive Queue Counter */
  23. #define EWRK3_TQ iobase+0x0a /* Transmit Queue */
  24. #define EWRK3_TQC iobase+0x0b /* Transmit Queue Counter */
  25. #define EWRK3_TDQ iobase+0x0c /* Transmit Done Queue */
  26. #define EWRK3_TDQC iobase+0x0d /* Transmit Done Queue Counter */
  27. #define EWRK3_PIR1 iobase+0x0e /* Page Index Register 1 */
  28. #define EWRK3_PIR2 iobase+0x0f /* Page Index Register 2 */
  29. #define EWRK3_DATA iobase+0x10 /* Data Register */
  30. #define EWRK3_IOPR iobase+0x11 /* I/O Page Register */
  31. #define EWRK3_IOBR iobase+0x12 /* I/O Base Register */
  32. #define EWRK3_MPR iobase+0x13 /* Memory Page Register */
  33. #define EWRK3_MBR iobase+0x14 /* Memory Base Register */
  34. #define EWRK3_APROM iobase+0x15 /* Address PROM */
  35. #define EWRK3_EPROM1 iobase+0x16 /* EEPROM Data Register 1 */
  36. #define EWRK3_EPROM2 iobase+0x17 /* EEPROM Data Register 2 */
  37. #define EWRK3_PAR0 iobase+0x18 /* Physical Address Register 0 */
  38. #define EWRK3_PAR1 iobase+0x19 /* Physical Address Register 1 */
  39. #define EWRK3_PAR2 iobase+0x1a /* Physical Address Register 2 */
  40. #define EWRK3_PAR3 iobase+0x1b /* Physical Address Register 3 */
  41. #define EWRK3_PAR4 iobase+0x1c /* Physical Address Register 4 */
  42. #define EWRK3_PAR5 iobase+0x1d /* Physical Address Register 5 */
  43. #define EWRK3_CMR iobase+0x1e /* Configuration/Management Register */
  44. /*
  45. ** Control Page Map
  46. */
  47. #define PAGE0_FMQ 0x000 /* Free Memory Queue */
  48. #define PAGE0_RQ 0x080 /* Receive Queue */
  49. #define PAGE0_TQ 0x100 /* Transmit Queue */
  50. #define PAGE0_TDQ 0x180 /* Transmit Done Queue */
  51. #define PAGE0_HTE 0x200 /* Hash Table Entries */
  52. #define PAGE0_RSVD 0x240 /* RESERVED */
  53. #define PAGE0_USRD 0x600 /* User Data */
  54. /*
  55. ** Control and Status Register bit definitions (EWRK3_CSR)
  56. */
  57. #define CSR_RA 0x80 /* Runt Accept */
  58. #define CSR_PME 0x40 /* Promiscuous Mode Enable */
  59. #define CSR_MCE 0x20 /* Multicast Enable */
  60. #define CSR_TNE 0x08 /* TX Done Queue Not Empty */
  61. #define CSR_RNE 0x04 /* RX Queue Not Empty */
  62. #define CSR_TXD 0x02 /* TX Disable */
  63. #define CSR_RXD 0x01 /* RX Disable */
  64. /*
  65. ** Control Register bit definitions (EWRK3_CR)
  66. */
  67. #define CR_APD 0x80 /* Auto Port Disable */
  68. #define CR_PSEL 0x40 /* Port Select (0->TP port) */
  69. #define CR_LBCK 0x20 /* LoopBaCK enable */
  70. #define CR_FDUP 0x10 /* Full DUPlex enable */
  71. #define CR_FBUS 0x08 /* Fast BUS enable (ISA clk > 8.33MHz) */
  72. #define CR_EN_16 0x04 /* ENable 16 bit memory accesses */
  73. #define CR_LED 0x02 /* LED (1-> turn on) */
  74. /*
  75. ** Interrupt Control Register bit definitions (EWRK3_ICR)
  76. */
  77. #define ICR_IE 0x80 /* Interrupt Enable */
  78. #define ICR_IS 0x60 /* Interrupt Selected */
  79. #define ICR_TNEM 0x08 /* TNE Mask (0->mask) */
  80. #define ICR_RNEM 0x04 /* RNE Mask (0->mask) */
  81. #define ICR_TXDM 0x02 /* TXD Mask (0->mask) */
  82. #define ICR_RXDM 0x01 /* RXD Mask (0->mask) */
  83. /*
  84. ** Transmit Status Register bit definitions (EWRK3_TSR)
  85. */
  86. #define TSR_NCL 0x80 /* No Carrier Loopback */
  87. #define TSR_ID 0x40 /* Initially Deferred */
  88. #define TSR_LCL 0x20 /* Late CoLlision */
  89. #define TSR_ECL 0x10 /* Excessive CoLlisions */
  90. #define TSR_RCNTR 0x0f /* Retries CouNTeR */
  91. /*
  92. ** I/O Page Register bit definitions (EWRK3_IOPR)
  93. */
  94. #define EEPROM_INIT 0xc0 /* EEPROM INIT command */
  95. #define EEPROM_WR_EN 0xc8 /* EEPROM WRITE ENABLE command */
  96. #define EEPROM_WR 0xd0 /* EEPROM WRITE command */
  97. #define EEPROM_WR_DIS 0xd8 /* EEPROM WRITE DISABLE command */
  98. #define EEPROM_RD 0xe0 /* EEPROM READ command */
  99. /*
  100. ** I/O Base Register bit definitions (EWRK3_IOBR)
  101. */
  102. #define EISA_REGS_EN 0x20 /* Enable EISA ID and Control Registers */
  103. #define EISA_IOB 0x1f /* Compare bits for I/O Base Address */
  104. /*
  105. ** I/O Configuration/Management Register bit definitions (EWRK3_CMR)
  106. */
  107. #define CMR_RA 0x80 /* Read Ahead */
  108. #define CMR_WB 0x40 /* Write Behind */
  109. #define CMR_LINK 0x20 /* 0->TP */
  110. #define CMR_POLARITY 0x10 /* Informational */
  111. #define CMR_NO_EEPROM 0x0c /* NO_EEPROM<1:0> pin status */
  112. #define CMR_HS 0x08 /* Hard Strapped pin status (LeMAC2) */
  113. #define CMR_PNP 0x04 /* Plug 'n Play */
  114. #define CMR_DRAM 0x02 /* 0-> 1DRAM, 1-> 2 DRAM on board */
  115. #define CMR_0WS 0x01 /* Zero Wait State */
  116. /*
  117. ** MAC Receive Status Register bit definitions
  118. */
  119. #define R_ROK 0x80 /* Receive OK summary */
  120. #define R_IAM 0x10 /* Individual Address Match */
  121. #define R_MCM 0x08 /* MultiCast Match */
  122. #define R_DBE 0x04 /* Dribble Bit Error */
  123. #define R_CRC 0x02 /* CRC error */
  124. #define R_PLL 0x01 /* Phase Lock Lost */
  125. /*
  126. ** MAC Transmit Control Register bit definitions
  127. */
  128. #define TCR_SQEE 0x40 /* SQE Enable - look for heartbeat */
  129. #define TCR_SED 0x20 /* Stop when Error Detected */
  130. #define TCR_QMODE 0x10 /* Q_MODE */
  131. #define TCR_LAB 0x08 /* Less Aggressive Backoff */
  132. #define TCR_PAD 0x04 /* PAD Runt Packets */
  133. #define TCR_IFC 0x02 /* Insert Frame Check */
  134. #define TCR_ISA 0x01 /* Insert Source Address */
  135. /*
  136. ** MAC Transmit Status Register bit definitions
  137. */
  138. #define T_VSTS 0x80 /* Valid STatuS */
  139. #define T_CTU 0x40 /* Cut Through Used */
  140. #define T_SQE 0x20 /* Signal Quality Error */
  141. #define T_NCL 0x10 /* No Carrier Loopback */
  142. #define T_LCL 0x08 /* Late Collision */
  143. #define T_ID 0x04 /* Initially Deferred */
  144. #define T_COLL 0x03 /* COLLision status */
  145. #define T_XCOLL 0x03 /* Excessive Collisions */
  146. #define T_MCOLL 0x02 /* Multiple Collisions */
  147. #define T_OCOLL 0x01 /* One Collision */
  148. #define T_NOCOLL 0x00 /* No Collisions */
  149. #define T_XUR 0x03 /* Excessive Underruns */
  150. #define T_TXE 0x7f /* TX Errors */
  151. /*
  152. ** EISA Configuration Register bit definitions
  153. */
  154. #define EISA_ID iobase + 0x0c80 /* EISA ID Registers */
  155. #define EISA_ID0 iobase + 0x0c80 /* EISA ID Register 0 */
  156. #define EISA_ID1 iobase + 0x0c81 /* EISA ID Register 1 */
  157. #define EISA_ID2 iobase + 0x0c82 /* EISA ID Register 2 */
  158. #define EISA_ID3 iobase + 0x0c83 /* EISA ID Register 3 */
  159. #define EISA_CR iobase + 0x0c84 /* EISA Control Register */
  160. /*
  161. ** EEPROM BYTES
  162. */
  163. #define EEPROM_MEMB 0x00
  164. #define EEPROM_IOB 0x01
  165. #define EEPROM_EISA_ID0 0x02
  166. #define EEPROM_EISA_ID1 0x03
  167. #define EEPROM_EISA_ID2 0x04
  168. #define EEPROM_EISA_ID3 0x05
  169. #define EEPROM_MISC0 0x06
  170. #define EEPROM_MISC1 0x07
  171. #define EEPROM_PNAME7 0x08
  172. #define EEPROM_PNAME6 0x09
  173. #define EEPROM_PNAME5 0x0a
  174. #define EEPROM_PNAME4 0x0b
  175. #define EEPROM_PNAME3 0x0c
  176. #define EEPROM_PNAME2 0x0d
  177. #define EEPROM_PNAME1 0x0e
  178. #define EEPROM_PNAME0 0x0f
  179. #define EEPROM_SWFLAGS 0x10
  180. #define EEPROM_HWCAT 0x11
  181. #define EEPROM_NETMAN2 0x12
  182. #define EEPROM_REVLVL 0x13
  183. #define EEPROM_NETMAN0 0x14
  184. #define EEPROM_NETMAN1 0x15
  185. #define EEPROM_CHIPVER 0x16
  186. #define EEPROM_SETUP 0x17
  187. #define EEPROM_PADDR0 0x18
  188. #define EEPROM_PADDR1 0x19
  189. #define EEPROM_PADDR2 0x1a
  190. #define EEPROM_PADDR3 0x1b
  191. #define EEPROM_PADDR4 0x1c
  192. #define EEPROM_PADDR5 0x1d
  193. #define EEPROM_PA_CRC 0x1e
  194. #define EEPROM_CHKSUM 0x1f
  195. /*
  196. ** EEPROM bytes for checksumming
  197. */
  198. #define EEPROM_MAX 32 /* bytes */
  199. /*
  200. ** EEPROM MISCELLANEOUS FLAGS
  201. */
  202. #define RBE_SHADOW 0x0100 /* Remote Boot Enable Shadow */
  203. #define READ_AHEAD 0x0080 /* Read Ahead feature */
  204. #define IRQ_SEL2 0x0070 /* IRQ line selection (LeMAC2) */
  205. #define IRQ_SEL 0x0060 /* IRQ line selection */
  206. #define FAST_BUS 0x0008 /* ISA Bus speeds > 8.33MHz */
  207. #define ENA_16 0x0004 /* Enables 16 bit memory transfers */
  208. #define WRITE_BEHIND 0x0002 /* Write Behind feature */
  209. #define _0WS_ENA 0x0001 /* Zero Wait State Enable */
  210. /*
  211. ** EEPROM NETWORK MANAGEMENT FLAGS
  212. */
  213. #define NETMAN_POL 0x04 /* Polarity defeat */
  214. #define NETMAN_LINK 0x02 /* Link defeat */
  215. #define NETMAN_CCE 0x01 /* Custom Counters Enable */
  216. /*
  217. ** EEPROM SW FLAGS
  218. */
  219. #define SW_SQE 0x10 /* Signal Quality Error */
  220. #define SW_LAB 0x08 /* Less Aggressive Backoff */
  221. #define SW_INIT 0x04 /* Initialized */
  222. #define SW_TIMEOUT 0x02 /* 0:2.5 mins, 1: 30 secs */
  223. #define SW_REMOTE 0x01 /* Remote Boot Enable -> 1 */
  224. /*
  225. ** EEPROM SETUP FLAGS
  226. */
  227. #define SETUP_APD 0x80 /* AutoPort Disable */
  228. #define SETUP_PS 0x40 /* Port Select */
  229. #define SETUP_MP 0x20 /* MultiPort */
  230. #define SETUP_1TP 0x10 /* 1 port, TP */
  231. #define SETUP_1COAX 0x00 /* 1 port, Coax */
  232. #define SETUP_DRAM 0x02 /* Number of DRAMS on board */
  233. /*
  234. ** EEPROM MANAGEMENT FLAGS
  235. */
  236. #define MGMT_CCE 0x01 /* Custom Counters Enable */
  237. /*
  238. ** EEPROM VERSIONS
  239. */
  240. #define LeMAC 0x11
  241. #define LeMAC2 0x12
  242. /*
  243. ** Miscellaneous
  244. */
  245. #define EEPROM_WAIT_TIME 1000 /* Number of microseconds */
  246. #define EISA_EN 0x0001 /* Enable EISA bus buffers */
  247. #define HASH_TABLE_LEN 512 /* Bits */
  248. #define XCT 0x80 /* Transmit Cut Through */
  249. #define PRELOAD 16 /* 4 long words */
  250. #define MASK_INTERRUPTS 1
  251. #define UNMASK_INTERRUPTS 0
  252. #define EEPROM_OFFSET(a) ((u_short)((u_long)(a)))
  253. /*
  254. ** Include the IOCTL stuff
  255. */
  256. #include <linux/sockios.h>
  257. #define EWRK3IOCTL SIOCDEVPRIVATE
  258. struct ewrk3_ioctl {
  259. unsigned short cmd; /* Command to run */
  260. unsigned short len; /* Length of the data buffer */
  261. unsigned char __user *data; /* Pointer to the data buffer */
  262. };
  263. /*
  264. ** Recognised commands for the driver
  265. */
  266. #define EWRK3_GET_HWADDR 0x01 /* Get the hardware address */
  267. #define EWRK3_SET_HWADDR 0x02 /* Get the hardware address */
  268. #define EWRK3_SET_PROM 0x03 /* Set Promiscuous Mode */
  269. #define EWRK3_CLR_PROM 0x04 /* Clear Promiscuous Mode */
  270. #define EWRK3_SAY_BOO 0x05 /* Say "Boo!" to the kernel log file */
  271. #define EWRK3_GET_MCA 0x06 /* Get a multicast address */
  272. #define EWRK3_SET_MCA 0x07 /* Set a multicast address */
  273. #define EWRK3_CLR_MCA 0x08 /* Clear a multicast address */
  274. #define EWRK3_MCA_EN 0x09 /* Enable a multicast address group */
  275. #define EWRK3_GET_STATS 0x0a /* Get the driver statistics */
  276. #define EWRK3_CLR_STATS 0x0b /* Zero out the driver statistics */
  277. #define EWRK3_GET_CSR 0x0c /* Get the CSR Register contents */
  278. #define EWRK3_SET_CSR 0x0d /* Set the CSR Register contents */
  279. #define EWRK3_GET_EEPROM 0x0e /* Get the EEPROM contents */
  280. #define EWRK3_SET_EEPROM 0x0f /* Set the EEPROM contents */
  281. #define EWRK3_GET_CMR 0x10 /* Get the CMR Register contents */
  282. #define EWRK3_CLR_TX_CUT_THRU 0x11 /* Clear the TX cut through mode */
  283. #define EWRK3_SET_TX_CUT_THRU 0x12 /* Set the TX cut through mode */