diff options
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 246 |
1 files changed, 110 insertions, 136 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index d13677899767..05b0b2f9c54b 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -484,8 +484,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
484 | * packet, also make sure the frame isn't just CRC only */ | 484 | * packet, also make sure the frame isn't just CRC only */ |
485 | if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) { | 485 | if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) { |
486 | /* All receives must fit into a single buffer */ | 486 | /* All receives must fit into a single buffer */ |
487 | ndev_dbg(netdev, "%s: Receive packet consumed " | 487 | e_dbg("%s: Receive packet consumed multiple buffers\n", |
488 | "multiple buffers\n", netdev->name); | 488 | netdev->name); |
489 | /* recycle */ | 489 | /* recycle */ |
490 | buffer_info->skb = skb; | 490 | buffer_info->skb = skb; |
491 | goto next_desc; | 491 | goto next_desc; |
@@ -576,28 +576,26 @@ static void e1000_print_tx_hang(struct e1000_adapter *adapter) | |||
576 | unsigned int i = tx_ring->next_to_clean; | 576 | unsigned int i = tx_ring->next_to_clean; |
577 | unsigned int eop = tx_ring->buffer_info[i].next_to_watch; | 577 | unsigned int eop = tx_ring->buffer_info[i].next_to_watch; |
578 | struct e1000_tx_desc *eop_desc = E1000_TX_DESC(*tx_ring, eop); | 578 | struct e1000_tx_desc *eop_desc = E1000_TX_DESC(*tx_ring, eop); |
579 | struct net_device *netdev = adapter->netdev; | ||
580 | 579 | ||
581 | /* detected Tx unit hang */ | 580 | /* detected Tx unit hang */ |
582 | ndev_err(netdev, | 581 | e_err("Detected Tx Unit Hang:\n" |
583 | "Detected Tx Unit Hang:\n" | 582 | " TDH <%x>\n" |
584 | " TDH <%x>\n" | 583 | " TDT <%x>\n" |
585 | " TDT <%x>\n" | 584 | " next_to_use <%x>\n" |
586 | " next_to_use <%x>\n" | 585 | " next_to_clean <%x>\n" |
587 | " next_to_clean <%x>\n" | 586 | "buffer_info[next_to_clean]:\n" |
588 | "buffer_info[next_to_clean]:\n" | 587 | " time_stamp <%lx>\n" |
589 | " time_stamp <%lx>\n" | 588 | " next_to_watch <%x>\n" |
590 | " next_to_watch <%x>\n" | 589 | " jiffies <%lx>\n" |
591 | " jiffies <%lx>\n" | 590 | " next_to_watch.status <%x>\n", |
592 | " next_to_watch.status <%x>\n", | 591 | readl(adapter->hw.hw_addr + tx_ring->head), |
593 | readl(adapter->hw.hw_addr + tx_ring->head), | 592 | readl(adapter->hw.hw_addr + tx_ring->tail), |
594 | readl(adapter->hw.hw_addr + tx_ring->tail), | 593 | tx_ring->next_to_use, |
595 | tx_ring->next_to_use, | 594 | tx_ring->next_to_clean, |
596 | tx_ring->next_to_clean, | 595 | tx_ring->buffer_info[eop].time_stamp, |
597 | tx_ring->buffer_info[eop].time_stamp, | 596 | eop, |
598 | eop, | 597 | jiffies, |
599 | jiffies, | 598 | eop_desc->upper.fields.status); |
600 | eop_desc->upper.fields.status); | ||
601 | } | 599 | } |
602 | 600 | ||
603 | /** | 601 | /** |
@@ -747,8 +745,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
747 | buffer_info->dma = 0; | 745 | buffer_info->dma = 0; |
748 | 746 | ||
749 | if (!(staterr & E1000_RXD_STAT_EOP)) { | 747 | if (!(staterr & E1000_RXD_STAT_EOP)) { |
750 | ndev_dbg(netdev, "%s: Packet Split buffers didn't pick " | 748 | e_dbg("%s: Packet Split buffers didn't pick up the " |
751 | "up the full packet\n", netdev->name); | 749 | "full packet\n", netdev->name); |
752 | dev_kfree_skb_irq(skb); | 750 | dev_kfree_skb_irq(skb); |
753 | goto next_desc; | 751 | goto next_desc; |
754 | } | 752 | } |
@@ -761,8 +759,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
761 | length = le16_to_cpu(rx_desc->wb.middle.length0); | 759 | length = le16_to_cpu(rx_desc->wb.middle.length0); |
762 | 760 | ||
763 | if (!length) { | 761 | if (!length) { |
764 | ndev_dbg(netdev, "%s: Last part of the packet spanning" | 762 | e_dbg("%s: Last part of the packet spanning multiple " |
765 | " multiple descriptors\n", netdev->name); | 763 | "descriptors\n", netdev->name); |
766 | dev_kfree_skb_irq(skb); | 764 | dev_kfree_skb_irq(skb); |
767 | goto next_desc; | 765 | goto next_desc; |
768 | } | 766 | } |
@@ -1011,7 +1009,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, | |||
1011 | 1009 | ||
1012 | /* eth type trans needs skb->data to point to something */ | 1010 | /* eth type trans needs skb->data to point to something */ |
1013 | if (!pskb_may_pull(skb, ETH_HLEN)) { | 1011 | if (!pskb_may_pull(skb, ETH_HLEN)) { |
1014 | ndev_err(netdev, "pskb_may_pull failed.\n"); | 1012 | e_err("pskb_may_pull failed.\n"); |
1015 | dev_kfree_skb(skb); | 1013 | dev_kfree_skb(skb); |
1016 | goto next_desc; | 1014 | goto next_desc; |
1017 | } | 1015 | } |
@@ -1251,10 +1249,8 @@ static int e1000_request_irq(struct e1000_adapter *adapter) | |||
1251 | err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, | 1249 | err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, |
1252 | netdev); | 1250 | netdev); |
1253 | if (err) { | 1251 | if (err) { |
1254 | ndev_err(netdev, | 1252 | e_err("Unable to allocate %s interrupt (return: %d)\n", |
1255 | "Unable to allocate %s interrupt (return: %d)\n", | 1253 | adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", err); |
1256 | adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", | ||
1257 | err); | ||
1258 | if (adapter->flags & FLAG_MSI_ENABLED) | 1254 | if (adapter->flags & FLAG_MSI_ENABLED) |
1259 | pci_disable_msi(adapter->pdev); | 1255 | pci_disable_msi(adapter->pdev); |
1260 | } | 1256 | } |
@@ -1395,8 +1391,7 @@ int e1000e_setup_tx_resources(struct e1000_adapter *adapter) | |||
1395 | return 0; | 1391 | return 0; |
1396 | err: | 1392 | err: |
1397 | vfree(tx_ring->buffer_info); | 1393 | vfree(tx_ring->buffer_info); |
1398 | ndev_err(adapter->netdev, | 1394 | e_err("Unable to allocate memory for the transmit descriptor ring\n"); |
1399 | "Unable to allocate memory for the transmit descriptor ring\n"); | ||
1400 | return err; | 1395 | return err; |
1401 | } | 1396 | } |
1402 | 1397 | ||
@@ -1450,8 +1445,7 @@ err_pages: | |||
1450 | } | 1445 | } |
1451 | err: | 1446 | err: |
1452 | vfree(rx_ring->buffer_info); | 1447 | vfree(rx_ring->buffer_info); |
1453 | ndev_err(adapter->netdev, | 1448 | e_err("Unable to allocate memory for the transmit descriptor ring\n"); |
1454 | "Unable to allocate memory for the transmit descriptor ring\n"); | ||
1455 | return err; | 1449 | return err; |
1456 | } | 1450 | } |
1457 | 1451 | ||
@@ -2450,13 +2444,13 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2450 | * For parts with AMT enabled, let the firmware know | 2444 | * For parts with AMT enabled, let the firmware know |
2451 | * that the network interface is in control | 2445 | * that the network interface is in control |
2452 | */ | 2446 | */ |
2453 | if ((adapter->flags & FLAG_HAS_AMT) && e1000e_check_mng_mode(hw)) | 2447 | if (adapter->flags & FLAG_HAS_AMT) |
2454 | e1000_get_hw_control(adapter); | 2448 | e1000_get_hw_control(adapter); |
2455 | 2449 | ||
2456 | ew32(WUC, 0); | 2450 | ew32(WUC, 0); |
2457 | 2451 | ||
2458 | if (mac->ops.init_hw(hw)) | 2452 | if (mac->ops.init_hw(hw)) |
2459 | ndev_err(adapter->netdev, "Hardware Error\n"); | 2453 | e_err("Hardware Error\n"); |
2460 | 2454 | ||
2461 | e1000_update_mng_vlan(adapter); | 2455 | e1000_update_mng_vlan(adapter); |
2462 | 2456 | ||
@@ -2591,7 +2585,7 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | |||
2591 | return 0; | 2585 | return 0; |
2592 | 2586 | ||
2593 | err: | 2587 | err: |
2594 | ndev_err(netdev, "Unable to allocate memory for queues\n"); | 2588 | e_err("Unable to allocate memory for queues\n"); |
2595 | kfree(adapter->rx_ring); | 2589 | kfree(adapter->rx_ring); |
2596 | kfree(adapter->tx_ring); | 2590 | kfree(adapter->tx_ring); |
2597 | return -ENOMEM; | 2591 | return -ENOMEM; |
@@ -2640,8 +2634,7 @@ static int e1000_open(struct net_device *netdev) | |||
2640 | * If AMT is enabled, let the firmware know that the network | 2634 | * If AMT is enabled, let the firmware know that the network |
2641 | * interface is now open | 2635 | * interface is now open |
2642 | */ | 2636 | */ |
2643 | if ((adapter->flags & FLAG_HAS_AMT) && | 2637 | if (adapter->flags & FLAG_HAS_AMT) |
2644 | e1000e_check_mng_mode(&adapter->hw)) | ||
2645 | e1000_get_hw_control(adapter); | 2638 | e1000_get_hw_control(adapter); |
2646 | 2639 | ||
2647 | /* | 2640 | /* |
@@ -2719,8 +2712,7 @@ static int e1000_close(struct net_device *netdev) | |||
2719 | * If AMT is enabled, let the firmware know that the network | 2712 | * If AMT is enabled, let the firmware know that the network |
2720 | * interface is now closed | 2713 | * interface is now closed |
2721 | */ | 2714 | */ |
2722 | if ((adapter->flags & FLAG_HAS_AMT) && | 2715 | if (adapter->flags & FLAG_HAS_AMT) |
2723 | e1000e_check_mng_mode(&adapter->hw)) | ||
2724 | e1000_release_hw_control(adapter); | 2716 | e1000_release_hw_control(adapter); |
2725 | 2717 | ||
2726 | return 0; | 2718 | return 0; |
@@ -2917,8 +2909,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
2917 | ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000); | 2909 | ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000); |
2918 | ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); | 2910 | ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); |
2919 | if (ret_val) | 2911 | if (ret_val) |
2920 | ndev_warn(adapter->netdev, | 2912 | e_warn("Error reading PHY register\n"); |
2921 | "Error reading PHY register\n"); | ||
2922 | } else { | 2913 | } else { |
2923 | /* | 2914 | /* |
2924 | * Do not read PHY registers if link is not up | 2915 | * Do not read PHY registers if link is not up |
@@ -2943,18 +2934,16 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
2943 | static void e1000_print_link_info(struct e1000_adapter *adapter) | 2934 | static void e1000_print_link_info(struct e1000_adapter *adapter) |
2944 | { | 2935 | { |
2945 | struct e1000_hw *hw = &adapter->hw; | 2936 | struct e1000_hw *hw = &adapter->hw; |
2946 | struct net_device *netdev = adapter->netdev; | ||
2947 | u32 ctrl = er32(CTRL); | 2937 | u32 ctrl = er32(CTRL); |
2948 | 2938 | ||
2949 | ndev_info(netdev, | 2939 | e_info("Link is Up %d Mbps %s, Flow Control: %s\n", |
2950 | "Link is Up %d Mbps %s, Flow Control: %s\n", | 2940 | adapter->link_speed, |
2951 | adapter->link_speed, | 2941 | (adapter->link_duplex == FULL_DUPLEX) ? |
2952 | (adapter->link_duplex == FULL_DUPLEX) ? | 2942 | "Full Duplex" : "Half Duplex", |
2953 | "Full Duplex" : "Half Duplex", | 2943 | ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? |
2954 | ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? | 2944 | "RX/TX" : |
2955 | "RX/TX" : | 2945 | ((ctrl & E1000_CTRL_RFCE) ? "RX" : |
2956 | ((ctrl & E1000_CTRL_RFCE) ? "RX" : | 2946 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); |
2957 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); | ||
2958 | } | 2947 | } |
2959 | 2948 | ||
2960 | static bool e1000_has_link(struct e1000_adapter *adapter) | 2949 | static bool e1000_has_link(struct e1000_adapter *adapter) |
@@ -2994,8 +2983,7 @@ static bool e1000_has_link(struct e1000_adapter *adapter) | |||
2994 | if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && | 2983 | if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && |
2995 | (er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { | 2984 | (er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { |
2996 | /* See e1000_kmrn_lock_loss_workaround_ich8lan() */ | 2985 | /* See e1000_kmrn_lock_loss_workaround_ich8lan() */ |
2997 | ndev_info(adapter->netdev, | 2986 | e_info("Gigabit has been disabled, downgrading speed\n"); |
2998 | "Gigabit has been disabled, downgrading speed\n"); | ||
2999 | } | 2987 | } |
3000 | 2988 | ||
3001 | return link_active; | 2989 | return link_active; |
@@ -3096,8 +3084,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
3096 | switch (adapter->link_speed) { | 3084 | switch (adapter->link_speed) { |
3097 | case SPEED_10: | 3085 | case SPEED_10: |
3098 | case SPEED_100: | 3086 | case SPEED_100: |
3099 | ndev_info(netdev, | 3087 | e_info("10/100 speed: disabling TSO\n"); |
3100 | "10/100 speed: disabling TSO\n"); | ||
3101 | netdev->features &= ~NETIF_F_TSO; | 3088 | netdev->features &= ~NETIF_F_TSO; |
3102 | netdev->features &= ~NETIF_F_TSO6; | 3089 | netdev->features &= ~NETIF_F_TSO6; |
3103 | break; | 3090 | break; |
@@ -3130,7 +3117,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
3130 | if (netif_carrier_ok(netdev)) { | 3117 | if (netif_carrier_ok(netdev)) { |
3131 | adapter->link_speed = 0; | 3118 | adapter->link_speed = 0; |
3132 | adapter->link_duplex = 0; | 3119 | adapter->link_duplex = 0; |
3133 | ndev_info(netdev, "Link is Down\n"); | 3120 | e_info("Link is Down\n"); |
3134 | netif_carrier_off(netdev); | 3121 | netif_carrier_off(netdev); |
3135 | netif_tx_stop_all_queues(netdev); | 3122 | netif_tx_stop_all_queues(netdev); |
3136 | if (!test_bit(__E1000_DOWN, &adapter->state)) | 3123 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
@@ -3604,8 +3591,7 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3604 | 3591 | ||
3605 | pull_size = min((unsigned int)4, skb->data_len); | 3592 | pull_size = min((unsigned int)4, skb->data_len); |
3606 | if (!__pskb_pull_tail(skb, pull_size)) { | 3593 | if (!__pskb_pull_tail(skb, pull_size)) { |
3607 | ndev_err(netdev, | 3594 | e_err("__pskb_pull_tail failed.\n"); |
3608 | "__pskb_pull_tail failed.\n"); | ||
3609 | dev_kfree_skb_any(skb); | 3595 | dev_kfree_skb_any(skb); |
3610 | return NETDEV_TX_OK; | 3596 | return NETDEV_TX_OK; |
3611 | } | 3597 | } |
@@ -3737,25 +3723,25 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3737 | 3723 | ||
3738 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || | 3724 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || |
3739 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { | 3725 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { |
3740 | ndev_err(netdev, "Invalid MTU setting\n"); | 3726 | e_err("Invalid MTU setting\n"); |
3741 | return -EINVAL; | 3727 | return -EINVAL; |
3742 | } | 3728 | } |
3743 | 3729 | ||
3744 | /* Jumbo frame size limits */ | 3730 | /* Jumbo frame size limits */ |
3745 | if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { | 3731 | if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { |
3746 | if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { | 3732 | if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
3747 | ndev_err(netdev, "Jumbo Frames not supported.\n"); | 3733 | e_err("Jumbo Frames not supported.\n"); |
3748 | return -EINVAL; | 3734 | return -EINVAL; |
3749 | } | 3735 | } |
3750 | if (adapter->hw.phy.type == e1000_phy_ife) { | 3736 | if (adapter->hw.phy.type == e1000_phy_ife) { |
3751 | ndev_err(netdev, "Jumbo Frames not supported.\n"); | 3737 | e_err("Jumbo Frames not supported.\n"); |
3752 | return -EINVAL; | 3738 | return -EINVAL; |
3753 | } | 3739 | } |
3754 | } | 3740 | } |
3755 | 3741 | ||
3756 | #define MAX_STD_JUMBO_FRAME_SIZE 9234 | 3742 | #define MAX_STD_JUMBO_FRAME_SIZE 9234 |
3757 | if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { | 3743 | if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { |
3758 | ndev_err(netdev, "MTU > 9216 not supported.\n"); | 3744 | e_err("MTU > 9216 not supported.\n"); |
3759 | return -EINVAL; | 3745 | return -EINVAL; |
3760 | } | 3746 | } |
3761 | 3747 | ||
@@ -3792,8 +3778,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3792 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN | 3778 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN |
3793 | + ETH_FCS_LEN; | 3779 | + ETH_FCS_LEN; |
3794 | 3780 | ||
3795 | ndev_info(netdev, "changing MTU from %d to %d\n", | 3781 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); |
3796 | netdev->mtu, new_mtu); | ||
3797 | netdev->mtu = new_mtu; | 3782 | netdev->mtu = new_mtu; |
3798 | 3783 | ||
3799 | if (netif_running(netdev)) | 3784 | if (netif_running(netdev)) |
@@ -4006,10 +3991,7 @@ static int e1000_resume(struct pci_dev *pdev) | |||
4006 | pci_restore_state(pdev); | 3991 | pci_restore_state(pdev); |
4007 | e1000e_disable_l1aspm(pdev); | 3992 | e1000e_disable_l1aspm(pdev); |
4008 | 3993 | ||
4009 | if (adapter->need_ioport) | 3994 | err = pci_enable_device_mem(pdev); |
4010 | err = pci_enable_device(pdev); | ||
4011 | else | ||
4012 | err = pci_enable_device_mem(pdev); | ||
4013 | if (err) { | 3995 | if (err) { |
4014 | dev_err(&pdev->dev, | 3996 | dev_err(&pdev->dev, |
4015 | "Cannot enable PCI device from suspend\n"); | 3997 | "Cannot enable PCI device from suspend\n"); |
@@ -4043,7 +4025,7 @@ static int e1000_resume(struct pci_dev *pdev) | |||
4043 | * is up. For all other cases, let the f/w know that the h/w is now | 4025 | * is up. For all other cases, let the f/w know that the h/w is now |
4044 | * under the control of the driver. | 4026 | * under the control of the driver. |
4045 | */ | 4027 | */ |
4046 | if (!(adapter->flags & FLAG_HAS_AMT) || !e1000e_check_mng_mode(&adapter->hw)) | 4028 | if (!(adapter->flags & FLAG_HAS_AMT)) |
4047 | e1000_get_hw_control(adapter); | 4029 | e1000_get_hw_control(adapter); |
4048 | 4030 | ||
4049 | return 0; | 4031 | return 0; |
@@ -4111,10 +4093,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
4111 | int err; | 4093 | int err; |
4112 | 4094 | ||
4113 | e1000e_disable_l1aspm(pdev); | 4095 | e1000e_disable_l1aspm(pdev); |
4114 | if (adapter->need_ioport) | 4096 | err = pci_enable_device_mem(pdev); |
4115 | err = pci_enable_device(pdev); | ||
4116 | else | ||
4117 | err = pci_enable_device_mem(pdev); | ||
4118 | if (err) { | 4097 | if (err) { |
4119 | dev_err(&pdev->dev, | 4098 | dev_err(&pdev->dev, |
4120 | "Cannot re-enable PCI device after reset.\n"); | 4099 | "Cannot re-enable PCI device after reset.\n"); |
@@ -4162,8 +4141,7 @@ static void e1000_io_resume(struct pci_dev *pdev) | |||
4162 | * is up. For all other cases, let the f/w know that the h/w is now | 4141 | * is up. For all other cases, let the f/w know that the h/w is now |
4163 | * under the control of the driver. | 4142 | * under the control of the driver. |
4164 | */ | 4143 | */ |
4165 | if (!(adapter->flags & FLAG_HAS_AMT) || | 4144 | if (!(adapter->flags & FLAG_HAS_AMT)) |
4166 | !e1000e_check_mng_mode(&adapter->hw)) | ||
4167 | e1000_get_hw_control(adapter); | 4145 | e1000_get_hw_control(adapter); |
4168 | 4146 | ||
4169 | } | 4147 | } |
@@ -4175,36 +4153,40 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) | |||
4175 | u32 pba_num; | 4153 | u32 pba_num; |
4176 | 4154 | ||
4177 | /* print bus type/speed/width info */ | 4155 | /* print bus type/speed/width info */ |
4178 | ndev_info(netdev, "(PCI Express:2.5GB/s:%s) " | 4156 | e_info("(PCI Express:2.5GB/s:%s) %02x:%02x:%02x:%02x:%02x:%02x\n", |
4179 | "%02x:%02x:%02x:%02x:%02x:%02x\n", | 4157 | /* bus width */ |
4180 | /* bus width */ | 4158 | ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : |
4181 | ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : | 4159 | "Width x1"), |
4182 | "Width x1"), | 4160 | /* MAC address */ |
4183 | /* MAC address */ | 4161 | netdev->dev_addr[0], netdev->dev_addr[1], |
4184 | netdev->dev_addr[0], netdev->dev_addr[1], | 4162 | netdev->dev_addr[2], netdev->dev_addr[3], |
4185 | netdev->dev_addr[2], netdev->dev_addr[3], | 4163 | netdev->dev_addr[4], netdev->dev_addr[5]); |
4186 | netdev->dev_addr[4], netdev->dev_addr[5]); | 4164 | e_info("Intel(R) PRO/%s Network Connection\n", |
4187 | ndev_info(netdev, "Intel(R) PRO/%s Network Connection\n", | 4165 | (hw->phy.type == e1000_phy_ife) ? "10/100" : "1000"); |
4188 | (hw->phy.type == e1000_phy_ife) | ||
4189 | ? "10/100" : "1000"); | ||
4190 | e1000e_read_pba_num(hw, &pba_num); | 4166 | e1000e_read_pba_num(hw, &pba_num); |
4191 | ndev_info(netdev, "MAC: %d, PHY: %d, PBA No: %06x-%03x\n", | 4167 | e_info("MAC: %d, PHY: %d, PBA No: %06x-%03x\n", |
4192 | hw->mac.type, hw->phy.type, | 4168 | hw->mac.type, hw->phy.type, (pba_num >> 8), (pba_num & 0xff)); |
4193 | (pba_num >> 8), (pba_num & 0xff)); | ||
4194 | } | 4169 | } |
4195 | 4170 | ||
4196 | /** | 4171 | static void e1000_eeprom_checks(struct e1000_adapter *adapter) |
4197 | * e1000e_is_need_ioport - determine if an adapter needs ioport resources or not | ||
4198 | * @pdev: PCI device information struct | ||
4199 | * | ||
4200 | * Returns true if an adapters needs ioport resources | ||
4201 | **/ | ||
4202 | static int e1000e_is_need_ioport(struct pci_dev *pdev) | ||
4203 | { | 4172 | { |
4204 | switch (pdev->device) { | 4173 | struct e1000_hw *hw = &adapter->hw; |
4205 | /* Currently there are no adapters that need ioport resources */ | 4174 | int ret_val; |
4206 | default: | 4175 | u16 buf = 0; |
4207 | return false; | 4176 | |
4177 | if (hw->mac.type != e1000_82573) | ||
4178 | return; | ||
4179 | |||
4180 | ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf); | ||
4181 | if (!(le16_to_cpu(buf) & (1 << 0))) { | ||
4182 | /* Deep Smart Power Down (DSPD) */ | ||
4183 | e_warn("Warning: detected DSPD enabled in EEPROM\n"); | ||
4184 | } | ||
4185 | |||
4186 | ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf); | ||
4187 | if (le16_to_cpu(buf) & (3 << 2)) { | ||
4188 | /* ASPM enable */ | ||
4189 | e_warn("Warning: detected ASPM enabled in EEPROM\n"); | ||
4208 | } | 4190 | } |
4209 | } | 4191 | } |
4210 | 4192 | ||
@@ -4233,19 +4215,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4233 | int i, err, pci_using_dac; | 4215 | int i, err, pci_using_dac; |
4234 | u16 eeprom_data = 0; | 4216 | u16 eeprom_data = 0; |
4235 | u16 eeprom_apme_mask = E1000_EEPROM_APME; | 4217 | u16 eeprom_apme_mask = E1000_EEPROM_APME; |
4236 | int bars, need_ioport; | ||
4237 | 4218 | ||
4238 | e1000e_disable_l1aspm(pdev); | 4219 | e1000e_disable_l1aspm(pdev); |
4239 | 4220 | ||
4240 | /* do not allocate ioport bars when not needed */ | 4221 | err = pci_enable_device_mem(pdev); |
4241 | need_ioport = e1000e_is_need_ioport(pdev); | ||
4242 | if (need_ioport) { | ||
4243 | bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); | ||
4244 | err = pci_enable_device(pdev); | ||
4245 | } else { | ||
4246 | bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
4247 | err = pci_enable_device_mem(pdev); | ||
4248 | } | ||
4249 | if (err) | 4222 | if (err) |
4250 | return err; | 4223 | return err; |
4251 | 4224 | ||
@@ -4268,7 +4241,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4268 | } | 4241 | } |
4269 | } | 4242 | } |
4270 | 4243 | ||
4271 | err = pci_request_selected_regions(pdev, bars, e1000e_driver_name); | 4244 | err = pci_request_selected_regions(pdev, |
4245 | pci_select_bars(pdev, IORESOURCE_MEM), | ||
4246 | e1000e_driver_name); | ||
4272 | if (err) | 4247 | if (err) |
4273 | goto err_pci_reg; | 4248 | goto err_pci_reg; |
4274 | 4249 | ||
@@ -4293,8 +4268,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4293 | adapter->hw.adapter = adapter; | 4268 | adapter->hw.adapter = adapter; |
4294 | adapter->hw.mac.type = ei->mac; | 4269 | adapter->hw.mac.type = ei->mac; |
4295 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 4270 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; |
4296 | adapter->bars = bars; | ||
4297 | adapter->need_ioport = need_ioport; | ||
4298 | 4271 | ||
4299 | mmio_start = pci_resource_start(pdev, 0); | 4272 | mmio_start = pci_resource_start(pdev, 0); |
4300 | mmio_len = pci_resource_len(pdev, 0); | 4273 | mmio_len = pci_resource_len(pdev, 0); |
@@ -4366,8 +4339,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4366 | } | 4339 | } |
4367 | 4340 | ||
4368 | if (e1000_check_reset_block(&adapter->hw)) | 4341 | if (e1000_check_reset_block(&adapter->hw)) |
4369 | ndev_info(netdev, | 4342 | e_info("PHY reset is blocked due to SOL/IDER session.\n"); |
4370 | "PHY reset is blocked due to SOL/IDER session.\n"); | ||
4371 | 4343 | ||
4372 | netdev->features = NETIF_F_SG | | 4344 | netdev->features = NETIF_F_SG | |
4373 | NETIF_F_HW_CSUM | | 4345 | NETIF_F_HW_CSUM | |
@@ -4411,25 +4383,26 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4411 | if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) | 4383 | if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) |
4412 | break; | 4384 | break; |
4413 | if (i == 2) { | 4385 | if (i == 2) { |
4414 | ndev_err(netdev, "The NVM Checksum Is Not Valid\n"); | 4386 | e_err("The NVM Checksum Is Not Valid\n"); |
4415 | err = -EIO; | 4387 | err = -EIO; |
4416 | goto err_eeprom; | 4388 | goto err_eeprom; |
4417 | } | 4389 | } |
4418 | } | 4390 | } |
4419 | 4391 | ||
4392 | e1000_eeprom_checks(adapter); | ||
4393 | |||
4420 | /* copy the MAC address out of the NVM */ | 4394 | /* copy the MAC address out of the NVM */ |
4421 | if (e1000e_read_mac_addr(&adapter->hw)) | 4395 | if (e1000e_read_mac_addr(&adapter->hw)) |
4422 | ndev_err(netdev, "NVM Read Error while reading MAC address\n"); | 4396 | e_err("NVM Read Error while reading MAC address\n"); |
4423 | 4397 | ||
4424 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); | 4398 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); |
4425 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 4399 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); |
4426 | 4400 | ||
4427 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 4401 | if (!is_valid_ether_addr(netdev->perm_addr)) { |
4428 | ndev_err(netdev, "Invalid MAC Address: " | 4402 | e_err("Invalid MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", |
4429 | "%02x:%02x:%02x:%02x:%02x:%02x\n", | 4403 | netdev->perm_addr[0], netdev->perm_addr[1], |
4430 | netdev->perm_addr[0], netdev->perm_addr[1], | 4404 | netdev->perm_addr[2], netdev->perm_addr[3], |
4431 | netdev->perm_addr[2], netdev->perm_addr[3], | 4405 | netdev->perm_addr[4], netdev->perm_addr[5]); |
4432 | netdev->perm_addr[4], netdev->perm_addr[5]); | ||
4433 | err = -EIO; | 4406 | err = -EIO; |
4434 | goto err_eeprom; | 4407 | goto err_eeprom; |
4435 | } | 4408 | } |
@@ -4499,8 +4472,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4499 | * is up. For all other cases, let the f/w know that the h/w is now | 4472 | * is up. For all other cases, let the f/w know that the h/w is now |
4500 | * under the control of the driver. | 4473 | * under the control of the driver. |
4501 | */ | 4474 | */ |
4502 | if (!(adapter->flags & FLAG_HAS_AMT) || | 4475 | if (!(adapter->flags & FLAG_HAS_AMT)) |
4503 | !e1000e_check_mng_mode(&adapter->hw)) | ||
4504 | e1000_get_hw_control(adapter); | 4476 | e1000_get_hw_control(adapter); |
4505 | 4477 | ||
4506 | /* tell the stack to leave us alone until e1000_open() is called */ | 4478 | /* tell the stack to leave us alone until e1000_open() is called */ |
@@ -4517,24 +4489,25 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4517 | return 0; | 4489 | return 0; |
4518 | 4490 | ||
4519 | err_register: | 4491 | err_register: |
4520 | err_hw_init: | 4492 | if (!(adapter->flags & FLAG_HAS_AMT)) |
4521 | e1000_release_hw_control(adapter); | 4493 | e1000_release_hw_control(adapter); |
4522 | err_eeprom: | 4494 | err_eeprom: |
4523 | if (!e1000_check_reset_block(&adapter->hw)) | 4495 | if (!e1000_check_reset_block(&adapter->hw)) |
4524 | e1000_phy_hw_reset(&adapter->hw); | 4496 | e1000_phy_hw_reset(&adapter->hw); |
4497 | err_hw_init: | ||
4525 | 4498 | ||
4526 | if (adapter->hw.flash_address) | ||
4527 | iounmap(adapter->hw.flash_address); | ||
4528 | |||
4529 | err_flashmap: | ||
4530 | kfree(adapter->tx_ring); | 4499 | kfree(adapter->tx_ring); |
4531 | kfree(adapter->rx_ring); | 4500 | kfree(adapter->rx_ring); |
4532 | err_sw_init: | 4501 | err_sw_init: |
4502 | if (adapter->hw.flash_address) | ||
4503 | iounmap(adapter->hw.flash_address); | ||
4504 | err_flashmap: | ||
4533 | iounmap(adapter->hw.hw_addr); | 4505 | iounmap(adapter->hw.hw_addr); |
4534 | err_ioremap: | 4506 | err_ioremap: |
4535 | free_netdev(netdev); | 4507 | free_netdev(netdev); |
4536 | err_alloc_etherdev: | 4508 | err_alloc_etherdev: |
4537 | pci_release_selected_regions(pdev, bars); | 4509 | pci_release_selected_regions(pdev, |
4510 | pci_select_bars(pdev, IORESOURCE_MEM)); | ||
4538 | err_pci_reg: | 4511 | err_pci_reg: |
4539 | err_dma: | 4512 | err_dma: |
4540 | pci_disable_device(pdev); | 4513 | pci_disable_device(pdev); |
@@ -4582,7 +4555,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev) | |||
4582 | iounmap(adapter->hw.hw_addr); | 4555 | iounmap(adapter->hw.hw_addr); |
4583 | if (adapter->hw.flash_address) | 4556 | if (adapter->hw.flash_address) |
4584 | iounmap(adapter->hw.flash_address); | 4557 | iounmap(adapter->hw.flash_address); |
4585 | pci_release_selected_regions(pdev, adapter->bars); | 4558 | pci_release_selected_regions(pdev, |
4559 | pci_select_bars(pdev, IORESOURCE_MEM)); | ||
4586 | 4560 | ||
4587 | free_netdev(netdev); | 4561 | free_netdev(netdev); |
4588 | 4562 | ||