aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 22:36:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 22:36:05 -0400
commit5f737085beea3a5c5b6f44a16e6d3e2fd03095e0 (patch)
tree218643043a16f9af32b2b1037ddbb3ecd271c779 /include/linux
parente9a404580ccaeb31dd2a976f9929c4f9eb6f3540 (diff)
parent276d789e1794560d7ce53a7f2687415e2a80bb8a (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: (50 commits) ide: remove inclusion of non-existent io_trace.h ide-disk: add get_smart_data() helper ide: fix ->data_phase in taskfile_load_raw() ide: check drive->using_dma in flagged_taskfile() ide: check ->dma_setup() return value in flagged_taskfile() dtc2278: note on docs qd65xx: remove pointless qd_{read,write}_reg() (take 2) ide: PCI BMDMA initialization fixes (take 2) ide: remove stale comments from ide-taskfile.c ide: remove dead code from ide_driveid_update() ide: use __ide_end_request() in ide_end_dequeued_request() ide: enhance ide_setup_pci_noise() cs5530: remove needless ide_lock taking ide: take ide_lock for prefetch disable/enable in do_special() ht6560b: fix deadlock on error handling cmd640: fix deadlock on error handling slc90e66: fix deadlock on error handling opti621: fix deadlock on error handling qd65xx: fix deadlock on error handling dtc2278: fix deadlock on error handling ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ide.h109
1 files changed, 33 insertions, 76 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 19db0a4ae447..2e4b8dd03cfe 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -192,22 +192,20 @@ typedef unsigned char byte; /* used everywhere */
192struct hwif_s; 192struct hwif_s;
193typedef int (ide_ack_intr_t)(struct hwif_s *); 193typedef int (ide_ack_intr_t)(struct hwif_s *);
194 194
195#ifndef NO_DMA
196#define NO_DMA 255
197#endif
198
199/* 195/*
200 * hwif_chipset_t is used to keep track of the specific hardware 196 * hwif_chipset_t is used to keep track of the specific hardware
201 * chipset used by each IDE interface, if known. 197 * chipset used by each IDE interface, if known.
202 */ 198 */
203typedef enum { ide_unknown, ide_generic, ide_pci, 199enum { ide_unknown, ide_generic, ide_pci,
204 ide_cmd640, ide_dtc2278, ide_ali14xx, 200 ide_cmd640, ide_dtc2278, ide_ali14xx,
205 ide_qd65xx, ide_umc8672, ide_ht6560b, 201 ide_qd65xx, ide_umc8672, ide_ht6560b,
206 ide_rz1000, ide_trm290, 202 ide_rz1000, ide_trm290,
207 ide_cmd646, ide_cy82c693, ide_4drives, 203 ide_cmd646, ide_cy82c693, ide_4drives,
208 ide_pmac, ide_etrax100, ide_acorn, 204 ide_pmac, ide_etrax100, ide_acorn,
209 ide_au1xxx, ide_forced 205 ide_au1xxx, ide_forced
210} hwif_chipset_t; 206};
207
208typedef u8 hwif_chipset_t;
211 209
212/* 210/*
213 * Structure to hold all information about the location of this port 211 * Structure to hold all information about the location of this port
@@ -215,22 +213,16 @@ typedef enum { ide_unknown, ide_generic, ide_pci,
215typedef struct hw_regs_s { 213typedef struct hw_regs_s {
216 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ 214 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */
217 int irq; /* our irq number */ 215 int irq; /* our irq number */
218 int dma; /* our dma entry */
219 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 216 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
220 hwif_chipset_t chipset; 217 hwif_chipset_t chipset;
221 struct device *dev; 218 struct device *dev;
222} hw_regs_t; 219} hw_regs_t;
223 220
224/* 221struct hwif_s * ide_find_port(unsigned long);
225 * Register new hardware with ide 222
226 */ 223int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int,
227int ide_register_hw(hw_regs_t *, int, struct hwif_s **); 224 struct hwif_s **);
228int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **,
229 void (*)(struct hwif_s *));
230 225
231/*
232 * Set up hw_regs_t structure before calling ide_register_hw (optional)
233 */
234void ide_setup_ports( hw_regs_t *hw, 226void ide_setup_ports( hw_regs_t *hw,
235 unsigned long base, 227 unsigned long base,
236 int *offsets, 228 int *offsets,
@@ -268,11 +260,7 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
268# define ide_init_default_irq(base) (0) 260# define ide_init_default_irq(base) (0)
269#endif 261#endif
270 262
271/* 263#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
272 * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series.
273 * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in <asm/ide.h>.
274 */
275#ifdef IDE_ARCH_OBSOLETE_INIT
276static inline void ide_init_hwif_ports(hw_regs_t *hw, 264static inline void ide_init_hwif_ports(hw_regs_t *hw,
277 unsigned long io_addr, 265 unsigned long io_addr,
278 unsigned long ctl_addr, 266 unsigned long ctl_addr,
@@ -302,7 +290,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
302 if (io_addr || ctl_addr) 290 if (io_addr || ctl_addr)
303 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); 291 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
304} 292}
305#endif /* IDE_ARCH_OBSOLETE_INIT */ 293#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */
306 294
307/* Currently only m68k, apus and m8xx need it */ 295/* Currently only m68k, apus and m8xx need it */
308#ifndef IDE_ARCH_ACK_INTR 296#ifndef IDE_ARCH_ACK_INTR
@@ -363,7 +351,6 @@ typedef union {
363 * ATA DATA Register Special. 351 * ATA DATA Register Special.
364 * ATA NSECTOR Count Register(). 352 * ATA NSECTOR Count Register().
365 * ATAPI Byte Count Register. 353 * ATAPI Byte Count Register.
366 * Channel index ordering pairs.
367 */ 354 */
368typedef union { 355typedef union {
369 unsigned all :16; 356 unsigned all :16;
@@ -378,7 +365,7 @@ typedef union {
378#error "Please fix <asm/byteorder.h>" 365#error "Please fix <asm/byteorder.h>"
379#endif 366#endif
380 } b; 367 } b;
381} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; 368} ata_nsector_t, ata_data_t, atapi_bcount_t;
382 369
383/* 370/*
384 * ATA-IDE Select Register, aka Device-Head 371 * ATA-IDE Select Register, aka Device-Head
@@ -657,7 +644,7 @@ typedef struct ide_drive_s {
657 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 644 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
658#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 645#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
659 646
660struct ide_pci_device_s; 647struct ide_port_info;
661 648
662typedef struct hwif_s { 649typedef struct hwif_s {
663 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 650 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
@@ -672,7 +659,6 @@ typedef struct hwif_s {
672 unsigned long sata_scr[SATA_NR_PORTS]; 659 unsigned long sata_scr[SATA_NR_PORTS];
673 unsigned long sata_misc[SATA_NR_PORTS]; 660 unsigned long sata_misc[SATA_NR_PORTS];
674 661
675 hw_regs_t hw; /* Hardware info */
676 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 662 ide_drive_t drives[MAX_DRIVES]; /* drive info */
677 663
678 u8 major; /* our major number */ 664 u8 major; /* our major number */
@@ -694,7 +680,9 @@ typedef struct hwif_s {
694 hwif_chipset_t chipset; /* sub-module for tuning.. */ 680 hwif_chipset_t chipset; /* sub-module for tuning.. */
695 681
696 struct pci_dev *pci_dev; /* for pci chipsets */ 682 struct pci_dev *pci_dev; /* for pci chipsets */
697 struct ide_pci_device_s *cds; /* chipset device struct */ 683 const struct ide_port_info *cds; /* chipset device struct */
684
685 ide_ack_intr_t *ack_intr;
698 686
699 void (*rw_disk)(ide_drive_t *, struct request *); 687 void (*rw_disk)(ide_drive_t *, struct request *);
700 688
@@ -725,6 +713,8 @@ typedef struct hwif_s {
725 u8 (*mdma_filter)(ide_drive_t *); 713 u8 (*mdma_filter)(ide_drive_t *);
726 u8 (*udma_filter)(ide_drive_t *); 714 u8 (*udma_filter)(ide_drive_t *);
727 715
716 void (*fixup)(struct hwif_s *);
717
728 void (*ata_input_data)(ide_drive_t *, void *, u32); 718 void (*ata_input_data)(ide_drive_t *, void *, u32);
729 void (*ata_output_data)(ide_drive_t *, void *, u32); 719 void (*ata_output_data)(ide_drive_t *, void *, u32);
730 720
@@ -841,8 +831,6 @@ typedef struct hwgroup_s {
841 831
842 /* for pci chipsets */ 832 /* for pci chipsets */
843 struct pci_dev *pci_dev; 833 struct pci_dev *pci_dev;
844 /* chipset device struct */
845 struct ide_pci_device_s *cds;
846 834
847 /* current request */ 835 /* current request */
848 struct request *rq; 836 struct request *rq;
@@ -1030,36 +1018,16 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
1030int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1018int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1031 int uptodate, int nr_sectors); 1019 int uptodate, int nr_sectors);
1032 1020
1033/*
1034 * This is used on exit from the driver to designate the next irq handler
1035 * and also to start the safety timer.
1036 */
1037extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 1021extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1038 1022
1039/*
1040 * This is used on exit from the driver to designate the next irq handler
1041 * and start the safety time safely and atomically from the IRQ handler
1042 * with respect to the command issue (which it also does)
1043 */
1044extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); 1023extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);
1045 1024
1046ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 1025ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
1047 1026
1048/*
1049 * ide_error() takes action based on the error returned by the controller.
1050 * The caller should return immediately after invoking this.
1051 *
1052 * (drive, msg, status)
1053 */
1054ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 1027ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
1055 1028
1056ide_startstop_t __ide_abort(ide_drive_t *, struct request *); 1029ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
1057 1030
1058/*
1059 * Abort a running command on the controller triggering the abort
1060 * from a host side, non error situation
1061 * (drive, msg)
1062 */
1063extern ide_startstop_t ide_abort(ide_drive_t *, const char *); 1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
1064 1032
1065extern void ide_fix_driveid(struct hd_driveid *); 1033extern void ide_fix_driveid(struct hd_driveid *);
@@ -1075,15 +1043,8 @@ extern void ide_fixstring(u8 *, const int, const int);
1075 1043
1076int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1044int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1077 1045
1078/*
1079 * Start a reset operation for an IDE interface.
1080 * The caller should return immediately after invoking this.
1081 */
1082extern ide_startstop_t ide_do_reset (ide_drive_t *); 1046extern ide_startstop_t ide_do_reset (ide_drive_t *);
1083 1047
1084/*
1085 * This function is intended to be used prior to invoking ide_do_drive_cmd().
1086 */
1087extern void ide_init_drive_cmd (struct request *rq); 1048extern void ide_init_drive_cmd (struct request *rq);
1088 1049
1089/* 1050/*
@@ -1098,13 +1059,6 @@ typedef enum {
1098 1059
1099extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); 1060extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
1100 1061
1101/*
1102 * Clean up after success/failure of an explicit drive cmd.
1103 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD).
1104 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK).
1105 *
1106 * (ide_drive_t *drive, u8 stat, u8 err)
1107 */
1108extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1062extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1109 1063
1110/* 1064/*
@@ -1177,10 +1131,6 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
1177 1131
1178extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); 1132extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
1179 1133
1180/*
1181 * ide_stall_queue() can be used by a drive to give excess bandwidth back
1182 * to the hwgroup by sleeping for timeout jiffies.
1183 */
1184extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); 1134extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1185 1135
1186extern int ide_spin_wait_hwgroup(ide_drive_t *); 1136extern int ide_spin_wait_hwgroup(ide_drive_t *);
@@ -1200,8 +1150,8 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1200#define ide_pci_register_driver(d) pci_register_driver(d) 1150#define ide_pci_register_driver(d) pci_register_driver(d)
1201#endif 1151#endif
1202 1152
1203void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1153void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *);
1204extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1154void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1205 1155
1206extern void default_hwif_iops(ide_hwif_t *); 1156extern void default_hwif_iops(ide_hwif_t *);
1207extern void default_hwif_mmiops(ide_hwif_t *); 1157extern void default_hwif_mmiops(ide_hwif_t *);
@@ -1261,6 +1211,14 @@ enum {
1261 IDE_HFLAG_SERIALIZE = (1 << 20), 1211 IDE_HFLAG_SERIALIZE = (1 << 20),
1262 /* use legacy IRQs */ 1212 /* use legacy IRQs */
1263 IDE_HFLAG_LEGACY_IRQS = (1 << 21), 1213 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1214 /* force use of legacy IRQs */
1215 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1216 /* limit LBA48 requests to 256 sectors */
1217 IDE_HFLAG_RQSIZE_256 = (1 << 23),
1218 /* use 32-bit I/O ops */
1219 IDE_HFLAG_IO_32BIT = (1 << 24),
1220 /* unmask IRQs */
1221 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1264}; 1222};
1265 1223
1266#ifdef CONFIG_BLK_DEV_OFFBOARD 1224#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1269,7 +1227,7 @@ enum {
1269# define IDE_HFLAG_OFF_BOARD 0 1227# define IDE_HFLAG_OFF_BOARD 0
1270#endif 1228#endif
1271 1229
1272typedef struct ide_pci_device_s { 1230struct ide_port_info {
1273 char *name; 1231 char *name;
1274 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1232 unsigned int (*init_chipset)(struct pci_dev *, const char *);
1275 void (*init_iops)(ide_hwif_t *); 1233 void (*init_iops)(ide_hwif_t *);
@@ -1277,17 +1235,17 @@ typedef struct ide_pci_device_s {
1277 void (*init_dma)(ide_hwif_t *, unsigned long); 1235 void (*init_dma)(ide_hwif_t *, unsigned long);
1278 void (*fixup)(ide_hwif_t *); 1236 void (*fixup)(ide_hwif_t *);
1279 ide_pci_enablebit_t enablebits[2]; 1237 ide_pci_enablebit_t enablebits[2];
1238 hwif_chipset_t chipset;
1280 unsigned int extra; 1239 unsigned int extra;
1281 struct ide_pci_device_s *next;
1282 u32 host_flags; 1240 u32 host_flags;
1283 u8 pio_mask; 1241 u8 pio_mask;
1284 u8 swdma_mask; 1242 u8 swdma_mask;
1285 u8 mwdma_mask; 1243 u8 mwdma_mask;
1286 u8 udma_mask; 1244 u8 udma_mask;
1287} ide_pci_device_t; 1245};
1288 1246
1289extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); 1247int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *);
1290extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); 1248int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *);
1291 1249
1292void ide_map_sg(ide_drive_t *, struct request *); 1250void ide_map_sg(ide_drive_t *, struct request *);
1293void ide_init_sg_cmd(ide_drive_t *, struct request *); 1251void ide_init_sg_cmd(ide_drive_t *, struct request *);
@@ -1370,8 +1328,7 @@ void ide_unregister_region(struct gendisk *);
1370 1328
1371void ide_undecoded_slave(ide_hwif_t *); 1329void ide_undecoded_slave(ide_hwif_t *);
1372 1330
1373int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); 1331int ide_device_add(u8 idx[4]);
1374extern int probe_hwif_init(ide_hwif_t *);
1375 1332
1376static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1333static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1377{ 1334{