printk("%s: ihdlr, mbox %2d, err 0x%x:%x," " target %d.%d:%d, pid %ld, reg 0x%x, count %d.\n", ha->board_name, i, spp->adapter_status, spp->target_status, SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid, reg, ha->iocount); 
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, ha->iocount); 
static irqreturn_t ihdlr(int irq, struct Scsi_Host *shost){	struct scsi_cmnd *SCpnt;	unsigned int i, k, c, status, tstatus, reg;	struct mssp *spp;	struct mscp *cpp;	struct hostdata *ha = (struct hostdata *)shost->hostdata;	if (shost->irq != irq)		panic("%s: ihdlr, irq %d, shost->irq %d.\n", ha->board_name, irq,		      shost->irq);	/* Check if this board need to be serviced */	if (!(inb(shost->io_port + REG_AUX_STATUS) & IRQ_ASSERTED))		goto none;	ha->iocount++;	if (do_trace)		printk("%s: ihdlr, enter, irq %d, count %d.\n", ha->board_name, irq,		       ha->iocount);	/* Check if this board is still busy */	if (wait_on_busy(shost->io_port, 20 * MAXLOOP)) {		reg = inb(shost->io_port + REG_STATUS);		printk		    ("%s: ihdlr, busy timeout error,  irq %d, reg 0x%x, count %d.\n",		     ha->board_name, irq, reg, ha->iocount);		goto none;	}	spp = &ha->sp;	/* Make a local copy just before clearing the interrupt indication */	memcpy(spp, ha->sp_cpu_addr, sizeof(struct mssp));	/* Clear the completion flag and cp pointer on the dynamic copy of sp */	memset(ha->sp_cpu_addr, 0, sizeof(struct mssp));	/* Read the status register to clear the interrupt indication */	reg = inb(shost->io_port + REG_STATUS);#if defined (DEBUG_INTERRUPT)	{		unsigned char *bytesp;		int cnt;		bytesp = (unsigned char *)spp;		if (ha->iocount < 200) {			printk("sp[] =");			for (cnt = 0; cnt < 15; cnt++)				printk(" 0x%x", bytesp[cnt]);			printk("\n");		}	}#endif	/* Reject any sp with supspect data */	if (spp->eoc == 0 && ha->iocount > 1)		printk		    ("%s: ihdlr, spp->eoc == 0, irq %d, reg 0x%x, count %d.\n",		     ha->board_name, irq, reg, ha->iocount);	if (spp->cpp_index < 0 || spp->cpp_index >= shost->can_queue)		printk		    ("%s: ihdlr, bad spp->cpp_index %d, irq %d, reg 0x%x, count %d.\n",		     ha->board_name, spp->cpp_index, irq, reg, ha->iocount);	if (spp->eoc == 0 || spp->cpp_index < 0	    || spp->cpp_index >= shost->can_queue)		goto handled;	/* Find the mailbox to be serviced on this board */	i = spp->cpp_index;	cpp = &(ha->cp[i]);#if defined(DEBUG_GENERATE_ABORTS)	if ((ha->iocount > 500) && ((ha->iocount % 500) < 3))		goto handled;#endif	if (ha->cp_stat[i] == IGNORE) {		ha->cp_stat[i] = FREE;		goto handled;	} else if (ha->cp_stat[i] == LOCKED) {		ha->cp_stat[i] = FREE;		printk("%s: ihdlr, mbox %d unlocked, count %d.\n", ha->board_name, i,		       ha->iocount);		goto handled;	} else if (ha->cp_stat[i] == FREE) {		printk("%s: ihdlr, mbox %d is free, count %d.\n", ha->board_name, i,		       ha->iocount);		goto handled;	} else if (ha->cp_stat[i] == IN_RESET)		printk("%s: ihdlr, mbox %d is in reset.\n", ha->board_name, i);	else if (ha->cp_stat[i] != IN_USE)		panic("%s: ihdlr, mbox %d, invalid cp_stat: %d.\n",		      ha->board_name, i, ha->cp_stat[i]);	ha->cp_stat[i] = FREE;	SCpnt = cpp->SCpnt;	if (SCpnt == NULL)		panic("%s: ihdlr, mbox %d, SCpnt == NULL.\n", ha->board_name, i);	if (SCpnt->host_scribble == NULL)		panic("%s: ihdlr, mbox %d, pid %ld, SCpnt %p garbled.\n", ha->board_name,		      i, SCpnt->pid, SCpnt);	if (*(unsigned int *)SCpnt->host_scribble != i)		panic("%s: ihdlr, mbox %d, pid %ld, index mismatch %d.\n",		      ha->board_name, i, SCpnt->pid,		      *(unsigned int *)SCpnt->host_scribble);	sync_dma(i, ha);	if (linked_comm && SCpnt->device->queue_depth > 2	    && TLDEV(SCpnt->device->type))		flush_dev(SCpnt->device, SCpnt->request->sector, ha, 1);	tstatus = status_byte(spp->target_status);#if defined(DEBUG_GENERATE_ERRORS)	if ((ha->iocount > 500) && ((ha->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			 && ha->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)			ha->target_redo[SCpnt->device->id][SCpnt->device->							      channel] = 0;		if (spp->target_status && SCpnt->device->type == TYPE_DISK &&		    (!(tstatus == CHECK_CONDITION && ha->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",			       ha->board_name,			       SCpnt->device->channel, SCpnt->device->id,			       SCpnt->device->lun, SCpnt->pid,			       spp->target_status, SCpnt->sense_buffer[2]);		ha->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;		if (ha->last_retried_pid == SCpnt->pid)			ha->retries = 0;		break;	case ASST:		/* Selection Time Out */	case 0x02:		/* Command Time Out   */		if (ha->target_to[SCpnt->device->id][SCpnt->device->channel] > 1)			status = DID_ERROR << 16;		else {			status = DID_TIME_OUT << 16;			ha->target_to[SCpnt->device->id][SCpnt->device->							    channel]++;		}		break;		/* Perform a limited number of internal retries */	case 0x03:		/* SCSI Bus Reset Received */	case 0x04:		/* Initial Controller Power-up */		for (c = 0; c <= shost->max_channel; c++)			for (k = 0; k < shost->max_id; k++)				ha->target_redo[k][c] = 1;		if (SCpnt->device->type != TYPE_TAPE		    && ha->retries < MAX_INTERNAL_RETRIES) {#if defined(DID_SOFT_ERROR)			status = DID_SOFT_ERROR << 16;#else			status = DID_BUS_BUSY << 16;#endif			ha->retries++;			ha->last_retried_pid = SCpnt->pid;		} else			status = DID_ERROR << 16;		break;	case 0x05:		/* Unexpected Bus Phase */	case 0x06:		/* Unexpected Bus Free */	case 0x07:		/* Bus Parity Error */	case 0x08:		/* SCSI Hung */	case 0x09:		/* Unexpected Message Reject */	case 0x0a:		/* SCSI Bus Reset Stuck */	case 0x0b:		/* Auto Request-Sense Failed */	case 0x0c:		/* Controller Ram Parity Error */	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 && ha->iocount > 1000) ||	    (spp->adapter_status != ASOK &&	     spp->adapter_status != ASST && ha->iocount <= 1000) ||	    do_trace || msg_byte(spp->target_status))#endif		printk("%s: ihdlr, mbox %2d, err 0x%x:%x,"		       " target %d.%d:%d, pid %ld, reg 0x%x, count %d.\n",		       ha->board_name, i, spp->adapter_status, spp->target_status,		       SCpnt->device->channel, SCpnt->device->id,		       SCpnt->device->lun, SCpnt->pid, reg, ha->iocount);	unmap_dma(i, ha);	/* 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", ha->board_name,				irq, ha->iocount);      handled:	return IRQ_HANDLED;      none:	return IRQ_NONE;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/017560fca496f72ed9dd734ffde63ce39dfe0411/eata.c/clean/drivers/scsi/eata.c