• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/ata/

Lines Matching refs:tf

112  *	@tf: Taskfile to convert
123 void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp)
128 fis[2] = tf->command;
129 fis[3] = tf->feature;
131 fis[4] = tf->lbal;
132 fis[5] = tf->lbam;
133 fis[6] = tf->lbah;
134 fis[7] = tf->device;
136 fis[8] = tf->hob_lbal;
137 fis[9] = tf->hob_lbam;
138 fis[10] = tf->hob_lbah;
139 fis[11] = tf->hob_feature;
141 fis[12] = tf->nsect;
142 fis[13] = tf->hob_nsect;
144 fis[15] = tf->ctl;
155 * @tf: Taskfile to output
163 void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf)
165 tf->command = fis[2]; /* status */
166 tf->feature = fis[3]; /* error */
168 tf->lbal = fis[4];
169 tf->lbam = fis[5];
170 tf->lbah = fis[6];
171 tf->device = fis[7];
173 tf->hob_lbal = fis[8];
174 tf->hob_lbam = fis[9];
175 tf->hob_lbah = fis[10];
177 tf->nsect = fis[12];
178 tf->hob_nsect = fis[13];
213 * @tf: command to examine and configure
214 * @dev: device tf belongs to
216 * Examine the device configuration and tf->flags to calculate
222 static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev)
228 fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0;
229 lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0;
230 write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0;
233 tf->protocol = ATA_PROT_PIO;
237 tf->protocol = ATA_PROT_PIO;
240 tf->protocol = ATA_PROT_DMA;
246 tf->command = cmd;
254 * @tf: ATA taskfile of interest
255 * @dev: ATA device @tf belongs to
260 * Read block address from @tf. This function can handle all
261 * three address formats - LBA, LBA48 and CHS. tf->protocol and
265 * Block address read from @tf.
267 u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
271 if (tf->flags & ATA_TFLAG_LBA) {
272 if (tf->flags & ATA_TFLAG_LBA48) {
273 block |= (u64)tf->hob_lbah << 40;
274 block |= (u64)tf->hob_lbam << 32;
275 block |= tf->hob_lbal << 24;
277 block |= (tf->device & 0xf) << 24;
279 block |= tf->lbah << 16;
280 block |= tf->lbam << 8;
281 block |= tf->lbal;
285 cyl = tf->lbam | (tf->lbah << 8);
286 head = tf->device & 0xf;
287 sect = tf->lbal;
297 * @tf: Target ATA taskfile
298 * @dev: ATA device @tf belongs to
307 * Build ATA taskfile @tf for read/write request described by
315 int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
319 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
320 tf->flags |= tf_flags;
327 tf->protocol = ATA_PROT_NCQ;
328 tf->flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
330 if (tf->flags & ATA_TFLAG_WRITE)
331 tf->command = ATA_CMD_FPDMA_WRITE;
333 tf->command = ATA_CMD_FPDMA_READ;
335 tf->nsect = tag << 3;
336 tf->hob_feature = (n_block >> 8) & 0xff;
337 tf->feature = n_block & 0xff;
339 tf->hob_lbah = (block >> 40) & 0xff;
340 tf->hob_lbam = (block >> 32) & 0xff;
341 tf->hob_lbal = (block >> 24) & 0xff;
342 tf->lbah = (block >> 16) & 0xff;
343 tf->lbam = (block >> 8) & 0xff;
344 tf->lbal = block & 0xff;
346 tf->device = 1 << 6;
347 if (tf->flags & ATA_TFLAG_FUA)
348 tf->device |= 1 << 7;
350 tf->flags |= ATA_TFLAG_LBA;
354 tf->device |= (block >> 24) & 0xf;
360 tf->flags |= ATA_TFLAG_LBA48;
362 tf->hob_nsect = (n_block >> 8) & 0xff;
364 tf->hob_lbah = (block >> 40) & 0xff;
365 tf->hob_lbam = (block >> 32) & 0xff;
366 tf->hob_lbal = (block >> 24) & 0xff;
371 if (unlikely(ata_rwcmd_protocol(tf, dev) < 0))
374 tf->nsect = n_block & 0xff;
376 tf->lbah = (block >> 16) & 0xff;
377 tf->lbam = (block >> 8) & 0xff;
378 tf->lbal = block & 0xff;
380 tf->device |= ATA_LBA;
389 if (unlikely(ata_rwcmd_protocol(tf, dev) < 0))
408 tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */
409 tf->lbal = sect;
410 tf->lbam = cyl;
411 tf->lbah = cyl >> 8;
412 tf->device |= head;
657 * @tf: ATA taskfile register set for device to be identified
671 unsigned int ata_dev_classify(const struct ata_taskfile *tf)
678 if (((tf->lbam == 0) && (tf->lbah == 0)) ||
679 ((tf->lbam == 0x3c) && (tf->lbah == 0xc3))) {
684 if (((tf->lbam == 0x14) && (tf->lbah == 0xeb)) ||
685 ((tf->lbam == 0x69) && (tf->lbah == 0x96))) {
719 struct ata_taskfile tf;
725 memset(&tf, 0, sizeof(tf));
727 ap->ops->tf_read(ap, &tf);
728 err = tf.feature;
744 class = ata_dev_classify(&tf);
816 static u64 ata_tf_to_lba48(struct ata_taskfile *tf)
820 sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40;
821 sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32;
822 sectors |= (tf->hob_lbal & 0xff) << 24;
823 sectors |= (tf->lbah & 0xff) << 16;
824 sectors |= (tf->lbam & 0xff) << 8;
825 sectors |= (tf->lbal & 0xff);
830 static u64 ata_tf_to_lba(struct ata_taskfile *tf)
834 sectors |= (tf->device & 0x0f) << 24;
835 sectors |= (tf->lbah & 0xff) << 16;
836 sectors |= (tf->lbam & 0xff) << 8;
837 sectors |= (tf->lbal & 0xff);
853 struct ata_taskfile tf;
855 ata_tf_init(dev, &tf);
857 tf.command = ATA_CMD_READ_NATIVE_MAX_EXT;
858 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 | ATA_TFLAG_ISADDR;
859 tf.protocol |= ATA_PROT_NODATA;
860 tf.device |= 0x40;
862 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
866 return ata_tf_to_lba48(&tf);
880 struct ata_taskfile tf;
882 ata_tf_init(dev, &tf);
884 tf.command = ATA_CMD_READ_NATIVE_MAX;
885 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
886 tf.protocol |= ATA_PROT_NODATA;
887 tf.device |= 0x40;
889 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
893 return ata_tf_to_lba(&tf);
908 struct ata_taskfile tf;
912 ata_tf_init(dev, &tf);
914 tf.command = ATA_CMD_SET_MAX_EXT;
915 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 | ATA_TFLAG_ISADDR;
916 tf.protocol |= ATA_PROT_NODATA;
917 tf.device |= 0x40;
919 tf.lbal = (new_sectors >> 0) & 0xff;
920 tf.lbam = (new_sectors >> 8) & 0xff;
921 tf.lbah = (new_sectors >> 16) & 0xff;
923 tf.hob_lbal = (new_sectors >> 24) & 0xff;
924 tf.hob_lbam = (new_sectors >> 32) & 0xff;
925 tf.hob_lbah = (new_sectors >> 40) & 0xff;
927 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
931 return ata_tf_to_lba48(&tf);
946 struct ata_taskfile tf;
950 ata_tf_init(dev, &tf);
952 tf.command = ATA_CMD_SET_MAX;
953 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
954 tf.protocol |= ATA_PROT_NODATA;
956 tf.lbal = (new_sectors >> 0) & 0xff;
957 tf.lbam = (new_sectors >> 8) & 0xff;
958 tf.lbah = (new_sectors >> 16) & 0xff;
959 tf.device |= ((new_sectors >> 24) & 0x0f) | 0x40;
961 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
965 return ata_tf_to_lba(&tf);
1338 * @tf: Taskfile registers for the command and the result
1344 * Executes libata internal command with timeout. @tf contains
1357 struct ata_taskfile *tf, const u8 *cdb,
1362 u8 command = tf->command;
1404 qc->tf = *tf;
1473 *tf = qc->result_tf;
1494 * @tf: Taskfile registers for the command and the result
1510 struct ata_taskfile *tf, const u8 *cdb,
1523 return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem);
1542 struct ata_taskfile tf;
1544 ata_tf_init(dev, &tf);
1546 tf.command = cmd;
1547 tf.flags |= ATA_TFLAG_DEVICE;
1548 tf.protocol = ATA_PROT_NODATA;
1550 return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
1623 struct ata_taskfile tf;
1634 ata_tf_init(dev, &tf);
1638 tf.command = ATA_CMD_ID_ATA;
1641 tf.command = ATA_CMD_ID_ATAPI;
1649 tf.protocol = ATA_PROT_PIO;
1654 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1659 tf.flags |= ATA_TFLAG_POLLING;
1661 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
1675 (err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) {
1716 ata_tf_init(dev, &tf);
1717 tf.command = ATA_CMD_SET_FEATURES;
1718 tf.feature = SETFEATURES_SPINUP;
1719 tf.protocol = ATA_PROT_NODATA;
1720 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1721 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
2895 * @tf: ATA taskfile register set
2906 const struct ata_taskfile *tf)
2908 ap->ops->tf_load(ap, tf);
2909 ap->ops->exec_command(ap, tf);
3908 struct ata_taskfile tf;
3917 ata_tf_init(dev, &tf);
3918 tf.command = ATA_CMD_SET_FEATURES;
3919 tf.feature = SETFEATURES_XFER;
3920 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
3921 tf.protocol = ATA_PROT_NODATA;
3922 tf.nsect = dev->xfer_mode;
3924 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
3945 struct ata_taskfile tf;
3955 ata_tf_init(dev, &tf);
3956 tf.command = ATA_CMD_INIT_DEV_PARAMS;
3957 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
3958 tf.protocol = ATA_PROT_NODATA;
3959 tf.nsect = sectors;
3960 tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */
3962 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
3996 if (qc->pad_len && !(qc->tf.flags & ATA_TFLAG_WRITE))
4207 if (qc->tf.flags & ATA_TFLAG_WRITE)
4240 qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
4288 if (qc->tf.flags & ATA_TFLAG_WRITE) {
4426 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
4443 DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
4483 if (is_multi_taskfile(&qc->tf)) {
4518 switch (qc->tf.protocol) {
4547 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
4596 DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
4642 int i_write, do_write = (qc->tf.flags & ATA_TFLAG_WRITE) ? 1 : 0;
4688 if (qc->tf.flags & ATA_TFLAG_POLLING)
4692 if (qc->tf.protocol == ATA_PROT_PIO &&
4693 (qc->tf.flags & ATA_TFLAG_WRITE))
4696 if (is_atapi_taskfile(&qc->tf) &&
4774 * in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING).
4780 ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);
4790 poll_next = (qc->tf.flags & ATA_TFLAG_POLLING);
4828 if (qc->tf.protocol == ATA_PROT_PIO) {
4854 if (qc->tf.protocol == ATA_PROT_ATAPI) {
4918 if (!(qc->tf.flags & ATA_TFLAG_WRITE)) {
4938 (!(qc->tf.flags & ATA_TFLAG_WRITE))) {
5122 if (qc->tf.protocol == ATA_PROT_NCQ)
5142 qc->result_tf.flags = qc->tf.flags;
5246 switch (qc->tf.protocol) {
5288 if (qc->tf.protocol == ATA_PROT_NCQ) {
5351 switch (qc->tf.protocol) {
5356 qc->tf.flags |= ATA_TFLAG_POLLING;
5372 switch (qc->tf.protocol) {
5374 if (qc->tf.flags & ATA_TFLAG_POLLING)
5377 ata_tf_to_host(ap, &qc->tf);
5380 if (qc->tf.flags & ATA_TFLAG_POLLING)
5386 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
5388 ap->ops->tf_load(ap, &qc->tf); /* load tf registers */
5395 if (qc->tf.flags & ATA_TFLAG_POLLING)
5398 ata_tf_to_host(ap, &qc->tf);
5400 if (qc->tf.flags & ATA_TFLAG_WRITE) {
5412 if (qc->tf.flags & ATA_TFLAG_POLLING)
5424 if (qc->tf.flags & ATA_TFLAG_POLLING)
5427 ata_tf_to_host(ap, &qc->tf);
5433 (qc->tf.flags & ATA_TFLAG_POLLING))
5438 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
5440 ap->ops->tf_load(ap, &qc->tf); /* load tf registers */
5480 ap->print_id, qc->tf.protocol, ap->hsm_task_state);
5491 * No need to check is_atapi_taskfile(&qc->tf) again.
5497 if (qc->tf.protocol == ATA_PROT_DMA ||
5498 qc->tf.protocol == ATA_PROT_ATAPI_DMA) {
5539 if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA ||
5540 qc->tf.protocol == ATA_PROT_ATAPI_DMA))
5592 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&