aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index b345cc476940..cfd30adc3f18 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -173,6 +173,10 @@ static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev,
173static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev, 173static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
174 unsigned long *memory_bar); 174 unsigned long *memory_bar);
175static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id); 175static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
176static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
177 void __iomem *vaddr, int wait_for_ready);
178#define BOARD_NOT_READY 0
179#define BOARD_READY 1
176 180
177static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); 181static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
178static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); 182static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
@@ -3237,6 +3241,20 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
3237 need a little pause here */ 3241 need a little pause here */
3238 msleep(HPSA_POST_RESET_PAUSE_MSECS); 3242 msleep(HPSA_POST_RESET_PAUSE_MSECS);
3239 3243
3244 /* Wait for board to become not ready, then ready. */
3245 dev_info(&pdev->dev, "Waiting for board to become ready.\n");
3246 rc = hpsa_wait_for_board_state(pdev, vaddr, BOARD_NOT_READY);
3247 if (rc)
3248 dev_warn(&pdev->dev,
3249 "failed waiting for board to become not ready\n");
3250 rc = hpsa_wait_for_board_state(pdev, vaddr, BOARD_READY);
3251 if (rc) {
3252 dev_warn(&pdev->dev,
3253 "failed waiting for board to become ready\n");
3254 goto unmap_cfgtable;
3255 }
3256 dev_info(&pdev->dev, "board ready.\n");
3257
3240 /* Controller should be in simple mode at this point. If it's not, 3258 /* Controller should be in simple mode at this point. If it's not,
3241 * It means we're on one of those controllers which doesn't support 3259 * It means we're on one of those controllers which doesn't support
3242 * the doorbell reset method and on which the PCI power management reset 3260 * the doorbell reset method and on which the PCI power management reset
@@ -3432,18 +3450,28 @@ static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
3432 return -ENODEV; 3450 return -ENODEV;
3433} 3451}
3434 3452
3435static int __devinit hpsa_wait_for_board_ready(struct ctlr_info *h) 3453static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
3454 void __iomem *vaddr, int wait_for_ready)
3436{ 3455{
3437 int i; 3456 int i, iterations;
3438 u32 scratchpad; 3457 u32 scratchpad;
3458 if (wait_for_ready)
3459 iterations = HPSA_BOARD_READY_ITERATIONS;
3460 else
3461 iterations = HPSA_BOARD_NOT_READY_ITERATIONS;
3439 3462
3440 for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) { 3463 for (i = 0; i < iterations; i++) {
3441 scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); 3464 scratchpad = readl(vaddr + SA5_SCRATCHPAD_OFFSET);
3442 if (scratchpad == HPSA_FIRMWARE_READY) 3465 if (wait_for_ready) {
3443 return 0; 3466 if (scratchpad == HPSA_FIRMWARE_READY)
3467 return 0;
3468 } else {
3469 if (scratchpad != HPSA_FIRMWARE_READY)
3470 return 0;
3471 }
3444 msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS); 3472 msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS);
3445 } 3473 }
3446 dev_warn(&h->pdev->dev, "board not ready, timed out.\n"); 3474 dev_warn(&pdev->dev, "board not ready, timed out.\n");
3447 return -ENODEV; 3475 return -ENODEV;
3448} 3476}
3449 3477
@@ -3635,7 +3663,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
3635 err = -ENOMEM; 3663 err = -ENOMEM;
3636 goto err_out_free_res; 3664 goto err_out_free_res;
3637 } 3665 }
3638 err = hpsa_wait_for_board_ready(h); 3666 err = hpsa_wait_for_board_state(h->pdev, h->vaddr, BOARD_READY);
3639 if (err) 3667 if (err)
3640 goto err_out_free_res; 3668 goto err_out_free_res;
3641 err = hpsa_find_cfgtables(h); 3669 err = hpsa_find_cfgtables(h);