28 #include <linux/if_ether.h>
30 #include <linux/pci.h>
31 #include <linux/netdevice.h>
138 for (i = 0; i < 10; i++)
158 for (i = 0; i < 10; i++)
179 hw_dbg(
"Programming MAC Address into RAR[0]\n");
181 hw->
mac.ops.rar_set(hw, hw->
mac.addr, 0);
184 hw_dbg(
"Clearing RAR[1-%u]\n", rar_count-1);
185 for (i = 1; i < rar_count; i++)
186 hw->
mac.ops.rar_set(hw, mac_addr, i);
209 if ((!!(vfta & mask)) == add) {
218 igb_write_vfta_i350(hw, index, vfta);
220 igb_write_vfta(hw, index, vfta);
252 &nvm_alt_mac_addr_offset);
254 hw_dbg(
"NVM Read Error\n");
258 if ((nvm_alt_mac_addr_offset == 0xFFFF) ||
259 (nvm_alt_mac_addr_offset == 0x0000))
271 offset = nvm_alt_mac_addr_offset + (i >> 1);
272 ret_val = hw->
nvm.ops.read(hw, offset, 1, &nvm_data);
274 hw_dbg(
"NVM Read Error\n");
278 alt_mac_addr[
i] = (
u8)(nvm_data & 0xFF);
279 alt_mac_addr[i + 1] = (
u8)(nvm_data >> 8);
283 if (is_multicast_ether_addr(alt_mac_addr)) {
284 hw_dbg(
"Ignoring Alternate Mac Address with MC bit set\n");
293 hw->
mac.ops.rar_set(hw, alt_mac_addr, 0);
310 u32 rar_low, rar_high;
316 rar_low = ((
u32) addr[0] |
317 ((
u32) addr[1] << 8) |
318 ((
u32) addr[2] << 16) | ((
u32) addr[3] << 24));
320 rar_high = ((
u32) addr[4] | ((
u32) addr[5] << 8));
323 if (rar_low || rar_high)
349 u32 hash_bit, hash_reg, mta;
361 hash_reg = (hash_value >> 5) & (hw->
mac.mta_reg_count - 1);
362 hash_bit = hash_value & 0x1F;
366 mta |= (1 << hash_bit);
381 static u32 igb_hash_mc_addr(
struct e1000_hw *hw,
u8 *mc_addr)
383 u32 hash_value, hash_mask;
387 hash_mask = (hw->
mac.mta_reg_count * 32) - 1;
393 while (hash_mask >> bit_shift != 0xFF)
422 switch (hw->
mac.mc_filter_type) {
437 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
438 (((
u16) mc_addr[5]) << bit_shift)));
453 u8 *mc_addr_list,
u32 mc_addr_count)
455 u32 hash_value, hash_bit, hash_reg;
459 memset(&hw->
mac.mta_shadow, 0,
sizeof(hw->
mac.mta_shadow));
462 for (i = 0; (
u32) i < mc_addr_count; i++) {
463 hash_value = igb_hash_mc_addr(hw, mc_addr_list);
465 hash_reg = (hash_value >> 5) & (hw->
mac.mta_reg_count - 1);
466 hash_bit = hash_value & 0x1F;
468 hw->
mac.mta_shadow[hash_reg] |= (1 << hash_bit);
473 for (i = hw->
mac.mta_reg_count - 1; i >= 0; i--)
594 hw_dbg(
"Error configuring flow control\n");
626 ret_val = igb_set_default_fc(hw);
636 hw->
fc.current_mode = hw->
fc.requested_mode;
638 hw_dbg(
"After fix-ups FlowControl is now = %x\n", hw->
fc.current_mode);
641 ret_val = hw->
mac.ops.setup_physical_interface(hw);
651 hw_dbg(
"Initializing the Flow Control address, type and timer regs\n");
658 ret_val = igb_set_fc_watermarks(hw);
694 static s32 igb_set_fc_watermarks(
struct e1000_hw *hw)
697 u32 fcrtl = 0, fcrth = 0;
712 fcrtl = hw->
fc.low_water;
716 fcrth = hw->
fc.high_water;
748 hw_dbg(
"NVM Read Error\n");
754 else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) ==
799 hw_dbg(
"hw->fc.current_mode = %u\n", hw->
fc.current_mode);
801 switch (hw->
fc.current_mode) {
817 hw_dbg(
"Flow control param set incorrectly\n");
842 u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg;
859 hw_dbg(
"Error forcing flow control settings\n");
885 hw_dbg(
"Copper PHY and Auto Neg "
886 "has not completed.\n");
902 &mii_nway_lp_ability_reg);
951 hw_dbg(
"Flow Control = FULL.\r\n");
955 "RX PAUSE frames only.\r\n");
966 else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
968 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
971 hw_dbg(
"Flow Control = TX PAUSE frames only.\r\n");
981 else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
982 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
983 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
984 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
986 hw_dbg(
"Flow Control = RX PAUSE frames only.\r\n");
1011 hw->
fc.strict_ieee) {
1013 hw_dbg(
"Flow Control = NONE.\r\n");
1016 hw_dbg(
"Flow Control = RX PAUSE frames only.\r\n");
1024 ret_val = hw->
mac.ops.get_speed_and_duplex(hw, &speed, &duplex);
1026 hw_dbg(
"Error getting link speed and duplex\n");
1039 hw_dbg(
"Error forcing flow control settings\n");
1099 while (i < timeout) {
1109 hw_dbg(
"Driver can't access device - SMBI bit is set.\n");
1115 for (i = 0; i < timeout; i++) {
1129 hw_dbg(
"Driver can't access the NVM\n");
1175 hw_dbg(
"Auto read by HW from NVM has not completed.\n");
1198 hw_dbg(
"NVM Read Error\n");
1203 switch(hw->
phy.media_type) {
1226 const u32 ledctl_mask = 0x000000FF;
1232 ret_val = igb_valid_led_default(hw, &data);
1240 for (i = 0; i < 4; i++) {
1241 temp = (data >> (i << 2)) &
led_mask;
1303 u32 ledctl_blink = 0;
1310 ledctl_blink = hw->
mac.ledctl_mode2;
1311 for (i = 0; i < 4; i++)
1312 if (((hw->
mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
1330 switch (hw->
phy.media_type) {
1374 hw_dbg(
"Master requests are pending.\n");
1394 if (!hw->
mac.autoneg && (hw->
phy.mdix == 0 || hw->
phy.mdix == 3)) {
1395 hw_dbg(
"Invalid MDI setting detected\n");
1417 u32 offset,
u8 data)
1419 u32 i, regvalue = 0;
1424 wr32(reg, regvalue);
1429 regvalue =
rd32(reg);
1434 hw_dbg(
"Reg %08x did not indicate ready\n", reg);
1454 bool ret_val =
false;
1456 if (!hw->
mac.asf_firmware_present)
1464 if (hw->
mac.arc_subsystem_valid) {