print_Scsi_Cmnd (cmd); 
scsi_print_command(cmd); 
int NCR5380_abort (Scsi_Cmnd *cmd){    struct Scsi_Host *instance = cmd->device->host;    SETUP_HOSTDATA(instance);    Scsi_Cmnd *tmp, **prev;    unsigned long flags;    printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);    print_Scsi_Cmnd (cmd);    NCR5380_print_status (instance);    local_irq_save(flags);        if (!IS_A_TT() && !falcon_got_lock)	printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_abort\n",	       HOSTNO);    ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,		NCR5380_read(BUS_AND_STATUS_REG),		NCR5380_read(STATUS_REG));#if 1/*  * Case 1 : If the command is the currently executing command,  * we'll set the aborted flag and return control so that  * information transfer routine can exit cleanly. */    if (hostdata->connected == cmd) {	ABRT_PRINTK("scsi%d: aborting connected command\n", HOSTNO);/* * We should perform BSY checking, and make sure we haven't slipped * into BUS FREE. *//*	NCR5380_write(INITIATOR_COMMAND_REG, ICR_ASSERT_ATN); *//*  * Since we can't change phases until we've completed the current  * handshake, we have to source or sink a byte of data if the current * phase is not MSGOUT. *//*  * Return control to the executing NCR drive so we can clear the * aborted flag and get back into our main loop. */ 	if (do_abort(instance) == 0) {	  hostdata->aborted = 1;	  hostdata->connected = NULL;	  cmd->result = DID_ABORT << 16;#ifdef SUPPORT_TAGS	  cmd_free_tag( cmd );#else	  hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);#endif	  local_irq_restore(flags);	  cmd->scsi_done(cmd);	  falcon_release_lock_if_possible( hostdata );	  return SCSI_ABORT_SUCCESS;	} else {/*	  local_irq_restore(flags); */	  printk("scsi%d: abort of connected command failed!\n", HOSTNO);	  return SCSI_ABORT_ERROR;	}    }#endif/*  * Case 2 : If the command hasn't been issued yet, we simply remove it  * 	    from the issue queue. */    for (prev = (Scsi_Cmnd **) &(hostdata->issue_queue), 	tmp = (Scsi_Cmnd *) hostdata->issue_queue;	tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )	if (cmd == tmp) {	    REMOVE(5, *prev, tmp, NEXT(tmp));	    (*prev) = NEXT(tmp);	    NEXT(tmp) = NULL;	    tmp->result = DID_ABORT << 16;	    local_irq_restore(flags);	    ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",			HOSTNO);	    /* Tagged queuing note: no tag to free here, hasn't been assigned	     * yet... */	    tmp->scsi_done(tmp);	    falcon_release_lock_if_possible( hostdata );	    return SCSI_ABORT_SUCCESS;	}/*  * Case 3 : If any commands are connected, we're going to fail the abort *	    and let the high level SCSI driver retry at a later time or  *	    issue a reset. * *	    Timeouts, and therefore aborted commands, will be highly unlikely *          and handling them cleanly in this situation would make the common *	    case of noresets less efficient, and would pollute our code.  So, *	    we fail. */    if (hostdata->connected) {	local_irq_restore(flags);	ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);        return SCSI_ABORT_SNOOZE;    }/* * Case 4: If the command is currently disconnected from the bus, and  * 	there are no connected commands, we reconnect the I_T_L or  *	I_T_L_Q nexus associated with it, go into message out, and send  *      an abort message. * * This case is especially ugly. In order to reestablish the nexus, we * need to call NCR5380_select().  The easiest way to implement this  * function was to abort if the bus was busy, and let the interrupt * handler triggered on the SEL for reselect take care of lost arbitrations * where necessary, meaning interrupts need to be enabled. * * When interrupts are enabled, the queues may change - so we  * can't remove it from the disconnected queue before selecting it * because that could cause a failure in hashing the nexus if that  * device reselected. *  * Since the queues may change, we can't use the pointers from when we * first locate it. * * So, we must first locate the command, and if NCR5380_select() * succeeds, then issue the abort, relocate the command and remove * it from the disconnected queue. */    for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp;	 tmp = NEXT(tmp))         if (cmd == tmp) {            local_irq_restore(flags);	    ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);              if (NCR5380_select (instance, cmd, (int) cmd->tag)) 		return SCSI_ABORT_BUSY;	    ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);	    do_abort (instance);	    local_irq_save(flags);	    for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), 		tmp = (Scsi_Cmnd *) hostdata->disconnected_queue;		tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )		    if (cmd == tmp) {		    REMOVE(5, *prev, tmp, NEXT(tmp));		    *prev = NEXT(tmp);		    NEXT(tmp) = NULL;		    tmp->result = DID_ABORT << 16;		    /* We must unlock the tag/LUN immediately here, since the		     * target goes to BUS FREE and doesn't send us another		     * message (COMMAND_COMPLETE or the like)		     */#ifdef SUPPORT_TAGS		    cmd_free_tag( tmp );#else		    hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);#endif		    local_irq_restore(flags);		    tmp->scsi_done(tmp);		    falcon_release_lock_if_possible( hostdata );		    return SCSI_ABORT_SUCCESS;		}	}/* * Case 5 : If we reached this point, the command was not found in any of  *	    the queues. * * We probably reached this point because of an unlikely race condition * between the command completing successfully and the abortion code, * so we won't panic, but we will notify the user in case something really * broke. */    local_irq_restore(flags);    printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n"           KERN_INFO "        before abortion\n", HOSTNO); /* Maybe it is sufficient just to release the ST-DMA lock... (if * possible at all) At least, we should check if the lock could be * released after the abort, in case it is kept due to some bug. */    falcon_release_lock_if_possible( hostdata );    return SCSI_ABORT_NOT_RUNNING;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1409277c4aad2e87ad27b2b8a6901ce78eaf8081/atari_NCR5380.c/clean/drivers/scsi/atari_NCR5380.c