Lines Matching refs:tf

579  *	@tf: taskfile to examine and configure
581 * Examine the device configuration and tf->flags to determine
582 * the proper read/write command and protocol to use for @tf.
588 struct ata_taskfile *tf)
594 fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0;
595 lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0;
596 write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0;
599 tf->protocol = ATA_PROT_PIO;
603 tf->protocol = ATA_PROT_PIO;
606 tf->protocol = ATA_PROT_DMA;
614 tf->command = cmd;
621 * @tf: ATA taskfile of interest
622 * @dev: ATA device @tf belongs to
627 * Read block address from @tf. This function can handle all
628 * three address formats - LBA, LBA48 and CHS. tf->protocol and
632 * Block address read from @tf.
634 u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev)
638 if (tf->flags & ATA_TFLAG_LBA) {
639 if (tf->flags & ATA_TFLAG_LBA48) {
640 block |= (u64)tf->hob_lbah << 40;
641 block |= (u64)tf->hob_lbam << 32;
642 block |= (u64)tf->hob_lbal << 24;
644 block |= (tf->device & 0xf) << 24;
646 block |= tf->lbah << 16;
647 block |= tf->lbam << 8;
648 block |= tf->lbal;
652 cyl = tf->lbam | (tf->lbah << 8);
653 head = tf->device & 0xf;
654 sect = tf->lbal;
673 struct ata_taskfile *tf = &qc->tf;
675 if (tf->protocol == ATA_PROT_NCQ)
676 tf->auxiliary |= cdl;
678 tf->feature |= cdl;
711 struct ata_taskfile *tf = &qc->tf;
714 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
715 tf->flags |= tf_flags;
722 tf->protocol = ATA_PROT_NCQ;
723 tf->flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
725 if (tf->flags & ATA_TFLAG_WRITE)
726 tf->command = ATA_CMD_FPDMA_WRITE;
728 tf->command = ATA_CMD_FPDMA_READ;
730 tf->nsect = qc->hw_tag << 3;
731 tf->hob_feature = (n_block >> 8) & 0xff;
732 tf->feature = n_block & 0xff;
734 tf->hob_lbah = (block >> 40) & 0xff;
735 tf->hob_lbam = (block >> 32) & 0xff;
736 tf->hob_lbal = (block >> 24) & 0xff;
737 tf->lbah = (block >> 16) & 0xff;
738 tf->lbam = (block >> 8) & 0xff;
739 tf->lbal = block & 0xff;
741 tf->device = ATA_LBA;
742 if (tf->flags & ATA_TFLAG_FUA)
743 tf->device |= 1 << 7;
747 tf->hob_nsect |= ATA_PRIO_HIGH << ATA_SHIFT_PRIO;
753 tf->flags |= ATA_TFLAG_LBA;
759 if (!(tf->flags & ATA_TFLAG_FUA) &&
763 tf->device |= (block >> 24) & 0xf;
769 tf->flags |= ATA_TFLAG_LBA48;
771 tf->hob_nsect = (n_block >> 8) & 0xff;
773 tf->hob_lbah = (block >> 40) & 0xff;
774 tf->hob_lbam = (block >> 32) & 0xff;
775 tf->hob_lbal = (block >> 24) & 0xff;
781 if (unlikely(!ata_set_rwcmd_protocol(dev, tf)))
784 tf->nsect = n_block & 0xff;
786 tf->lbah = (block >> 16) & 0xff;
787 tf->lbam = (block >> 8) & 0xff;
788 tf->lbal = block & 0xff;
790 tf->device |= ATA_LBA;
799 if (unlikely(!ata_set_rwcmd_protocol(dev, tf)))
815 tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */
816 tf->lbal = sect;
817 tf->lbam = cyl;
818 tf->lbah = cyl >> 8;
819 tf->device |= head;
1015 * @tf: ATA taskfile register set for device to be identified
1028 unsigned int ata_dev_classify(const struct ata_taskfile *tf)
1051 if (tf->lbam == 0 && tf->lbah == 0)
1054 if (tf->lbam == 0x14 && tf->lbah == 0xeb)
1057 if (tf->lbam == 0x69 && tf->lbah == 0x96)
1060 if (tf->lbam == 0x3c && tf->lbah == 0xc3)
1063 if (tf->lbam == 0xcd && tf->lbah == 0xab)
1152 u64 ata_tf_to_lba48(const struct ata_taskfile *tf)
1156 sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40;
1157 sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32;
1158 sectors |= ((u64)(tf->hob_lbal & 0xff)) << 24;
1159 sectors |= (tf->lbah & 0xff) << 16;
1160 sectors |= (tf->lbam & 0xff) << 8;
1161 sectors |= (tf->lbal & 0xff);
1166 u64 ata_tf_to_lba(const struct ata_taskfile *tf)
1170 sectors |= (tf->device & 0x0f) << 24;
1171 sectors |= (tf->lbah & 0xff) << 16;
1172 sectors |= (tf->lbam & 0xff) << 8;
1173 sectors |= (tf->lbal & 0xff);
1193 struct ata_taskfile tf;
1196 ata_tf_init(dev, &tf);
1199 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1202 tf.command = ATA_CMD_READ_NATIVE_MAX_EXT;
1203 tf.flags |= ATA_TFLAG_LBA48;
1205 tf.command = ATA_CMD_READ_NATIVE_MAX;
1207 tf.protocol = ATA_PROT_NODATA;
1208 tf.device |= ATA_LBA;
1210 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1215 if (err_mask == AC_ERR_DEV && (tf.error & ATA_ABORTED))
1221 *max_sectors = ata_tf_to_lba48(&tf) + 1;
1223 *max_sectors = ata_tf_to_lba(&tf) + 1;
1244 struct ata_taskfile tf;
1249 ata_tf_init(dev, &tf);
1251 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1254 tf.command = ATA_CMD_SET_MAX_EXT;
1255 tf.flags |= ATA_TFLAG_LBA48;
1257 tf.hob_lbal = (new_sectors >> 24) & 0xff;
1258 tf.hob_lbam = (new_sectors >> 32) & 0xff;
1259 tf.hob_lbah = (new_sectors >> 40) & 0xff;
1261 tf.command = ATA_CMD_SET_MAX;
1263 tf.device |= (new_sectors >> 24) & 0xf;
1266 tf.protocol = ATA_PROT_NODATA;
1267 tf.device |= ATA_LBA;
1269 tf.lbal = (new_sectors >> 0) & 0xff;
1270 tf.lbam = (new_sectors >> 8) & 0xff;
1271 tf.lbah = (new_sectors >> 16) & 0xff;
1273 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1279 (tf.error & (ATA_ABORTED | ATA_IDNF)))
1485 * @tf: Taskfile registers for the command and the result
1492 * Executes libata internal command with timeout. @tf contains
1505 struct ata_taskfile *tf, const u8 *cdb,
1511 u8 command = tf->command;
1551 qc->tf = *tf;
1556 if (tf->protocol == ATAPI_PROT_DMA && (dev->flags & ATA_DFLAG_DMADIR) &&
1558 qc->tf.feature |= ATAPI_DMADIR;
1631 } else if (qc->tf.command == ATA_CMD_REQ_SENSE_DATA) {
1638 *tf = qc->result_tf;
1658 * @tf: Taskfile registers for the command and the result
1675 struct ata_taskfile *tf, const u8 *cdb,
1689 return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem,
1753 * @tf: proposed taskfile
1761 struct ata_taskfile *tf, __le16 *id)
1763 return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
1794 struct ata_taskfile tf;
1802 ata_tf_init(dev, &tf);
1810 tf.command = ATA_CMD_ID_ATA;
1813 tf.command = ATA_CMD_ID_ATAPI;
1821 tf.protocol = ATA_PROT_PIO;
1826 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1831 tf.flags |= ATA_TFLAG_POLLING;
1834 err_mask = ap->ops->read_id(dev, &tf, (__le16 *)id);
1836 err_mask = ata_do_dev_read_id(dev, &tf, (__le16 *)id);
1852 if ((err_mask == AC_ERR_DEV) && (tf.error & ATA_ABORTED)) {
1975 bool ata_dev_power_init_tf(struct ata_device *dev, struct ata_taskfile *tf,
1982 ata_tf_init(dev, tf);
1983 tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
1984 tf->protocol = ATA_PROT_NODATA;
1988 tf->command = ATA_CMD_VERIFY;
1989 tf->nsect = 1;
1991 tf->flags |= ATA_TFLAG_LBA;
1992 tf->device |= ATA_LBA;
1995 tf->lbal = 0x1; /* sect */
1998 tf->command = ATA_CMD_STANDBYNOW1;
2006 struct ata_taskfile tf;
2009 ata_tf_init(dev, &tf);
2010 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2011 tf.protocol = ATA_PROT_NODATA;
2012 tf.command = ATA_CMD_CHK_POWER;
2014 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2025 ata_dev_dbg(dev, "Power mode: 0x%02x\n", tf.nsect);
2028 return tf.nsect == 0xff;
2044 struct ata_taskfile tf;
2066 if (!ata_dev_power_init_tf(dev, &tf, false))
2071 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2090 struct ata_taskfile tf;
2097 if (!ata_dev_power_init_tf(dev, &tf, true))
2109 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2135 struct ata_taskfile tf;
2149 ata_tf_init(dev, &tf);
2152 tf.command = ATA_CMD_READ_LOG_DMA_EXT;
2153 tf.protocol = ATA_PROT_DMA;
2156 tf.command = ATA_CMD_READ_LOG_EXT;
2157 tf.protocol = ATA_PROT_PIO;
2160 tf.lbal = log;
2161 tf.lbam = page;
2162 tf.nsect = sectors;
2163 tf.hob_nsect = sectors >> 8;
2164 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
2166 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
4500 struct ata_taskfile tf;
4508 ata_tf_init(dev, &tf);
4509 tf.command = ATA_CMD_SET_FEATURES;
4510 tf.feature = SETFEATURES_XFER;
4511 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
4512 tf.protocol = ATA_PROT_NODATA;
4515 tf.nsect = dev->xfer_mode;
4518 tf.nsect = 0x01;
4526 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);
4545 struct ata_taskfile tf;
4551 ata_tf_init(dev, &tf);
4552 tf.command = ATA_CMD_SET_FEATURES;
4553 tf.feature = subcmd;
4554 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4555 tf.protocol = ATA_PROT_NODATA;
4556 tf.nsect = action;
4562 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout);
4581 struct ata_taskfile tf;
4591 ata_tf_init(dev, &tf);
4592 tf.command = ATA_CMD_INIT_DEV_PARAMS;
4593 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4594 tf.protocol = ATA_PROT_NODATA;
4595 tf.nsect = sectors;
4596 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */
4598 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
4602 if (err_mask == AC_ERR_DEV && (tf.error & ATA_ABORTED))
4658 if (ata_is_ncq(qc->tf.protocol)) {
4812 if (ata_is_ncq(qc->tf.protocol)) {
4841 qc->result_tf.flags = qc->tf.flags;
4849 if (!ata_is_data(qc->tf.protocol))
4852 if ((dev->mwdma_mask || dev->udma_mask) && ata_is_pio(qc->tf.protocol))
4880 ledtrig_disk_activity(!!(qc->tf.flags & ATA_TFLAG_WRITE));
4946 switch (qc->tf.command) {
4948 if (qc->tf.feature != SETFEATURES_WC_ON &&
4949 qc->tf.feature != SETFEATURES_WC_OFF &&
4950 qc->tf.feature != SETFEATURES_RA_ON &&
4951 qc->tf.feature != SETFEATURES_RA_OFF)
5013 u8 prot = qc->tf.protocol;