aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>2011-11-02 21:50:08 -0400
committerDavid S. Miller <davem@davemloft.net>2011-11-03 21:59:40 -0400
commite1cfb67acd5e890bbad695000d2c997bfb7f1756 (patch)
tree898e6b168e9641f31633157385de5c84375ae802 /drivers/net
parent9372cacb300df3ee0a8be8a25bea15d16a95c583 (diff)
be2net: Add detect UE feature for Lancer
Add code to detect UE in case of Lancer. Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c3
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c58
3 files changed, 42 insertions, 21 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 03fe7cde2e61..2c7b36673dfc 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -318,8 +318,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
318 318
319 if (msecs > 4000) { 319 if (msecs > 4000) {
320 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 320 dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
321 if (!lancer_chip(adapter)) 321 be_detect_dump_ue(adapter);
322 be_detect_dump_ue(adapter);
323 return -1; 322 return -1;
324 } 323 }
325 324
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index fbc8a915519e..f2c89e3ccabd 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -48,6 +48,8 @@
48/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */ 48/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */
49#define SLIPORT_STATUS_OFFSET 0x404 49#define SLIPORT_STATUS_OFFSET 0x404
50#define SLIPORT_CONTROL_OFFSET 0x408 50#define SLIPORT_CONTROL_OFFSET 0x408
51#define SLIPORT_ERROR1_OFFSET 0x40C
52#define SLIPORT_ERROR2_OFFSET 0x410
51 53
52#define SLIPORT_STATUS_ERR_MASK 0x80000000 54#define SLIPORT_STATUS_ERR_MASK 0x80000000
53#define SLIPORT_STATUS_RN_MASK 0x01000000 55#define SLIPORT_STATUS_RN_MASK 0x01000000
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 30606f5ec0d0..e0aed188c57f 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1977,42 +1977,62 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
1977 1977
1978void be_detect_dump_ue(struct be_adapter *adapter) 1978void be_detect_dump_ue(struct be_adapter *adapter)
1979{ 1979{
1980 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; 1980 u32 ue_lo = 0, ue_hi = 0, ue_lo_mask = 0, ue_hi_mask = 0;
1981 u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
1981 u32 i; 1982 u32 i;
1982 1983
1983 pci_read_config_dword(adapter->pdev, 1984 if (lancer_chip(adapter)) {
1984 PCICFG_UE_STATUS_LOW, &ue_status_lo); 1985 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
1985 pci_read_config_dword(adapter->pdev, 1986 if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
1986 PCICFG_UE_STATUS_HIGH, &ue_status_hi); 1987 sliport_err1 = ioread32(adapter->db +
1987 pci_read_config_dword(adapter->pdev, 1988 SLIPORT_ERROR1_OFFSET);
1988 PCICFG_UE_STATUS_LOW_MASK, &ue_status_lo_mask); 1989 sliport_err2 = ioread32(adapter->db +
1989 pci_read_config_dword(adapter->pdev, 1990 SLIPORT_ERROR2_OFFSET);
1990 PCICFG_UE_STATUS_HI_MASK, &ue_status_hi_mask); 1991 }
1992 } else {
1993 pci_read_config_dword(adapter->pdev,
1994 PCICFG_UE_STATUS_LOW, &ue_lo);
1995 pci_read_config_dword(adapter->pdev,
1996 PCICFG_UE_STATUS_HIGH, &ue_hi);
1997 pci_read_config_dword(adapter->pdev,
1998 PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask);
1999 pci_read_config_dword(adapter->pdev,
2000 PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask);
1991 2001
1992 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); 2002 ue_lo = (ue_lo & (~ue_lo_mask));
1993 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); 2003 ue_hi = (ue_hi & (~ue_hi_mask));
2004 }
1994 2005
1995 if (ue_status_lo || ue_status_hi) { 2006 if (ue_lo || ue_hi ||
2007 sliport_status & SLIPORT_STATUS_ERR_MASK) {
1996 adapter->ue_detected = true; 2008 adapter->ue_detected = true;
1997 adapter->eeh_err = true; 2009 adapter->eeh_err = true;
1998 dev_err(&adapter->pdev->dev, "UE Detected!!\n"); 2010 dev_err(&adapter->pdev->dev, "UE Detected!!\n");
1999 } 2011 }
2000 2012
2001 if (ue_status_lo) { 2013 if (ue_lo) {
2002 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { 2014 for (i = 0; ue_lo; ue_lo >>= 1, i++) {
2003 if (ue_status_lo & 1) 2015 if (ue_lo & 1)
2004 dev_err(&adapter->pdev->dev, 2016 dev_err(&adapter->pdev->dev,
2005 "UE: %s bit set\n", ue_status_low_desc[i]); 2017 "UE: %s bit set\n", ue_status_low_desc[i]);
2006 } 2018 }
2007 } 2019 }
2008 if (ue_status_hi) { 2020 if (ue_hi) {
2009 for (i = 0; ue_status_hi; ue_status_hi >>= 1, i++) { 2021 for (i = 0; ue_hi; ue_hi >>= 1, i++) {
2010 if (ue_status_hi & 1) 2022 if (ue_hi & 1)
2011 dev_err(&adapter->pdev->dev, 2023 dev_err(&adapter->pdev->dev,
2012 "UE: %s bit set\n", ue_status_hi_desc[i]); 2024 "UE: %s bit set\n", ue_status_hi_desc[i]);
2013 } 2025 }
2014 } 2026 }
2015 2027
2028 if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
2029 dev_err(&adapter->pdev->dev,
2030 "sliport status 0x%x\n", sliport_status);
2031 dev_err(&adapter->pdev->dev,
2032 "sliport error1 0x%x\n", sliport_err1);
2033 dev_err(&adapter->pdev->dev,
2034 "sliport error2 0x%x\n", sliport_err2);
2035 }
2016} 2036}
2017 2037
2018static void be_worker(struct work_struct *work) 2038static void be_worker(struct work_struct *work)
@@ -2022,7 +2042,7 @@ static void be_worker(struct work_struct *work)
2022 struct be_rx_obj *rxo; 2042 struct be_rx_obj *rxo;
2023 int i; 2043 int i;
2024 2044
2025 if (!adapter->ue_detected && !lancer_chip(adapter)) 2045 if (!adapter->ue_detected)
2026 be_detect_dump_ue(adapter); 2046 be_detect_dump_ue(adapter);
2027 2047
2028 /* when interrupts are not yet enabled, just reap any pending 2048 /* when interrupts are not yet enabled, just reap any pending