diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:33 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:33 -0400 |
commit | 05236ea6df7419f0f37cf9603cfee265cfce5832 (patch) | |
tree | 42aa04bc4106f80dd3f09895909fb6495c55a9cd /drivers/ide/ide-taskfile.c | |
parent | 170dc5b085e688639aa2b7acd1b907e2e1c7a48a (diff) |
ide: move ioctls handling to ide-ioctls.c
* Move ioctls handling to ide-ioctls.c
(except HDIO_DRIVE_TASKFILE for now).
* Make ide_{cmd,task}() static.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r-- | drivers/ide/ide-taskfile.c | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 7ffe9004a4d6..487b18b3ebae 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -726,112 +726,3 @@ abort: | |||
726 | return err; | 726 | return err; |
727 | } | 727 | } |
728 | #endif | 728 | #endif |
729 | |||
730 | int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | ||
731 | { | ||
732 | u8 *buf = NULL; | ||
733 | int bufsize = 0, err = 0; | ||
734 | u8 args[4], xfer_rate = 0; | ||
735 | ide_task_t tfargs; | ||
736 | struct ide_taskfile *tf = &tfargs.tf; | ||
737 | u16 *id = drive->id; | ||
738 | |||
739 | if (NULL == (void *) arg) { | ||
740 | struct request *rq; | ||
741 | |||
742 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | ||
743 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | ||
744 | err = blk_execute_rq(drive->queue, NULL, rq, 0); | ||
745 | blk_put_request(rq); | ||
746 | |||
747 | return err; | ||
748 | } | ||
749 | |||
750 | if (copy_from_user(args, (void __user *)arg, 4)) | ||
751 | return -EFAULT; | ||
752 | |||
753 | memset(&tfargs, 0, sizeof(ide_task_t)); | ||
754 | tf->feature = args[2]; | ||
755 | if (args[0] == ATA_CMD_SMART) { | ||
756 | tf->nsect = args[3]; | ||
757 | tf->lbal = args[1]; | ||
758 | tf->lbam = 0x4f; | ||
759 | tf->lbah = 0xc2; | ||
760 | tfargs.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; | ||
761 | } else { | ||
762 | tf->nsect = args[1]; | ||
763 | tfargs.tf_flags = IDE_TFLAG_OUT_FEATURE | | ||
764 | IDE_TFLAG_OUT_NSECT | IDE_TFLAG_IN_NSECT; | ||
765 | } | ||
766 | tf->command = args[0]; | ||
767 | tfargs.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; | ||
768 | |||
769 | if (args[3]) { | ||
770 | tfargs.tf_flags |= IDE_TFLAG_IO_16BIT; | ||
771 | bufsize = SECTOR_SIZE * args[3]; | ||
772 | buf = kzalloc(bufsize, GFP_KERNEL); | ||
773 | if (buf == NULL) | ||
774 | return -ENOMEM; | ||
775 | } | ||
776 | |||
777 | if (tf->command == ATA_CMD_SET_FEATURES && | ||
778 | tf->feature == SETFEATURES_XFER && | ||
779 | tf->nsect >= XFER_SW_DMA_0 && | ||
780 | (id[ATA_ID_UDMA_MODES] || | ||
781 | id[ATA_ID_MWDMA_MODES] || | ||
782 | id[ATA_ID_SWDMA_MODES])) { | ||
783 | xfer_rate = args[1]; | ||
784 | if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) { | ||
785 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " | ||
786 | "be set\n", drive->name); | ||
787 | goto abort; | ||
788 | } | ||
789 | } | ||
790 | |||
791 | err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); | ||
792 | |||
793 | args[0] = tf->status; | ||
794 | args[1] = tf->error; | ||
795 | args[2] = tf->nsect; | ||
796 | |||
797 | if (!err && xfer_rate) { | ||
798 | /* active-retuning-calls future */ | ||
799 | ide_set_xfer_rate(drive, xfer_rate); | ||
800 | ide_driveid_update(drive); | ||
801 | } | ||
802 | abort: | ||
803 | if (copy_to_user((void __user *)arg, &args, 4)) | ||
804 | err = -EFAULT; | ||
805 | if (buf) { | ||
806 | if (copy_to_user((void __user *)(arg + 4), buf, bufsize)) | ||
807 | err = -EFAULT; | ||
808 | kfree(buf); | ||
809 | } | ||
810 | return err; | ||
811 | } | ||
812 | |||
813 | int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | ||
814 | { | ||
815 | void __user *p = (void __user *)arg; | ||
816 | int err = 0; | ||
817 | u8 args[7]; | ||
818 | ide_task_t task; | ||
819 | |||
820 | if (copy_from_user(args, p, 7)) | ||
821 | return -EFAULT; | ||
822 | |||
823 | memset(&task, 0, sizeof(task)); | ||
824 | memcpy(&task.tf_array[7], &args[1], 6); | ||
825 | task.tf.command = args[0]; | ||
826 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
827 | |||
828 | err = ide_no_data_taskfile(drive, &task); | ||
829 | |||
830 | args[0] = task.tf.command; | ||
831 | memcpy(&args[1], &task.tf_array[7], 6); | ||
832 | |||
833 | if (copy_to_user(p, args, 7)) | ||
834 | err = -EFAULT; | ||
835 | |||
836 | return err; | ||
837 | } | ||