print_sense("bh", DONE_SC); 
scsi_print_sense("bh", DONE_SC); 
static void busfree_run(struct Scsi_Host *shpnt){	unsigned long flags;#if defined(AHA152X_STAT)	int action=0;#endif	SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT);	SETPORT(SXFRCTL0, CH1);	SETPORT(SSTAT1, CLRBUSFREE);		if(CURRENT_SC) {#if defined(AHA152X_STAT)		action++;#endif		CURRENT_SC->SCp.phase &= ~syncneg;		if(CURRENT_SC->SCp.phase & completed) {			/* target sent COMMAND COMPLETE */			done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_OK << 16));		} else if(CURRENT_SC->SCp.phase & aborted) {			DPRINTK(debug_eh, DEBUG_LEAD "ABORT sent\n", CMDINFO(CURRENT_SC));			done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_ABORT << 16));		} else if(CURRENT_SC->SCp.phase & resetted) {			DPRINTK(debug_eh, DEBUG_LEAD "BUS DEVICE RESET sent\n", CMDINFO(CURRENT_SC));			done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_RESET << 16));		} else if(CURRENT_SC->SCp.phase & disconnected) {			/* target sent DISCONNECT */			DPRINTK(debug_selection, DEBUG_LEAD "target disconnected at %d/%d\n",				CMDINFO(CURRENT_SC),				CURRENT_SC->resid,				CURRENT_SC->request_bufflen);#if defined(AHA152X_STAT)			HOSTDATA(shpnt)->disconnections++;#endif			append_SC(&DISCONNECTED_SC, CURRENT_SC);			CURRENT_SC->SCp.phase |= 1 << 16;			CURRENT_SC = NULL;		} else {			done(shpnt, DID_ERROR << 16);		}#if defined(AHA152X_STAT)	} else {		HOSTDATA(shpnt)->busfree_without_old_command++;#endif	}	DO_LOCK(flags);	if(DONE_SC) {#if defined(AHA152X_STAT)		action++;#endif		if(DONE_SC->SCp.phase & check_condition) {#if 0			if(HOSTDATA(shpnt)->debug & debug_eh) {				printk(ERR_LEAD "received sense: ", CMDINFO(DONE_SC));				print_sense("bh", DONE_SC);			}#endif			/* restore old command */			memcpy((void *) DONE_SC->cmnd, (void *) DONE_SC->data_cmnd, sizeof(DONE_SC->data_cmnd));			DONE_SC->request_buffer  = DONE_SC->buffer;			DONE_SC->request_bufflen = DONE_SC->bufflen;			DONE_SC->use_sg          = DONE_SC->old_use_sg;			DONE_SC->cmd_len         = DONE_SC->old_cmd_len;			DONE_SC->SCp.Status = 0x02;			HOSTDATA(shpnt)->commands--;			if (!HOSTDATA(shpnt)->commands)				SETPORT(PORTA, 0);	/* turn led off */		} else if(DONE_SC->SCp.Status==0x02) {#if defined(AHA152X_STAT)			HOSTDATA(shpnt)->busfree_with_check_condition++;#endif#if 0			DPRINTK(debug_eh, ERR_LEAD "CHECK CONDITION found\n", CMDINFO(DONE_SC));#endif			if(!(DONE_SC->SCp.Status & not_issued)) {				Scsi_Cmnd *ptr = DONE_SC;				DONE_SC=NULL;#if 0				DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr));#endif				ptr->cmnd[0]         = REQUEST_SENSE;				ptr->cmnd[1]         = 0;				ptr->cmnd[2]         = 0;				ptr->cmnd[3]         = 0;				ptr->cmnd[4]         = sizeof(ptr->sense_buffer);				ptr->cmnd[5]         = 0;				ptr->cmd_len         = 6;				ptr->use_sg          = 0; 				ptr->request_buffer  = ptr->sense_buffer;				ptr->request_bufflen = sizeof(ptr->sense_buffer);							DO_UNLOCK(flags);				aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);				DO_LOCK(flags);#if 0			} else {				DPRINTK(debug_eh, ERR_LEAD "command not issued - CHECK CONDITION ignored\n", CMDINFO(DONE_SC));#endif			}		}		if(DONE_SC && DONE_SC->scsi_done) {#if defined(AHA152X_DEBUG)			int hostno=DONE_SC->device->host->host_no;			int id=DONE_SC->device->id & 0xf;			int lun=DONE_SC->device->lun & 0x7;#endif			Scsi_Cmnd *ptr = DONE_SC;			DONE_SC=NULL;			/* turn led off, when no commands are in the driver */			HOSTDATA(shpnt)->commands--;			if (!HOSTDATA(shpnt)->commands)				SETPORT(PORTA, 0);	/* turn led off */			if(ptr->scsi_done != reset_done) {				kfree(ptr->host_scribble);				ptr->host_scribble=NULL;			}			DO_UNLOCK(flags);			DPRINTK(debug_done, DEBUG_LEAD "calling scsi_done(%p)\n", hostno, id, lun, ptr);                	ptr->scsi_done(ptr);			DPRINTK(debug_done, DEBUG_LEAD "scsi_done(%p) returned\n", hostno, id, lun, ptr);			DO_LOCK(flags);		}		DONE_SC=NULL;#if defined(AHA152X_STAT)	} else {		HOSTDATA(shpnt)->busfree_without_done_command++;#endif	}	if(ISSUE_SC)		CURRENT_SC = remove_first_SC(&ISSUE_SC);	DO_UNLOCK(flags);	if(CURRENT_SC) {#if defined(AHA152X_STAT)		action++;#endif	    	CURRENT_SC->SCp.phase |= selecting;		DPRINTK(debug_selection, DEBUG_LEAD "selecting target\n", CMDINFO(CURRENT_SC));		/* clear selection timeout */		SETPORT(SSTAT1, SELTO);		SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id);		SETPORT(SXFRCTL1, (PARITY ? ENSPCHK : 0 ) | ENSTIMER);		SETPORT(SCSISEQ, ENSELO | ENAUTOATNO | (DISCONNECTED_SC ? ENRESELI : 0));	} else {#if defined(AHA152X_STAT)		HOSTDATA(shpnt)->busfree_without_new_command++;#endif		SETPORT(SCSISEQ, DISCONNECTED_SC ? ENRESELI : 0);	}#if defined(AHA152X_STAT)	if(!action)		HOSTDATA(shpnt)->busfree_without_any_action++;#endif}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/db9dff366ba78085d0323364fadbf09bec0e77ee/aha152x.c/clean/drivers/scsi/aha152x.c