diff options
Diffstat (limited to 'include/linux/ide.h')
| -rw-r--r-- | include/linux/ide.h | 347 |
1 files changed, 175 insertions, 172 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index 25087aead657..a5d26f66ef78 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 | */ |
| @@ -268,56 +241,52 @@ typedef enum { | |||
| 268 | 241 | ||
| 269 | enum { | 242 | enum { |
| 270 | IDE_TFLAG_LBA48 = (1 << 0), | 243 | IDE_TFLAG_LBA48 = (1 << 0), |
| 271 | IDE_TFLAG_FLAGGED = (1 << 2), | 244 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1), |
| 272 | IDE_TFLAG_OUT_DATA = (1 << 3), | 245 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 2), |
| 273 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | 246 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 3), |
| 274 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | 247 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 4), |
| 275 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | 248 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 5), |
| 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 | | 249 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | |
| 279 | IDE_TFLAG_OUT_HOB_NSECT | | 250 | IDE_TFLAG_OUT_HOB_NSECT | |
| 280 | IDE_TFLAG_OUT_HOB_LBAL | | 251 | IDE_TFLAG_OUT_HOB_LBAL | |
| 281 | IDE_TFLAG_OUT_HOB_LBAM | | 252 | IDE_TFLAG_OUT_HOB_LBAM | |
| 282 | IDE_TFLAG_OUT_HOB_LBAH, | 253 | IDE_TFLAG_OUT_HOB_LBAH, |
| 283 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | 254 | IDE_TFLAG_OUT_FEATURE = (1 << 6), |
| 284 | IDE_TFLAG_OUT_NSECT = (1 << 10), | 255 | IDE_TFLAG_OUT_NSECT = (1 << 7), |
| 285 | IDE_TFLAG_OUT_LBAL = (1 << 11), | 256 | IDE_TFLAG_OUT_LBAL = (1 << 8), |
| 286 | IDE_TFLAG_OUT_LBAM = (1 << 12), | 257 | IDE_TFLAG_OUT_LBAM = (1 << 9), |
| 287 | IDE_TFLAG_OUT_LBAH = (1 << 13), | 258 | IDE_TFLAG_OUT_LBAH = (1 << 10), |
| 288 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | 259 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | |
| 289 | IDE_TFLAG_OUT_NSECT | | 260 | IDE_TFLAG_OUT_NSECT | |
| 290 | IDE_TFLAG_OUT_LBAL | | 261 | IDE_TFLAG_OUT_LBAL | |
| 291 | IDE_TFLAG_OUT_LBAM | | 262 | IDE_TFLAG_OUT_LBAM | |
| 292 | IDE_TFLAG_OUT_LBAH, | 263 | IDE_TFLAG_OUT_LBAH, |
| 293 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | 264 | IDE_TFLAG_OUT_DEVICE = (1 << 11), |
| 294 | IDE_TFLAG_WRITE = (1 << 15), | 265 | IDE_TFLAG_WRITE = (1 << 12), |
| 295 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | 266 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 13), |
| 296 | IDE_TFLAG_IN_DATA = (1 << 17), | 267 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14), |
| 297 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | 268 | IDE_TFLAG_IN_HOB_ERROR = (1 << 15), |
| 298 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | 269 | IDE_TFLAG_IN_HOB_NSECT = (1 << 16), |
| 299 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | 270 | IDE_TFLAG_IN_HOB_LBAL = (1 << 17), |
| 300 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | 271 | IDE_TFLAG_IN_HOB_LBAM = (1 << 18), |
| 301 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | 272 | IDE_TFLAG_IN_HOB_LBAH = (1 << 19), |
| 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 | | 273 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | |
| 305 | IDE_TFLAG_IN_HOB_LBAM | | 274 | IDE_TFLAG_IN_HOB_LBAM | |
| 306 | IDE_TFLAG_IN_HOB_LBAH, | 275 | IDE_TFLAG_IN_HOB_LBAH, |
| 307 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | 276 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_ERROR | |
| 308 | IDE_TFLAG_IN_HOB_NSECT | | 277 | IDE_TFLAG_IN_HOB_NSECT | |
| 309 | IDE_TFLAG_IN_HOB_LBA, | 278 | IDE_TFLAG_IN_HOB_LBA, |
| 310 | IDE_TFLAG_IN_FEATURE = (1 << 1), | 279 | IDE_TFLAG_IN_ERROR = (1 << 20), |
| 311 | IDE_TFLAG_IN_NSECT = (1 << 25), | 280 | IDE_TFLAG_IN_NSECT = (1 << 21), |
| 312 | IDE_TFLAG_IN_LBAL = (1 << 26), | 281 | IDE_TFLAG_IN_LBAL = (1 << 22), |
| 313 | IDE_TFLAG_IN_LBAM = (1 << 27), | 282 | IDE_TFLAG_IN_LBAM = (1 << 23), |
| 314 | IDE_TFLAG_IN_LBAH = (1 << 28), | 283 | IDE_TFLAG_IN_LBAH = (1 << 24), |
| 315 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | 284 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | |
| 316 | IDE_TFLAG_IN_LBAM | | 285 | IDE_TFLAG_IN_LBAM | |
| 317 | IDE_TFLAG_IN_LBAH, | 286 | IDE_TFLAG_IN_LBAH, |
| 318 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | 287 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | |
| 319 | IDE_TFLAG_IN_LBA, | 288 | IDE_TFLAG_IN_LBA, |
| 320 | IDE_TFLAG_IN_DEVICE = (1 << 29), | 289 | IDE_TFLAG_IN_DEVICE = (1 << 25), |
| 321 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | 290 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | |
| 322 | IDE_TFLAG_IN_HOB, | 291 | IDE_TFLAG_IN_HOB, |
| 323 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | 292 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | |
| @@ -325,15 +294,28 @@ enum { | |||
| 325 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | 294 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | |
| 326 | IDE_TFLAG_IN_DEVICE, | 295 | IDE_TFLAG_IN_DEVICE, |
| 327 | /* force 16-bit I/O operations */ | 296 | /* force 16-bit I/O operations */ |
| 328 | IDE_TFLAG_IO_16BIT = (1 << 30), | 297 | IDE_TFLAG_IO_16BIT = (1 << 26), |
| 329 | /* ide_task_t was allocated using kmalloc() */ | 298 | /* struct ide_cmd was allocated using kmalloc() */ |
| 330 | 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 | |||
| 304 | enum { | ||
| 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), | ||
| 331 | }; | 309 | }; |
| 332 | 310 | ||
| 333 | struct ide_taskfile { | 311 | struct ide_taskfile { |
| 334 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | 312 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ |
| 313 | /* 1-5: additional data to support LBA48 */ | ||
| 314 | union { | ||
| 315 | u8 hob_error; /* read: error */ | ||
| 316 | u8 hob_feature; /* write: feature */ | ||
| 317 | }; | ||
| 335 | 318 | ||
| 336 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | ||
| 337 | u8 hob_nsect; | 319 | u8 hob_nsect; |
| 338 | u8 hob_lbal; | 320 | u8 hob_lbal; |
| 339 | u8 hob_lbam; | 321 | u8 hob_lbam; |
| @@ -359,16 +341,29 @@ struct ide_taskfile { | |||
| 359 | }; | 341 | }; |
| 360 | }; | 342 | }; |
| 361 | 343 | ||
| 362 | typedef struct ide_task_s { | 344 | struct ide_cmd { |
| 363 | union { | 345 | union { |
| 364 | struct ide_taskfile tf; | 346 | struct ide_taskfile tf; |
| 365 | u8 tf_array[14]; | 347 | u8 tf_array[14]; |
| 366 | }; | 348 | }; |
| 349 | u8 ftf_flags; /* for TASKFILE ioctl */ | ||
| 367 | u32 tf_flags; | 350 | u32 tf_flags; |
| 368 | int data_phase; | 351 | int protocol; |
| 352 | |||
| 353 | int sg_nents; /* number of sg entries */ | ||
| 354 | int orig_sg_nents; | ||
| 355 | int sg_dma_direction; /* DMA transfer direction */ | ||
| 356 | |||
| 357 | unsigned int nbytes; | ||
| 358 | unsigned int nleft; | ||
| 359 | unsigned int last_xfer_len; | ||
| 360 | |||
| 361 | struct scatterlist *cursg; | ||
| 362 | unsigned int cursg_ofs; | ||
| 363 | |||
| 369 | struct request *rq; /* copy of request */ | 364 | struct request *rq; /* copy of request */ |
| 370 | void *special; /* valid_t generally */ | 365 | void *special; /* valid_t generally */ |
| 371 | } ide_task_t; | 366 | }; |
| 372 | 367 | ||
| 373 | /* ATAPI packet command flags */ | 368 | /* ATAPI packet command flags */ |
| 374 | enum { | 369 | enum { |
| @@ -380,15 +375,13 @@ enum { | |||
| 380 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | 375 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), |
| 381 | PC_FLAG_DMA_ERROR = (1 << 5), | 376 | PC_FLAG_DMA_ERROR = (1 << 5), |
| 382 | PC_FLAG_WRITING = (1 << 6), | 377 | PC_FLAG_WRITING = (1 << 6), |
| 383 | /* command timed out */ | ||
| 384 | PC_FLAG_TIMEDOUT = (1 << 7), | ||
| 385 | }; | 378 | }; |
| 386 | 379 | ||
| 387 | /* | 380 | /* |
| 388 | * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. | 381 | * 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). | 382 | * This is used for several packet commands (not for READ/WRITE commands). |
| 390 | */ | 383 | */ |
| 391 | #define IDE_PC_BUFFER_SIZE 256 | 384 | #define IDE_PC_BUFFER_SIZE 64 |
| 392 | #define ATAPI_WAIT_PC (60 * HZ) | 385 | #define ATAPI_WAIT_PC (60 * HZ) |
| 393 | 386 | ||
| 394 | struct ide_atapi_pc { | 387 | struct ide_atapi_pc { |
| @@ -426,9 +419,6 @@ struct ide_atapi_pc { | |||
| 426 | struct idetape_bh *bh; | 419 | struct idetape_bh *bh; |
| 427 | char *b_data; | 420 | char *b_data; |
| 428 | 421 | ||
| 429 | struct scatterlist *sg; | ||
| 430 | unsigned int sg_cnt; | ||
| 431 | |||
| 432 | unsigned long timeout; | 422 | unsigned long timeout; |
| 433 | }; | 423 | }; |
| 434 | 424 | ||
| @@ -452,7 +442,6 @@ struct ide_disk_ops { | |||
| 452 | int); | 442 | int); |
| 453 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, | 443 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, |
| 454 | sector_t); | 444 | sector_t); |
| 455 | int (*end_request)(struct ide_drive_s *, int, int); | ||
| 456 | int (*ioctl)(struct ide_drive_s *, struct block_device *, | 445 | int (*ioctl)(struct ide_drive_s *, struct block_device *, |
| 457 | fmode_t, unsigned int, unsigned long); | 446 | fmode_t, unsigned int, unsigned long); |
| 458 | }; | 447 | }; |
| @@ -470,11 +459,6 @@ enum { | |||
| 470 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), | 459 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), |
| 471 | /* TOC track numbers are in BCD. */ | 460 | /* TOC track numbers are in BCD. */ |
| 472 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), | 461 | 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. */ | 462 | /* Saved TOC information is current. */ |
| 479 | IDE_AFLAG_TOC_VALID = (1 << 6), | 463 | IDE_AFLAG_TOC_VALID = (1 << 6), |
| 480 | /* We think that the drive door is locked. */ | 464 | /* We think that the drive door is locked. */ |
| @@ -528,8 +512,6 @@ enum { | |||
| 528 | IDE_DFLAG_NICE1 = (1 << 5), | 512 | IDE_DFLAG_NICE1 = (1 << 5), |
| 529 | /* device is physically present */ | 513 | /* device is physically present */ |
| 530 | IDE_DFLAG_PRESENT = (1 << 6), | 514 | IDE_DFLAG_PRESENT = (1 << 6), |
| 531 | /* device ejected hint */ | ||
| 532 | IDE_DFLAG_DEAD = (1 << 7), | ||
| 533 | /* id read from device (synthetic if not set) */ | 515 | /* id read from device (synthetic if not set) */ |
| 534 | IDE_DFLAG_ID_READ = (1 << 8), | 516 | IDE_DFLAG_ID_READ = (1 << 8), |
| 535 | IDE_DFLAG_NOPROBE = (1 << 9), | 517 | IDE_DFLAG_NOPROBE = (1 << 9), |
| @@ -621,7 +603,7 @@ struct ide_drive_s { | |||
| 621 | 603 | ||
| 622 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ | 604 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ |
| 623 | unsigned int cyl; /* "real" number of cyls */ | 605 | unsigned int cyl; /* "real" number of cyls */ |
| 624 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ | 606 | unsigned int drive_data; /* used by set_pio_mode/dev_select() */ |
| 625 | unsigned int failures; /* current failure count */ | 607 | unsigned int failures; /* current failure count */ |
| 626 | unsigned int max_failures; /* maximum allowed failure count */ | 608 | unsigned int max_failures; /* maximum allowed failure count */ |
| 627 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ | 609 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ |
| @@ -643,8 +625,11 @@ struct ide_drive_s { | |||
| 643 | /* current packet command */ | 625 | /* current packet command */ |
| 644 | struct ide_atapi_pc *pc; | 626 | struct ide_atapi_pc *pc; |
| 645 | 627 | ||
| 628 | /* last failed packet command */ | ||
| 629 | struct ide_atapi_pc *failed_pc; | ||
| 630 | |||
| 646 | /* callback for packet commands */ | 631 | /* callback for packet commands */ |
| 647 | void (*pc_callback)(struct ide_drive_s *, int); | 632 | int (*pc_callback)(struct ide_drive_s *, int); |
| 648 | 633 | ||
| 649 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); | 634 | 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 *, | 635 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, |
| @@ -674,16 +659,16 @@ struct ide_tp_ops { | |||
| 674 | void (*exec_command)(struct hwif_s *, u8); | 659 | void (*exec_command)(struct hwif_s *, u8); |
| 675 | u8 (*read_status)(struct hwif_s *); | 660 | u8 (*read_status)(struct hwif_s *); |
| 676 | u8 (*read_altstatus)(struct hwif_s *); | 661 | u8 (*read_altstatus)(struct hwif_s *); |
| 662 | void (*write_devctl)(struct hwif_s *, u8); | ||
| 677 | 663 | ||
| 678 | void (*set_irq)(struct hwif_s *, int); | 664 | void (*dev_select)(ide_drive_t *); |
| 665 | void (*tf_load)(ide_drive_t *, struct ide_cmd *); | ||
| 666 | void (*tf_read)(ide_drive_t *, struct ide_cmd *); | ||
| 679 | 667 | ||
| 680 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); | 668 | void (*input_data)(ide_drive_t *, struct ide_cmd *, |
| 681 | void (*tf_read)(ide_drive_t *, struct ide_task_s *); | 669 | void *, unsigned int); |
| 682 | 670 | void (*output_data)(ide_drive_t *, struct ide_cmd *, | |
| 683 | void (*input_data)(ide_drive_t *, struct request *, void *, | 671 | void *, unsigned int); |
| 684 | unsigned int); | ||
| 685 | void (*output_data)(ide_drive_t *, struct request *, void *, | ||
| 686 | unsigned int); | ||
| 687 | }; | 672 | }; |
| 688 | 673 | ||
| 689 | extern const struct ide_tp_ops default_tp_ops; | 674 | extern const struct ide_tp_ops default_tp_ops; |
| @@ -694,7 +679,6 @@ extern const struct ide_tp_ops default_tp_ops; | |||
| 694 | * @init_dev: host specific initialization of a device | 679 | * @init_dev: host specific initialization of a device |
| 695 | * @set_pio_mode: routine to program host for PIO mode | 680 | * @set_pio_mode: routine to program host for PIO mode |
| 696 | * @set_dma_mode: routine to program host for DMA mode | 681 | * @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 | 682 | * @reset_poll: chipset polling based on hba specifics |
| 699 | * @pre_reset: chipset specific changes to default for device-hba resets | 683 | * @pre_reset: chipset specific changes to default for device-hba resets |
| 700 | * @resetproc: routine to reset controller after a disk reset | 684 | * @resetproc: routine to reset controller after a disk reset |
| @@ -711,7 +695,6 @@ struct ide_port_ops { | |||
| 711 | void (*init_dev)(ide_drive_t *); | 695 | void (*init_dev)(ide_drive_t *); |
| 712 | void (*set_pio_mode)(ide_drive_t *, const u8); | 696 | void (*set_pio_mode)(ide_drive_t *, const u8); |
| 713 | void (*set_dma_mode)(ide_drive_t *, const u8); | 697 | void (*set_dma_mode)(ide_drive_t *, const u8); |
| 714 | void (*selectproc)(ide_drive_t *); | ||
| 715 | int (*reset_poll)(ide_drive_t *); | 698 | int (*reset_poll)(ide_drive_t *); |
| 716 | void (*pre_reset)(ide_drive_t *); | 699 | void (*pre_reset)(ide_drive_t *); |
| 717 | void (*resetproc)(ide_drive_t *); | 700 | void (*resetproc)(ide_drive_t *); |
| @@ -727,13 +710,15 @@ struct ide_port_ops { | |||
| 727 | 710 | ||
| 728 | struct ide_dma_ops { | 711 | struct ide_dma_ops { |
| 729 | void (*dma_host_set)(struct ide_drive_s *, int); | 712 | void (*dma_host_set)(struct ide_drive_s *, int); |
| 730 | int (*dma_setup)(struct ide_drive_s *); | 713 | 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 *); | 714 | void (*dma_start)(struct ide_drive_s *); |
| 733 | int (*dma_end)(struct ide_drive_s *); | 715 | int (*dma_end)(struct ide_drive_s *); |
| 734 | int (*dma_test_irq)(struct ide_drive_s *); | 716 | int (*dma_test_irq)(struct ide_drive_s *); |
| 735 | void (*dma_lost_irq)(struct ide_drive_s *); | 717 | void (*dma_lost_irq)(struct ide_drive_s *); |
| 736 | void (*dma_timeout)(struct ide_drive_s *); | 718 | /* below ones are optional */ |
| 719 | int (*dma_check)(struct ide_drive_s *, struct ide_cmd *); | ||
| 720 | int (*dma_timer_expiry)(struct ide_drive_s *); | ||
| 721 | void (*dma_clear)(struct ide_drive_s *); | ||
| 737 | /* | 722 | /* |
| 738 | * The following method is optional and only required to be | 723 | * The following method is optional and only required to be |
| 739 | * implemented for the SFF-8038i compatible controllers. | 724 | * implemented for the SFF-8038i compatible controllers. |
| @@ -796,19 +781,8 @@ typedef struct hwif_s { | |||
| 796 | /* Scatter-gather list used to build the above */ | 781 | /* Scatter-gather list used to build the above */ |
| 797 | struct scatterlist *sg_table; | 782 | struct scatterlist *sg_table; |
| 798 | int sg_max_nents; /* Maximum number of entries in it */ | 783 | int sg_max_nents; /* Maximum number of entries in it */ |
| 799 | int sg_nents; /* Current number of entries in it */ | ||
| 800 | int orig_sg_nents; | ||
| 801 | int sg_dma_direction; /* dma transfer direction */ | ||
| 802 | |||
| 803 | /* data phase of the active command (currently only valid for PIO/DMA) */ | ||
| 804 | int data_phase; | ||
| 805 | 784 | ||
| 806 | struct ide_task_s task; /* current command */ | 785 | struct ide_cmd cmd; /* current command */ |
| 807 | |||
| 808 | unsigned int nsect; | ||
| 809 | unsigned int nleft; | ||
| 810 | struct scatterlist *cursg; | ||
| 811 | unsigned int cursg_ofs; | ||
| 812 | 786 | ||
| 813 | int rqsize; /* max sectors per request */ | 787 | int rqsize; /* max sectors per request */ |
| 814 | int irq; /* our irq number */ | 788 | int irq; /* our irq number */ |
| @@ -866,9 +840,18 @@ struct ide_host { | |||
| 866 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; | 840 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; |
| 867 | unsigned int n_ports; | 841 | unsigned int n_ports; |
| 868 | struct device *dev[2]; | 842 | struct device *dev[2]; |
| 869 | unsigned int (*init_chipset)(struct pci_dev *); | 843 | |
| 844 | int (*init_chipset)(struct pci_dev *); | ||
| 845 | |||
| 846 | void (*get_lock)(irq_handler_t, void *); | ||
| 847 | void (*release_lock)(void); | ||
| 848 | |||
| 870 | irq_handler_t irq_handler; | 849 | irq_handler_t irq_handler; |
| 850 | |||
| 871 | unsigned long host_flags; | 851 | unsigned long host_flags; |
| 852 | |||
| 853 | int irq_flags; | ||
| 854 | |||
| 872 | void *host_priv; | 855 | void *host_priv; |
| 873 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ | 856 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ |
| 874 | 857 | ||
| @@ -885,7 +868,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); | |||
| 885 | typedef int (ide_expiry_t)(ide_drive_t *); | 868 | typedef int (ide_expiry_t)(ide_drive_t *); |
| 886 | 869 | ||
| 887 | /* used by ide-cd, ide-floppy, etc. */ | 870 | /* used by ide-cd, ide-floppy, etc. */ |
| 888 | typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); | 871 | typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned); |
| 889 | 872 | ||
| 890 | extern struct mutex ide_setting_mtx; | 873 | extern struct mutex ide_setting_mtx; |
| 891 | 874 | ||
| @@ -1061,10 +1044,11 @@ enum { | |||
| 1061 | }; | 1044 | }; |
| 1062 | 1045 | ||
| 1063 | /* DRV_NAME has to be defined in the driver before using the macro below */ | 1046 | /* DRV_NAME has to be defined in the driver before using the macro below */ |
| 1064 | #define __ide_debug_log(lvl, fmt, args...) \ | 1047 | #define __ide_debug_log(lvl, fmt, args...) \ |
| 1065 | { \ | 1048 | { \ |
| 1066 | if (unlikely(drive->debug_mask & lvl)) \ | 1049 | if (unlikely(drive->debug_mask & lvl)) \ |
| 1067 | printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ | 1050 | printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \ |
| 1051 | __func__, ## args); \ | ||
| 1068 | } | 1052 | } |
| 1069 | 1053 | ||
| 1070 | /* | 1054 | /* |
| @@ -1103,7 +1087,7 @@ int generic_ide_resume(struct device *); | |||
| 1103 | 1087 | ||
| 1104 | void ide_complete_power_step(ide_drive_t *, struct request *); | 1088 | void ide_complete_power_step(ide_drive_t *, struct request *); |
| 1105 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); | 1089 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); |
| 1106 | void ide_complete_pm_request(ide_drive_t *, struct request *); | 1090 | void ide_complete_pm_rq(ide_drive_t *, struct request *); |
| 1107 | void ide_check_pm_state(ide_drive_t *, struct request *); | 1091 | void ide_check_pm_state(ide_drive_t *, struct request *); |
| 1108 | 1092 | ||
| 1109 | /* | 1093 | /* |
| @@ -1115,7 +1099,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *); | |||
| 1115 | struct ide_driver { | 1099 | struct ide_driver { |
| 1116 | const char *version; | 1100 | const char *version; |
| 1117 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 1101 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
| 1118 | int (*end_request)(ide_drive_t *, int, int); | ||
| 1119 | struct device_driver gen_driver; | 1102 | struct device_driver gen_driver; |
| 1120 | int (*probe)(ide_drive_t *); | 1103 | int (*probe)(ide_drive_t *); |
| 1121 | void (*remove)(ide_drive_t *); | 1104 | void (*remove)(ide_drive_t *); |
| @@ -1146,16 +1129,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l | |||
| 1146 | extern int ide_vlb_clk; | 1129 | extern int ide_vlb_clk; |
| 1147 | extern int ide_pci_clk; | 1130 | extern int ide_pci_clk; |
| 1148 | 1131 | ||
| 1149 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 1132 | unsigned int ide_rq_bytes(struct request *); |
| 1150 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 1133 | int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int); |
| 1151 | int uptodate, int nr_sectors); | 1134 | void ide_kill_rq(ide_drive_t *, struct request *); |
| 1152 | |||
| 1153 | extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); | ||
| 1154 | 1135 | ||
| 1155 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, | 1136 | void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
| 1156 | ide_expiry_t *); | 1137 | void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
| 1157 | 1138 | ||
| 1158 | void ide_execute_pkt_cmd(ide_drive_t *); | 1139 | void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *, |
| 1140 | unsigned int); | ||
| 1159 | 1141 | ||
| 1160 | void ide_pad_transfer(ide_drive_t *, int, int); | 1142 | void ide_pad_transfer(ide_drive_t *, int, int); |
| 1161 | 1143 | ||
| @@ -1169,41 +1151,36 @@ int ide_busy_sleep(ide_hwif_t *, unsigned long, int); | |||
| 1169 | 1151 | ||
| 1170 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 1152 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
| 1171 | 1153 | ||
| 1154 | ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *); | ||
| 1155 | ide_startstop_t ide_do_devset(ide_drive_t *, struct request *); | ||
| 1156 | |||
| 1172 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1157 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
| 1173 | 1158 | ||
| 1174 | extern int ide_devset_execute(ide_drive_t *drive, | 1159 | extern int ide_devset_execute(ide_drive_t *drive, |
| 1175 | const struct ide_devset *setting, int arg); | 1160 | const struct ide_devset *setting, int arg); |
| 1176 | 1161 | ||
| 1177 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); | 1162 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); |
| 1178 | 1163 | int ide_complete_rq(ide_drive_t *, int, unsigned int); | |
| 1179 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | ||
| 1180 | 1164 | ||
| 1181 | void ide_tf_dump(const char *, struct ide_taskfile *); | 1165 | void ide_tf_dump(const char *, struct ide_taskfile *); |
| 1182 | 1166 | ||
| 1183 | void ide_exec_command(ide_hwif_t *, u8); | 1167 | void ide_exec_command(ide_hwif_t *, u8); |
| 1184 | u8 ide_read_status(ide_hwif_t *); | 1168 | u8 ide_read_status(ide_hwif_t *); |
| 1185 | u8 ide_read_altstatus(ide_hwif_t *); | 1169 | u8 ide_read_altstatus(ide_hwif_t *); |
| 1170 | void ide_write_devctl(ide_hwif_t *, u8); | ||
| 1186 | 1171 | ||
| 1187 | void ide_set_irq(ide_hwif_t *, int); | 1172 | void ide_dev_select(ide_drive_t *); |
| 1173 | void ide_tf_load(ide_drive_t *, struct ide_cmd *); | ||
| 1174 | void ide_tf_read(ide_drive_t *, struct ide_cmd *); | ||
| 1188 | 1175 | ||
| 1189 | void ide_tf_load(ide_drive_t *, ide_task_t *); | 1176 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
| 1190 | void ide_tf_read(ide_drive_t *, ide_task_t *); | 1177 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
| 1191 | 1178 | ||
| 1192 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); | ||
| 1193 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); | ||
| 1194 | |||
| 1195 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); | ||
| 1196 | |||
| 1197 | extern void SELECT_DRIVE(ide_drive_t *); | ||
| 1198 | void SELECT_MASK(ide_drive_t *, int); | 1179 | void SELECT_MASK(ide_drive_t *, int); |
| 1199 | 1180 | ||
| 1200 | u8 ide_read_error(ide_drive_t *); | 1181 | u8 ide_read_error(ide_drive_t *); |
| 1201 | void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); | 1182 | void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); |
| 1202 | 1183 | ||
| 1203 | extern int drive_is_ready(ide_drive_t *); | ||
| 1204 | |||
| 1205 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | ||
| 1206 | |||
| 1207 | int ide_check_atapi_device(ide_drive_t *, const char *); | 1184 | int ide_check_atapi_device(ide_drive_t *, const char *); |
| 1208 | 1185 | ||
| 1209 | void ide_init_pc(struct ide_atapi_pc *); | 1186 | void ide_init_pc(struct ide_atapi_pc *); |
| @@ -1240,16 +1217,20 @@ int ide_cd_expiry(ide_drive_t *); | |||
| 1240 | 1217 | ||
| 1241 | int ide_cd_get_xferlen(struct request *); | 1218 | int ide_cd_get_xferlen(struct request *); |
| 1242 | 1219 | ||
| 1243 | ide_startstop_t ide_issue_pc(ide_drive_t *); | 1220 | ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *); |
| 1221 | |||
| 1222 | ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *); | ||
| 1244 | 1223 | ||
| 1245 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 1224 | void ide_pio_bytes(ide_drive_t *, struct ide_cmd *, unsigned int, unsigned int); |
| 1246 | 1225 | ||
| 1247 | void task_end_request(ide_drive_t *, struct request *, u8); | 1226 | void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8); |
| 1248 | 1227 | ||
| 1249 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | 1228 | int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16); |
| 1250 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 1229 | int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *); |
| 1251 | 1230 | ||
| 1252 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 1231 | int ide_taskfile_ioctl(ide_drive_t *, unsigned long); |
| 1232 | |||
| 1233 | int ide_dev_read_id(ide_drive_t *, u8, u16 *); | ||
| 1253 | 1234 | ||
| 1254 | extern int ide_driveid_update(ide_drive_t *); | 1235 | extern int ide_driveid_update(ide_drive_t *); |
| 1255 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 1236 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
| @@ -1280,7 +1261,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev) | |||
| 1280 | return 0; | 1261 | return 0; |
| 1281 | } | 1262 | } |
| 1282 | 1263 | ||
| 1283 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, | 1264 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, |
| 1284 | hw_regs_t *, hw_regs_t **); | 1265 | hw_regs_t *, hw_regs_t **); |
| 1285 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1266 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
| 1286 | 1267 | ||
| @@ -1349,10 +1330,10 @@ enum { | |||
| 1349 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), | 1330 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), |
| 1350 | /* serialize ports */ | 1331 | /* serialize ports */ |
| 1351 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1332 | IDE_HFLAG_SERIALIZE = (1 << 20), |
| 1352 | /* use legacy IRQs */ | 1333 | /* host is DTC2278 */ |
| 1353 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), | 1334 | IDE_HFLAG_DTC2278 = (1 << 21), |
| 1354 | /* force use of legacy IRQs */ | 1335 | /* 4 devices on a single set of I/O ports */ |
| 1355 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), | 1336 | IDE_HFLAG_4DRIVES = (1 << 22), |
| 1356 | /* host is TRM290 */ | 1337 | /* host is TRM290 */ |
| 1357 | IDE_HFLAG_TRM290 = (1 << 23), | 1338 | IDE_HFLAG_TRM290 = (1 << 23), |
| 1358 | /* use 32-bit I/O ops */ | 1339 | /* use 32-bit I/O ops */ |
| @@ -1380,7 +1361,12 @@ enum { | |||
| 1380 | 1361 | ||
| 1381 | struct ide_port_info { | 1362 | struct ide_port_info { |
| 1382 | char *name; | 1363 | char *name; |
| 1383 | unsigned int (*init_chipset)(struct pci_dev *); | 1364 | |
| 1365 | int (*init_chipset)(struct pci_dev *); | ||
| 1366 | |||
| 1367 | void (*get_lock)(irq_handler_t, void *); | ||
| 1368 | void (*release_lock)(void); | ||
| 1369 | |||
| 1384 | void (*init_iops)(ide_hwif_t *); | 1370 | void (*init_iops)(ide_hwif_t *); |
| 1385 | void (*init_hwif)(ide_hwif_t *); | 1371 | void (*init_hwif)(ide_hwif_t *); |
| 1386 | int (*init_dma)(ide_hwif_t *, | 1372 | int (*init_dma)(ide_hwif_t *, |
| @@ -1397,6 +1383,9 @@ struct ide_port_info { | |||
| 1397 | u16 max_sectors; /* if < than the default one */ | 1383 | u16 max_sectors; /* if < than the default one */ |
| 1398 | 1384 | ||
| 1399 | u32 host_flags; | 1385 | u32 host_flags; |
| 1386 | |||
| 1387 | int irq_flags; | ||
| 1388 | |||
| 1400 | u8 pio_mask; | 1389 | u8 pio_mask; |
| 1401 | u8 swdma_mask; | 1390 | u8 swdma_mask; |
| 1402 | u8 mwdma_mask; | 1391 | u8 mwdma_mask; |
| @@ -1416,8 +1405,8 @@ int ide_pci_resume(struct pci_dev *); | |||
| 1416 | #define ide_pci_resume NULL | 1405 | #define ide_pci_resume NULL |
| 1417 | #endif | 1406 | #endif |
| 1418 | 1407 | ||
| 1419 | void ide_map_sg(ide_drive_t *, struct request *); | 1408 | void ide_map_sg(ide_drive_t *, struct ide_cmd *); |
| 1420 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1409 | void ide_init_sg_cmd(struct ide_cmd *, unsigned int); |
| 1421 | 1410 | ||
| 1422 | #define BAD_DMA_DRIVE 0 | 1411 | #define BAD_DMA_DRIVE 0 |
| 1423 | #define GOOD_DMA_DRIVE 1 | 1412 | #define GOOD_DMA_DRIVE 1 |
| @@ -1451,18 +1440,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *); | |||
| 1451 | int ide_allocate_dma_engine(ide_hwif_t *); | 1440 | int ide_allocate_dma_engine(ide_hwif_t *); |
| 1452 | void ide_release_dma_engine(ide_hwif_t *); | 1441 | void ide_release_dma_engine(ide_hwif_t *); |
| 1453 | 1442 | ||
| 1454 | int ide_build_sglist(ide_drive_t *, struct request *); | 1443 | int ide_dma_prepare(ide_drive_t *, struct ide_cmd *); |
| 1455 | void ide_destroy_dmatable(ide_drive_t *); | 1444 | void ide_dma_unmap_sg(ide_drive_t *, struct ide_cmd *); |
| 1456 | 1445 | ||
| 1457 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1446 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
| 1458 | int config_drive_for_dma(ide_drive_t *); | 1447 | int config_drive_for_dma(ide_drive_t *); |
| 1459 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1448 | int ide_build_dmatable(ide_drive_t *, struct ide_cmd *); |
| 1460 | void ide_dma_host_set(ide_drive_t *, int); | 1449 | void ide_dma_host_set(ide_drive_t *, int); |
| 1461 | extern int ide_dma_setup(ide_drive_t *); | 1450 | int ide_dma_setup(ide_drive_t *, struct ide_cmd *); |
| 1462 | void ide_dma_exec_cmd(ide_drive_t *, u8); | ||
| 1463 | extern void ide_dma_start(ide_drive_t *); | 1451 | extern void ide_dma_start(ide_drive_t *); |
| 1464 | int ide_dma_end(ide_drive_t *); | 1452 | int ide_dma_end(ide_drive_t *); |
| 1465 | int ide_dma_test_irq(ide_drive_t *); | 1453 | int ide_dma_test_irq(ide_drive_t *); |
| 1454 | int ide_dma_sff_timer_expiry(ide_drive_t *); | ||
| 1466 | u8 ide_dma_sff_read_status(ide_hwif_t *); | 1455 | u8 ide_dma_sff_read_status(ide_hwif_t *); |
| 1467 | extern const struct ide_dma_ops sff_dma_ops; | 1456 | extern const struct ide_dma_ops sff_dma_ops; |
| 1468 | #else | 1457 | #else |
| @@ -1470,7 +1459,7 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } | |||
| 1470 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1459 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
| 1471 | 1460 | ||
| 1472 | void ide_dma_lost_irq(ide_drive_t *); | 1461 | void ide_dma_lost_irq(ide_drive_t *); |
| 1473 | void ide_dma_timeout(ide_drive_t *); | 1462 | ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int); |
| 1474 | 1463 | ||
| 1475 | #else | 1464 | #else |
| 1476 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } | 1465 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } |
| @@ -1482,21 +1471,29 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; } | |||
| 1482 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1471 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
| 1483 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1472 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
| 1484 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1473 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
| 1474 | static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; } | ||
| 1475 | static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; } | ||
| 1485 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } | 1476 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
| 1477 | static inline int ide_dma_prepare(ide_drive_t *drive, | ||
| 1478 | struct ide_cmd *cmd) { return 1; } | ||
| 1479 | static inline void ide_dma_unmap_sg(ide_drive_t *drive, | ||
| 1480 | struct ide_cmd *cmd) { ; } | ||
| 1486 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1481 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
| 1487 | 1482 | ||
| 1488 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1483 | #ifdef CONFIG_BLK_DEV_IDEACPI |
| 1484 | int ide_acpi_init(void); | ||
| 1489 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); | 1485 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); |
| 1490 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); | 1486 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); |
| 1491 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); | 1487 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); |
| 1492 | extern void ide_acpi_init(ide_hwif_t *hwif); | 1488 | void ide_acpi_init_port(ide_hwif_t *); |
| 1493 | void ide_acpi_port_init_devices(ide_hwif_t *); | 1489 | void ide_acpi_port_init_devices(ide_hwif_t *); |
| 1494 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); | 1490 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); |
| 1495 | #else | 1491 | #else |
| 1492 | static inline int ide_acpi_init(void) { return 0; } | ||
| 1496 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } | 1493 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } |
| 1497 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } | 1494 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } |
| 1498 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } | 1495 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } |
| 1499 | static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } | 1496 | static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; } |
| 1500 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } | 1497 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } |
| 1501 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | 1498 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} |
| 1502 | #endif | 1499 | #endif |
| @@ -1530,9 +1527,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data) | |||
| 1530 | hwif->hwif_data = data; | 1527 | hwif->hwif_data = data; |
| 1531 | } | 1528 | } |
| 1532 | 1529 | ||
| 1533 | const char *ide_xfer_verbose(u8 mode); | ||
| 1534 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1530 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
| 1535 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | ||
| 1536 | 1531 | ||
| 1537 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1532 | u64 ide_get_lba_addr(struct ide_taskfile *, int); |
| 1538 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1533 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
| @@ -1571,14 +1566,18 @@ void ide_timing_merge(struct ide_timing *, struct ide_timing *, | |||
| 1571 | struct ide_timing *, unsigned int); | 1566 | struct ide_timing *, unsigned int); |
| 1572 | int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); | 1567 | int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); |
| 1573 | 1568 | ||
| 1569 | #ifdef CONFIG_IDE_XFER_MODE | ||
| 1574 | int ide_scan_pio_blacklist(char *); | 1570 | int ide_scan_pio_blacklist(char *); |
| 1575 | 1571 | const char *ide_xfer_verbose(u8); | |
| 1576 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); | 1572 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); |
| 1577 | |||
| 1578 | int ide_set_pio_mode(ide_drive_t *, u8); | 1573 | int ide_set_pio_mode(ide_drive_t *, u8); |
| 1579 | int ide_set_dma_mode(ide_drive_t *, u8); | 1574 | int ide_set_dma_mode(ide_drive_t *, u8); |
| 1580 | |||
| 1581 | void ide_set_pio(ide_drive_t *, u8); | 1575 | void ide_set_pio(ide_drive_t *, u8); |
| 1576 | int ide_set_xfer_rate(ide_drive_t *, u8); | ||
| 1577 | #else | ||
| 1578 | static inline void ide_set_pio(ide_drive_t *drive, u8 pio) { ; } | ||
| 1579 | static inline int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { return -1; } | ||
| 1580 | #endif | ||
| 1582 | 1581 | ||
| 1583 | static inline void ide_set_max_pio(ide_drive_t *drive) | 1582 | static inline void ide_set_max_pio(ide_drive_t *drive) |
| 1584 | { | 1583 | { |
| @@ -1611,6 +1610,10 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) | |||
| 1611 | #define ide_port_for_each_dev(i, dev, port) \ | 1610 | #define ide_port_for_each_dev(i, dev, port) \ |
| 1612 | for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) | 1611 | for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) |
| 1613 | 1612 | ||
| 1613 | #define ide_port_for_each_present_dev(i, dev, port) \ | ||
| 1614 | for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) \ | ||
| 1615 | if ((dev)->dev_flags & IDE_DFLAG_PRESENT) | ||
| 1616 | |||
| 1614 | #define ide_host_for_each_port(i, port, host) \ | 1617 | #define ide_host_for_each_port(i, port, host) \ |
| 1615 | for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) | 1618 | for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) |
| 1616 | 1619 | ||
