olympic.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /*
  2. * olympic.h (c) 1999 Peter De Schrijver All Rights Reserved
  3. * 1999,2000 Mike Phillips (mikep@linuxtr.net)
  4. *
  5. * Linux driver for IBM PCI tokenring cards based on the olympic and the PIT/PHY chipset.
  6. *
  7. * Base Driver Skeleton:
  8. * Written 1993-94 by Donald Becker.
  9. *
  10. * Copyright 1993 United States Government as represented by the
  11. * Director, National Security Agency.
  12. *
  13. * This software may be used and distributed according to the terms
  14. * of the GNU General Public License, incorporated herein by reference.
  15. */
  16. #define CID 0x4e
  17. #define BCTL 0x70
  18. #define BCTL_SOFTRESET (1<<15)
  19. #define BCTL_MIMREB (1<<6)
  20. #define BCTL_MODE_INDICATOR (1<<5)
  21. #define GPR 0x4a
  22. #define GPR_OPTI_BF (1<<6)
  23. #define GPR_NEPTUNE_BF (1<<4)
  24. #define GPR_AUTOSENSE (1<<2)
  25. #define GPR_16MBPS (1<<3)
  26. #define PAG 0x85
  27. #define LBC 0x8e
  28. #define LISR 0x10
  29. #define LISR_SUM 0x14
  30. #define LISR_RWM 0x18
  31. #define LISR_LIE (1<<15)
  32. #define LISR_SLIM (1<<13)
  33. #define LISR_SLI (1<<12)
  34. #define LISR_PCMSRMASK (1<<11)
  35. #define LISR_PCMSRINT (1<<10)
  36. #define LISR_WOLMASK (1<<9)
  37. #define LISR_WOL (1<<8)
  38. #define LISR_SRB_CMD (1<<5)
  39. #define LISR_ASB_REPLY (1<<4)
  40. #define LISR_ASB_FREE_REQ (1<<2)
  41. #define LISR_ARB_FREE (1<<1)
  42. #define LISR_TRB_FRAME (1<<0)
  43. #define SISR 0x20
  44. #define SISR_SUM 0x24
  45. #define SISR_RWM 0x28
  46. #define SISR_RR 0x2C
  47. #define SISR_RESMASK 0x30
  48. #define SISR_MASK 0x54
  49. #define SISR_MASK_SUM 0x58
  50. #define SISR_MASK_RWM 0x5C
  51. #define SISR_TX2_IDLE (1<<31)
  52. #define SISR_TX2_HALT (1<<29)
  53. #define SISR_TX2_EOF (1<<28)
  54. #define SISR_TX1_IDLE (1<<27)
  55. #define SISR_TX1_HALT (1<<25)
  56. #define SISR_TX1_EOF (1<<24)
  57. #define SISR_TIMEOUT (1<<23)
  58. #define SISR_RX_NOBUF (1<<22)
  59. #define SISR_RX_STATUS (1<<21)
  60. #define SISR_RX_HALT (1<<18)
  61. #define SISR_RX_EOF_EARLY (1<<16)
  62. #define SISR_MI (1<<15)
  63. #define SISR_PI (1<<13)
  64. #define SISR_ERR (1<<9)
  65. #define SISR_ADAPTER_CHECK (1<<6)
  66. #define SISR_SRB_REPLY (1<<5)
  67. #define SISR_ASB_FREE (1<<4)
  68. #define SISR_ARB_CMD (1<<3)
  69. #define SISR_TRB_REPLY (1<<2)
  70. #define EISR 0x34
  71. #define EISR_RWM 0x38
  72. #define EISR_MASK 0x3c
  73. #define EISR_MASK_OPTIONS 0x001FFF7F
  74. #define LAPA 0x60
  75. #define LAPWWO 0x64
  76. #define LAPWWC 0x68
  77. #define LAPCTL 0x6C
  78. #define LAIPD 0x78
  79. #define LAIPDDINC 0x7C
  80. #define TIMER 0x50
  81. #define CLKCTL 0x74
  82. #define CLKCTL_PAUSE (1<<15)
  83. #define PM_CON 0x4
  84. #define BMCTL_SUM 0x40
  85. #define BMCTL_RWM 0x44
  86. #define BMCTL_TX2_DIS (1<<30)
  87. #define BMCTL_TX1_DIS (1<<26)
  88. #define BMCTL_RX_DIS (1<<22)
  89. #define BMASR 0xcc
  90. #define RXDESCQ 0x90
  91. #define RXDESCQCNT 0x94
  92. #define RXCDA 0x98
  93. #define RXENQ 0x9C
  94. #define RXSTATQ 0xA0
  95. #define RXSTATQCNT 0xA4
  96. #define RXCSA 0xA8
  97. #define RXCLEN 0xAC
  98. #define RXHLEN 0xAE
  99. #define TXDESCQ_1 0xb0
  100. #define TXDESCQ_2 0xd0
  101. #define TXDESCQCNT_1 0xb4
  102. #define TXDESCQCNT_2 0xd4
  103. #define TXCDA_1 0xb8
  104. #define TXCDA_2 0xd8
  105. #define TXENQ_1 0xbc
  106. #define TXENQ_2 0xdc
  107. #define TXSTATQ_1 0xc0
  108. #define TXSTATQ_2 0xe0
  109. #define TXSTATQCNT_1 0xc4
  110. #define TXSTATQCNT_2 0xe4
  111. #define TXCSA_1 0xc8
  112. #define TXCSA_2 0xe8
  113. /* Cardbus */
  114. #define FERMASK 0xf4
  115. #define FERMASK_INT_BIT (1<<15)
  116. #define OLYMPIC_IO_SPACE 256
  117. #define SRB_COMMAND_SIZE 50
  118. #define OLYMPIC_MAX_ADAPTERS 8 /* 0x08 __MODULE_STRING can't hand 0xnn */
  119. /* Defines for LAN STATUS CHANGE reports */
  120. #define LSC_SIG_LOSS 0x8000
  121. #define LSC_HARD_ERR 0x4000
  122. #define LSC_SOFT_ERR 0x2000
  123. #define LSC_TRAN_BCN 0x1000
  124. #define LSC_LWF 0x0800
  125. #define LSC_ARW 0x0400
  126. #define LSC_FPE 0x0200
  127. #define LSC_RR 0x0100
  128. #define LSC_CO 0x0080
  129. #define LSC_SS 0x0040
  130. #define LSC_RING_REC 0x0020
  131. #define LSC_SR_CO 0x0010
  132. #define LSC_FDX_MODE 0x0004
  133. /* Defines for OPEN ADAPTER command */
  134. #define OPEN_ADAPTER_EXT_WRAP (1<<15)
  135. #define OPEN_ADAPTER_DIS_HARDEE (1<<14)
  136. #define OPEN_ADAPTER_DIS_SOFTERR (1<<13)
  137. #define OPEN_ADAPTER_PASS_ADC_MAC (1<<12)
  138. #define OPEN_ADAPTER_PASS_ATT_MAC (1<<11)
  139. #define OPEN_ADAPTER_ENABLE_EC (1<<10)
  140. #define OPEN_ADAPTER_CONTENDER (1<<8)
  141. #define OPEN_ADAPTER_PASS_BEACON (1<<7)
  142. #define OPEN_ADAPTER_ENABLE_FDX (1<<6)
  143. #define OPEN_ADAPTER_ENABLE_RPL (1<<5)
  144. #define OPEN_ADAPTER_INHIBIT_ETR (1<<4)
  145. #define OPEN_ADAPTER_INTERNAL_WRAP (1<<3)
  146. #define OPEN_ADAPTER_USE_OPTS2 (1<<0)
  147. #define OPEN_ADAPTER_2_ENABLE_ONNOW (1<<15)
  148. /* Defines for SRB Commands */
  149. #define SRB_ACCESS_REGISTER 0x1f
  150. #define SRB_CLOSE_ADAPTER 0x04
  151. #define SRB_CONFIGURE_BRIDGE 0x0c
  152. #define SRB_CONFIGURE_WAKEUP_EVENT 0x1a
  153. #define SRB_MODIFY_BRIDGE_PARMS 0x15
  154. #define SRB_MODIFY_OPEN_OPTIONS 0x01
  155. #define SRB_MODIFY_RECEIVE_OPTIONS 0x17
  156. #define SRB_NO_OPERATION 0x00
  157. #define SRB_OPEN_ADAPTER 0x03
  158. #define SRB_READ_LOG 0x08
  159. #define SRB_READ_SR_COUNTERS 0x16
  160. #define SRB_RESET_GROUP_ADDRESS 0x02
  161. #define SRB_SAVE_CONFIGURATION 0x1b
  162. #define SRB_SET_BRIDGE_PARMS 0x09
  163. #define SRB_SET_BRIDGE_TARGETS 0x10
  164. #define SRB_SET_FUNC_ADDRESS 0x07
  165. #define SRB_SET_GROUP_ADDRESS 0x06
  166. #define SRB_SET_GROUP_ADDR_OPTIONS 0x11
  167. #define SRB_UPDATE_WAKEUP_PATTERN 0x19
  168. /* Clear return code */
  169. #define OLYMPIC_CLEAR_RET_CODE 0xfe
  170. /* ARB Commands */
  171. #define ARB_RECEIVE_DATA 0x81
  172. #define ARB_LAN_CHANGE_STATUS 0x84
  173. /* ASB Response commands */
  174. #define ASB_RECEIVE_DATA 0x81
  175. /* Olympic defaults for buffers */
  176. #define OLYMPIC_RX_RING_SIZE 16 /* should be a power of 2 */
  177. #define OLYMPIC_TX_RING_SIZE 8 /* should be a power of 2 */
  178. #define PKT_BUF_SZ 4096 /* Default packet size */
  179. /* Olympic data structures */
  180. /* xxxx These structures are all little endian in hardware. */
  181. struct olympic_tx_desc {
  182. __le32 buffer;
  183. __le32 status_length;
  184. };
  185. struct olympic_tx_status {
  186. __le32 status;
  187. };
  188. struct olympic_rx_desc {
  189. __le32 buffer;
  190. __le32 res_length;
  191. };
  192. struct olympic_rx_status {
  193. __le32 fragmentcnt_framelen;
  194. __le32 status_buffercnt;
  195. };
  196. /* xxxx END These structures are all little endian in hardware. */
  197. /* xxxx There may be more, but I'm pretty sure about these */
  198. struct mac_receive_buffer {
  199. __le16 next ;
  200. u8 padding ;
  201. u8 frame_status ;
  202. __le16 buffer_length ;
  203. u8 frame_data ;
  204. };
  205. struct olympic_private {
  206. u16 srb; /* be16 */
  207. u16 trb; /* be16 */
  208. u16 arb; /* be16 */
  209. u16 asb; /* be16 */
  210. u8 __iomem *olympic_mmio;
  211. u8 __iomem *olympic_lap;
  212. struct pci_dev *pdev ;
  213. const char *olympic_card_name;
  214. spinlock_t olympic_lock ;
  215. volatile int srb_queued; /* True if an SRB is still posted */
  216. wait_queue_head_t srb_wait;
  217. volatile int asb_queued; /* True if an ASB is posted */
  218. volatile int trb_queued; /* True if a TRB is posted */
  219. wait_queue_head_t trb_wait ;
  220. /* These must be on a 4 byte boundary. */
  221. struct olympic_rx_desc olympic_rx_ring[OLYMPIC_RX_RING_SIZE];
  222. struct olympic_tx_desc olympic_tx_ring[OLYMPIC_TX_RING_SIZE];
  223. struct olympic_rx_status olympic_rx_status_ring[OLYMPIC_RX_RING_SIZE];
  224. struct olympic_tx_status olympic_tx_status_ring[OLYMPIC_TX_RING_SIZE];
  225. struct sk_buff *tx_ring_skb[OLYMPIC_TX_RING_SIZE], *rx_ring_skb[OLYMPIC_RX_RING_SIZE];
  226. int tx_ring_free, tx_ring_last_status, rx_ring_last_received,rx_status_last_received, free_tx_ring_entries;
  227. u16 olympic_lan_status ;
  228. u8 olympic_ring_speed ;
  229. u16 pkt_buf_sz ;
  230. u8 olympic_receive_options, olympic_copy_all_options,olympic_message_level, olympic_network_monitor;
  231. u16 olympic_addr_table_addr, olympic_parms_addr ;
  232. u8 olympic_laa[6] ;
  233. u32 rx_ring_dma_addr;
  234. u32 rx_status_ring_dma_addr;
  235. u32 tx_ring_dma_addr;
  236. u32 tx_status_ring_dma_addr;
  237. };
  238. struct olympic_adapter_addr_table {
  239. u8 node_addr[6] ;
  240. u8 reserved[4] ;
  241. u8 func_addr[4] ;
  242. } ;
  243. struct olympic_parameters_table {
  244. u8 phys_addr[4] ;
  245. u8 up_node_addr[6] ;
  246. u8 up_phys_addr[4] ;
  247. u8 poll_addr[6] ;
  248. u16 reserved ;
  249. u16 acc_priority ;
  250. u16 auth_source_class ;
  251. u16 att_code ;
  252. u8 source_addr[6] ;
  253. u16 beacon_type ;
  254. u16 major_vector ;
  255. u16 lan_status ;
  256. u16 soft_error_time ;
  257. u16 reserved1 ;
  258. u16 local_ring ;
  259. u16 mon_error ;
  260. u16 beacon_transmit ;
  261. u16 beacon_receive ;
  262. u16 frame_correl ;
  263. u8 beacon_naun[6] ;
  264. u32 reserved2 ;
  265. u8 beacon_phys[4] ;
  266. };