diff options
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r-- | include/linux/ide.h | 129 |
1 files changed, 68 insertions, 61 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index eddb6daadf4a..4726126f5a59 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -139,6 +139,12 @@ struct ide_io_ports { | |||
139 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ | 139 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * Op codes for special requests to be handled by ide_special_rq(). | ||
143 | * Values should be in the range of 0x20 to 0x3f. | ||
144 | */ | ||
145 | #define REQ_DRIVE_RESET 0x20 | ||
146 | |||
147 | /* | ||
142 | * Check for an interrupt and acknowledge the interrupt status | 148 | * Check for an interrupt and acknowledge the interrupt status |
143 | */ | 149 | */ |
144 | struct hwif_s; | 150 | struct hwif_s; |
@@ -171,7 +177,7 @@ typedef struct hw_regs_s { | |||
171 | int irq; /* our irq number */ | 177 | int irq; /* our irq number */ |
172 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 178 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
173 | hwif_chipset_t chipset; | 179 | hwif_chipset_t chipset; |
174 | struct device *dev; | 180 | struct device *dev, *parent; |
175 | } hw_regs_t; | 181 | } hw_regs_t; |
176 | 182 | ||
177 | void ide_init_port_data(struct hwif_s *, unsigned int); | 183 | void ide_init_port_data(struct hwif_s *, unsigned int); |
@@ -364,7 +370,6 @@ typedef struct ide_drive_s { | |||
364 | u8 wcache; /* status of write cache */ | 370 | u8 wcache; /* status of write cache */ |
365 | u8 acoustic; /* acoustic management */ | 371 | u8 acoustic; /* acoustic management */ |
366 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 372 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
367 | u8 ctl; /* "normal" value for Control register */ | ||
368 | u8 ready_stat; /* min status value for drive ready */ | 373 | u8 ready_stat; /* min status value for drive ready */ |
369 | u8 mult_count; /* current multiple sector setting */ | 374 | u8 mult_count; /* current multiple sector setting */ |
370 | u8 mult_req; /* requested multiple sector setting */ | 375 | u8 mult_req; /* requested multiple sector setting */ |
@@ -406,8 +411,8 @@ typedef struct ide_drive_s { | |||
406 | struct ide_port_info; | 411 | struct ide_port_info; |
407 | 412 | ||
408 | struct ide_port_ops { | 413 | struct ide_port_ops { |
409 | /* host specific initialization of devices on a port */ | 414 | /* host specific initialization of a device */ |
410 | void (*port_init_devs)(struct hwif_s *); | 415 | void (*init_dev)(ide_drive_t *); |
411 | /* routine to program host for PIO mode */ | 416 | /* routine to program host for PIO mode */ |
412 | void (*set_pio_mode)(ide_drive_t *, const u8); | 417 | void (*set_pio_mode)(ide_drive_t *, const u8); |
413 | /* routine to program host for DMA mode */ | 418 | /* routine to program host for DMA mode */ |
@@ -493,7 +498,7 @@ typedef struct hwif_s { | |||
493 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | 498 | void (*ide_dma_clear_irq)(ide_drive_t *drive); |
494 | 499 | ||
495 | void (*OUTB)(u8 addr, unsigned long port); | 500 | void (*OUTB)(u8 addr, unsigned long port); |
496 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); | 501 | void (*OUTBSYNC)(struct hwif_s *hwif, u8 addr, unsigned long port); |
497 | 502 | ||
498 | u8 (*INB)(unsigned long port); | 503 | u8 (*INB)(unsigned long port); |
499 | 504 | ||
@@ -532,7 +537,6 @@ typedef struct hwif_s { | |||
532 | unsigned serialized : 1; /* serialized all channel operation */ | 537 | unsigned serialized : 1; /* serialized all channel operation */ |
533 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 538 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
534 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 539 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
535 | unsigned mmio : 1; /* host uses MMIO */ | ||
536 | 540 | ||
537 | struct device gendev; | 541 | struct device gendev; |
538 | struct device *portdev; | 542 | struct device *portdev; |
@@ -567,8 +571,6 @@ typedef struct hwgroup_s { | |||
567 | unsigned int sleeping : 1; | 571 | unsigned int sleeping : 1; |
568 | /* BOOL: polling active & poll_timeout field valid */ | 572 | /* BOOL: polling active & poll_timeout field valid */ |
569 | unsigned int polling : 1; | 573 | unsigned int polling : 1; |
570 | /* BOOL: in a polling reset situation. Must not trigger another reset yet */ | ||
571 | unsigned int resetting : 1; | ||
572 | 574 | ||
573 | /* current drive */ | 575 | /* current drive */ |
574 | ide_drive_t *drive; | 576 | ide_drive_t *drive; |
@@ -604,12 +606,13 @@ enum { | |||
604 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | 606 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), |
605 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | 607 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), |
606 | PC_FLAG_DMA_OK = (1 << 3), | 608 | PC_FLAG_DMA_OK = (1 << 3), |
607 | PC_FLAG_DMA_RECOMMENDED = (1 << 4), | 609 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), |
608 | PC_FLAG_DMA_IN_PROGRESS = (1 << 5), | 610 | PC_FLAG_DMA_ERROR = (1 << 5), |
609 | PC_FLAG_DMA_ERROR = (1 << 6), | 611 | PC_FLAG_WRITING = (1 << 6), |
610 | PC_FLAG_WRITING = (1 << 7), | ||
611 | /* command timed out */ | 612 | /* command timed out */ |
612 | PC_FLAG_TIMEDOUT = (1 << 8), | 613 | PC_FLAG_TIMEDOUT = (1 << 7), |
614 | PC_FLAG_ZIP_DRIVE = (1 << 8), | ||
615 | PC_FLAG_DRQ_INTERRUPT = (1 << 9), | ||
613 | }; | 616 | }; |
614 | 617 | ||
615 | struct ide_atapi_pc { | 618 | struct ide_atapi_pc { |
@@ -642,8 +645,8 @@ struct ide_atapi_pc { | |||
642 | * to change/removal later. | 645 | * to change/removal later. |
643 | */ | 646 | */ |
644 | u8 pc_buf[256]; | 647 | u8 pc_buf[256]; |
645 | void (*idefloppy_callback) (ide_drive_t *); | 648 | |
646 | ide_startstop_t (*idetape_callback) (ide_drive_t *); | 649 | void (*callback)(ide_drive_t *); |
647 | 650 | ||
648 | /* idetape only */ | 651 | /* idetape only */ |
649 | struct idetape_bh *bh; | 652 | struct idetape_bh *bh; |
@@ -787,7 +790,6 @@ struct ide_driver_s { | |||
787 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 790 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
788 | int (*end_request)(ide_drive_t *, int, int); | 791 | int (*end_request)(ide_drive_t *, int, int); |
789 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); | 792 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); |
790 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); | ||
791 | struct device_driver gen_driver; | 793 | struct device_driver gen_driver; |
792 | int (*probe)(ide_drive_t *); | 794 | int (*probe)(ide_drive_t *); |
793 | void (*remove)(ide_drive_t *); | 795 | void (*remove)(ide_drive_t *); |
@@ -802,22 +804,6 @@ struct ide_driver_s { | |||
802 | 804 | ||
803 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 805 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); |
804 | 806 | ||
805 | /* | ||
806 | * ide_hwifs[] is the master data structure used to keep track | ||
807 | * of just about everything in ide.c. Whenever possible, routines | ||
808 | * should be using pointers to a drive (ide_drive_t *) or | ||
809 | * pointers to a hwif (ide_hwif_t *), rather than indexing this | ||
810 | * structure directly (the allocation/layout may change!). | ||
811 | * | ||
812 | */ | ||
813 | #ifndef _IDE_C | ||
814 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ | ||
815 | #endif | ||
816 | extern int ide_noacpi; | ||
817 | extern int ide_acpigtf; | ||
818 | extern int ide_acpionboot; | ||
819 | extern int noautodma; | ||
820 | |||
821 | extern int ide_vlb_clk; | 807 | extern int ide_vlb_clk; |
822 | extern int ide_pci_clk; | 808 | extern int ide_pci_clk; |
823 | 809 | ||
@@ -845,10 +831,6 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | |||
845 | 831 | ||
846 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 832 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
847 | 833 | ||
848 | ide_startstop_t __ide_abort(ide_drive_t *, struct request *); | ||
849 | |||
850 | extern ide_startstop_t ide_abort(ide_drive_t *, const char *); | ||
851 | |||
852 | extern void ide_fix_driveid(struct hd_driveid *); | 834 | extern void ide_fix_driveid(struct hd_driveid *); |
853 | 835 | ||
854 | extern void ide_fixstring(u8 *, const int, const int); | 836 | extern void ide_fixstring(u8 *, const int, const int); |
@@ -857,25 +839,12 @@ int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | |||
857 | 839 | ||
858 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 840 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
859 | 841 | ||
860 | extern void ide_init_drive_cmd (struct request *rq); | 842 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); |
861 | |||
862 | /* | ||
863 | * "action" parameter type for ide_do_drive_cmd() below. | ||
864 | */ | ||
865 | typedef enum { | ||
866 | ide_wait, /* insert rq at end of list, and wait for it */ | ||
867 | ide_preempt, /* insert rq in front of current request */ | ||
868 | ide_head_wait, /* insert rq in front of current request and wait for it */ | ||
869 | ide_end /* insert rq at end of list, but don't wait for it */ | ||
870 | } ide_action_t; | ||
871 | |||
872 | extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); | ||
873 | 843 | ||
874 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 844 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
875 | 845 | ||
876 | enum { | 846 | enum { |
877 | IDE_TFLAG_LBA48 = (1 << 0), | 847 | IDE_TFLAG_LBA48 = (1 << 0), |
878 | IDE_TFLAG_NO_SELECT_MASK = (1 << 1), | ||
879 | IDE_TFLAG_FLAGGED = (1 << 2), | 848 | IDE_TFLAG_FLAGGED = (1 << 2), |
880 | IDE_TFLAG_OUT_DATA = (1 << 3), | 849 | IDE_TFLAG_OUT_DATA = (1 << 3), |
881 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | 850 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), |
@@ -980,11 +949,23 @@ typedef struct ide_task_s { | |||
980 | void ide_tf_dump(const char *, struct ide_taskfile *); | 949 | void ide_tf_dump(const char *, struct ide_taskfile *); |
981 | 950 | ||
982 | extern void SELECT_DRIVE(ide_drive_t *); | 951 | extern void SELECT_DRIVE(ide_drive_t *); |
952 | void SELECT_MASK(ide_drive_t *, int); | ||
983 | 953 | ||
984 | extern int drive_is_ready(ide_drive_t *); | 954 | extern int drive_is_ready(ide_drive_t *); |
985 | 955 | ||
986 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | 956 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); |
987 | 957 | ||
958 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, | ||
959 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | ||
960 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), | ||
961 | void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *), | ||
962 | void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int, | ||
963 | int)); | ||
964 | ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *, | ||
965 | ide_handler_t *, unsigned int, ide_expiry_t *); | ||
966 | ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *, | ||
967 | ide_handler_t *, unsigned int, ide_expiry_t *); | ||
968 | |||
988 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 969 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); |
989 | 970 | ||
990 | void task_end_request(ide_drive_t *, struct request *, u8); | 971 | void task_end_request(ide_drive_t *, struct request *, u8); |
@@ -996,8 +977,6 @@ int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | |||
996 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); | 977 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); |
997 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); | 978 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); |
998 | 979 | ||
999 | extern int system_bus_clock(void); | ||
1000 | |||
1001 | extern int ide_driveid_update(ide_drive_t *); | 980 | extern int ide_driveid_update(ide_drive_t *); |
1002 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 981 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
1003 | extern u8 eighty_ninty_three (ide_drive_t *); | 982 | extern u8 eighty_ninty_three (ide_drive_t *); |
@@ -1279,16 +1258,43 @@ static inline int ide_dev_is_sata(struct hd_driveid *id) | |||
1279 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1258 | u64 ide_get_lba_addr(struct ide_taskfile *, int); |
1280 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1259 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1281 | 1260 | ||
1282 | typedef struct ide_pio_timings_s { | 1261 | struct ide_timing { |
1283 | int setup_time; /* Address setup (ns) minimum */ | 1262 | u8 mode; |
1284 | int active_time; /* Active pulse (ns) minimum */ | 1263 | u8 setup; /* t1 */ |
1285 | int cycle_time; /* Cycle time (ns) minimum = */ | 1264 | u16 act8b; /* t2 for 8-bit io */ |
1286 | /* active + recovery (+ setup for some chips) */ | 1265 | u16 rec8b; /* t2i for 8-bit io */ |
1287 | } ide_pio_timings_t; | 1266 | u16 cyc8b; /* t0 for 8-bit io */ |
1267 | u16 active; /* t2 or tD */ | ||
1268 | u16 recover; /* t2i or tK */ | ||
1269 | u16 cycle; /* t0 */ | ||
1270 | u16 udma; /* t2CYCTYP/2 */ | ||
1271 | }; | ||
1272 | |||
1273 | enum { | ||
1274 | IDE_TIMING_SETUP = (1 << 0), | ||
1275 | IDE_TIMING_ACT8B = (1 << 1), | ||
1276 | IDE_TIMING_REC8B = (1 << 2), | ||
1277 | IDE_TIMING_CYC8B = (1 << 3), | ||
1278 | IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B | | ||
1279 | IDE_TIMING_CYC8B, | ||
1280 | IDE_TIMING_ACTIVE = (1 << 4), | ||
1281 | IDE_TIMING_RECOVER = (1 << 5), | ||
1282 | IDE_TIMING_CYCLE = (1 << 6), | ||
1283 | IDE_TIMING_UDMA = (1 << 7), | ||
1284 | IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT | | ||
1285 | IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER | | ||
1286 | IDE_TIMING_CYCLE | IDE_TIMING_UDMA, | ||
1287 | }; | ||
1288 | |||
1289 | struct ide_timing *ide_timing_find_mode(u8); | ||
1290 | u16 ide_pio_cycle_time(ide_drive_t *, u8); | ||
1291 | void ide_timing_merge(struct ide_timing *, struct ide_timing *, | ||
1292 | struct ide_timing *, unsigned int); | ||
1293 | int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); | ||
1294 | |||
1295 | int ide_scan_pio_blacklist(char *); | ||
1288 | 1296 | ||
1289 | unsigned int ide_pio_cycle_time(ide_drive_t *, u8); | ||
1290 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); | 1297 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); |
1291 | extern const ide_pio_timings_t ide_pio_timings[6]; | ||
1292 | 1298 | ||
1293 | int ide_set_pio_mode(ide_drive_t *, u8); | 1299 | int ide_set_pio_mode(ide_drive_t *, u8); |
1294 | int ide_set_dma_mode(ide_drive_t *, u8); | 1300 | int ide_set_dma_mode(ide_drive_t *, u8); |
@@ -1349,7 +1355,8 @@ static inline void ide_set_irq(ide_drive_t *drive, int on) | |||
1349 | { | 1355 | { |
1350 | ide_hwif_t *hwif = drive->hwif; | 1356 | ide_hwif_t *hwif = drive->hwif; |
1351 | 1357 | ||
1352 | hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr); | 1358 | hwif->OUTBSYNC(hwif, ATA_DEVCTL_OBS | (on ? 0 : 2), |
1359 | hwif->io_ports.ctl_addr); | ||
1353 | } | 1360 | } |
1354 | 1361 | ||
1355 | static inline u8 ide_read_status(ide_drive_t *drive) | 1362 | static inline u8 ide_read_status(ide_drive_t *drive) |