]> git.hungrycats.org Git - linux/commitdiff
[PATCH] tmscsim: remove internal command queue
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Tue, 5 Oct 2004 05:14:10 +0000 (00:14 -0500)
committerChristoph Hellwig <hch@lst.de>
Tue, 5 Oct 2004 05:14:10 +0000 (00:14 -0500)
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsiiom.c
drivers/scsi/tmscsim.c
drivers/scsi/tmscsim.h

index df98ae44f83e69668993810323c0d8d5d5fc1016..a3bbb101aa917b63fea3cf4cd33f230f5874fd70 100644 (file)
@@ -15,7 +15,7 @@ dc390_freetag (struct dc390_dcb* pDCB, struct dc390_srb* pSRB)
 }
 
 
-static u8
+static int
 dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
 {
     u8 cmd; u8  disc_allowed, try_sync_nego;
@@ -1150,10 +1150,7 @@ dc390_Disconnect( struct dc390_acb* pACB )
     pACB->pActiveDCB = 0;
     pSRB->ScsiPhase = SCSI_NOP0;
     if( pSRB->SRBState & SRB_UNEXPECT_RESEL )
-    {
        pSRB->SRBState = 0;
-       dc390_Waiting_process ( pACB );
-    }
     else if( pSRB->SRBState & SRB_ABORT_SENT )
     {
        pDCB->TagMask = 0;
@@ -1168,31 +1165,16 @@ dc390_Disconnect( struct dc390_acb* pACB )
            pSRB = psrb;
        }
        pDCB->pGoingSRB = 0;
-       dc390_Waiting_process (pACB);
     }
     else
     {
        if( (pSRB->SRBState & (SRB_START_+SRB_MSGOUT)) ||
           !(pSRB->SRBState & (SRB_DISCONNECT+SRB_COMPLETED)) )
        {       /* Selection time out */
-           if( !(1/*pACB->scan_devices*/) )
-           {
-               pSRB->SRBState = SRB_READY;
-               dc390_freetag (pDCB, pSRB);
-               dc390_Going_to_Waiting (pDCB, pSRB);
-               dc390_waiting_timer (pACB, HZ/5);
-           }
-           else
-           {
                pSRB->TargetStatus = SCSI_STAT_SEL_TIMEOUT;
                goto  disc1;
-           }
-       }
-       else if( pSRB->SRBState & SRB_DISCONNECT )
-       {
-           dc390_Waiting_process ( pACB );
        }
-       else if( pSRB->SRBState & SRB_COMPLETED )
+       else if (!(pSRB->SRBState & SRB_DISCONNECT) && (pSRB->SRBState & SRB_COMPLETED))
        {
 disc1:
            dc390_freetag (pDCB, pSRB);
@@ -1221,10 +1203,13 @@ dc390_Reselect( struct dc390_acb* pACB )
        pSRB = pDCB->pActiveSRB;
        if( !( pACB->scan_devices ) )
        {
-           pSRB->SRBState = SRB_READY;
-           dc390_freetag (pDCB, pSRB);
-           dc390_Going_to_Waiting ( pDCB, pSRB);
-           dc390_waiting_timer (pACB, HZ/5);
+           struct scsi_cmnd *pcmd = pSRB->pcmd;
+           pcmd->resid = pcmd->request_bufflen;
+           SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
+           dc390_Going_remove(pDCB, pSRB);
+           dc390_Free_insert(pACB, pSRB);
+           pcmd->scsi_done (pcmd);
+           DEBUG0(printk(KERN_DEBUG"DC390: Return SRB %p to free\n", pSRB));
        }
     }
     /* Get ID */
@@ -1291,7 +1276,7 @@ dc390_Reselect( struct dc390_acb* pACB )
     DC390_write8 (ScsiCmd, MSG_ACCEPTED_CMD);  /* ;to release the /ACK signal */
 }
 
-static void __inline__
+static int __inline__
 dc390_RequestSense(struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB)
 {
        struct scsi_cmnd *pcmd;
@@ -1313,21 +1298,17 @@ dc390_RequestSense(struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_
 
        pSRB->TotalXferredLen = 0;
        pSRB->SGToBeXferLen = 0;
-       if (dc390_StartSCSI(pACB, pDCB, pSRB)) {
-               dc390_Going_to_Waiting(pDCB, pSRB);
-               dc390_waiting_timer(pACB, HZ/5);
-       }
+       return dc390_StartSCSI(pACB, pDCB, pSRB);
 }
 
 
 static void
 dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
 {
-    u8  bval, status, i;
+    u8  bval, status;
     struct scsi_cmnd *pcmd;
     PSCSI_INQDATA  ptr;
     struct scatterlist *ptr2;
-    unsigned long  swlval;
 
     pcmd = pSRB->pcmd;
     /* KG: Moved pci_unmap here */
@@ -1350,58 +1331,34 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
 
        //pcmd->result = MK_RES(DRIVER_SENSE,DID_OK,0,status);
        if (status == (CHECK_CONDITION << 1))
-       {
-           pcmd->result = MK_RES_LNX(0,DID_BAD_TARGET,0,/*CHECK_CONDITION*/0);
-           goto ckc_e;
-       }
-       if(pSRB->RetryCnt == 0)
-       {
-           //(u32)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0];
-           pSRB->TotalXferredLen = pSRB->SavedTotXLen;
-           if( (pSRB->TotalXferredLen) &&
-               (pSRB->TotalXferredLen >= pcmd->underflow) )
-                 SET_RES_DID(pcmd->result,DID_OK)
-           else
-                 pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION);
-                 REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x,Result=%08x,XferL=%08x\n",pSRB->pcmd->cmnd[0],\
-                       (u32) pcmd->result, (u32) pSRB->TotalXferredLen));
-           goto ckc_e;
-       }
+           pcmd->result = MK_RES_LNX(0, DID_BAD_TARGET, 0, /*CHECK_CONDITION*/0);
        else /* Retry */
        {
-           pSRB->RetryCnt--;
-           pSRB->AdaptStatus = 0;
-           pSRB->TargetStatus = 0;
-           /* Don't retry on TEST_UNIT_READY */
            if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */)
            {
+               /* Don't retry on TEST_UNIT_READY */
                pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION);
                REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n",pSRB->pcmd->cmnd[0],\
                       (u32) pcmd->result, (u32) pSRB->TotalXferredLen));
-               goto ckc_e;
-           }
-           SET_RES_DRV(pcmd->result,DRIVER_SENSE);
-           pcmd->use_sg         = pSRB->SavedSGCount;
-           //pSRB->ScsiCmdLen   = (u8) (pSRB->Segment1[0] >> 8);
-           DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun));
-           pSRB->SGIndex = 0;
-           pSRB->TotalXferredLen = 0;
-           pSRB->SGToBeXferLen = 0;
-
-           if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) {
-               dc390_Going_to_Waiting ( pDCB, pSRB );
-               dc390_waiting_timer (pACB, HZ/5);
+           } else {
+               SET_RES_DRV(pcmd->result, DRIVER_SENSE);
+               pcmd->use_sg = pSRB->SavedSGCount;
+               //pSRB->ScsiCmdLen       = (u8) (pSRB->Segment1[0] >> 8);
+               DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun));
+               pSRB->TotalXferredLen = 0;
+               SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
            }
-           return;
        }
+       goto cmd_done;
     }
     if( status )
     {
        if( status_byte(status) == CHECK_CONDITION )
        {
-           REMOVABLEDEBUG(printk (KERN_INFO "DC390: Check_Condition (Cmd %02x, Id %02x, LUN %02x)\n",\
-                   pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN));
-           if( (pSRB->SGIndex < pSRB->SGcount) && (pSRB->SGcount) && (pSRB->SGToBeXferLen) )
+#ifdef DC390_REMOVABLEDEBUG
+           printk(KERN_INFO "DC390: Check_Condition (Cmd %02x, Id %02x, LUN %02x)\n",
+                  pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN);
+           if ((pSRB->SGIndex < pSRB->SGcount) && (pSRB->SGcount) && (pSRB->SGToBeXferLen))
            {
                bval = pSRB->SGcount;
                swlval = 0;
@@ -1411,10 +1368,13 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
                    swlval += sg_dma_len(ptr2);
                    ptr2++;
                }
-               REMOVABLEDEBUG(printk(KERN_INFO "XferredLen=%08x,NotXferLen=%08x\n",\
-                       (u32) pSRB->TotalXferredLen, (u32) swlval));
+               printk(KERN_INFO "XferredLen=%08x,NotXferLen=%08x\n", (u32) pSRB->TotalXferredLen, (u32) swlval);
+           }
+#endif
+           if (dc390_RequestSense(pACB, pDCB, pSRB)) {
+               SET_RES_DID(pcmd->result, DID_ERROR);
+               goto cmd_done;
            }
-           dc390_RequestSense( pACB, pDCB, pSRB );
            return;
        }
        else if( status_byte(status) == QUEUE_FULL )
@@ -1422,12 +1382,10 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
            bval = (u8) pDCB->GoingSRBCnt;
            bval--;
            pDCB->MaxCommand = bval;
-           dc390_freetag (pDCB, pSRB);
-           dc390_Going_to_Waiting ( pDCB, pSRB );
-           dc390_waiting_timer (pACB, HZ/5);
-           pSRB->AdaptStatus = 0;
-           pSRB->TargetStatus = 0;
-           return;
+           pcmd->use_sg = pSRB->SavedSGCount;
+           DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun));
+           pSRB->TotalXferredLen = 0;
+           SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
        }
        else if(status == SCSI_STAT_SEL_TIMEOUT)
        {
@@ -1446,28 +1404,9 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
        }
        else
        {   /* Another error */
-           pSRB->AdaptStatus = 0;
-           if( pSRB->RetryCnt )
-           {   /* Retry */
-               //printk ("DC390: retry\n");
-               pSRB->RetryCnt--;
-               pSRB->TargetStatus = 0;
-               pSRB->SGIndex = 0;
-               pSRB->TotalXferredLen = 0;
-               pSRB->SGToBeXferLen = 0;
-               if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) {
-                   dc390_Going_to_Waiting ( pDCB, pSRB );
-                   dc390_waiting_timer (pACB, HZ/5);
-               }
-               return;
-           }
-           else
-           {   /* Report error */
-             //pcmd->result = MK_RES(0, DID_ERROR, pSRB->EndMessage, status);
-             SET_RES_DID(pcmd->result,DID_ERROR);
-             SET_RES_MSG(pcmd->result,pSRB->EndMessage);
-             SET_RES_TARGET(pcmd->result,status);
-           }
+           pSRB->TotalXferredLen = 0;
+           SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
+           goto cmd_done;
        }
     }
     else
@@ -1500,13 +1439,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
        (ptr->Vers & 0x07) >= 2)
            pDCB->Inquiry7 = ptr->Flags;
 
-ckc_e:
-    if (pcmd->cmnd[0] == INQUIRY && 
-       (pcmd->result == (DID_OK << 16) || status_byte(pcmd->result) & CHECK_CONDITION) &&
-       (ptr->DevType & SCSI_DEVTYPE) != TYPE_NODEV)
-       /* device found: add */ 
-       pDCB->DevType = ptr->DevType & SCSI_DEVTYPE;
-
+cmd_done:
     pcmd->resid = pcmd->request_bufflen - pSRB->TotalXferredLen;
 
     dc390_Going_remove (pDCB, pSRB);
@@ -1516,7 +1449,6 @@ ckc_e:
     DEBUG0(printk (KERN_DEBUG "DC390: SRBdone: done pid %li\n", pcmd->pid));
     pcmd->scsi_done (pcmd);
 
-    dc390_Waiting_process (pACB);
     return;
 }
 
@@ -1572,7 +1504,6 @@ dc390_ScsiRstDetect( struct dc390_acb* pACB )
     printk ("DC390: Rst_Detect: laststat = %08x\n", dc390_laststatus);
     //DEBUG0(printk(KERN_INFO "RST_DETECT,"));
 
-    if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
     DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
     /* Unlock before ? */
     /* delay half a second */
@@ -1593,7 +1524,6 @@ dc390_ScsiRstDetect( struct dc390_acb* pACB )
        //dc390_RecoverSRB( pACB );
        pACB->pActiveDCB = NULL;
        pACB->ACBFlag = 0;
-       dc390_Waiting_process( pACB );
     }
     return;
 }
index 40f7d0b22ffba82b7994838fa75e686eb95a7649..34977974218102c23bf14b356895f899d72aaeb3 100644 (file)
 
 #include "tmscsim.h"
 
-static u8 dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB );
+static int dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB );
 static void dc390_DataOut_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus);
 static void dc390_DataIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus);
 static void dc390_Command_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus);
@@ -365,20 +365,6 @@ static struct dc390_dcb __inline__ *dc390_findDCB ( struct dc390_acb* pACB, u8 i
    return pDCB;
 }
 
-/* Queueing philosphy:
- * There are a couple of lists:
- * - Query: Contains the Scsi Commands not yet turned into SRBs (per ACB)
- *   (Note: For new EH, it is unnecessary!)
- * - Waiting: Contains a list of SRBs not yet sent (per DCB)
- * - Free: List of free SRB slots
- * 
- * If there are no waiting commands for the DCB, the new one is sent to the bus
- * otherwise the oldest one is taken from the Waiting list and the new one is 
- * queued to the Waiting List
- * 
- * Lists are managed using two pointers and eventually a counter
- */
-
 /* Insert SRB oin top of free list */
 static __inline__ void dc390_Free_insert (struct dc390_acb* pACB, struct dc390_srb* pSRB)
 {
@@ -387,19 +373,6 @@ static __inline__ void dc390_Free_insert (struct dc390_acb* pACB, struct dc390_s
     pACB->pFreeSRB = pSRB;
 }
 
-
-/* Inserts a SRB to the top of the Waiting list */
-static __inline__ void dc390_Waiting_insert ( struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
-{
-    DEBUG0(printk ("DC390: Insert pSRB %p cmd %li to Waiting\n", pSRB, pSRB->pcmd->pid));
-    pSRB->pNextSRB = pDCB->pWaitingSRB;
-    if (!pDCB->pWaitingSRB)
-       pDCB->pWaitLast = pSRB;
-    pDCB->pWaitingSRB = pSRB;
-    pDCB->WaitSRBCnt++;
-}
-
-
 static __inline__ void dc390_Going_append (struct dc390_dcb* pDCB, struct dc390_srb* pSRB)
 {
     pDCB->GoingSRBCnt++;
@@ -434,91 +407,6 @@ static __inline__ void dc390_Going_remove (struct dc390_dcb* pDCB, struct dc390_
    pDCB->GoingSRBCnt--;
 }
 
-/* Moves SRB from Going list to the top of Waiting list */
-static void dc390_Going_to_Waiting ( struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
-{
-    DEBUG0(printk(KERN_INFO "DC390: Going_to_Waiting (SRB %p) pid = %li\n", pSRB, pSRB->pcmd->pid));
-    /* Remove SRB from Going */
-    dc390_Going_remove (pDCB, pSRB);
-    /* Insert on top of Waiting */
-    dc390_Waiting_insert (pDCB, pSRB);
-    /* Tag Mask must be freed elsewhere ! (KG, 99/06/18) */
-}
-
-/* Moves first SRB from Waiting list to Going list */
-static __inline__ void dc390_Waiting_to_Going ( struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
-{      
-       /* Remove from waiting list */
-       DEBUG0(printk("DC390: Remove SRB %p from head of Waiting\n", pSRB));
-       pDCB->pWaitingSRB = pSRB->pNextSRB;
-       if( !pDCB->pWaitingSRB ) pDCB->pWaitLast = NULL;
-       pDCB->WaitSRBCnt--;
-       dc390_Going_append (pDCB, pSRB);
-}
-
-static void DC390_waiting_timed_out (unsigned long ptr);
-/* Sets the timer to wake us up */
-static void dc390_waiting_timer (struct dc390_acb* pACB, unsigned long to)
-{
-       if (timer_pending (&pACB->Waiting_Timer)) return;
-       init_timer (&pACB->Waiting_Timer);
-       pACB->Waiting_Timer.function = DC390_waiting_timed_out;
-       pACB->Waiting_Timer.data = (unsigned long)pACB;
-       if (time_before (jiffies + to, pACB->pScsiHost->last_reset))
-               pACB->Waiting_Timer.expires = pACB->pScsiHost->last_reset + 1;
-       else
-               pACB->Waiting_Timer.expires = jiffies + to + 1;
-       add_timer (&pACB->Waiting_Timer);
-}
-
-
-/* Send the next command from the waiting list to the bus */
-static void dc390_Waiting_process ( struct dc390_acb* pACB )
-{
-    struct dc390_dcb *ptr, *ptr1;
-    struct dc390_srb *pSRB;
-
-    if( (pACB->pActiveDCB) || (pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV) ) )
-       return;
-    if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
-    ptr = pACB->pDCBRunRobin;
-    if( !ptr )
-      {
-       ptr = pACB->pLinkDCB;
-       pACB->pDCBRunRobin = ptr;
-      }
-    ptr1 = ptr;
-    if (!ptr1) return;
-    do 
-      {
-       pACB->pDCBRunRobin = ptr1->pNextDCB;
-       if( !( pSRB = ptr1->pWaitingSRB ) ||
-           ( ptr1->MaxCommand <= ptr1->GoingSRBCnt ))
-         ptr1 = ptr1->pNextDCB;
-       else
-         {
-           /* Try to send to the bus */
-           if( !dc390_StartSCSI(pACB, ptr1, pSRB) )
-             dc390_Waiting_to_Going (ptr1, pSRB);
-           else
-             dc390_waiting_timer (pACB, HZ/5);
-           break;
-         }
-      } while (ptr1 != ptr);
-    return;
-}
-
-/* Wake up waiting queue */
-static void DC390_waiting_timed_out (unsigned long ptr)
-{
-       struct dc390_acb* pACB = (struct dc390_acb*)ptr;
-       unsigned long iflags;
-       DEBUG0(printk ("DC390: Debug: Waiting queue woken up by timer!\n"));
-       spin_lock_irqsave(pACB->pScsiHost->host_lock, iflags);
-       dc390_Waiting_process (pACB);
-       spin_unlock_irqrestore(pACB->pScsiHost->host_lock, iflags);
-}
-
 static struct scatterlist* dc390_sg_build_single(struct scatterlist *sg, void *addr, unsigned int length)
 {
        memset(sg, 0, sizeof(struct scatterlist));
@@ -602,8 +490,6 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd,
        struct dc390_dcb *dcb = sdev->hostdata;
        struct dc390_srb *srb;
 
-       if (dcb->pWaitingSRB)
-               goto device_busy;
        if (dcb->MaxCommand <= dcb->GoingSRBCnt)
                goto device_busy;
        if (acb->pActiveDCB)
@@ -629,10 +515,7 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd,
        srb->AdaptStatus = 0;
        srb->TargetStatus = 0;
        srb->MsgCnt = 0;
-       if (dcb->DevType == TYPE_TAPE)
-               srb->RetryCnt = 0;
-       else
-               srb->RetryCnt = 1;
+
        srb->SRBStatus = 0;
        srb->SRBFlag = 0;
        srb->SRBState = 0;
@@ -644,21 +527,18 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd,
        srb->TagNumber = SCSI_NO_TAG;
 
        if (dc390_StartSCSI(acb, dcb, srb)) {
-               dc390_Waiting_insert(dcb, srb);
-               dc390_waiting_timer(acb, HZ/5);
-               goto done;
+               dc390_Free_insert(acb, srb);
+               goto host_busy;
        }
 
        dc390_Going_append(dcb, srb);
- done:
+
        return 0;
 
  host_busy:
-       dc390_Waiting_process(acb);
        return SCSI_MLQUEUE_HOST_BUSY;
 
  device_busy:
-       dc390_Waiting_process(acb);
        return SCSI_MLQUEUE_DEVICE_BUSY;
 }
 
@@ -712,45 +592,14 @@ static int DC390_abort(struct scsi_cmnd *cmd)
 {
        struct dc390_acb *pACB = (struct dc390_acb*) cmd->device->host->hostdata;
        struct dc390_dcb *pDCB = (struct dc390_dcb*) cmd->device->hostdata;
-       struct dc390_srb *pSRB, *psrb;
 
        printk("DC390: Abort command (pid %li, Device %02i-%02i)\n",
               cmd->pid, cmd->device->id, cmd->device->lun);
 
-       pSRB = pDCB->pWaitingSRB;
-       if (!pSRB)
-               goto on_going;
-
-       /* Now scan Waiting queue */
-       if (pSRB->pcmd != cmd) {
-               psrb = pSRB;
-               if (!(psrb->pNextSRB))
-                       goto on_going;
-
-               while (psrb->pNextSRB->pcmd != cmd) {
-                       psrb = psrb->pNextSRB;
-                       if (!(psrb->pNextSRB) || psrb == pSRB)
-                               goto on_going;
-               }
-
-               pSRB = psrb->pNextSRB;
-               psrb->pNextSRB = pSRB->pNextSRB;
-               if (pSRB == pDCB->pWaitLast)
-                       pDCB->pWaitLast = psrb;
-       } else
-               pDCB->pWaitingSRB = pSRB->pNextSRB;
-
-       dc390_Free_insert(pACB, pSRB);
-       pDCB->WaitSRBCnt--;
-       INIT_LIST_HEAD((struct list_head*)&cmd->SCp);
-
-       return SUCCESS;
-
-on_going:
        /* abort() is too stupid for already sent commands at the moment. 
         * If it's called we are in trouble anyway, so let's dump some info 
         * into the syslog at least. (KG, 98/08/20,99/06/20) */
-       dc390_dumpinfo(pACB, pDCB, pSRB);
+       dc390_dumpinfo(pACB, pDCB, NULL);
 
        pDCB->DCBFlag |= ABORT_DEV_;
        printk(KERN_INFO "DC390: Aborted pid %li\n", cmd->pid);
@@ -787,8 +636,6 @@ static int DC390_bus_reset (struct scsi_cmnd *cmd)
        struct dc390_acb*    pACB = (struct dc390_acb*) cmd->device->host->hostdata;
        u8   bval;
 
-       del_timer (&pACB->Waiting_Timer);
-
        bval = DC390_read8(CtrlReg1) | DIS_INT_ON_SCSI_RST;
        DC390_write8(CtrlReg1, bval);   /* disable IRQ on bus reset */
 
@@ -811,8 +658,6 @@ static int DC390_bus_reset (struct scsi_cmnd *cmd)
        bval = DC390_read8(CtrlReg1) & ~DIS_INT_ON_SCSI_RST;
        DC390_write8(CtrlReg1, bval);   /* re-enable interrupt */
 
-       dc390_Waiting_process(pACB);
-
        return SUCCESS;
 }
 
@@ -1295,7 +1140,6 @@ static int __devinit dc390_probe_one(struct pci_dev *pdev,
        pACB->sel_timeout = SEL_TIMEOUT;
        pACB->glitch_cfg = EATER_25NS;
        pACB->pdev = pdev;
-       init_timer(&pACB->Waiting_Timer);
 
        if (!request_region(io_port, shost->n_io_port, "tmscsim")) {
                printk(KERN_ERR "DC390: register IO ports error!\n");
@@ -1357,8 +1201,6 @@ static void __devexit dc390_remove_one(struct pci_dev *dev)
                dc390_ResetSCSIBus(pACB);
        spin_unlock_irqrestore(scsi_host->host_lock, iflags);
 
-       del_timer_sync(&pACB->Waiting_Timer);
-
        free_irq(scsi_host->irq, pACB);
        release_region(scsi_host->io_port, scsi_host->n_io_port);
 
index 95a35c9a4ef17e204ca68dd0d3f66e014b7628c8..d9a64583071b29909ffd9febe2ef6132c393f9e5 100644 (file)
@@ -44,17 +44,15 @@ struct dc390_dcb    *pSRBDCB;
 struct scsi_cmnd       *pcmd;
 struct scatterlist     *pSegmentList;
 
-/* 0x10: */
 struct scatterlist Segmentx;   /* make a one entry of S/G list table */
 
-/* 0x1c: */
 unsigned long  SGBusAddr;      /*;a segment starting address as seen by AM53C974A*/
 unsigned long  SGToBeXferLen;  /*; to be xfer length */
 unsigned long  TotalXferredLen;
 unsigned long  SavedTotXLen;
+unsigned long  Saved_Ptr;
 u32            SRBState;
 
-/* 0x30: */
 u8             SRBStatus;
 u8             SRBFlag;        /*; b0-AutoReqSense,b6-Read,b7-write */
                                /*; b4-settimeout,b5-Residual valid */
@@ -66,20 +64,14 @@ s8          TagNumber;
 u8             SGIndex;
 u8             SGcount;
 
-/* 0x38: */
 u8             MsgCnt;
 u8             EndMessage;
-u8             RetryCnt;
 u8             SavedSGCount;                   
 
-unsigned long  Saved_Ptr;
-
-/* 0x40: */
 u8             MsgInBuf[6];
 u8             MsgOutBuf[6];
 
 //u8           IORBFlag;       /*;81h-Reset, 2-retry */
-/* 0x4c: */
 };
 
 
@@ -93,20 +85,14 @@ struct dc390_dcb
 struct dc390_dcb       *pNextDCB;
 struct dc390_acb       *pDCBACB;
 
-/* 0x08: */
 /* Queued SRBs */
-struct dc390_srb       *pWaitingSRB;
-struct dc390_srb       *pWaitLast;
 struct dc390_srb       *pGoingSRB;
 struct dc390_srb       *pGoingLast;
 struct dc390_srb       *pActiveSRB;
-u8             WaitSRBCnt;     /* Not used */
 u8             GoingSRBCnt;
 
-u8             DevType;
 u8             MaxCommand;
 
-/* 0x20: */
 u32            TagMask;
 
 u8             TargetID;       /*; SCSI Target ID  (SCSI Only) */
@@ -119,16 +105,10 @@ u8                CtrlR3;
 u8             CtrlR4;
 u8             Inquiry7;
 
-/* 0x2c: */
 u8             SyncMode;       /*; 0:async mode */
 u8             NegoPeriod;     /*;for nego. */
 u8             SyncPeriod;     /*;for reg. */
 u8             SyncOffset;     /*;for reg. and nego.(low nibble) */
-
-/* 0x30:*/
-//u8           InqDataBuf[8];
-//u8           CapacityBuf[8];
-///* 0x40: */
 };
 
 
@@ -181,8 +161,6 @@ u32         SelLost;
 u32            SelConn;
 u32            CmdInQ;
 u32            CmdOutOfSRB;
-       
-struct timer_list      Waiting_Timer;
 
 struct dc390_srb       TmpSRB;
 struct dc390_srb       SRB_array[MAX_SRB_CNT];         /* 50 SRBs */
@@ -309,11 +287,11 @@ struct dc390_srb  SRB_array[MAX_SRB_CNT];         /* 50 SRBs */
 #define MK_RES(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt))
 #define MK_RES_LNX(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1)
 
-#define SET_RES_TARGET(who,tgt) { who &= ~RES_TARGET; who |= (int)(tgt); }
-#define SET_RES_TARGET_LNX(who,tgt) { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; }
-#define SET_RES_MSG(who,msg) { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; }
-#define SET_RES_DID(who,did) { who &= ~RES_DID; who |= (int)(did) << 16; }
-#define SET_RES_DRV(who,drv) { who &= ~RES_DRV; who |= (int)(drv) << 24; }
+#define SET_RES_TARGET(who, tgt) do { who &= ~RES_TARGET; who |= (int)(tgt); } while (0)
+#define SET_RES_TARGET_LNX(who, tgt) do { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; } while (0)
+#define SET_RES_MSG(who, msg) do { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; } while (0)
+#define SET_RES_DID(who, did) do { who &= ~RES_DID; who |= (int)(did) << 16; } while (0)
+#define SET_RES_DRV(who, drv) do { who &= ~RES_DRV; who |= (int)(drv) << 24; } while (0)
 
 /*;---Sync_Mode */
 #define SYNC_DISABLE   0