aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2013-03-03 16:48:46 -0500
committerDavid S. Miller <davem@davemloft.net>2013-03-06 02:47:06 -0500
commit66d29cbc59433ba538922a9e958495156b31b83b (patch)
tree50deb9e367290d70d12d79935c3ec2acd6475cb4
parentfa2b04f4502d74659e4e4b1294c6d88e08ece032 (diff)
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: Gavin Shan <shangw@linux.vnet.ibm.com> Acked-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 071aea79d218..813407f66c7c 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -473,7 +473,7 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
473 return 0; 473 return 0;
474} 474}
475 475
476static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) 476static void be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
477{ 477{
478 u32 sem; 478 u32 sem;
479 u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH : 479 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 481
482 pci_read_config_dword(adapter->pdev, reg, &sem); 482 pci_read_config_dword(adapter->pdev, reg, &sem);
483 *stage = sem & POST_STAGE_MASK; 483 *stage = sem & POST_STAGE_MASK;
484
485 if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK)
486 return -1;
487 else
488 return 0;
489} 484}
490 485
491int lancer_wait_ready(struct be_adapter *adapter) 486int lancer_wait_ready(struct be_adapter *adapter)
@@ -579,19 +574,17 @@ int be_fw_wait_ready(struct be_adapter *adapter)
579 } 574 }
580 575
581 do { 576 do {
582 status = be_POST_stage_get(adapter, &stage); 577 be_POST_stage_get(adapter, &stage);
583 if (status) { 578 if (stage == POST_STAGE_ARMFW_RDY)
584 dev_err(dev, "POST error; stage=0x%x\n", stage);
585 return -1;
586 } else if (stage != POST_STAGE_ARMFW_RDY) {
587 if (msleep_interruptible(2000)) {
588 dev_err(dev, "Waiting for POST aborted\n");
589 return -EINTR;
590 }
591 timeout += 2;
592 } else {
593 return 0; 579 return 0;
580
581 dev_info(dev, "Waiting for POST, %ds elapsed\n",
582 timeout);
583 if (msleep_interruptible(2000)) {
584 dev_err(dev, "Waiting for POST aborted\n");
585 return -EINTR;
594 } 586 }
587 timeout += 2;
595 } while (timeout < 60); 588 } while (timeout < 60);
596 589
597 dev_err(dev, "POST timeout; stage=0x%x\n", stage); 590 dev_err(dev, "POST timeout; stage=0x%x\n", stage);