blob: 9fb51627ee5453f34f7e8b5e932aa971393b5f86 [file] [log] [blame]
Amit S. Kale3d396eb2006-10-21 15:33:03 -04001/*
Dhananjay Phadke5d242f12009-02-25 15:57:56 +00002 * Copyright (C) 2003 - 2009 NetXen, Inc.
Amit S. Kale3d396eb2006-10-21 15:33:03 -04003 * All rights reserved.
Amit S. Kale80922fb2006-12-04 09:18:00 -08004 *
Amit S. Kale3d396eb2006-10-21 15:33:03 -04005 * 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.
Mithlesh Thukral3176ff32007-04-20 07:52:37 -07009 *
Amit S. Kale3d396eb2006-10-21 15:33:03 -040010 * 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.
Mithlesh Thukral3176ff32007-04-20 07:52:37 -070014 *
Amit S. Kale3d396eb2006-10-21 15:33:03 -040015 * 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.
Amit S. Kale80922fb2006-12-04 09:18:00 -080019 *
Amit S. Kale3d396eb2006-10-21 15:33:03 -040020 * The full GNU General Public License is included in this distribution
21 * in the file called LICENSE.
Amit S. Kale80922fb2006-12-04 09:18:00 -080022 *
Amit S. Kale3d396eb2006-10-21 15:33:03 -040023 * Contact Information:
24 * info@netxen.com
Dhananjay Phadke5d242f12009-02-25 15:57:56 +000025 * NetXen Inc,
26 * 18922 Forge Drive
27 * Cupertino, CA 95014-0701
Amit S. Kale3d396eb2006-10-21 15:33:03 -040028 *
29 */
30
31#ifndef __NETXEN_NIC_HW_H_
32#define __NETXEN_NIC_HW_H_
33
34#include "netxen_nic_hdr.h"
35
36/* Hardware memory size of 128 meg */
37#define NETXEN_MEMADDR_MAX (128 * 1024 * 1024)
38
39#ifndef readq
40static inline u64 readq(void __iomem * addr)
41{
42 return readl(addr) | (((u64) readl(addr + 4)) << 32LL);
43}
44#endif
45
46#ifndef writeq
47static inline void writeq(u64 val, void __iomem * addr)
48{
49 writel(((u32) (val)), (addr));
50 writel(((u32) (val >> 32)), (addr + 4));
51}
52#endif
53
Amit S. Kale3d396eb2006-10-21 15:33:03 -040054struct netxen_adapter;
55
56#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
57
Amit S. Kale3d396eb2006-10-21 15:33:03 -040058struct netxen_port;
Mithlesh Thukral3176ff32007-04-20 07:52:37 -070059void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
Amit S. Kale3d396eb2006-10-21 15:33:03 -040060void netxen_nic_flash_print(struct netxen_adapter *adapter);
Amit S. Kale3d396eb2006-10-21 15:33:03 -040061
62typedef u8 netxen_ethernet_macaddr_t[6];
63
64/* Nibble or Byte mode for phy interface (GbE mode only) */
65typedef enum {
66 NETXEN_NIU_10_100_MB = 0,
67 NETXEN_NIU_1000_MB
68} netxen_niu_gbe_ifmode_t;
69
70#define _netxen_crb_get_bit(var, bit) ((var >> bit) & 0x1)
71
72/*
73 * NIU GB MAC Config Register 0 (applies to GB0, GB1, GB2, GB3)
74 *
75 * Bit 0 : enable_tx => 1:enable frame xmit, 0:disable
76 * Bit 1 : tx_synced => R/O: xmit enable synched to xmit stream
77 * Bit 2 : enable_rx => 1:enable frame recv, 0:disable
78 * Bit 3 : rx_synced => R/O: recv enable synched to recv stream
79 * Bit 4 : tx_flowctl => 1:enable pause frame generation, 0:disable
80 * Bit 5 : rx_flowctl => 1:act on recv'd pause frames, 0:ignore
81 * Bit 8 : loopback => 1:loop MAC xmits to MAC recvs, 0:normal
82 * Bit 16: tx_reset_pb => 1:reset frame xmit protocol blk, 0:no-op
83 * Bit 17: rx_reset_pb => 1:reset frame recv protocol blk, 0:no-op
84 * Bit 18: tx_reset_mac => 1:reset data/ctl multiplexer blk, 0:no-op
85 * Bit 19: rx_reset_mac => 1:reset ctl frames & timers blk, 0:no-op
86 * Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op
87 */
88
89#define netxen_gb_enable_tx(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +000090 ((config_word) |= 1 << 0)
Amit S. Kale3d396eb2006-10-21 15:33:03 -040091#define netxen_gb_enable_rx(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +000092 ((config_word) |= 1 << 2)
Amit S. Kale3d396eb2006-10-21 15:33:03 -040093#define netxen_gb_tx_flowctl(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +000094 ((config_word) |= 1 << 4)
Amit S. Kale3d396eb2006-10-21 15:33:03 -040095#define netxen_gb_rx_flowctl(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +000096 ((config_word) |= 1 << 5)
Amit S. Kale3d396eb2006-10-21 15:33:03 -040097#define netxen_gb_tx_reset_pb(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +000098 ((config_word) |= 1 << 16)
Amit S. Kale3d396eb2006-10-21 15:33:03 -040099#define netxen_gb_rx_reset_pb(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000100 ((config_word) |= 1 << 17)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400101#define netxen_gb_tx_reset_mac(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000102 ((config_word) |= 1 << 18)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400103#define netxen_gb_rx_reset_mac(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000104 ((config_word) |= 1 << 19)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400105#define netxen_gb_soft_reset(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000106 ((config_word) |= 1 << 31)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400107
108#define netxen_gb_unset_tx_flowctl(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000109 ((config_word) &= ~(1 << 4))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400110#define netxen_gb_unset_rx_flowctl(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000111 ((config_word) &= ~(1 << 5))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400112
113#define netxen_gb_get_tx_synced(config_word) \
114 _netxen_crb_get_bit((config_word), 1)
115#define netxen_gb_get_rx_synced(config_word) \
116 _netxen_crb_get_bit((config_word), 3)
117#define netxen_gb_get_tx_flowctl(config_word) \
118 _netxen_crb_get_bit((config_word), 4)
119#define netxen_gb_get_rx_flowctl(config_word) \
120 _netxen_crb_get_bit((config_word), 5)
121#define netxen_gb_get_soft_reset(config_word) \
122 _netxen_crb_get_bit((config_word), 31)
123
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400124#define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16)
125
126#define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \
127 ((config_word) |= ((val) & 0x07))
128#define netxen_gb_mii_mgmt_reset(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000129 ((config_word) |= 1 << 31)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400130#define netxen_gb_mii_mgmt_unset(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000131 ((config_word) &= ~(1 << 31))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400132
133/*
134 * NIU GB MII Mgmt Command Register (applies to GB0, GB1, GB2, GB3)
135 * Bit 0 : read_cycle => 1:perform single read cycle, 0:no-op
136 * Bit 1 : scan_cycle => 1:perform continuous read cycles, 0:no-op
137 */
138
139#define netxen_gb_mii_mgmt_set_read_cycle(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000140 ((config_word) |= 1 << 0)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400141#define netxen_gb_mii_mgmt_reg_addr(config_word, val) \
142 ((config_word) |= ((val) & 0x1F))
143#define netxen_gb_mii_mgmt_phy_addr(config_word, val) \
144 ((config_word) |= (((val) & 0x1F) << 8))
145
146/*
147 * NIU GB MII Mgmt Indicators Register (applies to GB0, GB1, GB2, GB3)
148 * Read-only register.
149 * Bit 0 : busy => 1:performing an MII mgmt cycle, 0:idle
150 * Bit 1 : scanning => 1:scan operation in progress, 0:idle
151 * Bit 2 : notvalid => :mgmt result data not yet valid, 0:idle
152 */
153#define netxen_get_gb_mii_mgmt_busy(config_word) \
154 _netxen_crb_get_bit(config_word, 0)
155#define netxen_get_gb_mii_mgmt_scanning(config_word) \
156 _netxen_crb_get_bit(config_word, 1)
157#define netxen_get_gb_mii_mgmt_notvalid(config_word) \
158 _netxen_crb_get_bit(config_word, 2)
Mithlesh Thukral6c80b182007-04-20 07:55:26 -0700159/*
160 * NIU XG Pause Ctl Register
161 *
162 * Bit 0 : xg0_mask => 1:disable tx pause frames
163 * Bit 1 : xg0_request => 1:request single pause frame
164 * Bit 2 : xg0_on_off => 1:request is pause on, 0:off
165 * Bit 3 : xg1_mask => 1:disable tx pause frames
166 * Bit 4 : xg1_request => 1:request single pause frame
167 * Bit 5 : xg1_on_off => 1:request is pause on, 0:off
168 */
169
170#define netxen_xg_set_xg0_mask(config_word) \
171 ((config_word) |= 1 << 0)
172#define netxen_xg_set_xg1_mask(config_word) \
173 ((config_word) |= 1 << 3)
Jeff Garzik47906542007-11-23 21:23:36 -0500174
Mithlesh Thukral6c80b182007-04-20 07:55:26 -0700175#define netxen_xg_get_xg0_mask(config_word) \
176 _netxen_crb_get_bit((config_word), 0)
177#define netxen_xg_get_xg1_mask(config_word) \
178 _netxen_crb_get_bit((config_word), 3)
179
180#define netxen_xg_unset_xg0_mask(config_word) \
181 ((config_word) &= ~(1 << 0))
182#define netxen_xg_unset_xg1_mask(config_word) \
183 ((config_word) &= ~(1 << 3))
184
185/*
186 * NIU XG Pause Ctl Register
187 *
188 * Bit 0 : xg0_mask => 1:disable tx pause frames
189 * Bit 1 : xg0_request => 1:request single pause frame
190 * Bit 2 : xg0_on_off => 1:request is pause on, 0:off
191 * Bit 3 : xg1_mask => 1:disable tx pause frames
192 * Bit 4 : xg1_request => 1:request single pause frame
193 * Bit 5 : xg1_on_off => 1:request is pause on, 0:off
194 */
195#define netxen_gb_set_gb0_mask(config_word) \
196 ((config_word) |= 1 << 0)
197#define netxen_gb_set_gb1_mask(config_word) \
198 ((config_word) |= 1 << 2)
199#define netxen_gb_set_gb2_mask(config_word) \
200 ((config_word) |= 1 << 4)
201#define netxen_gb_set_gb3_mask(config_word) \
202 ((config_word) |= 1 << 6)
203
204#define netxen_gb_get_gb0_mask(config_word) \
205 _netxen_crb_get_bit((config_word), 0)
206#define netxen_gb_get_gb1_mask(config_word) \
207 _netxen_crb_get_bit((config_word), 2)
208#define netxen_gb_get_gb2_mask(config_word) \
209 _netxen_crb_get_bit((config_word), 4)
210#define netxen_gb_get_gb3_mask(config_word) \
211 _netxen_crb_get_bit((config_word), 6)
Jeff Garzik47906542007-11-23 21:23:36 -0500212
Mithlesh Thukral6c80b182007-04-20 07:55:26 -0700213#define netxen_gb_unset_gb0_mask(config_word) \
214 ((config_word) &= ~(1 << 0))
215#define netxen_gb_unset_gb1_mask(config_word) \
216 ((config_word) &= ~(1 << 2))
217#define netxen_gb_unset_gb2_mask(config_word) \
218 ((config_word) &= ~(1 << 4))
219#define netxen_gb_unset_gb3_mask(config_word) \
220 ((config_word) &= ~(1 << 6))
221
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400222
223/*
224 * PHY-Specific MII control/status registers.
225 */
226typedef enum {
227 NETXEN_NIU_GB_MII_MGMT_ADDR_CONTROL = 0,
228 NETXEN_NIU_GB_MII_MGMT_ADDR_STATUS = 1,
229 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_0 = 2,
230 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_1 = 3,
231 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG = 4,
232 NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART = 5,
233 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG_MORE = 6,
234 NETXEN_NIU_GB_MII_MGMT_ADDR_NEXTPAGE_XMIT = 7,
235 NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART_NEXTPAGE = 8,
236 NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_CONTROL = 9,
237 NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_STATUS = 10,
238 NETXEN_NIU_GB_MII_MGMT_ADDR_EXTENDED_STATUS = 15,
239 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL = 16,
240 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS = 17,
241 NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE = 18,
242 NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS = 19,
243 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE = 20,
244 NETXEN_NIU_GB_MII_MGMT_ADDR_RECV_ERROR_COUNT = 21,
245 NETXEN_NIU_GB_MII_MGMT_ADDR_LED_CONTROL = 24,
246 NETXEN_NIU_GB_MII_MGMT_ADDR_LED_OVERRIDE = 25,
247 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE_YET = 26,
248 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS_MORE = 27
249} netxen_niu_phy_register_t;
250
251/*
252 * PHY-Specific Status Register (reg 17).
253 *
254 * Bit 0 : jabber => 1:jabber detected, 0:not
255 * Bit 1 : polarity => 1:polarity reversed, 0:normal
256 * Bit 2 : recvpause => 1:receive pause enabled, 0:disabled
257 * Bit 3 : xmitpause => 1:transmit pause enabled, 0:disabled
258 * Bit 4 : energydetect => 1:sleep, 0:active
259 * Bit 5 : downshift => 1:downshift, 0:no downshift
260 * Bit 6 : crossover => 1:MDIX (crossover), 0:MDI (no crossover)
261 * Bits 7-9 : cablelen => not valid in 10Mb/s mode
262 * 0:<50m, 1:50-80m, 2:80-110m, 3:110-140m, 4:>140m
263 * Bit 10 : link => 1:link up, 0:link down
264 * Bit 11 : resolved => 1:speed and duplex resolved, 0:not yet
265 * Bit 12 : pagercvd => 1:page received, 0:page not received
266 * Bit 13 : duplex => 1:full duplex, 0:half duplex
267 * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd
268 */
269
270#define netxen_get_phy_cablelen(config_word) (((config_word) >> 7) & 0x07)
271#define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03)
272
273#define netxen_set_phy_speed(config_word, val) \
274 ((config_word) |= ((val & 0x03) << 14))
275#define netxen_set_phy_duplex(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000276 ((config_word) |= 1 << 13)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400277#define netxen_clear_phy_duplex(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000278 ((config_word) &= ~(1 << 13))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400279
280#define netxen_get_phy_jabber(config_word) \
281 _netxen_crb_get_bit(config_word, 0)
282#define netxen_get_phy_polarity(config_word) \
283 _netxen_crb_get_bit(config_word, 1)
284#define netxen_get_phy_recvpause(config_word) \
285 _netxen_crb_get_bit(config_word, 2)
286#define netxen_get_phy_xmitpause(config_word) \
287 _netxen_crb_get_bit(config_word, 3)
288#define netxen_get_phy_energydetect(config_word) \
289 _netxen_crb_get_bit(config_word, 4)
290#define netxen_get_phy_downshift(config_word) \
291 _netxen_crb_get_bit(config_word, 5)
292#define netxen_get_phy_crossover(config_word) \
293 _netxen_crb_get_bit(config_word, 6)
294#define netxen_get_phy_link(config_word) \
295 _netxen_crb_get_bit(config_word, 10)
296#define netxen_get_phy_resolved(config_word) \
297 _netxen_crb_get_bit(config_word, 11)
298#define netxen_get_phy_pagercvd(config_word) \
299 _netxen_crb_get_bit(config_word, 12)
300#define netxen_get_phy_duplex(config_word) \
301 _netxen_crb_get_bit(config_word, 13)
302
303/*
304 * Interrupt Register definition
305 * This definition applies to registers 18 and 19 (int enable and int status).
306 * Bit 0 : jabber
307 * Bit 1 : polarity_changed
308 * Bit 4 : energy_detect
309 * Bit 5 : downshift
310 * Bit 6 : mdi_xover_changed
311 * Bit 7 : fifo_over_underflow
312 * Bit 8 : false_carrier
313 * Bit 9 : symbol_error
314 * Bit 10: link_status_changed
315 * Bit 11: autoneg_completed
316 * Bit 12: page_received
317 * Bit 13: duplex_changed
318 * Bit 14: speed_changed
319 * Bit 15: autoneg_error
320 */
321
322#define netxen_get_phy_int_jabber(config_word) \
323 _netxen_crb_get_bit(config_word, 0)
324#define netxen_get_phy_int_polarity_changed(config_word) \
325 _netxen_crb_get_bit(config_word, 1)
326#define netxen_get_phy_int_energy_detect(config_word) \
327 _netxen_crb_get_bit(config_word, 4)
328#define netxen_get_phy_int_downshift(config_word) \
329 _netxen_crb_get_bit(config_word, 5)
330#define netxen_get_phy_int_mdi_xover_changed(config_word) \
331 _netxen_crb_get_bit(config_word, 6)
332#define netxen_get_phy_int_fifo_over_underflow(config_word) \
333 _netxen_crb_get_bit(config_word, 7)
334#define netxen_get_phy_int_false_carrier(config_word) \
335 _netxen_crb_get_bit(config_word, 8)
336#define netxen_get_phy_int_symbol_error(config_word) \
337 _netxen_crb_get_bit(config_word, 9)
338#define netxen_get_phy_int_link_status_changed(config_word) \
339 _netxen_crb_get_bit(config_word, 10)
340#define netxen_get_phy_int_autoneg_completed(config_word) \
341 _netxen_crb_get_bit(config_word, 11)
342#define netxen_get_phy_int_page_received(config_word) \
343 _netxen_crb_get_bit(config_word, 12)
344#define netxen_get_phy_int_duplex_changed(config_word) \
345 _netxen_crb_get_bit(config_word, 13)
346#define netxen_get_phy_int_speed_changed(config_word) \
347 _netxen_crb_get_bit(config_word, 14)
348#define netxen_get_phy_int_autoneg_error(config_word) \
349 _netxen_crb_get_bit(config_word, 15)
350
351#define netxen_set_phy_int_link_status_changed(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000352 ((config_word) |= 1 << 10)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400353#define netxen_set_phy_int_autoneg_completed(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000354 ((config_word) |= 1 << 11)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400355#define netxen_set_phy_int_speed_changed(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000356 ((config_word) |= 1 << 14)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400357
358/*
359 * NIU Mode Register.
360 * Bit 0 : enable FibreChannel
361 * Bit 1 : enable 10/100/1000 Ethernet
362 * Bit 2 : enable 10Gb Ethernet
363 */
364
365#define netxen_get_niu_enable_ge(config_word) \
366 _netxen_crb_get_bit(config_word, 1)
367
Dhananjay Phadke9ad27642008-08-01 03:14:59 -0700368#define NETXEN_NIU_NON_PROMISC_MODE 0
369#define NETXEN_NIU_PROMISC_MODE 1
370#define NETXEN_NIU_ALLMULTI_MODE 2
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400371
372/*
373 * NIU GB Drop CRC Register
Jeff Garzik47906542007-11-23 21:23:36 -0500374 *
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400375 * Bit 0 : drop_gb0 => 1:drop pkts with bad CRCs, 0:pass them on
376 * Bit 1 : drop_gb1 => 1:drop pkts with bad CRCs, 0:pass them on
377 * Bit 2 : drop_gb2 => 1:drop pkts with bad CRCs, 0:pass them on
378 * Bit 3 : drop_gb3 => 1:drop pkts with bad CRCs, 0:pass them on
379 */
380
381#define netxen_set_gb_drop_gb0(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000382 ((config_word) |= 1 << 0)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400383#define netxen_set_gb_drop_gb1(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000384 ((config_word) |= 1 << 1)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400385#define netxen_set_gb_drop_gb2(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000386 ((config_word) |= 1 << 2)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400387#define netxen_set_gb_drop_gb3(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000388 ((config_word) |= 1 << 3)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400389
390#define netxen_clear_gb_drop_gb0(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000391 ((config_word) &= ~(1 << 0))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400392#define netxen_clear_gb_drop_gb1(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000393 ((config_word) &= ~(1 << 1))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400394#define netxen_clear_gb_drop_gb2(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000395 ((config_word) &= ~(1 << 2))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400396#define netxen_clear_gb_drop_gb3(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000397 ((config_word) &= ~(1 << 3))
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400398
399/*
400 * NIU XG MAC Config Register
401 *
402 * Bit 0 : tx_enable => 1:enable frame xmit, 0:disable
403 * Bit 2 : rx_enable => 1:enable frame recv, 0:disable
404 * Bit 4 : soft_reset => 1:reset the MAC , 0:no-op
405 * Bit 27: xaui_framer_reset
406 * Bit 28: xaui_rx_reset
407 * Bit 29: xaui_tx_reset
408 * Bit 30: xg_ingress_afifo_reset
409 * Bit 31: xg_egress_afifo_reset
410 */
411
412#define netxen_xg_soft_reset(config_word) \
Al Viroa608ab9c2007-01-02 10:39:10 +0000413 ((config_word) |= 1 << 4)
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400414
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400415/* Set promiscuous mode for a GbE interface */
Jeff Garzik47906542007-11-23 21:23:36 -0500416int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
Dhananjay Phadke9ad27642008-08-01 03:14:59 -0700417 u32 mode);
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400418int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
Dhananjay Phadke9ad27642008-08-01 03:14:59 -0700419 u32 mode);
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400420
Adrian Bunk993fb902007-11-05 18:07:31 +0100421/* set the MAC address for a given MAC */
Mithlesh Thukral3176ff32007-04-20 07:52:37 -0700422int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400423 netxen_ethernet_macaddr_t addr);
424
Adrian Bunk993fb902007-11-05 18:07:31 +0100425/* XG version */
Mithlesh Thukral3176ff32007-04-20 07:52:37 -0700426int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400427 netxen_ethernet_macaddr_t addr);
428
429/* Generic enable for GbE ports. Will detect the speed of the link. */
430int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port);
431
Amit S. Kalecb8011a2006-11-29 09:00:10 -0800432int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port);
433
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400434/* Disable a GbE interface */
Mithlesh Thukral3176ff32007-04-20 07:52:37 -0700435int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter);
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400436
Mithlesh Thukral3176ff32007-04-20 07:52:37 -0700437int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400438
Dhananjay Phadke3ce06a32008-07-21 19:44:03 -0700439typedef struct {
440 unsigned valid;
441 unsigned start_128M;
442 unsigned end_128M;
443 unsigned start_2M;
444} crb_128M_2M_sub_block_map_t;
445
446typedef struct {
447 crb_128M_2M_sub_block_map_t sub_block[16];
448} crb_128M_2M_block_map_t;
449
Amit S. Kale3d396eb2006-10-21 15:33:03 -0400450#endif /* __NETXEN_NIC_HW_H_ */