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.h80
1 files changed, 37 insertions, 43 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index fe235b65207e..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,8 @@ 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 *);
854 irq_handler_t irq_handler;
869 unsigned long host_flags; 855 unsigned long host_flags;
870 void *host_priv; 856 void *host_priv;
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 857 ide_hwif_t *cur_port; /* for hosts requiring serialization */
@@ -1144,11 +1130,14 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
1144extern int ide_vlb_clk; 1130extern int ide_vlb_clk;
1145extern int ide_pci_clk; 1131extern int ide_pci_clk;
1146 1132
1147extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1133int ide_end_request(ide_drive_t *, int, int);
1148int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1134int ide_end_dequeued_request(ide_drive_t *, struct request *, int, int);
1149 int uptodate, int nr_sectors); 1135void ide_kill_rq(ide_drive_t *, struct request *);
1150 1136
1151extern 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 *);
1152 1141
1153void 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,
1154 ide_expiry_t *); 1143 ide_expiry_t *);
@@ -1167,13 +1156,14 @@ int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
1167 1156
1168int 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);
1169 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
1170extern ide_startstop_t ide_do_reset (ide_drive_t *); 1162extern ide_startstop_t ide_do_reset (ide_drive_t *);
1171 1163
1172extern int ide_devset_execute(ide_drive_t *drive, 1164extern int ide_devset_execute(ide_drive_t *drive,
1173 const struct ide_devset *setting, int arg); 1165 const struct ide_devset *setting, int arg);
1174 1166
1175extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
1176
1177extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1167extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1178 1168
1179void ide_tf_dump(const char *, struct ide_taskfile *); 1169void ide_tf_dump(const char *, struct ide_taskfile *);
@@ -1198,10 +1188,6 @@ void SELECT_MASK(ide_drive_t *, int);
1198u8 ide_read_error(ide_drive_t *); 1188u8 ide_read_error(ide_drive_t *);
1199void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); 1189void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
1200 1190
1201extern int drive_is_ready(ide_drive_t *);
1202
1203void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1204
1205int ide_check_atapi_device(ide_drive_t *, const char *); 1191int ide_check_atapi_device(ide_drive_t *, const char *);
1206 1192
1207void ide_init_pc(struct ide_atapi_pc *); 1193void ide_init_pc(struct ide_atapi_pc *);
@@ -1249,6 +1235,8 @@ int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1249 1235
1250int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1236int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1251 1237
1238int ide_dev_read_id(ide_drive_t *, u8, u16 *);
1239
1252extern int ide_driveid_update(ide_drive_t *); 1240extern int ide_driveid_update(ide_drive_t *);
1253extern int ide_config_drive_speed(ide_drive_t *, u8); 1241extern int ide_config_drive_speed(ide_drive_t *, u8);
1254extern u8 eighty_ninty_three (ide_drive_t *); 1242extern u8 eighty_ninty_three (ide_drive_t *);
@@ -1278,7 +1266,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
1278 return 0; 1266 return 0;
1279} 1267}
1280 1268
1281void 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 *,
1282 hw_regs_t *, hw_regs_t **); 1270 hw_regs_t *, hw_regs_t **);
1283void 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 *);
1284 1272
@@ -1347,10 +1335,6 @@ enum {
1347 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), 1335 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1348 /* serialize ports */ 1336 /* serialize ports */
1349 IDE_HFLAG_SERIALIZE = (1 << 20), 1337 IDE_HFLAG_SERIALIZE = (1 << 20),
1350 /* use legacy IRQs */
1351 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1352 /* force use of legacy IRQs */
1353 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1354 /* host is TRM290 */ 1338 /* host is TRM290 */
1355 IDE_HFLAG_TRM290 = (1 << 23), 1339 IDE_HFLAG_TRM290 = (1 << 23),
1356 /* use 32-bit I/O ops */ 1340 /* use 32-bit I/O ops */
@@ -1378,7 +1362,7 @@ enum {
1378 1362
1379struct ide_port_info { 1363struct ide_port_info {
1380 char *name; 1364 char *name;
1381 unsigned int (*init_chipset)(struct pci_dev *); 1365 int (*init_chipset)(struct pci_dev *);
1382 void (*init_iops)(ide_hwif_t *); 1366 void (*init_iops)(ide_hwif_t *);
1383 void (*init_hwif)(ide_hwif_t *); 1367 void (*init_hwif)(ide_hwif_t *);
1384 int (*init_dma)(ide_hwif_t *, 1368 int (*init_dma)(ide_hwif_t *,
@@ -1469,6 +1453,7 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1469 1453
1470void ide_dma_lost_irq(ide_drive_t *); 1454void ide_dma_lost_irq(ide_drive_t *);
1471void ide_dma_timeout(ide_drive_t *); 1455void ide_dma_timeout(ide_drive_t *);
1456ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
1472 1457
1473#else 1458#else
1474static 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; }
@@ -1480,21 +1465,24 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1480static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1465static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1481static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1466static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1482static 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; }
1483static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1469static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1484#endif /* CONFIG_BLK_DEV_IDEDMA */ 1470#endif /* CONFIG_BLK_DEV_IDEDMA */
1485 1471
1486#ifdef CONFIG_BLK_DEV_IDEACPI 1472#ifdef CONFIG_BLK_DEV_IDEACPI
1473int ide_acpi_init(void);
1487extern int ide_acpi_exec_tfs(ide_drive_t *drive); 1474extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1488extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1475extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1489extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1476extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1490extern void ide_acpi_init(ide_hwif_t *hwif); 1477void ide_acpi_init_port(ide_hwif_t *);
1491void ide_acpi_port_init_devices(ide_hwif_t *); 1478void ide_acpi_port_init_devices(ide_hwif_t *);
1492extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1479extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1493#else 1480#else
1481static inline int ide_acpi_init(void) { return 0; }
1494static 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; }
1495static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1483static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1496static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1484static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1497static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1485static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; }
1498static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } 1486static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1499static 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) {}
1500#endif 1488#endif
@@ -1528,9 +1516,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1528 hwif->hwif_data = data; 1516 hwif->hwif_data = data;
1529} 1517}
1530 1518
1531const char *ide_xfer_verbose(u8 mode);
1532extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1519extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1533extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1534 1520
1535u64 ide_get_lba_addr(struct ide_taskfile *, int); 1521u64 ide_get_lba_addr(struct ide_taskfile *, int);
1536u8 ide_dump_status(ide_drive_t *, const char *, u8); 1522u8 ide_dump_status(ide_drive_t *, const char *, u8);
@@ -1569,14 +1555,18 @@ void ide_timing_merge(struct ide_timing *, struct ide_timing *,
1569 struct ide_timing *, unsigned int); 1555 struct ide_timing *, unsigned int);
1570int 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);
1571 1557
1558#ifdef CONFIG_IDE_XFER_MODE
1572int ide_scan_pio_blacklist(char *); 1559int ide_scan_pio_blacklist(char *);
1573 1560const char *ide_xfer_verbose(u8);
1574u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1561u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1575
1576int ide_set_pio_mode(ide_drive_t *, u8); 1562int ide_set_pio_mode(ide_drive_t *, u8);
1577int ide_set_dma_mode(ide_drive_t *, u8); 1563int ide_set_dma_mode(ide_drive_t *, u8);
1578
1579void 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
1580 1570
1581static inline void ide_set_max_pio(ide_drive_t *drive) 1571static inline void ide_set_max_pio(ide_drive_t *drive)
1582{ 1572{
@@ -1609,6 +1599,10 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1609#define ide_port_for_each_dev(i, dev, port) \ 1599#define ide_port_for_each_dev(i, dev, port) \
1610 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) 1600 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1611 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
1612#define ide_host_for_each_port(i, port, host) \ 1606#define ide_host_for_each_port(i, port, host) \
1613 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)++)
1614 1608