be2net: Add detect UE feature for Lancer
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Thu, 3 Nov 2011 01:50:08 +0000 (01:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Nov 2011 01:59:40 +0000 (21:59 -0400)
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>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_hw.h
drivers/net/ethernet/emulex/benet/be_main.c

index 03fe7cde2e6188628f7057e428b9d2fc78dec660..2c7b36673dfc27bbae1c94a033ff702a2a928be4 100644 (file)
@@ -318,8 +318,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
 
                if (msecs > 4000) {
                        dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
-                       if (!lancer_chip(adapter))
-                               be_detect_dump_ue(adapter);
+                       be_detect_dump_ue(adapter);
                        return -1;
                }
 
index fbc8a915519e57aa36bb2f01f781475a5530ada1..f2c89e3ccabde3bdbae75296f882eca41df18322 100644 (file)
@@ -48,6 +48,8 @@
 /* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */
 #define SLIPORT_STATUS_OFFSET          0x404
 #define SLIPORT_CONTROL_OFFSET         0x408
+#define SLIPORT_ERROR1_OFFSET          0x40C
+#define SLIPORT_ERROR2_OFFSET          0x410
 
 #define SLIPORT_STATUS_ERR_MASK                0x80000000
 #define SLIPORT_STATUS_RN_MASK         0x01000000
index 30606f5ec0d09696f2680b76ac53d26724a8298d..e0aed188c57fd09b714766f0c96aa9e2c3601f43 100644 (file)
@@ -1977,42 +1977,62 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
 
 void be_detect_dump_ue(struct be_adapter *adapter)
 {
-       u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
+       u32 ue_lo = 0, ue_hi = 0, ue_lo_mask = 0, ue_hi_mask = 0;
+       u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
        u32 i;
 
-       pci_read_config_dword(adapter->pdev,
-                               PCICFG_UE_STATUS_LOW, &ue_status_lo);
-       pci_read_config_dword(adapter->pdev,
-                               PCICFG_UE_STATUS_HIGH, &ue_status_hi);
-       pci_read_config_dword(adapter->pdev,
-                               PCICFG_UE_STATUS_LOW_MASK, &ue_status_lo_mask);
-       pci_read_config_dword(adapter->pdev,
-                               PCICFG_UE_STATUS_HI_MASK, &ue_status_hi_mask);
+       if (lancer_chip(adapter)) {
+               sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
+               if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+                       sliport_err1 = ioread32(adapter->db +
+                                       SLIPORT_ERROR1_OFFSET);
+                       sliport_err2 = ioread32(adapter->db +
+                                       SLIPORT_ERROR2_OFFSET);
+               }
+       } else {
+               pci_read_config_dword(adapter->pdev,
+                               PCICFG_UE_STATUS_LOW, &ue_lo);
+               pci_read_config_dword(adapter->pdev,
+                               PCICFG_UE_STATUS_HIGH, &ue_hi);
+               pci_read_config_dword(adapter->pdev,
+                               PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask);
+               pci_read_config_dword(adapter->pdev,
+                               PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask);
 
-       ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
-       ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
+               ue_lo = (ue_lo & (~ue_lo_mask));
+               ue_hi = (ue_hi & (~ue_hi_mask));
+       }
 
-       if (ue_status_lo || ue_status_hi) {
+       if (ue_lo || ue_hi ||
+               sliport_status & SLIPORT_STATUS_ERR_MASK) {
                adapter->ue_detected = true;
                adapter->eeh_err = true;
                dev_err(&adapter->pdev->dev, "UE Detected!!\n");
        }
 
-       if (ue_status_lo) {
-               for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
-                       if (ue_status_lo & 1)
+       if (ue_lo) {
+               for (i = 0; ue_lo; ue_lo >>= 1, i++) {
+                       if (ue_lo & 1)
                                dev_err(&adapter->pdev->dev,
                                "UE: %s bit set\n", ue_status_low_desc[i]);
                }
        }
-       if (ue_status_hi) {
-               for (i = 0; ue_status_hi; ue_status_hi >>= 1, i++) {
-                       if (ue_status_hi & 1)
+       if (ue_hi) {
+               for (i = 0; ue_hi; ue_hi >>= 1, i++) {
+                       if (ue_hi & 1)
                                dev_err(&adapter->pdev->dev,
                                "UE: %s bit set\n", ue_status_hi_desc[i]);
                }
        }
 
+       if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+               dev_err(&adapter->pdev->dev,
+                       "sliport status 0x%x\n", sliport_status);
+               dev_err(&adapter->pdev->dev,
+                       "sliport error1 0x%x\n", sliport_err1);
+               dev_err(&adapter->pdev->dev,
+                       "sliport error2 0x%x\n", sliport_err2);
+       }
 }
 
 static void be_worker(struct work_struct *work)
@@ -2022,7 +2042,7 @@ static void be_worker(struct work_struct *work)
        struct be_rx_obj *rxo;
        int i;
 
-       if (!adapter->ue_detected && !lancer_chip(adapter))
+       if (!adapter->ue_detected)
                be_detect_dump_ue(adapter);
 
        /* when interrupts are not yet enabled, just reap any pending