aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2011-01-06 15:48:03 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-01-24 12:29:32 -0500
commitfe5389c87f13c16cd77d976801c93422d0c05a49 (patch)
treef90be61b1f137562dd4748004304ad5d4b235865 /drivers/scsi
parent922a9e4da34270d81e216728f929c6e11e169794 (diff)
[SCSI] hpsa: fix board status waiting code
After a reset, we should first wait for the board to become "not ready", and then wait for it to become "ready", instead of immediately waiting for it to become "ready", and do this waiting *after* restoring PCI config space registers. Also, only wait 10 secs for board to become "not ready" after a reset (it should quickly become not ready.) Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/hpsa.c44
-rw-r--r--drivers/scsi/hpsa.h4
2 files changed, 40 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);
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 19586e189f0f..074d237f4497 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -154,12 +154,16 @@ struct ctlr_info {
154 * HPSA_BOARD_READY_ITERATIONS are derived from those. 154 * HPSA_BOARD_READY_ITERATIONS are derived from those.
155 */ 155 */
156#define HPSA_BOARD_READY_WAIT_SECS (120) 156#define HPSA_BOARD_READY_WAIT_SECS (120)
157#define HPSA_BOARD_NOT_READY_WAIT_SECS (10)
157#define HPSA_BOARD_READY_POLL_INTERVAL_MSECS (100) 158#define HPSA_BOARD_READY_POLL_INTERVAL_MSECS (100)
158#define HPSA_BOARD_READY_POLL_INTERVAL \ 159#define HPSA_BOARD_READY_POLL_INTERVAL \
159 ((HPSA_BOARD_READY_POLL_INTERVAL_MSECS * HZ) / 1000) 160 ((HPSA_BOARD_READY_POLL_INTERVAL_MSECS * HZ) / 1000)
160#define HPSA_BOARD_READY_ITERATIONS \ 161#define HPSA_BOARD_READY_ITERATIONS \
161 ((HPSA_BOARD_READY_WAIT_SECS * 1000) / \ 162 ((HPSA_BOARD_READY_WAIT_SECS * 1000) / \
162 HPSA_BOARD_READY_POLL_INTERVAL_MSECS) 163 HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
164#define HPSA_BOARD_NOT_READY_ITERATIONS \
165 ((HPSA_BOARD_NOT_READY_WAIT_SECS * 1000) / \
166 HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
163#define HPSA_POST_RESET_PAUSE_MSECS (3000) 167#define HPSA_POST_RESET_PAUSE_MSECS (3000)
164#define HPSA_POST_RESET_NOOP_RETRIES (12) 168#define HPSA_POST_RESET_NOOP_RETRIES (12)
165 169