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 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 34 | /* Hardware memory size of 128 meg */ |
| 35 | #define NETXEN_MEMADDR_MAX (128 * 1024 * 1024) |
| 36 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 37 | struct netxen_adapter; |
| 38 | |
| 39 | #define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20) |
| 40 | |
Mithlesh Thukral | 3176ff3 | 2007-04-20 07:52:37 -0700 | [diff] [blame] | 41 | void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 42 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 43 | /* Nibble or Byte mode for phy interface (GbE mode only) */ |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 44 | |
| 45 | #define _netxen_crb_get_bit(var, bit) ((var >> bit) & 0x1) |
| 46 | |
| 47 | /* |
| 48 | * NIU GB MAC Config Register 0 (applies to GB0, GB1, GB2, GB3) |
| 49 | * |
| 50 | * Bit 0 : enable_tx => 1:enable frame xmit, 0:disable |
| 51 | * Bit 1 : tx_synced => R/O: xmit enable synched to xmit stream |
| 52 | * Bit 2 : enable_rx => 1:enable frame recv, 0:disable |
| 53 | * Bit 3 : rx_synced => R/O: recv enable synched to recv stream |
| 54 | * Bit 4 : tx_flowctl => 1:enable pause frame generation, 0:disable |
| 55 | * Bit 5 : rx_flowctl => 1:act on recv'd pause frames, 0:ignore |
| 56 | * Bit 8 : loopback => 1:loop MAC xmits to MAC recvs, 0:normal |
| 57 | * Bit 16: tx_reset_pb => 1:reset frame xmit protocol blk, 0:no-op |
| 58 | * Bit 17: rx_reset_pb => 1:reset frame recv protocol blk, 0:no-op |
| 59 | * Bit 18: tx_reset_mac => 1:reset data/ctl multiplexer blk, 0:no-op |
| 60 | * Bit 19: rx_reset_mac => 1:reset ctl frames & timers blk, 0:no-op |
| 61 | * Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op |
| 62 | */ |
| 63 | |
| 64 | #define netxen_gb_enable_tx(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 65 | ((config_word) |= 1 << 0) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 66 | #define netxen_gb_enable_rx(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 67 | ((config_word) |= 1 << 2) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 68 | #define netxen_gb_tx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 69 | ((config_word) |= 1 << 4) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 70 | #define netxen_gb_rx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 71 | ((config_word) |= 1 << 5) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 72 | #define netxen_gb_tx_reset_pb(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 73 | ((config_word) |= 1 << 16) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 74 | #define netxen_gb_rx_reset_pb(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 75 | ((config_word) |= 1 << 17) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 76 | #define netxen_gb_tx_reset_mac(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 77 | ((config_word) |= 1 << 18) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 78 | #define netxen_gb_rx_reset_mac(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 79 | ((config_word) |= 1 << 19) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 80 | #define netxen_gb_soft_reset(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 81 | ((config_word) |= 1 << 31) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 82 | |
| 83 | #define netxen_gb_unset_tx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 84 | ((config_word) &= ~(1 << 4)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 85 | #define netxen_gb_unset_rx_flowctl(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 86 | ((config_word) &= ~(1 << 5)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 87 | |
| 88 | #define netxen_gb_get_tx_synced(config_word) \ |
| 89 | _netxen_crb_get_bit((config_word), 1) |
| 90 | #define netxen_gb_get_rx_synced(config_word) \ |
| 91 | _netxen_crb_get_bit((config_word), 3) |
| 92 | #define netxen_gb_get_tx_flowctl(config_word) \ |
| 93 | _netxen_crb_get_bit((config_word), 4) |
| 94 | #define netxen_gb_get_rx_flowctl(config_word) \ |
| 95 | _netxen_crb_get_bit((config_word), 5) |
| 96 | #define netxen_gb_get_soft_reset(config_word) \ |
| 97 | _netxen_crb_get_bit((config_word), 31) |
| 98 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 99 | #define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16) |
| 100 | |
| 101 | #define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \ |
| 102 | ((config_word) |= ((val) & 0x07)) |
| 103 | #define netxen_gb_mii_mgmt_reset(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 104 | ((config_word) |= 1 << 31) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 105 | #define netxen_gb_mii_mgmt_unset(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 | /* |
| 109 | * NIU GB MII Mgmt Command Register (applies to GB0, GB1, GB2, GB3) |
| 110 | * Bit 0 : read_cycle => 1:perform single read cycle, 0:no-op |
| 111 | * Bit 1 : scan_cycle => 1:perform continuous read cycles, 0:no-op |
| 112 | */ |
| 113 | |
| 114 | #define netxen_gb_mii_mgmt_set_read_cycle(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 115 | ((config_word) |= 1 << 0) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 116 | #define netxen_gb_mii_mgmt_reg_addr(config_word, val) \ |
| 117 | ((config_word) |= ((val) & 0x1F)) |
| 118 | #define netxen_gb_mii_mgmt_phy_addr(config_word, val) \ |
| 119 | ((config_word) |= (((val) & 0x1F) << 8)) |
| 120 | |
| 121 | /* |
| 122 | * NIU GB MII Mgmt Indicators Register (applies to GB0, GB1, GB2, GB3) |
| 123 | * Read-only register. |
| 124 | * Bit 0 : busy => 1:performing an MII mgmt cycle, 0:idle |
| 125 | * Bit 1 : scanning => 1:scan operation in progress, 0:idle |
| 126 | * Bit 2 : notvalid => :mgmt result data not yet valid, 0:idle |
| 127 | */ |
| 128 | #define netxen_get_gb_mii_mgmt_busy(config_word) \ |
| 129 | _netxen_crb_get_bit(config_word, 0) |
| 130 | #define netxen_get_gb_mii_mgmt_scanning(config_word) \ |
| 131 | _netxen_crb_get_bit(config_word, 1) |
| 132 | #define netxen_get_gb_mii_mgmt_notvalid(config_word) \ |
| 133 | _netxen_crb_get_bit(config_word, 2) |
Mithlesh Thukral | 6c80b18 | 2007-04-20 07:55:26 -0700 | [diff] [blame] | 134 | /* |
| 135 | * NIU XG Pause Ctl Register |
| 136 | * |
| 137 | * Bit 0 : xg0_mask => 1:disable tx pause frames |
| 138 | * Bit 1 : xg0_request => 1:request single pause frame |
| 139 | * Bit 2 : xg0_on_off => 1:request is pause on, 0:off |
| 140 | * Bit 3 : xg1_mask => 1:disable tx pause frames |
| 141 | * Bit 4 : xg1_request => 1:request single pause frame |
| 142 | * Bit 5 : xg1_on_off => 1:request is pause on, 0:off |
| 143 | */ |
| 144 | |
| 145 | #define netxen_xg_set_xg0_mask(config_word) \ |
| 146 | ((config_word) |= 1 << 0) |
| 147 | #define netxen_xg_set_xg1_mask(config_word) \ |
| 148 | ((config_word) |= 1 << 3) |
Jeff Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 149 | |
Mithlesh Thukral | 6c80b18 | 2007-04-20 07:55:26 -0700 | [diff] [blame] | 150 | #define netxen_xg_get_xg0_mask(config_word) \ |
| 151 | _netxen_crb_get_bit((config_word), 0) |
| 152 | #define netxen_xg_get_xg1_mask(config_word) \ |
| 153 | _netxen_crb_get_bit((config_word), 3) |
| 154 | |
| 155 | #define netxen_xg_unset_xg0_mask(config_word) \ |
| 156 | ((config_word) &= ~(1 << 0)) |
| 157 | #define netxen_xg_unset_xg1_mask(config_word) \ |
| 158 | ((config_word) &= ~(1 << 3)) |
| 159 | |
| 160 | /* |
| 161 | * NIU XG Pause Ctl Register |
| 162 | * |
| 163 | * Bit 0 : xg0_mask => 1:disable tx pause frames |
| 164 | * Bit 1 : xg0_request => 1:request single pause frame |
| 165 | * Bit 2 : xg0_on_off => 1:request is pause on, 0:off |
| 166 | * Bit 3 : xg1_mask => 1:disable tx pause frames |
| 167 | * Bit 4 : xg1_request => 1:request single pause frame |
| 168 | * Bit 5 : xg1_on_off => 1:request is pause on, 0:off |
| 169 | */ |
| 170 | #define netxen_gb_set_gb0_mask(config_word) \ |
| 171 | ((config_word) |= 1 << 0) |
| 172 | #define netxen_gb_set_gb1_mask(config_word) \ |
| 173 | ((config_word) |= 1 << 2) |
| 174 | #define netxen_gb_set_gb2_mask(config_word) \ |
| 175 | ((config_word) |= 1 << 4) |
| 176 | #define netxen_gb_set_gb3_mask(config_word) \ |
| 177 | ((config_word) |= 1 << 6) |
| 178 | |
| 179 | #define netxen_gb_get_gb0_mask(config_word) \ |
| 180 | _netxen_crb_get_bit((config_word), 0) |
| 181 | #define netxen_gb_get_gb1_mask(config_word) \ |
| 182 | _netxen_crb_get_bit((config_word), 2) |
| 183 | #define netxen_gb_get_gb2_mask(config_word) \ |
| 184 | _netxen_crb_get_bit((config_word), 4) |
| 185 | #define netxen_gb_get_gb3_mask(config_word) \ |
| 186 | _netxen_crb_get_bit((config_word), 6) |
Jeff Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 187 | |
Mithlesh Thukral | 6c80b18 | 2007-04-20 07:55:26 -0700 | [diff] [blame] | 188 | #define netxen_gb_unset_gb0_mask(config_word) \ |
| 189 | ((config_word) &= ~(1 << 0)) |
| 190 | #define netxen_gb_unset_gb1_mask(config_word) \ |
| 191 | ((config_word) &= ~(1 << 2)) |
| 192 | #define netxen_gb_unset_gb2_mask(config_word) \ |
| 193 | ((config_word) &= ~(1 << 4)) |
| 194 | #define netxen_gb_unset_gb3_mask(config_word) \ |
| 195 | ((config_word) &= ~(1 << 6)) |
| 196 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 197 | |
| 198 | /* |
| 199 | * PHY-Specific MII control/status registers. |
| 200 | */ |
Dhananjay Phadke | e98e335 | 2009-04-07 22:50:38 +0000 | [diff] [blame] | 201 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_CONTROL 0 |
| 202 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_STATUS 1 |
| 203 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_0 2 |
| 204 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_1 3 |
| 205 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG 4 |
| 206 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART 5 |
| 207 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG_MORE 6 |
| 208 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_NEXTPAGE_XMIT 7 |
| 209 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART_NEXTPAGE 8 |
| 210 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_CONTROL 9 |
| 211 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_STATUS 10 |
| 212 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_EXTENDED_STATUS 15 |
| 213 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL 16 |
| 214 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS 17 |
| 215 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE 18 |
| 216 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS 19 |
| 217 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE 20 |
| 218 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_RECV_ERROR_COUNT 21 |
| 219 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_LED_CONTROL 24 |
| 220 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_LED_OVERRIDE 25 |
| 221 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE_YET 26 |
| 222 | #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS_MORE 27 |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 223 | |
| 224 | /* |
| 225 | * PHY-Specific Status Register (reg 17). |
| 226 | * |
| 227 | * Bit 0 : jabber => 1:jabber detected, 0:not |
| 228 | * Bit 1 : polarity => 1:polarity reversed, 0:normal |
| 229 | * Bit 2 : recvpause => 1:receive pause enabled, 0:disabled |
| 230 | * Bit 3 : xmitpause => 1:transmit pause enabled, 0:disabled |
| 231 | * Bit 4 : energydetect => 1:sleep, 0:active |
| 232 | * Bit 5 : downshift => 1:downshift, 0:no downshift |
| 233 | * Bit 6 : crossover => 1:MDIX (crossover), 0:MDI (no crossover) |
| 234 | * Bits 7-9 : cablelen => not valid in 10Mb/s mode |
| 235 | * 0:<50m, 1:50-80m, 2:80-110m, 3:110-140m, 4:>140m |
| 236 | * Bit 10 : link => 1:link up, 0:link down |
| 237 | * Bit 11 : resolved => 1:speed and duplex resolved, 0:not yet |
| 238 | * Bit 12 : pagercvd => 1:page received, 0:page not received |
| 239 | * Bit 13 : duplex => 1:full duplex, 0:half duplex |
| 240 | * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd |
| 241 | */ |
| 242 | |
| 243 | #define netxen_get_phy_cablelen(config_word) (((config_word) >> 7) & 0x07) |
| 244 | #define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03) |
| 245 | |
| 246 | #define netxen_set_phy_speed(config_word, val) \ |
| 247 | ((config_word) |= ((val & 0x03) << 14)) |
| 248 | #define netxen_set_phy_duplex(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 249 | ((config_word) |= 1 << 13) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 250 | #define netxen_clear_phy_duplex(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 251 | ((config_word) &= ~(1 << 13)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 252 | |
| 253 | #define netxen_get_phy_jabber(config_word) \ |
| 254 | _netxen_crb_get_bit(config_word, 0) |
| 255 | #define netxen_get_phy_polarity(config_word) \ |
| 256 | _netxen_crb_get_bit(config_word, 1) |
| 257 | #define netxen_get_phy_recvpause(config_word) \ |
| 258 | _netxen_crb_get_bit(config_word, 2) |
| 259 | #define netxen_get_phy_xmitpause(config_word) \ |
| 260 | _netxen_crb_get_bit(config_word, 3) |
| 261 | #define netxen_get_phy_energydetect(config_word) \ |
| 262 | _netxen_crb_get_bit(config_word, 4) |
| 263 | #define netxen_get_phy_downshift(config_word) \ |
| 264 | _netxen_crb_get_bit(config_word, 5) |
| 265 | #define netxen_get_phy_crossover(config_word) \ |
| 266 | _netxen_crb_get_bit(config_word, 6) |
| 267 | #define netxen_get_phy_link(config_word) \ |
| 268 | _netxen_crb_get_bit(config_word, 10) |
| 269 | #define netxen_get_phy_resolved(config_word) \ |
| 270 | _netxen_crb_get_bit(config_word, 11) |
| 271 | #define netxen_get_phy_pagercvd(config_word) \ |
| 272 | _netxen_crb_get_bit(config_word, 12) |
| 273 | #define netxen_get_phy_duplex(config_word) \ |
| 274 | _netxen_crb_get_bit(config_word, 13) |
| 275 | |
| 276 | /* |
| 277 | * Interrupt Register definition |
| 278 | * This definition applies to registers 18 and 19 (int enable and int status). |
| 279 | * Bit 0 : jabber |
| 280 | * Bit 1 : polarity_changed |
| 281 | * Bit 4 : energy_detect |
| 282 | * Bit 5 : downshift |
| 283 | * Bit 6 : mdi_xover_changed |
| 284 | * Bit 7 : fifo_over_underflow |
| 285 | * Bit 8 : false_carrier |
| 286 | * Bit 9 : symbol_error |
| 287 | * Bit 10: link_status_changed |
| 288 | * Bit 11: autoneg_completed |
| 289 | * Bit 12: page_received |
| 290 | * Bit 13: duplex_changed |
| 291 | * Bit 14: speed_changed |
| 292 | * Bit 15: autoneg_error |
| 293 | */ |
| 294 | |
| 295 | #define netxen_get_phy_int_jabber(config_word) \ |
| 296 | _netxen_crb_get_bit(config_word, 0) |
| 297 | #define netxen_get_phy_int_polarity_changed(config_word) \ |
| 298 | _netxen_crb_get_bit(config_word, 1) |
| 299 | #define netxen_get_phy_int_energy_detect(config_word) \ |
| 300 | _netxen_crb_get_bit(config_word, 4) |
| 301 | #define netxen_get_phy_int_downshift(config_word) \ |
| 302 | _netxen_crb_get_bit(config_word, 5) |
| 303 | #define netxen_get_phy_int_mdi_xover_changed(config_word) \ |
| 304 | _netxen_crb_get_bit(config_word, 6) |
| 305 | #define netxen_get_phy_int_fifo_over_underflow(config_word) \ |
| 306 | _netxen_crb_get_bit(config_word, 7) |
| 307 | #define netxen_get_phy_int_false_carrier(config_word) \ |
| 308 | _netxen_crb_get_bit(config_word, 8) |
| 309 | #define netxen_get_phy_int_symbol_error(config_word) \ |
| 310 | _netxen_crb_get_bit(config_word, 9) |
| 311 | #define netxen_get_phy_int_link_status_changed(config_word) \ |
| 312 | _netxen_crb_get_bit(config_word, 10) |
| 313 | #define netxen_get_phy_int_autoneg_completed(config_word) \ |
| 314 | _netxen_crb_get_bit(config_word, 11) |
| 315 | #define netxen_get_phy_int_page_received(config_word) \ |
| 316 | _netxen_crb_get_bit(config_word, 12) |
| 317 | #define netxen_get_phy_int_duplex_changed(config_word) \ |
| 318 | _netxen_crb_get_bit(config_word, 13) |
| 319 | #define netxen_get_phy_int_speed_changed(config_word) \ |
| 320 | _netxen_crb_get_bit(config_word, 14) |
| 321 | #define netxen_get_phy_int_autoneg_error(config_word) \ |
| 322 | _netxen_crb_get_bit(config_word, 15) |
| 323 | |
| 324 | #define netxen_set_phy_int_link_status_changed(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 325 | ((config_word) |= 1 << 10) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 326 | #define netxen_set_phy_int_autoneg_completed(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 327 | ((config_word) |= 1 << 11) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 328 | #define netxen_set_phy_int_speed_changed(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 329 | ((config_word) |= 1 << 14) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 330 | |
| 331 | /* |
| 332 | * NIU Mode Register. |
| 333 | * Bit 0 : enable FibreChannel |
| 334 | * Bit 1 : enable 10/100/1000 Ethernet |
| 335 | * Bit 2 : enable 10Gb Ethernet |
| 336 | */ |
| 337 | |
| 338 | #define netxen_get_niu_enable_ge(config_word) \ |
| 339 | _netxen_crb_get_bit(config_word, 1) |
| 340 | |
Dhananjay Phadke | 9ad2764 | 2008-08-01 03:14:59 -0700 | [diff] [blame] | 341 | #define NETXEN_NIU_NON_PROMISC_MODE 0 |
| 342 | #define NETXEN_NIU_PROMISC_MODE 1 |
| 343 | #define NETXEN_NIU_ALLMULTI_MODE 2 |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 344 | |
| 345 | /* |
| 346 | * NIU GB Drop CRC Register |
Jeff Garzik | 4790654 | 2007-11-23 21:23:36 -0500 | [diff] [blame] | 347 | * |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 348 | * Bit 0 : drop_gb0 => 1:drop pkts with bad CRCs, 0:pass them on |
| 349 | * Bit 1 : drop_gb1 => 1:drop pkts with bad CRCs, 0:pass them on |
| 350 | * Bit 2 : drop_gb2 => 1:drop pkts with bad CRCs, 0:pass them on |
| 351 | * Bit 3 : drop_gb3 => 1:drop pkts with bad CRCs, 0:pass them on |
| 352 | */ |
| 353 | |
| 354 | #define netxen_set_gb_drop_gb0(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 355 | ((config_word) |= 1 << 0) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 356 | #define netxen_set_gb_drop_gb1(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 357 | ((config_word) |= 1 << 1) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 358 | #define netxen_set_gb_drop_gb2(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 359 | ((config_word) |= 1 << 2) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 360 | #define netxen_set_gb_drop_gb3(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 361 | ((config_word) |= 1 << 3) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 362 | |
| 363 | #define netxen_clear_gb_drop_gb0(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 364 | ((config_word) &= ~(1 << 0)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 365 | #define netxen_clear_gb_drop_gb1(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 366 | ((config_word) &= ~(1 << 1)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 367 | #define netxen_clear_gb_drop_gb2(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 368 | ((config_word) &= ~(1 << 2)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 369 | #define netxen_clear_gb_drop_gb3(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 370 | ((config_word) &= ~(1 << 3)) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 371 | |
| 372 | /* |
| 373 | * NIU XG MAC Config Register |
| 374 | * |
| 375 | * Bit 0 : tx_enable => 1:enable frame xmit, 0:disable |
| 376 | * Bit 2 : rx_enable => 1:enable frame recv, 0:disable |
| 377 | * Bit 4 : soft_reset => 1:reset the MAC , 0:no-op |
| 378 | * Bit 27: xaui_framer_reset |
| 379 | * Bit 28: xaui_rx_reset |
| 380 | * Bit 29: xaui_tx_reset |
| 381 | * Bit 30: xg_ingress_afifo_reset |
| 382 | * Bit 31: xg_egress_afifo_reset |
| 383 | */ |
| 384 | |
| 385 | #define netxen_xg_soft_reset(config_word) \ |
Al Viro | a608ab9c | 2007-01-02 10:39:10 +0000 | [diff] [blame] | 386 | ((config_word) |= 1 << 4) |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 387 | |
Dhananjay Phadke | 3ce06a3 | 2008-07-21 19:44:03 -0700 | [diff] [blame] | 388 | typedef struct { |
| 389 | unsigned valid; |
| 390 | unsigned start_128M; |
| 391 | unsigned end_128M; |
| 392 | unsigned start_2M; |
| 393 | } crb_128M_2M_sub_block_map_t; |
| 394 | |
| 395 | typedef struct { |
| 396 | crb_128M_2M_sub_block_map_t sub_block[16]; |
| 397 | } crb_128M_2M_block_map_t; |
| 398 | |
Amit S. Kale | 3d396eb | 2006-10-21 15:33:03 -0400 | [diff] [blame] | 399 | #endif /* __NETXEN_NIC_HW_H_ */ |