From 2f9acd650bd507fe8818b8180358684db0dfdb07 Mon Sep 17 00:00:00 2001 From: Joerg Albert Date: Mon, 16 May 2016 00:52:10 +0200 Subject: [PATCH] e1000e: added more error output during probe made debug output errors to see it, when probe fails. fixed a missing error return code --- drivers/net/ethernet/intel/e1000e/ich8lan.c | 48 ++++++++++++++++++++--------- drivers/net/ethernet/intel/e1000e/netdev.c | 39 +++++++++++++++-------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index c0f4887..265a069 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -322,7 +322,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) ret_val = hw->phy.ops.acquire(hw); if (ret_val) { - e_dbg("Failed to initialize PHY flow\n"); + e_err("Failed to initialize PHY flow (%d)\n", ret_val); goto out; } @@ -361,7 +361,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) break; if (hw->phy.ops.check_reset_block(hw)) { - e_dbg("Required LANPHYPC toggle blocked by ME\n"); + e_err("Required LANPHYPC toggle blocked by ME\n"); ret_val = -E1000_ERR_PHY; break; } @@ -395,6 +395,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) /* Check to see if able to reset PHY. Print error if not */ if (hw->phy.ops.check_reset_block(hw)) { e_err("Reset blocked by ME\n"); + ret_val = -E1000_BLK_PHY_RESET; goto out; } @@ -404,13 +405,15 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) * because we haven't determined the PHY type yet. */ ret_val = e1000e_phy_hw_reset_generic(hw); - if (ret_val) + if (ret_val) { + e_err("e1000e_phy_hw_reset_generic failed with %d\n", ret_val); goto out; + } /* On a successful reset, possibly need to wait for the PHY * to quiesce to an accessible state before returning control * to the calling function. If the PHY does not quiesce, then - * return E1000E_BLK_PHY_RESET, as this is the condition that + * return E1000_BLK_PHY_RESET, as this is the condition that * the PHY is in. */ ret_val = hw->phy.ops.check_reset_block(hw); @@ -438,6 +441,7 @@ out: static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; + struct e1000_adapter *adapter = hw->adapter; s32 ret_val; phy->addr = 1; @@ -459,15 +463,19 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) phy->id = e1000_phy_unknown; ret_val = e1000_init_phy_workarounds_pchlan(hw); - if (ret_val) + if (ret_val) { + e_err("%s: e1000_init_phy_workarounds_pchlan returned %d\n", __func__, ret_val); return ret_val; + } if (phy->id == e1000_phy_unknown) switch (hw->mac.type) { default: ret_val = e1000e_get_phy_id(hw); - if (ret_val) + if (ret_val) { + e_err("%s: e1000e_get_phy_id returned %d\n", __func__, ret_val); return ret_val; + } if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK)) break; /* fall-through */ @@ -478,11 +486,15 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) * set slow mode and try to get the PHY id again. */ ret_val = e1000_set_mdio_slow_mode_hv(hw); - if (ret_val) + if (ret_val) { + e_err("%s: e1000_set_mdio_slow_mode returned %d\n", __func__, ret_val); return ret_val; + } ret_val = e1000e_get_phy_id(hw); - if (ret_val) + if (ret_val) { + e_err("%s: e1000e_get_phy_id (2) returned %d\n", __func__, ret_val); return ret_val; + } break; } phy->type = e1000e_get_phy_type_from_id(phy->id); @@ -506,6 +518,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) break; default: ret_val = -E1000_ERR_PHY; + e_err("%s: return %d for phy->type %d\n", __func__, ret_val, phy->type); break; } @@ -1623,12 +1636,16 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) s32 rc; rc = e1000_init_mac_params_ich8lan(hw); - if (rc) + if (rc) { + dev_err(&adapter->pdev->dev, "e1000_init_mac_params_ich8lan failed with %d\n", rc); return rc; + } rc = e1000_init_nvm_params_ich8lan(hw); - if (rc) + if (rc) { + dev_err(&adapter->pdev->dev, "e1000_init_nvm_params_ich8lan failed with %d\n", rc); return rc; + } switch (hw->mac.type) { case e1000_ich8lan: @@ -1645,8 +1662,10 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) default: break; } - if (rc) + if (rc) { + dev_err(&adapter->pdev->dev, "e1000_init_phy_params-* failed with %d (mac.type %d)\n", rc, hw->mac.type); return rc; + } /* Disable Jumbo Frame support on parts with Intel 10/100 PHY or * on parts with MACsec enabled in NVM (reflected in CTRL_EXT). @@ -1709,10 +1728,11 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) { u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT; s32 ret_val = 0; + struct e1000_adapter *adapter = hw->adapter; if (test_and_set_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state)) { - e_dbg("contention for Phy access\n"); + e_err("contention for Phy access\n"); return -E1000_ERR_PHY; } @@ -1726,7 +1746,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) } if (!timeout) { - e_dbg("SW has already locked the resource.\n"); + e_err("SW has already locked the resource.\n"); ret_val = -E1000_ERR_CONFIG; goto out; } @@ -1746,7 +1766,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) } if (!timeout) { - e_dbg("Failed to acquire the semaphore, FW or HW has it: FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n", + e_err("Failed to acquire the semaphore, FW or HW has it: FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n", er32(FWSM), extcnf_ctrl); extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; ew32(EXTCNF_CTRL, extcnf_ctrl); diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 9b4ec13..fe3a969 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6975,8 +6975,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) e1000e_disable_aspm(pdev, aspm_disable_flag); err = pci_enable_device_mem(pdev); - if (err) + if (err) { + dev_err(&pdev->dev, "pci_enable_device_mem failed with %d\n", err); return err; + } pci_using_dac = 0; err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); @@ -6994,22 +6996,27 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) bars = pci_select_bars(pdev, IORESOURCE_MEM); err = pci_request_selected_regions_exclusive(pdev, bars, e1000e_driver_name); - if (err) + if (err) { + dev_err(&pdev->dev, "pci_request_selected_regions_exclusive failed with %d\n", err); goto err_pci_reg; - + } /* AER (Advanced Error Reporting) hooks */ pci_enable_pcie_error_reporting(pdev); pci_set_master(pdev); /* PCI config space info */ err = pci_save_state(pdev); - if (err) + if (err) { + dev_err(&pdev->dev, "pci_save_state failed with %d\n", err); goto err_alloc_etherdev; + } err = -ENOMEM; netdev = alloc_etherdev(sizeof(struct e1000_adapter)); - if (!netdev) + if (!netdev) { + dev_err(&pdev->dev, "alloc_etherdev failed with %d\n", err); goto err_alloc_etherdev; + } SET_NETDEV_DEV(netdev, &pdev->dev); @@ -7034,8 +7041,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = -EIO; adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); - if (!adapter->hw.hw_addr) + if (!adapter->hw.hw_addr) { + dev_err(&pdev->dev, "ioremap(mmio) failed\n"); goto err_ioremap; + } if ((adapter->flags & FLAG_HAS_FLASH) && (pci_resource_flags(pdev, 1) & IORESOURCE_MEM) && @@ -7043,8 +7052,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) flash_start = pci_resource_start(pdev, 1); flash_len = pci_resource_len(pdev, 1); adapter->hw.flash_address = ioremap(flash_start, flash_len); - if (!adapter->hw.flash_address) + if (!adapter->hw.flash_address) { + dev_err(&pdev->dev, "ioremap(flash) failed\n"); goto err_flashmap; + } } /* Set default EEE advertisement */ @@ -7067,16 +7078,19 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* setup adapter struct */ err = e1000_sw_init(adapter); - if (err) + if (err) { + dev_err(&pdev->dev, "e1000e_sw_init failed with %d\n", err); goto err_sw_init; - + } memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops)); memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops)); memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops)); err = ei->get_variants(adapter); - if (err) + if (err) { + dev_err(&pdev->dev, "ei->get_variants failed with %d\n", err); goto err_hw_init; + } if ((adapter->flags & FLAG_IS_ICH) && (adapter->flags & FLAG_READ_ONLY_NVM) && @@ -7250,9 +7264,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) strlcpy(netdev->name, "eth%d", sizeof(netdev->name)); err = register_netdev(netdev); - if (err) + if (err) { + dev_err(&pdev->dev, "register_netdev failed with %d\n", err); goto err_register; - + } /* carrier off reporting is important to ethtool even BEFORE open */ netif_carrier_off(netdev); -- 1.9.1