aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h475
1 files changed, 187 insertions, 288 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 4ed4777bba67..367c17084a28 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -9,7 +9,6 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/hdreg.h> 11#include <linux/hdreg.h>
12#include <linux/hdsmart.h>
13#include <linux/blkdev.h> 12#include <linux/blkdev.h>
14#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
15#include <linux/interrupt.h> 14#include <linux/interrupt.h>
@@ -27,25 +26,10 @@
27#include <asm/semaphore.h> 26#include <asm/semaphore.h>
28#include <asm/mutex.h> 27#include <asm/mutex.h>
29 28
30/****************************************************************************** 29#if defined(CRIS) || defined(FRV)
31 * IDE driver configuration options (play with these as desired): 30# define SUPPORT_VLB_SYNC 0
32 * 31#else
33 * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary 32# define SUPPORT_VLB_SYNC 1
34 */
35#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
36
37#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
38#define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
39#endif
40#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */
41#define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
42#endif
43#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
44#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
45#endif
46
47#ifndef DISABLE_IRQ_NOSYNC
48#define DISABLE_IRQ_NOSYNC 0
49#endif 33#endif
50 34
51/* 35/*
@@ -55,10 +39,6 @@
55 39
56#define IDE_NO_IRQ (-1) 40#define IDE_NO_IRQ (-1)
57 41
58/*
59 * "No user-serviceable parts" beyond this point :)
60 *****************************************************************************/
61
62typedef unsigned char byte; /* used everywhere */ 42typedef unsigned char byte; /* used everywhere */
63 43
64/* 44/*
@@ -103,8 +83,6 @@ typedef unsigned char byte; /* used everywhere */
103#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
104#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
105 85
106#define IDE_CONTROL_OFFSET_HOB (7)
107
108#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 86#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET])
109#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 87#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET])
110#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 88#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET])
@@ -128,25 +106,18 @@ typedef unsigned char byte; /* used everywhere */
128#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) 106#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
129#define BAD_STAT (BAD_R_STAT | DRQ_STAT) 107#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
130#define DRIVE_READY (READY_STAT | SEEK_STAT) 108#define DRIVE_READY (READY_STAT | SEEK_STAT)
131#define DATA_READY (DRQ_STAT)
132 109
133#define BAD_CRC (ABRT_ERR | ICRC_ERR) 110#define BAD_CRC (ABRT_ERR | ICRC_ERR)
134 111
135#define SATA_NR_PORTS (3) /* 16 possible ?? */ 112#define SATA_NR_PORTS (3) /* 16 possible ?? */
136 113
137#define SATA_STATUS_OFFSET (0) 114#define SATA_STATUS_OFFSET (0)
138#define SATA_STATUS_REG (HWIF(drive)->sata_scr[SATA_STATUS_OFFSET])
139#define SATA_ERROR_OFFSET (1) 115#define SATA_ERROR_OFFSET (1)
140#define SATA_ERROR_REG (HWIF(drive)->sata_scr[SATA_ERROR_OFFSET])
141#define SATA_CONTROL_OFFSET (2) 116#define SATA_CONTROL_OFFSET (2)
142#define SATA_CONTROL_REG (HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET])
143 117
144#define SATA_MISC_OFFSET (0) 118#define SATA_MISC_OFFSET (0)
145#define SATA_MISC_REG (HWIF(drive)->sata_misc[SATA_MISC_OFFSET])
146#define SATA_PHY_OFFSET (1) 119#define SATA_PHY_OFFSET (1)
147#define SATA_PHY_REG (HWIF(drive)->sata_misc[SATA_PHY_OFFSET])
148#define SATA_IEN_OFFSET (2) 120#define SATA_IEN_OFFSET (2)
149#define SATA_IEN_REG (HWIF(drive)->sata_misc[SATA_IEN_OFFSET])
150 121
151/* 122/*
152 * Our Physical Region Descriptor (PRD) table should be large enough 123 * Our Physical Region Descriptor (PRD) table should be large enough
@@ -219,8 +190,12 @@ typedef struct hw_regs_s {
219} hw_regs_t; 190} hw_regs_t;
220 191
221struct hwif_s * ide_find_port(unsigned long); 192struct hwif_s * ide_find_port(unsigned long);
193struct hwif_s *ide_deprecated_find_port(unsigned long);
194void ide_init_port_data(struct hwif_s *, unsigned int);
195void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
222 196
223int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, 197struct ide_drive_s;
198int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
224 struct hwif_s **); 199 struct hwif_s **);
225 200
226void ide_setup_ports( hw_regs_t *hw, 201void ide_setup_ports( hw_regs_t *hw,
@@ -327,47 +302,16 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
327typedef union { 302typedef union {
328 unsigned all : 8; 303 unsigned all : 8;
329 struct { 304 struct {
330#if defined(__LITTLE_ENDIAN_BITFIELD)
331 unsigned set_geometry : 1; 305 unsigned set_geometry : 1;
332 unsigned recalibrate : 1; 306 unsigned recalibrate : 1;
333 unsigned set_multmode : 1; 307 unsigned set_multmode : 1;
334 unsigned set_tune : 1; 308 unsigned set_tune : 1;
335 unsigned serviced : 1; 309 unsigned serviced : 1;
336 unsigned reserved : 3; 310 unsigned reserved : 3;
337#elif defined(__BIG_ENDIAN_BITFIELD)
338 unsigned reserved : 3;
339 unsigned serviced : 1;
340 unsigned set_tune : 1;
341 unsigned set_multmode : 1;
342 unsigned recalibrate : 1;
343 unsigned set_geometry : 1;
344#else
345#error "Please fix <asm/byteorder.h>"
346#endif
347 } b; 311 } b;
348} special_t; 312} special_t;
349 313
350/* 314/*
351 * ATA DATA Register Special.
352 * ATA NSECTOR Count Register().
353 * ATAPI Byte Count Register.
354 */
355typedef union {
356 unsigned all :16;
357 struct {
358#if defined(__LITTLE_ENDIAN_BITFIELD)
359 unsigned low :8; /* LSB */
360 unsigned high :8; /* MSB */
361#elif defined(__BIG_ENDIAN_BITFIELD)
362 unsigned high :8; /* MSB */
363 unsigned low :8; /* LSB */
364#else
365#error "Please fix <asm/byteorder.h>"
366#endif
367 } b;
368} ata_nsector_t, ata_data_t, atapi_bcount_t;
369
370/*
371 * ATA-IDE Select Register, aka Device-Head 315 * ATA-IDE Select Register, aka Device-Head
372 * 316 *
373 * head : always zeros here 317 * head : always zeros here
@@ -398,131 +342,6 @@ typedef union {
398} select_t, ata_select_t; 342} select_t, ata_select_t;
399 343
400/* 344/*
401 * The ATA-IDE Status Register.
402 * The ATAPI Status Register.
403 *
404 * check : Error occurred
405 * idx : Index Error
406 * corr : Correctable error occurred
407 * drq : Data is request by the device
408 * dsc : Disk Seek Complete : ata
409 * : Media access command finished : atapi
410 * df : Device Fault : ata
411 * : Reserved : atapi
412 * drdy : Ready, Command Mode Capable : ata
413 * : Ignored for ATAPI commands : atapi
414 * bsy : Disk is Busy
415 * : The device has access to the command block
416 */
417typedef union {
418 unsigned all :8;
419 struct {
420#if defined(__LITTLE_ENDIAN_BITFIELD)
421 unsigned check :1;
422 unsigned idx :1;
423 unsigned corr :1;
424 unsigned drq :1;
425 unsigned dsc :1;
426 unsigned df :1;
427 unsigned drdy :1;
428 unsigned bsy :1;
429#elif defined(__BIG_ENDIAN_BITFIELD)
430 unsigned bsy :1;
431 unsigned drdy :1;
432 unsigned df :1;
433 unsigned dsc :1;
434 unsigned drq :1;
435 unsigned corr :1;
436 unsigned idx :1;
437 unsigned check :1;
438#else
439#error "Please fix <asm/byteorder.h>"
440#endif
441 } b;
442} ata_status_t, atapi_status_t;
443
444/*
445 * ATAPI Feature Register
446 *
447 * dma : Using DMA or PIO
448 * reserved321 : Reserved
449 * reserved654 : Reserved (Tag Type)
450 * reserved7 : Reserved
451 */
452typedef union {
453 unsigned all :8;
454 struct {
455#if defined(__LITTLE_ENDIAN_BITFIELD)
456 unsigned dma :1;
457 unsigned reserved321 :3;
458 unsigned reserved654 :3;
459 unsigned reserved7 :1;
460#elif defined(__BIG_ENDIAN_BITFIELD)
461 unsigned reserved7 :1;
462 unsigned reserved654 :3;
463 unsigned reserved321 :3;
464 unsigned dma :1;
465#else
466#error "Please fix <asm/byteorder.h>"
467#endif
468 } b;
469} atapi_feature_t;
470
471/*
472 * ATAPI Interrupt Reason Register.
473 *
474 * cod : Information transferred is command (1) or data (0)
475 * io : The device requests us to read (1) or write (0)
476 * reserved : Reserved
477 */
478typedef union {
479 unsigned all :8;
480 struct {
481#if defined(__LITTLE_ENDIAN_BITFIELD)
482 unsigned cod :1;
483 unsigned io :1;
484 unsigned reserved :6;
485#elif defined(__BIG_ENDIAN_BITFIELD)
486 unsigned reserved :6;
487 unsigned io :1;
488 unsigned cod :1;
489#else
490#error "Please fix <asm/byteorder.h>"
491#endif
492 } b;
493} atapi_ireason_t;
494
495/*
496 * The ATAPI error register.
497 *
498 * ili : Illegal Length Indication
499 * eom : End Of Media Detected
500 * abrt : Aborted command - As defined by ATA
501 * mcr : Media Change Requested - As defined by ATA
502 * sense_key : Sense key of the last failed packet command
503 */
504typedef union {
505 unsigned all :8;
506 struct {
507#if defined(__LITTLE_ENDIAN_BITFIELD)
508 unsigned ili :1;
509 unsigned eom :1;
510 unsigned abrt :1;
511 unsigned mcr :1;
512 unsigned sense_key :4;
513#elif defined(__BIG_ENDIAN_BITFIELD)
514 unsigned sense_key :4;
515 unsigned mcr :1;
516 unsigned abrt :1;
517 unsigned eom :1;
518 unsigned ili :1;
519#else
520#error "Please fix <asm/byteorder.h>"
521#endif
522 } b;
523} atapi_error_t;
524
525/*
526 * Status returned from various ide_ functions 345 * Status returned from various ide_ functions
527 */ 346 */
528typedef enum { 347typedef enum {
@@ -568,7 +387,6 @@ typedef struct ide_drive_s {
568 u8 state; /* retry state */ 387 u8 state; /* retry state */
569 u8 waiting_for_dma; /* dma currently in progress */ 388 u8 waiting_for_dma; /* dma currently in progress */
570 u8 unmask; /* okay to unmask other irqs */ 389 u8 unmask; /* okay to unmask other irqs */
571 u8 bswap; /* byte swap data */
572 u8 noflush; /* don't attempt flushes */ 390 u8 noflush; /* don't attempt flushes */
573 u8 dsc_overlap; /* DSC overlap */ 391 u8 dsc_overlap; /* DSC overlap */
574 u8 nice1; /* give potential excess bandwidth */ 392 u8 nice1; /* give potential excess bandwidth */
@@ -583,8 +401,6 @@ typedef struct ide_drive_s {
583 unsigned no_unmask : 1; /* disallow setting unmask bit */ 401 unsigned no_unmask : 1; /* disallow setting unmask bit */
584 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ 402 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
585 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ 403 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
586 unsigned nice0 : 1; /* give obvious excess bandwidth */
587 unsigned nice2 : 1; /* give a share in our own bandwidth */
588 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 404 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
589 unsigned nodma : 1; /* disallow DMA */ 405 unsigned nodma : 1; /* disallow DMA */
590 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ 406 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
@@ -664,7 +480,6 @@ typedef struct hwif_s {
664 u8 major; /* our major number */ 480 u8 major; /* our major number */
665 u8 index; /* 0 for ide0; 1 for ide1; ... */ 481 u8 index; /* 0 for ide0; 1 for ide1; ... */
666 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 482 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
667 u8 straight8; /* Alan's straight 8 check */
668 u8 bus_state; /* power state of the IDE bus */ 483 u8 bus_state; /* power state of the IDE bus */
669 484
670 u32 host_flags; 485 u32 host_flags;
@@ -679,7 +494,8 @@ typedef struct hwif_s {
679 494
680 hwif_chipset_t chipset; /* sub-module for tuning.. */ 495 hwif_chipset_t chipset; /* sub-module for tuning.. */
681 496
682 struct pci_dev *pci_dev; /* for pci chipsets */ 497 struct device *dev;
498
683 const struct ide_port_info *cds; /* chipset device struct */ 499 const struct ide_port_info *cds; /* chipset device struct */
684 500
685 ide_ack_intr_t *ack_intr; 501 ide_ack_intr_t *ack_intr;
@@ -689,6 +505,8 @@ typedef struct hwif_s {
689#if 0 505#if 0
690 ide_hwif_ops_t *hwifops; 506 ide_hwif_ops_t *hwifops;
691#else 507#else
508 /* host specific initialization of devices on a port */
509 void (*port_init_devs)(struct hwif_s *);
692 /* routine to program host for PIO mode */ 510 /* routine to program host for PIO mode */
693 void (*set_pio_mode)(ide_drive_t *, const u8); 511 void (*set_pio_mode)(ide_drive_t *, const u8);
694 /* routine to program host for DMA mode */ 512 /* routine to program host for DMA mode */
@@ -701,19 +519,17 @@ typedef struct hwif_s {
701 void (*pre_reset)(ide_drive_t *); 519 void (*pre_reset)(ide_drive_t *);
702 /* routine to reset controller after a disk reset */ 520 /* routine to reset controller after a disk reset */
703 void (*resetproc)(ide_drive_t *); 521 void (*resetproc)(ide_drive_t *);
704 /* special interrupt handling for shared pci interrupts */
705 void (*intrproc)(ide_drive_t *);
706 /* special host masking for drive selection */ 522 /* special host masking for drive selection */
707 void (*maskproc)(ide_drive_t *, int); 523 void (*maskproc)(ide_drive_t *, int);
708 /* check host's drive quirk list */ 524 /* check host's drive quirk list */
709 int (*quirkproc)(ide_drive_t *); 525 void (*quirkproc)(ide_drive_t *);
710 /* driver soft-power interface */ 526 /* driver soft-power interface */
711 int (*busproc)(ide_drive_t *, int); 527 int (*busproc)(ide_drive_t *, int);
712#endif 528#endif
713 u8 (*mdma_filter)(ide_drive_t *); 529 u8 (*mdma_filter)(ide_drive_t *);
714 u8 (*udma_filter)(ide_drive_t *); 530 u8 (*udma_filter)(ide_drive_t *);
715 531
716 void (*fixup)(struct hwif_s *); 532 u8 (*cable_detect)(struct hwif_s *);
717 533
718 void (*ata_input_data)(ide_drive_t *, void *, u32); 534 void (*ata_input_data)(ide_drive_t *, void *, u32);
719 void (*ata_output_data)(ide_drive_t *, void *, u32); 535 void (*ata_output_data)(ide_drive_t *, void *, u32);
@@ -721,16 +537,13 @@ typedef struct hwif_s {
721 void (*atapi_input_bytes)(ide_drive_t *, void *, u32); 537 void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
722 void (*atapi_output_bytes)(ide_drive_t *, void *, u32); 538 void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
723 539
540 void (*dma_host_set)(ide_drive_t *, int);
724 int (*dma_setup)(ide_drive_t *); 541 int (*dma_setup)(ide_drive_t *);
725 void (*dma_exec_cmd)(ide_drive_t *, u8); 542 void (*dma_exec_cmd)(ide_drive_t *, u8);
726 void (*dma_start)(ide_drive_t *); 543 void (*dma_start)(ide_drive_t *);
727 int (*ide_dma_end)(ide_drive_t *drive); 544 int (*ide_dma_end)(ide_drive_t *drive);
728 int (*ide_dma_on)(ide_drive_t *drive);
729 void (*dma_off_quietly)(ide_drive_t *drive);
730 int (*ide_dma_test_irq)(ide_drive_t *drive); 545 int (*ide_dma_test_irq)(ide_drive_t *drive);
731 void (*ide_dma_clear_irq)(ide_drive_t *drive); 546 void (*ide_dma_clear_irq)(ide_drive_t *drive);
732 void (*dma_host_on)(ide_drive_t *drive);
733 void (*dma_host_off)(ide_drive_t *drive);
734 void (*dma_lost_irq)(ide_drive_t *drive); 547 void (*dma_lost_irq)(ide_drive_t *drive);
735 void (*dma_timeout)(ide_drive_t *drive); 548 void (*dma_timeout)(ide_drive_t *drive);
736 549
@@ -766,7 +579,6 @@ typedef struct hwif_s {
766 int rqsize; /* max sectors per request */ 579 int rqsize; /* max sectors per request */
767 int irq; /* our irq number */ 580 int irq; /* our irq number */
768 581
769 unsigned long dma_master; /* reference base addr dmabase */
770 unsigned long dma_base; /* base addr for dma ports */ 582 unsigned long dma_base; /* base addr for dma ports */
771 unsigned long dma_command; /* dma command register */ 583 unsigned long dma_command; /* dma command register */
772 unsigned long dma_vendor1; /* dma vendor 1 register */ 584 unsigned long dma_vendor1; /* dma vendor 1 register */
@@ -786,10 +598,9 @@ typedef struct hwif_s {
786 unsigned serialized : 1; /* serialized all channel operation */ 598 unsigned serialized : 1; /* serialized all channel operation */
787 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 599 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
788 unsigned reset : 1; /* reset after probe */ 600 unsigned reset : 1; /* reset after probe */
789 unsigned auto_poll : 1; /* supports nop auto-poll */
790 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 601 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
791 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
792 unsigned mmio : 1; /* host uses MMIO */ 602 unsigned mmio : 1; /* host uses MMIO */
603 unsigned straight8 : 1; /* Alan's straight 8 check */
793 604
794 struct device gendev; 605 struct device gendev;
795 struct completion gendev_rel_comp; /* To deal with device release() */ 606 struct completion gendev_rel_comp; /* To deal with device release() */
@@ -806,15 +617,16 @@ typedef struct hwif_s {
806/* 617/*
807 * internal ide interrupt handler type 618 * internal ide interrupt handler type
808 */ 619 */
809typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
810typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); 620typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
811typedef int (ide_expiry_t)(ide_drive_t *); 621typedef int (ide_expiry_t)(ide_drive_t *);
812 622
623/* used by ide-cd, ide-floppy, etc. */
624typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
625
813typedef struct hwgroup_s { 626typedef struct hwgroup_s {
814 /* irq handler, if active */ 627 /* irq handler, if active */
815 ide_startstop_t (*handler)(ide_drive_t *); 628 ide_startstop_t (*handler)(ide_drive_t *);
816 /* irq handler, suspended if active */ 629
817 ide_startstop_t (*handler_save)(ide_drive_t *);
818 /* BOOL: protects all fields below */ 630 /* BOOL: protects all fields below */
819 volatile int busy; 631 volatile int busy;
820 /* BOOL: wake us up on timer expiry */ 632 /* BOOL: wake us up on timer expiry */
@@ -829,25 +641,18 @@ typedef struct hwgroup_s {
829 /* ptr to current hwif in linked-list */ 641 /* ptr to current hwif in linked-list */
830 ide_hwif_t *hwif; 642 ide_hwif_t *hwif;
831 643
832 /* for pci chipsets */
833 struct pci_dev *pci_dev;
834
835 /* current request */ 644 /* current request */
836 struct request *rq; 645 struct request *rq;
646
837 /* failsafe timer */ 647 /* failsafe timer */
838 struct timer_list timer; 648 struct timer_list timer;
839 /* local copy of current write rq */
840 struct request wrq;
841 /* timeout value during long polls */ 649 /* timeout value during long polls */
842 unsigned long poll_timeout; 650 unsigned long poll_timeout;
843 /* queried upon timeouts */ 651 /* queried upon timeouts */
844 int (*expiry)(ide_drive_t *); 652 int (*expiry)(ide_drive_t *);
845 /* ide_system_bus_speed */ 653
846 int pio_clock;
847 int req_gen; 654 int req_gen;
848 int req_gen_timer; 655 int req_gen_timer;
849
850 unsigned char cmd_buf[4];
851} ide_hwgroup_t; 656} ide_hwgroup_t;
852 657
853typedef struct ide_driver_s ide_driver_t; 658typedef struct ide_driver_s ide_driver_t;
@@ -901,6 +706,7 @@ typedef struct {
901void proc_ide_create(void); 706void proc_ide_create(void);
902void proc_ide_destroy(void); 707void proc_ide_destroy(void);
903void ide_proc_register_port(ide_hwif_t *); 708void ide_proc_register_port(ide_hwif_t *);
709void ide_proc_port_register_devices(ide_hwif_t *);
904void ide_proc_unregister_port(ide_hwif_t *); 710void ide_proc_unregister_port(ide_hwif_t *);
905void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 711void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
906void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 712void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -933,6 +739,7 @@ void ide_pci_create_host_proc(const char *, get_info_t *);
933static inline void proc_ide_create(void) { ; } 739static inline void proc_ide_create(void) { ; }
934static inline void proc_ide_destroy(void) { ; } 740static inline void proc_ide_destroy(void) { ; }
935static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 741static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
742static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
936static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 743static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
937static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 744static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
938static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 745static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
@@ -1020,7 +827,8 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1020 827
1021extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 828extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1022 829
1023extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); 830void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
831 ide_expiry_t *);
1024 832
1025ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 833ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
1026 834
@@ -1031,14 +839,7 @@ ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *); 839extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
1032 840
1033extern void ide_fix_driveid(struct hd_driveid *); 841extern void ide_fix_driveid(struct hd_driveid *);
1034/* 842
1035 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
1036 * removing leading/trailing blanks and compressing internal blanks.
1037 * It is primarily used to tidy up the model name/number fields as
1038 * returned by the WIN_[P]IDENTIFY commands.
1039 *
1040 * (s, bytecount, byteswap)
1041 */
1042extern void ide_fixstring(u8 *, const int, const int); 843extern void ide_fixstring(u8 *, const int, const int);
1043 844
1044int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 845int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
@@ -1061,60 +862,124 @@ extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
1061 862
1062extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 863extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1063 864
1064/* 865enum {
1065 * Issue ATA command and wait for completion. 866 IDE_TFLAG_LBA48 = (1 << 0),
1066 * Use for implementing commands in kernel 867 IDE_TFLAG_NO_SELECT_MASK = (1 << 1),
1067 * 868 IDE_TFLAG_FLAGGED = (1 << 2),
1068 * (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) 869 IDE_TFLAG_OUT_DATA = (1 << 3),
1069 */ 870 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
1070extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); 871 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
872 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
873 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
874 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
875 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
876 IDE_TFLAG_OUT_HOB_NSECT |
877 IDE_TFLAG_OUT_HOB_LBAL |
878 IDE_TFLAG_OUT_HOB_LBAM |
879 IDE_TFLAG_OUT_HOB_LBAH,
880 IDE_TFLAG_OUT_FEATURE = (1 << 9),
881 IDE_TFLAG_OUT_NSECT = (1 << 10),
882 IDE_TFLAG_OUT_LBAL = (1 << 11),
883 IDE_TFLAG_OUT_LBAM = (1 << 12),
884 IDE_TFLAG_OUT_LBAH = (1 << 13),
885 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
886 IDE_TFLAG_OUT_NSECT |
887 IDE_TFLAG_OUT_LBAL |
888 IDE_TFLAG_OUT_LBAM |
889 IDE_TFLAG_OUT_LBAH,
890 IDE_TFLAG_OUT_DEVICE = (1 << 14),
891 IDE_TFLAG_WRITE = (1 << 15),
892 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
893 IDE_TFLAG_IN_DATA = (1 << 17),
894 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
895 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
896 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
897 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
898 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
899 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
900 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
901 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
902 IDE_TFLAG_IN_HOB_LBAM |
903 IDE_TFLAG_IN_HOB_LBAH,
904 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
905 IDE_TFLAG_IN_HOB_NSECT |
906 IDE_TFLAG_IN_HOB_LBA,
907 IDE_TFLAG_IN_NSECT = (1 << 25),
908 IDE_TFLAG_IN_LBAL = (1 << 26),
909 IDE_TFLAG_IN_LBAM = (1 << 27),
910 IDE_TFLAG_IN_LBAH = (1 << 28),
911 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
912 IDE_TFLAG_IN_LBAM |
913 IDE_TFLAG_IN_LBAH,
914 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
915 IDE_TFLAG_IN_LBA,
916 IDE_TFLAG_IN_DEVICE = (1 << 29),
917 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
918 IDE_TFLAG_IN_HOB,
919 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
920 IDE_TFLAG_IN_TF,
921 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
922 IDE_TFLAG_IN_DEVICE,
923 /* force 16-bit I/O operations */
924 IDE_TFLAG_IO_16BIT = (1 << 30),
925};
926
927struct ide_taskfile {
928 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
929
930 u8 hob_feature; /* 1-5: additional data to support LBA48 */
931 u8 hob_nsect;
932 u8 hob_lbal;
933 u8 hob_lbam;
934 u8 hob_lbah;
935
936 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
937
938 union { /*  7: */
939 u8 error; /* read: error */
940 u8 feature; /* write: feature */
941 };
942
943 u8 nsect; /* 8: number of sectors */
944 u8 lbal; /* 9: LBA low */
945 u8 lbam; /* 10: LBA mid */
946 u8 lbah; /* 11: LBA high */
947
948 u8 device; /* 12: device select */
949
950 union { /* 13: */
951 u8 status; /*  read: status  */
952 u8 command; /* write: command */
953 };
954};
1071 955
1072typedef struct ide_task_s { 956typedef struct ide_task_s {
1073/* 957 union {
1074 * struct hd_drive_task_hdr tf; 958 struct ide_taskfile tf;
1075 * task_struct_t tf; 959 u8 tf_array[14];
1076 * struct hd_drive_hob_hdr hobf; 960 };
1077 * hob_struct_t hobf; 961 u32 tf_flags;
1078 */
1079 task_ioreg_t tfRegister[8];
1080 task_ioreg_t hobRegister[8];
1081 ide_reg_valid_t tf_out_flags;
1082 ide_reg_valid_t tf_in_flags;
1083 int data_phase; 962 int data_phase;
1084 int command_type;
1085 ide_pre_handler_t *prehandler;
1086 ide_handler_t *handler;
1087 struct request *rq; /* copy of request */ 963 struct request *rq; /* copy of request */
1088 void *special; /* valid_t generally */ 964 void *special; /* valid_t generally */
1089} ide_task_t; 965} ide_task_t;
1090 966
1091extern u32 ide_read_24(ide_drive_t *); 967void ide_tf_load(ide_drive_t *, ide_task_t *);
968void ide_tf_read(ide_drive_t *, ide_task_t *);
1092 969
1093extern void SELECT_DRIVE(ide_drive_t *); 970extern void SELECT_DRIVE(ide_drive_t *);
1094extern void SELECT_INTERRUPT(ide_drive_t *);
1095extern void SELECT_MASK(ide_drive_t *, int); 971extern void SELECT_MASK(ide_drive_t *, int);
1096extern void QUIRK_LIST(ide_drive_t *);
1097 972
1098extern int drive_is_ready(ide_drive_t *); 973extern int drive_is_ready(ide_drive_t *);
1099 974
1100/* 975void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1101 * taskfile io for disks for now...and builds request from ide_ioctl
1102 */
1103extern ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1104 976
1105/* 977ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1106 * Special Flagged Register Validation Caller
1107 */
1108extern ide_startstop_t flagged_taskfile(ide_drive_t *, ide_task_t *);
1109 978
1110extern ide_startstop_t set_multmode_intr(ide_drive_t *); 979void task_end_request(ide_drive_t *, struct request *, u8);
1111extern ide_startstop_t set_geometry_intr(ide_drive_t *);
1112extern ide_startstop_t recal_intr(ide_drive_t *);
1113extern ide_startstop_t task_no_data_intr(ide_drive_t *);
1114extern ide_startstop_t task_in_intr(ide_drive_t *);
1115extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
1116 980
1117extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *); 981int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
982int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1118 983
1119int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 984int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1120int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); 985int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
@@ -1123,10 +988,8 @@ int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
1123extern int system_bus_clock(void); 988extern int system_bus_clock(void);
1124 989
1125extern int ide_driveid_update(ide_drive_t *); 990extern int ide_driveid_update(ide_drive_t *);
1126extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
1127extern int ide_config_drive_speed(ide_drive_t *, u8); 991extern int ide_config_drive_speed(ide_drive_t *, u8);
1128extern u8 eighty_ninty_three (ide_drive_t *); 992extern u8 eighty_ninty_three (ide_drive_t *);
1129extern int set_transfer(ide_drive_t *, ide_task_t *);
1130extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); 993extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
1131 994
1132extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); 995extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
@@ -1140,10 +1003,8 @@ extern void do_ide_request(struct request_queue *);
1140 1003
1141void ide_init_disk(struct gendisk *, ide_drive_t *); 1004void ide_init_disk(struct gendisk *, ide_drive_t *);
1142 1005
1143extern int ideprobe_init(void);
1144
1145#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 1006#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1146extern void ide_scan_pcibus(int scan_direction) __init; 1007extern int ide_scan_direction;
1147extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1008extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1148#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 1009#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1149#else 1010#else
@@ -1153,6 +1014,13 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1153void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); 1014void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *);
1154void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1015void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1155 1016
1017#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1018void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1019#else
1020static inline void ide_hwif_setup_dma(ide_hwif_t *hwif,
1021 const struct ide_port_info *d) { }
1022#endif
1023
1156extern void default_hwif_iops(ide_hwif_t *); 1024extern void default_hwif_iops(ide_hwif_t *);
1157extern void default_hwif_mmiops(ide_hwif_t *); 1025extern void default_hwif_mmiops(ide_hwif_t *);
1158extern void default_hwif_transport(ide_hwif_t *); 1026extern void default_hwif_transport(ide_hwif_t *);
@@ -1189,7 +1057,7 @@ enum {
1189 IDE_HFLAG_NO_SET_MODE = (1 << 9), 1057 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1190 /* trust BIOS for programming chipset/device for DMA */ 1058 /* trust BIOS for programming chipset/device for DMA */
1191 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1059 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1192 /* host uses VDMA */ 1060 /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */
1193 IDE_HFLAG_VDMA = (1 << 11), 1061 IDE_HFLAG_VDMA = (1 << 11),
1194 /* ATAPI DMA is unsupported */ 1062 /* ATAPI DMA is unsupported */
1195 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1063 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
@@ -1199,8 +1067,10 @@ enum {
1199 IDE_HFLAG_NO_DMA = (1 << 14), 1067 IDE_HFLAG_NO_DMA = (1 << 14),
1200 /* check if host is PCI IDE device before allowing DMA */ 1068 /* check if host is PCI IDE device before allowing DMA */
1201 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1069 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1070 /* don't autotune PIO */
1071 IDE_HFLAG_NO_AUTOTUNE = (1 << 16),
1202 /* host is CS5510/CS5520 */ 1072 /* host is CS5510/CS5520 */
1203 IDE_HFLAG_CS5520 = (1 << 16), 1073 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1204 /* no LBA48 */ 1074 /* no LBA48 */
1205 IDE_HFLAG_NO_LBA48 = (1 << 17), 1075 IDE_HFLAG_NO_LBA48 = (1 << 17),
1206 /* no LBA48 DMA */ 1076 /* no LBA48 DMA */
@@ -1219,6 +1089,17 @@ enum {
1219 IDE_HFLAG_IO_32BIT = (1 << 24), 1089 IDE_HFLAG_IO_32BIT = (1 << 24),
1220 /* unmask IRQs */ 1090 /* unmask IRQs */
1221 IDE_HFLAG_UNMASK_IRQS = (1 << 25), 1091 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1092 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1093 /* host is CY82C693 */
1094 IDE_HFLAG_CY82C693 = (1 << 27),
1095 /* force host out of "simplex" mode */
1096 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1097 /* DSC overlap is unsupported */
1098 IDE_HFLAG_NO_DSC = (1 << 29),
1099 /* never use 32-bit I/O ops */
1100 IDE_HFLAG_NO_IO_32BIT = (1 << 30),
1101 /* never unmask IRQs */
1102 IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31),
1222}; 1103};
1223 1104
1224#ifdef CONFIG_BLK_DEV_OFFBOARD 1105#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1233,10 +1114,9 @@ struct ide_port_info {
1233 void (*init_iops)(ide_hwif_t *); 1114 void (*init_iops)(ide_hwif_t *);
1234 void (*init_hwif)(ide_hwif_t *); 1115 void (*init_hwif)(ide_hwif_t *);
1235 void (*init_dma)(ide_hwif_t *, unsigned long); 1116 void (*init_dma)(ide_hwif_t *, unsigned long);
1236 void (*fixup)(ide_hwif_t *);
1237 ide_pci_enablebit_t enablebits[2]; 1117 ide_pci_enablebit_t enablebits[2];
1238 hwif_chipset_t chipset; 1118 hwif_chipset_t chipset;
1239 unsigned int extra; 1119 u8 extra;
1240 u32 host_flags; 1120 u32 host_flags;
1241 u8 pio_mask; 1121 u8 pio_mask;
1242 u8 swdma_mask; 1122 u8 swdma_mask;
@@ -1262,6 +1142,7 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1262 1142
1263#ifdef CONFIG_BLK_DEV_IDEDMA 1143#ifdef CONFIG_BLK_DEV_IDEDMA
1264int __ide_dma_bad_drive(ide_drive_t *); 1144int __ide_dma_bad_drive(ide_drive_t *);
1145int ide_id_dma_bug(ide_drive_t *);
1265 1146
1266u8 ide_find_dma_mode(ide_drive_t *, u8); 1147u8 ide_find_dma_mode(ide_drive_t *, u8);
1267 1148
@@ -1270,22 +1151,22 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive)
1270 return ide_find_dma_mode(drive, XFER_UDMA_6); 1151 return ide_find_dma_mode(drive, XFER_UDMA_6);
1271} 1152}
1272 1153
1154void ide_dma_off_quietly(ide_drive_t *);
1273void ide_dma_off(ide_drive_t *); 1155void ide_dma_off(ide_drive_t *);
1274void ide_dma_verbose(ide_drive_t *); 1156void ide_dma_on(ide_drive_t *);
1275int ide_set_dma(ide_drive_t *); 1157int ide_set_dma(ide_drive_t *);
1158void ide_check_dma_crc(ide_drive_t *);
1276ide_startstop_t ide_dma_intr(ide_drive_t *); 1159ide_startstop_t ide_dma_intr(ide_drive_t *);
1277 1160
1161int ide_build_sglist(ide_drive_t *, struct request *);
1162void ide_destroy_dmatable(ide_drive_t *);
1163
1278#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1164#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1279extern int ide_build_sglist(ide_drive_t *, struct request *);
1280extern int ide_build_dmatable(ide_drive_t *, struct request *); 1165extern int ide_build_dmatable(ide_drive_t *, struct request *);
1281extern void ide_destroy_dmatable(ide_drive_t *);
1282extern int ide_release_dma(ide_hwif_t *); 1166extern int ide_release_dma(ide_hwif_t *);
1283extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); 1167extern void ide_setup_dma(ide_hwif_t *, unsigned long);
1284 1168
1285void ide_dma_host_off(ide_drive_t *); 1169void ide_dma_host_set(ide_drive_t *, int);
1286void ide_dma_off_quietly(ide_drive_t *);
1287void ide_dma_host_on(ide_drive_t *);
1288extern int __ide_dma_on(ide_drive_t *);
1289extern int ide_dma_setup(ide_drive_t *); 1170extern int ide_dma_setup(ide_drive_t *);
1290extern void ide_dma_start(ide_drive_t *); 1171extern void ide_dma_start(ide_drive_t *);
1291extern int __ide_dma_end(ide_drive_t *); 1172extern int __ide_dma_end(ide_drive_t *);
@@ -1294,11 +1175,15 @@ extern void ide_dma_timeout(ide_drive_t *);
1294#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 1175#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
1295 1176
1296#else 1177#else
1178static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1297static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1179static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1298static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1180static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1181static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
1299static inline void ide_dma_off(ide_drive_t *drive) { ; } 1182static inline void ide_dma_off(ide_drive_t *drive) { ; }
1183static inline void ide_dma_on(ide_drive_t *drive) { ; }
1300static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1184static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1301static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1185static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1186static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1302#endif /* CONFIG_BLK_DEV_IDEDMA */ 1187#endif /* CONFIG_BLK_DEV_IDEDMA */
1303 1188
1304#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 1189#ifndef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1310,25 +1195,29 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1310extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1195extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1311extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1196extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1312extern void ide_acpi_init(ide_hwif_t *hwif); 1197extern void ide_acpi_init(ide_hwif_t *hwif);
1198void ide_acpi_port_init_devices(ide_hwif_t *);
1313extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1199extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1314#else 1200#else
1315static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1201static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1316static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1202static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1317static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1203static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1318static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1204static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
1205static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1319static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1206static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1320#endif 1207#endif
1321 1208
1209void ide_remove_port_from_hwgroup(ide_hwif_t *);
1322extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1210extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1323extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1211extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1324extern void ide_unregister (unsigned int index); 1212void ide_unregister(unsigned int, int, int);
1325 1213
1326void ide_register_region(struct gendisk *); 1214void ide_register_region(struct gendisk *);
1327void ide_unregister_region(struct gendisk *); 1215void ide_unregister_region(struct gendisk *);
1328 1216
1329void ide_undecoded_slave(ide_hwif_t *); 1217void ide_undecoded_slave(ide_drive_t *);
1330 1218
1331int ide_device_add(u8 idx[4]); 1219int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1220int ide_device_add(u8 idx[4], const struct ide_port_info *);
1332 1221
1333static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1222static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1334{ 1223{
@@ -1340,8 +1229,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1340 hwif->hwif_data = data; 1229 hwif->hwif_data = data;
1341} 1230}
1342 1231
1343/* ide-lib.c */ 1232const char *ide_xfer_verbose(u8 mode);
1344extern char *ide_xfer_verbose(u8 xfer_rate);
1345extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1233extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1346extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1234extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1347 1235
@@ -1363,6 +1251,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
1363 return 0; 1251 return 0;
1364} 1252}
1365 1253
1254u64 ide_get_lba_addr(struct ide_taskfile *, int);
1366u8 ide_dump_status(ide_drive_t *, const char *, u8); 1255u8 ide_dump_status(ide_drive_t *, const char *, u8);
1367 1256
1368typedef struct ide_pio_timings_s { 1257typedef struct ide_pio_timings_s {
@@ -1412,9 +1301,14 @@ extern struct bus_type ide_bus_type;
1412#define ide_id_has_flush_cache_ext(id) \ 1301#define ide_id_has_flush_cache_ext(id) \
1413 (((id)->cfs_enable_2 & 0x2400) == 0x2400) 1302 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1414 1303
1304static inline void ide_dump_identify(u8 *id)
1305{
1306 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);
1307}
1308
1415static inline int hwif_to_node(ide_hwif_t *hwif) 1309static inline int hwif_to_node(ide_hwif_t *hwif)
1416{ 1310{
1417 struct pci_dev *dev = hwif->pci_dev; 1311 struct pci_dev *dev = to_pci_dev(hwif->dev);
1418 return dev ? pcibus_to_node(dev->bus) : -1; 1312 return dev ? pcibus_to_node(dev->bus) : -1;
1419} 1313}
1420 1314
@@ -1425,4 +1319,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1425 return &hwif->drives[(drive->dn ^ 1) & 1]; 1319 return &hwif->drives[(drive->dn ^ 1) & 1];
1426} 1320}
1427 1321
1322static inline void ide_set_irq(ide_drive_t *drive, int on)
1323{
1324 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG);
1325}
1326
1428#endif /* _IDE_H */ 1327#endif /* _IDE_H */