Skip to content

Commit ec52d5f

Browse files
Stephen M. CameronJens Axboe
authored andcommitted
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>
1 parent 93c46c2 commit ec52d5f

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

‎drivers/block/cciss.c‎

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static void __devinit cciss_procinit(ctlr_info_t *h)
558558
#define to_hba(n) container_of(n, struct ctlr_info, dev)
559559
#define to_drv(n) container_of(n, drive_info_struct, dev)
560560

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 */
562562
static u32 unresettable_controller[] = {
563563
0x324a103C, /* Smart Array P712m */
564564
0x324b103C, /* SmartArray P711m */
@@ -576,23 +576,45 @@ static u32 unresettable_controller[] = {
576576
0x409D0E11, /* Smart Array 6400 EM */
577577
};
578578

579-
static int ctlr_is_resettable(struct ctlr_info *h)
579+
/* List of controllers which cannot even be soft reset */
580+
static u32 soft_unresettable_controller[] = {
581+
0x409C0E11, /* Smart Array 6400 */
582+
0x409D0E11, /* Smart Array 6400 EM */
583+
};
584+
585+
static int ctlr_is_hard_resettable(u32 board_id)
580586
{
581587
int i;
582588

583589
for (i = 0; i < ARRAY_SIZE(unresettable_controller); i++)
584-
if (unresettable_controller[i] == h->board_id)
590+
if (unresettable_controller[i] == board_id)
585591
return 0;
586592
return 1;
587593
}
588594

595+
static 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+
605+
static 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+
589611
static ssize_t host_show_resettable(struct device *dev,
590612
struct device_attribute *attr,
591613
char *buf)
592614
{
593615
struct ctlr_info *h = to_hba(dev);
594616

595-
return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h));
617+
return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h->board_id));
596618
}
597619
static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL);
598620

@@ -4601,12 +4623,16 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
46014623
* likely not be happy. Just forbid resetting this conjoined mess.
46024624
*/
46034625
cciss_lookup_board_id(pdev, &board_id);
4604-
if (board_id == 0x409C0E11 || board_id == 0x409D0E11) {
4626+
if (!ctlr_is_resettable(board_id)) {
46054627
dev_warn(&pdev->dev, "Cannot reset Smart Array 640x "
46064628
"due to shared cache module.");
46074629
return -ENODEV;
46084630
}
46094631

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+
46104636
/* Save the PCI command register */
46114637
pci_read_config_word(pdev, 4, &command_register);
46124638
/* Turn the board off. This is so that later pci_restore_state()

0 commit comments

Comments
 (0)