patch-2.0.36 linux/drivers/scsi/gdth_proc.c

Next file: linux/drivers/scsi/gdth_proc.h
Previous file: linux/drivers/scsi/gdth.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.35/linux/drivers/scsi/gdth_proc.c linux/drivers/scsi/gdth_proc.c
@@ -1,5 +1,5 @@
 /* gdth_proc.c 
- * $Id: gdth_proc.c,v 1.4 1997/02/25 13:33:47 achim Exp $
+ * $Id: gdth_proc.c,v 1.10 1998/06/03 14:53:49 achim Exp $
  */
 
 #include "gdth_ioctl.h"
@@ -10,7 +10,7 @@
     int hanum,busnum,i;
 
     TRACE2(("gdth_proc_info() length %d ha %d offs %d inout %d\n",
-            length,hostno,offset,inout));
+            length,hostno,(int)offset,inout));
 
     for (i=0; i<gdth_ctr_vcount; ++i) {
         if (gdth_ctr_vtab[i]->host_no == hostno)
@@ -113,6 +113,7 @@
                         struct semaphore sem = MUTEX_LOCKED;
                         scp.request.rq_status = RQ_SCSI_BUSY;
                         scp.request.sem = &sem;
+                        scp.SCp.this_residual = IOCTL_PRI;
                         scsi_do_cmd(&scp, cmnd, &gdtcmd,
                                     sizeof(gdth_cmd_str), gdth_scsi_done,
                                     30*HZ, 1);
@@ -170,7 +171,7 @@
         gdtcmd.BoardNode = LOCALBOARD;
         gdtcmd.Service = CACHESERVICE;
         gdtcmd.OpCode = GDT_IOCTL;
-        gdtcmd.u.ioctl.p_param = (ulong)pcpar;
+        gdtcmd.u.ioctl.p_param = virt_to_bus(pcpar);
         gdtcmd.u.ioctl.param_size = sizeof(gdth_cpar_str);
         gdtcmd.u.ioctl.subfunc = CACHE_CONFIG;
         gdtcmd.u.ioctl.channel = INVALID_CHANNEL;
@@ -179,6 +180,7 @@
             struct semaphore sem = MUTEX_LOCKED;
             scp.request.rq_status = RQ_SCSI_BUSY;
             scp.request.sem = &sem;
+            scp.SCp.this_residual = IOCTL_PRI;
             scsi_do_cmd(&scp, cmnd, &gdtcmd, sizeof(gdth_cmd_str),
                         gdth_scsi_done, 30*HZ, 1);
             down(&sem);
@@ -257,7 +259,7 @@
         piord->size = sizeof(gdth_iord_str) + add_size;
         if (add_size > 0) {
             memcpy(piord->iu.general.data, piowr->iu.general.data, add_size);
-            *ppadd = (ulong)piord->iu.general.data;
+            *ppadd = virt_to_bus(piord->iu.general.data);
         }
         /* do IOCTL */
         {
@@ -291,7 +293,7 @@
         piord->size = sizeof(gdth_iord_str);
         piord->status = S_OK;
         if (ha->type == GDT_ISA || ha->type == GDT_EISA) {
-            piord->iu.ctrtype.type = (unchar)((ha->stype>>20) - 10);
+            piord->iu.ctrtype.type = (unchar)((ha->stype>>20) - 0x10);
         } else if (ha->type != GDT_PCIMPR) {
             piord->iu.ctrtype.type = (unchar)((ha->stype<<8) + 6);
         } else {
@@ -433,14 +435,14 @@
 
     /* look for buffer ID in length */
     if (id > 4) {
-#if LINUX_VERSION_CODE >= 0x010400
+#if LINUX_VERSION_CODE >= 0x020000
         size = sprintf(buffer+len,
                        "%s SCSI Disk Array Controller\n",
-                       gdth_ctr_name(hanum));
+                       ha->ctr_name);
 #else
         size = sprintf(buffer+len,
                        "%s SCSI Disk Array Controller (SCSI Bus %d)\n",
-                       gdth_ctr_name(hanum),busnum);
+                       ha->ctr_name,busnum);
 #endif
         len += size;  pos = begin + len;
         size = sprintf(buffer+len,
@@ -479,7 +481,7 @@
     if (len > length)
         len = length;
     TRACE2(("get_info() len %d pos %d begin %d offset %d length %d size %d\n",
-            len,pos,begin,offset,length,size));
+            len,(int)pos,(int)begin,(int)offset,length,size));
     return(len);
 }
 
@@ -542,16 +544,19 @@
 
     for (i = 0; i < GDTH_MAXCMDS; ++i) {
         scp = gdth_cmd_tab[i][hanum].cmnd;
+#if LINUX_VERSION_CODE >= 0x020000
         if (!SPECIAL_SCP(scp) && scp->target == (unchar)id &&
-#if LINUX_VERSION_CODE >= 0x010400
             scp->channel == (unchar)busnum)
 #else
+        if (!SPECIAL_SCP(scp) && scp->target == (unchar)id &&
             NUMDATA(scp->host)->busnum == (unchar)busnum)
 #endif
         {
+	    scp->SCp.have_data_in = 0;
             restore_flags(flags);
             while (!scp->SCp.have_data_in)
                 barrier();
+	    scp->scsi_done(scp);
             save_flags(flags);
             cli();
         }
@@ -570,15 +575,16 @@
     ha = HADATA(gdth_ctr_tab[hanum]);
 
     for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
+#if LINUX_VERSION_CODE >= 0x020000
         if (scp->target == (unchar)id &&
-#if LINUX_VERSION_CODE >= 0x010400
             scp->channel == (unchar)busnum)
 #else
+        if (scp->target == (unchar)id &&
             NUMDATA(scp->host)->busnum == (unchar)busnum)
 #endif
         {
             TRACE2(("gdth_stop_timeout(): update_timeout()\n"));
-            scp->SCp.buffers_residual = gdth_update_timeout(scp, 0);
+            scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0);
         }
     }
     restore_flags(flags);
@@ -595,30 +601,44 @@
     ha = HADATA(gdth_ctr_tab[hanum]);
 
     for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
+#if LINUX_VERSION_CODE >= 0x020000
         if (scp->target == (unchar)id &&
-#if LINUX_VERSION_CODE >= 0x010400
             scp->channel == (unchar)busnum)
 #else
+        if (scp->target == (unchar)id &&
             NUMDATA(scp->host)->busnum == (unchar)busnum)
 #endif
         {
             TRACE2(("gdth_start_timeout(): update_timeout()\n"));
-            gdth_update_timeout(scp, scp->SCp.buffers_residual);
+            gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual);
         }
     }
     restore_flags(flags);
 }
 
-static int gdth_update_timeout(Scsi_Cmnd *scp, int timeout)
+static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout)
 {
     ulong flags;
     int oldto;
 
     save_flags(flags);
     cli();
+    oldto = scp->timeout_per_command;
+    scp->timeout_per_command = timeout;
 
-    oldto = scp->timeout;
-    scp->timeout = timeout;
+#if LINUX_VERSION_CODE >= 0x02014B
+    if (timeout == 0) {
+	del_timer(&scp->eh_timeout);
+	scp->eh_timeout.data = (unsigned long) NULL;
+	scp->eh_timeout.expires = 0;
+    } else {
+	if (scp->eh_timeout.data != (unsigned long) NULL) 
+	    del_timer(&scp->eh_timeout);
+	scp->eh_timeout.data = (unsigned long) scp;
+	scp->eh_timeout.expires = jiffies + timeout;
+	add_timer(&scp->eh_timeout);
+    }
+#else
     if (timeout > 0) {
         if (timer_table[SCSI_TIMER].expires == 0) {
             timer_table[SCSI_TIMER].expires = jiffies + timeout;
@@ -628,6 +648,7 @@
                 timer_table[SCSI_TIMER].expires = jiffies + timeout;
         }
     }
+#endif
 
     restore_flags(flags);
     return oldto;

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