diff options
author | Darrick J. Wong <djwong@us.ibm.com> | 2007-01-11 17:15:38 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-13 17:20:23 -0500 |
commit | e7571c152dea576f8c80ca240befc93d4f16551d (patch) | |
tree | d3d7010b1daf107f93fa8dc23ff8783cab91a544 /drivers/scsi/aic94xx/aic94xx_init.c | |
parent | fe3b5bfe73ace420709f0cfb198b0ffc704bd38b (diff) |
[SCSI] aic94xx: Scan SAS devices asynchronously
Add the necessary hooks to the aic94xx driver to support the asynchronous SCSI
device scan infrastructure.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic94xx/aic94xx_init.c')
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_init.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 7344f4d59a7d..a6fb33f1412d 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
@@ -57,6 +57,8 @@ MODULE_PARM_DESC(collector, "\n" | |||
57 | char sas_addr_str[2*SAS_ADDR_SIZE + 1] = ""; | 57 | char sas_addr_str[2*SAS_ADDR_SIZE + 1] = ""; |
58 | 58 | ||
59 | static struct scsi_transport_template *aic94xx_transport_template; | 59 | static struct scsi_transport_template *aic94xx_transport_template; |
60 | static int asd_scan_finished(struct Scsi_Host *, unsigned long); | ||
61 | static void asd_scan_start(struct Scsi_Host *); | ||
60 | 62 | ||
61 | static struct scsi_host_template aic94xx_sht = { | 63 | static struct scsi_host_template aic94xx_sht = { |
62 | .module = THIS_MODULE, | 64 | .module = THIS_MODULE, |
@@ -66,6 +68,8 @@ static struct scsi_host_template aic94xx_sht = { | |||
66 | .target_alloc = sas_target_alloc, | 68 | .target_alloc = sas_target_alloc, |
67 | .slave_configure = sas_slave_configure, | 69 | .slave_configure = sas_slave_configure, |
68 | .slave_destroy = sas_slave_destroy, | 70 | .slave_destroy = sas_slave_destroy, |
71 | .scan_finished = asd_scan_finished, | ||
72 | .scan_start = asd_scan_start, | ||
69 | .change_queue_depth = sas_change_queue_depth, | 73 | .change_queue_depth = sas_change_queue_depth, |
70 | .change_queue_type = sas_change_queue_type, | 74 | .change_queue_type = sas_change_queue_type, |
71 | .bios_param = sas_bios_param, | 75 | .bios_param = sas_bios_param, |
@@ -672,21 +676,10 @@ static int __devinit asd_pci_probe(struct pci_dev *dev, | |||
672 | if (err) | 676 | if (err) |
673 | goto Err_reg_sas; | 677 | goto Err_reg_sas; |
674 | 678 | ||
675 | err = asd_enable_phys(asd_ha, asd_ha->hw_prof.enabled_phys); | 679 | scsi_scan_host(shost); |
676 | if (err) { | ||
677 | asd_printk("coudln't enable phys, err:%d\n", err); | ||
678 | goto Err_en_phys; | ||
679 | } | ||
680 | ASD_DPRINTK("enabled phys\n"); | ||
681 | /* give the phy enabling interrupt event time to come in (1s | ||
682 | * is empirically about all it takes) */ | ||
683 | ssleep(1); | ||
684 | /* Wait for discovery to finish */ | ||
685 | scsi_flush_work(asd_ha->sas_ha.core.shost); | ||
686 | 680 | ||
687 | return 0; | 681 | return 0; |
688 | Err_en_phys: | 682 | |
689 | asd_unregister_sas_ha(asd_ha); | ||
690 | Err_reg_sas: | 683 | Err_reg_sas: |
691 | asd_remove_dev_attrs(asd_ha); | 684 | asd_remove_dev_attrs(asd_ha); |
692 | Err_dev_attrs: | 685 | Err_dev_attrs: |
@@ -779,6 +772,28 @@ static void __devexit asd_pci_remove(struct pci_dev *dev) | |||
779 | return; | 772 | return; |
780 | } | 773 | } |
781 | 774 | ||
775 | static void asd_scan_start(struct Scsi_Host *shost) | ||
776 | { | ||
777 | struct asd_ha_struct *asd_ha; | ||
778 | int err; | ||
779 | |||
780 | asd_ha = SHOST_TO_SAS_HA(shost)->lldd_ha; | ||
781 | err = asd_enable_phys(asd_ha, asd_ha->hw_prof.enabled_phys); | ||
782 | if (err) | ||
783 | asd_printk("Couldn't enable phys, err:%d\n", err); | ||
784 | } | ||
785 | |||
786 | static int asd_scan_finished(struct Scsi_Host *shost, unsigned long time) | ||
787 | { | ||
788 | /* give the phy enabling interrupt event time to come in (1s | ||
789 | * is empirically about all it takes) */ | ||
790 | if (time < HZ) | ||
791 | return 0; | ||
792 | /* Wait for discovery to finish */ | ||
793 | scsi_flush_work(shost); | ||
794 | return 1; | ||
795 | } | ||
796 | |||
782 | static ssize_t asd_version_show(struct device_driver *driver, char *buf) | 797 | static ssize_t asd_version_show(struct device_driver *driver, char *buf) |
783 | { | 798 | { |
784 | return snprintf(buf, PAGE_SIZE, "%s\n", ASD_DRIVER_VERSION); | 799 | return snprintf(buf, PAGE_SIZE, "%s\n", ASD_DRIVER_VERSION); |