patch-2.3.29 linux/drivers/scsi/aic7xxx.c

Next file: linux/drivers/scsi/aic7xxx_proc.c
Previous file: linux/drivers/scsi/aic7xxx/aic7xxx.seq
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c
@@ -263,7 +263,7 @@
  */
 #define VIRT_TO_BUS(a) (unsigned int)virt_to_bus((void *)(a))
 
-#define AIC7XXX_C_VERSION  "5.1.20"
+#define AIC7XXX_C_VERSION  "5.1.21"
 
 #define NUMBER(arr)     (sizeof(arr) / sizeof(arr[0]))
 #define MIN(a,b)        (((a) < (b)) ? (a) : (b))
@@ -280,10 +280,6 @@
 #  define FALSE 0
 #endif
 
-#ifndef KERNEL_VERSION
-#  define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
-#endif
-
 /*
  * We need the bios32.h file if we are kernel version 2.1.92 or less.  The
  * full set of pci_* changes wasn't in place until 2.1.93
@@ -1355,6 +1351,18 @@
  */
 static int aic7xxx_scbram = 0;
 /*
+ * So that we can set how long each device is given as a selection timeout.
+ * The table of values goes like this:
+ * 	0 - 256ms
+ * 	1 - 128ms
+ * 	2 - 64ms
+ * 	3 - 32ms
+ * We default to 64ms because it's fast.  Some old SCSI-I devices need a
+ * longer time.  The final value has to be left shifted by 3, hence 0x10
+ * is the final value.
+ */
+static int aic7xxx_seltime = 0x10;
+/*
  * So that insmod can find the variable and make it point to something
  */
 #ifdef MODULE
@@ -1515,6 +1523,7 @@
     { "dump_card", &aic7xxx_dump_card },
     { "dump_sequencer", &aic7xxx_dump_sequencer },
     { "scbram", &aic7xxx_scbram },
+    { "seltime", &aic7xxx_seltime },
     { "tag_info",    NULL }
   };
 
@@ -1608,6 +1617,10 @@
         else if (p[n] == ':')
         {
           *(options[i].flag) = simple_strtoul(p + n + 1, NULL, 0);
+          if(!strncmp(p, "seltime", n))
+          {
+            *(options[i].flag) = (*(options[i].flag) % 4) << 3;
+          }
         }
         else if (!strncmp(p, "verbose", n))
         {
@@ -1616,6 +1629,10 @@
         else
         {
           *(options[i].flag) = ~(*(options[i].flag));
+          if(!strncmp(p, "seltime", n))
+          {
+            *(options[i].flag) = (*(options[i].flag) % 4) << 3;
+          }
         }
       }
     }
@@ -1850,10 +1867,13 @@
         }
       }
       aic_outb(p, (instr.integer & 0xff), SEQRAM);
+      udelay(50);
       aic_outb(p, ((instr.integer >> 8) & 0xff), SEQRAM);
+      udelay(50);
       aic_outb(p, ((instr.integer >> 16) & 0xff), SEQRAM);
+      udelay(50);
       aic_outb(p, ((instr.integer >> 24) & 0xff), SEQRAM);
-      udelay(15);
+      udelay(50);
       break;
 
     default:
@@ -7895,7 +7915,7 @@
   host->this_id = p->scsi_id;
   host->io_port = p->base;
   host->n_io_port = 0xFF;
-  host->base = (unsigned char *) p->mbase;
+  host->base = p->mbase;
   host->irq = p->irq;
   if (p->features & AHC_WIDE)
   {
@@ -8019,7 +8039,7 @@
     {
       unsigned char devconfig;
 
-#if LINUX_KERNEL_VERSION > KERNEL_VERSION(2,1,92)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92)
       pci_read_config_byte(p->pdev, DEVCONFIG, &devconfig);
 #else
       pcibios_read_config_byte(p->pci_bus, p->pci_device_fn,
@@ -8037,7 +8057,7 @@
         if (aic7xxx_verbose & VERBOSE_PROBE2)
           printk("(scsi%d) Force clearing STPWLEV bit\n", p->host_no);
       }
-#if LINUX_KERNEL_VERSION > KERNEL_VERSION(2,1,92)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92)
       pci_write_config_byte(p->pdev, DEVCONFIG, devconfig);
 #else
       pcibios_write_config_byte(p->pci_bus, p->pci_device_fn,
@@ -8117,7 +8137,7 @@
     aic_outb(p, p->scsi_id_b, SCSIID);
     scsi_conf = aic_inb(p, SCSICONF + 1);
     aic_outb(p, DFON | SPIOEN, SXFRCTL0);
-    aic_outb(p, (scsi_conf & ENSPCHK) | STIMESEL | term | 
+    aic_outb(p, (scsi_conf & ENSPCHK) | aic7xxx_seltime | term | 
          ENSTIMER | ACTNEGEN, SXFRCTL1);
     aic_outb(p, 0, SIMODE0);
     aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1);
@@ -8141,7 +8161,7 @@
     term = ((p->flags & (AHC_TERM_ENB_A|AHC_TERM_ENB_LVD)) ? STPWEN : 0);
   scsi_conf = aic_inb(p, SCSICONF);
   aic_outb(p, DFON | SPIOEN, SXFRCTL0);
-  aic_outb(p, (scsi_conf & ENSPCHK) | STIMESEL | term | 
+  aic_outb(p, (scsi_conf & ENSPCHK) | aic7xxx_seltime | term | 
        ENSTIMER | ACTNEGEN, SXFRCTL1);
   aic_outb(p, 0, SIMODE0);
   aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1);
@@ -9656,7 +9676,7 @@
           devconfig |= 0x80000040;
           pcibios_write_config_dword(pci_bus, pci_devfn, DEVCONFIG, devconfig);
 #endif /* AIC7XXX_STRICT_PCI_SETUP */
-#endif /* LINUIX_VERSION_CODE > KERNEL_VERSION(2,1,92) */
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) */
 
           temp_p->unpause = INTEN;
           temp_p->pause = temp_p->unpause | PAUSE;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)