dc84f8bde52a81b159a29d43f3af82a34a3cf992
[deliverable/linux.git] / drivers / ide / ide-taskfile.c
1 /*
2 * Copyright (C) 2000-2002 Michael Cornwell <cornwell@acm.org>
3 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
4 * Copyright (C) 2001-2002 Klaus Smolin
5 * IBM Storage Technology Division
6 * Copyright (C) 2003-2004, 2007 Bartlomiej Zolnierkiewicz
7 *
8 * The big the bad and the ugly.
9 */
10
11 #include <linux/types.h>
12 #include <linux/string.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/interrupt.h>
16 #include <linux/errno.h>
17 #include <linux/slab.h>
18 #include <linux/delay.h>
19 #include <linux/hdreg.h>
20 #include <linux/ide.h>
21 #include <linux/scatterlist.h>
22
23 #include <asm/uaccess.h>
24 #include <asm/io.h>
25
26 void ide_tf_dump(const char *s, struct ide_taskfile *tf)
27 {
28 #ifdef DEBUG
29 printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x "
30 "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n",
31 s, tf->feature, tf->nsect, tf->lbal,
32 tf->lbam, tf->lbah, tf->device, tf->command);
33 printk("%s: hob: nsect 0x%02x lbal 0x%02x "
34 "lbam 0x%02x lbah 0x%02x\n",
35 s, tf->hob_nsect, tf->hob_lbal,
36 tf->hob_lbam, tf->hob_lbah);
37 #endif
38 }
39
40 int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
41 {
42 struct ide_cmd cmd;
43
44 memset(&cmd, 0, sizeof(cmd));
45 cmd.tf.nsect = 0x01;
46 if (drive->media == ide_disk)
47 cmd.tf.command = ATA_CMD_ID_ATA;
48 else
49 cmd.tf.command = ATA_CMD_ID_ATAPI;
50 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
51 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
52 cmd.protocol = ATA_PROT_PIO;
53
54 return ide_raw_taskfile(drive, &cmd, buf, 1);
55 }
56
57 static ide_startstop_t task_no_data_intr(ide_drive_t *);
58 static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct ide_cmd *);
59 static ide_startstop_t task_pio_intr(ide_drive_t *);
60
61 ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
62 {
63 ide_hwif_t *hwif = drive->hwif;
64 struct ide_cmd *cmd = &hwif->cmd;
65 struct ide_taskfile *tf = &cmd->tf;
66 ide_handler_t *handler = NULL;
67 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
68 const struct ide_dma_ops *dma_ops = hwif->dma_ops;
69
70 if (orig_cmd->protocol == ATA_PROT_PIO &&
71 (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) &&
72 drive->mult_count == 0) {
73 printk(KERN_ERR "%s: multimode not set!\n", drive->name);
74 return ide_stopped;
75 }
76
77 if (orig_cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
78 orig_cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS;
79
80 memcpy(cmd, orig_cmd, sizeof(*cmd));
81
82 if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
83 ide_tf_dump(drive->name, tf);
84 tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
85 SELECT_MASK(drive, 0);
86
87 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
88 u8 data[2] = { tf->data, tf->hob_data };
89
90 tp_ops->output_data(drive, cmd, data, 2);
91 }
92 tp_ops->tf_load(drive, cmd);
93 }
94
95 switch (cmd->protocol) {
96 case ATA_PROT_PIO:
97 if (cmd->tf_flags & IDE_TFLAG_WRITE) {
98 tp_ops->exec_command(hwif, tf->command);
99 ndelay(400); /* FIXME */
100 return pre_task_out_intr(drive, cmd);
101 }
102 handler = task_pio_intr;
103 /* fall-through */
104 case ATA_PROT_NODATA:
105 if (handler == NULL)
106 handler = task_no_data_intr;
107 ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE);
108 return ide_started;
109 case ATA_PROT_DMA:
110 if (ide_dma_prepare(drive, cmd))
111 return ide_stopped;
112 hwif->expiry = dma_ops->dma_timer_expiry;
113 ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD);
114 dma_ops->dma_start(drive);
115 default:
116 return ide_started;
117 }
118 }
119 EXPORT_SYMBOL_GPL(do_rw_taskfile);
120
121 static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
122 {
123 ide_hwif_t *hwif = drive->hwif;
124 struct ide_cmd *cmd = &hwif->cmd;
125 struct ide_taskfile *tf = &cmd->tf;
126 int custom = (cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) ? 1 : 0;
127 int retries = (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) ? 5 : 1;
128 u8 stat;
129
130 local_irq_enable_in_hardirq();
131
132 while (1) {
133 stat = hwif->tp_ops->read_status(hwif);
134 if ((stat & ATA_BUSY) == 0 || retries-- == 0)
135 break;
136 udelay(10);
137 };
138
139 if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
140 if (custom && tf->command == ATA_CMD_SET_MULTI) {
141 drive->mult_req = drive->mult_count = 0;
142 drive->special.b.recalibrate = 1;
143 (void)ide_dump_status(drive, __func__, stat);
144 return ide_stopped;
145 } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) {
146 if ((stat & (ATA_ERR | ATA_DRQ)) == 0) {
147 ide_set_handler(drive, &task_no_data_intr,
148 WAIT_WORSTCASE);
149 return ide_started;
150 }
151 }
152 return ide_error(drive, "task_no_data_intr", stat);
153 }
154
155 if (custom && tf->command == ATA_CMD_SET_MULTI)
156 drive->mult_count = drive->mult_req;
157
158 if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE ||
159 tf->command == ATA_CMD_CHK_POWER) {
160 struct request *rq = hwif->rq;
161
162 if (blk_pm_request(rq))
163 ide_complete_pm_rq(drive, rq);
164 else
165 ide_finish_cmd(drive, cmd, stat);
166 }
167
168 return ide_stopped;
169 }
170
171 static u8 wait_drive_not_busy(ide_drive_t *drive)
172 {
173 ide_hwif_t *hwif = drive->hwif;
174 int retries;
175 u8 stat;
176
177 /*
178 * Last sector was transfered, wait until device is ready. This can
179 * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms.
180 */
181 for (retries = 0; retries < 1000; retries++) {
182 stat = hwif->tp_ops->read_status(hwif);
183
184 if (stat & ATA_BUSY)
185 udelay(10);
186 else
187 break;
188 }
189
190 if (stat & ATA_BUSY)
191 printk(KERN_ERR "%s: drive still BUSY!\n", drive->name);
192
193 return stat;
194 }
195
196 void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
197 unsigned int write, unsigned int len)
198 {
199 ide_hwif_t *hwif = drive->hwif;
200 struct scatterlist *sg = hwif->sg_table;
201 struct scatterlist *cursg = cmd->cursg;
202 struct page *page;
203 unsigned long flags;
204 unsigned int offset;
205 u8 *buf;
206
207 cursg = cmd->cursg;
208 if (cursg == NULL)
209 cursg = cmd->cursg = sg;
210
211 while (len) {
212 unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs);
213
214 if (nr_bytes > PAGE_SIZE)
215 nr_bytes = PAGE_SIZE;
216
217 page = sg_page(cursg);
218 offset = cursg->offset + cmd->cursg_ofs;
219
220 /* get the current page and offset */
221 page = nth_page(page, (offset >> PAGE_SHIFT));
222 offset %= PAGE_SIZE;
223
224 if (PageHighMem(page))
225 local_irq_save(flags);
226
227 buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
228
229 cmd->nleft -= nr_bytes;
230 cmd->cursg_ofs += nr_bytes;
231
232 if (cmd->cursg_ofs == cursg->length) {
233 cursg = cmd->cursg = sg_next(cmd->cursg);
234 cmd->cursg_ofs = 0;
235 }
236
237 /* do the actual data transfer */
238 if (write)
239 hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes);
240 else
241 hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes);
242
243 kunmap_atomic(buf, KM_BIO_SRC_IRQ);
244
245 if (PageHighMem(page))
246 local_irq_restore(flags);
247
248 len -= nr_bytes;
249 }
250 }
251 EXPORT_SYMBOL_GPL(ide_pio_bytes);
252
253 static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
254 unsigned int write)
255 {
256 unsigned int nr_bytes;
257
258 u8 saved_io_32bit = drive->io_32bit;
259
260 if (cmd->tf_flags & IDE_TFLAG_FS)
261 cmd->rq->errors = 0;
262
263 if (cmd->tf_flags & IDE_TFLAG_IO_16BIT)
264 drive->io_32bit = 0;
265
266 touch_softlockup_watchdog();
267
268 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO)
269 nr_bytes = min_t(unsigned, cmd->nleft, drive->mult_count << 9);
270 else
271 nr_bytes = SECTOR_SIZE;
272
273 ide_pio_bytes(drive, cmd, write, nr_bytes);
274
275 drive->io_32bit = saved_io_32bit;
276 }
277
278 static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
279 {
280 if (cmd->tf_flags & IDE_TFLAG_FS) {
281 int nr_bytes = cmd->nbytes - cmd->nleft;
282
283 if (cmd->protocol == ATA_PROT_PIO &&
284 ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) {
285 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO)
286 nr_bytes -= drive->mult_count << 9;
287 else
288 nr_bytes -= SECTOR_SIZE;
289 }
290
291 if (nr_bytes > 0)
292 ide_complete_rq(drive, 0, nr_bytes);
293 }
294 }
295
296 void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
297 {
298 struct request *rq = drive->hwif->rq;
299 u8 err = ide_read_error(drive);
300
301 ide_complete_cmd(drive, cmd, stat, err);
302 rq->errors = err;
303 ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq));
304 }
305
306 /*
307 * Handler for command with PIO data phase.
308 */
309 static ide_startstop_t task_pio_intr(ide_drive_t *drive)
310 {
311 ide_hwif_t *hwif = drive->hwif;
312 struct ide_cmd *cmd = &drive->hwif->cmd;
313 u8 stat = hwif->tp_ops->read_status(hwif);
314 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
315
316 if (write == 0) {
317 /* Error? */
318 if (stat & ATA_ERR)
319 goto out_err;
320
321 /* Didn't want any data? Odd. */
322 if ((stat & ATA_DRQ) == 0) {
323 /* Command all done? */
324 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY))
325 goto out_end;
326
327 /* Assume it was a spurious irq */
328 goto out_wait;
329 }
330 } else {
331 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
332 goto out_err;
333
334 /* Deal with unexpected ATA data phase. */
335 if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0))
336 goto out_err;
337 }
338
339 if (write && cmd->nleft == 0)
340 goto out_end;
341
342 /* Still data left to transfer. */
343 ide_pio_datablock(drive, cmd, write);
344
345 /* Are we done? Check status and finish transfer. */
346 if (write == 0 && cmd->nleft == 0) {
347 stat = wait_drive_not_busy(drive);
348 if (!OK_STAT(stat, 0, BAD_STAT))
349 goto out_err;
350
351 goto out_end;
352 }
353 out_wait:
354 /* Still data left to transfer. */
355 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
356 return ide_started;
357 out_end:
358 if ((cmd->tf_flags & IDE_TFLAG_FS) == 0)
359 ide_finish_cmd(drive, cmd, stat);
360 else
361 ide_complete_rq(drive, 0, cmd->rq->nr_sectors << 9);
362 return ide_stopped;
363 out_err:
364 ide_error_cmd(drive, cmd);
365 return ide_error(drive, __func__, stat);
366 }
367
368 static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
369 struct ide_cmd *cmd)
370 {
371 ide_startstop_t startstop;
372
373 if (ide_wait_stat(&startstop, drive, ATA_DRQ,
374 drive->bad_wstat, WAIT_DRQ)) {
375 printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n",
376 drive->name,
377 (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "",
378 (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : "");
379 return startstop;
380 }
381
382 if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0)
383 local_irq_disable();
384
385 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
386
387 ide_pio_datablock(drive, cmd, 1);
388
389 return ide_started;
390 }
391
392 int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
393 u16 nsect)
394 {
395 struct request *rq;
396 int error;
397
398 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
399 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
400 rq->buffer = buf;
401
402 /*
403 * (ks) We transfer currently only whole sectors.
404 * This is suffient for now. But, it would be great,
405 * if we would find a solution to transfer any size.
406 * To support special commands like READ LONG.
407 */
408 rq->hard_nr_sectors = rq->nr_sectors = nsect;
409 rq->hard_cur_sectors = rq->current_nr_sectors = nsect;
410
411 if (cmd->tf_flags & IDE_TFLAG_WRITE)
412 rq->cmd_flags |= REQ_RW;
413
414 rq->special = cmd;
415 cmd->rq = rq;
416
417 error = blk_execute_rq(drive->queue, NULL, rq, 0);
418 blk_put_request(rq);
419
420 return error;
421 }
422
423 EXPORT_SYMBOL(ide_raw_taskfile);
424
425 int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
426 {
427 cmd->protocol = ATA_PROT_NODATA;
428
429 return ide_raw_taskfile(drive, cmd, NULL, 0);
430 }
431 EXPORT_SYMBOL_GPL(ide_no_data_taskfile);
432
433 #ifdef CONFIG_IDE_TASK_IOCTL
434 int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
435 {
436 ide_task_request_t *req_task;
437 struct ide_cmd cmd;
438 u8 *outbuf = NULL;
439 u8 *inbuf = NULL;
440 u8 *data_buf = NULL;
441 int err = 0;
442 int tasksize = sizeof(struct ide_task_request_s);
443 unsigned int taskin = 0;
444 unsigned int taskout = 0;
445 u16 nsect = 0;
446 char __user *buf = (char __user *)arg;
447
448 // printk("IDE Taskfile ...\n");
449
450 req_task = kzalloc(tasksize, GFP_KERNEL);
451 if (req_task == NULL) return -ENOMEM;
452 if (copy_from_user(req_task, buf, tasksize)) {
453 kfree(req_task);
454 return -EFAULT;
455 }
456
457 taskout = req_task->out_size;
458 taskin = req_task->in_size;
459
460 if (taskin > 65536 || taskout > 65536) {
461 err = -EINVAL;
462 goto abort;
463 }
464
465 if (taskout) {
466 int outtotal = tasksize;
467 outbuf = kzalloc(taskout, GFP_KERNEL);
468 if (outbuf == NULL) {
469 err = -ENOMEM;
470 goto abort;
471 }
472 if (copy_from_user(outbuf, buf + outtotal, taskout)) {
473 err = -EFAULT;
474 goto abort;
475 }
476 }
477
478 if (taskin) {
479 int intotal = tasksize + taskout;
480 inbuf = kzalloc(taskin, GFP_KERNEL);
481 if (inbuf == NULL) {
482 err = -ENOMEM;
483 goto abort;
484 }
485 if (copy_from_user(inbuf, buf + intotal, taskin)) {
486 err = -EFAULT;
487 goto abort;
488 }
489 }
490
491 memset(&cmd, 0, sizeof(cmd));
492
493 memcpy(&cmd.tf_array[0], req_task->hob_ports,
494 HDIO_DRIVE_HOB_HDR_SIZE - 2);
495 memcpy(&cmd.tf_array[6], req_task->io_ports,
496 HDIO_DRIVE_TASK_HDR_SIZE);
497
498 cmd.valid.out.tf = IDE_VALID_DEVICE;
499 cmd.valid.in.tf = IDE_VALID_DEVICE | IDE_VALID_IN_TF;
500 cmd.tf_flags = IDE_TFLAG_IO_16BIT;
501
502 if (drive->dev_flags & IDE_DFLAG_LBA48) {
503 cmd.tf_flags |= IDE_TFLAG_LBA48;
504 cmd.valid.in.hob = IDE_VALID_IN_HOB;
505 }
506
507 if (req_task->out_flags.all) {
508 cmd.ftf_flags |= IDE_FTFLAG_FLAGGED;
509
510 if (req_task->out_flags.b.data)
511 cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA;
512
513 if (req_task->out_flags.b.nsector_hob)
514 cmd.valid.out.hob |= IDE_VALID_NSECT;
515 if (req_task->out_flags.b.sector_hob)
516 cmd.valid.out.hob |= IDE_VALID_LBAL;
517 if (req_task->out_flags.b.lcyl_hob)
518 cmd.valid.out.hob |= IDE_VALID_LBAM;
519 if (req_task->out_flags.b.hcyl_hob)
520 cmd.valid.out.hob |= IDE_VALID_LBAH;
521
522 if (req_task->out_flags.b.error_feature)
523 cmd.valid.out.tf |= IDE_VALID_FEATURE;
524 if (req_task->out_flags.b.nsector)
525 cmd.valid.out.tf |= IDE_VALID_NSECT;
526 if (req_task->out_flags.b.sector)
527 cmd.valid.out.tf |= IDE_VALID_LBAL;
528 if (req_task->out_flags.b.lcyl)
529 cmd.valid.out.tf |= IDE_VALID_LBAM;
530 if (req_task->out_flags.b.hcyl)
531 cmd.valid.out.tf |= IDE_VALID_LBAH;
532 } else {
533 cmd.valid.out.tf |= IDE_VALID_OUT_TF;
534 if (cmd.tf_flags & IDE_TFLAG_LBA48)
535 cmd.valid.out.hob |= IDE_VALID_OUT_HOB;
536 }
537
538 if (req_task->in_flags.b.data)
539 cmd.ftf_flags |= IDE_FTFLAG_IN_DATA;
540
541 if (req_task->req_cmd == IDE_DRIVE_TASK_RAW_WRITE) {
542 /* fixup data phase if needed */
543 if (req_task->data_phase == TASKFILE_IN_DMAQ ||
544 req_task->data_phase == TASKFILE_IN_DMA)
545 cmd.tf_flags |= IDE_TFLAG_WRITE;
546 }
547
548 cmd.protocol = ATA_PROT_DMA;
549
550 switch (req_task->data_phase) {
551 case TASKFILE_MULTI_OUT:
552 if (!drive->mult_count) {
553 /* (hs): give up if multcount is not set */
554 printk(KERN_ERR "%s: %s Multimode Write " \
555 "multcount is not set\n",
556 drive->name, __func__);
557 err = -EPERM;
558 goto abort;
559 }
560 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
561 /* fall through */
562 case TASKFILE_OUT:
563 cmd.protocol = ATA_PROT_PIO;
564 /* fall through */
565 case TASKFILE_OUT_DMAQ:
566 case TASKFILE_OUT_DMA:
567 cmd.tf_flags |= IDE_TFLAG_WRITE;
568 nsect = taskout / SECTOR_SIZE;
569 data_buf = outbuf;
570 break;
571 case TASKFILE_MULTI_IN:
572 if (!drive->mult_count) {
573 /* (hs): give up if multcount is not set */
574 printk(KERN_ERR "%s: %s Multimode Read failure " \
575 "multcount is not set\n",
576 drive->name, __func__);
577 err = -EPERM;
578 goto abort;
579 }
580 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
581 /* fall through */
582 case TASKFILE_IN:
583 cmd.protocol = ATA_PROT_PIO;
584 /* fall through */
585 case TASKFILE_IN_DMAQ:
586 case TASKFILE_IN_DMA:
587 nsect = taskin / SECTOR_SIZE;
588 data_buf = inbuf;
589 break;
590 case TASKFILE_NO_DATA:
591 cmd.protocol = ATA_PROT_NODATA;
592 break;
593 default:
594 err = -EFAULT;
595 goto abort;
596 }
597
598 if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA)
599 nsect = 0;
600 else if (!nsect) {
601 nsect = (cmd.tf.hob_nsect << 8) | cmd.tf.nsect;
602
603 if (!nsect) {
604 printk(KERN_ERR "%s: in/out command without data\n",
605 drive->name);
606 err = -EFAULT;
607 goto abort;
608 }
609 }
610
611 err = ide_raw_taskfile(drive, &cmd, data_buf, nsect);
612
613 memcpy(req_task->hob_ports, &cmd.tf_array[0],
614 HDIO_DRIVE_HOB_HDR_SIZE - 2);
615 memcpy(req_task->io_ports, &cmd.tf_array[6],
616 HDIO_DRIVE_TASK_HDR_SIZE);
617
618 if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) &&
619 req_task->in_flags.all == 0) {
620 req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS;
621 if (drive->dev_flags & IDE_DFLAG_LBA48)
622 req_task->in_flags.all |= (IDE_HOB_STD_IN_FLAGS << 8);
623 }
624
625 if (copy_to_user(buf, req_task, tasksize)) {
626 err = -EFAULT;
627 goto abort;
628 }
629 if (taskout) {
630 int outtotal = tasksize;
631 if (copy_to_user(buf + outtotal, outbuf, taskout)) {
632 err = -EFAULT;
633 goto abort;
634 }
635 }
636 if (taskin) {
637 int intotal = tasksize + taskout;
638 if (copy_to_user(buf + intotal, inbuf, taskin)) {
639 err = -EFAULT;
640 goto abort;
641 }
642 }
643 abort:
644 kfree(req_task);
645 kfree(outbuf);
646 kfree(inbuf);
647
648 // printk("IDE Taskfile ioctl ended. rc = %i\n", err);
649
650 return err;
651 }
652 #endif
This page took 0.047139 seconds and 4 git commands to generate.