diff options
author | Sathya Perla <sathyap@serverengines.com> | 2009-10-14 16:21:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-15 02:29:56 -0400 |
commit | 43a04fdc369ce4fb6718b95e1c930ff8661e65c1 (patch) | |
tree | b7ae4c9b9e39694320a03db2f63edd3e3ecbdd3a /drivers/net/benet/be_cmds.c | |
parent | 73d540f282c0d8ce48fafd7fcc844e91f31d4103 (diff) |
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: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index b57abc0c9f48..28a0eda92680 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -243,15 +243,26 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) | |||
243 | 243 | ||
244 | int be_cmd_POST(struct be_adapter *adapter) | 244 | int be_cmd_POST(struct be_adapter *adapter) |
245 | { | 245 | { |
246 | u16 stage, error; | 246 | u16 stage; |
247 | int status, timeout = 0; | ||
247 | 248 | ||
248 | error = be_POST_stage_get(adapter, &stage); | 249 | do { |
249 | if (error || stage != POST_STAGE_ARMFW_RDY) { | 250 | status = be_POST_stage_get(adapter, &stage); |
250 | dev_err(&adapter->pdev->dev, "POST failed.\n"); | 251 | if (status) { |
251 | return -1; | 252 | dev_err(&adapter->pdev->dev, "POST error; stage=0x%x\n", |
252 | } | 253 | stage); |
254 | return -1; | ||
255 | } else if (stage != POST_STAGE_ARMFW_RDY) { | ||
256 | set_current_state(TASK_INTERRUPTIBLE); | ||
257 | schedule_timeout(2 * HZ); | ||
258 | timeout += 2; | ||
259 | } else { | ||
260 | return 0; | ||
261 | } | ||
262 | } while (timeout < 20); | ||
253 | 263 | ||
254 | return 0; | 264 | dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage); |
265 | return -1; | ||
255 | } | 266 | } |
256 | 267 | ||
257 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) | 268 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) |