 /* Use polling pio if the LLD doesn't handle * interrupt driven pio and atapi CDB interrupt. */ if (ap->flags & ATA_FLAG_PIO_POLLING) { switch (qc->tf.protocol) { case ATA_PROT_PIO: case ATA_PROT_ATAPI: case ATA_PROT_ATAPI_NODATA: qc->tf.flags |= ATA_TFLAG_POLLING; break; case ATA_PROT_ATAPI_DMA: if (qc->dev->flags & ATA_DFLAG_CDB_INTR) BUG(); break; default: break; } } 
int ata_qc_issue_prot(struct ata_queued_cmd *qc){	struct ata_port *ap = qc->ap;	/* select the device */	ata_dev_select(ap, qc->dev->devno, 1, 0);	/* start the command */	switch (qc->tf.protocol) {	case ATA_PROT_NODATA:		if (qc->tf.flags & ATA_TFLAG_POLLING)			ata_qc_set_polling(qc);		ata_tf_to_host_nolock(ap, &qc->tf);		ap->hsm_task_state = HSM_ST_LAST;		if (qc->tf.flags & ATA_TFLAG_POLLING)			queue_work(ata_wq, &ap->pio_task);		break;	case ATA_PROT_DMA:		assert(!(qc->tf.flags & ATA_TFLAG_POLLING));		ap->ops->tf_load(ap, &qc->tf);	 /* load tf registers */		ap->ops->bmdma_setup(qc);	    /* set up bmdma */		ap->ops->bmdma_start(qc);	    /* initiate bmdma */		ap->hsm_task_state = HSM_ST_LAST;		break;	case ATA_PROT_PIO:		if (qc->tf.flags & ATA_TFLAG_POLLING)			ata_qc_set_polling(qc);		ata_tf_to_host_nolock(ap, &qc->tf);		if (qc->tf.flags & ATA_TFLAG_POLLING) {			/* polling PIO */			ap->hsm_task_state = HSM_ST;			queue_work(ata_wq, &ap->pio_task);		} else {			/* interrupt driven PIO */			if (qc->tf.flags & ATA_TFLAG_WRITE) {				/* PIO data out protocol */				ap->hsm_task_state = HSM_ST_FIRST;				queue_work(ata_wq, &ap->packet_task);				/* send first data block by polling */			} else {				/* PIO data in protocol */				ap->hsm_task_state = HSM_ST;				/* interrupt handler takes over from here */			}		}		break;	case ATA_PROT_ATAPI:		if (qc->tf.flags & ATA_TFLAG_POLLING)			ata_qc_set_polling(qc);		ata_tf_to_host_nolock(ap, &qc->tf);		ap->hsm_task_state = HSM_ST_FIRST;		/* send cdb by polling if no cdb interrupt */		if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) ||		    (qc->tf.flags & ATA_TFLAG_POLLING))			queue_work(ata_wq, &ap->packet_task);		break;	case ATA_PROT_ATAPI_NODATA:		if (qc->tf.flags & ATA_TFLAG_POLLING)			ata_qc_set_polling(qc);		ata_tf_to_host_nolock(ap, &qc->tf);		ap->hsm_task_state = HSM_ST_FIRST;		/* send cdb by polling if no cdb interrupt */		if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) ||		    (qc->tf.flags & ATA_TFLAG_POLLING))			queue_work(ata_wq, &ap->packet_task);		break;	case ATA_PROT_ATAPI_DMA:		assert(!(qc->tf.flags & ATA_TFLAG_POLLING));		ap->ops->tf_load(ap, &qc->tf);	 /* load tf registers */		ap->ops->bmdma_setup(qc);	    /* set up bmdma */		ap->hsm_task_state = HSM_ST_FIRST;		/* send cdb by polling if no cdb interrupt */		if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))			queue_work(ata_wq, &ap->packet_task);		break;	default:		WARN_ON(1);		return -1;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/e50362eccd8809a224cda5f71714a088ba37b2ab/libata-core.c/clean/drivers/scsi/libata-core.c