HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] = 0; 
HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] = 0; 
static irqreturn_t ihdlr(int irq, unsigned int j) {   struct scsi_cmnd *SCpnt;   unsigned int i, k, c, status, tstatus, reg, ret;   struct mscp *spp, *cpp;   if (sh[j]->irq != irq)       panic("%s: ihdlr, irq %d, sh[j]->irq %d.\n", BN(j), irq, sh[j]->irq);   /* Check if this board need to be serviced */   if (!((reg = inb(sh[j]->io_port + REG_SYS_INTR)) & IRQ_ASSERTED)) goto none;   HD(j)->iocount++;   if (do_trace) printk("%s: ihdlr, enter, irq %d, count %d.\n", BN(j), irq,                        HD(j)->iocount);   /* Check if this board is still busy */   if (wait_on_busy(sh[j]->io_port, 20 * MAXLOOP)) {      outb(CMD_CLR_INTR, sh[j]->io_port + REG_SYS_INTR);      printk("%s: ihdlr, busy timeout error,  irq %d, reg 0x%x, count %d.\n",             BN(j), irq, reg, HD(j)->iocount);      goto none;      }   ret = inl(sh[j]->io_port + REG_ICM);   /* Clear interrupt pending flag */   outb(CMD_CLR_INTR, sh[j]->io_port + REG_SYS_INTR);   /* Find the mailbox to be serviced on this board */   for (i = 0; i < sh[j]->can_queue; i++)      if (H2DEV(HD(j)->cp[i].cp_dma_addr) == ret) break;   if (i >= sh[j]->can_queue)      panic("%s: ihdlr, invalid mscp bus address %p, cp0 %p.\n", BN(j),            (void *)ret, (void *)H2DEV(HD(j)->cp[0].cp_dma_addr));   cpp = &(HD(j)->cp[i]);   spp = cpp;#if defined(DEBUG_GENERATE_ABORTS)   if ((HD(j)->iocount > 500) && ((HD(j)->iocount % 500) < 3)) goto handled;#endif   if (HD(j)->cp_stat[i] == IGNORE) {      HD(j)->cp_stat[i] = FREE;      goto handled;      }   else if (HD(j)->cp_stat[i] == LOCKED) {      HD(j)->cp_stat[i] = FREE;      printk("%s: ihdlr, mbox %d unlocked, count %d.\n", BN(j), i,             HD(j)->iocount);      goto handled;      }   else if (HD(j)->cp_stat[i] == FREE) {      printk("%s: ihdlr, mbox %d is free, count %d.\n", BN(j), i,             HD(j)->iocount);      goto handled;      }   else if (HD(j)->cp_stat[i] == IN_RESET)      printk("%s: ihdlr, mbox %d is in reset.\n", BN(j), i);   else if (HD(j)->cp_stat[i] != IN_USE)      panic("%s: ihdlr, mbox %d, invalid cp_stat: %d.\n",            BN(j), i, HD(j)->cp_stat[i]);   HD(j)->cp_stat[i] = FREE;   SCpnt = cpp->SCpnt;   if (SCpnt == NULL) panic("%s: ihdlr, mbox %d, SCpnt == NULL.\n", BN(j), i);   if (SCpnt->host_scribble == NULL)      panic("%s: ihdlr, mbox %d, pid %ld, SCpnt %p garbled.\n", BN(j), i,            SCpnt->pid, SCpnt);   if (*(unsigned int *)SCpnt->host_scribble != i)      panic("%s: ihdlr, mbox %d, pid %ld, index mismatch %d.\n",            BN(j), i, SCpnt->pid, *(unsigned int *)SCpnt->host_scribble);   sync_dma(i, j);   if (linked_comm && SCpnt->device->queue_depth > 2                                     && TLDEV(SCpnt->device->type))      flush_dev(SCpnt->device, SCpnt->request->sector, j, TRUE);   tstatus = status_byte(spp->target_status);#if defined(DEBUG_GENERATE_ERRORS)   if ((HD(j)->iocount > 500) && ((HD(j)->iocount % 200) < 2))                                           spp->adapter_status = 0x01;#endif   switch (spp->adapter_status) {      case ASOK:     /* status OK */         /* Forces a reset if a disk drive keeps returning BUSY */         if (tstatus == BUSY && SCpnt->device->type != TYPE_TAPE)            status = DID_ERROR << 16;         /* If there was a bus reset, redo operation on each target */         else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK                  && HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel])            status = DID_BUS_BUSY << 16;         /* Works around a flaw in scsi.c */         else if (tstatus == CHECK_CONDITION                  && SCpnt->device->type == TYPE_DISK                  && (SCpnt->sense_buffer[2] & 0xf) == RECOVERED_ERROR)            status = DID_BUS_BUSY << 16;         else            status = DID_OK << 16;         if (tstatus == GOOD)            HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = FALSE;         if (spp->target_status && SCpnt->device->type == TYPE_DISK &&             (!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&               (SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))            printk("%s: ihdlr, target %d.%d:%d, pid %ld, "\                   "target_status 0x%x, sense key 0x%x.\n", BN(j),                   SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,                   SCpnt->pid, spp->target_status,                   SCpnt->sense_buffer[2]);         HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;         if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0;         break;      case ASST:     /* Selection Time Out */         if (HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] > 1)            status = DID_ERROR << 16;         else {            status = DID_TIME_OUT << 16;            HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel]++;            }         break;      /* Perform a limited number of internal retries */      case 0x93:     /* Unexpected bus free */      case 0x94:     /* Target bus phase sequence failure */      case 0x96:     /* Illegal SCSI command */      case 0xa3:     /* SCSI bus reset error */         for (c = 0; c <= sh[j]->max_channel; c++)            for (k = 0; k < sh[j]->max_id; k++)               HD(j)->target_redo[k][c] = TRUE;      case 0x92:     /* Data over/under-run */         if (SCpnt->device->type != TYPE_TAPE             && HD(j)->retries < MAX_INTERNAL_RETRIES) {#if defined(DID_SOFT_ERROR)            status = DID_SOFT_ERROR << 16;#else            status = DID_BUS_BUSY << 16;#endif            HD(j)->retries++;            HD(j)->last_retried_pid = SCpnt->pid;            }         else            status = DID_ERROR << 16;         break;      case 0x01:     /* Invalid command */      case 0x02:     /* Invalid parameters */      case 0x03:     /* Invalid data list */      case 0x84:     /* SCSI bus abort error */      case 0x9b:     /* Auto request sense error */      case 0x9f:     /* Unexpected command complete message error */      case 0xff:     /* Invalid parameter in the S/G list */      default:         status = DID_ERROR << 16;         break;      }   SCpnt->result = status | spp->target_status;#if defined(DEBUG_INTERRUPT)   if (SCpnt->result || do_trace)#else   if ((spp->adapter_status != ASOK && HD(j)->iocount >  1000) ||       (spp->adapter_status != ASOK &&        spp->adapter_status != ASST && HD(j)->iocount <= 1000) ||        do_trace || msg_byte(spp->target_status))#endif      scmd_printk(KERN_INFO, SCpnt, "ihdlr, mbox %2d, err 0x%x:%x,"\             " pid %ld, reg 0x%x, count %d.\n",             i, spp->adapter_status, spp->target_status, SCpnt->pid,             reg, HD(j)->iocount);   unmap_dma(i, j);   /* Set the command state to inactive */   SCpnt->host_scribble = NULL;   SCpnt->scsi_done(SCpnt);   if (do_trace) printk("%s: ihdlr, exit, irq %d, count %d.\n", BN(j), irq,                        HD(j)->iocount);handled:   return IRQ_HANDLED;none:   return IRQ_NONE;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/422c0d61d591cbfb70f029e13505fb437e169d68/u14-34f.c/clean/drivers/scsi/u14-34f.c