Lines Matching refs:tf

597  *	@tf: taskfile to examine and configure
599 * Examine the device configuration and tf->flags to determine
600 * the proper read/write command and protocol to use for @tf.
606 struct ata_taskfile *tf)
612 fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0;
613 lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0;
614 write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0;
617 tf->protocol = ATA_PROT_PIO;
621 tf->protocol = ATA_PROT_PIO;
624 tf->protocol = ATA_PROT_DMA;
632 tf->command = cmd;
639 * @tf: ATA taskfile of interest
640 * @dev: ATA device @tf belongs to
645 * Read block address from @tf. This function can handle all
646 * three address formats - LBA, LBA48 and CHS. tf->protocol and
650 * Block address read from @tf.
652 u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev)
656 if (tf->flags & ATA_TFLAG_LBA) {
657 if (tf->flags & ATA_TFLAG_LBA48) {
658 block |= (u64)tf->hob_lbah << 40;
659 block |= (u64)tf->hob_lbam << 32;
660 block |= (u64)tf->hob_lbal << 24;
662 block |= (tf->device & 0xf) << 24;
664 block |= tf->lbah << 16;
665 block |= tf->lbam << 8;
666 block |= tf->lbal;
670 cyl = tf->lbam | (tf->lbah << 8);
671 head = tf->device & 0xf;
672 sect = tf->lbal;
691 struct ata_taskfile *tf = &qc->tf;
693 if (tf->protocol == ATA_PROT_NCQ)
694 tf->auxiliary |= cdl;
696 tf->feature |= cdl;
729 struct ata_taskfile *tf = &qc->tf;
732 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
733 tf->flags |= tf_flags;
740 tf->protocol = ATA_PROT_NCQ;
741 tf->flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
743 if (tf->flags & ATA_TFLAG_WRITE)
744 tf->command = ATA_CMD_FPDMA_WRITE;
746 tf->command = ATA_CMD_FPDMA_READ;
748 tf->nsect = qc->hw_tag << 3;
749 tf->hob_feature = (n_block >> 8) & 0xff;
750 tf->feature = n_block & 0xff;
752 tf->hob_lbah = (block >> 40) & 0xff;
753 tf->hob_lbam = (block >> 32) & 0xff;
754 tf->hob_lbal = (block >> 24) & 0xff;
755 tf->lbah = (block >> 16) & 0xff;
756 tf->lbam = (block >> 8) & 0xff;
757 tf->lbal = block & 0xff;
759 tf->device = ATA_LBA;
760 if (tf->flags & ATA_TFLAG_FUA)
761 tf->device |= 1 << 7;
765 tf->hob_nsect |= ATA_PRIO_HIGH << ATA_SHIFT_PRIO;
771 tf->flags |= ATA_TFLAG_LBA;
777 if (!(tf->flags & ATA_TFLAG_FUA) &&
781 tf->device |= (block >> 24) & 0xf;
787 tf->flags |= ATA_TFLAG_LBA48;
789 tf->hob_nsect = (n_block >> 8) & 0xff;
791 tf->hob_lbah = (block >> 40) & 0xff;
792 tf->hob_lbam = (block >> 32) & 0xff;
793 tf->hob_lbal = (block >> 24) & 0xff;
799 if (unlikely(!ata_set_rwcmd_protocol(dev, tf)))
802 tf->nsect = n_block & 0xff;
804 tf->lbah = (block >> 16) & 0xff;
805 tf->lbam = (block >> 8) & 0xff;
806 tf->lbal = block & 0xff;
808 tf->device |= ATA_LBA;
817 if (unlikely(!ata_set_rwcmd_protocol(dev, tf)))
833 tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */
834 tf->lbal = sect;
835 tf->lbam = cyl;
836 tf->lbah = cyl >> 8;
837 tf->device |= head;
1033 * @tf: ATA taskfile register set for device to be identified
1046 unsigned int ata_dev_classify(const struct ata_taskfile *tf)
1069 if (tf->lbam == 0 && tf->lbah == 0)
1072 if (tf->lbam == 0x14 && tf->lbah == 0xeb)
1075 if (tf->lbam == 0x69 && tf->lbah == 0x96)
1078 if (tf->lbam == 0x3c && tf->lbah == 0xc3)
1081 if (tf->lbam == 0xcd && tf->lbah == 0xab)
1170 u64 ata_tf_to_lba48(const struct ata_taskfile *tf)
1174 sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40;
1175 sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32;
1176 sectors |= ((u64)(tf->hob_lbal & 0xff)) << 24;
1177 sectors |= (tf->lbah & 0xff) << 16;
1178 sectors |= (tf->lbam & 0xff) << 8;
1179 sectors |= (tf->lbal & 0xff);
1184 u64 ata_tf_to_lba(const struct ata_taskfile *tf)
1188 sectors |= (tf->device & 0x0f) << 24;
1189 sectors |= (tf->lbah & 0xff) << 16;
1190 sectors |= (tf->lbam & 0xff) << 8;
1191 sectors |= (tf->lbal & 0xff);
1211 struct ata_taskfile tf;
1214 ata_tf_init(dev, &tf);
1217 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1220 tf.command = ATA_CMD_READ_NATIVE_MAX_EXT;
1221 tf.flags |= ATA_TFLAG_LBA48;
1223 tf.command = ATA_CMD_READ_NATIVE_MAX;
1225 tf.protocol = ATA_PROT_NODATA;
1226 tf.device |= ATA_LBA;
1228 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1233 if (err_mask == AC_ERR_DEV && (tf.error & ATA_ABORTED))
1239 *max_sectors = ata_tf_to_lba48(&tf) + 1;
1241 *max_sectors = ata_tf_to_lba(&tf) + 1;
1262 struct ata_taskfile tf;
1267 ata_tf_init(dev, &tf);
1269 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1272 tf.command = ATA_CMD_SET_MAX_EXT;
1273 tf.flags |= ATA_TFLAG_LBA48;
1275 tf.hob_lbal = (new_sectors >> 24) & 0xff;
1276 tf.hob_lbam = (new_sectors >> 32) & 0xff;
1277 tf.hob_lbah = (new_sectors >> 40) & 0xff;
1279 tf.command = ATA_CMD_SET_MAX;
1281 tf.device |= (new_sectors >> 24) & 0xf;
1284 tf.protocol = ATA_PROT_NODATA;
1285 tf.device |= ATA_LBA;
1287 tf.lbal = (new_sectors >> 0) & 0xff;
1288 tf.lbam = (new_sectors >> 8) & 0xff;
1289 tf.lbah = (new_sectors >> 16) & 0xff;
1291 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1297 (tf.error & (ATA_ABORTED | ATA_IDNF)))
1503 * @tf: Taskfile registers for the command and the result
1510 * Executes libata internal command with timeout. @tf contains
1522 unsigned int ata_exec_internal(struct ata_device *dev, struct ata_taskfile *tf,
1529 u8 command = tf->command;
1573 qc->tf = *tf;
1578 if (tf->protocol == ATAPI_PROT_DMA && (dev->flags & ATA_DFLAG_DMADIR) &&
1580 qc->tf.feature |= ATAPI_DMADIR;
1643 } else if (qc->tf.command == ATA_CMD_REQ_SENSE_DATA) {
1650 *tf = qc->result_tf;
1727 * @tf: proposed taskfile
1735 struct ata_taskfile *tf, __le16 *id)
1737 return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
1768 struct ata_taskfile tf;
1776 ata_tf_init(dev, &tf);
1784 tf.command = ATA_CMD_ID_ATA;
1787 tf.command = ATA_CMD_ID_ATAPI;
1795 tf.protocol = ATA_PROT_PIO;
1800 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1805 tf.flags |= ATA_TFLAG_POLLING;
1808 err_mask = ap->ops->read_id(dev, &tf, (__le16 *)id);
1810 err_mask = ata_do_dev_read_id(dev, &tf, (__le16 *)id);
1826 if ((err_mask == AC_ERR_DEV) && (tf.error & ATA_ABORTED)) {
1949 bool ata_dev_power_init_tf(struct ata_device *dev, struct ata_taskfile *tf,
1956 ata_tf_init(dev, tf);
1957 tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1958 tf->protocol = ATA_PROT_NODATA;
1962 tf->command = ATA_CMD_VERIFY;
1963 tf->nsect = 1;
1965 tf->flags |= ATA_TFLAG_LBA;
1966 tf->device |= ATA_LBA;
1969 tf->lbal = 0x1; /* sect */
1972 tf->command = ATA_CMD_STANDBYNOW1;
1980 struct ata_taskfile tf;
1983 ata_tf_init(dev, &tf);
1984 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1985 tf.protocol = ATA_PROT_NODATA;
1986 tf.command = ATA_CMD_CHK_POWER;
1988 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1999 ata_dev_dbg(dev, "Power mode: 0x%02x\n", tf.nsect);
2002 return tf.nsect == 0xff;
2018 struct ata_taskfile tf;
2040 if (!ata_dev_power_init_tf(dev, &tf, false))
2045 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2064 struct ata_taskfile tf;
2071 if (!ata_dev_power_init_tf(dev, &tf, true))
2083 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2109 struct ata_taskfile tf;
2123 ata_tf_init(dev, &tf);
2126 tf.command = ATA_CMD_READ_LOG_DMA_EXT;
2127 tf.protocol = ATA_PROT_DMA;
2130 tf.command = ATA_CMD_READ_LOG_EXT;
2131 tf.protocol = ATA_PROT_PIO;
2134 tf.lbal = log;
2135 tf.lbam = page;
2136 tf.nsect = sectors;
2137 tf.hob_nsect = sectors >> 8;
2138 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
2140 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
4516 struct ata_taskfile tf;
4524 ata_tf_init(dev, &tf);
4525 tf.command = ATA_CMD_SET_FEATURES;
4526 tf.feature = SETFEATURES_XFER;
4527 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
4528 tf.protocol = ATA_PROT_NODATA;
4531 tf.nsect = dev->xfer_mode;
4534 tf.nsect = 0x01;
4542 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);
4561 struct ata_taskfile tf;
4567 ata_tf_init(dev, &tf);
4568 tf.command = ATA_CMD_SET_FEATURES;
4569 tf.feature = subcmd;
4570 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4571 tf.protocol = ATA_PROT_NODATA;
4572 tf.nsect = action;
4578 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout);
4597 struct ata_taskfile tf;
4607 ata_tf_init(dev, &tf);
4608 tf.command = ATA_CMD_INIT_DEV_PARAMS;
4609 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4610 tf.protocol = ATA_PROT_NODATA;
4611 tf.nsect = sectors;
4612 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */
4614 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
4618 if (err_mask == AC_ERR_DEV && (tf.error & ATA_ABORTED))
4674 if (ata_is_ncq(qc->tf.protocol)) {
4823 if (ata_is_ncq(qc->tf.protocol)) {
4860 qc->result_tf.flags = qc->tf.flags;
4869 if (!ata_is_data(qc->tf.protocol))
4872 if ((dev->mwdma_mask || dev->udma_mask) && ata_is_pio(qc->tf.protocol))
4900 ledtrig_disk_activity(!!(qc->tf.flags & ATA_TFLAG_WRITE));
4966 switch (qc->tf.command) {
4968 if (qc->tf.feature != SETFEATURES_WC_ON &&
4969 qc->tf.feature != SETFEATURES_WC_OFF &&
4970 qc->tf.feature != SETFEATURES_RA_ON &&
4971 qc->tf.feature != SETFEATURES_RA_OFF)
5033 u8 prot = qc->tf.protocol;