diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-06-16 14:51:35 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:02:00 -0400 |
commit | 4c2a8c40d877effc25774f00406a4a7df1967102 (patch) | |
tree | dfba737fcbd73674ffd720378e82f1f57ccb02eb | |
parent | a51fd47f1b8f2b9937011c433269d2ec182b9879 (diff) |
[SCSI] hpsa: factor out the code to reset controllers on driver load
for kdump support
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/hpsa.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 44f81a0ae531..b2f478596dfb 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -3571,33 +3571,44 @@ static void __devinit hpsa_hba_inquiry(struct ctlr_info *h) | |||
3571 | } | 3571 | } |
3572 | } | 3572 | } |
3573 | 3573 | ||
3574 | static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev) | ||
3575 | { | ||
3576 | int i; | ||
3577 | |||
3578 | if (!reset_devices) | ||
3579 | return 0; | ||
3580 | |||
3581 | /* Reset the controller with a PCI power-cycle */ | ||
3582 | if (hpsa_hard_reset_controller(pdev) || hpsa_reset_msi(pdev)) | ||
3583 | return -ENODEV; | ||
3584 | |||
3585 | /* Some devices (notably the HP Smart Array 5i Controller) | ||
3586 | need a little pause here */ | ||
3587 | msleep(HPSA_POST_RESET_PAUSE_MSECS); | ||
3588 | |||
3589 | /* Now try to get the controller to respond to a no-op */ | ||
3590 | for (i = 0; i < HPSA_POST_RESET_NOOP_RETRIES; i++) { | ||
3591 | if (hpsa_noop(pdev) == 0) | ||
3592 | break; | ||
3593 | else | ||
3594 | dev_warn(&pdev->dev, "no-op failed%s\n", | ||
3595 | (i < 11 ? "; re-trying" : "")); | ||
3596 | } | ||
3597 | return 0; | ||
3598 | } | ||
3599 | |||
3574 | static int __devinit hpsa_init_one(struct pci_dev *pdev, | 3600 | static int __devinit hpsa_init_one(struct pci_dev *pdev, |
3575 | const struct pci_device_id *ent) | 3601 | const struct pci_device_id *ent) |
3576 | { | 3602 | { |
3577 | int i, rc; | 3603 | int dac, rc; |
3578 | int dac; | ||
3579 | struct ctlr_info *h; | 3604 | struct ctlr_info *h; |
3580 | 3605 | ||
3581 | if (number_of_controllers == 0) | 3606 | if (number_of_controllers == 0) |
3582 | printk(KERN_INFO DRIVER_NAME "\n"); | 3607 | printk(KERN_INFO DRIVER_NAME "\n"); |
3583 | if (reset_devices) { | ||
3584 | /* Reset the controller with a PCI power-cycle */ | ||
3585 | if (hpsa_hard_reset_controller(pdev) || hpsa_reset_msi(pdev)) | ||
3586 | return -ENODEV; | ||
3587 | |||
3588 | /* Some devices (notably the HP Smart Array 5i Controller) | ||
3589 | need a little pause here */ | ||
3590 | msleep(HPSA_POST_RESET_PAUSE_MSECS); | ||
3591 | 3608 | ||
3592 | /* Now try to get the controller to respond to a no-op */ | 3609 | rc = hpsa_init_reset_devices(pdev); |
3593 | for (i = 0; i < HPSA_POST_RESET_NOOP_RETRIES; i++) { | 3610 | if (rc) |
3594 | if (hpsa_noop(pdev) == 0) | 3611 | return rc; |
3595 | break; | ||
3596 | else | ||
3597 | dev_warn(&pdev->dev, "no-op failed%s\n", | ||
3598 | (i < 11 ? "; re-trying" : "")); | ||
3599 | } | ||
3600 | } | ||
3601 | 3612 | ||
3602 | /* Command structures must be aligned on a 32-byte boundary because | 3613 | /* Command structures must be aligned on a 32-byte boundary because |
3603 | * the 5 lower bits of the address are used by the hardware. and by | 3614 | * the 5 lower bits of the address are used by the hardware. and by |