if (TAILQ_EMPTY(&dev->busyq)) { if ((dev->flags & AHC_DEV_UNCONFIGURED) != 0 && dev->active == 0 && (dev->flags & AHC_DEV_TIMER_ACTIVE) == 0) ahc_linux_free_device(ahc, dev); } else if ((dev->flags & AHC_DEV_ON_RUN_LIST) == 0) { 
if ((dev->flags & AHC_DEV_UNCONFIGURED) != 0 && dev->active == 0 && (dev->flags & AHC_DEV_TIMER_ACTIVE) == 0) ahc_linux_free_device(ahc, dev); else if ((dev->flags & AHC_DEV_ON_RUN_LIST) == 0) { 
ahc_done(struct ahc_softc *ahc, struct scb *scb){	Scsi_Cmnd *cmd;	struct	   ahc_linux_device *dev;	LIST_REMOVE(scb, pending_links);	if ((scb->flags & SCB_UNTAGGEDQ) != 0) {		struct scb_tailq *untagged_q;		int target_offset;		target_offset = SCB_GET_TARGET_OFFSET(ahc, scb);		untagged_q = &(ahc->untagged_queues[target_offset]);		TAILQ_REMOVE(untagged_q, scb, links.tqe);		ahc_run_untagged_queue(ahc, untagged_q);	}	if ((scb->flags & SCB_ACTIVE) == 0) {		printf("SCB %d done'd twice\n", scb->hscb->tag);		ahc_dump_card_state(ahc);		panic("Stopping for safety");	}	cmd = scb->io_ctx;	dev = scb->platform_data->dev;	dev->active--;	dev->openings++;	if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) {		cmd->result &= ~(CAM_DEV_QFRZN << 16);		dev->qfrozen--;	}	ahc_linux_unmap_scb(ahc, scb);	/*	 * Guard against stale sense data.	 * The Linux mid-layer assumes that sense	 * was retrieved anytime the first byte of	 * the sense buffer looks "sane".	 */	cmd->sense_buffer[0] = 0;	if (ahc_get_transaction_status(scb) == CAM_REQ_INPROG) {		uint32_t amount_xferred;		amount_xferred =		    ahc_get_transfer_length(scb) - ahc_get_residual(scb);		if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) {#ifdef AHC_DEBUG			if ((ahc_debug & AHC_SHOW_MISC) != 0) {				ahc_print_path(ahc, scb);				printf("Set CAM_UNCOR_PARITY\n");			}#endif			ahc_set_transaction_status(scb, CAM_UNCOR_PARITY);#ifdef AHC_REPORT_UNDERFLOWS		/*		 * This code is disabled by default as some		 * clients of the SCSI system do not properly		 * initialize the underflow parameter.  This		 * results in spurious termination of commands		 * that complete as expected (e.g. underflow is		 * allowed as command can return variable amounts		 * of data.		 */		} else if (amount_xferred < scb->io_ctx->underflow) {			u_int i;			ahc_print_path(ahc, scb);			printf("CDB:");			for (i = 0; i < scb->io_ctx->cmd_len; i++)				printf(" 0x%x", scb->io_ctx->cmnd[i]);			printf("\n");			ahc_print_path(ahc, scb);			printf("Saw underflow (%ld of %ld bytes). "			       "Treated as error\n",				ahc_get_residual(scb),				ahc_get_transfer_length(scb));			ahc_set_transaction_status(scb, CAM_DATA_RUN_ERR);#endif		} else {			ahc_set_transaction_status(scb, CAM_REQ_CMP);		}	} else if (ahc_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {		ahc_linux_handle_scsi_status(ahc, dev, scb);	} else if (ahc_get_transaction_status(scb) == CAM_SEL_TIMEOUT) {		dev->flags |= AHC_DEV_UNCONFIGURED;	}	if (dev->openings == 1	 && ahc_get_transaction_status(scb) == CAM_REQ_CMP	 && ahc_get_scsi_status(scb) != SCSI_STATUS_QUEUE_FULL)		dev->tag_success_count++;	/*	 * Some devices deal with temporary internal resource	 * shortages by returning queue full.  When the queue	 * full occurrs, we throttle back.  Slowly try to get	 * back to our previous queue depth.	 */	if ((dev->openings + dev->active) < dev->maxtags	 && dev->tag_success_count > AHC_TAG_SUCCESS_INTERVAL) {		dev->tag_success_count = 0;		dev->openings++;	}	if (dev->active == 0)		dev->commands_since_idle_or_otag = 0;	if (TAILQ_EMPTY(&dev->busyq)) {		if ((dev->flags & AHC_DEV_UNCONFIGURED) != 0		 && dev->active == 0	 	 && (dev->flags & AHC_DEV_TIMER_ACTIVE) == 0)			ahc_linux_free_device(ahc, dev);	} else if ((dev->flags & AHC_DEV_ON_RUN_LIST) == 0) {		TAILQ_INSERT_TAIL(&ahc->platform_data->device_runq, dev, links);		dev->flags |= AHC_DEV_ON_RUN_LIST;	}	if ((scb->flags & SCB_RECOVERY_SCB) != 0) {		printf("Recovery SCB completes\n");		if (ahc_get_transaction_status(scb) == CAM_BDR_SENT		 || ahc_get_transaction_status(scb) == CAM_REQ_ABORTED)			ahc_set_transaction_status(scb, CAM_CMD_TIMEOUT);		if ((ahc->platform_data->flags & AHC_UP_EH_SEMAPHORE) != 0) {			ahc->platform_data->flags &= ~AHC_UP_EH_SEMAPHORE;			up(&ahc->platform_data->eh_sem);		}	}	ahc_free_scb(ahc, scb);	ahc_linux_queue_cmd_complete(ahc, cmd);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/e4e360c325c90f7830baaa2a27cd7a1f2bdeb6b0/aic7xxx_osm.c/clean/drivers/scsi/aic7xxx/aic7xxx_osm.c