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

Next file: linux/drivers/scsi/dc390.h
Previous file: linux/drivers/scsi/README.tmscsim
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.126/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c
@@ -349,7 +349,7 @@
     0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 
-#define AIC7XXX_C_VERSION  "5.1.2"
+#define AIC7XXX_C_VERSION  "5.1.3"
 
 #define NUMBER(arr)     (sizeof(arr) / sizeof(arr[0]))
 #define MIN(a,b)        (((a) < (b)) ? (a) : (b))
@@ -3429,10 +3429,7 @@
    * here so that we can delay all re-sent commands for this device for the
    * 4 seconds and then have our timer routine pick them back up.
    */
-        if(p->dev_timer[i].expires)
-        {
-          del_timer(&p->dev_timer[i]);
-        }
+        del_timer(&p->dev_timer[i]);
         p->dev_timer[i].expires = jiffies + (4 * HZ);
         add_timer(&p->dev_timer[i]);
       }
@@ -3481,12 +3478,8 @@
             "delayed_scbs queue!\n", p->host_no, channel, i, lun);
         scbq_init(&p->delayed_scbs[i]);
       }
-      if ( (p->delayed_scbs[i].head == NULL) &&
-           (p->dev_timer[i].expires) )
-      {
+      if ( p->delayed_scbs[i].head == NULL )
         del_timer(&p->dev_timer[i]);
-        p->dev_timer[i].expires = 0;
-      }
     }
   }
 
@@ -4007,7 +4000,7 @@
     }
     if ( (p->dev_active_cmds[tindex] >=
           p->dev_temp_queue_depth[tindex]) ||
-         (p->dev_last_reset[tindex] >= (jiffies - (4 * HZ))) )
+         time_after_eq(p->dev_last_reset[tindex], jiffies - 4 * HZ) )
     {
 #ifdef AIC7XXX_VERBOSE_DEBUGGING
       if (aic7xxx_verbose > 0xffff)
@@ -4015,7 +4008,7 @@
                p->host_no, CTL_OF_SCB(scb));
 #endif
       scbq_insert_tail(&p->delayed_scbs[tindex], scb);
-      if ( !(p->dev_timer[tindex].expires) &&
+      if ( !timer_pending(&p->dev_timer[tindex]) &&
            !(p->dev_active_cmds[tindex]) )
       {
         p->dev_timer[tindex].expires = p->dev_last_reset[tindex] + (4 * HZ);
@@ -4154,15 +4147,8 @@
 #endif
   for(i=0; i<MAX_TARGETS; i++)
   {
-    if ( (p->dev_timer[i].expires) && 
-          (p->dev_timer[i].expires <= jiffies) )
+    if ( del_timer(&p->dev_timer[i]) )
     {
-      p->dev_timer[i].expires = 0;
-      if ( (p->dev_timer[i].prev != NULL) ||
-           (p->dev_timer[i].next != NULL) )
-      {
-        del_timer(&p->dev_timer[i]);
-      }
       p->dev_temp_queue_depth[i] =  p->dev_max_queue_depth[i];
       j = 0;
       while ( ((scb = scbq_remove_head(&p->delayed_scbs[i])) != NULL) &&
@@ -4895,7 +4881,7 @@
               p->activescbs--;
               scb->flags |= SCB_WAITINGQ | SCB_WAS_BUSY;
                   
-              if (p->dev_timer[tindex].expires == 0) 
+              if ( !timer_pending(&p->dev_timer[tindex]) ) 
               {
                 if ( p->dev_active_cmds[tindex] )
                 {
@@ -7462,7 +7448,7 @@
   }
 
   p->host = host;
-  p->last_reset = 0;
+  p->last_reset = jiffies;
   p->host_no = host->host_no;
   host->unique_id = p->instance;
   p->isr_count = 0;
@@ -7489,7 +7475,7 @@
     p->dev_commands_sent[i] = 0;
     p->dev_flags[i] = 0;
     p->dev_active_cmds[i] = 0;
-    p->dev_last_reset[i] = 0;
+    p->dev_last_reset[i] = jiffies;
     p->dev_last_queue_full[i] = 0;
     p->dev_last_queue_full_count[i] = 0;
     p->dev_max_queue_depth[i] = 1;
@@ -7497,7 +7483,6 @@
     p->dev_mid_level_queue_depth[i] = 3;
     scbq_init(&p->delayed_scbs[i]);
     init_timer(&p->dev_timer[i]);
-    p->dev_timer[i].expires = 0;
     p->dev_timer[i].data = (unsigned long)p;
     p->dev_timer[i].function = (void *)aic7xxx_timer;
   }
@@ -9184,6 +9169,27 @@
               aic_outb(temp_p, (aic_inb(temp_p, DSCOMMAND0) |
                                 CACHETHEN | MPARCKEN) & ~DPARCKEN,
                        DSCOMMAND0);
+              aic7xxx_load_seeprom(temp_p, &sxfrctl1);
+              break;
+            case AHC_AIC7880:
+              /*
+               * Only set the DSCOMMAND0 register if this is a Rev B.
+               * chipset.  For those, we also enable Ultra mode by
+               * force due to brain-damage on the part of some BIOSes
+               * We overload the devconfig variable here since we can.
+               */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92)
+              pci_read_config_dword(pdev, DEVCONFIG, &devconfig);
+#else
+              pcibios_read_config_dword(pci_bus, pci_devfn, DEVCONFIG,
+                                        &devconfig);
+#endif
+              if ((devconfig & 0xff) >= 1)
+              {
+                aic_outb(temp_p, (aic_inb(temp_p, DSCOMMAND0) |
+                                  CACHETHEN | MPARCKEN) & ~DPARCKEN,
+                         DSCOMMAND0);
+              }
               aic7xxx_load_seeprom(temp_p, &sxfrctl1);
               break;
           }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov