if (qc->nsect == 0) /* we don't support length==0 cmds */ return 1; 
static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd){	struct ata_taskfile *tf = &qc->tf;	unsigned int lba48 = tf->flags & ATA_TFLAG_LBA48;	tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;	tf->protocol = qc->dev->xfer_protocol;	tf->device |= ATA_LBA;	if (scsicmd[0] == READ_10 || scsicmd[0] == READ_6 ||	    scsicmd[0] == READ_16) {		tf->command = qc->dev->read_cmd;	} else {		tf->command = qc->dev->write_cmd;		tf->flags |= ATA_TFLAG_WRITE;	}	if (scsicmd[0] == READ_10 || scsicmd[0] == WRITE_10) {		if (lba48) {			tf->hob_nsect = scsicmd[7];			tf->hob_lbal = scsicmd[2];			qc->nsect = ((unsigned int)scsicmd[7] << 8) |					scsicmd[8];		} else {			/* if we don't support LBA48 addressing, the request			 * -may- be too large. */			if ((scsicmd[2] & 0xf0) || scsicmd[7])				return 1;			/* stores LBA27:24 in lower 4 bits of device reg */			tf->device |= scsicmd[2];			qc->nsect = scsicmd[8];		}		tf->nsect = scsicmd[8];		tf->lbal = scsicmd[5];		tf->lbam = scsicmd[4];		tf->lbah = scsicmd[3];		VPRINTK("ten-byte command\n");		return 0;	}	if (scsicmd[0] == READ_6 || scsicmd[0] == WRITE_6) {		qc->nsect = tf->nsect = scsicmd[4];		tf->lbal = scsicmd[3];		tf->lbam = scsicmd[2];		tf->lbah = scsicmd[1] & 0x1f; /* mask out reserved bits */		VPRINTK("six-byte command\n");		return 0;	}	if (scsicmd[0] == READ_16 || scsicmd[0] == WRITE_16) {		/* rule out impossible LBAs and sector counts */		if (scsicmd[2] || scsicmd[3] || scsicmd[10] || scsicmd[11])			return 1;		if (lba48) {			tf->hob_nsect = scsicmd[12];			tf->hob_lbal = scsicmd[6];			tf->hob_lbam = scsicmd[5];			tf->hob_lbah = scsicmd[4];			qc->nsect = ((unsigned int)scsicmd[12] << 8) |					scsicmd[13];		} else {			/* once again, filter out impossible non-zero values */			if (scsicmd[4] || scsicmd[5] || scsicmd[12] ||			    (scsicmd[6] & 0xf0))				return 1;			/* stores LBA27:24 in lower 4 bits of device reg */			tf->device |= scsicmd[6];			qc->nsect = scsicmd[13];		}		tf->nsect = scsicmd[13];		tf->lbal = scsicmd[9];		tf->lbam = scsicmd[8];		tf->lbah = scsicmd[7];		VPRINTK("sixteen-byte command\n");		return 0;	}	DPRINTK("no-byte command\n");	return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/135932651fd1eeb95eb6c5d4f6652aae73fe2c24/libata-scsi.c/clean/drivers/scsi/libata-scsi.c