diff options
| -rw-r--r-- | drivers/ide/ide-taskfile.c | 109 |
1 files changed, 51 insertions, 58 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 3a5224cbd0f2..50336d51eebc 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
| @@ -19,8 +19,8 @@ | |||
| 19 | #include <linux/hdreg.h> | 19 | #include <linux/hdreg.h> |
| 20 | #include <linux/ide.h> | 20 | #include <linux/ide.h> |
| 21 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
| 22 | #include <linux/uaccess.h> | ||
| 22 | 23 | ||
| 23 | #include <asm/uaccess.h> | ||
| 24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
| 25 | 25 | ||
| 26 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd) | 26 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd) |
| @@ -53,7 +53,7 @@ void ide_tf_dump(const char *s, struct ide_cmd *cmd) | |||
| 53 | #endif | 53 | #endif |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) | 56 | int taskfile_lib_get_identify(ide_drive_t *drive, u8 *buf) |
| 57 | { | 57 | { |
| 58 | struct ide_cmd cmd; | 58 | struct ide_cmd cmd; |
| 59 | 59 | ||
| @@ -86,7 +86,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) | |||
| 86 | if (orig_cmd->protocol == ATA_PROT_PIO && | 86 | if (orig_cmd->protocol == ATA_PROT_PIO && |
| 87 | (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) && | 87 | (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) && |
| 88 | drive->mult_count == 0) { | 88 | drive->mult_count == 0) { |
| 89 | printk(KERN_ERR "%s: multimode not set!\n", drive->name); | 89 | pr_err("%s: multimode not set!\n", drive->name); |
| 90 | return ide_stopped; | 90 | return ide_stopped; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| @@ -214,7 +214,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) | |||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | if (stat & ATA_BUSY) | 216 | if (stat & ATA_BUSY) |
| 217 | printk(KERN_ERR "%s: drive still BUSY!\n", drive->name); | 217 | pr_err("%s: drive still BUSY!\n", drive->name); |
| 218 | 218 | ||
| 219 | return stat; | 219 | return stat; |
| 220 | } | 220 | } |
| @@ -400,8 +400,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, | |||
| 400 | 400 | ||
| 401 | if (ide_wait_stat(&startstop, drive, ATA_DRQ, | 401 | if (ide_wait_stat(&startstop, drive, ATA_DRQ, |
| 402 | drive->bad_wstat, WAIT_DRQ)) { | 402 | drive->bad_wstat, WAIT_DRQ)) { |
| 403 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", | 403 | pr_err("%s: no DRQ after issuing %sWRITE%s\n", drive->name, |
| 404 | drive->name, | ||
| 405 | (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "", | 404 | (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "", |
| 406 | (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); | 405 | (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); |
| 407 | return startstop; | 406 | return startstop; |
| @@ -451,7 +450,6 @@ put_req: | |||
| 451 | blk_put_request(rq); | 450 | blk_put_request(rq); |
| 452 | return error; | 451 | return error; |
| 453 | } | 452 | } |
| 454 | |||
| 455 | EXPORT_SYMBOL(ide_raw_taskfile); | 453 | EXPORT_SYMBOL(ide_raw_taskfile); |
| 456 | 454 | ||
| 457 | int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) | 455 | int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) |
| @@ -477,10 +475,9 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
| 477 | u16 nsect = 0; | 475 | u16 nsect = 0; |
| 478 | char __user *buf = (char __user *)arg; | 476 | char __user *buf = (char __user *)arg; |
| 479 | 477 | ||
| 480 | // printk("IDE Taskfile ...\n"); | ||
| 481 | |||
| 482 | req_task = kzalloc(tasksize, GFP_KERNEL); | 478 | req_task = kzalloc(tasksize, GFP_KERNEL); |
| 483 | if (req_task == NULL) return -ENOMEM; | 479 | if (req_task == NULL) |
| 480 | return -ENOMEM; | ||
| 484 | if (copy_from_user(req_task, buf, tasksize)) { | 481 | if (copy_from_user(req_task, buf, tasksize)) { |
| 485 | kfree(req_task); | 482 | kfree(req_task); |
| 486 | return -EFAULT; | 483 | return -EFAULT; |
| @@ -488,7 +485,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
| 488 | 485 | ||
| 489 | taskout = req_task->out_size; | 486 | taskout = req_task->out_size; |
| 490 | taskin = req_task->in_size; | 487 | taskin = req_task->in_size; |
| 491 | 488 | ||
| 492 | if (taskin > 65536 || taskout > 65536) { | 489 | if (taskin > 65536 || taskout > 65536) { |
| 493 | err = -EINVAL; | 490 | err = -EINVAL; |
| 494 | goto abort; | 491 | goto abort; |
| @@ -578,51 +575,49 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
| 578 | cmd.protocol = ATA_PROT_DMA; | 575 | cmd.protocol = ATA_PROT_DMA; |
| 579 | 576 | ||
| 580 | switch (req_task->data_phase) { | 577 | switch (req_task->data_phase) { |
| 581 | case TASKFILE_MULTI_OUT: | 578 | case TASKFILE_MULTI_OUT: |
| 582 | if (!drive->mult_count) { | 579 | if (!drive->mult_count) { |
| 583 | /* (hs): give up if multcount is not set */ | 580 | /* (hs): give up if multcount is not set */ |
| 584 | printk(KERN_ERR "%s: %s Multimode Write " \ | 581 | pr_err("%s: %s Multimode Write multcount is not set\n", |
| 585 | "multcount is not set\n", | 582 | drive->name, __func__); |
| 586 | drive->name, __func__); | 583 | err = -EPERM; |
| 587 | err = -EPERM; | 584 | goto abort; |
| 588 | goto abort; | 585 | } |
| 589 | } | 586 | cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; |
| 590 | cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; | 587 | /* fall through */ |
| 591 | /* fall through */ | 588 | case TASKFILE_OUT: |
| 592 | case TASKFILE_OUT: | 589 | cmd.protocol = ATA_PROT_PIO; |
| 593 | cmd.protocol = ATA_PROT_PIO; | 590 | /* fall through */ |
| 594 | /* fall through */ | 591 | case TASKFILE_OUT_DMAQ: |
| 595 | case TASKFILE_OUT_DMAQ: | 592 | case TASKFILE_OUT_DMA: |
| 596 | case TASKFILE_OUT_DMA: | 593 | cmd.tf_flags |= IDE_TFLAG_WRITE; |
| 597 | cmd.tf_flags |= IDE_TFLAG_WRITE; | 594 | nsect = taskout / SECTOR_SIZE; |
| 598 | nsect = taskout / SECTOR_SIZE; | 595 | data_buf = outbuf; |
| 599 | data_buf = outbuf; | 596 | break; |
| 600 | break; | 597 | case TASKFILE_MULTI_IN: |
| 601 | case TASKFILE_MULTI_IN: | 598 | if (!drive->mult_count) { |
| 602 | if (!drive->mult_count) { | 599 | /* (hs): give up if multcount is not set */ |
| 603 | /* (hs): give up if multcount is not set */ | 600 | pr_err("%s: %s Multimode Read multcount is not set\n", |
| 604 | printk(KERN_ERR "%s: %s Multimode Read failure " \ | 601 | drive->name, __func__); |
| 605 | "multcount is not set\n", | 602 | err = -EPERM; |
| 606 | drive->name, __func__); | ||
| 607 | err = -EPERM; | ||
| 608 | goto abort; | ||
| 609 | } | ||
| 610 | cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; | ||
| 611 | /* fall through */ | ||
| 612 | case TASKFILE_IN: | ||
| 613 | cmd.protocol = ATA_PROT_PIO; | ||
| 614 | /* fall through */ | ||
| 615 | case TASKFILE_IN_DMAQ: | ||
| 616 | case TASKFILE_IN_DMA: | ||
| 617 | nsect = taskin / SECTOR_SIZE; | ||
| 618 | data_buf = inbuf; | ||
| 619 | break; | ||
| 620 | case TASKFILE_NO_DATA: | ||
| 621 | cmd.protocol = ATA_PROT_NODATA; | ||
| 622 | break; | ||
| 623 | default: | ||
| 624 | err = -EFAULT; | ||
| 625 | goto abort; | 603 | goto abort; |
| 604 | } | ||
| 605 | cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; | ||
| 606 | /* fall through */ | ||
| 607 | case TASKFILE_IN: | ||
| 608 | cmd.protocol = ATA_PROT_PIO; | ||
| 609 | /* fall through */ | ||
| 610 | case TASKFILE_IN_DMAQ: | ||
| 611 | case TASKFILE_IN_DMA: | ||
| 612 | nsect = taskin / SECTOR_SIZE; | ||
| 613 | data_buf = inbuf; | ||
| 614 | break; | ||
| 615 | case TASKFILE_NO_DATA: | ||
| 616 | cmd.protocol = ATA_PROT_NODATA; | ||
| 617 | break; | ||
| 618 | default: | ||
| 619 | err = -EFAULT; | ||
| 620 | goto abort; | ||
| 626 | } | 621 | } |
| 627 | 622 | ||
| 628 | if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) | 623 | if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) |
| @@ -631,7 +626,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
| 631 | nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect; | 626 | nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect; |
| 632 | 627 | ||
| 633 | if (!nsect) { | 628 | if (!nsect) { |
| 634 | printk(KERN_ERR "%s: in/out command without data\n", | 629 | pr_err("%s: in/out command without data\n", |
| 635 | drive->name); | 630 | drive->name); |
| 636 | err = -EFAULT; | 631 | err = -EFAULT; |
| 637 | goto abort; | 632 | goto abort; |
| @@ -673,8 +668,6 @@ abort: | |||
| 673 | kfree(outbuf); | 668 | kfree(outbuf); |
| 674 | kfree(inbuf); | 669 | kfree(inbuf); |
| 675 | 670 | ||
| 676 | // printk("IDE Taskfile ioctl ended. rc = %i\n", err); | ||
| 677 | |||
| 678 | return err; | 671 | return err; |
| 679 | } | 672 | } |
| 680 | #endif | 673 | #endif |
