Commit e1cfb67a authored by Padmanabh Ratnakar's avatar Padmanabh Ratnakar Committed by David S. Miller

be2net: Add detect UE feature for Lancer

Add code to detect UE in case of Lancer.
Signed-off-by: default avatarPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9372cacb
...@@ -318,8 +318,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) ...@@ -318,8 +318,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
if (msecs > 4000) { if (msecs > 4000) {
dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 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; return -1;
} }
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */ /* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */
#define SLIPORT_STATUS_OFFSET 0x404 #define SLIPORT_STATUS_OFFSET 0x404
#define SLIPORT_CONTROL_OFFSET 0x408 #define SLIPORT_CONTROL_OFFSET 0x408
#define SLIPORT_ERROR1_OFFSET 0x40C
#define SLIPORT_ERROR2_OFFSET 0x410
#define SLIPORT_STATUS_ERR_MASK 0x80000000 #define SLIPORT_STATUS_ERR_MASK 0x80000000
#define SLIPORT_STATUS_RN_MASK 0x01000000 #define SLIPORT_STATUS_RN_MASK 0x01000000
......
...@@ -1977,42 +1977,62 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget) ...@@ -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) 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; u32 i;
pci_read_config_dword(adapter->pdev, if (lancer_chip(adapter)) {
PCICFG_UE_STATUS_LOW, &ue_status_lo); sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
pci_read_config_dword(adapter->pdev, if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
PCICFG_UE_STATUS_HIGH, &ue_status_hi); sliport_err1 = ioread32(adapter->db +
pci_read_config_dword(adapter->pdev, SLIPORT_ERROR1_OFFSET);
PCICFG_UE_STATUS_LOW_MASK, &ue_status_lo_mask); sliport_err2 = ioread32(adapter->db +
pci_read_config_dword(adapter->pdev, SLIPORT_ERROR2_OFFSET);
PCICFG_UE_STATUS_HI_MASK, &ue_status_hi_mask); }
} 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_lo = (ue_lo & (~ue_lo_mask));
ue_status_hi = (ue_status_hi & (~ue_status_hi_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->ue_detected = true;
adapter->eeh_err = true; adapter->eeh_err = true;
dev_err(&adapter->pdev->dev, "UE Detected!!\n"); dev_err(&adapter->pdev->dev, "UE Detected!!\n");
} }
if (ue_status_lo) { if (ue_lo) {
for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { for (i = 0; ue_lo; ue_lo >>= 1, i++) {
if (ue_status_lo & 1) if (ue_lo & 1)
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"UE: %s bit set\n", ue_status_low_desc[i]); "UE: %s bit set\n", ue_status_low_desc[i]);
} }
} }
if (ue_status_hi) { if (ue_hi) {
for (i = 0; ue_status_hi; ue_status_hi >>= 1, i++) { for (i = 0; ue_hi; ue_hi >>= 1, i++) {
if (ue_status_hi & 1) if (ue_hi & 1)
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"UE: %s bit set\n", ue_status_hi_desc[i]); "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) static void be_worker(struct work_struct *work)
...@@ -2022,7 +2042,7 @@ 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; struct be_rx_obj *rxo;
int i; int i;
if (!adapter->ue_detected && !lancer_chip(adapter)) if (!adapter->ue_detected)
be_detect_dump_ue(adapter); be_detect_dump_ue(adapter);
/* when interrupts are not yet enabled, just reap any pending /* when interrupts are not yet enabled, just reap any pending
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment