hp100.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /*
  2. * hp100.h: Hewlett Packard HP10/100VG ANY LAN ethernet driver for Linux.
  3. *
  4. * $Id: hp100.h,v 1.1.1.1 2007/06/12 07:27:10 eyryu Exp $
  5. *
  6. * Authors: Jaroslav Kysela, <perex@pf.jcu.cz>
  7. * Siegfried Loeffler <floeff@tunix.mathematik.uni-stuttgart.de>
  8. *
  9. * This driver is based on the 'hpfepkt' crynwr packet driver.
  10. *
  11. * This source/code is public free; you can distribute it and/or modify
  12. * it under terms of the GNU General Public License (published by the
  13. * Free Software Foundation) either version two of this License, or any
  14. * later version.
  15. */
  16. /****************************************************************************
  17. * Hardware Constants
  18. ****************************************************************************/
  19. /*
  20. * Page Identifiers
  21. * (Swap Paging Register, PAGING, bits 3:0, Offset 0x02)
  22. */
  23. #define HP100_PAGE_PERFORMANCE 0x0 /* Page 0 */
  24. #define HP100_PAGE_MAC_ADDRESS 0x1 /* Page 1 */
  25. #define HP100_PAGE_HW_MAP 0x2 /* Page 2 */
  26. #define HP100_PAGE_EEPROM_CTRL 0x3 /* Page 3 */
  27. #define HP100_PAGE_MAC_CTRL 0x4 /* Page 4 */
  28. #define HP100_PAGE_MMU_CFG 0x5 /* Page 5 */
  29. #define HP100_PAGE_ID_MAC_ADDR 0x6 /* Page 6 */
  30. #define HP100_PAGE_MMU_POINTER 0x7 /* Page 7 */
  31. /* Registers that are present on all pages */
  32. #define HP100_REG_HW_ID 0x00 /* R: (16) Unique card ID */
  33. #define HP100_REG_TRACE 0x00 /* W: (16) Used for debug output */
  34. #define HP100_REG_PAGING 0x02 /* R: (16),15:4 Card ID */
  35. /* W: (16),3:0 Switch pages */
  36. #define HP100_REG_OPTION_LSW 0x04 /* RW: (16) Select card functions */
  37. #define HP100_REG_OPTION_MSW 0x06 /* RW: (16) Select card functions */
  38. /* Page 0 - Performance */
  39. #define HP100_REG_IRQ_STATUS 0x08 /* RW: (16) Which ints are pending */
  40. #define HP100_REG_IRQ_MASK 0x0a /* RW: (16) Select ints to allow */
  41. #define HP100_REG_FRAGMENT_LEN 0x0c /* W: (16)12:0 Current fragment len */
  42. /* Note: For 32 bit systems, fragment len and offset registers are available */
  43. /* at offset 0x28 and 0x2c, where they can be written as 32bit values. */
  44. #define HP100_REG_OFFSET 0x0e /* RW: (16)12:0 Offset to start read */
  45. #define HP100_REG_DATA32 0x10 /* RW: (32) I/O mode data port */
  46. #define HP100_REG_DATA16 0x12 /* RW: WORDs must be read from here */
  47. #define HP100_REG_TX_MEM_FREE 0x14 /* RD: (32) Amount of free Tx mem */
  48. #define HP100_REG_TX_PDA_L 0x14 /* W: (32) BM: Ptr to PDL, Low Pri */
  49. #define HP100_REG_TX_PDA_H 0x1c /* W: (32) BM: Ptr to PDL, High Pri */
  50. #define HP100_REG_RX_PKT_CNT 0x18 /* RD: (8) Rx count of pkts on card */
  51. #define HP100_REG_TX_PKT_CNT 0x19 /* RD: (8) Tx count of pkts on card */
  52. #define HP100_REG_RX_PDL 0x1a /* R: (8) BM: # rx pdl not executed */
  53. #define HP100_REG_TX_PDL 0x1b /* R: (8) BM: # tx pdl not executed */
  54. #define HP100_REG_RX_PDA 0x18 /* W: (32) BM: Up to 31 addresses */
  55. /* which point to a PDL */
  56. #define HP100_REG_SL_EARLY 0x1c /* (32) Enhanced Slave Early Rx */
  57. #define HP100_REG_STAT_DROPPED 0x20 /* R (12) Dropped Packet Counter */
  58. #define HP100_REG_STAT_ERRORED 0x22 /* R (8) Errored Packet Counter */
  59. #define HP100_REG_STAT_ABORT 0x23 /* R (8) Abort Counter/OW Coll. Flag */
  60. #define HP100_REG_RX_RING 0x24 /* W (32) Slave: RX Ring Pointers */
  61. #define HP100_REG_32_FRAGMENT_LEN 0x28 /* W (13) Slave: Fragment Length Reg */
  62. #define HP100_REG_32_OFFSET 0x2c /* W (16) Slave: Offset Register */
  63. /* Page 1 - MAC Address/Hash Table */
  64. #define HP100_REG_MAC_ADDR 0x08 /* RW: (8) Cards MAC address */
  65. #define HP100_REG_HASH_BYTE0 0x10 /* RW: (8) Cards multicast filter */
  66. /* Page 2 - Hardware Mapping */
  67. #define HP100_REG_MEM_MAP_LSW 0x08 /* RW: (16) LSW of cards mem addr */
  68. #define HP100_REG_MEM_MAP_MSW 0x0a /* RW: (16) MSW of cards mem addr */
  69. #define HP100_REG_IO_MAP 0x0c /* RW: (8) Cards I/O address */
  70. #define HP100_REG_IRQ_CHANNEL 0x0d /* RW: (8) IRQ and edge/level int */
  71. #define HP100_REG_SRAM 0x0e /* RW: (8) How much RAM on card */
  72. #define HP100_REG_BM 0x0f /* RW: (8) Controls BM functions */
  73. /* New on Page 2 for ETR chips: */
  74. #define HP100_REG_MODECTRL1 0x10 /* RW: (8) Mode Control 1 */
  75. #define HP100_REG_MODECTRL2 0x11 /* RW: (8) Mode Control 2 */
  76. #define HP100_REG_PCICTRL1 0x12 /* RW: (8) PCI Cfg 1 */
  77. #define HP100_REG_PCICTRL2 0x13 /* RW: (8) PCI Cfg 2 */
  78. #define HP100_REG_PCIBUSMLAT 0x15 /* RW: (8) PCI Bus Master Latency */
  79. #define HP100_REG_EARLYTXCFG 0x16 /* RW: (16) Early TX Cfg/Cntrl Reg */
  80. #define HP100_REG_EARLYRXCFG 0x18 /* RW: (8) Early RX Cfg/Cntrl Reg */
  81. #define HP100_REG_ISAPNPCFG1 0x1a /* RW: (8) ISA PnP Cfg/Cntrl Reg 1 */
  82. #define HP100_REG_ISAPNPCFG2 0x1b /* RW: (8) ISA PnP Cfg/Cntrl Reg 2 */
  83. /* Page 3 - EEPROM/Boot ROM */
  84. #define HP100_REG_EEPROM_CTRL 0x08 /* RW: (16) Used to load EEPROM */
  85. #define HP100_REG_BOOTROM_CTRL 0x0a
  86. /* Page 4 - LAN Configuration (MAC_CTRL) */
  87. #define HP100_REG_10_LAN_CFG_1 0x08 /* RW: (8) Set 10M XCVR functions */
  88. #define HP100_REG_10_LAN_CFG_2 0x09 /* RW: (8) 10M XCVR functions */
  89. #define HP100_REG_VG_LAN_CFG_1 0x0a /* RW: (8) Set 100M XCVR functions */
  90. #define HP100_REG_VG_LAN_CFG_2 0x0b /* RW: (8) 100M LAN Training cfgregs */
  91. #define HP100_REG_MAC_CFG_1 0x0c /* RW: (8) Types of pkts to accept */
  92. #define HP100_REG_MAC_CFG_2 0x0d /* RW: (8) Misc MAC functions */
  93. #define HP100_REG_MAC_CFG_3 0x0e /* RW: (8) Misc MAC functions */
  94. #define HP100_REG_MAC_CFG_4 0x0f /* R: (8) Misc MAC states */
  95. #define HP100_REG_DROPPED 0x10 /* R: (16),11:0 Pkts cant fit in mem */
  96. #define HP100_REG_CRC 0x12 /* R: (8) Pkts with CRC */
  97. #define HP100_REG_ABORT 0x13 /* R: (8) Aborted Tx pkts */
  98. #define HP100_REG_TRAIN_REQUEST 0x14 /* RW: (16) Endnode MAC register. */
  99. #define HP100_REG_TRAIN_ALLOW 0x16 /* R: (16) Hub allowed register */
  100. /* Page 5 - MMU */
  101. #define HP100_REG_RX_MEM_STOP 0x0c /* RW: (16) End of Rx ring addr */
  102. #define HP100_REG_TX_MEM_STOP 0x0e /* RW: (16) End of Tx ring addr */
  103. #define HP100_REG_PDL_MEM_STOP 0x10 /* Not used by 802.12 devices */
  104. #define HP100_REG_ECB_MEM_STOP 0x14 /* I've no idea what this is */
  105. /* Page 6 - Card ID/Physical LAN Address */
  106. #define HP100_REG_BOARD_ID 0x08 /* R: (8) EISA/ISA card ID */
  107. #define HP100_REG_BOARD_IO_CHCK 0x0c /* R: (8) Added to ID to get FFh */
  108. #define HP100_REG_SOFT_MODEL 0x0d /* R: (8) Config program defined */
  109. #define HP100_REG_LAN_ADDR 0x10 /* R: (8) MAC addr of card */
  110. #define HP100_REG_LAN_ADDR_CHCK 0x16 /* R: (8) Added to addr to get FFh */
  111. /* Page 7 - MMU Current Pointers */
  112. #define HP100_REG_PTR_RXSTART 0x08 /* R: (16) Current begin of Rx ring */
  113. #define HP100_REG_PTR_RXEND 0x0a /* R: (16) Current end of Rx ring */
  114. #define HP100_REG_PTR_TXSTART 0x0c /* R: (16) Current begin of Tx ring */
  115. #define HP100_REG_PTR_TXEND 0x0e /* R: (16) Current end of Rx ring */
  116. #define HP100_REG_PTR_RPDLSTART 0x10
  117. #define HP100_REG_PTR_RPDLEND 0x12
  118. #define HP100_REG_PTR_RINGPTRS 0x14
  119. #define HP100_REG_PTR_MEMDEBUG 0x1a
  120. /* ------------------------------------------------------------------------ */
  121. /*
  122. * Hardware ID Register I (Always available, HW_ID, Offset 0x00)
  123. */
  124. #define HP100_HW_ID_CASCADE 0x4850 /* Identifies Cascade Chip */
  125. /*
  126. * Hardware ID Register 2 & Paging Register
  127. * (Always available, PAGING, Offset 0x02)
  128. * Bits 15:4 are for the Chip ID
  129. */
  130. #define HP100_CHIPID_MASK 0xFFF0
  131. #define HP100_CHIPID_SHASTA 0x5350 /* Not 802.12 compliant */
  132. /* EISA BM/SL, MCA16/32 SL, ISA SL */
  133. #define HP100_CHIPID_RAINIER 0x5360 /* Not 802.12 compliant EISA BM, */
  134. /* PCI SL, MCA16/32 SL, ISA SL */
  135. #define HP100_CHIPID_LASSEN 0x5370 /* 802.12 compliant PCI BM, PCI SL */
  136. /* LRF supported */
  137. /*
  138. * Option Registers I and II
  139. * (Always available, OPTION_LSW, Offset 0x04-0x05)
  140. */
  141. #define HP100_DEBUG_EN 0x8000 /* 0:Dis., 1:Enable Debug Dump Ptr. */
  142. #define HP100_RX_HDR 0x4000 /* 0:Dis., 1:Enable putting pkt into */
  143. /* system mem. before Rx interrupt */
  144. #define HP100_MMAP_DIS 0x2000 /* 0:Enable, 1:Disable mem.mapping. */
  145. /* MMAP_DIS must be 0 and MEM_EN */
  146. /* must be 1 for memory-mapped */
  147. /* mode to be enabled */
  148. #define HP100_EE_EN 0x1000 /* 0:Disable,1:Enable EEPROM writing */
  149. #define HP100_BM_WRITE 0x0800 /* 0:Slave, 1:Bus Master for Tx data */
  150. #define HP100_BM_READ 0x0400 /* 0:Slave, 1:Bus Master for Rx data */
  151. #define HP100_TRI_INT 0x0200 /* 0:Don't, 1:Do tri-state the int */
  152. #define HP100_MEM_EN 0x0040 /* Config program set this to */
  153. /* 0:Disable, 1:Enable mem map. */
  154. /* See MMAP_DIS. */
  155. #define HP100_IO_EN 0x0020 /* 1:Enable I/O transfers */
  156. #define HP100_BOOT_EN 0x0010 /* 1:Enable boot ROM access */
  157. #define HP100_FAKE_INT 0x0008 /* 1:int */
  158. #define HP100_INT_EN 0x0004 /* 1:Enable ints from card */
  159. #define HP100_HW_RST 0x0002 /* 0:Reset, 1:Out of reset */
  160. /* NIC reset on 0 to 1 transition */
  161. /*
  162. * Option Register III
  163. * (Always available, OPTION_MSW, Offset 0x06)
  164. */
  165. #define HP100_PRIORITY_TX 0x0080 /* 1:Do all Tx pkts as priority */
  166. #define HP100_EE_LOAD 0x0040 /* 1:EEPROM loading, 0 when done */
  167. #define HP100_ADV_NXT_PKT 0x0004 /* 1:Advance to next pkt in Rx queue */
  168. /* h/w will set to 0 when done */
  169. #define HP100_TX_CMD 0x0002 /* 1:Tell h/w download done, h/w */
  170. /* will set to 0 when done */
  171. /*
  172. * Interrupt Status Registers I and II
  173. * (Page PERFORMANCE, IRQ_STATUS, Offset 0x08-0x09)
  174. * Note: With old chips, these Registers will clear when 1 is written to them
  175. * with new chips this depends on setting of CLR_ISMODE
  176. */
  177. #define HP100_RX_EARLY_INT 0x2000
  178. #define HP100_RX_PDA_ZERO 0x1000
  179. #define HP100_RX_PDL_FILL_COMPL 0x0800
  180. #define HP100_RX_PACKET 0x0400 /* 0:No, 1:Yes pkt has been Rx */
  181. #define HP100_RX_ERROR 0x0200 /* 0:No, 1:Yes Rx pkt had error */
  182. #define HP100_TX_PDA_ZERO 0x0020 /* 1 when PDA count goes to zero */
  183. #define HP100_TX_SPACE_AVAIL 0x0010 /* 0:<8192, 1:>=8192 Tx free bytes */
  184. #define HP100_TX_COMPLETE 0x0008 /* 0:No, 1:Yes a Tx has completed */
  185. #define HP100_MISC_ERROR 0x0004 /* 0:No, 1:Lan Link down or bus error */
  186. #define HP100_TX_ERROR 0x0002 /* 0:No, 1:Yes Tx pkt had error */
  187. /*
  188. * Xmit Memory Free Count
  189. * (Page PERFORMANCE, TX_MEM_FREE, Offset 0x14) (Read only, 32bit)
  190. */
  191. #define HP100_AUTO_COMPARE 0x80000000 /* Tx Space avail & pkts<255 */
  192. #define HP100_FREE_SPACE 0x7fffffe0 /* Tx free memory */
  193. /*
  194. * IRQ Channel
  195. * (Page HW_MAP, IRQ_CHANNEL, Offset 0x0d)
  196. */
  197. #define HP100_ZERO_WAIT_EN 0x80 /* 0:No, 1:Yes asserts NOWS signal */
  198. #define HP100_IRQ_SCRAMBLE 0x40
  199. #define HP100_BOND_HP 0x20
  200. #define HP100_LEVEL_IRQ 0x10 /* 0:Edge, 1:Level type interrupts. */
  201. /* (Only valid on EISA cards) */
  202. #define HP100_IRQMASK 0x0F /* Isolate the IRQ bits */
  203. /*
  204. * SRAM Parameters
  205. * (Page HW_MAP, SRAM, Offset 0x0e)
  206. */
  207. #define HP100_RAM_SIZE_MASK 0xe0 /* AND to get SRAM size index */
  208. #define HP100_RAM_SIZE_SHIFT 0x05 /* Shift count(put index in lwr bits) */
  209. /*
  210. * Bus Master Register
  211. * (Page HW_MAP, BM, Offset 0x0f)
  212. */
  213. #define HP100_BM_BURST_RD 0x01 /* EISA only: 1=Use burst trans. fm system */
  214. /* memory to chip (tx) */
  215. #define HP100_BM_BURST_WR 0x02 /* EISA only: 1=Use burst trans. fm system */
  216. /* memory to chip (rx) */
  217. #define HP100_BM_MASTER 0x04 /* 0:Slave, 1:BM mode */
  218. #define HP100_BM_PAGE_CK 0x08 /* This bit should be set whenever in */
  219. /* an EISA system */
  220. #define HP100_BM_PCI_8CLK 0x40 /* ... cycles 8 clocks apart */
  221. /*
  222. * Mode Control Register I
  223. * (Page HW_MAP, MODECTRL1, Offset0x10)
  224. */
  225. #define HP100_TX_DUALQ 0x10
  226. /* If set and BM -> dual tx pda queues */
  227. #define HP100_ISR_CLRMODE 0x02 /* If set ISR will clear all pending */
  228. /* interrupts on read (etr only?) */
  229. #define HP100_EE_NOLOAD 0x04 /* Status whether res will be loaded */
  230. /* from the eeprom */
  231. #define HP100_TX_CNT_FLG 0x08 /* Controls Early TX Reg Cnt Field */
  232. #define HP100_PDL_USE3 0x10 /* If set BM engine will read only */
  233. /* first three data elements of a PDL */
  234. /* on the first access. */
  235. #define HP100_BUSTYPE_MASK 0xe0 /* Three bit bus type info */
  236. /*
  237. * Mode Control Register II
  238. * (Page HW_MAP, MODECTRL2, Offset0x11)
  239. */
  240. #define HP100_EE_MASK 0x0f /* Tell EEPROM circuit not to load */
  241. /* certain resources */
  242. #define HP100_DIS_CANCEL 0x20 /* For tx dualq mode operation */
  243. #define HP100_EN_PDL_WB 0x40 /* 1: Status of PDL completion may be */
  244. /* written back to system mem */
  245. #define HP100_EN_BUS_FAIL 0x80 /* Enables bus-fail portion of misc */
  246. /* interrupt */
  247. /*
  248. * PCI Configuration and Control Register I
  249. * (Page HW_MAP, PCICTRL1, Offset 0x12)
  250. */
  251. #define HP100_LO_MEM 0x01 /* 1: Mapped Mem requested below 1MB */
  252. #define HP100_NO_MEM 0x02 /* 1: Disables Req for sysmem to PCI */
  253. /* bios */
  254. #define HP100_USE_ISA 0x04 /* 1: isa type decodes will occur */
  255. /* simultaneously with PCI decodes */
  256. #define HP100_IRQ_HI_MASK 0xf0 /* pgmed by pci bios */
  257. #define HP100_PCI_IRQ_HI_MASK 0x78 /* Isolate 4 bits for PCI IRQ */
  258. /*
  259. * PCI Configuration and Control Register II
  260. * (Page HW_MAP, PCICTRL2, Offset 0x13)
  261. */
  262. #define HP100_RD_LINE_PDL 0x01 /* 1: PCI command Memory Read Line en */
  263. #define HP100_RD_TX_DATA_MASK 0x06 /* choose PCI memread cmds for TX */
  264. #define HP100_MWI 0x08 /* 1: en. PCI memory write invalidate */
  265. #define HP100_ARB_MODE 0x10 /* Select PCI arbitor type */
  266. #define HP100_STOP_EN 0x20 /* Enables PCI state machine to issue */
  267. /* pci stop if cascade not ready */
  268. #define HP100_IGNORE_PAR 0x40 /* 1: PCI state machine ignores parity */
  269. #define HP100_PCI_RESET 0x80 /* 0->1: Reset PCI block */
  270. /*
  271. * Early TX Configuration and Control Register
  272. * (Page HW_MAP, EARLYTXCFG, Offset 0x16)
  273. */
  274. #define HP100_EN_EARLY_TX 0x8000 /* 1=Enable Early TX */
  275. #define HP100_EN_ADAPTIVE 0x4000 /* 1=Enable adaptive mode */
  276. #define HP100_EN_TX_UR_IRQ 0x2000 /* reserved, must be 0 */
  277. #define HP100_EN_LOW_TX 0x1000 /* reserved, must be 0 */
  278. #define HP100_ET_CNT_MASK 0x0fff /* bits 11..0: ET counters */
  279. /*
  280. * Early RX Configuration and Control Register
  281. * (Page HW_MAP, EARLYRXCFG, Offset 0x18)
  282. */
  283. #define HP100_EN_EARLY_RX 0x80 /* 1=Enable Early RX */
  284. #define HP100_EN_LOW_RX 0x40 /* reserved, must be 0 */
  285. #define HP100_RX_TRIP_MASK 0x1f /* bits 4..0: threshold at which the
  286. * early rx circuit will start the
  287. * dma of received packet into system
  288. * memory for BM */
  289. /*
  290. * Serial Devices Control Register
  291. * (Page EEPROM_CTRL, EEPROM_CTRL, Offset 0x08)
  292. */
  293. #define HP100_EEPROM_LOAD 0x0001 /* 0->1 loads EEPROM into registers. */
  294. /* When it goes back to 0, load is */
  295. /* complete. This should take ~600us. */
  296. /*
  297. * 10MB LAN Control and Configuration Register I
  298. * (Page MAC_CTRL, 10_LAN_CFG_1, Offset 0x08)
  299. */
  300. #define HP100_MAC10_SEL 0xc0 /* Get bits to indicate MAC */
  301. #define HP100_AUI_SEL 0x20 /* Status of AUI selection */
  302. #define HP100_LOW_TH 0x10 /* 0:No, 1:Yes allow better cabling */
  303. #define HP100_LINK_BEAT_DIS 0x08 /* 0:Enable, 1:Disable link beat */
  304. #define HP100_LINK_BEAT_ST 0x04 /* 0:No, 1:Yes link beat being Rx */
  305. #define HP100_R_ROL_ST 0x02 /* 0:No, 1:Yes Rx twisted pair has */
  306. /* been reversed */
  307. #define HP100_AUI_ST 0x01 /* 0:No, 1:Yes use AUI on TP card */
  308. /*
  309. * 10 MB LAN Control and Configuration Register II
  310. * (Page MAC_CTRL, 10_LAN_CFG_2, Offset 0x09)
  311. */
  312. #define HP100_SQU_ST 0x01 /* 0:No, 1:Yes collision signal sent */
  313. /* after Tx.Only used for AUI. */
  314. #define HP100_FULLDUP 0x02 /* 1: LXT901 XCVR fullduplx enabled */
  315. #define HP100_DOT3_MAC 0x04 /* 1: DOT 3 Mac sel. unless Autosel */
  316. /*
  317. * MAC Selection, use with MAC10_SEL bits
  318. */
  319. #define HP100_AUTO_SEL_10 0x0 /* Auto select */
  320. #define HP100_XCVR_LXT901_10 0x1 /* LXT901 10BaseT transceiver */
  321. #define HP100_XCVR_7213 0x2 /* 7213 transceiver */
  322. #define HP100_XCVR_82503 0x3 /* 82503 transceiver */
  323. /*
  324. * 100MB LAN Training Register
  325. * (Page MAC_CTRL, VG_LAN_CFG_2, Offset 0x0b) (old, pre 802.12)
  326. */
  327. #define HP100_FRAME_FORMAT 0x08 /* 0:802.3, 1:802.5 frames */
  328. #define HP100_BRIDGE 0x04 /* 0:No, 1:Yes tell hub i am a bridge */
  329. #define HP100_PROM_MODE 0x02 /* 0:No, 1:Yes tell hub card is */
  330. /* promiscuous */
  331. #define HP100_REPEATER 0x01 /* 0:No, 1:Yes tell hub MAC wants to */
  332. /* be a cascaded repeater */
  333. /*
  334. * 100MB LAN Control and Configuration Register
  335. * (Page MAC_CTRL, VG_LAN_CFG_1, Offset 0x0a)
  336. */
  337. #define HP100_VG_SEL 0x80 /* 0:No, 1:Yes use 100 Mbit MAC */
  338. #define HP100_LINK_UP_ST 0x40 /* 0:No, 1:Yes endnode logged in */
  339. #define HP100_LINK_CABLE_ST 0x20 /* 0:No, 1:Yes cable can hear tones */
  340. /* from hub */
  341. #define HP100_LOAD_ADDR 0x10 /* 0->1 card addr will be sent */
  342. /* 100ms later the link status */
  343. /* bits are valid */
  344. #define HP100_LINK_CMD 0x08 /* 0->1 link will attempt to log in. */
  345. /* 100ms later the link status */
  346. /* bits are valid */
  347. #define HP100_TRN_DONE 0x04 /* NEW ETR-Chips only: Will be reset */
  348. /* after LinkUp Cmd is given and set */
  349. /* when training has completed. */
  350. #define HP100_LINK_GOOD_ST 0x02 /* 0:No, 1:Yes cable passed training */
  351. #define HP100_VG_RESET 0x01 /* 0:Yes, 1:No reset the 100VG MAC */
  352. /*
  353. * MAC Configuration Register I
  354. * (Page MAC_CTRL, MAC_CFG_1, Offset 0x0c)
  355. */
  356. #define HP100_RX_IDLE 0x80 /* 0:Yes, 1:No currently receiving pkts */
  357. #define HP100_TX_IDLE 0x40 /* 0:Yes, 1:No currently Txing pkts */
  358. #define HP100_RX_EN 0x20 /* 1: allow receiving of pkts */
  359. #define HP100_TX_EN 0x10 /* 1: allow transmitting of pkts */
  360. #define HP100_ACC_ERRORED 0x08 /* 0:No, 1:Yes allow Rx of errored pkts */
  361. #define HP100_ACC_MC 0x04 /* 0:No, 1:Yes allow Rx of multicast pkts */
  362. #define HP100_ACC_BC 0x02 /* 0:No, 1:Yes allow Rx of broadcast pkts */
  363. #define HP100_ACC_PHY 0x01 /* 0:No, 1:Yes allow Rx of ALL phys. pkts */
  364. #define HP100_MAC1MODEMASK 0xf0 /* Hide ACC bits */
  365. #define HP100_MAC1MODE1 0x00 /* Receive nothing, must also disable RX */
  366. #define HP100_MAC1MODE2 0x00
  367. #define HP100_MAC1MODE3 HP100_MAC1MODE2 | HP100_ACC_BC
  368. #define HP100_MAC1MODE4 HP100_MAC1MODE3 | HP100_ACC_MC
  369. #define HP100_MAC1MODE5 HP100_MAC1MODE4 /* set mc hash to all ones also */
  370. #define HP100_MAC1MODE6 HP100_MAC1MODE5 | HP100_ACC_PHY /* Promiscuous */
  371. /* Note MODE6 will receive all GOOD packets on the LAN. This really needs
  372. a mode 7 defined to be LAN Analyzer mode, which will receive errored and
  373. runt packets, and keep the CRC bytes. */
  374. #define HP100_MAC1MODE7 HP100_MAC1MODE6 | HP100_ACC_ERRORED
  375. /*
  376. * MAC Configuration Register II
  377. * (Page MAC_CTRL, MAC_CFG_2, Offset 0x0d)
  378. */
  379. #define HP100_TR_MODE 0x80 /* 0:No, 1:Yes support Token Ring formats */
  380. #define HP100_TX_SAME 0x40 /* 0:No, 1:Yes Tx same packet continuous */
  381. #define HP100_LBK_XCVR 0x20 /* 0:No, 1:Yes loopback through MAC & */
  382. /* transceiver */
  383. #define HP100_LBK_MAC 0x10 /* 0:No, 1:Yes loopback through MAC */
  384. #define HP100_CRC_I 0x08 /* 0:No, 1:Yes inhibit CRC on Tx packets */
  385. #define HP100_ACCNA 0x04 /* 1: For 802.5: Accept only token ring
  386. * group addr that maches NA mask */
  387. #define HP100_KEEP_CRC 0x02 /* 0:No, 1:Yes keep CRC on Rx packets. */
  388. /* The length will reflect this. */
  389. #define HP100_ACCFA 0x01 /* 1: For 802.5: Accept only functional
  390. * addrs that match FA mask (page1) */
  391. #define HP100_MAC2MODEMASK 0x02
  392. #define HP100_MAC2MODE1 0x00
  393. #define HP100_MAC2MODE2 0x00
  394. #define HP100_MAC2MODE3 0x00
  395. #define HP100_MAC2MODE4 0x00
  396. #define HP100_MAC2MODE5 0x00
  397. #define HP100_MAC2MODE6 0x00
  398. #define HP100_MAC2MODE7 KEEP_CRC
  399. /*
  400. * MAC Configuration Register III
  401. * (Page MAC_CTRL, MAC_CFG_3, Offset 0x0e)
  402. */
  403. #define HP100_PACKET_PACE 0x03 /* Packet Pacing:
  404. * 00: No packet pacing
  405. * 01: 8 to 16 uS delay
  406. * 10: 16 to 32 uS delay
  407. * 11: 32 to 64 uS delay
  408. */
  409. #define HP100_LRF_EN 0x04 /* 1: External LAN Rcv Filter and
  410. * TCP/IP Checksumming enabled. */
  411. #define HP100_AUTO_MODE 0x10 /* 1: AutoSelect between 10/100 */
  412. /*
  413. * MAC Configuration Register IV
  414. * (Page MAC_CTRL, MAC_CFG_4, Offset 0x0f)
  415. */
  416. #define HP100_MAC_SEL_ST 0x01 /* (R): Status of external VGSEL
  417. * Signal, 1=100VG, 0=10Mbit sel. */
  418. #define HP100_LINK_FAIL_ST 0x02 /* (R): Status of Link Fail portion
  419. * of the Misc. Interrupt */
  420. /*
  421. * 100 MB LAN Training Request/Allowed Registers
  422. * (Page MAC_CTRL, TRAIN_REQUEST and TRAIN_ALLOW, Offset 0x14-0x16)(ETR parts only)
  423. */
  424. #define HP100_MACRQ_REPEATER 0x0001 /* 1: MAC tells HUB it wants to be
  425. * a cascaded repeater
  426. * 0: ... wants to be a DTE */
  427. #define HP100_MACRQ_PROMSC 0x0006 /* 2 bits: Promiscious mode
  428. * 00: Rcv only unicast packets
  429. * specifically addr to this
  430. * endnode
  431. * 10: Rcv all pckts fwded by
  432. * the local repeater */
  433. #define HP100_MACRQ_FRAMEFMT_EITHER 0x0018 /* 11: either format allowed */
  434. #define HP100_MACRQ_FRAMEFMT_802_3 0x0000 /* 00: 802.3 is requested */
  435. #define HP100_MACRQ_FRAMEFMT_802_5 0x0010 /* 10: 802.5 format is requested */
  436. #define HP100_CARD_MACVER 0xe000 /* R: 3 bit Cards 100VG MAC version */
  437. #define HP100_MALLOW_REPEATER 0x0001 /* If reset, requested access as an
  438. * end node is allowed */
  439. #define HP100_MALLOW_PROMSC 0x0004 /* 2 bits: Promiscious mode
  440. * 00: Rcv only unicast packets
  441. * specifically addr to this
  442. * endnode
  443. * 10: Rcv all pckts fwded by
  444. * the local repeater */
  445. #define HP100_MALLOW_FRAMEFMT 0x00e0 /* 2 bits: Frame Format
  446. * 00: 802.3 format will be used
  447. * 10: 802.5 format will be used */
  448. #define HP100_MALLOW_ACCDENIED 0x0400 /* N bit */
  449. #define HP100_MALLOW_CONFIGURE 0x0f00 /* C bit */
  450. #define HP100_MALLOW_DUPADDR 0x1000 /* D bit */
  451. #define HP100_HUB_MACVER 0xe000 /* R: 3 bit 802.12 MAC/RMAC training */
  452. /* protocol of repeater */
  453. /* ****************************************************************************** */
  454. /*
  455. * Set/Reset bits
  456. */
  457. #define HP100_SET_HB 0x0100 /* 0:Set fields to 0 whose mask is 1 */
  458. #define HP100_SET_LB 0x0001 /* HB sets upper byte, LB sets lower byte */
  459. #define HP100_RESET_HB 0x0000 /* For readability when resetting bits */
  460. #define HP100_RESET_LB 0x0000 /* For readability when resetting bits */
  461. /*
  462. * Misc. Constants
  463. */
  464. #define HP100_LAN_100 100 /* lan_type value for VG */
  465. #define HP100_LAN_10 10 /* lan_type value for 10BaseT */
  466. #define HP100_LAN_COAX 9 /* lan_type value for Coax */
  467. #define HP100_LAN_ERR (-1) /* lan_type value for link down */
  468. /*
  469. * Bus Master Data Structures ----------------------------------------------
  470. */
  471. #define MAX_RX_PDL 30 /* Card limit = 31 */
  472. #define MAX_RX_FRAG 2 /* Don't need more... */
  473. #define MAX_TX_PDL 29
  474. #define MAX_TX_FRAG 2 /* Limit = 31 */
  475. /* Define total PDL area size in bytes (should be 4096) */
  476. /* This is the size of kernel (dma) memory that will be allocated. */
  477. #define MAX_RINGSIZE ((MAX_RX_FRAG*8+4+4)*MAX_RX_PDL+(MAX_TX_FRAG*8+4+4)*MAX_TX_PDL)+16
  478. /* Ethernet Packet Sizes */
  479. #define MIN_ETHER_SIZE 60
  480. #define MAX_ETHER_SIZE 1514 /* Needed for preallocation of */
  481. /* skb buffer when busmastering */
  482. /* Tx or Rx Ring Entry */
  483. typedef struct hp100_ring {
  484. u_int *pdl; /* Address of PDLs PDH, dword before
  485. * this address is used for rx hdr */
  486. u_int pdl_paddr; /* Physical address of PDL */
  487. struct sk_buff *skb;
  488. struct hp100_ring *next;
  489. } hp100_ring_t;
  490. /* Mask for Header Descriptor */
  491. #define HP100_PKT_LEN_MASK 0x1FFF /* AND with RxLength to get length */
  492. /* Receive Packet Status. Note, the error bits are only valid if ACC_ERRORED
  493. bit in the MAC Configuration Register 1 is set. */
  494. #define HP100_RX_PRI 0x8000 /* 0:No, 1:Yes packet is priority */
  495. #define HP100_SDF_ERR 0x4000 /* 0:No, 1:Yes start of frame error */
  496. #define HP100_SKEW_ERR 0x2000 /* 0:No, 1:Yes skew out of range */
  497. #define HP100_BAD_SYMBOL_ERR 0x1000 /* 0:No, 1:Yes invalid symbol received */
  498. #define HP100_RCV_IPM_ERR 0x0800 /* 0:No, 1:Yes pkt had an invalid packet */
  499. /* marker */
  500. #define HP100_SYMBOL_BAL_ERR 0x0400 /* 0:No, 1:Yes symbol balance error */
  501. #define HP100_VG_ALN_ERR 0x0200 /* 0:No, 1:Yes non-octet received */
  502. #define HP100_TRUNC_ERR 0x0100 /* 0:No, 1:Yes the packet was truncated */
  503. #define HP100_RUNT_ERR 0x0040 /* 0:No, 1:Yes pkt length < Min Pkt */
  504. /* Length Reg. */
  505. #define HP100_ALN_ERR 0x0010 /* 0:No, 1:Yes align error. */
  506. #define HP100_CRC_ERR 0x0008 /* 0:No, 1:Yes CRC occurred. */
  507. /* The last three bits indicate the type of destination address */
  508. #define HP100_MULTI_ADDR_HASH 0x0006 /* 110: Addr multicast, matched hash */
  509. #define HP100_BROADCAST_ADDR 0x0003 /* x11: Addr broadcast */
  510. #define HP100_MULTI_ADDR_NO_HASH 0x0002 /* 010: Addr multicast, didn't match hash */
  511. #define HP100_PHYS_ADDR_MATCH 0x0001 /* x01: Addr was physical and mine */
  512. #define HP100_PHYS_ADDR_NO_MATCH 0x0000 /* x00: Addr was physical but not mine */
  513. /*
  514. * macros
  515. */
  516. #define hp100_inb( reg ) \
  517. inb( ioaddr + HP100_REG_##reg )
  518. #define hp100_inw( reg ) \
  519. inw( ioaddr + HP100_REG_##reg )
  520. #define hp100_inl( reg ) \
  521. inl( ioaddr + HP100_REG_##reg )
  522. #define hp100_outb( data, reg ) \
  523. outb( data, ioaddr + HP100_REG_##reg )
  524. #define hp100_outw( data, reg ) \
  525. outw( data, ioaddr + HP100_REG_##reg )
  526. #define hp100_outl( data, reg ) \
  527. outl( data, ioaddr + HP100_REG_##reg )
  528. #define hp100_orb( data, reg ) \
  529. outb( inb( ioaddr + HP100_REG_##reg ) | (data), ioaddr + HP100_REG_##reg )
  530. #define hp100_orw( data, reg ) \
  531. outw( inw( ioaddr + HP100_REG_##reg ) | (data), ioaddr + HP100_REG_##reg )
  532. #define hp100_andb( data, reg ) \
  533. outb( inb( ioaddr + HP100_REG_##reg ) & (data), ioaddr + HP100_REG_##reg )
  534. #define hp100_andw( data, reg ) \
  535. outw( inw( ioaddr + HP100_REG_##reg ) & (data), ioaddr + HP100_REG_##reg )
  536. #define hp100_page( page ) \
  537. outw( HP100_PAGE_##page, ioaddr + HP100_REG_PAGING )
  538. #define hp100_ints_off() \
  539. outw( HP100_INT_EN | HP100_RESET_LB, ioaddr + HP100_REG_OPTION_LSW )
  540. #define hp100_ints_on() \
  541. outw( HP100_INT_EN | HP100_SET_LB, ioaddr + HP100_REG_OPTION_LSW )
  542. #define hp100_mem_map_enable() \
  543. outw( HP100_MMAP_DIS | HP100_RESET_HB, ioaddr + HP100_REG_OPTION_LSW )
  544. #define hp100_mem_map_disable() \
  545. outw( HP100_MMAP_DIS | HP100_SET_HB, ioaddr + HP100_REG_OPTION_LSW )