aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:56 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:56 -0400
commit374e042c3e767ac2e5a40b78529220e0b3de793c (patch)
tree433d258f6da9783f0cb34234af9c359353f531fe /include/linux/ide.h
parentd6276b5f5cc7508124de291f3ed59c6945c17ae7 (diff)
ide: add struct ide_tp_ops (take 2)
* Add struct ide_tp_ops for transport methods. * Add 'const struct ide_tp_ops *tp_ops' to struct ide_port_info and ide_hwif_t. * Set the default hwif->tp_ops in ide_init_port_data(). * Set host driver specific hwif->tp_ops in ide_init_port(). * Export ide_exec_command(), ide_read_status(), ide_read_altstatus(), ide_read_sff_dma_status(), ide_set_irq(), ide_tf_{load,read}() and ata_{in,out}put_data(). * Convert host drivers and core code to use struct ide_tp_ops. * Remove no longer needed default_hwif_transport(). * Cleanup ide_hwif_t from methods that are now in struct ide_tp_ops. While at it: * Use struct ide_port_info in falconide.c and q40ide.c. * Rename ata_{in,out}put_data() to ide_{in,out}put_data(). v2: * Fix missing convertion in ns87415.c. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h52
1 files changed, 35 insertions, 17 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e340218b2a5f..1286a2275efb 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -408,8 +408,28 @@ typedef struct ide_drive_s {
408 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 408 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
409#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 409#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
410 410
411struct ide_task_s;
411struct ide_port_info; 412struct ide_port_info;
412 413
414struct ide_tp_ops {
415 void (*exec_command)(struct hwif_s *, u8);
416 u8 (*read_status)(struct hwif_s *);
417 u8 (*read_altstatus)(struct hwif_s *);
418 u8 (*read_sff_dma_status)(struct hwif_s *);
419
420 void (*set_irq)(struct hwif_s *, int);
421
422 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
423 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
424
425 void (*input_data)(ide_drive_t *, struct request *, void *,
426 unsigned int);
427 void (*output_data)(ide_drive_t *, struct request *, void *,
428 unsigned int);
429};
430
431extern const struct ide_tp_ops default_tp_ops;
432
413struct ide_port_ops { 433struct ide_port_ops {
414 /* host specific initialization of a device */ 434 /* host specific initialization of a device */
415 void (*init_dev)(ide_drive_t *); 435 void (*init_dev)(ide_drive_t *);
@@ -447,8 +467,6 @@ struct ide_dma_ops {
447 void (*dma_timeout)(struct ide_drive_s *); 467 void (*dma_timeout)(struct ide_drive_s *);
448}; 468};
449 469
450struct ide_task_s;
451
452typedef struct hwif_s { 470typedef struct hwif_s {
453 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 471 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
454 struct hwif_s *mate; /* other hwif from same PCI chip */ 472 struct hwif_s *mate; /* other hwif from same PCI chip */
@@ -486,22 +504,10 @@ typedef struct hwif_s {
486 504
487 void (*rw_disk)(ide_drive_t *, struct request *); 505 void (*rw_disk)(ide_drive_t *, struct request *);
488 506
507 const struct ide_tp_ops *tp_ops;
489 const struct ide_port_ops *port_ops; 508 const struct ide_port_ops *port_ops;
490 const struct ide_dma_ops *dma_ops; 509 const struct ide_dma_ops *dma_ops;
491 510
492 void (*exec_command)(struct hwif_s *, u8);
493 u8 (*read_status)(struct hwif_s *);
494 u8 (*read_altstatus)(struct hwif_s *);
495 u8 (*read_sff_dma_status)(struct hwif_s *);
496
497 void (*set_irq)(struct hwif_s *, int);
498
499 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
500 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
501
502 void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
503 void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
504
505 void (*ide_dma_clear_irq)(ide_drive_t *drive); 511 void (*ide_dma_clear_irq)(ide_drive_t *drive);
506 512
507 /* dma physical region descriptor table (cpu view) */ 513 /* dma physical region descriptor table (cpu view) */
@@ -949,6 +955,19 @@ typedef struct ide_task_s {
949 955
950void ide_tf_dump(const char *, struct ide_taskfile *); 956void ide_tf_dump(const char *, struct ide_taskfile *);
951 957
958void ide_exec_command(ide_hwif_t *, u8);
959u8 ide_read_status(ide_hwif_t *);
960u8 ide_read_altstatus(ide_hwif_t *);
961u8 ide_read_sff_dma_status(ide_hwif_t *);
962
963void ide_set_irq(ide_hwif_t *, int);
964
965void ide_tf_load(ide_drive_t *, ide_task_t *);
966void ide_tf_read(ide_drive_t *, ide_task_t *);
967
968void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int);
969void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int);
970
952extern void SELECT_DRIVE(ide_drive_t *); 971extern void SELECT_DRIVE(ide_drive_t *);
953void SELECT_MASK(ide_drive_t *, int); 972void SELECT_MASK(ide_drive_t *, int);
954 973
@@ -1022,8 +1041,6 @@ static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1022} 1041}
1023#endif 1042#endif
1024 1043
1025extern void default_hwif_transport(ide_hwif_t *);
1026
1027typedef struct ide_pci_enablebit_s { 1044typedef struct ide_pci_enablebit_s {
1028 u8 reg; /* byte pci reg holding the enable-bit */ 1045 u8 reg; /* byte pci reg holding the enable-bit */
1029 u8 mask; /* mask to isolate the enable-bit */ 1046 u8 mask; /* mask to isolate the enable-bit */
@@ -1112,6 +1129,7 @@ struct ide_port_info {
1112 int (*init_dma)(ide_hwif_t *, 1129 int (*init_dma)(ide_hwif_t *,
1113 const struct ide_port_info *); 1130 const struct ide_port_info *);
1114 1131
1132 const struct ide_tp_ops *tp_ops;
1115 const struct ide_port_ops *port_ops; 1133 const struct ide_port_ops *port_ops;
1116 const struct ide_dma_ops *dma_ops; 1134 const struct ide_dma_ops *dma_ops;
1117 1135