diff options
author | Elias Oltmanns <eo@nebensachen.de> | 2008-10-10 16:39:40 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:40 -0400 |
commit | 92f1f8fd8040e7b50a67a850a935509bb01201bb (patch) | |
tree | df27468982bc64f0a6fdc54f05153e382ca63a1b /include | |
parent | d6e2955a6b82d2312b5ff885ce13c8ab54d59d96 (diff) |
ide: Remove ide_spin_wait_hwgroup() and use special requests instead
Use a special request for serialisation purposes and get rid of the
awkward ide_spin_wait_hwgroup(). This also involves converting the
ide_devset structure so it can be shared by the /proc and the ioctl code.
Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
[bart: use rq->cmd[] directly]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ide.h | 138 |
1 files changed, 73 insertions, 65 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index a9eced25acce..a9d82d6e6bdd 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -161,6 +161,7 @@ enum { | |||
161 | * Values should be in the range of 0x20 to 0x3f. | 161 | * Values should be in the range of 0x20 to 0x3f. |
162 | */ | 162 | */ |
163 | #define REQ_DRIVE_RESET 0x20 | 163 | #define REQ_DRIVE_RESET 0x20 |
164 | #define REQ_DEVSET_EXEC 0x21 | ||
164 | 165 | ||
165 | /* | 166 | /* |
166 | * Check for an interrupt and acknowledge the interrupt status | 167 | * Check for an interrupt and acknowledge the interrupt status |
@@ -405,7 +406,7 @@ struct ide_drive_s { | |||
405 | u16 *id; /* identification info */ | 406 | u16 *id; /* identification info */ |
406 | #ifdef CONFIG_IDE_PROC_FS | 407 | #ifdef CONFIG_IDE_PROC_FS |
407 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 408 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
408 | const struct ide_devset **settings; /* /proc/ide/ drive settings */ | 409 | const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */ |
409 | #endif | 410 | #endif |
410 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ | 411 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ |
411 | 412 | ||
@@ -707,29 +708,62 @@ typedef struct ide_driver_s ide_driver_t; | |||
707 | 708 | ||
708 | extern struct mutex ide_setting_mtx; | 709 | extern struct mutex ide_setting_mtx; |
709 | 710 | ||
710 | int get_io_32bit(ide_drive_t *); | 711 | /* |
711 | int set_io_32bit(ide_drive_t *, int); | 712 | * configurable drive settings |
712 | int get_ksettings(ide_drive_t *); | 713 | */ |
713 | int set_ksettings(ide_drive_t *, int); | 714 | |
714 | int set_pio_mode(ide_drive_t *, int); | 715 | #define DS_SYNC (1 << 0) |
715 | int get_unmaskirq(ide_drive_t *); | 716 | |
716 | int set_unmaskirq(ide_drive_t *, int); | 717 | struct ide_devset { |
717 | int get_using_dma(ide_drive_t *); | 718 | int (*get)(ide_drive_t *); |
718 | int set_using_dma(ide_drive_t *, int); | 719 | int (*set)(ide_drive_t *, int); |
720 | unsigned int flags; | ||
721 | }; | ||
722 | |||
723 | #define __DEVSET(_flags, _get, _set) { \ | ||
724 | .flags = _flags, \ | ||
725 | .get = _get, \ | ||
726 | .set = _set, \ | ||
727 | } | ||
719 | 728 | ||
720 | #define ide_devset_get(name, field) \ | 729 | #define ide_devset_get(name, field) \ |
721 | int get_##name(ide_drive_t *drive) \ | 730 | static int get_##name(ide_drive_t *drive) \ |
722 | { \ | 731 | { \ |
723 | return drive->field; \ | 732 | return drive->field; \ |
724 | } | 733 | } |
725 | 734 | ||
726 | #define ide_devset_set(name, field) \ | 735 | #define ide_devset_set(name, field) \ |
727 | int set_##name(ide_drive_t *drive, int arg) \ | 736 | static int set_##name(ide_drive_t *drive, int arg) \ |
728 | { \ | 737 | { \ |
729 | drive->field = arg; \ | 738 | drive->field = arg; \ |
730 | return 0; \ | 739 | return 0; \ |
731 | } | 740 | } |
732 | 741 | ||
742 | #define __IDE_DEVSET(_name, _flags, _get, _set) \ | ||
743 | const struct ide_devset ide_devset_##_name = \ | ||
744 | __DEVSET(_flags, _get, _set) | ||
745 | |||
746 | #define IDE_DEVSET(_name, _flags, _get, _set) \ | ||
747 | static __IDE_DEVSET(_name, _flags, _get, _set) | ||
748 | |||
749 | #define ide_devset_rw(_name, _func) \ | ||
750 | IDE_DEVSET(_name, 0, get_##_func, set_##_func) | ||
751 | |||
752 | #define ide_devset_w(_name, _func) \ | ||
753 | IDE_DEVSET(_name, 0, NULL, set_##_func) | ||
754 | |||
755 | #define ide_devset_rw_sync(_name, _func) \ | ||
756 | IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) | ||
757 | |||
758 | #define ide_decl_devset(_name) \ | ||
759 | extern const struct ide_devset ide_devset_##_name | ||
760 | |||
761 | ide_decl_devset(io_32bit); | ||
762 | ide_decl_devset(keepsettings); | ||
763 | ide_decl_devset(pio_mode); | ||
764 | ide_decl_devset(unmaskirq); | ||
765 | ide_decl_devset(using_dma); | ||
766 | |||
733 | /* ATAPI packet command flags */ | 767 | /* ATAPI packet command flags */ |
734 | enum { | 768 | enum { |
735 | /* set when an error is considered normal - no retry (ide-tape) */ | 769 | /* set when an error is considered normal - no retry (ide-tape) */ |
@@ -797,60 +831,34 @@ struct ide_atapi_pc { | |||
797 | 831 | ||
798 | #ifdef CONFIG_IDE_PROC_FS | 832 | #ifdef CONFIG_IDE_PROC_FS |
799 | /* | 833 | /* |
800 | * configurable drive settings | 834 | * /proc/ide interface |
801 | */ | 835 | */ |
802 | 836 | ||
803 | #define S_READ (1 << 0) | 837 | #define ide_devset_rw_field(_name, _field) \ |
804 | #define S_WRITE (1 << 1) | 838 | ide_devset_get(_name, _field); \ |
805 | #define S_RW (S_READ | S_WRITE) | 839 | ide_devset_set(_name, _field); \ |
806 | #define S_NOLOCK (1 << 2) | 840 | IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) |
807 | 841 | ||
808 | struct ide_devset { | 842 | struct ide_proc_devset { |
809 | const char *name; | 843 | const char *name; |
810 | unsigned int flags; | 844 | const struct ide_devset *setting; |
811 | int min, max; | 845 | int min, max; |
812 | int (*get)(ide_drive_t *); | 846 | int (*mulf)(ide_drive_t *); |
813 | int (*set)(ide_drive_t *, int); | 847 | int (*divf)(ide_drive_t *); |
814 | int (*mulf)(ide_drive_t *); | ||
815 | int (*divf)(ide_drive_t *); | ||
816 | }; | 848 | }; |
817 | 849 | ||
818 | #define __DEVSET(_name, _flags, _min, _max, _get, _set, _mulf, _divf) { \ | 850 | #define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \ |
819 | .name = __stringify(_name), \ | 851 | .name = __stringify(_name), \ |
820 | .flags = _flags, \ | 852 | .setting = &ide_devset_##_name, \ |
821 | .min = _min, \ | 853 | .min = _min, \ |
822 | .max = _max, \ | 854 | .max = _max, \ |
823 | .get = _get, \ | 855 | .mulf = _mulf, \ |
824 | .set = _set, \ | 856 | .divf = _divf, \ |
825 | .mulf = _mulf, \ | ||
826 | .divf = _divf, \ | ||
827 | } | 857 | } |
828 | 858 | ||
829 | #define __IDE_DEVSET(_name, _flags, _min, _max, _get, _set, _mulf, _divf) \ | 859 | #define IDE_PROC_DEVSET(_name, _min, _max) \ |
830 | static const struct ide_devset ide_devset_##_name = \ | 860 | __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL) |
831 | __DEVSET(_name, _flags, _min, _max, _get, _set, _mulf, _divf) | ||
832 | |||
833 | #define IDE_DEVSET(_name, _flags, _min, _max, _get, _set) \ | ||
834 | __IDE_DEVSET(_name, _flags, _min, _max, _get, _set, NULL, NULL) | ||
835 | |||
836 | #define ide_devset_rw_nolock(_name, _min, _max, _func) \ | ||
837 | IDE_DEVSET(_name, S_RW | S_NOLOCK, _min, _max, get_##_func, set_##_func) | ||
838 | 861 | ||
839 | #define ide_devset_w_nolock(_name, _min, _max, _func) \ | ||
840 | IDE_DEVSET(_name, S_WRITE | S_NOLOCK, _min, _max, NULL, set_##_func) | ||
841 | |||
842 | #define ide_devset_rw(_name, _min, _max, _field) \ | ||
843 | static ide_devset_get(_name, _field); \ | ||
844 | static ide_devset_set(_name, _field); \ | ||
845 | IDE_DEVSET(_name, S_RW, _min, _max, get_##_name, set_##_name) | ||
846 | |||
847 | #define ide_devset_r(_name, _min, _max, _field) \ | ||
848 | ide_devset_get(_name, _field) \ | ||
849 | IDE_DEVSET(_name, S_READ, _min, _max, get_##_name, NULL) | ||
850 | |||
851 | /* | ||
852 | * /proc/ide interface | ||
853 | */ | ||
854 | typedef struct { | 862 | typedef struct { |
855 | const char *name; | 863 | const char *name; |
856 | mode_t mode; | 864 | mode_t mode; |
@@ -948,8 +956,8 @@ struct ide_driver_s { | |||
948 | void (*resume)(ide_drive_t *); | 956 | void (*resume)(ide_drive_t *); |
949 | void (*shutdown)(ide_drive_t *); | 957 | void (*shutdown)(ide_drive_t *); |
950 | #ifdef CONFIG_IDE_PROC_FS | 958 | #ifdef CONFIG_IDE_PROC_FS |
951 | ide_proc_entry_t *proc; | 959 | ide_proc_entry_t *proc; |
952 | const struct ide_devset **settings; | 960 | const struct ide_proc_devset *settings; |
953 | #endif | 961 | #endif |
954 | }; | 962 | }; |
955 | 963 | ||
@@ -961,9 +969,7 @@ void ide_device_put(ide_drive_t *); | |||
961 | struct ide_ioctl_devset { | 969 | struct ide_ioctl_devset { |
962 | unsigned int get_ioctl; | 970 | unsigned int get_ioctl; |
963 | unsigned int set_ioctl; | 971 | unsigned int set_ioctl; |
964 | 972 | const struct ide_devset *setting; | |
965 | int (*get)(ide_drive_t *); | ||
966 | int (*set)(ide_drive_t *, int); | ||
967 | }; | 973 | }; |
968 | 974 | ||
969 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, | 975 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, |
@@ -1002,6 +1008,9 @@ int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | |||
1002 | 1008 | ||
1003 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1009 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
1004 | 1010 | ||
1011 | extern int ide_devset_execute(ide_drive_t *drive, | ||
1012 | const struct ide_devset *setting, int arg); | ||
1013 | |||
1005 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); | 1014 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); |
1006 | 1015 | ||
1007 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1016 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
@@ -1191,7 +1200,6 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | |||
1191 | 1200 | ||
1192 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | 1201 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); |
1193 | 1202 | ||
1194 | extern int ide_spin_wait_hwgroup(ide_drive_t *); | ||
1195 | extern void ide_timer_expiry(unsigned long); | 1203 | extern void ide_timer_expiry(unsigned long); |
1196 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1204 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
1197 | extern void do_ide_request(struct request_queue *); | 1205 | extern void do_ide_request(struct request_queue *); |