Lines Matching defs: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)) {
1988 struct ata_taskfile tf;
2008 ata_tf_init(dev, &tf);
2009 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2010 tf.protocol = ATA_PROT_NODATA;
2011 tf.command = ATA_CMD_STANDBYNOW1;
2015 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2034 struct ata_taskfile tf;
2048 ata_tf_init(dev, &tf);
2049 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2050 tf.protocol = ATA_PROT_NODATA;
2051 tf.command = ATA_CMD_VERIFY;
2052 tf.nsect = 1;
2054 tf.flags |= ATA_TFLAG_LBA;
2055 tf.device |= ATA_LBA;
2058 tf.lbal = 0x1; /* sect */
2063 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2089 struct ata_taskfile tf;
2103 ata_tf_init(dev, &tf);
2106 tf.command = ATA_CMD_READ_LOG_DMA_EXT;
2107 tf.protocol = ATA_PROT_DMA;
2110 tf.command = ATA_CMD_READ_LOG_EXT;
2111 tf.protocol = ATA_PROT_PIO;
2114 tf.lbal = log;
2115 tf.lbam = page;
2116 tf.nsect = sectors;
2117 tf.hob_nsect = sectors >> 8;
2118 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
2120 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
4454 struct ata_taskfile tf;
4462 ata_tf_init(dev, &tf);
4463 tf.command = ATA_CMD_SET_FEATURES;
4464 tf.feature = SETFEATURES_XFER;
4465 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
4466 tf.protocol = ATA_PROT_NODATA;
4469 tf.nsect = dev->xfer_mode;
4472 tf.nsect = 0x01;
4480 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);
4499 struct ata_taskfile tf;
4505 ata_tf_init(dev, &tf);
4506 tf.command = ATA_CMD_SET_FEATURES;
4507 tf.feature = subcmd;
4508 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4509 tf.protocol = ATA_PROT_NODATA;
4510 tf.nsect = action;
4516 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout);
4535 struct ata_taskfile tf;
4545 ata_tf_init(dev, &tf);
4546 tf.command = ATA_CMD_INIT_DEV_PARAMS;
4547 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4548 tf.protocol = ATA_PROT_NODATA;
4549 tf.nsect = sectors;
4550 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */
4552 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
4556 if (err_mask == AC_ERR_DEV && (tf.error & ATA_ABORTED))
4612 if (ata_is_ncq(qc->tf.protocol)) {
4766 if (ata_is_ncq(qc->tf.protocol)) {
4795 qc->result_tf.flags = qc->tf.flags;
4803 if (!ata_is_data(qc->tf.protocol))
4806 if ((dev->mwdma_mask || dev->udma_mask) && ata_is_pio(qc->tf.protocol))
4834 ledtrig_disk_activity(!!(qc->tf.flags & ATA_TFLAG_WRITE));
4900 switch (qc->tf.command) {
4902 if (qc->tf.feature != SETFEATURES_WC_ON &&
4903 qc->tf.feature != SETFEATURES_WC_OFF &&
4904 qc->tf.feature != SETFEATURES_RA_ON &&
4905 qc->tf.feature != SETFEATURES_RA_OFF)
4967 u8 prot = qc->tf.protocol;