0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __NETXEN_NIC_HW_H_
0009 #define __NETXEN_NIC_HW_H_
0010
0011
0012 #define NETXEN_MEMADDR_MAX (128 * 1024 * 1024)
0013
0014 struct netxen_adapter;
0015
0016 #define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
0017
0018 void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
0019
0020
0021
0022 #define _netxen_crb_get_bit(var, bit) ((var >> bit) & 0x1)
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #define netxen_gb_tx_flowctl(config_word) \
0042 ((config_word) |= 1 << 4)
0043 #define netxen_gb_rx_flowctl(config_word) \
0044 ((config_word) |= 1 << 5)
0045 #define netxen_gb_tx_reset_pb(config_word) \
0046 ((config_word) |= 1 << 16)
0047 #define netxen_gb_rx_reset_pb(config_word) \
0048 ((config_word) |= 1 << 17)
0049 #define netxen_gb_tx_reset_mac(config_word) \
0050 ((config_word) |= 1 << 18)
0051 #define netxen_gb_rx_reset_mac(config_word) \
0052 ((config_word) |= 1 << 19)
0053
0054 #define netxen_gb_unset_tx_flowctl(config_word) \
0055 ((config_word) &= ~(1 << 4))
0056 #define netxen_gb_unset_rx_flowctl(config_word) \
0057 ((config_word) &= ~(1 << 5))
0058
0059 #define netxen_gb_get_tx_synced(config_word) \
0060 _netxen_crb_get_bit((config_word), 1)
0061 #define netxen_gb_get_rx_synced(config_word) \
0062 _netxen_crb_get_bit((config_word), 3)
0063 #define netxen_gb_get_tx_flowctl(config_word) \
0064 _netxen_crb_get_bit((config_word), 4)
0065 #define netxen_gb_get_rx_flowctl(config_word) \
0066 _netxen_crb_get_bit((config_word), 5)
0067 #define netxen_gb_get_soft_reset(config_word) \
0068 _netxen_crb_get_bit((config_word), 31)
0069
0070 #define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16)
0071
0072 #define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \
0073 ((config_word) |= ((val) & 0x07))
0074 #define netxen_gb_mii_mgmt_reset(config_word) \
0075 ((config_word) |= 1 << 31)
0076 #define netxen_gb_mii_mgmt_unset(config_word) \
0077 ((config_word) &= ~(1 << 31))
0078
0079
0080
0081
0082
0083
0084
0085 #define netxen_gb_mii_mgmt_set_read_cycle(config_word) \
0086 ((config_word) |= 1 << 0)
0087 #define netxen_gb_mii_mgmt_reg_addr(config_word, val) \
0088 ((config_word) |= ((val) & 0x1F))
0089 #define netxen_gb_mii_mgmt_phy_addr(config_word, val) \
0090 ((config_word) |= (((val) & 0x1F) << 8))
0091
0092
0093
0094
0095
0096
0097
0098
0099 #define netxen_get_gb_mii_mgmt_busy(config_word) \
0100 _netxen_crb_get_bit(config_word, 0)
0101 #define netxen_get_gb_mii_mgmt_scanning(config_word) \
0102 _netxen_crb_get_bit(config_word, 1)
0103 #define netxen_get_gb_mii_mgmt_notvalid(config_word) \
0104 _netxen_crb_get_bit(config_word, 2)
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116 #define netxen_xg_set_xg0_mask(config_word) \
0117 ((config_word) |= 1 << 0)
0118 #define netxen_xg_set_xg1_mask(config_word) \
0119 ((config_word) |= 1 << 3)
0120
0121 #define netxen_xg_get_xg0_mask(config_word) \
0122 _netxen_crb_get_bit((config_word), 0)
0123 #define netxen_xg_get_xg1_mask(config_word) \
0124 _netxen_crb_get_bit((config_word), 3)
0125
0126 #define netxen_xg_unset_xg0_mask(config_word) \
0127 ((config_word) &= ~(1 << 0))
0128 #define netxen_xg_unset_xg1_mask(config_word) \
0129 ((config_word) &= ~(1 << 3))
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141 #define netxen_gb_set_gb0_mask(config_word) \
0142 ((config_word) |= 1 << 0)
0143 #define netxen_gb_set_gb1_mask(config_word) \
0144 ((config_word) |= 1 << 2)
0145 #define netxen_gb_set_gb2_mask(config_word) \
0146 ((config_word) |= 1 << 4)
0147 #define netxen_gb_set_gb3_mask(config_word) \
0148 ((config_word) |= 1 << 6)
0149
0150 #define netxen_gb_get_gb0_mask(config_word) \
0151 _netxen_crb_get_bit((config_word), 0)
0152 #define netxen_gb_get_gb1_mask(config_word) \
0153 _netxen_crb_get_bit((config_word), 2)
0154 #define netxen_gb_get_gb2_mask(config_word) \
0155 _netxen_crb_get_bit((config_word), 4)
0156 #define netxen_gb_get_gb3_mask(config_word) \
0157 _netxen_crb_get_bit((config_word), 6)
0158
0159 #define netxen_gb_unset_gb0_mask(config_word) \
0160 ((config_word) &= ~(1 << 0))
0161 #define netxen_gb_unset_gb1_mask(config_word) \
0162 ((config_word) &= ~(1 << 2))
0163 #define netxen_gb_unset_gb2_mask(config_word) \
0164 ((config_word) &= ~(1 << 4))
0165 #define netxen_gb_unset_gb3_mask(config_word) \
0166 ((config_word) &= ~(1 << 6))
0167
0168
0169
0170
0171
0172 #define NETXEN_NIU_GB_MII_MGMT_ADDR_CONTROL 0
0173 #define NETXEN_NIU_GB_MII_MGMT_ADDR_STATUS 1
0174 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_0 2
0175 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_1 3
0176 #define NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG 4
0177 #define NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART 5
0178 #define NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG_MORE 6
0179 #define NETXEN_NIU_GB_MII_MGMT_ADDR_NEXTPAGE_XMIT 7
0180 #define NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART_NEXTPAGE 8
0181 #define NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_CONTROL 9
0182 #define NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_STATUS 10
0183 #define NETXEN_NIU_GB_MII_MGMT_ADDR_EXTENDED_STATUS 15
0184 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL 16
0185 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS 17
0186 #define NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE 18
0187 #define NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS 19
0188 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE 20
0189 #define NETXEN_NIU_GB_MII_MGMT_ADDR_RECV_ERROR_COUNT 21
0190 #define NETXEN_NIU_GB_MII_MGMT_ADDR_LED_CONTROL 24
0191 #define NETXEN_NIU_GB_MII_MGMT_ADDR_LED_OVERRIDE 25
0192 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE_YET 26
0193 #define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS_MORE 27
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214 #define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03)
0215
0216 #define netxen_set_phy_speed(config_word, val) \
0217 ((config_word) |= ((val & 0x03) << 14))
0218 #define netxen_set_phy_duplex(config_word) \
0219 ((config_word) |= 1 << 13)
0220 #define netxen_clear_phy_duplex(config_word) \
0221 ((config_word) &= ~(1 << 13))
0222
0223 #define netxen_get_phy_link(config_word) \
0224 _netxen_crb_get_bit(config_word, 10)
0225 #define netxen_get_phy_duplex(config_word) \
0226 _netxen_crb_get_bit(config_word, 13)
0227
0228
0229
0230
0231
0232
0233
0234
0235 #define netxen_get_niu_enable_ge(config_word) \
0236 _netxen_crb_get_bit(config_word, 1)
0237
0238 #define NETXEN_NIU_NON_PROMISC_MODE 0
0239 #define NETXEN_NIU_PROMISC_MODE 1
0240 #define NETXEN_NIU_ALLMULTI_MODE 2
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255 #define netxen_xg_soft_reset(config_word) \
0256 ((config_word) |= 1 << 4)
0257
0258 typedef struct {
0259 unsigned valid;
0260 unsigned start_128M;
0261 unsigned end_128M;
0262 unsigned start_2M;
0263 } crb_128M_2M_sub_block_map_t;
0264
0265 typedef struct {
0266 crb_128M_2M_sub_block_map_t sub_block[16];
0267 } crb_128M_2M_block_map_t;
0268
0269 #endif