Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 1 | /* |
Dhananjay Phadke | 5d242f1 | 2009-02-25 15:57:56 +0000 | [diff] [blame^] | 2 | * Copyright (C) 2003 - 2009 NetXen, Inc. |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 3 | * All rights reserved. |
Amit S. Kale | 80922fb | 2006-12-04 09:18:00 -0800 | [diff] [blame] | 4 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 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. |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 9 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 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. |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 14 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 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. |
Amit S. Kale | 80922fb | 2006-12-04 09:18:00 -0800 | [diff] [blame] | 19 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 20 | * The full GNU General Public License is included in this distribution |
| 21 | * in the file called LICENSE. |
Amit S. Kale | 80922fb | 2006-12-04 09:18:00 -0800 | [diff] [blame] | 22 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 23 | * Contact Information: |
| 24 | * info@netxen.com |
Dhananjay Phadke | 5d242f1 | 2009-02-25 15:57:56 +0000 | [diff] [blame^] | 25 | * NetXen Inc, |
| 26 | * 18922 Forge Drive |
| 27 | * Cupertino, CA 95014-0701 |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 28 | * |
| 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 |
| 40 | static inline u64 readq(void __iomem * addr) |
| 41 | { |
| 42 | return readl(addr) | (((u64) readl(addr + 4)) << 32LL); |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | #ifndef writeq |
| 47 | static 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. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 54 | struct netxen_adapter; |
| 55 | |
| 56 | #define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20) |
| 57 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 58 | struct netxen_port; |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 59 | void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 60 | void netxen_nic_flash_print(struct netxen_adapter *adapter); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 61 | |
| 62 | typedef u8 netxen_ethernet_macaddr_t[6]; |
| 63 | |
| 64 | /* Nibble or Byte mode for phy interface (GbE mode only) */ |
| 65 | typedef 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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 90 | ((config_word) |= 1 << 0) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 91 | #define netxen_gb_enable_rx(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 92 | ((config_word) |= 1 << 2) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 93 | #define netxen_gb_tx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 94 | ((config_word) |= 1 << 4) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 95 | #define netxen_gb_rx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 96 | ((config_word) |= 1 << 5) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 97 | #define netxen_gb_tx_reset_pb(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 98 | ((config_word) |= 1 << 16) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 99 | #define netxen_gb_rx_reset_pb(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 100 | ((config_word) |= 1 << 17) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 101 | #define netxen_gb_tx_reset_mac(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 102 | ((config_word) |= 1 << 18) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 103 | #define netxen_gb_rx_reset_mac(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 104 | ((config_word) |= 1 << 19) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 105 | #define netxen_gb_soft_reset(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 106 | ((config_word) |= 1 << 31) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 107 | |
| 108 | #define netxen_gb_unset_tx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 109 | ((config_word) &= ~(1 << 4)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 110 | #define netxen_gb_unset_rx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 111 | ((config_word) &= ~(1 << 5)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 112 | |
| 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. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 124 | #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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 129 | ((config_word) |= 1 << 31) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 130 | #define netxen_gb_mii_mgmt_unset(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 131 | ((config_word) &= ~(1 << 31)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 132 | |
| 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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 140 | ((config_word) |= 1 << 0) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 141 | #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 Thukral | 6c80b18 | 2007-04-20 07:55:26 -0700 | [diff] [blame] | 159 | /* |
| 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 Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 174 | |
Mithlesh Thukral | 6c80b18 | 2007-04-20 07:55:26 -0700 | [diff] [blame] | 175 | #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 Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 212 | |
Mithlesh Thukral | 6c80b18 | 2007-04-20 07:55:26 -0700 | [diff] [blame] | 213 | #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. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 222 | |
| 223 | /* |
| 224 | * PHY-Specific MII control/status registers. |
| 225 | */ |
| 226 | typedef 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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 276 | ((config_word) |= 1 << 13) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 277 | #define netxen_clear_phy_duplex(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 278 | ((config_word) &= ~(1 << 13)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 279 | |
| 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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 352 | ((config_word) |= 1 << 10) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 353 | #define netxen_set_phy_int_autoneg_completed(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 354 | ((config_word) |= 1 << 11) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 355 | #define netxen_set_phy_int_speed_changed(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 356 | ((config_word) |= 1 << 14) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 357 | |
| 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 Phadke | 9ad2764 | 2008-08-01 03:14:59 -0700 | [diff] [blame] | 368 | #define NETXEN_NIU_NON_PROMISC_MODE 0 |
| 369 | #define NETXEN_NIU_PROMISC_MODE 1 |
| 370 | #define NETXEN_NIU_ALLMULTI_MODE 2 |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 371 | |
| 372 | /* |
| 373 | * NIU GB Drop CRC Register |
Jeff Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 374 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 375 | * 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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 382 | ((config_word) |= 1 << 0) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 383 | #define netxen_set_gb_drop_gb1(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 384 | ((config_word) |= 1 << 1) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 385 | #define netxen_set_gb_drop_gb2(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 386 | ((config_word) |= 1 << 2) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 387 | #define netxen_set_gb_drop_gb3(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 388 | ((config_word) |= 1 << 3) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 389 | |
| 390 | #define netxen_clear_gb_drop_gb0(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 391 | ((config_word) &= ~(1 << 0)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 392 | #define netxen_clear_gb_drop_gb1(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 393 | ((config_word) &= ~(1 << 1)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 394 | #define netxen_clear_gb_drop_gb2(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 395 | ((config_word) &= ~(1 << 2)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 396 | #define netxen_clear_gb_drop_gb3(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 397 | ((config_word) &= ~(1 << 3)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 398 | |
| 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 Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 413 | ((config_word) |= 1 << 4) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 414 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 415 | /* Set promiscuous mode for a GbE interface */ |
Jeff Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 416 | int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, |
Dhananjay Phadke | 9ad2764 | 2008-08-01 03:14:59 -0700 | [diff] [blame] | 417 | u32 mode); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 418 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, |
Dhananjay Phadke | 9ad2764 | 2008-08-01 03:14:59 -0700 | [diff] [blame] | 419 | u32 mode); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 420 | |
Adrian Bunk | 993fb90 | 2007-11-05 18:07:31 +0100 | [diff] [blame] | 421 | /* set the MAC address for a given MAC */ |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 422 | int netxen_niu_macaddr_set(struct netxen_adapter *adapter, |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 423 | netxen_ethernet_macaddr_t addr); |
| 424 | |
Adrian Bunk | 993fb90 | 2007-11-05 18:07:31 +0100 | [diff] [blame] | 425 | /* XG version */ |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 426 | int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 427 | netxen_ethernet_macaddr_t addr); |
| 428 | |
| 429 | /* Generic enable for GbE ports. Will detect the speed of the link. */ |
| 430 | int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port); |
| 431 | |
Amit S. Kale | cb8011a | 2006-11-29 09:00:10 -0800 | [diff] [blame] | 432 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port); |
| 433 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 434 | /* Disable a GbE interface */ |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 435 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 436 | |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 437 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 438 | |
Dhananjay Phadke | 3ce06a3 | 2008-07-21 19:44:03 -0700 | [diff] [blame] | 439 | typedef 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 | |
| 446 | typedef struct { |
| 447 | crb_128M_2M_sub_block_map_t sub_block[16]; |
| 448 | } crb_128M_2M_block_map_t; |
| 449 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 450 | #endif /* __NETXEN_NIC_HW_H_ */ |