Commit 43a04fdc authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller

be2net: fix support for PCI hot plug

Before issuing any cmds to the FW, the driver must first wait
till the fW becomes ready. This is needed for PCI hot plug when
the driver can be probed while the card fw is being initialized.
Signed-off-by: default avatarSathya Perla <sathyap@serverengines.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 73d540f2
...@@ -243,15 +243,26 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) ...@@ -243,15 +243,26 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
int be_cmd_POST(struct be_adapter *adapter) int be_cmd_POST(struct be_adapter *adapter)
{ {
u16 stage, error; u16 stage;
int status, timeout = 0;
error = be_POST_stage_get(adapter, &stage); do {
if (error || stage != POST_STAGE_ARMFW_RDY) { status = be_POST_stage_get(adapter, &stage);
dev_err(&adapter->pdev->dev, "POST failed.\n"); if (status) {
dev_err(&adapter->pdev->dev, "POST error; stage=0x%x\n",
stage);
return -1; return -1;
} else if (stage != POST_STAGE_ARMFW_RDY) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(2 * HZ);
timeout += 2;
} else {
return 0;
} }
} while (timeout < 20);
return 0; dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage);
return -1;
} }
static inline void *embedded_payload(struct be_mcc_wrb *wrb) static inline void *embedded_payload(struct be_mcc_wrb *wrb)
......
...@@ -2058,6 +2058,10 @@ static int be_hw_up(struct be_adapter *adapter) ...@@ -2058,6 +2058,10 @@ static int be_hw_up(struct be_adapter *adapter)
if (status) if (status)
return status; return status;
status = be_cmd_reset_function(adapter);
if (status)
return status;
status = be_cmd_get_fw_ver(adapter, adapter->fw_ver); status = be_cmd_get_fw_ver(adapter, adapter->fw_ver);
if (status) if (status)
return status; return status;
...@@ -2111,10 +2115,6 @@ static int __devinit be_probe(struct pci_dev *pdev, ...@@ -2111,10 +2115,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
if (status) if (status)
goto free_netdev; goto free_netdev;
status = be_cmd_reset_function(adapter);
if (status)
goto ctrl_clean;
status = be_stats_init(adapter); status = be_stats_init(adapter);
if (status) if (status)
goto ctrl_clean; goto ctrl_clean;
......
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