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.h79
1 files changed, 36 insertions, 43 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e0cedfe9fad4..854eba8b2ba3 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
@@ -193,24 +193,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
193 hw->io_ports.ctl_addr = ctl_addr; 193 hw->io_ports.ctl_addr = ctl_addr;
194} 194}
195 195
196/* for IDE PCI controllers in legacy mode, temporary */ 196#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
197static inline int __ide_default_irq(unsigned long base) 197 defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
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> 198#include <asm/ide.h>
215#else 199#else
216#include <asm-generic/ide_iops.h> 200#include <asm-generic/ide_iops.h>
@@ -797,6 +781,7 @@ typedef struct hwif_s {
797 struct scatterlist *sg_table; 781 struct scatterlist *sg_table;
798 int sg_max_nents; /* Maximum number of entries in it */ 782 int sg_max_nents; /* Maximum number of entries in it */
799 int sg_nents; /* Current number of entries in it */ 783 int sg_nents; /* Current number of entries in it */
784 int orig_sg_nents;
800 int sg_dma_direction; /* dma transfer direction */ 785 int sg_dma_direction; /* dma transfer direction */
801 786
802 /* data phase of the active command (currently only valid for PIO/DMA) */ 787 /* data phase of the active command (currently only valid for PIO/DMA) */
@@ -865,7 +850,7 @@ struct ide_host {
865 ide_hwif_t *ports[MAX_HOST_PORTS + 1]; 850 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
866 unsigned int n_ports; 851 unsigned int n_ports;
867 struct device *dev[2]; 852 struct device *dev[2];
868 unsigned int (*init_chipset)(struct pci_dev *); 853 int (*init_chipset)(struct pci_dev *);
869 irq_handler_t irq_handler; 854 irq_handler_t irq_handler;
870 unsigned long host_flags; 855 unsigned long host_flags;
871 void *host_priv; 856 void *host_priv;
@@ -1145,11 +1130,14 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
1145extern int ide_vlb_clk; 1130extern int ide_vlb_clk;
1146extern int ide_pci_clk; 1131extern int ide_pci_clk;
1147 1132
1148extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1133int ide_end_request(ide_drive_t *, int, int);
1149int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1134int ide_end_dequeued_request(ide_drive_t *, struct request *, int, int);
1150 int uptodate, int nr_sectors); 1135void ide_kill_rq(ide_drive_t *, struct request *);
1151 1136
1152extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 1137void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int,
1138 ide_expiry_t *);
1139void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int,
1140 ide_expiry_t *);
1153 1141
1154void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 1142void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
1155 ide_expiry_t *); 1143 ide_expiry_t *);
@@ -1168,13 +1156,14 @@ int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
1168 1156
1169int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1157int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1170 1158
1159ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
1160ide_startstop_t ide_do_devset(ide_drive_t *, struct request *);
1161
1171extern ide_startstop_t ide_do_reset (ide_drive_t *); 1162extern ide_startstop_t ide_do_reset (ide_drive_t *);
1172 1163
1173extern int ide_devset_execute(ide_drive_t *drive, 1164extern int ide_devset_execute(ide_drive_t *drive,
1174 const struct ide_devset *setting, int arg); 1165 const struct ide_devset *setting, int arg);
1175 1166
1176extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
1177
1178extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1167extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1179 1168
1180void ide_tf_dump(const char *, struct ide_taskfile *); 1169void ide_tf_dump(const char *, struct ide_taskfile *);
@@ -1199,10 +1188,6 @@ void SELECT_MASK(ide_drive_t *, int);
1199u8 ide_read_error(ide_drive_t *); 1188u8 ide_read_error(ide_drive_t *);
1200void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); 1189void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
1201 1190
1202extern int drive_is_ready(ide_drive_t *);
1203
1204void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1205
1206int ide_check_atapi_device(ide_drive_t *, const char *); 1191int ide_check_atapi_device(ide_drive_t *, const char *);
1207 1192
1208void ide_init_pc(struct ide_atapi_pc *); 1193void ide_init_pc(struct ide_atapi_pc *);
@@ -1250,6 +1235,8 @@ int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1250 1235
1251int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1236int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1252 1237
1238int ide_dev_read_id(ide_drive_t *, u8, u16 *);
1239
1253extern int ide_driveid_update(ide_drive_t *); 1240extern int ide_driveid_update(ide_drive_t *);
1254extern int ide_config_drive_speed(ide_drive_t *, u8); 1241extern int ide_config_drive_speed(ide_drive_t *, u8);
1255extern u8 eighty_ninty_three (ide_drive_t *); 1242extern u8 eighty_ninty_three (ide_drive_t *);
@@ -1279,7 +1266,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
1279 return 0; 1266 return 0;
1280} 1267}
1281 1268
1282void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, 1269void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
1283 hw_regs_t *, hw_regs_t **); 1270 hw_regs_t *, hw_regs_t **);
1284void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1271void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1285 1272
@@ -1348,10 +1335,6 @@ enum {
1348 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), 1335 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1349 /* serialize ports */ 1336 /* serialize ports */
1350 IDE_HFLAG_SERIALIZE = (1 << 20), 1337 IDE_HFLAG_SERIALIZE = (1 << 20),
1351 /* use legacy IRQs */
1352 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1353 /* force use of legacy IRQs */
1354 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1355 /* host is TRM290 */ 1338 /* host is TRM290 */
1356 IDE_HFLAG_TRM290 = (1 << 23), 1339 IDE_HFLAG_TRM290 = (1 << 23),
1357 /* use 32-bit I/O ops */ 1340 /* use 32-bit I/O ops */
@@ -1379,7 +1362,7 @@ enum {
1379 1362
1380struct ide_port_info { 1363struct ide_port_info {
1381 char *name; 1364 char *name;
1382 unsigned int (*init_chipset)(struct pci_dev *); 1365 int (*init_chipset)(struct pci_dev *);
1383 void (*init_iops)(ide_hwif_t *); 1366 void (*init_iops)(ide_hwif_t *);
1384 void (*init_hwif)(ide_hwif_t *); 1367 void (*init_hwif)(ide_hwif_t *);
1385 int (*init_dma)(ide_hwif_t *, 1368 int (*init_dma)(ide_hwif_t *,
@@ -1470,6 +1453,7 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1470 1453
1471void ide_dma_lost_irq(ide_drive_t *); 1454void ide_dma_lost_irq(ide_drive_t *);
1472void ide_dma_timeout(ide_drive_t *); 1455void ide_dma_timeout(ide_drive_t *);
1456ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
1473 1457
1474#else 1458#else
1475static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } 1459static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
@@ -1481,21 +1465,24 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1481static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1465static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1482static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1466static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1483static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1467static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1468static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; }
1484static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1469static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1485#endif /* CONFIG_BLK_DEV_IDEDMA */ 1470#endif /* CONFIG_BLK_DEV_IDEDMA */
1486 1471
1487#ifdef CONFIG_BLK_DEV_IDEACPI 1472#ifdef CONFIG_BLK_DEV_IDEACPI
1473int ide_acpi_init(void);
1488extern int ide_acpi_exec_tfs(ide_drive_t *drive); 1474extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1489extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1475extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1490extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1476extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1491extern void ide_acpi_init(ide_hwif_t *hwif); 1477void ide_acpi_init_port(ide_hwif_t *);
1492void ide_acpi_port_init_devices(ide_hwif_t *); 1478void ide_acpi_port_init_devices(ide_hwif_t *);
1493extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1479extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1494#else 1480#else
1481static inline int ide_acpi_init(void) { return 0; }
1495static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1482static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1496static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1483static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1497static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1484static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1498static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1485static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; }
1499static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } 1486static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1500static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1487static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1501#endif 1488#endif
@@ -1529,9 +1516,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1529 hwif->hwif_data = data; 1516 hwif->hwif_data = data;
1530} 1517}
1531 1518
1532const char *ide_xfer_verbose(u8 mode);
1533extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1519extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1534extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1535 1520
1536u64 ide_get_lba_addr(struct ide_taskfile *, int); 1521u64 ide_get_lba_addr(struct ide_taskfile *, int);
1537u8 ide_dump_status(ide_drive_t *, const char *, u8); 1522u8 ide_dump_status(ide_drive_t *, const char *, u8);
@@ -1570,14 +1555,18 @@ void ide_timing_merge(struct ide_timing *, struct ide_timing *,
1570 struct ide_timing *, unsigned int); 1555 struct ide_timing *, unsigned int);
1571int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); 1556int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1572 1557
1558#ifdef CONFIG_IDE_XFER_MODE
1573int ide_scan_pio_blacklist(char *); 1559int ide_scan_pio_blacklist(char *);
1574 1560const char *ide_xfer_verbose(u8);
1575u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1561u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1576
1577int ide_set_pio_mode(ide_drive_t *, u8); 1562int ide_set_pio_mode(ide_drive_t *, u8);
1578int ide_set_dma_mode(ide_drive_t *, u8); 1563int ide_set_dma_mode(ide_drive_t *, u8);
1579
1580void ide_set_pio(ide_drive_t *, u8); 1564void ide_set_pio(ide_drive_t *, u8);
1565int ide_set_xfer_rate(ide_drive_t *, u8);
1566#else
1567static inline void ide_set_pio(ide_drive_t *drive, u8 pio) { ; }
1568static inline int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { return -1; }
1569#endif
1581 1570
1582static inline void ide_set_max_pio(ide_drive_t *drive) 1571static inline void ide_set_max_pio(ide_drive_t *drive)
1583{ 1572{
@@ -1610,6 +1599,10 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1610#define ide_port_for_each_dev(i, dev, port) \ 1599#define ide_port_for_each_dev(i, dev, port) \
1611 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) 1600 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1612 1601
1602#define ide_port_for_each_present_dev(i, dev, port) \
1603 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) \
1604 if ((dev)->dev_flags & IDE_DFLAG_PRESENT)
1605
1613#define ide_host_for_each_port(i, port, host) \ 1606#define ide_host_for_each_port(i, port, host) \
1614 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) 1607 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1615 1608