@@ -559,8 +559,6 @@ static void sym53c8xx_timer(struct timer_list *t)
559
559
*/
560
560
#define SYM_EH_ABORT 0
561
561
#define SYM_EH_DEVICE_RESET 1
562
- #define SYM_EH_BUS_RESET 2
563
- #define SYM_EH_HOST_RESET 3
564
562
565
563
/*
566
564
* Generic method for our eh processing.
@@ -580,35 +578,11 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
580
578
581
579
scmd_printk (KERN_WARNING , cmd , "%s operation started\n" , opname );
582
580
583
- /* We may be in an error condition because the PCI bus
584
- * went down. In this case, we need to wait until the
585
- * PCI bus is reset, the card is reset, and only then
586
- * proceed with the scsi error recovery. There's no
587
- * point in hurrying; take a leisurely wait.
581
+ /*
582
+ * Escalate to host reset if the PCI bus went down
588
583
*/
589
- #define WAIT_FOR_PCI_RECOVERY 35
590
- if (pci_channel_offline (pdev )) {
591
- int finished_reset = 0 ;
592
- init_completion (& eh_done );
593
- spin_lock_irq (shost -> host_lock );
594
- /* Make sure we didn't race */
595
- if (pci_channel_offline (pdev )) {
596
- BUG_ON (sym_data -> io_reset );
597
- sym_data -> io_reset = & eh_done ;
598
- } else {
599
- finished_reset = 1 ;
600
- }
601
- spin_unlock_irq (shost -> host_lock );
602
- if (!finished_reset )
603
- finished_reset = wait_for_completion_timeout
604
- (sym_data -> io_reset ,
605
- WAIT_FOR_PCI_RECOVERY * HZ );
606
- spin_lock_irq (shost -> host_lock );
607
- sym_data -> io_reset = NULL ;
608
- spin_unlock_irq (shost -> host_lock );
609
- if (!finished_reset )
610
- return SCSI_FAILED ;
611
- }
584
+ if (pci_channel_offline (pdev ))
585
+ return SCSI_FAILED ;
612
586
613
587
spin_lock_irq (shost -> host_lock );
614
588
/* This one is queued in some place -> to wait for completion */
@@ -629,15 +603,6 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
629
603
case SYM_EH_DEVICE_RESET :
630
604
sts = sym_reset_scsi_target (np , cmd -> device -> id );
631
605
break ;
632
- case SYM_EH_BUS_RESET :
633
- sym_reset_scsi_bus (np , 1 );
634
- sts = 0 ;
635
- break ;
636
- case SYM_EH_HOST_RESET :
637
- sym_reset_scsi_bus (np , 0 );
638
- sym_start_up (shost , 1 );
639
- sts = 0 ;
640
- break ;
641
606
default :
642
607
break ;
643
608
}
@@ -679,12 +644,72 @@ static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd)
679
644
680
645
static int sym53c8xx_eh_bus_reset_handler (struct scsi_cmnd * cmd )
681
646
{
682
- return sym_eh_handler (SYM_EH_BUS_RESET , "BUS RESET" , cmd );
647
+ struct Scsi_Host * shost = cmd -> device -> host ;
648
+ struct sym_data * sym_data = shost_priv (shost );
649
+ struct pci_dev * pdev = sym_data -> pdev ;
650
+ struct sym_hcb * np = sym_data -> ncb ;
651
+
652
+ scmd_printk (KERN_WARNING , cmd , "BUS RESET operation started\n" );
653
+
654
+ /*
655
+ * Escalate to host reset if the PCI bus went down
656
+ */
657
+ if (pci_channel_offline (pdev ))
658
+ return SCSI_FAILED ;
659
+
660
+ spin_lock_irq (shost -> host_lock );
661
+ sym_reset_scsi_bus (np , 1 );
662
+ spin_unlock_irq (shost -> host_lock );
663
+
664
+ dev_warn (& cmd -> device -> sdev_gendev , "BUS RESET operation complete.\n" );
665
+ return SCSI_SUCCESS ;
683
666
}
684
667
685
668
static int sym53c8xx_eh_host_reset_handler (struct scsi_cmnd * cmd )
686
669
{
687
- return sym_eh_handler (SYM_EH_HOST_RESET , "HOST RESET" , cmd );
670
+ struct Scsi_Host * shost = cmd -> device -> host ;
671
+ struct sym_data * sym_data = shost_priv (shost );
672
+ struct pci_dev * pdev = sym_data -> pdev ;
673
+ struct sym_hcb * np = sym_data -> ncb ;
674
+ struct completion eh_done ;
675
+ int finished_reset = 1 ;
676
+
677
+ shost_printk (KERN_WARNING , shost , "HOST RESET operation started\n" );
678
+
679
+ /* We may be in an error condition because the PCI bus
680
+ * went down. In this case, we need to wait until the
681
+ * PCI bus is reset, the card is reset, and only then
682
+ * proceed with the scsi error recovery. There's no
683
+ * point in hurrying; take a leisurely wait.
684
+ */
685
+ #define WAIT_FOR_PCI_RECOVERY 35
686
+ if (pci_channel_offline (pdev )) {
687
+ init_completion (& eh_done );
688
+ spin_lock_irq (shost -> host_lock );
689
+ /* Make sure we didn't race */
690
+ if (pci_channel_offline (pdev )) {
691
+ BUG_ON (sym_data -> io_reset );
692
+ sym_data -> io_reset = & eh_done ;
693
+ finished_reset = 0 ;
694
+ }
695
+ spin_unlock_irq (shost -> host_lock );
696
+ if (!finished_reset )
697
+ finished_reset = wait_for_completion_timeout
698
+ (sym_data -> io_reset ,
699
+ WAIT_FOR_PCI_RECOVERY * HZ );
700
+ spin_lock_irq (shost -> host_lock );
701
+ sym_data -> io_reset = NULL ;
702
+ spin_unlock_irq (shost -> host_lock );
703
+ }
704
+
705
+ if (finished_reset ) {
706
+ sym_reset_scsi_bus (np , 0 );
707
+ sym_start_up (shost , 1 );
708
+ }
709
+
710
+ shost_printk (KERN_WARNING , shost , "HOST RESET operation %s.\n" ,
711
+ finished_reset == 1 ? "complete" : "failed" );
712
+ return finished_reset ? SCSI_SUCCESS : SCSI_FAILED ;
688
713
}
689
714
690
715
/*
0 commit comments