aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic94xx/aic94xx_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic94xx/aic94xx_init.c')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index fbc82b00a418..bc7744e35ad0 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -38,7 +38,7 @@
38#include "aic94xx_seq.h" 38#include "aic94xx_seq.h"
39 39
40/* The format is "version.release.patchlevel" */ 40/* The format is "version.release.patchlevel" */
41#define ASD_DRIVER_VERSION "1.0.2" 41#define ASD_DRIVER_VERSION "1.0.3"
42 42
43static int use_msi = 0; 43static int use_msi = 0;
44module_param_named(use_msi, use_msi, int, S_IRUGO); 44module_param_named(use_msi, use_msi, int, S_IRUGO);
@@ -57,6 +57,8 @@ MODULE_PARM_DESC(collector, "\n"
57char sas_addr_str[2*SAS_ADDR_SIZE + 1] = ""; 57char sas_addr_str[2*SAS_ADDR_SIZE + 1] = "";
58 58
59static struct scsi_transport_template *aic94xx_transport_template; 59static struct scsi_transport_template *aic94xx_transport_template;
60static int asd_scan_finished(struct Scsi_Host *, unsigned long);
61static void asd_scan_start(struct Scsi_Host *);
60 62
61static struct scsi_host_template aic94xx_sht = { 63static 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,
@@ -75,6 +79,8 @@ static struct scsi_host_template aic94xx_sht = {
75 .sg_tablesize = SG_ALL, 79 .sg_tablesize = SG_ALL,
76 .max_sectors = SCSI_DEFAULT_MAX_SECTORS, 80 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
77 .use_clustering = ENABLE_CLUSTERING, 81 .use_clustering = ENABLE_CLUSTERING,
82 .eh_device_reset_handler = sas_eh_device_reset_handler,
83 .eh_bus_reset_handler = sas_eh_bus_reset_handler,
78}; 84};
79 85
80static int __devinit asd_map_memio(struct asd_ha_struct *asd_ha) 86static int __devinit asd_map_memio(struct asd_ha_struct *asd_ha)
@@ -234,7 +240,7 @@ static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha)
234 } 240 }
235 /* Provide some sane default values. */ 241 /* Provide some sane default values. */
236 asd_ha->hw_prof.max_scbs = 512; 242 asd_ha->hw_prof.max_scbs = 512;
237 asd_ha->hw_prof.max_ddbs = 128; 243 asd_ha->hw_prof.max_ddbs = ASD_MAX_DDBS;
238 asd_ha->hw_prof.num_phys = ASD_MAX_PHYS; 244 asd_ha->hw_prof.num_phys = ASD_MAX_PHYS;
239 /* All phys are enabled, by default. */ 245 /* All phys are enabled, by default. */
240 asd_ha->hw_prof.enabled_phys = 0xFF; 246 asd_ha->hw_prof.enabled_phys = 0xFF;
@@ -526,6 +532,7 @@ static int asd_register_sas_ha(struct asd_ha_struct *asd_ha)
526 asd_ha->sas_ha.num_phys= ASD_MAX_PHYS; 532 asd_ha->sas_ha.num_phys= ASD_MAX_PHYS;
527 533
528 asd_ha->sas_ha.lldd_queue_size = asd_ha->seq.can_queue; 534 asd_ha->sas_ha.lldd_queue_size = asd_ha->seq.can_queue;
535 asd_ha->sas_ha.lldd_max_execute_num = lldd_max_execute_num;
529 536
530 return sas_register_ha(&asd_ha->sas_ha); 537 return sas_register_ha(&asd_ha->sas_ha);
531} 538}
@@ -671,21 +678,10 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
671 if (err) 678 if (err)
672 goto Err_reg_sas; 679 goto Err_reg_sas;
673 680
674 err = asd_enable_phys(asd_ha, asd_ha->hw_prof.enabled_phys); 681 scsi_scan_host(shost);
675 if (err) {
676 asd_printk("coudln't enable phys, err:%d\n", err);
677 goto Err_en_phys;
678 }
679 ASD_DPRINTK("enabled phys\n");
680 /* give the phy enabling interrupt event time to come in (1s
681 * is empirically about all it takes) */
682 ssleep(1);
683 /* Wait for discovery to finish */
684 scsi_flush_work(asd_ha->sas_ha.core.shost);
685 682
686 return 0; 683 return 0;
687Err_en_phys: 684
688 asd_unregister_sas_ha(asd_ha);
689Err_reg_sas: 685Err_reg_sas:
690 asd_remove_dev_attrs(asd_ha); 686 asd_remove_dev_attrs(asd_ha);
691Err_dev_attrs: 687Err_dev_attrs:
@@ -778,6 +774,28 @@ static void __devexit asd_pci_remove(struct pci_dev *dev)
778 return; 774 return;
779} 775}
780 776
777static void asd_scan_start(struct Scsi_Host *shost)
778{
779 struct asd_ha_struct *asd_ha;
780 int err;
781
782 asd_ha = SHOST_TO_SAS_HA(shost)->lldd_ha;
783 err = asd_enable_phys(asd_ha, asd_ha->hw_prof.enabled_phys);
784 if (err)
785 asd_printk("Couldn't enable phys, err:%d\n", err);
786}
787
788static int asd_scan_finished(struct Scsi_Host *shost, unsigned long time)
789{
790 /* give the phy enabling interrupt event time to come in (1s
791 * is empirically about all it takes) */
792 if (time < HZ)
793 return 0;
794 /* Wait for discovery to finish */
795 scsi_flush_work(shost);
796 return 1;
797}
798
781static ssize_t asd_version_show(struct device_driver *driver, char *buf) 799static ssize_t asd_version_show(struct device_driver *driver, char *buf)
782{ 800{
783 return snprintf(buf, PAGE_SIZE, "%s\n", ASD_DRIVER_VERSION); 801 return snprintf(buf, PAGE_SIZE, "%s\n", ASD_DRIVER_VERSION);
@@ -885,6 +903,7 @@ static void __exit aic94xx_exit(void)
885 asd_remove_driver_attrs(&aic94xx_pci_driver.driver); 903 asd_remove_driver_attrs(&aic94xx_pci_driver.driver);
886 pci_unregister_driver(&aic94xx_pci_driver); 904 pci_unregister_driver(&aic94xx_pci_driver);
887 sas_release_transport(aic94xx_transport_template); 905 sas_release_transport(aic94xx_transport_template);
906 asd_release_firmware();
888 asd_destroy_global_caches(); 907 asd_destroy_global_caches();
889 asd_printk("%s version %s unloaded\n", ASD_DRIVER_DESCRIPTION, 908 asd_printk("%s version %s unloaded\n", ASD_DRIVER_DESCRIPTION,
890 ASD_DRIVER_VERSION); 909 ASD_DRIVER_VERSION);