ni52.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /*
  2. * Intel i82586 Ethernet definitions
  3. *
  4. * This is an extension to the Linux operating system, and is covered by the
  5. * same GNU General Public License that covers that work.
  6. *
  7. * copyrights (c) 1994 by Michael Hipp (hippm@informatik.uni-tuebingen.de)
  8. *
  9. * I have done a look in the following sources:
  10. * crynwr-packet-driver by Russ Nelson
  11. * Garret A. Wollman's i82586-driver for BSD
  12. */
  13. #define NI52_RESET 0 /* writing to this address, resets the i82586 */
  14. #define NI52_ATTENTION 1 /* channel attention, kick the 586 */
  15. #define NI52_TENA 3 /* 2-5 possibly wrong, Xmit enable */
  16. #define NI52_TDIS 2 /* Xmit disable */
  17. #define NI52_INTENA 5 /* Interrupt enable */
  18. #define NI52_INTDIS 4 /* Interrupt disable */
  19. #define NI52_MAGIC1 6 /* dunno exact function */
  20. #define NI52_MAGIC2 7 /* dunno exact function */
  21. #define NI52_MAGICVAL1 0x00 /* magic-values for ni5210 card */
  22. #define NI52_MAGICVAL2 0x55
  23. /*
  24. * where to find the System Configuration Pointer (SCP)
  25. */
  26. #define SCP_DEFAULT_ADDRESS 0xfffff4
  27. /*
  28. * System Configuration Pointer Struct
  29. */
  30. struct scp_struct
  31. {
  32. u16 zero_dum0; /* has to be zero */
  33. u8 sysbus; /* 0=16Bit,1=8Bit */
  34. u8 zero_dum1; /* has to be zero for 586 */
  35. u16 zero_dum2;
  36. u16 zero_dum3;
  37. u32 iscp; /* pointer to the iscp-block */
  38. };
  39. /*
  40. * Intermediate System Configuration Pointer (ISCP)
  41. */
  42. struct iscp_struct
  43. {
  44. u8 busy; /* 586 clears after successful init */
  45. u8 zero_dummy; /* has to be zero */
  46. u16 scb_offset; /* pointeroffset to the scb_base */
  47. u32 scb_base; /* base-address of all 16-bit offsets */
  48. };
  49. /*
  50. * System Control Block (SCB)
  51. */
  52. struct scb_struct
  53. {
  54. u8 rus;
  55. u8 cus;
  56. u8 cmd_ruc; /* command word: RU part */
  57. u8 cmd_cuc; /* command word: CU part & ACK */
  58. u16 cbl_offset; /* pointeroffset, command block list */
  59. u16 rfa_offset; /* pointeroffset, receive frame area */
  60. u16 crc_errs; /* CRC-Error counter */
  61. u16 aln_errs; /* alignmenterror counter */
  62. u16 rsc_errs; /* Resourceerror counter */
  63. u16 ovrn_errs; /* OVerrunerror counter */
  64. };
  65. /*
  66. * possible command values for the command word
  67. */
  68. #define RUC_MASK 0x0070 /* mask for RU commands */
  69. #define RUC_NOP 0x0000 /* NOP-command */
  70. #define RUC_START 0x0010 /* start RU */
  71. #define RUC_RESUME 0x0020 /* resume RU after suspend */
  72. #define RUC_SUSPEND 0x0030 /* suspend RU */
  73. #define RUC_ABORT 0x0040 /* abort receiver operation immediately */
  74. #define CUC_MASK 0x07 /* mask for CU command */
  75. #define CUC_NOP 0x00 /* NOP-command */
  76. #define CUC_START 0x01 /* start execution of 1. cmd on the CBL */
  77. #define CUC_RESUME 0x02 /* resume after suspend */
  78. #define CUC_SUSPEND 0x03 /* Suspend CU */
  79. #define CUC_ABORT 0x04 /* abort command operation immediately */
  80. #define ACK_MASK 0xf0 /* mask for ACK command */
  81. #define ACK_CX 0x80 /* acknowledges STAT_CX */
  82. #define ACK_FR 0x40 /* ack. STAT_FR */
  83. #define ACK_CNA 0x20 /* ack. STAT_CNA */
  84. #define ACK_RNR 0x10 /* ack. STAT_RNR */
  85. /*
  86. * possible status values for the status word
  87. */
  88. #define STAT_MASK 0xf0 /* mask for cause of interrupt */
  89. #define STAT_CX 0x80 /* CU finished cmd with its I bit set */
  90. #define STAT_FR 0x40 /* RU finished receiving a frame */
  91. #define STAT_CNA 0x20 /* CU left active state */
  92. #define STAT_RNR 0x10 /* RU left ready state */
  93. #define CU_STATUS 0x7 /* CU status, 0=idle */
  94. #define CU_SUSPEND 0x1 /* CU is suspended */
  95. #define CU_ACTIVE 0x2 /* CU is active */
  96. #define RU_STATUS 0x70 /* RU status, 0=idle */
  97. #define RU_SUSPEND 0x10 /* RU suspended */
  98. #define RU_NOSPACE 0x20 /* RU no resources */
  99. #define RU_READY 0x40 /* RU is ready */
  100. /*
  101. * Receive Frame Descriptor (RFD)
  102. */
  103. struct rfd_struct
  104. {
  105. u8 stat_low; /* status word */
  106. u8 stat_high; /* status word */
  107. u8 rfd_sf; /* 82596 mode only */
  108. u8 last; /* Bit15,Last Frame on List / Bit14,suspend */
  109. u16 next; /* linkoffset to next RFD */
  110. u16 rbd_offset; /* pointeroffset to RBD-buffer */
  111. u8 dest[6]; /* ethernet-address, destination */
  112. u8 source[6]; /* ethernet-address, source */
  113. u16 length; /* 802.3 frame-length */
  114. u16 zero_dummy; /* dummy */
  115. };
  116. #define RFD_LAST 0x80 /* last: last rfd in the list */
  117. #define RFD_SUSP 0x40 /* last: suspend RU after */
  118. #define RFD_COMPL 0x80
  119. #define RFD_OK 0x20
  120. #define RFD_BUSY 0x40
  121. #define RFD_ERR_LEN 0x10 /* Length error (if enabled length-checking */
  122. #define RFD_ERR_CRC 0x08 /* CRC error */
  123. #define RFD_ERR_ALGN 0x04 /* Alignment error */
  124. #define RFD_ERR_RNR 0x02 /* status: receiver out of resources */
  125. #define RFD_ERR_OVR 0x01 /* DMA Overrun! */
  126. #define RFD_ERR_FTS 0x0080 /* Frame to short */
  127. #define RFD_ERR_NEOP 0x0040 /* No EOP flag (for bitstuffing only) */
  128. #define RFD_ERR_TRUN 0x0020 /* (82596 only/SF mode) indicates truncated frame */
  129. #define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matches IA (only 82596) */
  130. #define RFD_COLLDET 0x0001 /* Detected collision during reception */
  131. /*
  132. * Receive Buffer Descriptor (RBD)
  133. */
  134. struct rbd_struct
  135. {
  136. u16 status; /* status word,number of used bytes in buff */
  137. u16 next; /* pointeroffset to next RBD */
  138. u32 buffer; /* receive buffer address pointer */
  139. u16 size; /* size of this buffer */
  140. u16 zero_dummy; /* dummy */
  141. };
  142. #define RBD_LAST 0x8000 /* last buffer */
  143. #define RBD_USED 0x4000 /* this buffer has data */
  144. #define RBD_MASK 0x3fff /* size-mask for length */
  145. /*
  146. * Statusvalues for Commands/RFD
  147. */
  148. #define STAT_COMPL 0x8000 /* status: frame/command is complete */
  149. #define STAT_BUSY 0x4000 /* status: frame/command is busy */
  150. #define STAT_OK 0x2000 /* status: frame/command is ok */
  151. /*
  152. * Action-Commands
  153. */
  154. #define CMD_NOP 0x0000 /* NOP */
  155. #define CMD_IASETUP 0x0001 /* initial address setup command */
  156. #define CMD_CONFIGURE 0x0002 /* configure command */
  157. #define CMD_MCSETUP 0x0003 /* MC setup command */
  158. #define CMD_XMIT 0x0004 /* transmit command */
  159. #define CMD_TDR 0x0005 /* time domain reflectometer (TDR) command */
  160. #define CMD_DUMP 0x0006 /* dump command */
  161. #define CMD_DIAGNOSE 0x0007 /* diagnose command */
  162. /*
  163. * Action command bits
  164. */
  165. #define CMD_LAST 0x8000 /* indicates last command in the CBL */
  166. #define CMD_SUSPEND 0x4000 /* suspend CU after this CB */
  167. #define CMD_INT 0x2000 /* generate interrupt after execution */
  168. /*
  169. * NOP - command
  170. */
  171. struct nop_cmd_struct
  172. {
  173. u16 cmd_status; /* status of this command */
  174. u16 cmd_cmd; /* the command itself (+bits) */
  175. u16 cmd_link; /* offsetpointer to next command */
  176. };
  177. /*
  178. * IA Setup command
  179. */
  180. struct iasetup_cmd_struct
  181. {
  182. u16 cmd_status;
  183. u16 cmd_cmd;
  184. u16 cmd_link;
  185. u8 iaddr[6];
  186. };
  187. /*
  188. * Configure command
  189. */
  190. struct configure_cmd_struct
  191. {
  192. u16 cmd_status;
  193. u16 cmd_cmd;
  194. u16 cmd_link;
  195. u8 byte_cnt; /* size of the config-cmd */
  196. u8 fifo; /* fifo/recv monitor */
  197. u8 sav_bf; /* save bad frames (bit7=1)*/
  198. u8 adr_len; /* adr_len(0-2),al_loc(3),pream(4-5),loopbak(6-7)*/
  199. u8 priority; /* lin_prio(0-2),exp_prio(4-6),bof_metd(7) */
  200. u8 ifs; /* inter frame spacing */
  201. u8 time_low; /* slot time low */
  202. u8 time_high; /* slot time high(0-2) and max. retries(4-7) */
  203. u8 promisc; /* promisc-mode(0) , et al (1-7) */
  204. u8 carr_coll; /* carrier(0-3)/collision(4-7) stuff */
  205. u8 fram_len; /* minimal frame len */
  206. u8 dummy; /* dummy */
  207. };
  208. /*
  209. * Multicast Setup command
  210. */
  211. struct mcsetup_cmd_struct
  212. {
  213. u16 cmd_status;
  214. u16 cmd_cmd;
  215. u16 cmd_link;
  216. u16 mc_cnt; /* number of bytes in the MC-List */
  217. u8 mc_list[0][6]; /* pointer to 6 bytes entries */
  218. };
  219. /*
  220. * DUMP command
  221. */
  222. struct dump_cmd_struct
  223. {
  224. u16 cmd_status;
  225. u16 cmd_cmd;
  226. u16 cmd_link;
  227. u16 dump_offset; /* pointeroffset to DUMP space */
  228. };
  229. /*
  230. * transmit command
  231. */
  232. struct transmit_cmd_struct
  233. {
  234. u16 cmd_status;
  235. u16 cmd_cmd;
  236. u16 cmd_link;
  237. u16 tbd_offset; /* pointeroffset to TBD */
  238. u8 dest[6]; /* destination address of the frame */
  239. u16 length; /* user defined: 802.3 length / Ether type */
  240. };
  241. #define TCMD_ERRMASK 0x0fa0
  242. #define TCMD_MAXCOLLMASK 0x000f
  243. #define TCMD_MAXCOLL 0x0020
  244. #define TCMD_HEARTBEAT 0x0040
  245. #define TCMD_DEFERRED 0x0080
  246. #define TCMD_UNDERRUN 0x0100
  247. #define TCMD_LOSTCTS 0x0200
  248. #define TCMD_NOCARRIER 0x0400
  249. #define TCMD_LATECOLL 0x0800
  250. struct tdr_cmd_struct
  251. {
  252. u16 cmd_status;
  253. u16 cmd_cmd;
  254. u16 cmd_link;
  255. u16 status;
  256. };
  257. #define TDR_LNK_OK 0x8000 /* No link problem identified */
  258. #define TDR_XCVR_PRB 0x4000 /* indicates a transceiver problem */
  259. #define TDR_ET_OPN 0x2000 /* open, no correct termination */
  260. #define TDR_ET_SRT 0x1000 /* TDR detected a short circuit */
  261. #define TDR_TIMEMASK 0x07ff /* mask for the time field */
  262. /*
  263. * Transmit Buffer Descriptor (TBD)
  264. */
  265. struct tbd_struct
  266. {
  267. u16 size; /* size + EOF-Flag(15) */
  268. u16 next; /* pointeroffset to next TBD */
  269. u32 buffer; /* pointer to buffer */
  270. };
  271. #define TBD_LAST 0x8000 /* EOF-Flag, indicates last buffer in list */