aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 13:05:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 13:05:43 -0400
commit83826dc505e6c6f432332dd45681be4bb71635ce (patch)
tree761f6321c3c5ef94e63344e948e684313d61b88a /include
parentffd14285142cb398b2b613e27f71be415d28072e (diff)
parentbf717c0a2e18dbe82eeb28e57b0abede3cdf45d6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (70 commits) ide: keep track of number of bytes instead of sectors in struct ide_cmd ide: remove ide_execute_pkt_cmd() (v2) ide: add ->dma_timer_expiry method and remove ->dma_exec_cmd one (v2) ide: set hwif->expiry prior to calling [__]ide_set_handler() ide: use do_rw_taskfile() for ATA_CMD_PACKET commands ide: pass command to ide_map_sg() ide: remove ide_end_request() ide: use ide_end_rq() in ide_complete_rq() ide: pass number of bytes to complete to ide_complete_rq() ide: remove BUG() from ide_complete_rq() ide: move rq->errors quirk out from ide_end_request() ide: pass error value to ide_complete_rq() ide: sanitize ide_end_rq() ide: add ide_end_rq() (v2) ide: make ide_special_rq() BUG() on unknown requests ide: sanitize ide_finish_cmd() ide: use ide_complete_cmd() for REQ_UNPARK_HEADS ide: use ide_complete_cmd() for head unload commands ide: task_error() -> task_error_cmd() ide: unify exit paths in task_pio_intr() ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/ide.h239
1 files changed, 126 insertions, 113 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 854eba8b2ba3..d5d832271f44 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -40,6 +40,13 @@
40#define ERROR_RESET 3 /* Reset controller every 4th retry */ 40#define ERROR_RESET 3 /* Reset controller every 4th retry */
41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
42 42
43/* Error codes returned in rq->errors to the higher part of the driver. */
44enum {
45 IDE_DRV_ERROR_GENERAL = 101,
46 IDE_DRV_ERROR_FILEMARK = 102,
47 IDE_DRV_ERROR_EOD = 103,
48};
49
43/* 50/*
44 * Definitions for accessing IDE controller registers 51 * Definitions for accessing IDE controller registers
45 */ 52 */
@@ -193,26 +200,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
193 hw->io_ports.ctl_addr = ctl_addr; 200 hw->io_ports.ctl_addr = ctl_addr;
194} 201}
195 202
196#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
197 defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
198#include <asm/ide.h>
199#else
200#include <asm-generic/ide_iops.h>
201#endif
202
203#define MAX_HWIFS 10 203#define MAX_HWIFS 10
204 204
205/* Currently only m68k, apus and m8xx need it */
206#ifndef IDE_ARCH_ACK_INTR
207# define ide_ack_intr(hwif) (1)
208#endif
209
210/* Currently only Atari needs it */
211#ifndef IDE_ARCH_LOCK
212# define ide_release_lock() do {} while (0)
213# define ide_get_lock(hdlr, data) do {} while (0)
214#endif /* IDE_ARCH_LOCK */
215
216/* 205/*
217 * Now for the data we need to maintain per-drive: ide_drive_t 206 * Now for the data we need to maintain per-drive: ide_drive_t
218 */ 207 */
@@ -252,56 +241,52 @@ typedef enum {
252 241
253enum { 242enum {
254 IDE_TFLAG_LBA48 = (1 << 0), 243 IDE_TFLAG_LBA48 = (1 << 0),
255 IDE_TFLAG_FLAGGED = (1 << 2), 244 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1),
256 IDE_TFLAG_OUT_DATA = (1 << 3), 245 IDE_TFLAG_OUT_HOB_NSECT = (1 << 2),
257 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), 246 IDE_TFLAG_OUT_HOB_LBAL = (1 << 3),
258 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), 247 IDE_TFLAG_OUT_HOB_LBAM = (1 << 4),
259 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), 248 IDE_TFLAG_OUT_HOB_LBAH = (1 << 5),
260 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
261 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
262 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | 249 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
263 IDE_TFLAG_OUT_HOB_NSECT | 250 IDE_TFLAG_OUT_HOB_NSECT |
264 IDE_TFLAG_OUT_HOB_LBAL | 251 IDE_TFLAG_OUT_HOB_LBAL |
265 IDE_TFLAG_OUT_HOB_LBAM | 252 IDE_TFLAG_OUT_HOB_LBAM |
266 IDE_TFLAG_OUT_HOB_LBAH, 253 IDE_TFLAG_OUT_HOB_LBAH,
267 IDE_TFLAG_OUT_FEATURE = (1 << 9), 254 IDE_TFLAG_OUT_FEATURE = (1 << 6),
268 IDE_TFLAG_OUT_NSECT = (1 << 10), 255 IDE_TFLAG_OUT_NSECT = (1 << 7),
269 IDE_TFLAG_OUT_LBAL = (1 << 11), 256 IDE_TFLAG_OUT_LBAL = (1 << 8),
270 IDE_TFLAG_OUT_LBAM = (1 << 12), 257 IDE_TFLAG_OUT_LBAM = (1 << 9),
271 IDE_TFLAG_OUT_LBAH = (1 << 13), 258 IDE_TFLAG_OUT_LBAH = (1 << 10),
272 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | 259 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
273 IDE_TFLAG_OUT_NSECT | 260 IDE_TFLAG_OUT_NSECT |
274 IDE_TFLAG_OUT_LBAL | 261 IDE_TFLAG_OUT_LBAL |
275 IDE_TFLAG_OUT_LBAM | 262 IDE_TFLAG_OUT_LBAM |
276 IDE_TFLAG_OUT_LBAH, 263 IDE_TFLAG_OUT_LBAH,
277 IDE_TFLAG_OUT_DEVICE = (1 << 14), 264 IDE_TFLAG_OUT_DEVICE = (1 << 11),
278 IDE_TFLAG_WRITE = (1 << 15), 265 IDE_TFLAG_WRITE = (1 << 12),
279 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), 266 IDE_TFLAG_CUSTOM_HANDLER = (1 << 13),
280 IDE_TFLAG_IN_DATA = (1 << 17), 267 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14),
281 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), 268 IDE_TFLAG_IN_HOB_FEATURE = (1 << 15),
282 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), 269 IDE_TFLAG_IN_HOB_NSECT = (1 << 16),
283 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), 270 IDE_TFLAG_IN_HOB_LBAL = (1 << 17),
284 IDE_TFLAG_IN_HOB_NSECT = (1 << 21), 271 IDE_TFLAG_IN_HOB_LBAM = (1 << 18),
285 IDE_TFLAG_IN_HOB_LBAL = (1 << 22), 272 IDE_TFLAG_IN_HOB_LBAH = (1 << 19),
286 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
287 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
288 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | 273 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
289 IDE_TFLAG_IN_HOB_LBAM | 274 IDE_TFLAG_IN_HOB_LBAM |
290 IDE_TFLAG_IN_HOB_LBAH, 275 IDE_TFLAG_IN_HOB_LBAH,
291 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | 276 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
292 IDE_TFLAG_IN_HOB_NSECT | 277 IDE_TFLAG_IN_HOB_NSECT |
293 IDE_TFLAG_IN_HOB_LBA, 278 IDE_TFLAG_IN_HOB_LBA,
294 IDE_TFLAG_IN_FEATURE = (1 << 1), 279 IDE_TFLAG_IN_FEATURE = (1 << 20),
295 IDE_TFLAG_IN_NSECT = (1 << 25), 280 IDE_TFLAG_IN_NSECT = (1 << 21),
296 IDE_TFLAG_IN_LBAL = (1 << 26), 281 IDE_TFLAG_IN_LBAL = (1 << 22),
297 IDE_TFLAG_IN_LBAM = (1 << 27), 282 IDE_TFLAG_IN_LBAM = (1 << 23),
298 IDE_TFLAG_IN_LBAH = (1 << 28), 283 IDE_TFLAG_IN_LBAH = (1 << 24),
299 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | 284 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
300 IDE_TFLAG_IN_LBAM | 285 IDE_TFLAG_IN_LBAM |
301 IDE_TFLAG_IN_LBAH, 286 IDE_TFLAG_IN_LBAH,
302 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | 287 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
303 IDE_TFLAG_IN_LBA, 288 IDE_TFLAG_IN_LBA,
304 IDE_TFLAG_IN_DEVICE = (1 << 29), 289 IDE_TFLAG_IN_DEVICE = (1 << 25),
305 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | 290 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
306 IDE_TFLAG_IN_HOB, 291 IDE_TFLAG_IN_HOB,
307 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | 292 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
@@ -309,9 +294,18 @@ enum {
309 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | 294 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
310 IDE_TFLAG_IN_DEVICE, 295 IDE_TFLAG_IN_DEVICE,
311 /* force 16-bit I/O operations */ 296 /* force 16-bit I/O operations */
312 IDE_TFLAG_IO_16BIT = (1 << 30), 297 IDE_TFLAG_IO_16BIT = (1 << 26),
313 /* ide_task_t was allocated using kmalloc() */ 298 /* struct ide_cmd was allocated using kmalloc() */
314 IDE_TFLAG_DYN = (1 << 31), 299 IDE_TFLAG_DYN = (1 << 27),
300 IDE_TFLAG_FS = (1 << 28),
301 IDE_TFLAG_MULTI_PIO = (1 << 29),
302};
303
304enum {
305 IDE_FTFLAG_FLAGGED = (1 << 0),
306 IDE_FTFLAG_SET_IN_FLAGS = (1 << 1),
307 IDE_FTFLAG_OUT_DATA = (1 << 2),
308 IDE_FTFLAG_IN_DATA = (1 << 3),
315}; 309};
316 310
317struct ide_taskfile { 311struct ide_taskfile {
@@ -343,16 +337,27 @@ struct ide_taskfile {
343 }; 337 };
344}; 338};
345 339
346typedef struct ide_task_s { 340struct ide_cmd {
347 union { 341 union {
348 struct ide_taskfile tf; 342 struct ide_taskfile tf;
349 u8 tf_array[14]; 343 u8 tf_array[14];
350 }; 344 };
345 u8 ftf_flags; /* for TASKFILE ioctl */
351 u32 tf_flags; 346 u32 tf_flags;
352 int data_phase; 347 int protocol;
348
349 int sg_nents; /* number of sg entries */
350 int orig_sg_nents;
351 int sg_dma_direction; /* DMA transfer direction */
352
353 unsigned int nbytes;
354 unsigned int nleft;
355 struct scatterlist *cursg;
356 unsigned int cursg_ofs;
357
353 struct request *rq; /* copy of request */ 358 struct request *rq; /* copy of request */
354 void *special; /* valid_t generally */ 359 void *special; /* valid_t generally */
355} ide_task_t; 360};
356 361
357/* ATAPI packet command flags */ 362/* ATAPI packet command flags */
358enum { 363enum {
@@ -364,8 +369,6 @@ enum {
364 PC_FLAG_DMA_IN_PROGRESS = (1 << 4), 369 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
365 PC_FLAG_DMA_ERROR = (1 << 5), 370 PC_FLAG_DMA_ERROR = (1 << 5),
366 PC_FLAG_WRITING = (1 << 6), 371 PC_FLAG_WRITING = (1 << 6),
367 /* command timed out */
368 PC_FLAG_TIMEDOUT = (1 << 7),
369}; 372};
370 373
371/* 374/*
@@ -436,7 +439,6 @@ struct ide_disk_ops {
436 int); 439 int);
437 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, 440 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
438 sector_t); 441 sector_t);
439 int (*end_request)(struct ide_drive_s *, int, int);
440 int (*ioctl)(struct ide_drive_s *, struct block_device *, 442 int (*ioctl)(struct ide_drive_s *, struct block_device *,
441 fmode_t, unsigned int, unsigned long); 443 fmode_t, unsigned int, unsigned long);
442}; 444};
@@ -512,8 +514,6 @@ enum {
512 IDE_DFLAG_NICE1 = (1 << 5), 514 IDE_DFLAG_NICE1 = (1 << 5),
513 /* device is physically present */ 515 /* device is physically present */
514 IDE_DFLAG_PRESENT = (1 << 6), 516 IDE_DFLAG_PRESENT = (1 << 6),
515 /* device ejected hint */
516 IDE_DFLAG_DEAD = (1 << 7),
517 /* id read from device (synthetic if not set) */ 517 /* id read from device (synthetic if not set) */
518 IDE_DFLAG_ID_READ = (1 << 8), 518 IDE_DFLAG_ID_READ = (1 << 8),
519 IDE_DFLAG_NOPROBE = (1 << 9), 519 IDE_DFLAG_NOPROBE = (1 << 9),
@@ -627,8 +627,11 @@ struct ide_drive_s {
627 /* current packet command */ 627 /* current packet command */
628 struct ide_atapi_pc *pc; 628 struct ide_atapi_pc *pc;
629 629
630 /* last failed packet command */
631 struct ide_atapi_pc *failed_pc;
632
630 /* callback for packet commands */ 633 /* callback for packet commands */
631 void (*pc_callback)(struct ide_drive_s *, int); 634 int (*pc_callback)(struct ide_drive_s *, int);
632 635
633 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); 636 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
634 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, 637 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
@@ -661,13 +664,13 @@ struct ide_tp_ops {
661 664
662 void (*set_irq)(struct hwif_s *, int); 665 void (*set_irq)(struct hwif_s *, int);
663 666
664 void (*tf_load)(ide_drive_t *, struct ide_task_s *); 667 void (*tf_load)(ide_drive_t *, struct ide_cmd *);
665 void (*tf_read)(ide_drive_t *, struct ide_task_s *); 668 void (*tf_read)(ide_drive_t *, struct ide_cmd *);
666 669
667 void (*input_data)(ide_drive_t *, struct request *, void *, 670 void (*input_data)(ide_drive_t *, struct ide_cmd *,
668 unsigned int); 671 void *, unsigned int);
669 void (*output_data)(ide_drive_t *, struct request *, void *, 672 void (*output_data)(ide_drive_t *, struct ide_cmd *,
670 unsigned int); 673 void *, unsigned int);
671}; 674};
672 675
673extern const struct ide_tp_ops default_tp_ops; 676extern const struct ide_tp_ops default_tp_ops;
@@ -711,12 +714,12 @@ struct ide_port_ops {
711 714
712struct ide_dma_ops { 715struct ide_dma_ops {
713 void (*dma_host_set)(struct ide_drive_s *, int); 716 void (*dma_host_set)(struct ide_drive_s *, int);
714 int (*dma_setup)(struct ide_drive_s *); 717 int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *);
715 void (*dma_exec_cmd)(struct ide_drive_s *, u8);
716 void (*dma_start)(struct ide_drive_s *); 718 void (*dma_start)(struct ide_drive_s *);
717 int (*dma_end)(struct ide_drive_s *); 719 int (*dma_end)(struct ide_drive_s *);
718 int (*dma_test_irq)(struct ide_drive_s *); 720 int (*dma_test_irq)(struct ide_drive_s *);
719 void (*dma_lost_irq)(struct ide_drive_s *); 721 void (*dma_lost_irq)(struct ide_drive_s *);
722 int (*dma_timer_expiry)(struct ide_drive_s *);
720 void (*dma_timeout)(struct ide_drive_s *); 723 void (*dma_timeout)(struct ide_drive_s *);
721 /* 724 /*
722 * The following method is optional and only required to be 725 * The following method is optional and only required to be
@@ -780,19 +783,8 @@ typedef struct hwif_s {
780 /* Scatter-gather list used to build the above */ 783 /* Scatter-gather list used to build the above */
781 struct scatterlist *sg_table; 784 struct scatterlist *sg_table;
782 int sg_max_nents; /* Maximum number of entries in it */ 785 int sg_max_nents; /* Maximum number of entries in it */
783 int sg_nents; /* Current number of entries in it */
784 int orig_sg_nents;
785 int sg_dma_direction; /* dma transfer direction */
786
787 /* data phase of the active command (currently only valid for PIO/DMA) */
788 int data_phase;
789 786
790 struct ide_task_s task; /* current command */ 787 struct ide_cmd cmd; /* current command */
791
792 unsigned int nsect;
793 unsigned int nleft;
794 struct scatterlist *cursg;
795 unsigned int cursg_ofs;
796 788
797 int rqsize; /* max sectors per request */ 789 int rqsize; /* max sectors per request */
798 int irq; /* our irq number */ 790 int irq; /* our irq number */
@@ -850,9 +842,18 @@ struct ide_host {
850 ide_hwif_t *ports[MAX_HOST_PORTS + 1]; 842 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
851 unsigned int n_ports; 843 unsigned int n_ports;
852 struct device *dev[2]; 844 struct device *dev[2];
845
853 int (*init_chipset)(struct pci_dev *); 846 int (*init_chipset)(struct pci_dev *);
847
848 void (*get_lock)(irq_handler_t, void *);
849 void (*release_lock)(void);
850
854 irq_handler_t irq_handler; 851 irq_handler_t irq_handler;
852
855 unsigned long host_flags; 853 unsigned long host_flags;
854
855 int irq_flags;
856
856 void *host_priv; 857 void *host_priv;
857 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 858 ide_hwif_t *cur_port; /* for hosts requiring serialization */
858 859
@@ -869,7 +870,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
869typedef int (ide_expiry_t)(ide_drive_t *); 870typedef int (ide_expiry_t)(ide_drive_t *);
870 871
871/* used by ide-cd, ide-floppy, etc. */ 872/* used by ide-cd, ide-floppy, etc. */
872typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 873typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned);
873 874
874extern struct mutex ide_setting_mtx; 875extern struct mutex ide_setting_mtx;
875 876
@@ -1045,10 +1046,11 @@ enum {
1045}; 1046};
1046 1047
1047/* DRV_NAME has to be defined in the driver before using the macro below */ 1048/* DRV_NAME has to be defined in the driver before using the macro below */
1048#define __ide_debug_log(lvl, fmt, args...) \ 1049#define __ide_debug_log(lvl, fmt, args...) \
1049{ \ 1050{ \
1050 if (unlikely(drive->debug_mask & lvl)) \ 1051 if (unlikely(drive->debug_mask & lvl)) \
1051 printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ 1052 printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \
1053 __func__, ## args); \
1052} 1054}
1053 1055
1054/* 1056/*
@@ -1087,7 +1089,7 @@ int generic_ide_resume(struct device *);
1087 1089
1088void ide_complete_power_step(ide_drive_t *, struct request *); 1090void ide_complete_power_step(ide_drive_t *, struct request *);
1089ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); 1091ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
1090void ide_complete_pm_request(ide_drive_t *, struct request *); 1092void ide_complete_pm_rq(ide_drive_t *, struct request *);
1091void ide_check_pm_state(ide_drive_t *, struct request *); 1093void ide_check_pm_state(ide_drive_t *, struct request *);
1092 1094
1093/* 1095/*
@@ -1099,7 +1101,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *);
1099struct ide_driver { 1101struct ide_driver {
1100 const char *version; 1102 const char *version;
1101 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1103 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1102 int (*end_request)(ide_drive_t *, int, int);
1103 struct device_driver gen_driver; 1104 struct device_driver gen_driver;
1104 int (*probe)(ide_drive_t *); 1105 int (*probe)(ide_drive_t *);
1105 void (*remove)(ide_drive_t *); 1106 void (*remove)(ide_drive_t *);
@@ -1130,19 +1131,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
1130extern int ide_vlb_clk; 1131extern int ide_vlb_clk;
1131extern int ide_pci_clk; 1132extern int ide_pci_clk;
1132 1133
1133int ide_end_request(ide_drive_t *, int, int); 1134unsigned int ide_rq_bytes(struct request *);
1134int ide_end_dequeued_request(ide_drive_t *, struct request *, int, int); 1135int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
1135void ide_kill_rq(ide_drive_t *, struct request *); 1136void ide_kill_rq(ide_drive_t *, struct request *);
1136 1137
1137void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int, 1138void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1138 ide_expiry_t *); 1139void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1139void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int,
1140 ide_expiry_t *);
1141
1142void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
1143 ide_expiry_t *);
1144 1140
1145void ide_execute_pkt_cmd(ide_drive_t *); 1141void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *,
1142 unsigned int);
1146 1143
1147void ide_pad_transfer(ide_drive_t *, int, int); 1144void ide_pad_transfer(ide_drive_t *, int, int);
1148 1145
@@ -1164,7 +1161,8 @@ extern ide_startstop_t ide_do_reset (ide_drive_t *);
1164extern int ide_devset_execute(ide_drive_t *drive, 1161extern int ide_devset_execute(ide_drive_t *drive,
1165 const struct ide_devset *setting, int arg); 1162 const struct ide_devset *setting, int arg);
1166 1163
1167extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1164void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
1165int ide_complete_rq(ide_drive_t *, int, unsigned int);
1168 1166
1169void ide_tf_dump(const char *, struct ide_taskfile *); 1167void ide_tf_dump(const char *, struct ide_taskfile *);
1170 1168
@@ -1174,11 +1172,11 @@ u8 ide_read_altstatus(ide_hwif_t *);
1174 1172
1175void ide_set_irq(ide_hwif_t *, int); 1173void ide_set_irq(ide_hwif_t *, int);
1176 1174
1177void ide_tf_load(ide_drive_t *, ide_task_t *); 1175void ide_tf_load(ide_drive_t *, struct ide_cmd *);
1178void ide_tf_read(ide_drive_t *, ide_task_t *); 1176void ide_tf_read(ide_drive_t *, struct ide_cmd *);
1179 1177
1180void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); 1178void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1181void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); 1179void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1182 1180
1183int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); 1181int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
1184 1182
@@ -1224,16 +1222,16 @@ int ide_cd_expiry(ide_drive_t *);
1224 1222
1225int ide_cd_get_xferlen(struct request *); 1223int ide_cd_get_xferlen(struct request *);
1226 1224
1227ide_startstop_t ide_issue_pc(ide_drive_t *); 1225ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *);
1228 1226
1229ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1227ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
1230 1228
1231void task_end_request(ide_drive_t *, struct request *, u8); 1229void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
1232 1230
1233int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); 1231int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
1234int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 1232int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
1235 1233
1236int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1234int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
1237 1235
1238int ide_dev_read_id(ide_drive_t *, u8, u16 *); 1236int ide_dev_read_id(ide_drive_t *, u8, u16 *);
1239 1237
@@ -1335,6 +1333,10 @@ enum {
1335 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), 1333 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1336 /* serialize ports */ 1334 /* serialize ports */
1337 IDE_HFLAG_SERIALIZE = (1 << 20), 1335 IDE_HFLAG_SERIALIZE = (1 << 20),
1336 /* host is DTC2278 */
1337 IDE_HFLAG_DTC2278 = (1 << 21),
1338 /* 4 devices on a single set of I/O ports */
1339 IDE_HFLAG_4DRIVES = (1 << 22),
1338 /* host is TRM290 */ 1340 /* host is TRM290 */
1339 IDE_HFLAG_TRM290 = (1 << 23), 1341 IDE_HFLAG_TRM290 = (1 << 23),
1340 /* use 32-bit I/O ops */ 1342 /* use 32-bit I/O ops */
@@ -1362,7 +1364,12 @@ enum {
1362 1364
1363struct ide_port_info { 1365struct ide_port_info {
1364 char *name; 1366 char *name;
1367
1365 int (*init_chipset)(struct pci_dev *); 1368 int (*init_chipset)(struct pci_dev *);
1369
1370 void (*get_lock)(irq_handler_t, void *);
1371 void (*release_lock)(void);
1372
1366 void (*init_iops)(ide_hwif_t *); 1373 void (*init_iops)(ide_hwif_t *);
1367 void (*init_hwif)(ide_hwif_t *); 1374 void (*init_hwif)(ide_hwif_t *);
1368 int (*init_dma)(ide_hwif_t *, 1375 int (*init_dma)(ide_hwif_t *,
@@ -1379,6 +1386,9 @@ struct ide_port_info {
1379 u16 max_sectors; /* if < than the default one */ 1386 u16 max_sectors; /* if < than the default one */
1380 1387
1381 u32 host_flags; 1388 u32 host_flags;
1389
1390 int irq_flags;
1391
1382 u8 pio_mask; 1392 u8 pio_mask;
1383 u8 swdma_mask; 1393 u8 swdma_mask;
1384 u8 mwdma_mask; 1394 u8 mwdma_mask;
@@ -1398,8 +1408,8 @@ int ide_pci_resume(struct pci_dev *);
1398#define ide_pci_resume NULL 1408#define ide_pci_resume NULL
1399#endif 1409#endif
1400 1410
1401void ide_map_sg(ide_drive_t *, struct request *); 1411void ide_map_sg(ide_drive_t *, struct ide_cmd *);
1402void ide_init_sg_cmd(ide_drive_t *, struct request *); 1412void ide_init_sg_cmd(struct ide_cmd *, unsigned int);
1403 1413
1404#define BAD_DMA_DRIVE 0 1414#define BAD_DMA_DRIVE 0
1405#define GOOD_DMA_DRIVE 1 1415#define GOOD_DMA_DRIVE 1
@@ -1433,18 +1443,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *);
1433int ide_allocate_dma_engine(ide_hwif_t *); 1443int ide_allocate_dma_engine(ide_hwif_t *);
1434void ide_release_dma_engine(ide_hwif_t *); 1444void ide_release_dma_engine(ide_hwif_t *);
1435 1445
1436int ide_build_sglist(ide_drive_t *, struct request *); 1446int ide_build_sglist(ide_drive_t *, struct ide_cmd *);
1437void ide_destroy_dmatable(ide_drive_t *); 1447void ide_destroy_dmatable(ide_drive_t *);
1438 1448
1439#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1449#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1440int config_drive_for_dma(ide_drive_t *); 1450int config_drive_for_dma(ide_drive_t *);
1441extern int ide_build_dmatable(ide_drive_t *, struct request *); 1451int ide_build_dmatable(ide_drive_t *, struct ide_cmd *);
1442void ide_dma_host_set(ide_drive_t *, int); 1452void ide_dma_host_set(ide_drive_t *, int);
1443extern int ide_dma_setup(ide_drive_t *); 1453int ide_dma_setup(ide_drive_t *, struct ide_cmd *);
1444void ide_dma_exec_cmd(ide_drive_t *, u8);
1445extern void ide_dma_start(ide_drive_t *); 1454extern void ide_dma_start(ide_drive_t *);
1446int ide_dma_end(ide_drive_t *); 1455int ide_dma_end(ide_drive_t *);
1447int ide_dma_test_irq(ide_drive_t *); 1456int ide_dma_test_irq(ide_drive_t *);
1457int ide_dma_sff_timer_expiry(ide_drive_t *);
1448u8 ide_dma_sff_read_status(ide_hwif_t *); 1458u8 ide_dma_sff_read_status(ide_hwif_t *);
1449extern const struct ide_dma_ops sff_dma_ops; 1459extern const struct ide_dma_ops sff_dma_ops;
1450#else 1460#else
@@ -1465,8 +1475,11 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1465static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1475static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1466static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1476static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1467static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1477static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1478static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; }
1468static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; } 1479static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; }
1469static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1480static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1481static inline int ide_build_sglist(ide_drive_t *drive,
1482 struct ide_cmd *cmd) { return 0; }
1470#endif /* CONFIG_BLK_DEV_IDEDMA */ 1483#endif /* CONFIG_BLK_DEV_IDEDMA */
1471 1484
1472#ifdef CONFIG_BLK_DEV_IDEACPI 1485#ifdef CONFIG_BLK_DEV_IDEACPI