Lines Matching refs:tf

580 static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev)  in ata_rwcmd_protocol()  argument
586 fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0; in ata_rwcmd_protocol()
587 lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; in ata_rwcmd_protocol()
588 write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; in ata_rwcmd_protocol()
591 tf->protocol = ATA_PROT_PIO; in ata_rwcmd_protocol()
595 tf->protocol = ATA_PROT_PIO; in ata_rwcmd_protocol()
598 tf->protocol = ATA_PROT_DMA; in ata_rwcmd_protocol()
604 tf->command = cmd; in ata_rwcmd_protocol()
625 u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) in ata_tf_read_block() argument
629 if (tf->flags & ATA_TFLAG_LBA) { in ata_tf_read_block()
630 if (tf->flags & ATA_TFLAG_LBA48) { in ata_tf_read_block()
631 block |= (u64)tf->hob_lbah << 40; in ata_tf_read_block()
632 block |= (u64)tf->hob_lbam << 32; in ata_tf_read_block()
633 block |= (u64)tf->hob_lbal << 24; in ata_tf_read_block()
635 block |= (tf->device & 0xf) << 24; in ata_tf_read_block()
637 block |= tf->lbah << 16; in ata_tf_read_block()
638 block |= tf->lbam << 8; in ata_tf_read_block()
639 block |= tf->lbal; in ata_tf_read_block()
643 cyl = tf->lbam | (tf->lbah << 8); in ata_tf_read_block()
644 head = tf->device & 0xf; in ata_tf_read_block()
645 sect = tf->lbal; in ata_tf_read_block()
680 int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, in ata_build_rw_tf() argument
684 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; in ata_build_rw_tf()
685 tf->flags |= tf_flags; in ata_build_rw_tf()
692 tf->protocol = ATA_PROT_NCQ; in ata_build_rw_tf()
693 tf->flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48; in ata_build_rw_tf()
695 if (tf->flags & ATA_TFLAG_WRITE) in ata_build_rw_tf()
696 tf->command = ATA_CMD_FPDMA_WRITE; in ata_build_rw_tf()
698 tf->command = ATA_CMD_FPDMA_READ; in ata_build_rw_tf()
700 tf->nsect = tag << 3; in ata_build_rw_tf()
701 tf->hob_feature = (n_block >> 8) & 0xff; in ata_build_rw_tf()
702 tf->feature = n_block & 0xff; in ata_build_rw_tf()
704 tf->hob_lbah = (block >> 40) & 0xff; in ata_build_rw_tf()
705 tf->hob_lbam = (block >> 32) & 0xff; in ata_build_rw_tf()
706 tf->hob_lbal = (block >> 24) & 0xff; in ata_build_rw_tf()
707 tf->lbah = (block >> 16) & 0xff; in ata_build_rw_tf()
708 tf->lbam = (block >> 8) & 0xff; in ata_build_rw_tf()
709 tf->lbal = block & 0xff; in ata_build_rw_tf()
711 tf->device = ATA_LBA; in ata_build_rw_tf()
712 if (tf->flags & ATA_TFLAG_FUA) in ata_build_rw_tf()
713 tf->device |= 1 << 7; in ata_build_rw_tf()
717 tf->hob_nsect |= ATA_PRIO_HIGH << ATA_SHIFT_PRIO; in ata_build_rw_tf()
719 tf->flags |= ATA_TFLAG_LBA; in ata_build_rw_tf()
723 tf->device |= (block >> 24) & 0xf; in ata_build_rw_tf()
729 tf->flags |= ATA_TFLAG_LBA48; in ata_build_rw_tf()
731 tf->hob_nsect = (n_block >> 8) & 0xff; in ata_build_rw_tf()
733 tf->hob_lbah = (block >> 40) & 0xff; in ata_build_rw_tf()
734 tf->hob_lbam = (block >> 32) & 0xff; in ata_build_rw_tf()
735 tf->hob_lbal = (block >> 24) & 0xff; in ata_build_rw_tf()
740 if (unlikely(ata_rwcmd_protocol(tf, dev) < 0)) in ata_build_rw_tf()
743 tf->nsect = n_block & 0xff; in ata_build_rw_tf()
745 tf->lbah = (block >> 16) & 0xff; in ata_build_rw_tf()
746 tf->lbam = (block >> 8) & 0xff; in ata_build_rw_tf()
747 tf->lbal = block & 0xff; in ata_build_rw_tf()
749 tf->device |= ATA_LBA; in ata_build_rw_tf()
758 if (unlikely(ata_rwcmd_protocol(tf, dev) < 0)) in ata_build_rw_tf()
777 tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */ in ata_build_rw_tf()
778 tf->lbal = sect; in ata_build_rw_tf()
779 tf->lbam = cyl; in ata_build_rw_tf()
780 tf->lbah = cyl >> 8; in ata_build_rw_tf()
781 tf->device |= head; in ata_build_rw_tf()
990 unsigned int ata_dev_classify(const struct ata_taskfile *tf) in ata_dev_classify() argument
1013 if ((tf->lbam == 0) && (tf->lbah == 0)) { in ata_dev_classify()
1018 if ((tf->lbam == 0x14) && (tf->lbah == 0xeb)) { in ata_dev_classify()
1023 if ((tf->lbam == 0x69) && (tf->lbah == 0x96)) { in ata_dev_classify()
1028 if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3)) { in ata_dev_classify()
1033 if ((tf->lbam == 0xcd) && (tf->lbah == 0xab)) { in ata_dev_classify()
1125 u64 ata_tf_to_lba48(const struct ata_taskfile *tf) in ata_tf_to_lba48() argument
1129 sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40; in ata_tf_to_lba48()
1130 sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32; in ata_tf_to_lba48()
1131 sectors |= ((u64)(tf->hob_lbal & 0xff)) << 24; in ata_tf_to_lba48()
1132 sectors |= (tf->lbah & 0xff) << 16; in ata_tf_to_lba48()
1133 sectors |= (tf->lbam & 0xff) << 8; in ata_tf_to_lba48()
1134 sectors |= (tf->lbal & 0xff); in ata_tf_to_lba48()
1139 u64 ata_tf_to_lba(const struct ata_taskfile *tf) in ata_tf_to_lba() argument
1143 sectors |= (tf->device & 0x0f) << 24; in ata_tf_to_lba()
1144 sectors |= (tf->lbah & 0xff) << 16; in ata_tf_to_lba()
1145 sectors |= (tf->lbam & 0xff) << 8; in ata_tf_to_lba()
1146 sectors |= (tf->lbal & 0xff); in ata_tf_to_lba()
1166 struct ata_taskfile tf; in ata_read_native_max_address() local
1169 ata_tf_init(dev, &tf); in ata_read_native_max_address()
1172 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; in ata_read_native_max_address()
1175 tf.command = ATA_CMD_READ_NATIVE_MAX_EXT; in ata_read_native_max_address()
1176 tf.flags |= ATA_TFLAG_LBA48; in ata_read_native_max_address()
1178 tf.command = ATA_CMD_READ_NATIVE_MAX; in ata_read_native_max_address()
1180 tf.protocol = ATA_PROT_NODATA; in ata_read_native_max_address()
1181 tf.device |= ATA_LBA; in ata_read_native_max_address()
1183 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); in ata_read_native_max_address()
1188 if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED)) in ata_read_native_max_address()
1194 *max_sectors = ata_tf_to_lba48(&tf) + 1; in ata_read_native_max_address()
1196 *max_sectors = ata_tf_to_lba(&tf) + 1; in ata_read_native_max_address()
1217 struct ata_taskfile tf; in ata_set_max_sectors() local
1222 ata_tf_init(dev, &tf); in ata_set_max_sectors()
1224 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; in ata_set_max_sectors()
1227 tf.command = ATA_CMD_SET_MAX_EXT; in ata_set_max_sectors()
1228 tf.flags |= ATA_TFLAG_LBA48; in ata_set_max_sectors()
1230 tf.hob_lbal = (new_sectors >> 24) & 0xff; in ata_set_max_sectors()
1231 tf.hob_lbam = (new_sectors >> 32) & 0xff; in ata_set_max_sectors()
1232 tf.hob_lbah = (new_sectors >> 40) & 0xff; in ata_set_max_sectors()
1234 tf.command = ATA_CMD_SET_MAX; in ata_set_max_sectors()
1236 tf.device |= (new_sectors >> 24) & 0xf; in ata_set_max_sectors()
1239 tf.protocol = ATA_PROT_NODATA; in ata_set_max_sectors()
1240 tf.device |= ATA_LBA; in ata_set_max_sectors()
1242 tf.lbal = (new_sectors >> 0) & 0xff; in ata_set_max_sectors()
1243 tf.lbam = (new_sectors >> 8) & 0xff; in ata_set_max_sectors()
1244 tf.lbah = (new_sectors >> 16) & 0xff; in ata_set_max_sectors()
1246 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); in ata_set_max_sectors()
1252 (tf.feature & (ATA_ABORTED | ATA_IDNF))) in ata_set_max_sectors()
1495 struct ata_taskfile *tf, const u8 *cdb, in ata_exec_internal_sg() argument
1501 u8 command = tf->command; in ata_exec_internal_sg()
1541 qc->tf = *tf; in ata_exec_internal_sg()
1546 if (tf->protocol == ATAPI_PROT_DMA && (dev->flags & ATA_DFLAG_DMADIR) && in ata_exec_internal_sg()
1548 qc->tf.feature |= ATAPI_DMADIR; in ata_exec_internal_sg()
1627 } else if (qc->tf.command == ATA_CMD_REQ_SENSE_DATA) { in ata_exec_internal_sg()
1634 *tf = qc->result_tf; in ata_exec_internal_sg()
1671 struct ata_taskfile *tf, const u8 *cdb, in ata_exec_internal() argument
1685 return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem, in ata_exec_internal()
1757 struct ata_taskfile *tf, u16 *id) in ata_do_dev_read_id() argument
1759 return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE, in ata_do_dev_read_id()
1790 struct ata_taskfile tf; in ata_dev_read_id() local
1801 ata_tf_init(dev, &tf); in ata_dev_read_id()
1809 tf.command = ATA_CMD_ID_ATA; in ata_dev_read_id()
1812 tf.command = ATA_CMD_ID_ATAPI; in ata_dev_read_id()
1820 tf.protocol = ATA_PROT_PIO; in ata_dev_read_id()
1825 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; in ata_dev_read_id()
1830 tf.flags |= ATA_TFLAG_POLLING; in ata_dev_read_id()
1833 err_mask = ap->ops->read_id(dev, &tf, id); in ata_dev_read_id()
1835 err_mask = ata_do_dev_read_id(dev, &tf, id); in ata_dev_read_id()
1851 if ((err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { in ata_dev_read_id()
1995 struct ata_taskfile tf; in ata_read_log_page() local
2009 ata_tf_init(dev, &tf); in ata_read_log_page()
2012 tf.command = ATA_CMD_READ_LOG_DMA_EXT; in ata_read_log_page()
2013 tf.protocol = ATA_PROT_DMA; in ata_read_log_page()
2016 tf.command = ATA_CMD_READ_LOG_EXT; in ata_read_log_page()
2017 tf.protocol = ATA_PROT_PIO; in ata_read_log_page()
2020 tf.lbal = log; in ata_read_log_page()
2021 tf.lbam = page; in ata_read_log_page()
2022 tf.nsect = sectors; in ata_read_log_page()
2023 tf.hob_nsect = sectors >> 8; in ata_read_log_page()
2024 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; in ata_read_log_page()
2026 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, in ata_read_log_page()
4323 struct ata_taskfile tf; in ata_dev_set_xfermode() local
4332 ata_tf_init(dev, &tf); in ata_dev_set_xfermode()
4333 tf.command = ATA_CMD_SET_FEATURES; in ata_dev_set_xfermode()
4334 tf.feature = SETFEATURES_XFER; in ata_dev_set_xfermode()
4335 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING; in ata_dev_set_xfermode()
4336 tf.protocol = ATA_PROT_NODATA; in ata_dev_set_xfermode()
4339 tf.nsect = dev->xfer_mode; in ata_dev_set_xfermode()
4342 tf.nsect = 0x01; in ata_dev_set_xfermode()
4347 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000); in ata_dev_set_xfermode()
4370 struct ata_taskfile tf; in ata_dev_set_feature() local
4377 ata_tf_init(dev, &tf); in ata_dev_set_feature()
4378 tf.command = ATA_CMD_SET_FEATURES; in ata_dev_set_feature()
4379 tf.feature = enable; in ata_dev_set_feature()
4380 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; in ata_dev_set_feature()
4381 tf.protocol = ATA_PROT_NODATA; in ata_dev_set_feature()
4382 tf.nsect = feature; in ata_dev_set_feature()
4387 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout); in ata_dev_set_feature()
4409 struct ata_taskfile tf; in ata_dev_init_params() local
4419 ata_tf_init(dev, &tf); in ata_dev_init_params()
4420 tf.command = ATA_CMD_INIT_DEV_PARAMS; in ata_dev_init_params()
4421 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; in ata_dev_init_params()
4422 tf.protocol = ATA_PROT_NODATA; in ata_dev_init_params()
4423 tf.nsect = sectors; in ata_dev_init_params()
4424 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */ in ata_dev_init_params()
4426 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); in ata_dev_init_params()
4430 if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED)) in ata_dev_init_params()
4487 if (ata_is_ncq(qc->tf.protocol)) { in ata_std_qc_defer()
4692 if (ata_is_ncq(qc->tf.protocol)) { in __ata_qc_complete()
4721 qc->result_tf.flags = qc->tf.flags; in fill_result_tf()
4729 if (!ata_is_data(qc->tf.protocol)) in ata_verify_xfer()
4732 if ((dev->mwdma_mask || dev->udma_mask) && ata_is_pio(qc->tf.protocol)) in ata_verify_xfer()
4758 ledtrig_disk_activity(!!(qc->tf.flags & ATA_TFLAG_WRITE)); in ata_qc_complete()
4812 switch (qc->tf.command) { in ata_qc_complete()
4814 if (qc->tf.feature != SETFEATURES_WC_ON && in ata_qc_complete()
4815 qc->tf.feature != SETFEATURES_WC_OFF && in ata_qc_complete()
4816 qc->tf.feature != SETFEATURES_RA_ON && in ata_qc_complete()
4817 qc->tf.feature != SETFEATURES_RA_OFF) in ata_qc_complete()
4889 u8 prot = qc->tf.protocol; in ata_qc_issue()