PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/release/src-rt-6.x/linux/linux-2.6/drivers/net/tokenring/3c359.h

https://gitlab.com/envieidoc/advancedtomato2
C Header | 290 lines | 201 code | 42 blank | 47 comment | 0 complexity | 0462dd7fac418c8d280d8323971bb862 MD5 | raw file
  1. /*
  2. * 3c359.h (c) 2000 Mike Phillips (mikep@linuxtr.net) All Rights Reserved
  3. *
  4. * Linux driver for 3Com 3C359 Token Link PCI XL cards.
  5. *
  6. * This software may be used and distributed according to the terms
  7. * of the GNU General Public License Version 2 or (at your option)
  8. * any later verion, incorporated herein by reference.
  9. */
  10. /* Memory Access Commands */
  11. #define IO_BYTE_READ 0x28 << 24
  12. #define IO_BYTE_WRITE 0x18 << 24
  13. #define IO_WORD_READ 0x20 << 24
  14. #define IO_WORD_WRITE 0x10 << 24
  15. #define MMIO_BYTE_READ 0x88 << 24
  16. #define MMIO_BYTE_WRITE 0x48 << 24
  17. #define MMIO_WORD_READ 0x80 << 24
  18. #define MMIO_WORD_WRITE 0x40 << 24
  19. #define MEM_BYTE_READ 0x8C << 24
  20. #define MEM_BYTE_WRITE 0x4C << 24
  21. #define MEM_WORD_READ 0x84 << 24
  22. #define MEM_WORD_WRITE 0x44 << 24
  23. #define PMBAR 0x1C80
  24. #define PMB_CPHOLD (1<<10)
  25. #define CPATTENTION 0x180D
  26. #define CPA_PMBARVIS (1<<7)
  27. #define CPA_MEMWREN (1<<6)
  28. #define SWITCHSETTINGS 0x1C88
  29. #define EECONTROL 0x1C8A
  30. #define EEDATA 0x1C8C
  31. #define EEREAD 0x0080
  32. #define EEWRITE 0x0040
  33. #define EEERASE 0x0060
  34. #define EE_ENABLE_WRITE 0x0030
  35. #define EEBUSY (1<<15)
  36. #define WRBR 0xCDE02
  37. #define WWOR 0xCDE04
  38. #define WWCR 0xCDE06
  39. #define MACSTATUS 0xCDE08
  40. #define MISR_RW 0xCDE0B
  41. #define MISR_AND 0xCDE2B
  42. #define MISR_SET 0xCDE4B
  43. #define RXBUFAREA 0xCDE10
  44. #define RXEARLYTHRESH 0xCDE12
  45. #define TXSTARTTHRESH 0x58
  46. #define DNPRIREQTHRESH 0x2C
  47. #define MISR_CSRB (1<<5)
  48. #define MISR_RASB (1<<4)
  49. #define MISR_SRBFR (1<<3)
  50. #define MISR_ASBFR (1<<2)
  51. #define MISR_ARBF (1<<1)
  52. /* MISR Flags memory locations */
  53. #define MF_SSBF 0xDFFE0
  54. #define MF_ARBF 0xDFFE1
  55. #define MF_ASBFR 0xDFFE2
  56. #define MF_SRBFR 0xDFFE3
  57. #define MF_RASB 0xDFFE4
  58. #define MF_CSRB 0xDFFE5
  59. #define MMIO_MACDATA 0x10
  60. #define MMIO_MAC_ACCESS_CMD 0x14
  61. #define MMIO_TIMER 0x1A
  62. #define MMIO_DMA_CTRL 0x20
  63. #define MMIO_DNLISTPTR 0x24
  64. #define MMIO_HASHFILTER 0x28
  65. #define MMIO_CONFIG 0x29
  66. #define MMIO_DNPRIREQTHRESH 0x2C
  67. #define MMIO_DNPOLL 0x2D
  68. #define MMIO_UPPKTSTATUS 0x30
  69. #define MMIO_FREETIMER 0x34
  70. #define MMIO_COUNTDOWN 0x36
  71. #define MMIO_UPLISTPTR 0x38
  72. #define MMIO_UPPOLL 0x3C
  73. #define MMIO_UPBURSTTHRESH 0x40
  74. #define MMIO_DNBURSTTHRESH 0x41
  75. #define MMIO_INTSTATUS_AUTO 0x56
  76. #define MMIO_TXSTARTTHRESH 0x58
  77. #define MMIO_INTERRUPTENABLE 0x5A
  78. #define MMIO_INDICATIONENABLE 0x5C
  79. #define MMIO_COMMAND 0x5E /* These two are meant to be the same */
  80. #define MMIO_INTSTATUS 0x5E /* Makes the code more readable this way */
  81. #define INTSTAT_CMD_IN_PROGRESS (1<<12)
  82. #define INTSTAT_SRB (1<<14)
  83. #define INTSTAT_INTLATCH (1<<0)
  84. /* Indication / Interrupt Mask
  85. * Annoyingly the bits to be set in the indication and interrupt enable
  86. * do not match with the actual bits received in the interrupt, although
  87. * they are in the same order.
  88. * The mapping for the indication / interrupt are:
  89. * Bit Indication / Interrupt
  90. * 0 HostError
  91. * 1 txcomplete
  92. * 2 updneeded
  93. * 3 rxcomplete
  94. * 4 intrequested
  95. * 5 macerror
  96. * 6 dncomplete
  97. * 7 upcomplete
  98. * 8 txunderrun
  99. * 9 asbf
  100. * 10 srbr
  101. * 11 arbc
  102. *
  103. * The only ones we don't want to receive are txcomplete and rxcomplete
  104. * we use dncomplete and upcomplete instead.
  105. */
  106. #define INT_MASK 0xFF5
  107. /* Note the subtle difference here, IND and INT */
  108. #define SETINDENABLE (8<<12)
  109. #define SETINTENABLE (7<<12)
  110. #define SRBBIT (1<<10)
  111. #define ASBBIT (1<<9)
  112. #define ARBBIT (1<<11)
  113. #define SRB 0xDFE90
  114. #define ASB 0xDFED0
  115. #define ARB 0xD0000
  116. #define SCRATCH 0xDFEF0
  117. #define INT_REQUEST 0x6000 /* (6 << 12) */
  118. #define ACK_INTERRUPT 0x6800 /* (13 <<11) */
  119. #define GLOBAL_RESET 0x00
  120. #define DNDISABLE 0x5000
  121. #define DNENABLE 0x4800
  122. #define DNSTALL 0x3002
  123. #define DNRESET 0x5800
  124. #define DNUNSTALL 0x3003
  125. #define UPRESET 0x2800
  126. #define UPSTALL 0x3000
  127. #define UPUNSTALL 0x3001
  128. #define SETCONFIG 0x4000
  129. #define SETTXSTARTTHRESH 0x9800
  130. /* Received Interrupts */
  131. #define ASBFINT (1<<13)
  132. #define SRBRINT (1<<14)
  133. #define ARBCINT (1<<15)
  134. #define TXUNDERRUN (1<<11)
  135. #define UPCOMPINT (1<<10)
  136. #define DNCOMPINT (1<<9)
  137. #define HARDERRINT (1<<7)
  138. #define RXCOMPLETE (1<<4)
  139. #define TXCOMPINT (1<<2)
  140. #define HOSTERRINT (1<<1)
  141. /* Receive descriptor bits */
  142. #define RXOVERRUN (1<<19)
  143. #define RXFC (1<<21)
  144. #define RXAR (1<<22)
  145. #define RXUPDCOMPLETE (1<<23)
  146. #define RXUPDFULL (1<<24)
  147. #define RXUPLASTFRAG (1<<31)
  148. /* Transmit descriptor bits */
  149. #define TXDNCOMPLETE (1<<16)
  150. #define TXTXINDICATE (1<<27)
  151. #define TXDPDEMPTY (1<<29)
  152. #define TXDNINDICATE (1<<31)
  153. #define TXDNFRAGLAST (1<<31)
  154. /* Interrupts to Acknowledge */
  155. #define LATCH_ACK 1
  156. #define TXCOMPACK (1<<1)
  157. #define INTREQACK (1<<2)
  158. #define DNCOMPACK (1<<3)
  159. #define UPCOMPACK (1<<4)
  160. #define ASBFACK (1<<5)
  161. #define SRBRACK (1<<6)
  162. #define ARBCACK (1<<7)
  163. #define XL_IO_SPACE 128
  164. #define SRB_COMMAND_SIZE 50
  165. /* Adapter Commands */
  166. #define REQUEST_INT 0x00
  167. #define MODIFY_OPEN_PARMS 0x01
  168. #define RESTORE_OPEN_PARMS 0x02
  169. #define OPEN_NIC 0x03
  170. #define CLOSE_NIC 0x04
  171. #define SET_SLEEP_MODE 0x05
  172. #define SET_GROUP_ADDRESS 0x06
  173. #define SET_FUNC_ADDRESS 0x07
  174. #define READ_LOG 0x08
  175. #define SET_MULTICAST_MODE 0x0C
  176. #define CHANGE_WAKEUP_PATTERN 0x0D
  177. #define GET_STATISTICS 0x13
  178. #define SET_RECEIVE_MODE 0x1F
  179. /* ARB Commands */
  180. #define RECEIVE_DATA 0x81
  181. #define RING_STATUS_CHANGE 0x84
  182. /* ASB Commands */
  183. #define ASB_RECEIVE_DATE 0x81
  184. /* Defines for LAN STATUS CHANGE reports */
  185. #define LSC_SIG_LOSS 0x8000
  186. #define LSC_HARD_ERR 0x4000
  187. #define LSC_SOFT_ERR 0x2000
  188. #define LSC_TRAN_BCN 0x1000
  189. #define LSC_LWF 0x0800
  190. #define LSC_ARW 0x0400
  191. #define LSC_FPE 0x0200
  192. #define LSC_RR 0x0100
  193. #define LSC_CO 0x0080
  194. #define LSC_SS 0x0040
  195. #define LSC_RING_REC 0x0020
  196. #define LSC_SR_CO 0x0010
  197. #define LSC_FDX_MODE 0x0004
  198. #define XL_MAX_ADAPTERS 8 /* 0x08 __MODULE_STRING can't hand 0xnn */
  199. /* 3c359 defaults for buffers */
  200. #define XL_RX_RING_SIZE 16 /* must be a power of 2 */
  201. #define XL_TX_RING_SIZE 16 /* must be a power of 2 */
  202. #define PKT_BUF_SZ 4096 /* Default packet size */
  203. /* 3c359 data structures */
  204. struct xl_tx_desc {
  205. u32 dnnextptr ;
  206. u32 framestartheader ;
  207. u32 buffer ;
  208. u32 buffer_length ;
  209. };
  210. struct xl_rx_desc {
  211. u32 upnextptr ;
  212. u32 framestatus ;
  213. u32 upfragaddr ;
  214. u32 upfraglen ;
  215. };
  216. struct xl_private {
  217. /* These two structures must be aligned on 8 byte boundaries */
  218. /* struct xl_rx_desc xl_rx_ring[XL_RX_RING_SIZE]; */
  219. /* struct xl_tx_desc xl_tx_ring[XL_TX_RING_SIZE]; */
  220. struct xl_rx_desc *xl_rx_ring ;
  221. struct xl_tx_desc *xl_tx_ring ;
  222. struct sk_buff *tx_ring_skb[XL_TX_RING_SIZE], *rx_ring_skb[XL_RX_RING_SIZE];
  223. int tx_ring_head, tx_ring_tail ;
  224. int rx_ring_tail, rx_ring_no ;
  225. int free_ring_entries ;
  226. u16 srb;
  227. u16 arb;
  228. u16 asb;
  229. u8 __iomem *xl_mmio;
  230. char *xl_card_name;
  231. struct pci_dev *pdev ;
  232. spinlock_t xl_lock ;
  233. volatile int srb_queued;
  234. struct wait_queue *srb_wait;
  235. volatile int asb_queued;
  236. struct net_device_stats xl_stats ;
  237. u16 mac_buffer ;
  238. u16 xl_lan_status ;
  239. u8 xl_ring_speed ;
  240. u16 pkt_buf_sz ;
  241. u8 xl_message_level;
  242. u16 xl_copy_all_options ;
  243. unsigned char xl_functional_addr[4] ;
  244. u16 xl_addr_table_addr, xl_parms_addr ;
  245. u8 xl_laa[6] ;
  246. u32 rx_ring_dma_addr ;
  247. u32 tx_ring_dma_addr ;
  248. };