11 #include <linux/types.h>
12 #include <linux/string.h>
13 #include <linux/kernel.h>
14 #include <linux/export.h>
15 #include <linux/sched.h>
17 #include <linux/errno.h>
18 #include <linux/slab.h>
47 printk(
"%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x "
48 "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n",
49 s, cmd->
tf.feature, cmd->
tf.nsect,
50 cmd->
tf.lbal, cmd->
tf.lbam, cmd->
tf.lbah,
51 cmd->
tf.device, cmd->
tf.command);
52 printk(
"%s: hob: nsect 0x%02x lbal 0x%02x lbam 0x%02x lbah 0x%02x\n",
53 s, cmd->
hob.nsect, cmd->
hob.lbal, cmd->
hob.lbam, cmd->
hob.lbah);
61 memset(&cmd, 0,
sizeof(cmd));
90 pr_err(
"%s: multimode not set!\n", drive->
name);
97 memcpy(cmd, orig_cmd,
sizeof(*cmd));
114 cmd->
tf.device &= HIHI;
127 return pre_task_out_intr(drive, cmd);
129 handler = task_pio_intr;
133 handler = task_no_data_intr;
160 stat = hwif->
tp_ops->read_status(hwif);
161 if ((stat &
ATA_BUSY) == 0 || retries-- == 0)
179 return ide_error(drive,
"task_no_data_intr", stat);
189 if (blk_pm_request(rq))
208 for (retries = 0; retries < 1000; retries++) {
209 stat = hwif->
tp_ops->read_status(hwif);
218 pr_err(
"%s: drive still BUSY!\n", drive->
name);
224 unsigned int write,
unsigned int len)
245 page = sg_page(cursg);
249 page = nth_page(page, (offset >>
PAGE_SHIFT));
252 page_is_high = PageHighMem(page);
258 cmd->
nleft -= nr_bytes;
268 hwif->
tp_ops->output_data(drive, cmd, buf, nr_bytes);
270 hwif->
tp_ops->input_data(drive, cmd, buf, nr_bytes);
285 unsigned int nr_bytes;
334 if (err == 0 && set_xfer) {
349 u8 stat = hwif->
tp_ops->read_status(hwif);
371 if (((stat & ATA_DRQ) == 0) ^ (cmd->
nleft == 0))
375 if (write && cmd->
nleft == 0)
379 ide_pio_datablock(drive, cmd, write);
382 if (write == 0 && cmd->
nleft == 0) {
383 stat = wait_drive_not_busy(drive);
400 ide_error_cmd(drive, cmd);
411 pr_err(
"%s: no DRQ after issuing %sWRITE%s\n", drive->
name,
422 ide_pio_datablock(drive, cmd, 1);
435 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
469 #ifdef CONFIG_IDE_TASK_IOCTL
479 unsigned int taskin = 0;
480 unsigned int taskout = 0;
485 if (IS_ERR(req_task))
486 return PTR_ERR(req_task);
491 if (taskin > 65536 || taskout > 65536) {
497 int outtotal = tasksize;
499 if (outbuf ==
NULL) {
510 int intotal = tasksize + taskout;
522 memset(&cmd, 0,
sizeof(cmd));
583 pr_err(
"%s: %s Multimode Write multcount is not set\n",
584 drive->
name, __func__);
602 pr_err(
"%s: %s Multimode Read multcount is not set\n",
603 drive->
name, __func__);
628 nsect = (cmd.
hob.nsect << 8) | cmd.
tf.nsect;
631 pr_err(
"%s: in/out command without data\n",
655 int outtotal = tasksize;
662 int intotal = tasksize + taskout;