aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 18:41:31 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 18:41:31 -0400
commit3cb7396b7b26585b1ab7c1a8ca554ec103da5d37 (patch)
tree94720199f016045fe2a204ac8fd26c0029f4544c /include/linux
parentd0b6e0e380d6a32d479120a8b5d98cdff936ec8c (diff)
parent317a46a200e6514a1acf50ed30291160185a5c73 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: ide: fix PIO setup on resume for ATAPI devices ide: legacy PCI bus order probing fixes ide: add ide_proc_register_port() ide: add "initializing" argument to ide_register_hw() ide: cable detection fixes (take 2) ide: move IDE settings handling to ide-proc.c ide: split off ioctl handling from IDE settings (v2) ide: make /proc/ide/ optional ide: add ide_tune_dma() helper ide: rework the code for selecting the best DMA transfer mode (v3) ide: fix UDMA/MWDMA/SWDMA masks (v3)
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ide.h93
1 files changed, 50 insertions, 43 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 418dfb5adadd..df4e6a510310 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -223,8 +223,9 @@ typedef struct hw_regs_s {
223/* 223/*
224 * Register new hardware with ide 224 * Register new hardware with ide
225 */ 225 */
226int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp); 226int ide_register_hw(hw_regs_t *, int, struct hwif_s **);
227int ide_register_hw_with_fixup(hw_regs_t *, struct hwif_s **, void (*)(struct hwif_s *)); 227int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **,
228 void (*)(struct hwif_s *));
228 229
229/* 230/*
230 * Set up hw_regs_t structure before calling ide_register_hw (optional) 231 * Set up hw_regs_t structure before calling ide_register_hw (optional)
@@ -559,9 +560,10 @@ typedef struct ide_drive_s {
559 struct ide_drive_s *next; /* circular list of hwgroup drives */ 560 struct ide_drive_s *next; /* circular list of hwgroup drives */
560 void *driver_data; /* extra driver data */ 561 void *driver_data; /* extra driver data */
561 struct hd_driveid *id; /* drive model identification info */ 562 struct hd_driveid *id; /* drive model identification info */
563#ifdef CONFIG_IDE_PROC_FS
562 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 564 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
563 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 565 struct ide_settings_s *settings;/* /proc/ide/ drive settings */
564 566#endif
565 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 567 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
566 568
567 unsigned long sleep; /* sleep until this time */ 569 unsigned long sleep; /* sleep until this time */
@@ -601,16 +603,12 @@ typedef struct ide_drive_s {
601 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ 603 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */
602 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ 604 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
603 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ 605 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */
604 unsigned addressing; /* : 3;
605 * 0=28-bit
606 * 1=48-bit
607 * 2=48-bit doing 28-bit
608 * 3=64-bit
609 */
610 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ 606 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */
611 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ 607 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */
612 unsigned post_reset : 1; 608 unsigned post_reset : 1;
609 unsigned udma33_warned : 1;
613 610
611 u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */
614 u8 quirk_list; /* considered quirky, set for a specific host */ 612 u8 quirk_list; /* considered quirky, set for a specific host */
615 u8 init_speed; /* transfer rate set at boot */ 613 u8 init_speed; /* transfer rate set at boot */
616 u8 current_speed; /* current transfer rate set */ 614 u8 current_speed; /* current transfer rate set */
@@ -717,11 +715,8 @@ typedef struct hwif_s {
717 int (*quirkproc)(ide_drive_t *); 715 int (*quirkproc)(ide_drive_t *);
718 /* driver soft-power interface */ 716 /* driver soft-power interface */
719 int (*busproc)(ide_drive_t *, int); 717 int (*busproc)(ide_drive_t *, int);
720// /* host rate limiter */
721// u8 (*ratemask)(ide_drive_t *);
722// /* device rate limiter */
723// u8 (*ratefilter)(ide_drive_t *, u8);
724#endif 718#endif
719 u8 (*udma_filter)(ide_drive_t *);
725 720
726 void (*ata_input_data)(ide_drive_t *, void *, u32); 721 void (*ata_input_data)(ide_drive_t *, void *, u32);
727 void (*ata_output_data)(ide_drive_t *, void *, u32); 722 void (*ata_output_data)(ide_drive_t *, void *, u32);
@@ -866,16 +861,22 @@ typedef struct hwgroup_s {
866 unsigned char cmd_buf[4]; 861 unsigned char cmd_buf[4];
867} ide_hwgroup_t; 862} ide_hwgroup_t;
868 863
869/* structure attached to the request for IDE_TASK_CMDS */ 864typedef struct ide_driver_s ide_driver_t;
865
866extern struct semaphore ide_setting_sem;
867
868int set_io_32bit(ide_drive_t *, int);
869int set_pio_mode(ide_drive_t *, int);
870int set_using_dma(ide_drive_t *, int);
870 871
872#ifdef CONFIG_IDE_PROC_FS
871/* 873/*
872 * configurable drive settings 874 * configurable drive settings
873 */ 875 */
874 876
875#define TYPE_INT 0 877#define TYPE_INT 0
876#define TYPE_INTA 1 878#define TYPE_BYTE 1
877#define TYPE_BYTE 2 879#define TYPE_SHORT 2
878#define TYPE_SHORT 3
879 880
880#define SETTING_READ (1 << 0) 881#define SETTING_READ (1 << 0)
881#define SETTING_WRITE (1 << 1) 882#define SETTING_WRITE (1 << 1)
@@ -885,8 +886,6 @@ typedef int (ide_procset_t)(ide_drive_t *, int);
885typedef struct ide_settings_s { 886typedef struct ide_settings_s {
886 char *name; 887 char *name;
887 int rw; 888 int rw;
888 int read_ioctl;
889 int write_ioctl;
890 int data_type; 889 int data_type;
891 int min; 890 int min;
892 int max; 891 int max;
@@ -898,12 +897,7 @@ typedef struct ide_settings_s {
898 struct ide_settings_s *next; 897 struct ide_settings_s *next;
899} ide_settings_t; 898} ide_settings_t;
900 899
901extern struct semaphore ide_setting_sem; 900int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set);
902extern int ide_add_setting(ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set);
903extern ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name);
904extern int ide_read_setting(ide_drive_t *t, ide_settings_t *setting);
905extern int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val);
906extern void ide_add_generic_settings(ide_drive_t *drive);
907 901
908/* 902/*
909 * /proc/ide interface 903 * /proc/ide interface
@@ -915,15 +909,15 @@ typedef struct {
915 write_proc_t *write_proc; 909 write_proc_t *write_proc;
916} ide_proc_entry_t; 910} ide_proc_entry_t;
917 911
918#ifdef CONFIG_PROC_FS 912void proc_ide_create(void);
919extern struct proc_dir_entry *proc_ide_root; 913void proc_ide_destroy(void);
914void ide_proc_register_port(ide_hwif_t *);
915void ide_proc_unregister_port(ide_hwif_t *);
916void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
917void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
918
919void ide_add_generic_settings(ide_drive_t *);
920 920
921extern void proc_ide_create(void);
922extern void proc_ide_destroy(void);
923extern void create_proc_ide_interfaces(void);
924void destroy_proc_ide_interface(ide_hwif_t *);
925extern void ide_add_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *, void *);
926extern void ide_remove_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *);
927read_proc_t proc_ide_read_capacity; 921read_proc_t proc_ide_read_capacity;
928read_proc_t proc_ide_read_geometry; 922read_proc_t proc_ide_read_geometry;
929 923
@@ -947,8 +941,13 @@ void ide_pci_create_host_proc(const char *, get_info_t *);
947 return len; \ 941 return len; \
948} 942}
949#else 943#else
950static inline void create_proc_ide_interfaces(void) { ; } 944static inline void proc_ide_create(void) { ; }
951static inline void destroy_proc_ide_interface(ide_hwif_t *hwif) { ; } 945static inline void proc_ide_destroy(void) { ; }
946static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
947static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
948static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
949static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
950static inline void ide_add_generic_settings(ide_drive_t *drive) { ; }
952#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 951#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
953#endif 952#endif
954 953
@@ -991,7 +990,7 @@ enum {
991 * The gendriver.owner field should be set to the module owner of this driver. 990 * The gendriver.owner field should be set to the module owner of this driver.
992 * The gendriver.name field should be set to the name of this driver 991 * The gendriver.name field should be set to the name of this driver
993 */ 992 */
994typedef struct ide_driver_s { 993struct ide_driver_s {
995 const char *version; 994 const char *version;
996 u8 media; 995 u8 media;
997 unsigned supports_dsc_overlap : 1; 996 unsigned supports_dsc_overlap : 1;
@@ -999,12 +998,14 @@ typedef struct ide_driver_s {
999 int (*end_request)(ide_drive_t *, int, int); 998 int (*end_request)(ide_drive_t *, int, int);
1000 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 999 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
1001 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 1000 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
1002 ide_proc_entry_t *proc;
1003 struct device_driver gen_driver; 1001 struct device_driver gen_driver;
1004 int (*probe)(ide_drive_t *); 1002 int (*probe)(ide_drive_t *);
1005 void (*remove)(ide_drive_t *); 1003 void (*remove)(ide_drive_t *);
1006 void (*shutdown)(ide_drive_t *); 1004 void (*shutdown)(ide_drive_t *);
1007} ide_driver_t; 1005#ifdef CONFIG_IDE_PROC_FS
1006 ide_proc_entry_t *proc;
1007#endif
1008};
1008 1009
1009#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 1010#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
1010 1011
@@ -1204,9 +1205,14 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
1204 1205
1205extern int ideprobe_init(void); 1206extern int ideprobe_init(void);
1206 1207
1208#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1207extern void ide_scan_pcibus(int scan_direction) __init; 1209extern void ide_scan_pcibus(int scan_direction) __init;
1208extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1210extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1209#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 1211#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1212#else
1213#define ide_pci_register_driver(d) pci_register_driver(d)
1214#endif
1215
1210void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1216void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
1211extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1217extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
1212 1218
@@ -1214,9 +1220,6 @@ extern void default_hwif_iops(ide_hwif_t *);
1214extern void default_hwif_mmiops(ide_hwif_t *); 1220extern void default_hwif_mmiops(ide_hwif_t *);
1215extern void default_hwif_transport(ide_hwif_t *); 1221extern void default_hwif_transport(ide_hwif_t *);
1216 1222
1217void ide_register_subdriver(ide_drive_t *, ide_driver_t *);
1218void ide_unregister_subdriver(ide_drive_t *, ide_driver_t *);
1219
1220#define ON_BOARD 1 1223#define ON_BOARD 1
1221#define NEVER_BOARD 0 1224#define NEVER_BOARD 0
1222 1225
@@ -1257,6 +1260,7 @@ typedef struct ide_pci_device_s {
1257 unsigned int extra; 1260 unsigned int extra;
1258 struct ide_pci_device_s *next; 1261 struct ide_pci_device_s *next;
1259 u8 flags; 1262 u8 flags;
1263 u8 udma_mask;
1260} ide_pci_device_t; 1264} ide_pci_device_t;
1261 1265
1262extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); 1266extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
@@ -1278,6 +1282,8 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1278int __ide_dma_bad_drive(ide_drive_t *); 1282int __ide_dma_bad_drive(ide_drive_t *);
1279int __ide_dma_good_drive(ide_drive_t *); 1283int __ide_dma_good_drive(ide_drive_t *);
1280int ide_use_dma(ide_drive_t *); 1284int ide_use_dma(ide_drive_t *);
1285u8 ide_max_dma_mode(ide_drive_t *);
1286int ide_tune_dma(ide_drive_t *);
1281void ide_dma_off(ide_drive_t *); 1287void ide_dma_off(ide_drive_t *);
1282void ide_dma_verbose(ide_drive_t *); 1288void ide_dma_verbose(ide_drive_t *);
1283int ide_set_dma(ide_drive_t *); 1289int ide_set_dma(ide_drive_t *);
@@ -1304,6 +1310,8 @@ extern int __ide_dma_timeout(ide_drive_t *);
1304 1310
1305#else 1311#else
1306static inline int ide_use_dma(ide_drive_t *drive) { return 0; } 1312static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
1313static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1314static inline int ide_tune_dma(ide_drive_t *drive) { return 0; }
1307static inline void ide_dma_off(ide_drive_t *drive) { ; } 1315static inline void ide_dma_off(ide_drive_t *drive) { ; }
1308static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1316static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1309static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1317static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
@@ -1348,8 +1356,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1348} 1356}
1349 1357
1350/* ide-lib.c */ 1358/* ide-lib.c */
1351extern u8 ide_dma_speed(ide_drive_t *drive, u8 mode); 1359u8 ide_rate_filter(ide_drive_t *, u8);
1352extern u8 ide_rate_filter(u8 mode, u8 speed);
1353extern int ide_dma_enable(ide_drive_t *drive); 1360extern int ide_dma_enable(ide_drive_t *drive);
1354extern char *ide_xfer_verbose(u8 xfer_rate); 1361extern char *ide_xfer_verbose(u8 xfer_rate);
1355extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1362extern void ide_toggle_bounce(ide_drive_t *drive, int on);