print_status(status); 
scsi_print_status(status); 
static int internal_command (unsigned char target, unsigned char lun,		  const void *cmnd, void *buff, int bufflen, int reselect){	unsigned char *data = NULL;	struct scatterlist *buffer = NULL;	int clock, temp, nobuffs = 0, done = 0, len = 0;#ifdef DEBUG	int transfered = 0, phase = 0, newphase;#endif	register unsigned char status_read;	unsigned char tmp_data, tmp_control, status = 0, message = 0;	unsigned transfersize = 0, underflow = 0;#ifdef SLOW_RATE	int borken = (int) SCint->device->borken;	/* Does the current target require							   Very Slow I/O ?  */#endif	incommand = 0;	st0x_aborted = 0;#if (DEBUG & PRINT_COMMAND)	printk("scsi%d : target = %d, command = ", hostno, target);	print_command((unsigned char *) cmnd);#endif#if (DEBUG & PHASE_RESELECT)	switch (reselect) {	case RECONNECT_NOW:		printk("scsi%d : reconnecting\n", hostno);		break;#ifdef LINKED	case LINKED_RIGHT:		printk("scsi%d : connected, can reconnect\n", hostno);		break;	case LINKED_WRONG:		printk("scsi%d : connected to wrong target, can reconnect\n",			hostno);		break;#endif	case CAN_RECONNECT:		printk("scsi%d : allowed to reconnect\n", hostno);		break;	default:		printk("scsi%d : not allowed to reconnect\n", hostno);	}#endif	if (target == (controller_type == SEAGATE ? 7 : 6))		return DID_BAD_TARGET;	/*	 *	We work it differently depending on if this is is "the first time,"	 *      or a reconnect.  If this is a reselect phase, then SEL will	 *      be asserted, and we must skip selection / arbitration phases.	 */	switch (reselect) {	case RECONNECT_NOW:		DPRINTK (PHASE_RESELECT, "scsi%d : phase RESELECT \n", hostno);		/*		 *	At this point, we should find the logical or of our ID		 *	and the original target's ID on the BUS, with BSY, SEL,		 *	and I/O signals asserted.		 *		 *      After ARBITRATION phase is completed, only SEL, BSY,		 *	and the target ID are asserted.  A valid initiator ID		 *	is not on the bus until IO is asserted, so we must wait		 *	for that.		 */		ULOOP (100 * 1000) {			temp = STATUS;			if ((temp & STAT_IO) && !(temp & STAT_BSY))				break;			if (TIMEOUT) {				DPRINTK (PHASE_RESELECT, "scsi%d : RESELECT timed out while waiting for IO .\n", hostno);				return (DID_BAD_INTR << 16);			}		}		/*		 *	After I/O is asserted by the target, we can read our ID		 *	and its ID off of the BUS.		 */		if (!((temp = DATA) & (controller_type == SEAGATE ? 0x80 : 0x40))) {			DPRINTK (PHASE_RESELECT, "scsi%d : detected reconnect request to different target.\n\tData bus = %d\n", hostno, temp);			return (DID_BAD_INTR << 16);		}		if (!(temp & (1 << current_target))) {			printk(KERN_WARNING "scsi%d : Unexpected reselect interrupt.  Data bus = %d\n", hostno, temp);			return (DID_BAD_INTR << 16);		}		buffer = current_buffer;		cmnd = current_cmnd;	/* WDE add */		data = current_data;	/* WDE add */		len = current_bufflen;	/* WDE add */		nobuffs = current_nobuffs;		/*		 *	We have determined that we have been selected.  At this		 *	point, we must respond to the reselection by asserting		 *	BSY ourselves		 */#if 1		WRITE_CONTROL (BASE_CMD | CMD_DRVR_ENABLE | CMD_BSY);#else		WRITE_CONTROL (BASE_CMD | CMD_BSY);#endif		/*		 *	The target will drop SEL, and raise BSY, at which time		 *	we must drop BSY.		 */		ULOOP (100 * 1000) {			if (!(STATUS & STAT_SEL))				break;			if (TIMEOUT) {				WRITE_CONTROL (BASE_CMD | CMD_INTR);				DPRINTK (PHASE_RESELECT, "scsi%d : RESELECT timed out while waiting for SEL.\n", hostno);				return (DID_BAD_INTR << 16);			}		}		WRITE_CONTROL (BASE_CMD);		/*		 *	At this point, we have connected with the target		 *	and can get on with our lives.		 */		break;	case CAN_RECONNECT:#ifdef LINKED		/*		 * This is a bletcherous hack, just as bad as the Unix #!		 * interpreter stuff. If it turns out we are using the wrong		 * I_T_L nexus, the easiest way to deal with it is to go into		 *  our INFORMATION TRANSFER PHASE code, send a ABORT		 * message on MESSAGE OUT phase, and then loop back to here.		 */connect_loop:#endif		DPRINTK (PHASE_BUS_FREE, "scsi%d : phase = BUS FREE \n", hostno);		/*		 *    BUS FREE PHASE		 *		 *      On entry, we make sure that the BUS is in a BUS FREE		 *      phase, by insuring that both BSY and SEL are low for		 *      at least one bus settle delay.  Several reads help		 *      eliminate wire glitch.		 */#ifndef ARBITRATE#error FIXME: this is broken: we may not use jiffies here - we are under cli(). It will hardlock.		clock = jiffies + ST0X_BUS_FREE_DELAY;		while (((STATUS | STATUS | STATUS) & (STAT_BSY | STAT_SEL)) && (!st0x_aborted) && time_before (jiffies, clock))			cpu_relax();		if (time_after (jiffies, clock))			return retcode (DID_BUS_BUSY);		else if (st0x_aborted)			return retcode (st0x_aborted);#endif		DPRINTK (PHASE_SELECTION, "scsi%d : phase = SELECTION\n", hostno);		clock = jiffies + ST0X_SELECTION_DELAY;		/*		 * Arbitration/selection procedure :		 * 1.  Disable drivers		 * 2.  Write HOST adapter address bit		 * 3.  Set start arbitration.		 * 4.  We get either ARBITRATION COMPLETE or SELECT at this		 *     point.		 * 5.  OR our ID and targets on bus.		 * 6.  Enable SCSI drivers and asserted SEL and ATTN		 */#ifdef ARBITRATE		/* FIXME: verify host lock is always held here */		WRITE_CONTROL(0);		WRITE_DATA((controller_type == SEAGATE) ? 0x80 : 0x40);		WRITE_CONTROL(CMD_START_ARB);		ULOOP (ST0X_SELECTION_DELAY * 10000) {			status_read = STATUS;			if (status_read & STAT_ARB_CMPL)				break;			if (st0x_aborted)	/* FIXME: What? We are going to do something even after abort? */				break;			if (TIMEOUT || (status_read & STAT_SEL)) {				printk(KERN_WARNING "scsi%d : arbitration lost or timeout.\n", hostno);				WRITE_CONTROL (BASE_CMD);				return retcode (DID_NO_CONNECT);			}		}		DPRINTK (PHASE_SELECTION, "scsi%d : arbitration complete\n", hostno);#endif		/*		 *    When the SCSI device decides that we're gawking at it, 		 *    it will respond by asserting BUSY on the bus.		 *		 *    Note : the Seagate ST-01/02 product manual says that we		 *    should twiddle the DATA register before the control		 *    register. However, this does not work reliably so we do		 *    it the other way around.		 *		 *    Probably could be a problem with arbitration too, we		 *    really should try this with a SCSI protocol or logic 		 *    analyzer to see what is going on.		 */		tmp_data = (unsigned char) ((1 << target) | (controller_type == SEAGATE ? 0x80 : 0x40));		tmp_control = BASE_CMD | CMD_DRVR_ENABLE | CMD_SEL | (reselect ? CMD_ATTN : 0);		/* FIXME: verify host lock is always held here */#ifdef OLDCNTDATASCEME#ifdef SWAPCNTDATA		WRITE_CONTROL (tmp_control);		WRITE_DATA (tmp_data);#else		WRITE_DATA (tmp_data);		WRITE_CONTROL (tmp_control);#endif#else		tmp_control ^= CMD_BSY;	/* This is guesswork. What used to be in driver    */		WRITE_CONTROL (tmp_control);	/* could never work: it sent data into control     */		WRITE_DATA (tmp_data);	/* register and control info into data. Hopefully  */		tmp_control ^= CMD_BSY;	/* fixed, but order of first two may be wrong.     */		WRITE_CONTROL (tmp_control);	/* -- pavel@ucw.cz   */#endif		ULOOP (250 * 1000) {			if (st0x_aborted) {				/*				 *	If we have been aborted, and we have a				 *	command in progress, IE the target 				 *	still has BSY asserted, then we will				 *	reset the bus, and notify the midlevel				 *	driver to expect sense.				 */				WRITE_CONTROL (BASE_CMD);				if (STATUS & STAT_BSY) {					printk(KERN_WARNING "scsi%d : BST asserted after we've been aborted.\n", hostno);					seagate_st0x_bus_reset(NULL);					return retcode (DID_RESET);				}				return retcode (st0x_aborted);			}			if (STATUS & STAT_BSY)				break;			if (TIMEOUT) {				DPRINTK (PHASE_SELECTION, "scsi%d : NO CONNECT with target %d, stat = %x \n", hostno, target, STATUS);				return retcode (DID_NO_CONNECT);			}		}		/* Establish current pointers.  Take into account scatter / gather */		if ((nobuffs = SCint->use_sg)) {#if (DEBUG & DEBUG_SG)			{				int i;				printk("scsi%d : scatter gather requested, using %d buffers.\n", hostno, nobuffs);				for (i = 0; i < nobuffs; ++i)					printk("scsi%d : buffer %d address = %p length = %d\n",					     hostno, i,					     page_address(buffer[i].page) + buffer[i].offset,					     buffer[i].length);			}#endif			buffer = (struct scatterlist *) SCint->buffer;			len = buffer->length;			data = page_address(buffer->page) + buffer->offset;		} else {			DPRINTK (DEBUG_SG, "scsi%d : scatter gather not requested.\n", hostno);			buffer = NULL;			len = SCint->request_bufflen;			data = (unsigned char *) SCint->request_buffer;		}		DPRINTK (PHASE_DATAIN | PHASE_DATAOUT, "scsi%d : len = %d\n",			 hostno, len);		break;#ifdef LINKED	case LINKED_RIGHT:		break;	case LINKED_WRONG:		break;#endif	}			/* end of switch(reselect) */	/*	 *    There are several conditions under which we wish to send a message :	 *      1.  When we are allowing disconnect / reconnect, and need to	 *	establish the I_T_L nexus via an IDENTIFY with the DiscPriv bit	 *	set.	 *	 *      2.  When we are doing linked commands, are have the wrong I_T_L	 *	nexus established and want to send an ABORT message.	 */	/* GCC does not like an ifdef inside a macro, so do it the hard way. */#ifdef LINKED	WRITE_CONTROL (BASE_CMD | CMD_DRVR_ENABLE | (((reselect == CAN_RECONNECT)|| (reselect == LINKED_WRONG))? CMD_ATTN : 0));#else	WRITE_CONTROL (BASE_CMD | CMD_DRVR_ENABLE | (((reselect == CAN_RECONNECT))? CMD_ATTN : 0));#endif	/*	 *    INFORMATION TRANSFER PHASE	 *	 *      The nasty looking read / write inline assembler loops we use for	 *      DATAIN and DATAOUT phases are approximately 4-5 times as fast as	 *      the 'C' versions - since we're moving 1024 bytes of data, this	 *      really adds up.	 *	 *      SJT: The nasty-looking assembler is gone, so it's slower.	 *	 */	DPRINTK (PHASE_ETC, "scsi%d : phase = INFORMATION TRANSFER\n", hostno);	incommand = 1;	transfersize = SCint->transfersize;	underflow = SCint->underflow;	/*	 *	Now, we poll the device for status information,	 *      and handle any requests it makes.  Note that since we are unsure	 *	of how much data will be flowing across the system, etc and	 *	cannot make reasonable timeouts, that we will instead have the	 *	midlevel driver handle any timeouts that occur in this phase.	 */	while (((status_read = STATUS) & STAT_BSY) && !st0x_aborted && !done) {#ifdef PARITY		if (status_read & STAT_PARITY) {			printk(KERN_ERR "scsi%d : got parity error\n", hostno);			st0x_aborted = DID_PARITY;		}#endif		if (status_read & STAT_REQ) {#if ((DEBUG & PHASE_ETC) == PHASE_ETC)			if ((newphase = (status_read & REQ_MASK)) != phase) {				phase = newphase;				switch (phase) {				case REQ_DATAOUT:					printk ("scsi%d : phase = DATA OUT\n", hostno);					break;				case REQ_DATAIN:					printk ("scsi%d : phase = DATA IN\n", hostno);					break;				case REQ_CMDOUT:					printk					    ("scsi%d : phase = COMMAND OUT\n", hostno);					break;				case REQ_STATIN:					printk ("scsi%d : phase = STATUS IN\n",	hostno);					break;				case REQ_MSGOUT:					printk					    ("scsi%d : phase = MESSAGE OUT\n", hostno);					break;				case REQ_MSGIN:					printk ("scsi%d : phase = MESSAGE IN\n", hostno);					break;				default:					printk ("scsi%d : phase = UNKNOWN\n", hostno);					st0x_aborted = DID_ERROR;				}			}#endif			switch (status_read & REQ_MASK) {			case REQ_DATAOUT:				/*				 * If we are in fast mode, then we simply splat				 * the data out in word-sized chunks as fast as				 * we can.				 */				if (!len) {#if 0					printk("scsi%d: underflow to target %d lun %d \n", hostno, target, lun);					st0x_aborted = DID_ERROR;					fast = 0;#endif					break;				}				if (fast && transfersize				    && !(len % transfersize)				    && (len >= transfersize)#ifdef FAST32				    && !(transfersize % 4)#endif				    ) {					DPRINTK (DEBUG_FAST,						 "scsi%d : FAST transfer, underflow = %d, transfersize = %d\n"						 "         len = %d, data = %08x\n",						 hostno, SCint->underflow,						 SCint->transfersize, len,						 data);			/* SJT: Start. Fast Write */#ifdef SEAGATE_USE_ASM					__asm__ ("cld\n\t"#ifdef FAST32						 "shr $2, %%ecx\n\t"						 "1:\t"						 "lodsl\n\t"						 "movl %%eax, (%%edi)\n\t"#else						 "1:\t"						 "lodsb\n\t"						 "movb %%al, (%%edi)\n\t"#endif						 "loop 1b;"				      /* output */ :				      /* input */ :"D" (st0x_dr),						 "S"						 (data),						 "c" (SCint->transfersize)/* clobbered */				      :	 "eax", "ecx",						 "esi");#else				/* SEAGATE_USE_ASM */					memcpy_toio(st0x_dr, data, transfersize);#endif				/* SEAGATE_USE_ASM *//* SJT: End */					len -= transfersize;					data += transfersize;					DPRINTK (DEBUG_FAST, "scsi%d : FAST transfer complete len = %d data = %08x\n", hostno, len, data);				} else {					/*					 *    We loop as long as we are in a 					 *    data out phase, there is data to					 *    send, and BSY is still active.					 *//* SJT: Start. Slow Write. */#ifdef SEAGATE_USE_ASM					int __dummy_1, __dummy_2;/* *      We loop as long as we are in a data out phase, there is data to send,  *      and BSY is still active. *//* Local variables : len = ecx , data = esi,                      st0x_cr_sr = ebx, st0x_dr =  edi*/					__asm__ (							/* Test for any data here at all. */							"orl %%ecx, %%ecx\n\t"							"jz 2f\n\t" "cld\n\t"/*                    "movl st0x_cr_sr, %%ebx\n\t"  *//*                    "movl st0x_dr, %%edi\n\t"  */							"1:\t"							"movb (%%ebx), %%al\n\t"							/* Test for BSY */							"test $1, %%al\n\t"							"jz 2f\n\t"							/* Test for data out phase - STATUS & REQ_MASK should be 							   REQ_DATAOUT, which is 0. */							"test $0xe, %%al\n\t"							"jnz 2f\n\t"							/* Test for REQ */							"test $0x10, %%al\n\t"							"jz 1b\n\t"							"lodsb\n\t"							"movb %%al, (%%edi)\n\t"							"loop 1b\n\t" "2:\n"				      /* output */ :"=S" (data), "=c" (len),							"=b"							(__dummy_1),							"=D" (__dummy_2)/* input */				      :		"0" (data), "1" (len),							"2" (st0x_cr_sr),							"3" (st0x_dr)/* clobbered */				      :		"eax");#else				/* SEAGATE_USE_ASM */					while (len) {						unsigned char stat;						stat = STATUS;						if (!(stat & STAT_BSY)						    || ((stat & REQ_MASK) !=							REQ_DATAOUT))							break;						if (stat & STAT_REQ) {							WRITE_DATA (*data++);							--len;						}					}#endif				/* SEAGATE_USE_ASM *//* SJT: End. */				}				if (!len && nobuffs) {					--nobuffs;					++buffer;					len = buffer->length;					data = page_address(buffer->page) + buffer->offset;					DPRINTK (DEBUG_SG,						 "scsi%d : next scatter-gather buffer len = %d address = %08x\n",						 hostno, len, data);				}				break;			case REQ_DATAIN:#ifdef SLOW_RATE				if (borken) {#if (DEBUG & (PHASE_DATAIN))					transfered += len;#endif					for (; len && (STATUS & (REQ_MASK | STAT_REQ)) == (REQ_DATAIN | STAT_REQ); --len) {						*data++ = DATA;						borken_wait();					}#if (DEBUG & (PHASE_DATAIN))					transfered -= len;#endif				} else#endif					if (fast && transfersize					    && !(len % transfersize)					    && (len >= transfersize)#ifdef FAST32					    && !(transfersize % 4)#endif				    ) {					DPRINTK (DEBUG_FAST,						 "scsi%d : FAST transfer, underflow = %d, transfersize = %d\n"						 "         len = %d, data = %08x\n",						 hostno, SCint->underflow,						 SCint->transfersize, len,						 data);/* SJT: Start. Fast Read */#ifdef SEAGATE_USE_ASM					__asm__ ("cld\n\t"#ifdef FAST32						 "shr $2, %%ecx\n\t"						 "1:\t"						 "movl (%%esi), %%eax\n\t"						 "stosl\n\t"#else						 "1:\t"						 "movb (%%esi), %%al\n\t"						 "stosb\n\t"#endif						 "loop 1b\n\t"				      /* output */ :				      /* input */ :"S" (st0x_dr),						 "D"						 (data),						 "c" (SCint->transfersize)/* clobbered */				      :	 "eax", "ecx",						 "edi");#else				/* SEAGATE_USE_ASM */					memcpy_fromio(data, st0x_dr, len);#endif				/* SEAGATE_USE_ASM *//* SJT: End */					len -= transfersize;					data += transfersize;#if (DEBUG & PHASE_DATAIN)					printk ("scsi%d: transfered += %d\n", hostno, transfersize);					transfered += transfersize;#endif					DPRINTK (DEBUG_FAST, "scsi%d : FAST transfer complete len = %d data = %08x\n", hostno, len, data);				} else {#if (DEBUG & PHASE_DATAIN)					printk ("scsi%d: transfered += %d\n", hostno, len);					transfered += len;	/* Assume we'll transfer it all, then								   subtract what we *didn't* transfer */#endif/* *	We loop as long as we are in a data in phase, there is room to read, *      and BSY is still active *//* SJT: Start. */#ifdef SEAGATE_USE_ASM					int __dummy_3, __dummy_4;/* Dummy clobbering variables for the new gcc-2.95 *//* *      We loop as long as we are in a data in phase, there is room to read,  *      and BSY is still active */					/* Local variables : ecx = len, edi = data					   esi = st0x_cr_sr, ebx = st0x_dr */					__asm__ (							/* Test for room to read */							"orl %%ecx, %%ecx\n\t"							"jz 2f\n\t" "cld\n\t"/*                "movl st0x_cr_sr, %%esi\n\t"  *//*                "movl st0x_dr, %%ebx\n\t"  */							"1:\t"							"movb (%%esi), %%al\n\t"							/* Test for BSY */							"test $1, %%al\n\t"							"jz 2f\n\t"							/* Test for data in phase - STATUS & REQ_MASK should be REQ_DATAIN, 							   = STAT_IO, which is 4. */							"movb $0xe, %%ah\n\t"							"andb %%al, %%ah\n\t"							"cmpb $0x04, %%ah\n\t"							"jne 2f\n\t"							/* Test for REQ */							"test $0x10, %%al\n\t"							"jz 1b\n\t"							"movb (%%ebx), %%al\n\t"							"stosb\n\t"							"loop 1b\n\t" "2:\n"				      /* output */ :"=D" (data), "=c" (len),							"=S"							(__dummy_3),							"=b" (__dummy_4)/* input */				      :		"0" (data), "1" (len),							"2" (st0x_cr_sr),							"3" (st0x_dr)/* clobbered */				      :		"eax");#else				/* SEAGATE_USE_ASM */					while (len) {						unsigned char stat;						stat = STATUS;						if (!(stat & STAT_BSY)						    || ((stat & REQ_MASK) !=							REQ_DATAIN))							break;						if (stat & STAT_REQ) {							*data++ = DATA;							--len;						}					}#endif				/* SEAGATE_USE_ASM *//* SJT: End. */#if (DEBUG & PHASE_DATAIN)					printk ("scsi%d: transfered -= %d\n", hostno, len);					transfered -= len;	/* Since we assumed all of Len got  *								   transfered, correct our mistake */#endif				}				if (!len && nobuffs) {					--nobuffs;					++buffer;					len = buffer->length;					data = page_address(buffer->page) + buffer->offset;					DPRINTK (DEBUG_SG, "scsi%d : next scatter-gather buffer len = %d address = %08x\n", hostno, len, data);				}				break;			case REQ_CMDOUT:				while (((status_read = STATUS) & STAT_BSY) &&				       ((status_read & REQ_MASK) == REQ_CMDOUT))					if (status_read & STAT_REQ) {						WRITE_DATA (*(const unsigned char *) cmnd);						cmnd = 1 + (const unsigned char *)cmnd;#ifdef SLOW_RATE						if (borken)							borken_wait ();#endif					}				break;			case REQ_STATIN:				status = DATA;				break;			case REQ_MSGOUT:				/*				 *	We can only have sent a MSG OUT if we				 *	requested to do this by raising ATTN.				 *	So, we must drop ATTN.				 */				WRITE_CONTROL (BASE_CMD | CMD_DRVR_ENABLE);				/*				 *	If we are reconnecting, then we must 				 *	send an IDENTIFY message in response				 *	to MSGOUT.				 */				switch (reselect) {				case CAN_RECONNECT:					WRITE_DATA (IDENTIFY (1, lun));					DPRINTK (PHASE_RESELECT | PHASE_MSGOUT, "scsi%d : sent IDENTIFY message.\n", hostno);					break;#ifdef LINKED				case LINKED_WRONG:					WRITE_DATA (ABORT);					linked_connected = 0;					reselect = CAN_RECONNECT;					goto connect_loop;					DPRINTK (PHASE_MSGOUT | DEBUG_LINKED, "scsi%d : sent ABORT message to cancel incorrect I_T_L nexus.\n", hostno);#endif					/* LINKED */					DPRINTK (DEBUG_LINKED, "correct\n");				default:					WRITE_DATA (NOP);					printk("scsi%d : target %d requested MSGOUT, sent NOP message.\n", hostno, target);				}				break;			case REQ_MSGIN:				switch (message = DATA) {				case DISCONNECT:					DANY("seagate: deciding to disconnect\n");					should_reconnect = 1;					current_data = data;	/* WDE add */					current_buffer = buffer;					current_bufflen = len;	/* WDE add */					current_nobuffs = nobuffs;#ifdef LINKED					linked_connected = 0;#endif					done = 1;					DPRINTK ((PHASE_RESELECT | PHASE_MSGIN), "scsi%d : disconnected.\n", hostno);					break;#ifdef LINKED				case LINKED_CMD_COMPLETE:				case LINKED_FLG_CMD_COMPLETE:#endif				case COMMAND_COMPLETE:					/*					 * Note : we should check for underflow here.					 */					DPRINTK(PHASE_MSGIN, "scsi%d : command complete.\n", hostno);					done = 1;					break;				case ABORT:					DPRINTK(PHASE_MSGIN, "scsi%d : abort message.\n", hostno);					done = 1;					break;				case SAVE_POINTERS:					current_buffer = buffer;					current_bufflen = len;	/* WDE add */					current_data = data;	/* WDE mod */					current_nobuffs = nobuffs;					DPRINTK (PHASE_MSGIN, "scsi%d : pointers saved.\n", hostno);					break;				case RESTORE_POINTERS:					buffer = current_buffer;					cmnd = current_cmnd;					data = current_data;	/* WDE mod */					len = current_bufflen;					nobuffs = current_nobuffs;					DPRINTK(PHASE_MSGIN, "scsi%d : pointers restored.\n", hostno);					break;				default:					/*					 *	IDENTIFY distinguishes itself					 *	from the other messages by 					 *	setting the high bit.					 *					 *      Note : we need to handle at 					 *	least one outstanding command					 *	per LUN, and need to hash the 					 *	SCSI command for that I_T_L					 *	nexus based on the known ID 					 *	(at this point) and LUN.					 */					if (message & 0x80) {						DPRINTK (PHASE_MSGIN, "scsi%d : IDENTIFY message received from id %d, lun %d.\n", hostno, target, message & 7);					} else {						/*						 *      We should go into a						 *	MESSAGE OUT phase, and						 *	send  a MESSAGE_REJECT						 *      if we run into a message 						 *	that we don't like.  The						 *	seagate driver needs 						 *	some serious 						 *	restructuring first						 *	though.						 */						DPRINTK (PHASE_MSGIN, "scsi%d : unknown message %d from target %d.\n", hostno, message, target);					}				}				break;			default:				printk(KERN_ERR "scsi%d : unknown phase.\n", hostno);				st0x_aborted = DID_ERROR;			}	/* end of switch (status_read &  REQ_MASK) */#ifdef SLOW_RATE			/*			 * I really don't care to deal with borken devices in			 * each single byte transfer case (ie, message in,			 * message out, status), so I'll do the wait here if 			 * necessary.			 */			if(borken)				borken_wait();#endif		}		/* if(status_read & STAT_REQ) ends */	}			/* while(((status_read = STATUS)...) ends */	DPRINTK(PHASE_DATAIN | PHASE_DATAOUT | PHASE_EXIT, "scsi%d : Transfered %d bytes\n", hostno, transfered);#if (DEBUG & PHASE_EXIT)#if 0				/* Doesn't work for scatter/gather */	printk("Buffer : \n");	for(i = 0; i < 20; ++i)		printk("%02x  ", ((unsigned char *) data)[i]);	/* WDE mod */	printk("\n");#endif	printk("scsi%d : status = ", hostno);	print_status(status);	printk(" message = %02x\n", message);#endif	/* We shouldn't reach this until *after* BSY has been deasserted */#ifdef LINKED	else	{		/*		 * Fix the message byte so that unsuspecting high level drivers		 * don't puke when they see a LINKED COMMAND message in place of		 * the COMMAND COMPLETE they may be expecting.  Shouldn't be		 * necessary, but it's better to be on the safe side.		 *		 * A non LINKED* message byte will indicate that the command		 * completed, and we are now disconnected.		 */		switch (message) {		case LINKED_CMD_COMPLETE:		case LINKED_FLG_CMD_COMPLETE:			message = COMMAND_COMPLETE;			linked_target = current_target;			linked_lun = current_lun;			linked_connected = 1;			DPRINTK (DEBUG_LINKED, "scsi%d : keeping I_T_L nexus established for linked command.\n", hostno);			/* We also will need to adjust status to accommodate intermediate			   conditions. */			if ((status == INTERMEDIATE_GOOD) || (status == INTERMEDIATE_C_GOOD))				status = GOOD;			break;			/*			 * We should also handle what are "normal" termination			 * messages here (ABORT, BUS_DEVICE_RESET?, and			 * COMMAND_COMPLETE individually, and flake if things			 * aren't right.			 */		default:			DPRINTK (DEBUG_LINKED, "scsi%d : closing I_T_L nexus.\n", hostno);			linked_connected = 0;		}	}#endif	/* LINKED */	if (should_reconnect) {		DPRINTK (PHASE_RESELECT, "scsi%d : exiting seagate_st0x_queue_command() with reconnect enabled.\n", hostno);		WRITE_CONTROL (BASE_CMD | CMD_INTR);	} else		WRITE_CONTROL (BASE_CMD);	return retcode (st0x_aborted);}				/* end of internal_command */
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1409277c4aad2e87ad27b2b8a6901ce78eaf8081/seagate.c/clean/drivers/scsi/seagate.c