patch-2.0.5 linux/drivers/scsi/eata.c

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

diff -u --recursive --new-file v2.0.4/linux/drivers/scsi/eata.c linux/drivers/scsi/eata.c
@@ -1,6 +1,9 @@
 /*
  *      eata.c - Low-level driver for EATA/DMA SCSI host adapters.
  *
+ *      09 Jul 1996 rev. 2.11 for linux 2.0.4
+ *          Number of internal retries is now limited.
+ *
  *      16 Apr 1996 rev. 2.10 for linux 1.3.90
  *          New argument "reset_flags" to the reset routine.
  *
@@ -156,6 +159,7 @@
 #define MAX_BOARDS 18
 #define MAX_MAILBOXES 64
 #define MAX_SGLIST 64
+#define MAX_INTERNAL_RETRIES 64
 #define MAX_CMD_PER_LUN 2
 
 #define FALSE 0
@@ -313,6 +317,8 @@
    int in_reset;                        /* True if board is doing a reset */
    int target_time_out[MAX_TARGET];     /* N. of timeout errors on target */
    int target_reset[MAX_TARGET];        /* If TRUE redo operation on target */
+   unsigned int retries;                /* Number of internal retries */
+   unsigned long last_retried_pid;      /* Pid of last retried command */
    unsigned char subversion;            /* Bus type, either ISA or ESA */
    unsigned char protocol_rev;          /* EATA 2.0 rev., 'A' or 'B' or 'C' */
    struct mssp sp[MAX_MAILBOXES];       /* Returned status for this board */
@@ -802,6 +808,8 @@
       return SCSI_RESET_ERROR;
       }
 
+   HD(j)->retries = 0;
+
    for (k = 0; k < MAX_TARGET; k++) HD(j)->target_reset[k] = TRUE;
 
    for (k = 0; k < MAX_TARGET; k++) HD(j)->target_time_out[k] = 0;
@@ -1008,6 +1016,8 @@
    
 		  HD(j)->target_time_out[SCpnt->target] = 0;
    
+                  if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0;
+
 		  break;
 	       case ASST:     /* Selection Time Out */
 	       case 0x02:     /* Command Time Out   */
@@ -1020,17 +1030,23 @@
 		     }
    
 		  break;
+
+               /* Perform a limited number of internal retries */
 	       case 0x03:     /* SCSI Bus Reset Received */
 	       case 0x04:     /* Initial Controller Power-up */
    
-		  if (SCpnt->device->type != TYPE_TAPE)
-		     status = DID_BUS_BUSY << 16;
-		  else
-		     status = DID_ERROR << 16;
-   
 		  for (k = 0; k < MAX_TARGET; k++) 
 		     HD(j)->target_reset[k] = TRUE;
    
+	          if (SCpnt->device->type != TYPE_TAPE
+                      && HD(j)->retries < MAX_INTERNAL_RETRIES) {
+		     status = DID_BUS_BUSY << 16;
+		     HD(j)->retries++;
+                     HD(j)->last_retried_pid = SCpnt->pid;
+                     }
+	          else 
+		     status = DID_ERROR << 16;
+
 		  break;
 	       case 0x07:     /* Bus Parity Error */
 	       case 0x0c:     /* Controller Ram Parity */
@@ -1058,7 +1074,7 @@
 		 spp->adapter_status != ASST && HD(j)->iocount <= 1000) ||
 		do_trace)
 #endif
-	       printk("%s: ihdlr, mbox %d, err 0x%x:%x,"\
+	       printk("%s: ihdlr, mbox %2d, err 0x%x:%x,"\
 		      " target %d:%d, pid %ld, count %d.\n",
 		      BN(j), i, spp->adapter_status, spp->target_status,
 		      SCpnt->target, SCpnt->lun, SCpnt->pid, HD(j)->iocount);

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