Commit 66d29cbc authored by Gavin Shan's avatar Gavin Shan Committed by David S. Miller

benet: Wait f/w POST until timeout

While PCI card faces EEH errors, reset (usually hot reset) is
expected to recover from the EEH errors. After EEH core finishes
the reset, the driver callback (be_eeh_reset) is called and wait
the firmware to complete POST successfully. The original code would
return with error once detecting failure during POST stage. That
seems not enough.

The patch forces the driver (be_eeh_reset) to wait the firmware
completes POST until timeout, instead of returning error upon
detection POST failure immediately. Also, it would improve the
reliability of the EEH funtionality of the driver.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Acked-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa2b04f4
...@@ -473,7 +473,7 @@ static int be_mbox_notify_wait(struct be_adapter *adapter) ...@@ -473,7 +473,7 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
return 0; return 0;
} }
static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) static void be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
{ {
u32 sem; u32 sem;
u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH : u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH :
...@@ -481,11 +481,6 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) ...@@ -481,11 +481,6 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
pci_read_config_dword(adapter->pdev, reg, &sem); pci_read_config_dword(adapter->pdev, reg, &sem);
*stage = sem & POST_STAGE_MASK; *stage = sem & POST_STAGE_MASK;
if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK)
return -1;
else
return 0;
} }
int lancer_wait_ready(struct be_adapter *adapter) int lancer_wait_ready(struct be_adapter *adapter)
...@@ -579,19 +574,17 @@ int be_fw_wait_ready(struct be_adapter *adapter) ...@@ -579,19 +574,17 @@ int be_fw_wait_ready(struct be_adapter *adapter)
} }
do { do {
status = be_POST_stage_get(adapter, &stage); be_POST_stage_get(adapter, &stage);
if (status) { if (stage == POST_STAGE_ARMFW_RDY)
dev_err(dev, "POST error; stage=0x%x\n", stage);
return -1;
} else if (stage != POST_STAGE_ARMFW_RDY) {
if (msleep_interruptible(2000)) {
dev_err(dev, "Waiting for POST aborted\n");
return -EINTR;
}
timeout += 2;
} else {
return 0; return 0;
dev_info(dev, "Waiting for POST, %ds elapsed\n",
timeout);
if (msleep_interruptible(2000)) {
dev_err(dev, "Waiting for POST aborted\n");
return -EINTR;
} }
timeout += 2;
} while (timeout < 60); } while (timeout < 60);
dev_err(dev, "POST timeout; stage=0x%x\n", stage); dev_err(dev, "POST timeout; stage=0x%x\n", stage);
......
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