fplustm.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. /******************************************************************************
  2. *
  3. * (C)Copyright 1998,1999 SysKonnect,
  4. * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * The information in this file is provided "AS IS" without warranty.
  12. *
  13. ******************************************************************************/
  14. /*
  15. * AMD Fplus in tag mode data structs
  16. * defs for fplustm.c
  17. */
  18. #ifndef _FPLUS_
  19. #define _FPLUS_
  20. #ifndef HW_PTR
  21. #define HW_PTR void __iomem *
  22. #endif
  23. /*
  24. * fplus error statistic structure
  25. */
  26. struct err_st {
  27. u_long err_valid ; /* memory status valid */
  28. u_long err_abort ; /* memory status receive abort */
  29. u_long err_e_indicator ; /* error indicator */
  30. u_long err_crc ; /* error detected (CRC or length) */
  31. u_long err_llc_frame ; /* LLC frame */
  32. u_long err_mac_frame ; /* MAC frame */
  33. u_long err_smt_frame ; /* SMT frame */
  34. u_long err_imp_frame ; /* implementer frame */
  35. u_long err_no_buf ; /* no buffer available */
  36. u_long err_too_long ; /* longer than max. buffer */
  37. u_long err_bec_stat ; /* beacon state entered */
  38. u_long err_clm_stat ; /* claim state entered */
  39. u_long err_sifg_det ; /* short interframe gap detect */
  40. u_long err_phinv ; /* PHY invalid */
  41. u_long err_tkiss ; /* token issued */
  42. u_long err_tkerr ; /* token error */
  43. } ;
  44. /*
  45. * Transmit Descriptor struct
  46. */
  47. struct s_smt_fp_txd {
  48. __le32 txd_tbctrl ; /* transmit buffer control */
  49. __le32 txd_txdscr ; /* transmit frame status word */
  50. __le32 txd_tbadr ; /* physical tx buffer address */
  51. __le32 txd_ntdadr ; /* physical pointer to the next TxD */
  52. #ifdef ENA_64BIT_SUP
  53. __le32 txd_tbadr_hi ; /* physical tx buffer addr (high dword)*/
  54. #endif
  55. char far *txd_virt ; /* virtual pointer to the data frag */
  56. /* virt pointer to the next TxD */
  57. struct s_smt_fp_txd volatile far *txd_next ;
  58. struct s_txd_os txd_os ; /* OS - specific struct */
  59. } ;
  60. /*
  61. * Receive Descriptor struct
  62. */
  63. struct s_smt_fp_rxd {
  64. __le32 rxd_rbctrl ; /* receive buffer control */
  65. __le32 rxd_rfsw ; /* receive frame status word */
  66. __le32 rxd_rbadr ; /* physical rx buffer address */
  67. __le32 rxd_nrdadr ; /* physical pointer to the next RxD */
  68. #ifdef ENA_64BIT_SUP
  69. __le32 rxd_rbadr_hi ; /* physical tx buffer addr (high dword)*/
  70. #endif
  71. char far *rxd_virt ; /* virtual pointer to the data frag */
  72. /* virt pointer to the next RxD */
  73. struct s_smt_fp_rxd volatile far *rxd_next ;
  74. struct s_rxd_os rxd_os ; /* OS - specific struct */
  75. } ;
  76. /*
  77. * Descriptor Union Definition
  78. */
  79. union s_fp_descr {
  80. struct s_smt_fp_txd t ; /* pointer to the TxD */
  81. struct s_smt_fp_rxd r ; /* pointer to the RxD */
  82. } ;
  83. /*
  84. * TxD Ring Control struct
  85. */
  86. struct s_smt_tx_queue {
  87. struct s_smt_fp_txd volatile *tx_curr_put ; /* next free TxD */
  88. struct s_smt_fp_txd volatile *tx_prev_put ; /* shadow put pointer */
  89. struct s_smt_fp_txd volatile *tx_curr_get ; /* next TxD to release*/
  90. u_short tx_free ; /* count of free TxD's */
  91. u_short tx_used ; /* count of used TxD's */
  92. HW_PTR tx_bmu_ctl ; /* BMU addr for tx start */
  93. HW_PTR tx_bmu_dsc ; /* BMU addr for curr dsc. */
  94. } ;
  95. /*
  96. * RxD Ring Control struct
  97. */
  98. struct s_smt_rx_queue {
  99. struct s_smt_fp_rxd volatile *rx_curr_put ; /* next RxD to queue into */
  100. struct s_smt_fp_rxd volatile *rx_prev_put ; /* shadow put pointer */
  101. struct s_smt_fp_rxd volatile *rx_curr_get ; /* next RxD to fill */
  102. u_short rx_free ; /* count of free RxD's */
  103. u_short rx_used ; /* count of used RxD's */
  104. HW_PTR rx_bmu_ctl ; /* BMU addr for rx start */
  105. HW_PTR rx_bmu_dsc ; /* BMU addr for curr dsc. */
  106. } ;
  107. #define VOID_FRAME_OFF 0x00
  108. #define CLAIM_FRAME_OFF 0x08
  109. #define BEACON_FRAME_OFF 0x10
  110. #define DBEACON_FRAME_OFF 0x18
  111. #define RX_FIFO_OFF 0x21 /* to get a prime number for */
  112. /* the RX_FIFO_SPACE */
  113. #define RBC_MEM_SIZE 0x8000
  114. #define SEND_ASYNC_AS_SYNC 0x1
  115. #define SYNC_TRAFFIC_ON 0x2
  116. /* big FIFO memory */
  117. #define RX_FIFO_SPACE 0x4000 - RX_FIFO_OFF
  118. #define TX_FIFO_SPACE 0x4000
  119. #define TX_SMALL_FIFO 0x0900
  120. #define TX_MEDIUM_FIFO TX_FIFO_SPACE / 2
  121. #define TX_LARGE_FIFO TX_FIFO_SPACE - TX_SMALL_FIFO
  122. #define RX_SMALL_FIFO 0x0900
  123. #define RX_LARGE_FIFO RX_FIFO_SPACE - RX_SMALL_FIFO
  124. struct s_smt_fifo_conf {
  125. u_short rbc_ram_start ; /* FIFO start address */
  126. u_short rbc_ram_end ; /* FIFO size */
  127. u_short rx1_fifo_start ; /* rx queue start address */
  128. u_short rx1_fifo_size ; /* rx queue size */
  129. u_short rx2_fifo_start ; /* rx queue start address */
  130. u_short rx2_fifo_size ; /* rx queue size */
  131. u_short tx_s_start ; /* sync queue start address */
  132. u_short tx_s_size ; /* sync queue size */
  133. u_short tx_a0_start ; /* async queue A0 start address */
  134. u_short tx_a0_size ; /* async queue A0 size */
  135. u_short fifo_config_mode ; /* FIFO configuration mode */
  136. } ;
  137. #define FM_ADDRX (FM_ADDET|FM_EXGPA0|FM_EXGPA1)
  138. struct s_smt_fp {
  139. u_short mdr2init ; /* mode register 2 init value */
  140. u_short mdr3init ; /* mode register 3 init value */
  141. u_short frselreg_init ; /* frame selection register init val */
  142. u_short rx_mode ; /* address mode broad/multi/promisc */
  143. u_short nsa_mode ;
  144. u_short rx_prom ;
  145. u_short exgpa ;
  146. struct err_st err_stats ; /* error statistics */
  147. /*
  148. * MAC buffers
  149. */
  150. struct fddi_mac_sf { /* special frame build buffer */
  151. u_char mac_fc ;
  152. struct fddi_addr mac_dest ;
  153. struct fddi_addr mac_source ;
  154. u_char mac_info[0x20] ;
  155. } mac_sfb ;
  156. /*
  157. * queues
  158. */
  159. #define QUEUE_S 0
  160. #define QUEUE_A0 1
  161. #define QUEUE_R1 0
  162. #define QUEUE_R2 1
  163. #define USED_QUEUES 2
  164. /*
  165. * queue pointers; points to the queue dependent variables
  166. */
  167. struct s_smt_tx_queue *tx[USED_QUEUES] ;
  168. struct s_smt_rx_queue *rx[USED_QUEUES] ;
  169. /*
  170. * queue dependent variables
  171. */
  172. struct s_smt_tx_queue tx_q[USED_QUEUES] ;
  173. struct s_smt_rx_queue rx_q[USED_QUEUES] ;
  174. /*
  175. * FIFO configuration struct
  176. */
  177. struct s_smt_fifo_conf fifo ;
  178. /* last formac status */
  179. u_short s2u ;
  180. u_short s2l ;
  181. /* calculated FORMAC+ reg.addr. */
  182. HW_PTR fm_st1u ;
  183. HW_PTR fm_st1l ;
  184. HW_PTR fm_st2u ;
  185. HW_PTR fm_st2l ;
  186. HW_PTR fm_st3u ;
  187. HW_PTR fm_st3l ;
  188. /*
  189. * multicast table
  190. */
  191. #define FPMAX_MULTICAST 32
  192. #define SMT_MAX_MULTI 4
  193. struct {
  194. struct s_fpmc {
  195. struct fddi_addr a ; /* mc address */
  196. u_char n ; /* usage counter */
  197. u_char perm ; /* flag: permanent */
  198. } table[FPMAX_MULTICAST] ;
  199. } mc ;
  200. struct fddi_addr group_addr ;
  201. u_long func_addr ; /* functional address */
  202. int smt_slots_used ; /* count of table entries for the SMT */
  203. int os_slots_used ; /* count of table entries */
  204. /* used by the os-specific module */
  205. } ;
  206. /*
  207. * modes for mac_set_rx_mode()
  208. */
  209. #define RX_ENABLE_ALLMULTI 1 /* enable all multicasts */
  210. #define RX_DISABLE_ALLMULTI 2 /* disable "enable all multicasts" */
  211. #define RX_ENABLE_PROMISC 3 /* enable promiscuous */
  212. #define RX_DISABLE_PROMISC 4 /* disable promiscuous */
  213. #define RX_ENABLE_NSA 5 /* enable reception of NSA frames */
  214. #define RX_DISABLE_NSA 6 /* disable reception of NSA frames */
  215. /*
  216. * support for byte reversal in AIX
  217. * (descriptors and pointers must be byte reversed in memory
  218. * CPU is big endian; M-Channel is little endian)
  219. */
  220. #ifdef AIX
  221. #define MDR_REV
  222. #define AIX_REVERSE(x) ((((x)<<24L)&0xff000000L) + \
  223. (((x)<< 8L)&0x00ff0000L) + \
  224. (((x)>> 8L)&0x0000ff00L) + \
  225. (((x)>>24L)&0x000000ffL))
  226. #else
  227. #ifndef AIX_REVERSE
  228. #define AIX_REVERSE(x) (x)
  229. #endif
  230. #endif
  231. #ifdef MDR_REV
  232. #define MDR_REVERSE(x) ((((x)<<24L)&0xff000000L) + \
  233. (((x)<< 8L)&0x00ff0000L) + \
  234. (((x)>> 8L)&0x0000ff00L) + \
  235. (((x)>>24L)&0x000000ffL))
  236. #else
  237. #ifndef MDR_REVERSE
  238. #define MDR_REVERSE(x) (x)
  239. #endif
  240. #endif
  241. #endif