44 u16 pcie_link_status, cap_offset;
46 cap_offset = adapter->
pdev->pcie_cap;
50 pci_read_config_word(adapter->
pdev,
58 mac->
ops.set_lan_id(hw);
144 e_dbg(
"Programming MAC Address into RAR[0]\n");
146 hw->
mac.ops.rar_set(hw, hw->
mac.addr, 0);
149 e_dbg(
"Clearing RAR[1-%u]\n", rar_count - 1);
150 for (i = 1; i < rar_count; i++)
151 hw->
mac.ops.rar_set(hw, mac_addr, i);
173 ret_val = e1000_read_nvm(hw,
NVM_COMPAT, 1, &nvm_data);
182 &nvm_alt_mac_addr_offset);
184 e_dbg(
"NVM Read Error\n");
188 if ((nvm_alt_mac_addr_offset == 0xFFFF) ||
189 (nvm_alt_mac_addr_offset == 0x0000))
196 offset = nvm_alt_mac_addr_offset + (i >> 1);
197 ret_val = e1000_read_nvm(hw, offset, 1, &nvm_data);
199 e_dbg(
"NVM Read Error\n");
203 alt_mac_addr[
i] = (
u8)(nvm_data & 0xFF);
204 alt_mac_addr[i + 1] = (
u8)(nvm_data >> 8);
208 if (is_multicast_ether_addr(alt_mac_addr)) {
209 e_dbg(
"Ignoring Alternate Mac Address with MC bit set\n");
218 hw->
mac.ops.rar_set(hw, alt_mac_addr, 0);
234 u32 rar_low, rar_high;
240 rar_low = ((
u32)addr[0] | ((
u32)addr[1] << 8) |
241 ((
u32)addr[2] << 16) | ((
u32)addr[3] << 24));
243 rar_high = ((
u32)addr[4] | ((
u32)addr[5] << 8));
246 if (rar_low || rar_high)
256 ew32(RAH(index), rar_high);
270 u32 hash_value, hash_mask;
274 hash_mask = (hw->
mac.mta_reg_count * 32) - 1;
280 while (hash_mask >> bit_shift != 0xFF)
309 switch (hw->
mac.mc_filter_type) {
324 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
325 (((
u16)mc_addr[5]) << bit_shift)));
340 u8 *mc_addr_list,
u32 mc_addr_count)
342 u32 hash_value, hash_bit, hash_reg;
346 memset(&hw->
mac.mta_shadow, 0,
sizeof(hw->
mac.mta_shadow));
349 for (i = 0; (
u32)i < mc_addr_count; i++) {
352 hash_reg = (hash_value >> 5) & (hw->
mac.mta_reg_count - 1);
353 hash_bit = hash_value & 0x1F;
355 hw->
mac.mta_shadow[hash_reg] |= (1 << hash_bit);
360 for (i = hw->
mac.mta_reg_count - 1; i >= 0; i--)
467 mac->
ops.config_collision_dist(hw);
477 e_dbg(
"Error configuring flow control\n");
516 e_dbg(
"NOT Rx'ing /C/, disable AutoNeg and force link.\n");
529 e_dbg(
"Error configuring flow control\n");
539 e_dbg(
"Rx'ing /C/, enable AutoNeg and stop forcing link.\n");
541 ew32(
CTRL, (ctrl & ~E1000_CTRL_SLU));
581 e_dbg(
"NOT Rx'ing /C/, disable AutoNeg and force link.\n");
594 e_dbg(
"Error configuring flow control\n");
604 e_dbg(
"Rx'ing /C/, enable AutoNeg and stop forcing link.\n");
606 ew32(
CTRL, (ctrl & ~E1000_CTRL_SLU));
621 e_dbg(
"SERDES: Link up - forced.\n");
625 e_dbg(
"SERDES: Link down - force failed.\n");
631 if (status & E1000_STATUS_LU) {
638 e_dbg(
"SERDES: Link up - autoneg completed successfully.\n");
641 e_dbg(
"SERDES: Link down - invalid codewords detected in autoneg.\n");
645 e_dbg(
"SERDES: Link down - no sync.\n");
649 e_dbg(
"SERDES: Link down - autoneg failed\n");
680 e_dbg(
"NVM Read Error\n");
712 if (hw->
phy.ops.check_reset_block && hw->
phy.ops.check_reset_block(hw))
720 ret_val = e1000_set_default_fc_generic(hw);
729 hw->
fc.current_mode = hw->
fc.requested_mode;
731 e_dbg(
"After fix-ups FlowControl is now = %x\n", hw->
fc.current_mode);
734 ret_val = hw->
mac.ops.setup_physical_interface(hw);
744 e_dbg(
"Initializing the Flow Control address, type and timer regs\n");
749 ew32(FCTTV, hw->
fc.pause_time);
761 static s32 e1000_commit_fc_settings_generic(
struct e1000_hw *hw)
783 switch (hw->
fc.current_mode) {
814 e_dbg(
"Flow control param set incorrectly\n");
832 static s32 e1000_poll_fiber_serdes_link_generic(
struct e1000_hw *hw)
851 if (i == FIBER_LINK_UP_LIMIT) {
852 e_dbg(
"Never got a valid link from auto-neg!!!\n");
860 ret_val = mac->
ops.check_for_link(hw);
862 e_dbg(
"Error while checking for link\n");
868 e_dbg(
"Valid Link Found\n");
891 hw->
mac.ops.config_collision_dist(hw);
893 ret_val = e1000_commit_fc_settings_generic(hw);
904 e_dbg(
"Auto-negotiation enabled\n");
917 ret_val = e1000_poll_fiber_serdes_link_generic(hw);
919 e_dbg(
"No signal detected\n");
955 u32 fcrtl = 0, fcrth = 0;
970 fcrtl = hw->
fc.low_water;
974 fcrth = hw->
fc.high_water;
1016 e_dbg(
"hw->fc.current_mode = %u\n", hw->
fc.current_mode);
1018 switch (hw->
fc.current_mode) {
1034 e_dbg(
"Flow control param set incorrectly\n");
1057 u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg;
1075 e_dbg(
"Error forcing flow control settings\n");
1091 ret_val = e1e_rphy(hw,
PHY_STATUS, &mii_status_reg);
1094 ret_val = e1e_rphy(hw,
PHY_STATUS, &mii_status_reg);
1099 e_dbg(
"Copper PHY and Auto Neg has not completed.\n");
1163 e_dbg(
"Flow Control = FULL.\n");
1166 e_dbg(
"Flow Control = Rx PAUSE frames only.\n");
1177 else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
1179 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1182 e_dbg(
"Flow Control = Tx PAUSE frames only.\n");
1192 else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
1193 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1194 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1195 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1197 e_dbg(
"Flow Control = Rx PAUSE frames only.\n");
1204 e_dbg(
"Flow Control = NONE.\n");
1212 ret_val = mac->
ops.get_link_up_info(hw, &speed, &duplex);
1214 e_dbg(
"Error getting link speed and duplex\n");
1227 e_dbg(
"Error forcing flow control settings\n");
1262 e_dbg(
"%u Mbps, %s Duplex\n",
1300 while (i < timeout) {
1310 e_dbg(
"Driver can't access device - SMBI bit is set.\n");
1315 for (i = 0; i < timeout; i++) {
1329 e_dbg(
"Driver can't access the NVM\n");
1369 e_dbg(
"Auto read by HW from NVM has not completed.\n");
1390 e_dbg(
"NVM Read Error\n");
1409 const u32 ledctl_mask = 0x000000FF;
1415 ret_val = hw->
nvm.ops.valid_led_default(hw, &data);
1423 for (i = 0; i < 4; i++) {
1424 temp = (data >> (i << 2)) &
led_mask;
1479 ledctl =
er32(LEDCTL);
1480 hw->
mac.ledctl_default = ledctl;
1486 ew32(LEDCTL, ledctl);
1488 ew32(LEDCTL, hw->
mac.ledctl_mode1);
1503 ew32(LEDCTL, hw->
mac.ledctl_default);
1515 u32 ledctl_blink = 0;
1527 ledctl_blink = hw->
mac.ledctl_mode2;
1528 for (i = 0; i < 4; i++)
1529 if (((hw->
mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
1535 ew32(LEDCTL, ledctl_blink);
1550 switch (hw->
phy.media_type) {
1558 ew32(LEDCTL, hw->
mac.ledctl_mode2);
1577 switch (hw->
phy.media_type) {
1585 ew32(LEDCTL, hw->
mac.ledctl_mode1);
1641 e_dbg(
"Master requests are pending.\n");
1659 e_dbg(
"Not in Adaptive IFS mode!\n");
1685 e_dbg(
"Not in Adaptive IFS mode!\n");