printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n", ha->board_name, SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid); 
scmd_printk(KERN_INFO, SCarg, "reset, enter, pid %ld.\n", SCarg->pid); 
static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg){	unsigned int i, time, k, c, limit = 0;	int arg_done = 0;	struct scsi_cmnd *SCpnt;	struct Scsi_Host *shost = SCarg->device->host;	struct hostdata *ha = (struct hostdata *)shost->hostdata;	printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n",	       ha->board_name, SCarg->device->channel, SCarg->device->id,	       SCarg->device->lun, SCarg->pid);	spin_lock_irq(shost->host_lock);	if (SCarg->host_scribble == NULL)		printk("%s: reset, pid %ld inactive.\n", ha->board_name, SCarg->pid);	if (ha->in_reset) {		printk("%s: reset, exit, already in reset.\n", ha->board_name);		spin_unlock_irq(shost->host_lock);		return FAILED;	}	if (wait_on_busy(shost->io_port, MAXLOOP)) {		printk("%s: reset, exit, timeout error.\n", ha->board_name);		spin_unlock_irq(shost->host_lock);		return FAILED;	}	ha->retries = 0;	for (c = 0; c <= shost->max_channel; c++)		for (k = 0; k < shost->max_id; k++) {			ha->target_redo[k][c] = 1;			ha->target_to[k][c] = 0;		}	for (i = 0; i < shost->can_queue; i++) {		if (ha->cp_stat[i] == FREE)			continue;		if (ha->cp_stat[i] == LOCKED) {			ha->cp_stat[i] = FREE;			printk("%s: reset, locked mbox %d forced free.\n",			       ha->board_name, i);			continue;		}		if (!(SCpnt = ha->cp[i].SCpnt))			panic("%s: reset, mbox %d, SCpnt == NULL.\n", ha->board_name, i);		if (ha->cp_stat[i] == READY || ha->cp_stat[i] == ABORTING) {			ha->cp_stat[i] = ABORTING;			printk("%s: reset, mbox %d aborting, pid %ld.\n",			       ha->board_name, i, SCpnt->pid);		}		else {			ha->cp_stat[i] = IN_RESET;			printk("%s: reset, mbox %d in reset, pid %ld.\n",			       ha->board_name, i, SCpnt->pid);		}		if (SCpnt->host_scribble == NULL)			panic("%s: reset, mbox %d, garbled SCpnt.\n", ha->board_name, i);		if (*(unsigned int *)SCpnt->host_scribble != i)			panic("%s: reset, mbox %d, index mismatch.\n", ha->board_name, i);		if (SCpnt->scsi_done == NULL)			panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n",			      ha->board_name, i);		if (SCpnt == SCarg)			arg_done = 1;	}	if (do_dma(shost->io_port, 0, RESET_PIO)) {		printk("%s: reset, cannot reset, timeout error.\n", ha->board_name);		spin_unlock_irq(shost->host_lock);		return FAILED;	}	printk("%s: reset, board reset done, enabling interrupts.\n", ha->board_name);#if defined(DEBUG_RESET)	do_trace = 1;#endif	ha->in_reset = 1;	spin_unlock_irq(shost->host_lock);	/* FIXME: use a sleep instead */	time = jiffies;	while ((jiffies - time) < (10 * HZ) && limit++ < 200000)		udelay(100L);	spin_lock_irq(shost->host_lock);	printk("%s: reset, interrupts disabled, loops %d.\n", ha->board_name, limit);	for (i = 0; i < shost->can_queue; i++) {		if (ha->cp_stat[i] == IN_RESET) {			SCpnt = ha->cp[i].SCpnt;			unmap_dma(i, ha);			SCpnt->result = DID_RESET << 16;			SCpnt->host_scribble = NULL;			/* This mailbox is still waiting for its interrupt */			ha->cp_stat[i] = LOCKED;			printk			    ("%s, reset, mbox %d locked, DID_RESET, pid %ld done.\n",			     ha->board_name, i, SCpnt->pid);		}		else if (ha->cp_stat[i] == ABORTING) {			SCpnt = ha->cp[i].SCpnt;			unmap_dma(i, ha);			SCpnt->result = DID_RESET << 16;			SCpnt->host_scribble = NULL;			/* This mailbox was never queued to the adapter */			ha->cp_stat[i] = FREE;			printk			    ("%s, reset, mbox %d aborting, DID_RESET, pid %ld done.\n",			     ha->board_name, i, SCpnt->pid);		}		else			/* Any other mailbox has already been set free by interrupt */			continue;		SCpnt->scsi_done(SCpnt);	}	ha->in_reset = 0;	do_trace = 0;	if (arg_done)		printk("%s: reset, exit, pid %ld done.\n", ha->board_name, SCarg->pid);	else		printk("%s: reset, exit.\n", ha->board_name);	spin_unlock_irq(shost->host_lock);	return SUCCESS;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/017560fca496f72ed9dd734ffde63ce39dfe0411/eata.c/clean/drivers/scsi/eata.c