diff options
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r-- | include/linux/ide.h | 418 |
1 files changed, 193 insertions, 225 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index fe235b65207e..ff65fffb078f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <asm/mutex.h> | 27 | #include <asm/mutex.h> |
28 | 28 | ||
29 | #if defined(CONFIG_CRIS) || defined(CONFIG_FRV) | 29 | #if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) |
30 | # define SUPPORT_VLB_SYNC 0 | 30 | # define SUPPORT_VLB_SYNC 0 |
31 | #else | 31 | #else |
32 | # define SUPPORT_VLB_SYNC 1 | 32 | # define SUPPORT_VLB_SYNC 1 |
@@ -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. */ | ||
44 | enum { | ||
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,42 +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 | /* for IDE PCI controllers in legacy mode, temporary */ | ||
197 | static inline int __ide_default_irq(unsigned long base) | ||
198 | { | ||
199 | switch (base) { | ||
200 | #ifdef CONFIG_IA64 | ||
201 | case 0x1f0: return isa_irq_to_vector(14); | ||
202 | case 0x170: return isa_irq_to_vector(15); | ||
203 | #else | ||
204 | case 0x1f0: return 14; | ||
205 | case 0x170: return 15; | ||
206 | #endif | ||
207 | } | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | #if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \ | ||
212 | defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \ | ||
213 | || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64) | ||
214 | #include <asm/ide.h> | ||
215 | #else | ||
216 | #include <asm-generic/ide_iops.h> | ||
217 | #endif | ||
218 | |||
219 | #define MAX_HWIFS 10 | 203 | #define MAX_HWIFS 10 |
220 | 204 | ||
221 | /* Currently only m68k, apus and m8xx need it */ | ||
222 | #ifndef IDE_ARCH_ACK_INTR | ||
223 | # define ide_ack_intr(hwif) (1) | ||
224 | #endif | ||
225 | |||
226 | /* Currently only Atari needs it */ | ||
227 | #ifndef IDE_ARCH_LOCK | ||
228 | # define ide_release_lock() do {} while (0) | ||
229 | # define ide_get_lock(hdlr, data) do {} while (0) | ||
230 | #endif /* IDE_ARCH_LOCK */ | ||
231 | |||
232 | /* | 205 | /* |
233 | * 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 |
234 | */ | 207 | */ |
@@ -267,108 +240,92 @@ typedef enum { | |||
267 | } ide_startstop_t; | 240 | } ide_startstop_t; |
268 | 241 | ||
269 | enum { | 242 | enum { |
243 | IDE_VALID_ERROR = (1 << 1), | ||
244 | IDE_VALID_FEATURE = IDE_VALID_ERROR, | ||
245 | IDE_VALID_NSECT = (1 << 2), | ||
246 | IDE_VALID_LBAL = (1 << 3), | ||
247 | IDE_VALID_LBAM = (1 << 4), | ||
248 | IDE_VALID_LBAH = (1 << 5), | ||
249 | IDE_VALID_DEVICE = (1 << 6), | ||
250 | IDE_VALID_LBA = IDE_VALID_LBAL | | ||
251 | IDE_VALID_LBAM | | ||
252 | IDE_VALID_LBAH, | ||
253 | IDE_VALID_OUT_TF = IDE_VALID_FEATURE | | ||
254 | IDE_VALID_NSECT | | ||
255 | IDE_VALID_LBA, | ||
256 | IDE_VALID_IN_TF = IDE_VALID_NSECT | | ||
257 | IDE_VALID_LBA, | ||
258 | IDE_VALID_OUT_HOB = IDE_VALID_OUT_TF, | ||
259 | IDE_VALID_IN_HOB = IDE_VALID_ERROR | | ||
260 | IDE_VALID_NSECT | | ||
261 | IDE_VALID_LBA, | ||
262 | }; | ||
263 | |||
264 | enum { | ||
270 | IDE_TFLAG_LBA48 = (1 << 0), | 265 | IDE_TFLAG_LBA48 = (1 << 0), |
271 | IDE_TFLAG_FLAGGED = (1 << 2), | 266 | IDE_TFLAG_WRITE = (1 << 1), |
272 | IDE_TFLAG_OUT_DATA = (1 << 3), | 267 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 2), |
273 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | 268 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3), |
274 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | ||
275 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | ||
276 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | ||
277 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | ||
278 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | ||
279 | IDE_TFLAG_OUT_HOB_NSECT | | ||
280 | IDE_TFLAG_OUT_HOB_LBAL | | ||
281 | IDE_TFLAG_OUT_HOB_LBAM | | ||
282 | IDE_TFLAG_OUT_HOB_LBAH, | ||
283 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | ||
284 | IDE_TFLAG_OUT_NSECT = (1 << 10), | ||
285 | IDE_TFLAG_OUT_LBAL = (1 << 11), | ||
286 | IDE_TFLAG_OUT_LBAM = (1 << 12), | ||
287 | IDE_TFLAG_OUT_LBAH = (1 << 13), | ||
288 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | ||
289 | IDE_TFLAG_OUT_NSECT | | ||
290 | IDE_TFLAG_OUT_LBAL | | ||
291 | IDE_TFLAG_OUT_LBAM | | ||
292 | IDE_TFLAG_OUT_LBAH, | ||
293 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | ||
294 | IDE_TFLAG_WRITE = (1 << 15), | ||
295 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | ||
296 | IDE_TFLAG_IN_DATA = (1 << 17), | ||
297 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | ||
298 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | ||
299 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | ||
300 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | ||
301 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | ||
302 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | ||
303 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | ||
304 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | ||
305 | IDE_TFLAG_IN_HOB_LBAM | | ||
306 | IDE_TFLAG_IN_HOB_LBAH, | ||
307 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | ||
308 | IDE_TFLAG_IN_HOB_NSECT | | ||
309 | IDE_TFLAG_IN_HOB_LBA, | ||
310 | IDE_TFLAG_IN_FEATURE = (1 << 1), | ||
311 | IDE_TFLAG_IN_NSECT = (1 << 25), | ||
312 | IDE_TFLAG_IN_LBAL = (1 << 26), | ||
313 | IDE_TFLAG_IN_LBAM = (1 << 27), | ||
314 | IDE_TFLAG_IN_LBAH = (1 << 28), | ||
315 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | ||
316 | IDE_TFLAG_IN_LBAM | | ||
317 | IDE_TFLAG_IN_LBAH, | ||
318 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | ||
319 | IDE_TFLAG_IN_LBA, | ||
320 | IDE_TFLAG_IN_DEVICE = (1 << 29), | ||
321 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
322 | IDE_TFLAG_IN_HOB, | ||
323 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
324 | IDE_TFLAG_IN_TF, | ||
325 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
326 | IDE_TFLAG_IN_DEVICE, | ||
327 | /* force 16-bit I/O operations */ | 269 | /* force 16-bit I/O operations */ |
328 | IDE_TFLAG_IO_16BIT = (1 << 30), | 270 | IDE_TFLAG_IO_16BIT = (1 << 4), |
329 | /* ide_task_t was allocated using kmalloc() */ | 271 | /* struct ide_cmd was allocated using kmalloc() */ |
330 | IDE_TFLAG_DYN = (1 << 31), | 272 | IDE_TFLAG_DYN = (1 << 5), |
273 | IDE_TFLAG_FS = (1 << 6), | ||
274 | IDE_TFLAG_MULTI_PIO = (1 << 7), | ||
331 | }; | 275 | }; |
332 | 276 | ||
333 | struct ide_taskfile { | 277 | enum { |
334 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | 278 | IDE_FTFLAG_FLAGGED = (1 << 0), |
279 | IDE_FTFLAG_SET_IN_FLAGS = (1 << 1), | ||
280 | IDE_FTFLAG_OUT_DATA = (1 << 2), | ||
281 | IDE_FTFLAG_IN_DATA = (1 << 3), | ||
282 | }; | ||
335 | 283 | ||
336 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | 284 | struct ide_taskfile { |
337 | u8 hob_nsect; | 285 | u8 data; /* 0: data byte (for TASKFILE ioctl) */ |
338 | u8 hob_lbal; | 286 | union { /* 1: */ |
339 | u8 hob_lbam; | 287 | u8 error; /* read: error */ |
340 | u8 hob_lbah; | 288 | u8 feature; /* write: feature */ |
289 | }; | ||
290 | u8 nsect; /* 2: number of sectors */ | ||
291 | u8 lbal; /* 3: LBA low */ | ||
292 | u8 lbam; /* 4: LBA mid */ | ||
293 | u8 lbah; /* 5: LBA high */ | ||
294 | u8 device; /* 6: device select */ | ||
295 | union { /* 7: */ | ||
296 | u8 status; /* read: status */ | ||
297 | u8 command; /* write: command */ | ||
298 | }; | ||
299 | }; | ||
341 | 300 | ||
342 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | 301 | struct ide_cmd { |
302 | struct ide_taskfile tf; | ||
303 | struct ide_taskfile hob; | ||
304 | struct { | ||
305 | struct { | ||
306 | u8 tf; | ||
307 | u8 hob; | ||
308 | } out, in; | ||
309 | } valid; | ||
343 | 310 | ||
344 | union { /* Â 7: */ | 311 | u8 tf_flags; |
345 | u8 error; /* read: error */ | 312 | u8 ftf_flags; /* for TASKFILE ioctl */ |
346 | u8 feature; /* write: feature */ | 313 | int protocol; |
347 | }; | ||
348 | 314 | ||
349 | u8 nsect; /* 8: number of sectors */ | 315 | int sg_nents; /* number of sg entries */ |
350 | u8 lbal; /* 9: LBA low */ | 316 | int orig_sg_nents; |
351 | u8 lbam; /* 10: LBA mid */ | 317 | int sg_dma_direction; /* DMA transfer direction */ |
352 | u8 lbah; /* 11: LBA high */ | ||
353 | 318 | ||
354 | u8 device; /* 12: device select */ | 319 | unsigned int nbytes; |
320 | unsigned int nleft; | ||
321 | unsigned int last_xfer_len; | ||
355 | 322 | ||
356 | union { /* 13: */ | 323 | struct scatterlist *cursg; |
357 | u8 status; /*  read: status  */ | 324 | unsigned int cursg_ofs; |
358 | u8 command; /* write: command */ | ||
359 | }; | ||
360 | }; | ||
361 | 325 | ||
362 | typedef struct ide_task_s { | ||
363 | union { | ||
364 | struct ide_taskfile tf; | ||
365 | u8 tf_array[14]; | ||
366 | }; | ||
367 | u32 tf_flags; | ||
368 | int data_phase; | ||
369 | struct request *rq; /* copy of request */ | 326 | struct request *rq; /* copy of request */ |
370 | void *special; /* valid_t generally */ | 327 | void *special; /* valid_t generally */ |
371 | } ide_task_t; | 328 | }; |
372 | 329 | ||
373 | /* ATAPI packet command flags */ | 330 | /* ATAPI packet command flags */ |
374 | enum { | 331 | enum { |
@@ -380,15 +337,13 @@ enum { | |||
380 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | 337 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), |
381 | PC_FLAG_DMA_ERROR = (1 << 5), | 338 | PC_FLAG_DMA_ERROR = (1 << 5), |
382 | PC_FLAG_WRITING = (1 << 6), | 339 | PC_FLAG_WRITING = (1 << 6), |
383 | /* command timed out */ | ||
384 | PC_FLAG_TIMEDOUT = (1 << 7), | ||
385 | }; | 340 | }; |
386 | 341 | ||
387 | /* | 342 | /* |
388 | * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. | 343 | * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. |
389 | * This is used for several packet commands (not for READ/WRITE commands). | 344 | * This is used for several packet commands (not for READ/WRITE commands). |
390 | */ | 345 | */ |
391 | #define IDE_PC_BUFFER_SIZE 256 | 346 | #define IDE_PC_BUFFER_SIZE 64 |
392 | #define ATAPI_WAIT_PC (60 * HZ) | 347 | #define ATAPI_WAIT_PC (60 * HZ) |
393 | 348 | ||
394 | struct ide_atapi_pc { | 349 | struct ide_atapi_pc { |
@@ -426,9 +381,6 @@ struct ide_atapi_pc { | |||
426 | struct idetape_bh *bh; | 381 | struct idetape_bh *bh; |
427 | char *b_data; | 382 | char *b_data; |
428 | 383 | ||
429 | struct scatterlist *sg; | ||
430 | unsigned int sg_cnt; | ||
431 | |||
432 | unsigned long timeout; | 384 | unsigned long timeout; |
433 | }; | 385 | }; |
434 | 386 | ||
@@ -452,7 +404,6 @@ struct ide_disk_ops { | |||
452 | int); | 404 | int); |
453 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, | 405 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, |
454 | sector_t); | 406 | sector_t); |
455 | int (*end_request)(struct ide_drive_s *, int, int); | ||
456 | int (*ioctl)(struct ide_drive_s *, struct block_device *, | 407 | int (*ioctl)(struct ide_drive_s *, struct block_device *, |
457 | fmode_t, unsigned int, unsigned long); | 408 | fmode_t, unsigned int, unsigned long); |
458 | }; | 409 | }; |
@@ -470,11 +421,6 @@ enum { | |||
470 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), | 421 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), |
471 | /* TOC track numbers are in BCD. */ | 422 | /* TOC track numbers are in BCD. */ |
472 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), | 423 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), |
473 | /* | ||
474 | * Drive does not provide data in multiples of SECTOR_SIZE | ||
475 | * when more than one interrupt is needed. | ||
476 | */ | ||
477 | IDE_AFLAG_LIMIT_NFRAMES = (1 << 5), | ||
478 | /* Saved TOC information is current. */ | 424 | /* Saved TOC information is current. */ |
479 | IDE_AFLAG_TOC_VALID = (1 << 6), | 425 | IDE_AFLAG_TOC_VALID = (1 << 6), |
480 | /* We think that the drive door is locked. */ | 426 | /* We think that the drive door is locked. */ |
@@ -528,8 +474,6 @@ enum { | |||
528 | IDE_DFLAG_NICE1 = (1 << 5), | 474 | IDE_DFLAG_NICE1 = (1 << 5), |
529 | /* device is physically present */ | 475 | /* device is physically present */ |
530 | IDE_DFLAG_PRESENT = (1 << 6), | 476 | IDE_DFLAG_PRESENT = (1 << 6), |
531 | /* device ejected hint */ | ||
532 | IDE_DFLAG_DEAD = (1 << 7), | ||
533 | /* id read from device (synthetic if not set) */ | 477 | /* id read from device (synthetic if not set) */ |
534 | IDE_DFLAG_ID_READ = (1 << 8), | 478 | IDE_DFLAG_ID_READ = (1 << 8), |
535 | IDE_DFLAG_NOPROBE = (1 << 9), | 479 | IDE_DFLAG_NOPROBE = (1 << 9), |
@@ -621,7 +565,7 @@ struct ide_drive_s { | |||
621 | 565 | ||
622 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ | 566 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ |
623 | unsigned int cyl; /* "real" number of cyls */ | 567 | unsigned int cyl; /* "real" number of cyls */ |
624 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ | 568 | unsigned int drive_data; /* used by set_pio_mode/dev_select() */ |
625 | unsigned int failures; /* current failure count */ | 569 | unsigned int failures; /* current failure count */ |
626 | unsigned int max_failures; /* maximum allowed failure count */ | 570 | unsigned int max_failures; /* maximum allowed failure count */ |
627 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ | 571 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ |
@@ -643,8 +587,11 @@ struct ide_drive_s { | |||
643 | /* current packet command */ | 587 | /* current packet command */ |
644 | struct ide_atapi_pc *pc; | 588 | struct ide_atapi_pc *pc; |
645 | 589 | ||
590 | /* last failed packet command */ | ||
591 | struct ide_atapi_pc *failed_pc; | ||
592 | |||
646 | /* callback for packet commands */ | 593 | /* callback for packet commands */ |
647 | void (*pc_callback)(struct ide_drive_s *, int); | 594 | int (*pc_callback)(struct ide_drive_s *, int); |
648 | 595 | ||
649 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); | 596 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); |
650 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, | 597 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, |
@@ -674,16 +621,16 @@ struct ide_tp_ops { | |||
674 | void (*exec_command)(struct hwif_s *, u8); | 621 | void (*exec_command)(struct hwif_s *, u8); |
675 | u8 (*read_status)(struct hwif_s *); | 622 | u8 (*read_status)(struct hwif_s *); |
676 | u8 (*read_altstatus)(struct hwif_s *); | 623 | u8 (*read_altstatus)(struct hwif_s *); |
624 | void (*write_devctl)(struct hwif_s *, u8); | ||
677 | 625 | ||
678 | void (*set_irq)(struct hwif_s *, int); | 626 | void (*dev_select)(ide_drive_t *); |
679 | 627 | void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8); | |
680 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); | 628 | void (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8); |
681 | void (*tf_read)(ide_drive_t *, struct ide_task_s *); | ||
682 | 629 | ||
683 | void (*input_data)(ide_drive_t *, struct request *, void *, | 630 | void (*input_data)(ide_drive_t *, struct ide_cmd *, |
684 | unsigned int); | 631 | void *, unsigned int); |
685 | void (*output_data)(ide_drive_t *, struct request *, void *, | 632 | void (*output_data)(ide_drive_t *, struct ide_cmd *, |
686 | unsigned int); | 633 | void *, unsigned int); |
687 | }; | 634 | }; |
688 | 635 | ||
689 | extern const struct ide_tp_ops default_tp_ops; | 636 | extern const struct ide_tp_ops default_tp_ops; |
@@ -694,7 +641,6 @@ extern const struct ide_tp_ops default_tp_ops; | |||
694 | * @init_dev: host specific initialization of a device | 641 | * @init_dev: host specific initialization of a device |
695 | * @set_pio_mode: routine to program host for PIO mode | 642 | * @set_pio_mode: routine to program host for PIO mode |
696 | * @set_dma_mode: routine to program host for DMA mode | 643 | * @set_dma_mode: routine to program host for DMA mode |
697 | * @selectproc: tweaks hardware to select drive | ||
698 | * @reset_poll: chipset polling based on hba specifics | 644 | * @reset_poll: chipset polling based on hba specifics |
699 | * @pre_reset: chipset specific changes to default for device-hba resets | 645 | * @pre_reset: chipset specific changes to default for device-hba resets |
700 | * @resetproc: routine to reset controller after a disk reset | 646 | * @resetproc: routine to reset controller after a disk reset |
@@ -711,7 +657,6 @@ struct ide_port_ops { | |||
711 | void (*init_dev)(ide_drive_t *); | 657 | void (*init_dev)(ide_drive_t *); |
712 | void (*set_pio_mode)(ide_drive_t *, const u8); | 658 | void (*set_pio_mode)(ide_drive_t *, const u8); |
713 | void (*set_dma_mode)(ide_drive_t *, const u8); | 659 | void (*set_dma_mode)(ide_drive_t *, const u8); |
714 | void (*selectproc)(ide_drive_t *); | ||
715 | int (*reset_poll)(ide_drive_t *); | 660 | int (*reset_poll)(ide_drive_t *); |
716 | void (*pre_reset)(ide_drive_t *); | 661 | void (*pre_reset)(ide_drive_t *); |
717 | void (*resetproc)(ide_drive_t *); | 662 | void (*resetproc)(ide_drive_t *); |
@@ -727,13 +672,15 @@ struct ide_port_ops { | |||
727 | 672 | ||
728 | struct ide_dma_ops { | 673 | struct ide_dma_ops { |
729 | void (*dma_host_set)(struct ide_drive_s *, int); | 674 | void (*dma_host_set)(struct ide_drive_s *, int); |
730 | int (*dma_setup)(struct ide_drive_s *); | 675 | int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *); |
731 | void (*dma_exec_cmd)(struct ide_drive_s *, u8); | ||
732 | void (*dma_start)(struct ide_drive_s *); | 676 | void (*dma_start)(struct ide_drive_s *); |
733 | int (*dma_end)(struct ide_drive_s *); | 677 | int (*dma_end)(struct ide_drive_s *); |
734 | int (*dma_test_irq)(struct ide_drive_s *); | 678 | int (*dma_test_irq)(struct ide_drive_s *); |
735 | void (*dma_lost_irq)(struct ide_drive_s *); | 679 | void (*dma_lost_irq)(struct ide_drive_s *); |
736 | void (*dma_timeout)(struct ide_drive_s *); | 680 | /* below ones are optional */ |
681 | int (*dma_check)(struct ide_drive_s *, struct ide_cmd *); | ||
682 | int (*dma_timer_expiry)(struct ide_drive_s *); | ||
683 | void (*dma_clear)(struct ide_drive_s *); | ||
737 | /* | 684 | /* |
738 | * The following method is optional and only required to be | 685 | * The following method is optional and only required to be |
739 | * implemented for the SFF-8038i compatible controllers. | 686 | * implemented for the SFF-8038i compatible controllers. |
@@ -796,18 +743,8 @@ typedef struct hwif_s { | |||
796 | /* Scatter-gather list used to build the above */ | 743 | /* Scatter-gather list used to build the above */ |
797 | struct scatterlist *sg_table; | 744 | struct scatterlist *sg_table; |
798 | int sg_max_nents; /* Maximum number of entries in it */ | 745 | int sg_max_nents; /* Maximum number of entries in it */ |
799 | int sg_nents; /* Current number of entries in it */ | ||
800 | int sg_dma_direction; /* dma transfer direction */ | ||
801 | 746 | ||
802 | /* data phase of the active command (currently only valid for PIO/DMA) */ | 747 | struct ide_cmd cmd; /* current command */ |
803 | int data_phase; | ||
804 | |||
805 | struct ide_task_s task; /* current command */ | ||
806 | |||
807 | unsigned int nsect; | ||
808 | unsigned int nleft; | ||
809 | struct scatterlist *cursg; | ||
810 | unsigned int cursg_ofs; | ||
811 | 748 | ||
812 | int rqsize; /* max sectors per request */ | 749 | int rqsize; /* max sectors per request */ |
813 | int irq; /* our irq number */ | 750 | int irq; /* our irq number */ |
@@ -865,8 +802,18 @@ struct ide_host { | |||
865 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; | 802 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; |
866 | unsigned int n_ports; | 803 | unsigned int n_ports; |
867 | struct device *dev[2]; | 804 | struct device *dev[2]; |
868 | unsigned int (*init_chipset)(struct pci_dev *); | 805 | |
806 | int (*init_chipset)(struct pci_dev *); | ||
807 | |||
808 | void (*get_lock)(irq_handler_t, void *); | ||
809 | void (*release_lock)(void); | ||
810 | |||
811 | irq_handler_t irq_handler; | ||
812 | |||
869 | unsigned long host_flags; | 813 | unsigned long host_flags; |
814 | |||
815 | int irq_flags; | ||
816 | |||
870 | void *host_priv; | 817 | void *host_priv; |
871 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ | 818 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ |
872 | 819 | ||
@@ -883,7 +830,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); | |||
883 | typedef int (ide_expiry_t)(ide_drive_t *); | 830 | typedef int (ide_expiry_t)(ide_drive_t *); |
884 | 831 | ||
885 | /* used by ide-cd, ide-floppy, etc. */ | 832 | /* used by ide-cd, ide-floppy, etc. */ |
886 | typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); | 833 | typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned); |
887 | 834 | ||
888 | extern struct mutex ide_setting_mtx; | 835 | extern struct mutex ide_setting_mtx; |
889 | 836 | ||
@@ -1059,10 +1006,11 @@ enum { | |||
1059 | }; | 1006 | }; |
1060 | 1007 | ||
1061 | /* DRV_NAME has to be defined in the driver before using the macro below */ | 1008 | /* DRV_NAME has to be defined in the driver before using the macro below */ |
1062 | #define __ide_debug_log(lvl, fmt, args...) \ | 1009 | #define __ide_debug_log(lvl, fmt, args...) \ |
1063 | { \ | 1010 | { \ |
1064 | if (unlikely(drive->debug_mask & lvl)) \ | 1011 | if (unlikely(drive->debug_mask & lvl)) \ |
1065 | printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ | 1012 | printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \ |
1013 | __func__, ## args); \ | ||
1066 | } | 1014 | } |
1067 | 1015 | ||
1068 | /* | 1016 | /* |
@@ -1101,7 +1049,7 @@ int generic_ide_resume(struct device *); | |||
1101 | 1049 | ||
1102 | void ide_complete_power_step(ide_drive_t *, struct request *); | 1050 | void ide_complete_power_step(ide_drive_t *, struct request *); |
1103 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); | 1051 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); |
1104 | void ide_complete_pm_request(ide_drive_t *, struct request *); | 1052 | void ide_complete_pm_rq(ide_drive_t *, struct request *); |
1105 | void ide_check_pm_state(ide_drive_t *, struct request *); | 1053 | void ide_check_pm_state(ide_drive_t *, struct request *); |
1106 | 1054 | ||
1107 | /* | 1055 | /* |
@@ -1113,7 +1061,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *); | |||
1113 | struct ide_driver { | 1061 | struct ide_driver { |
1114 | const char *version; | 1062 | const char *version; |
1115 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 1063 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
1116 | int (*end_request)(ide_drive_t *, int, int); | ||
1117 | struct device_driver gen_driver; | 1064 | struct device_driver gen_driver; |
1118 | int (*probe)(ide_drive_t *); | 1065 | int (*probe)(ide_drive_t *); |
1119 | void (*remove)(ide_drive_t *); | 1066 | void (*remove)(ide_drive_t *); |
@@ -1144,16 +1091,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l | |||
1144 | extern int ide_vlb_clk; | 1091 | extern int ide_vlb_clk; |
1145 | extern int ide_pci_clk; | 1092 | extern int ide_pci_clk; |
1146 | 1093 | ||
1147 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 1094 | unsigned int ide_rq_bytes(struct request *); |
1148 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 1095 | int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int); |
1149 | int uptodate, int nr_sectors); | 1096 | void ide_kill_rq(ide_drive_t *, struct request *); |
1150 | 1097 | ||
1151 | extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); | 1098 | void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
1099 | void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); | ||
1152 | 1100 | ||
1153 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, | 1101 | void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *, |
1154 | ide_expiry_t *); | 1102 | unsigned int); |
1155 | |||
1156 | void ide_execute_pkt_cmd(ide_drive_t *); | ||
1157 | 1103 | ||
1158 | void ide_pad_transfer(ide_drive_t *, int, int); | 1104 | void ide_pad_transfer(ide_drive_t *, int, int); |
1159 | 1105 | ||
@@ -1167,41 +1113,37 @@ int ide_busy_sleep(ide_hwif_t *, unsigned long, int); | |||
1167 | 1113 | ||
1168 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 1114 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
1169 | 1115 | ||
1116 | ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *); | ||
1117 | ide_startstop_t ide_do_devset(ide_drive_t *, struct request *); | ||
1118 | |||
1170 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1119 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
1171 | 1120 | ||
1172 | extern int ide_devset_execute(ide_drive_t *drive, | 1121 | extern int ide_devset_execute(ide_drive_t *drive, |
1173 | const struct ide_devset *setting, int arg); | 1122 | const struct ide_devset *setting, int arg); |
1174 | 1123 | ||
1175 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); | 1124 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); |
1125 | int ide_complete_rq(ide_drive_t *, int, unsigned int); | ||
1176 | 1126 | ||
1177 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1127 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd); |
1178 | 1128 | void ide_tf_dump(const char *, struct ide_cmd *); | |
1179 | void ide_tf_dump(const char *, struct ide_taskfile *); | ||
1180 | 1129 | ||
1181 | void ide_exec_command(ide_hwif_t *, u8); | 1130 | void ide_exec_command(ide_hwif_t *, u8); |
1182 | u8 ide_read_status(ide_hwif_t *); | 1131 | u8 ide_read_status(ide_hwif_t *); |
1183 | u8 ide_read_altstatus(ide_hwif_t *); | 1132 | u8 ide_read_altstatus(ide_hwif_t *); |
1133 | void ide_write_devctl(ide_hwif_t *, u8); | ||
1184 | 1134 | ||
1185 | void ide_set_irq(ide_hwif_t *, int); | 1135 | void ide_dev_select(ide_drive_t *); |
1186 | 1136 | void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8); | |
1187 | void ide_tf_load(ide_drive_t *, ide_task_t *); | 1137 | void ide_tf_read(ide_drive_t *, struct ide_taskfile *, u8); |
1188 | void ide_tf_read(ide_drive_t *, ide_task_t *); | ||
1189 | 1138 | ||
1190 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); | 1139 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
1191 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); | 1140 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
1192 | 1141 | ||
1193 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); | ||
1194 | |||
1195 | extern void SELECT_DRIVE(ide_drive_t *); | ||
1196 | void SELECT_MASK(ide_drive_t *, int); | 1142 | void SELECT_MASK(ide_drive_t *, int); |
1197 | 1143 | ||
1198 | u8 ide_read_error(ide_drive_t *); | 1144 | u8 ide_read_error(ide_drive_t *); |
1199 | void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); | 1145 | void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); |
1200 | 1146 | ||
1201 | extern int drive_is_ready(ide_drive_t *); | ||
1202 | |||
1203 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | ||
1204 | |||
1205 | int ide_check_atapi_device(ide_drive_t *, const char *); | 1147 | int ide_check_atapi_device(ide_drive_t *, const char *); |
1206 | 1148 | ||
1207 | void ide_init_pc(struct ide_atapi_pc *); | 1149 | void ide_init_pc(struct ide_atapi_pc *); |
@@ -1238,16 +1180,20 @@ int ide_cd_expiry(ide_drive_t *); | |||
1238 | 1180 | ||
1239 | int ide_cd_get_xferlen(struct request *); | 1181 | int ide_cd_get_xferlen(struct request *); |
1240 | 1182 | ||
1241 | ide_startstop_t ide_issue_pc(ide_drive_t *); | 1183 | ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *); |
1184 | |||
1185 | ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *); | ||
1242 | 1186 | ||
1243 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 1187 | void ide_pio_bytes(ide_drive_t *, struct ide_cmd *, unsigned int, unsigned int); |
1244 | 1188 | ||
1245 | void task_end_request(ide_drive_t *, struct request *, u8); | 1189 | void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8); |
1246 | 1190 | ||
1247 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | 1191 | int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16); |
1248 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 1192 | int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *); |
1249 | 1193 | ||
1250 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 1194 | int ide_taskfile_ioctl(ide_drive_t *, unsigned long); |
1195 | |||
1196 | int ide_dev_read_id(ide_drive_t *, u8, u16 *); | ||
1251 | 1197 | ||
1252 | extern int ide_driveid_update(ide_drive_t *); | 1198 | extern int ide_driveid_update(ide_drive_t *); |
1253 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 1199 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
@@ -1278,7 +1224,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev) | |||
1278 | return 0; | 1224 | return 0; |
1279 | } | 1225 | } |
1280 | 1226 | ||
1281 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, | 1227 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, |
1282 | hw_regs_t *, hw_regs_t **); | 1228 | hw_regs_t *, hw_regs_t **); |
1283 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1229 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1284 | 1230 | ||
@@ -1347,10 +1293,10 @@ enum { | |||
1347 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), | 1293 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), |
1348 | /* serialize ports */ | 1294 | /* serialize ports */ |
1349 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1295 | IDE_HFLAG_SERIALIZE = (1 << 20), |
1350 | /* use legacy IRQs */ | 1296 | /* host is DTC2278 */ |
1351 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), | 1297 | IDE_HFLAG_DTC2278 = (1 << 21), |
1352 | /* force use of legacy IRQs */ | 1298 | /* 4 devices on a single set of I/O ports */ |
1353 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), | 1299 | IDE_HFLAG_4DRIVES = (1 << 22), |
1354 | /* host is TRM290 */ | 1300 | /* host is TRM290 */ |
1355 | IDE_HFLAG_TRM290 = (1 << 23), | 1301 | IDE_HFLAG_TRM290 = (1 << 23), |
1356 | /* use 32-bit I/O ops */ | 1302 | /* use 32-bit I/O ops */ |
@@ -1378,7 +1324,12 @@ enum { | |||
1378 | 1324 | ||
1379 | struct ide_port_info { | 1325 | struct ide_port_info { |
1380 | char *name; | 1326 | char *name; |
1381 | unsigned int (*init_chipset)(struct pci_dev *); | 1327 | |
1328 | int (*init_chipset)(struct pci_dev *); | ||
1329 | |||
1330 | void (*get_lock)(irq_handler_t, void *); | ||
1331 | void (*release_lock)(void); | ||
1332 | |||
1382 | void (*init_iops)(ide_hwif_t *); | 1333 | void (*init_iops)(ide_hwif_t *); |
1383 | void (*init_hwif)(ide_hwif_t *); | 1334 | void (*init_hwif)(ide_hwif_t *); |
1384 | int (*init_dma)(ide_hwif_t *, | 1335 | int (*init_dma)(ide_hwif_t *, |
@@ -1395,6 +1346,9 @@ struct ide_port_info { | |||
1395 | u16 max_sectors; /* if < than the default one */ | 1346 | u16 max_sectors; /* if < than the default one */ |
1396 | 1347 | ||
1397 | u32 host_flags; | 1348 | u32 host_flags; |
1349 | |||
1350 | int irq_flags; | ||
1351 | |||
1398 | u8 pio_mask; | 1352 | u8 pio_mask; |
1399 | u8 swdma_mask; | 1353 | u8 swdma_mask; |
1400 | u8 mwdma_mask; | 1354 | u8 mwdma_mask; |
@@ -1414,8 +1368,8 @@ int ide_pci_resume(struct pci_dev *); | |||
1414 | #define ide_pci_resume NULL | 1368 | #define ide_pci_resume NULL |
1415 | #endif | 1369 | #endif |
1416 | 1370 | ||
1417 | void ide_map_sg(ide_drive_t *, struct request *); | 1371 | void ide_map_sg(ide_drive_t *, struct ide_cmd *); |
1418 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1372 | void ide_init_sg_cmd(struct ide_cmd *, unsigned int); |
1419 | 1373 | ||
1420 | #define BAD_DMA_DRIVE 0 | 1374 | #define BAD_DMA_DRIVE 0 |
1421 | #define GOOD_DMA_DRIVE 1 | 1375 | #define GOOD_DMA_DRIVE 1 |
@@ -1449,18 +1403,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *); | |||
1449 | int ide_allocate_dma_engine(ide_hwif_t *); | 1403 | int ide_allocate_dma_engine(ide_hwif_t *); |
1450 | void ide_release_dma_engine(ide_hwif_t *); | 1404 | void ide_release_dma_engine(ide_hwif_t *); |
1451 | 1405 | ||
1452 | int ide_build_sglist(ide_drive_t *, struct request *); | 1406 | int ide_dma_prepare(ide_drive_t *, struct ide_cmd *); |
1453 | void ide_destroy_dmatable(ide_drive_t *); | 1407 | void ide_dma_unmap_sg(ide_drive_t *, struct ide_cmd *); |
1454 | 1408 | ||
1455 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1409 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1456 | int config_drive_for_dma(ide_drive_t *); | 1410 | int config_drive_for_dma(ide_drive_t *); |
1457 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1411 | int ide_build_dmatable(ide_drive_t *, struct ide_cmd *); |
1458 | void ide_dma_host_set(ide_drive_t *, int); | 1412 | void ide_dma_host_set(ide_drive_t *, int); |
1459 | extern int ide_dma_setup(ide_drive_t *); | 1413 | int ide_dma_setup(ide_drive_t *, struct ide_cmd *); |
1460 | void ide_dma_exec_cmd(ide_drive_t *, u8); | ||
1461 | extern void ide_dma_start(ide_drive_t *); | 1414 | extern void ide_dma_start(ide_drive_t *); |
1462 | int ide_dma_end(ide_drive_t *); | 1415 | int ide_dma_end(ide_drive_t *); |
1463 | int ide_dma_test_irq(ide_drive_t *); | 1416 | int ide_dma_test_irq(ide_drive_t *); |
1417 | int ide_dma_sff_timer_expiry(ide_drive_t *); | ||
1464 | u8 ide_dma_sff_read_status(ide_hwif_t *); | 1418 | u8 ide_dma_sff_read_status(ide_hwif_t *); |
1465 | extern const struct ide_dma_ops sff_dma_ops; | 1419 | extern const struct ide_dma_ops sff_dma_ops; |
1466 | #else | 1420 | #else |
@@ -1468,7 +1422,7 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } | |||
1468 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1422 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
1469 | 1423 | ||
1470 | void ide_dma_lost_irq(ide_drive_t *); | 1424 | void ide_dma_lost_irq(ide_drive_t *); |
1471 | void ide_dma_timeout(ide_drive_t *); | 1425 | ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int); |
1472 | 1426 | ||
1473 | #else | 1427 | #else |
1474 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } | 1428 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } |
@@ -1480,21 +1434,29 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; } | |||
1480 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1434 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1481 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1435 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1482 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1436 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
1437 | static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; } | ||
1438 | static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; } | ||
1483 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } | 1439 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1440 | static inline int ide_dma_prepare(ide_drive_t *drive, | ||
1441 | struct ide_cmd *cmd) { return 1; } | ||
1442 | static inline void ide_dma_unmap_sg(ide_drive_t *drive, | ||
1443 | struct ide_cmd *cmd) { ; } | ||
1484 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1444 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1485 | 1445 | ||
1486 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1446 | #ifdef CONFIG_BLK_DEV_IDEACPI |
1447 | int ide_acpi_init(void); | ||
1487 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); | 1448 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); |
1488 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); | 1449 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); |
1489 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); | 1450 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); |
1490 | extern void ide_acpi_init(ide_hwif_t *hwif); | 1451 | void ide_acpi_init_port(ide_hwif_t *); |
1491 | void ide_acpi_port_init_devices(ide_hwif_t *); | 1452 | void ide_acpi_port_init_devices(ide_hwif_t *); |
1492 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); | 1453 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); |
1493 | #else | 1454 | #else |
1455 | static inline int ide_acpi_init(void) { return 0; } | ||
1494 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } | 1456 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } |
1495 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } | 1457 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } |
1496 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } | 1458 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } |
1497 | static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } | 1459 | static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; } |
1498 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } | 1460 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } |
1499 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | 1461 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} |
1500 | #endif | 1462 | #endif |
@@ -1528,11 +1490,9 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data) | |||
1528 | hwif->hwif_data = data; | 1490 | hwif->hwif_data = data; |
1529 | } | 1491 | } |
1530 | 1492 | ||
1531 | const char *ide_xfer_verbose(u8 mode); | ||
1532 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1493 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1533 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | ||
1534 | 1494 | ||
1535 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1495 | u64 ide_get_lba_addr(struct ide_cmd *, int); |
1536 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1496 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1537 | 1497 | ||
1538 | struct ide_timing { | 1498 | struct ide_timing { |
@@ -1569,14 +1529,18 @@ void ide_timing_merge(struct ide_timing *, struct ide_timing *, | |||
1569 | struct ide_timing *, unsigned int); | 1529 | struct ide_timing *, unsigned int); |
1570 | int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); | 1530 | int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); |
1571 | 1531 | ||
1532 | #ifdef CONFIG_IDE_XFER_MODE | ||
1572 | int ide_scan_pio_blacklist(char *); | 1533 | int ide_scan_pio_blacklist(char *); |
1573 | 1534 | const char *ide_xfer_verbose(u8); | |
1574 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); | 1535 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); |
1575 | |||
1576 | int ide_set_pio_mode(ide_drive_t *, u8); | 1536 | int ide_set_pio_mode(ide_drive_t *, u8); |
1577 | int ide_set_dma_mode(ide_drive_t *, u8); | 1537 | int ide_set_dma_mode(ide_drive_t *, u8); |
1578 | |||
1579 | void ide_set_pio(ide_drive_t *, u8); | 1538 | void ide_set_pio(ide_drive_t *, u8); |
1539 | int ide_set_xfer_rate(ide_drive_t *, u8); | ||
1540 | #else | ||
1541 | static inline void ide_set_pio(ide_drive_t *drive, u8 pio) { ; } | ||
1542 | static inline int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { return -1; } | ||
1543 | #endif | ||
1580 | 1544 | ||
1581 | static inline void ide_set_max_pio(ide_drive_t *drive) | 1545 | static inline void ide_set_max_pio(ide_drive_t *drive) |
1582 | { | 1546 | { |
@@ -1609,6 +1573,10 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) | |||
1609 | #define ide_port_for_each_dev(i, dev, port) \ | 1573 | #define ide_port_for_each_dev(i, dev, port) \ |
1610 | for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) | 1574 | for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) |
1611 | 1575 | ||
1576 | #define ide_port_for_each_present_dev(i, dev, port) \ | ||
1577 | for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) \ | ||
1578 | if ((dev)->dev_flags & IDE_DFLAG_PRESENT) | ||
1579 | |||
1612 | #define ide_host_for_each_port(i, port, host) \ | 1580 | #define ide_host_for_each_port(i, port, host) \ |
1613 | for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) | 1581 | for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) |
1614 | 1582 | ||