ahd_linux_handle_scsi_status(ahd, dev, scb); } else if (ahd_get_transaction_status(scb) == CAM_SEL_TIMEOUT) { dev->flags |= AHD_DEV_UNCONFIGURED; if (AHD_DV_CMD(cmd) == FALSE) dev->target->flags &= ~AHD_DV_REQUIRED; 
ahd_linux_handle_scsi_status(ahd, cmd->device, scb); 
ahd_done(struct ahd_softc *ahd, struct scb *scb){	Scsi_Cmnd *cmd;	struct	  ahd_linux_device *dev;	if ((scb->flags & SCB_ACTIVE) == 0) {		printf("SCB %d done'd twice\n", SCB_GET_TAG(scb));		ahd_dump_card_state(ahd);		panic("Stopping for safety");	}	LIST_REMOVE(scb, pending_links);	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--;	}	ahd_linux_unmap_scb(ahd, 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 (ahd_get_transaction_status(scb) == CAM_REQ_INPROG) {		uint32_t amount_xferred;		amount_xferred =		    ahd_get_transfer_length(scb) - ahd_get_residual(scb);		if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) {#ifdef AHD_DEBUG			if ((ahd_debug & AHD_SHOW_MISC) != 0) {				ahd_print_path(ahd, scb);				printf("Set CAM_UNCOR_PARITY\n");			}#endif			ahd_set_transaction_status(scb, CAM_UNCOR_PARITY);#ifdef AHD_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;			ahd_print_path(ahd, scb);			printf("CDB:");			for (i = 0; i < scb->io_ctx->cmd_len; i++)				printf(" 0x%x", scb->io_ctx->cmnd[i]);			printf("\n");			ahd_print_path(ahd, scb);			printf("Saw underflow (%ld of %ld bytes). "			       "Treated as error\n",				ahd_get_residual(scb),				ahd_get_transfer_length(scb));			ahd_set_transaction_status(scb, CAM_DATA_RUN_ERR);#endif		} else {			ahd_set_transaction_status(scb, CAM_REQ_CMP);		}	} else if (ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {		ahd_linux_handle_scsi_status(ahd, dev, scb);	} else if (ahd_get_transaction_status(scb) == CAM_SEL_TIMEOUT) {		dev->flags |= AHD_DEV_UNCONFIGURED;		if (AHD_DV_CMD(cmd) == FALSE)			dev->target->flags &= ~AHD_DV_REQUIRED;	}	/*	 * Start DV for devices that require it assuming the first command	 * sent does not result in a selection timeout.	 */	if (ahd_get_transaction_status(scb) != CAM_SEL_TIMEOUT	 && (dev->target->flags & AHD_DV_REQUIRED) != 0)		ahd_linux_start_dv(ahd);	if (dev->openings == 1	 && ahd_get_transaction_status(scb) == CAM_REQ_CMP	 && ahd_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 > AHD_TAG_SUCCESS_INTERVAL) {		dev->tag_success_count = 0;		dev->openings++;	}	if (dev->active == 0)		dev->commands_since_idle_or_otag = 0;	if ((dev->flags & AHD_DEV_UNCONFIGURED) != 0	    && dev->active == 0	    && (dev->flags & AHD_DEV_TIMER_ACTIVE) == 0)		ahd_linux_free_device(ahd, dev);	if ((scb->flags & SCB_RECOVERY_SCB) != 0) {		printf("Recovery SCB completes\n");		if (ahd_get_transaction_status(scb) == CAM_BDR_SENT		 || ahd_get_transaction_status(scb) == CAM_REQ_ABORTED)			ahd_set_transaction_status(scb, CAM_CMD_TIMEOUT);		if ((scb->platform_data->flags & AHD_SCB_UP_EH_SEM) != 0) {			scb->platform_data->flags &= ~AHD_SCB_UP_EH_SEM;			up(&ahd->platform_data->eh_sem);		}	}	ahd_free_scb(ahd, scb);	ahd_linux_queue_cmd_complete(ahd, cmd);	if ((ahd->platform_data->flags & AHD_DV_WAIT_SIMQ_EMPTY) != 0	 && LIST_FIRST(&ahd->pending_scbs) == NULL) {		ahd->platform_data->flags &= ~AHD_DV_WAIT_SIMQ_EMPTY;		up(&ahd->platform_data->dv_sem);	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/73a25462100772b72a5d62fd66dff01b53018618/aic79xx_osm.c/buggy/drivers/scsi/aic7xxx/aic79xx_osm.c