]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/scsi/aic7xxx/aic7xxx_osm.c
[SCSI] aic7xxx: sane pci probing
[mv-sheeva.git] / drivers / scsi / aic7xxx / aic7xxx_osm.c
index 89f073a3b76626fe667dbfac6ced905c3d0259db..f94a67be0be4e58fefcf701d514d1b4ae2abb3e1 100644 (file)
@@ -337,13 +337,6 @@ static uint32_t aic7xxx_pci_parity = ~0;
  */
 uint32_t aic7xxx_allow_memio = ~0;
 
-/*
- * aic7xxx_detect() has been run, so register all device arrivals
- * immediately with the system rather than deferring to the sorted
- * attachment performed by aic7xxx_detect().
- */
-int aic7xxx_detect_complete;
-
 /*
  * So that we can set how long each device is given as a selection timeout.
  * The table of values goes like this:
@@ -475,48 +468,6 @@ ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb,
        return (consumed);
 }
 
-/*
- * Try to detect an Adaptec 7XXX controller.
- */
-static int
-ahc_linux_detect(struct scsi_host_template *template)
-{
-       struct  ahc_softc *ahc;
-       int     found = 0;
-
-       /*
-        * If we've been passed any parameters, process them now.
-        */
-       if (aic7xxx)
-               aic7xxx_setup(aic7xxx);
-
-       template->proc_name = "aic7xxx";
-
-       /*
-        * Initialize our softc list lock prior to
-        * probing for any adapters.
-        */
-       ahc_list_lockinit();
-
-       found = ahc_linux_pci_init();
-       if (!ahc_linux_eisa_init())
-               found++;
-       
-       /*
-        * Register with the SCSI layer all
-        * controllers we've found.
-        */
-       TAILQ_FOREACH(ahc, &ahc_tailq, links) {
-
-               if (ahc_linux_register_host(ahc, template) == 0)
-                       found++;
-       }
-
-       aic7xxx_detect_complete++;
-
-       return (found);
-}
-
 /*
  * Return a string describing the driver.
  */
@@ -829,10 +780,14 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd)
 {
        struct ahc_softc *ahc;
        int    found;
+       unsigned long flags;
 
        ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
+
+       ahc_lock(ahc, &flags);
        found = ahc_reset_channel(ahc, cmd->device->channel + 'A',
                                  /*initiate reset*/TRUE);
+       ahc_unlock(ahc, &flags);
 
        if (bootverbose)
                printf("%s: SCSI bus reset delivered. "
@@ -844,6 +799,7 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd)
 struct scsi_host_template aic7xxx_driver_template = {
        .module                 = THIS_MODULE,
        .name                   = "aic7xxx",
+       .proc_name              = "aic7xxx",
        .proc_info              = ahc_linux_proc_info,
        .info                   = ahc_linux_info,
        .queuecommand           = ahc_linux_queue,
@@ -2629,6 +2585,11 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt)
        ahc_unlock(ahc, &flags);
 }
 
+#if 0
+/* FIXME: This code claims to support IU and QAS.  However, the actual
+ * sequencer code and aic7xxx_core have no support for these parameters and
+ * will get into a bad state if they're negotiated.  Do not enable this
+ * unless you know what you're doing */
 static void ahc_linux_set_qas(struct scsi_target *starget, int qas)
 {
        struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -2684,6 +2645,7 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu)
                         ppr_options, AHC_TRANS_GOAL, FALSE);
        ahc_unlock(ahc, &flags);
 }
+#endif
 
 static struct spi_function_template ahc_linux_transport_functions = {
        .set_offset     = ahc_linux_set_offset,
@@ -2694,10 +2656,12 @@ static struct spi_function_template ahc_linux_transport_functions = {
        .show_width     = 1,
        .set_dt         = ahc_linux_set_dt,
        .show_dt        = 1,
+#if 0
        .set_iu         = ahc_linux_set_iu,
        .show_iu        = 1,
        .set_qas        = ahc_linux_set_qas,
        .show_qas       = 1,
+#endif
 };
 
 
@@ -2705,18 +2669,31 @@ static struct spi_function_template ahc_linux_transport_functions = {
 static int __init
 ahc_linux_init(void)
 {
-       ahc_linux_transport_template = spi_attach_transport(&ahc_linux_transport_functions);
+       /*
+        * If we've been passed any parameters, process them now.
+        */
+       if (aic7xxx)
+               aic7xxx_setup(aic7xxx);
+
+       ahc_linux_transport_template =
+               spi_attach_transport(&ahc_linux_transport_functions);
        if (!ahc_linux_transport_template)
                return -ENODEV;
+
        scsi_transport_reserve_target(ahc_linux_transport_template,
                                      sizeof(struct ahc_linux_target));
        scsi_transport_reserve_device(ahc_linux_transport_template,
                                      sizeof(struct ahc_linux_device));
-       if (ahc_linux_detect(&aic7xxx_driver_template))
-               return 0;
-       spi_release_transport(ahc_linux_transport_template);
-       ahc_linux_exit();
-       return -ENODEV;
+
+       /*
+        * Initialize our softc list lock prior to
+        * probing for any adapters.
+        */
+       ahc_list_lockinit();
+
+       ahc_linux_pci_init();
+       ahc_linux_eisa_init();
+       return 0;
 }
 
 static void