sun3_82586.h 9.9 KB

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