netxen_nic_hw.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /*
  2. * Copyright (C) 2003 - 2006 NetXen, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  18. * MA 02111-1307, USA.
  19. *
  20. * The full GNU General Public License is included in this distribution
  21. * in the file called LICENSE.
  22. *
  23. * Contact Information:
  24. * info@netxen.com
  25. * NetXen,
  26. * 3965 Freedom Circle, Fourth floor,
  27. * Santa Clara, CA 95054
  28. *
  29. *
  30. * Structures, enums, and macros for the MAC
  31. *
  32. */
  33. #ifndef __NETXEN_NIC_HW_H_
  34. #define __NETXEN_NIC_HW_H_
  35. #include "netxen_nic_hdr.h"
  36. /* Hardware memory size of 128 meg */
  37. #define NETXEN_MEMADDR_MAX (128 * 1024 * 1024)
  38. #ifndef readq
  39. static inline u64 readq(void __iomem * addr)
  40. {
  41. return readl(addr) | (((u64) readl(addr + 4)) << 32LL);
  42. }
  43. #endif
  44. #ifndef writeq
  45. static inline void writeq(u64 val, void __iomem * addr)
  46. {
  47. writel(((u32) (val)), (addr));
  48. writel(((u32) (val >> 32)), (addr + 4));
  49. }
  50. #endif
  51. static inline void netxen_nic_hw_block_write64(u64 __iomem * data_ptr,
  52. u64 __iomem * addr,
  53. int num_words)
  54. {
  55. int num;
  56. for (num = 0; num < num_words; num++) {
  57. writeq(readq((void __iomem *)data_ptr), addr);
  58. addr++;
  59. data_ptr++;
  60. }
  61. }
  62. static inline void netxen_nic_hw_block_read64(u64 __iomem * data_ptr,
  63. u64 __iomem * addr, int num_words)
  64. {
  65. int num;
  66. for (num = 0; num < num_words; num++) {
  67. writeq(readq((void __iomem *)addr), data_ptr);
  68. addr++;
  69. data_ptr++;
  70. }
  71. }
  72. struct netxen_adapter;
  73. #define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
  74. struct netxen_port;
  75. void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
  76. void netxen_nic_flash_print(struct netxen_adapter *adapter);
  77. typedef u8 netxen_ethernet_macaddr_t[6];
  78. /* Nibble or Byte mode for phy interface (GbE mode only) */
  79. typedef enum {
  80. NETXEN_NIU_10_100_MB = 0,
  81. NETXEN_NIU_1000_MB
  82. } netxen_niu_gbe_ifmode_t;
  83. #define _netxen_crb_get_bit(var, bit) ((var >> bit) & 0x1)
  84. /*
  85. * NIU GB MAC Config Register 0 (applies to GB0, GB1, GB2, GB3)
  86. *
  87. * Bit 0 : enable_tx => 1:enable frame xmit, 0:disable
  88. * Bit 1 : tx_synced => R/O: xmit enable synched to xmit stream
  89. * Bit 2 : enable_rx => 1:enable frame recv, 0:disable
  90. * Bit 3 : rx_synced => R/O: recv enable synched to recv stream
  91. * Bit 4 : tx_flowctl => 1:enable pause frame generation, 0:disable
  92. * Bit 5 : rx_flowctl => 1:act on recv'd pause frames, 0:ignore
  93. * Bit 8 : loopback => 1:loop MAC xmits to MAC recvs, 0:normal
  94. * Bit 16: tx_reset_pb => 1:reset frame xmit protocol blk, 0:no-op
  95. * Bit 17: rx_reset_pb => 1:reset frame recv protocol blk, 0:no-op
  96. * Bit 18: tx_reset_mac => 1:reset data/ctl multiplexer blk, 0:no-op
  97. * Bit 19: rx_reset_mac => 1:reset ctl frames & timers blk, 0:no-op
  98. * Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op
  99. */
  100. #define netxen_gb_enable_tx(config_word) \
  101. ((config_word) |= 1 << 0)
  102. #define netxen_gb_enable_rx(config_word) \
  103. ((config_word) |= 1 << 2)
  104. #define netxen_gb_tx_flowctl(config_word) \
  105. ((config_word) |= 1 << 4)
  106. #define netxen_gb_rx_flowctl(config_word) \
  107. ((config_word) |= 1 << 5)
  108. #define netxen_gb_tx_reset_pb(config_word) \
  109. ((config_word) |= 1 << 16)
  110. #define netxen_gb_rx_reset_pb(config_word) \
  111. ((config_word) |= 1 << 17)
  112. #define netxen_gb_tx_reset_mac(config_word) \
  113. ((config_word) |= 1 << 18)
  114. #define netxen_gb_rx_reset_mac(config_word) \
  115. ((config_word) |= 1 << 19)
  116. #define netxen_gb_soft_reset(config_word) \
  117. ((config_word) |= 1 << 31)
  118. #define netxen_gb_unset_tx_flowctl(config_word) \
  119. ((config_word) &= ~(1 << 4))
  120. #define netxen_gb_unset_rx_flowctl(config_word) \
  121. ((config_word) &= ~(1 << 5))
  122. #define netxen_gb_get_tx_synced(config_word) \
  123. _netxen_crb_get_bit((config_word), 1)
  124. #define netxen_gb_get_rx_synced(config_word) \
  125. _netxen_crb_get_bit((config_word), 3)
  126. #define netxen_gb_get_tx_flowctl(config_word) \
  127. _netxen_crb_get_bit((config_word), 4)
  128. #define netxen_gb_get_rx_flowctl(config_word) \
  129. _netxen_crb_get_bit((config_word), 5)
  130. #define netxen_gb_get_soft_reset(config_word) \
  131. _netxen_crb_get_bit((config_word), 31)
  132. /*
  133. * NIU GB MAC Config Register 1 (applies to GB0, GB1, GB2, GB3)
  134. *
  135. * Bit 0 : duplex => 1:full duplex mode, 0:half duplex
  136. * Bit 1 : crc_enable => 1:append CRC to xmit frames, 0:dont append
  137. * Bit 2 : padshort => 1:pad short frames and add CRC, 0:dont pad
  138. * Bit 4 : checklength => 1:check framelen with actual,0:dont check
  139. * Bit 5 : hugeframes => 1:allow oversize xmit frames, 0:dont allow
  140. * Bits 8-9 : intfmode => 01:nibble (10/100), 10:byte (1000)
  141. * Bits 12-15 : preamblelen => preamble field length in bytes, default 7
  142. */
  143. #define netxen_gb_set_duplex(config_word) \
  144. ((config_word) |= 1 << 0)
  145. #define netxen_gb_set_crc_enable(config_word) \
  146. ((config_word) |= 1 << 1)
  147. #define netxen_gb_set_padshort(config_word) \
  148. ((config_word) |= 1 << 2)
  149. #define netxen_gb_set_checklength(config_word) \
  150. ((config_word) |= 1 << 4)
  151. #define netxen_gb_set_hugeframes(config_word) \
  152. ((config_word) |= 1 << 5)
  153. #define netxen_gb_set_preamblelen(config_word, val) \
  154. ((config_word) |= ((val) << 12) & 0xF000)
  155. #define netxen_gb_set_intfmode(config_word, val) \
  156. ((config_word) |= ((val) << 8) & 0x300)
  157. #define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16)
  158. #define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \
  159. ((config_word) |= ((val) & 0x07))
  160. #define netxen_gb_mii_mgmt_reset(config_word) \
  161. ((config_word) |= 1 << 31)
  162. #define netxen_gb_mii_mgmt_unset(config_word) \
  163. ((config_word) &= ~(1 << 31))
  164. /*
  165. * NIU GB MII Mgmt Command Register (applies to GB0, GB1, GB2, GB3)
  166. * Bit 0 : read_cycle => 1:perform single read cycle, 0:no-op
  167. * Bit 1 : scan_cycle => 1:perform continuous read cycles, 0:no-op
  168. */
  169. #define netxen_gb_mii_mgmt_set_read_cycle(config_word) \
  170. ((config_word) |= 1 << 0)
  171. #define netxen_gb_mii_mgmt_reg_addr(config_word, val) \
  172. ((config_word) |= ((val) & 0x1F))
  173. #define netxen_gb_mii_mgmt_phy_addr(config_word, val) \
  174. ((config_word) |= (((val) & 0x1F) << 8))
  175. /*
  176. * NIU GB MII Mgmt Indicators Register (applies to GB0, GB1, GB2, GB3)
  177. * Read-only register.
  178. * Bit 0 : busy => 1:performing an MII mgmt cycle, 0:idle
  179. * Bit 1 : scanning => 1:scan operation in progress, 0:idle
  180. * Bit 2 : notvalid => :mgmt result data not yet valid, 0:idle
  181. */
  182. #define netxen_get_gb_mii_mgmt_busy(config_word) \
  183. _netxen_crb_get_bit(config_word, 0)
  184. #define netxen_get_gb_mii_mgmt_scanning(config_word) \
  185. _netxen_crb_get_bit(config_word, 1)
  186. #define netxen_get_gb_mii_mgmt_notvalid(config_word) \
  187. _netxen_crb_get_bit(config_word, 2)
  188. /*
  189. * NIU XG Pause Ctl Register
  190. *
  191. * Bit 0 : xg0_mask => 1:disable tx pause frames
  192. * Bit 1 : xg0_request => 1:request single pause frame
  193. * Bit 2 : xg0_on_off => 1:request is pause on, 0:off
  194. * Bit 3 : xg1_mask => 1:disable tx pause frames
  195. * Bit 4 : xg1_request => 1:request single pause frame
  196. * Bit 5 : xg1_on_off => 1:request is pause on, 0:off
  197. */
  198. #define netxen_xg_set_xg0_mask(config_word) \
  199. ((config_word) |= 1 << 0)
  200. #define netxen_xg_set_xg1_mask(config_word) \
  201. ((config_word) |= 1 << 3)
  202. #define netxen_xg_get_xg0_mask(config_word) \
  203. _netxen_crb_get_bit((config_word), 0)
  204. #define netxen_xg_get_xg1_mask(config_word) \
  205. _netxen_crb_get_bit((config_word), 3)
  206. #define netxen_xg_unset_xg0_mask(config_word) \
  207. ((config_word) &= ~(1 << 0))
  208. #define netxen_xg_unset_xg1_mask(config_word) \
  209. ((config_word) &= ~(1 << 3))
  210. /*
  211. * NIU XG Pause Ctl Register
  212. *
  213. * Bit 0 : xg0_mask => 1:disable tx pause frames
  214. * Bit 1 : xg0_request => 1:request single pause frame
  215. * Bit 2 : xg0_on_off => 1:request is pause on, 0:off
  216. * Bit 3 : xg1_mask => 1:disable tx pause frames
  217. * Bit 4 : xg1_request => 1:request single pause frame
  218. * Bit 5 : xg1_on_off => 1:request is pause on, 0:off
  219. */
  220. #define netxen_gb_set_gb0_mask(config_word) \
  221. ((config_word) |= 1 << 0)
  222. #define netxen_gb_set_gb1_mask(config_word) \
  223. ((config_word) |= 1 << 2)
  224. #define netxen_gb_set_gb2_mask(config_word) \
  225. ((config_word) |= 1 << 4)
  226. #define netxen_gb_set_gb3_mask(config_word) \
  227. ((config_word) |= 1 << 6)
  228. #define netxen_gb_get_gb0_mask(config_word) \
  229. _netxen_crb_get_bit((config_word), 0)
  230. #define netxen_gb_get_gb1_mask(config_word) \
  231. _netxen_crb_get_bit((config_word), 2)
  232. #define netxen_gb_get_gb2_mask(config_word) \
  233. _netxen_crb_get_bit((config_word), 4)
  234. #define netxen_gb_get_gb3_mask(config_word) \
  235. _netxen_crb_get_bit((config_word), 6)
  236. #define netxen_gb_unset_gb0_mask(config_word) \
  237. ((config_word) &= ~(1 << 0))
  238. #define netxen_gb_unset_gb1_mask(config_word) \
  239. ((config_word) &= ~(1 << 2))
  240. #define netxen_gb_unset_gb2_mask(config_word) \
  241. ((config_word) &= ~(1 << 4))
  242. #define netxen_gb_unset_gb3_mask(config_word) \
  243. ((config_word) &= ~(1 << 6))
  244. /*
  245. * PHY-Specific MII control/status registers.
  246. */
  247. typedef enum {
  248. NETXEN_NIU_GB_MII_MGMT_ADDR_CONTROL = 0,
  249. NETXEN_NIU_GB_MII_MGMT_ADDR_STATUS = 1,
  250. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_0 = 2,
  251. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_1 = 3,
  252. NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG = 4,
  253. NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART = 5,
  254. NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG_MORE = 6,
  255. NETXEN_NIU_GB_MII_MGMT_ADDR_NEXTPAGE_XMIT = 7,
  256. NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART_NEXTPAGE = 8,
  257. NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_CONTROL = 9,
  258. NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_STATUS = 10,
  259. NETXEN_NIU_GB_MII_MGMT_ADDR_EXTENDED_STATUS = 15,
  260. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL = 16,
  261. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS = 17,
  262. NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE = 18,
  263. NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS = 19,
  264. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE = 20,
  265. NETXEN_NIU_GB_MII_MGMT_ADDR_RECV_ERROR_COUNT = 21,
  266. NETXEN_NIU_GB_MII_MGMT_ADDR_LED_CONTROL = 24,
  267. NETXEN_NIU_GB_MII_MGMT_ADDR_LED_OVERRIDE = 25,
  268. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE_YET = 26,
  269. NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS_MORE = 27
  270. } netxen_niu_phy_register_t;
  271. /*
  272. * PHY-Specific Status Register (reg 17).
  273. *
  274. * Bit 0 : jabber => 1:jabber detected, 0:not
  275. * Bit 1 : polarity => 1:polarity reversed, 0:normal
  276. * Bit 2 : recvpause => 1:receive pause enabled, 0:disabled
  277. * Bit 3 : xmitpause => 1:transmit pause enabled, 0:disabled
  278. * Bit 4 : energydetect => 1:sleep, 0:active
  279. * Bit 5 : downshift => 1:downshift, 0:no downshift
  280. * Bit 6 : crossover => 1:MDIX (crossover), 0:MDI (no crossover)
  281. * Bits 7-9 : cablelen => not valid in 10Mb/s mode
  282. * 0:<50m, 1:50-80m, 2:80-110m, 3:110-140m, 4:>140m
  283. * Bit 10 : link => 1:link up, 0:link down
  284. * Bit 11 : resolved => 1:speed and duplex resolved, 0:not yet
  285. * Bit 12 : pagercvd => 1:page received, 0:page not received
  286. * Bit 13 : duplex => 1:full duplex, 0:half duplex
  287. * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd
  288. */
  289. #define netxen_get_phy_cablelen(config_word) (((config_word) >> 7) & 0x07)
  290. #define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03)
  291. #define netxen_set_phy_speed(config_word, val) \
  292. ((config_word) |= ((val & 0x03) << 14))
  293. #define netxen_set_phy_duplex(config_word) \
  294. ((config_word) |= 1 << 13)
  295. #define netxen_clear_phy_duplex(config_word) \
  296. ((config_word) &= ~(1 << 13))
  297. #define netxen_get_phy_jabber(config_word) \
  298. _netxen_crb_get_bit(config_word, 0)
  299. #define netxen_get_phy_polarity(config_word) \
  300. _netxen_crb_get_bit(config_word, 1)
  301. #define netxen_get_phy_recvpause(config_word) \
  302. _netxen_crb_get_bit(config_word, 2)
  303. #define netxen_get_phy_xmitpause(config_word) \
  304. _netxen_crb_get_bit(config_word, 3)
  305. #define netxen_get_phy_energydetect(config_word) \
  306. _netxen_crb_get_bit(config_word, 4)
  307. #define netxen_get_phy_downshift(config_word) \
  308. _netxen_crb_get_bit(config_word, 5)
  309. #define netxen_get_phy_crossover(config_word) \
  310. _netxen_crb_get_bit(config_word, 6)
  311. #define netxen_get_phy_link(config_word) \
  312. _netxen_crb_get_bit(config_word, 10)
  313. #define netxen_get_phy_resolved(config_word) \
  314. _netxen_crb_get_bit(config_word, 11)
  315. #define netxen_get_phy_pagercvd(config_word) \
  316. _netxen_crb_get_bit(config_word, 12)
  317. #define netxen_get_phy_duplex(config_word) \
  318. _netxen_crb_get_bit(config_word, 13)
  319. /*
  320. * Interrupt Register definition
  321. * This definition applies to registers 18 and 19 (int enable and int status).
  322. * Bit 0 : jabber
  323. * Bit 1 : polarity_changed
  324. * Bit 4 : energy_detect
  325. * Bit 5 : downshift
  326. * Bit 6 : mdi_xover_changed
  327. * Bit 7 : fifo_over_underflow
  328. * Bit 8 : false_carrier
  329. * Bit 9 : symbol_error
  330. * Bit 10: link_status_changed
  331. * Bit 11: autoneg_completed
  332. * Bit 12: page_received
  333. * Bit 13: duplex_changed
  334. * Bit 14: speed_changed
  335. * Bit 15: autoneg_error
  336. */
  337. #define netxen_get_phy_int_jabber(config_word) \
  338. _netxen_crb_get_bit(config_word, 0)
  339. #define netxen_get_phy_int_polarity_changed(config_word) \
  340. _netxen_crb_get_bit(config_word, 1)
  341. #define netxen_get_phy_int_energy_detect(config_word) \
  342. _netxen_crb_get_bit(config_word, 4)
  343. #define netxen_get_phy_int_downshift(config_word) \
  344. _netxen_crb_get_bit(config_word, 5)
  345. #define netxen_get_phy_int_mdi_xover_changed(config_word) \
  346. _netxen_crb_get_bit(config_word, 6)
  347. #define netxen_get_phy_int_fifo_over_underflow(config_word) \
  348. _netxen_crb_get_bit(config_word, 7)
  349. #define netxen_get_phy_int_false_carrier(config_word) \
  350. _netxen_crb_get_bit(config_word, 8)
  351. #define netxen_get_phy_int_symbol_error(config_word) \
  352. _netxen_crb_get_bit(config_word, 9)
  353. #define netxen_get_phy_int_link_status_changed(config_word) \
  354. _netxen_crb_get_bit(config_word, 10)
  355. #define netxen_get_phy_int_autoneg_completed(config_word) \
  356. _netxen_crb_get_bit(config_word, 11)
  357. #define netxen_get_phy_int_page_received(config_word) \
  358. _netxen_crb_get_bit(config_word, 12)
  359. #define netxen_get_phy_int_duplex_changed(config_word) \
  360. _netxen_crb_get_bit(config_word, 13)
  361. #define netxen_get_phy_int_speed_changed(config_word) \
  362. _netxen_crb_get_bit(config_word, 14)
  363. #define netxen_get_phy_int_autoneg_error(config_word) \
  364. _netxen_crb_get_bit(config_word, 15)
  365. #define netxen_set_phy_int_link_status_changed(config_word) \
  366. ((config_word) |= 1 << 10)
  367. #define netxen_set_phy_int_autoneg_completed(config_word) \
  368. ((config_word) |= 1 << 11)
  369. #define netxen_set_phy_int_speed_changed(config_word) \
  370. ((config_word) |= 1 << 14)
  371. /*
  372. * NIU Mode Register.
  373. * Bit 0 : enable FibreChannel
  374. * Bit 1 : enable 10/100/1000 Ethernet
  375. * Bit 2 : enable 10Gb Ethernet
  376. */
  377. #define netxen_get_niu_enable_ge(config_word) \
  378. _netxen_crb_get_bit(config_word, 1)
  379. #define NETXEN_NIU_NON_PROMISC_MODE 0
  380. #define NETXEN_NIU_PROMISC_MODE 1
  381. #define NETXEN_NIU_ALLMULTI_MODE 2
  382. /*
  383. * NIU GB Drop CRC Register
  384. *
  385. * Bit 0 : drop_gb0 => 1:drop pkts with bad CRCs, 0:pass them on
  386. * Bit 1 : drop_gb1 => 1:drop pkts with bad CRCs, 0:pass them on
  387. * Bit 2 : drop_gb2 => 1:drop pkts with bad CRCs, 0:pass them on
  388. * Bit 3 : drop_gb3 => 1:drop pkts with bad CRCs, 0:pass them on
  389. */
  390. #define netxen_set_gb_drop_gb0(config_word) \
  391. ((config_word) |= 1 << 0)
  392. #define netxen_set_gb_drop_gb1(config_word) \
  393. ((config_word) |= 1 << 1)
  394. #define netxen_set_gb_drop_gb2(config_word) \
  395. ((config_word) |= 1 << 2)
  396. #define netxen_set_gb_drop_gb3(config_word) \
  397. ((config_word) |= 1 << 3)
  398. #define netxen_clear_gb_drop_gb0(config_word) \
  399. ((config_word) &= ~(1 << 0))
  400. #define netxen_clear_gb_drop_gb1(config_word) \
  401. ((config_word) &= ~(1 << 1))
  402. #define netxen_clear_gb_drop_gb2(config_word) \
  403. ((config_word) &= ~(1 << 2))
  404. #define netxen_clear_gb_drop_gb3(config_word) \
  405. ((config_word) &= ~(1 << 3))
  406. /*
  407. * NIU XG MAC Config Register
  408. *
  409. * Bit 0 : tx_enable => 1:enable frame xmit, 0:disable
  410. * Bit 2 : rx_enable => 1:enable frame recv, 0:disable
  411. * Bit 4 : soft_reset => 1:reset the MAC , 0:no-op
  412. * Bit 27: xaui_framer_reset
  413. * Bit 28: xaui_rx_reset
  414. * Bit 29: xaui_tx_reset
  415. * Bit 30: xg_ingress_afifo_reset
  416. * Bit 31: xg_egress_afifo_reset
  417. */
  418. #define netxen_xg_soft_reset(config_word) \
  419. ((config_word) |= 1 << 4)
  420. /* Set promiscuous mode for a GbE interface */
  421. int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
  422. u32 mode);
  423. int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
  424. u32 mode);
  425. /* set the MAC address for a given MAC */
  426. int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
  427. netxen_ethernet_macaddr_t addr);
  428. /* XG version */
  429. int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
  430. netxen_ethernet_macaddr_t addr);
  431. /* Generic enable for GbE ports. Will detect the speed of the link. */
  432. int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port);
  433. int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port);
  434. /* Disable a GbE interface */
  435. int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter);
  436. int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
  437. typedef struct {
  438. unsigned valid;
  439. unsigned start_128M;
  440. unsigned end_128M;
  441. unsigned start_2M;
  442. } crb_128M_2M_sub_block_map_t;
  443. typedef struct {
  444. crb_128M_2M_sub_block_map_t sub_block[16];
  445. } crb_128M_2M_block_map_t;
  446. #endif /* __NETXEN_NIC_HW_H_ */