aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2011-05-03 15:54:02 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-05-06 10:23:57 -0400
commitec52d5f1cb9a1a0db02143fdcc6004749ea19e0b (patch)
tree9a6e24130f4dfcd4d97ade51cb060c72da48a9a1 /drivers/block/cciss.c
parent93c46c2fa7cfb272c3014327830d6cb30d8486a4 (diff)
cciss: do not attempt PCI power management reset method if we know it won't work.
Just go straight to the soft-reset method instead. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7990b98d4f73..865484e40841 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -558,7 +558,7 @@ static void __devinit cciss_procinit(ctlr_info_t *h)
558#define to_hba(n) container_of(n, struct ctlr_info, dev) 558#define to_hba(n) container_of(n, struct ctlr_info, dev)
559#define to_drv(n) container_of(n, drive_info_struct, dev) 559#define to_drv(n) container_of(n, drive_info_struct, dev)
560 560
561/* List of controllers which cannot be reset on kexec with reset_devices */ 561/* List of controllers which cannot be hard reset on kexec with reset_devices */
562static u32 unresettable_controller[] = { 562static u32 unresettable_controller[] = {
563 0x324a103C, /* Smart Array P712m */ 563 0x324a103C, /* Smart Array P712m */
564 0x324b103C, /* SmartArray P711m */ 564 0x324b103C, /* SmartArray P711m */
@@ -576,23 +576,45 @@ static u32 unresettable_controller[] = {
576 0x409D0E11, /* Smart Array 6400 EM */ 576 0x409D0E11, /* Smart Array 6400 EM */
577}; 577};
578 578
579static int ctlr_is_resettable(struct ctlr_info *h) 579/* List of controllers which cannot even be soft reset */
580static u32 soft_unresettable_controller[] = {
581 0x409C0E11, /* Smart Array 6400 */
582 0x409D0E11, /* Smart Array 6400 EM */
583};
584
585static int ctlr_is_hard_resettable(u32 board_id)
580{ 586{
581 int i; 587 int i;
582 588
583 for (i = 0; i < ARRAY_SIZE(unresettable_controller); i++) 589 for (i = 0; i < ARRAY_SIZE(unresettable_controller); i++)
584 if (unresettable_controller[i] == h->board_id) 590 if (unresettable_controller[i] == board_id)
585 return 0; 591 return 0;
586 return 1; 592 return 1;
587} 593}
588 594
595static int ctlr_is_soft_resettable(u32 board_id)
596{
597 int i;
598
599 for (i = 0; i < ARRAY_SIZE(soft_unresettable_controller); i++)
600 if (soft_unresettable_controller[i] == board_id)
601 return 0;
602 return 1;
603}
604
605static int ctlr_is_resettable(u32 board_id)
606{
607 return ctlr_is_hard_resettable(board_id) ||
608 ctlr_is_soft_resettable(board_id);
609}
610
589static ssize_t host_show_resettable(struct device *dev, 611static ssize_t host_show_resettable(struct device *dev,
590 struct device_attribute *attr, 612 struct device_attribute *attr,
591 char *buf) 613 char *buf)
592{ 614{
593 struct ctlr_info *h = to_hba(dev); 615 struct ctlr_info *h = to_hba(dev);
594 616
595 return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h)); 617 return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h->board_id));
596} 618}
597static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL); 619static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL);
598 620
@@ -4601,12 +4623,16 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
4601 * likely not be happy. Just forbid resetting this conjoined mess. 4623 * likely not be happy. Just forbid resetting this conjoined mess.
4602 */ 4624 */
4603 cciss_lookup_board_id(pdev, &board_id); 4625 cciss_lookup_board_id(pdev, &board_id);
4604 if (board_id == 0x409C0E11 || board_id == 0x409D0E11) { 4626 if (!ctlr_is_resettable(board_id)) {
4605 dev_warn(&pdev->dev, "Cannot reset Smart Array 640x " 4627 dev_warn(&pdev->dev, "Cannot reset Smart Array 640x "
4606 "due to shared cache module."); 4628 "due to shared cache module.");
4607 return -ENODEV; 4629 return -ENODEV;
4608 } 4630 }
4609 4631
4632 /* if controller is soft- but not hard resettable... */
4633 if (!ctlr_is_hard_resettable(board_id))
4634 return -ENOTSUPP; /* try soft reset later. */
4635
4610 /* Save the PCI command register */ 4636 /* Save the PCI command register */
4611 pci_read_config_word(pdev, 4, &command_register); 4637 pci_read_config_word(pdev, 4, &command_register);
4612 /* Turn the board off. This is so that later pci_restore_state() 4638 /* Turn the board off. This is so that later pci_restore_state()