aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-18 13:31:12 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-18 13:31:12 -0400
commit3e370b29d35fb01bfb92c2814d6f79bf6a2cb970 (patch)
tree3b8fb467d60bfe6a34686f4abdc3a60050ba40a4 /include/linux/ide.h
parent88d1dce3a74367291f65a757fbdcaf17f042f30c (diff)
parent5b664cb235e97afbf34db9c4d77f08ebd725335e (diff)
Merge branch 'linus' into x86/pci-ioapic-boot-irq-quirks
Conflicts: drivers/pci/quirks.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h129
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 */
144struct hwif_s; 150struct 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
177void ide_init_port_data(struct hwif_s *, unsigned int); 183void 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 {
406struct ide_port_info; 411struct ide_port_info;
407 412
408struct ide_port_ops { 413struct 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
615struct ide_atapi_pc { 618struct 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
803int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 805int 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
814extern ide_hwif_t ide_hwifs[]; /* master data repository */
815#endif
816extern int ide_noacpi;
817extern int ide_acpigtf;
818extern int ide_acpionboot;
819extern int noautodma;
820
821extern int ide_vlb_clk; 807extern int ide_vlb_clk;
822extern int ide_pci_clk; 808extern int ide_pci_clk;
823 809
@@ -845,10 +831,6 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
845 831
846ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 832ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
847 833
848ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
849
850extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
851
852extern void ide_fix_driveid(struct hd_driveid *); 834extern void ide_fix_driveid(struct hd_driveid *);
853 835
854extern void ide_fixstring(u8 *, const int, const int); 836extern 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
858extern ide_startstop_t ide_do_reset (ide_drive_t *); 840extern ide_startstop_t ide_do_reset (ide_drive_t *);
859 841
860extern void ide_init_drive_cmd (struct request *rq); 842extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
861
862/*
863 * "action" parameter type for ide_do_drive_cmd() below.
864 */
865typedef 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
872extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
873 843
874extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 844extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
875 845
876enum { 846enum {
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 {
980void ide_tf_dump(const char *, struct ide_taskfile *); 949void ide_tf_dump(const char *, struct ide_taskfile *);
981 950
982extern void SELECT_DRIVE(ide_drive_t *); 951extern void SELECT_DRIVE(ide_drive_t *);
952void SELECT_MASK(ide_drive_t *, int);
983 953
984extern int drive_is_ready(ide_drive_t *); 954extern int drive_is_ready(ide_drive_t *);
985 955
986void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); 956void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
987 957
958ide_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));
964ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
965 ide_handler_t *, unsigned int, ide_expiry_t *);
966ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *,
967 ide_handler_t *, unsigned int, ide_expiry_t *);
968
988ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 969ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
989 970
990void task_end_request(ide_drive_t *, struct request *, u8); 971void task_end_request(ide_drive_t *, struct request *, u8);
@@ -996,8 +977,6 @@ int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
996int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); 977int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
997int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); 978int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
998 979
999extern int system_bus_clock(void);
1000
1001extern int ide_driveid_update(ide_drive_t *); 980extern int ide_driveid_update(ide_drive_t *);
1002extern int ide_config_drive_speed(ide_drive_t *, u8); 981extern int ide_config_drive_speed(ide_drive_t *, u8);
1003extern u8 eighty_ninty_three (ide_drive_t *); 982extern u8 eighty_ninty_three (ide_drive_t *);
@@ -1279,16 +1258,43 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
1279u64 ide_get_lba_addr(struct ide_taskfile *, int); 1258u64 ide_get_lba_addr(struct ide_taskfile *, int);
1280u8 ide_dump_status(ide_drive_t *, const char *, u8); 1259u8 ide_dump_status(ide_drive_t *, const char *, u8);
1281 1260
1282typedef struct ide_pio_timings_s { 1261struct 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
1273enum {
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
1289struct ide_timing *ide_timing_find_mode(u8);
1290u16 ide_pio_cycle_time(ide_drive_t *, u8);
1291void ide_timing_merge(struct ide_timing *, struct ide_timing *,
1292 struct ide_timing *, unsigned int);
1293int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1294
1295int ide_scan_pio_blacklist(char *);
1288 1296
1289unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1290u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1297u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1291extern const ide_pio_timings_t ide_pio_timings[6];
1292 1298
1293int ide_set_pio_mode(ide_drive_t *, u8); 1299int ide_set_pio_mode(ide_drive_t *, u8);
1294int ide_set_dma_mode(ide_drive_t *, u8); 1300int 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
1355static inline u8 ide_read_status(ide_drive_t *drive) 1362static inline u8 ide_read_status(ide_drive_t *drive)