diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 116 |
1 files changed, 66 insertions, 50 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index b2f2003b92e5..3bad2701bfa6 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -202,12 +202,6 @@ enum { | |||
202 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | 202 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity |
203 | * led */ | 203 | * led */ |
204 | 204 | ||
205 | /* The following flag belongs to ap->pflags but is kept in | ||
206 | * ap->flags because it's referenced in many LLDs and will be | ||
207 | * removed in not-too-distant future. | ||
208 | */ | ||
209 | ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */ | ||
210 | |||
211 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ | 205 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ |
212 | 206 | ||
213 | 207 | ||
@@ -256,12 +250,13 @@ enum { | |||
256 | ATA_TMOUT_INTERNAL_QUICK = 5000, | 250 | ATA_TMOUT_INTERNAL_QUICK = 5000, |
257 | ATA_TMOUT_MAX_PARK = 30000, | 251 | ATA_TMOUT_MAX_PARK = 30000, |
258 | 252 | ||
259 | /* FIXME: GoVault needs 2s but we can't afford that without | 253 | /* |
260 | * parallel probing. 800ms is enough for iVDR disk | 254 | * GoVault needs 2s and iVDR disk HHD424020F7SV00 800ms. 2s |
261 | * HHD424020F7SV00. Increase to 2secs when parallel probing | 255 | * is too much without parallel probing. Use 2s if parallel |
262 | * is in place. | 256 | * probing is available, 800ms otherwise. |
263 | */ | 257 | */ |
264 | ATA_TMOUT_FF_WAIT = 800, | 258 | ATA_TMOUT_FF_WAIT_LONG = 2000, |
259 | ATA_TMOUT_FF_WAIT = 800, | ||
265 | 260 | ||
266 | /* Spec mandates to wait for ">= 2ms" before checking status | 261 | /* Spec mandates to wait for ">= 2ms" before checking status |
267 | * after reset. We wait 150ms, because that was the magic | 262 | * after reset. We wait 150ms, because that was the magic |
@@ -391,6 +386,7 @@ enum { | |||
391 | ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ | 386 | ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ |
392 | ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ | 387 | ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ |
393 | ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ | 388 | ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ |
389 | ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ | ||
394 | 390 | ||
395 | /* DMA mask for user DMA control: User visible values; DO NOT | 391 | /* DMA mask for user DMA control: User visible values; DO NOT |
396 | renumber */ | 392 | renumber */ |
@@ -518,7 +514,9 @@ struct ata_ioports { | |||
518 | void __iomem *command_addr; | 514 | void __iomem *command_addr; |
519 | void __iomem *altstatus_addr; | 515 | void __iomem *altstatus_addr; |
520 | void __iomem *ctl_addr; | 516 | void __iomem *ctl_addr; |
517 | #ifdef CONFIG_ATA_BMDMA | ||
521 | void __iomem *bmdma_addr; | 518 | void __iomem *bmdma_addr; |
519 | #endif /* CONFIG_ATA_BMDMA */ | ||
522 | void __iomem *scr_addr; | 520 | void __iomem *scr_addr; |
523 | }; | 521 | }; |
524 | #endif /* CONFIG_ATA_SFF */ | 522 | #endif /* CONFIG_ATA_SFF */ |
@@ -721,15 +719,17 @@ struct ata_port { | |||
721 | unsigned int print_id; /* user visible unique port ID */ | 719 | unsigned int print_id; /* user visible unique port ID */ |
722 | unsigned int port_no; /* 0 based port no. inside the host */ | 720 | unsigned int port_no; /* 0 based port no. inside the host */ |
723 | 721 | ||
724 | struct ata_prd *prd; /* our SG list */ | ||
725 | dma_addr_t prd_dma; /* and its DMA mapping */ | ||
726 | |||
727 | #ifdef CONFIG_ATA_SFF | 722 | #ifdef CONFIG_ATA_SFF |
728 | struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ | 723 | struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ |
729 | #endif /* CONFIG_ATA_SFF */ | ||
730 | |||
731 | u8 ctl; /* cache of ATA control register */ | 724 | u8 ctl; /* cache of ATA control register */ |
732 | u8 last_ctl; /* Cache last written value */ | 725 | u8 last_ctl; /* Cache last written value */ |
726 | struct delayed_work sff_pio_task; | ||
727 | #ifdef CONFIG_ATA_BMDMA | ||
728 | struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */ | ||
729 | dma_addr_t bmdma_prd_dma; /* and its DMA mapping */ | ||
730 | #endif /* CONFIG_ATA_BMDMA */ | ||
731 | #endif /* CONFIG_ATA_SFF */ | ||
732 | |||
733 | unsigned int pio_mask; | 733 | unsigned int pio_mask; |
734 | unsigned int mwdma_mask; | 734 | unsigned int mwdma_mask; |
735 | unsigned int udma_mask; | 735 | unsigned int udma_mask; |
@@ -751,8 +751,6 @@ struct ata_port { | |||
751 | struct ata_host *host; | 751 | struct ata_host *host; |
752 | struct device *dev; | 752 | struct device *dev; |
753 | 753 | ||
754 | void *port_task_data; | ||
755 | struct delayed_work port_task; | ||
756 | struct delayed_work hotplug_task; | 754 | struct delayed_work hotplug_task; |
757 | struct work_struct scsi_rescan_task; | 755 | struct work_struct scsi_rescan_task; |
758 | 756 | ||
@@ -849,6 +847,7 @@ struct ata_port_operations { | |||
849 | * SFF / taskfile oriented ops | 847 | * SFF / taskfile oriented ops |
850 | */ | 848 | */ |
851 | void (*sff_dev_select)(struct ata_port *ap, unsigned int device); | 849 | void (*sff_dev_select)(struct ata_port *ap, unsigned int device); |
850 | void (*sff_set_devctl)(struct ata_port *ap, u8 ctl); | ||
852 | u8 (*sff_check_status)(struct ata_port *ap); | 851 | u8 (*sff_check_status)(struct ata_port *ap); |
853 | u8 (*sff_check_altstatus)(struct ata_port *ap); | 852 | u8 (*sff_check_altstatus)(struct ata_port *ap); |
854 | void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf); | 853 | void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf); |
@@ -857,16 +856,17 @@ struct ata_port_operations { | |||
857 | const struct ata_taskfile *tf); | 856 | const struct ata_taskfile *tf); |
858 | unsigned int (*sff_data_xfer)(struct ata_device *dev, | 857 | unsigned int (*sff_data_xfer)(struct ata_device *dev, |
859 | unsigned char *buf, unsigned int buflen, int rw); | 858 | unsigned char *buf, unsigned int buflen, int rw); |
860 | u8 (*sff_irq_on)(struct ata_port *); | 859 | void (*sff_irq_on)(struct ata_port *); |
861 | bool (*sff_irq_check)(struct ata_port *); | 860 | bool (*sff_irq_check)(struct ata_port *); |
862 | void (*sff_irq_clear)(struct ata_port *); | 861 | void (*sff_irq_clear)(struct ata_port *); |
862 | void (*sff_drain_fifo)(struct ata_queued_cmd *qc); | ||
863 | 863 | ||
864 | #ifdef CONFIG_ATA_BMDMA | ||
864 | void (*bmdma_setup)(struct ata_queued_cmd *qc); | 865 | void (*bmdma_setup)(struct ata_queued_cmd *qc); |
865 | void (*bmdma_start)(struct ata_queued_cmd *qc); | 866 | void (*bmdma_start)(struct ata_queued_cmd *qc); |
866 | void (*bmdma_stop)(struct ata_queued_cmd *qc); | 867 | void (*bmdma_stop)(struct ata_queued_cmd *qc); |
867 | u8 (*bmdma_status)(struct ata_port *ap); | 868 | u8 (*bmdma_status)(struct ata_port *ap); |
868 | 869 | #endif /* CONFIG_ATA_BMDMA */ | |
869 | void (*drain_fifo)(struct ata_queued_cmd *qc); | ||
870 | #endif /* CONFIG_ATA_SFF */ | 870 | #endif /* CONFIG_ATA_SFF */ |
871 | 871 | ||
872 | ssize_t (*em_show)(struct ata_port *ap, char *buf); | 872 | ssize_t (*em_show)(struct ata_port *ap, char *buf); |
@@ -935,7 +935,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap) | |||
935 | return ap->ops == &ata_dummy_port_ops; | 935 | return ap->ops == &ata_dummy_port_ops; |
936 | } | 936 | } |
937 | 937 | ||
938 | extern void ata_port_probe(struct ata_port *); | ||
939 | extern int sata_set_spd(struct ata_link *link); | 938 | extern int sata_set_spd(struct ata_link *link); |
940 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); | 939 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); |
941 | extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, | 940 | extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, |
@@ -950,7 +949,6 @@ extern int sata_link_hardreset(struct ata_link *link, | |||
950 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, | 949 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, |
951 | unsigned long deadline); | 950 | unsigned long deadline); |
952 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); | 951 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); |
953 | extern void ata_port_disable(struct ata_port *); | ||
954 | 952 | ||
955 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | 953 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
956 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 954 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
@@ -1006,7 +1004,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode); | |||
1006 | extern int ata_xfer_mode2shift(unsigned long xfer_mode); | 1004 | extern int ata_xfer_mode2shift(unsigned long xfer_mode); |
1007 | extern const char *ata_mode_string(unsigned long xfer_mask); | 1005 | extern const char *ata_mode_string(unsigned long xfer_mask); |
1008 | extern unsigned long ata_id_xfermask(const u16 *id); | 1006 | extern unsigned long ata_id_xfermask(const u16 *id); |
1009 | extern int ata_port_start(struct ata_port *ap); | ||
1010 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); | 1007 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); |
1011 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); | 1008 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); |
1012 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 1009 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
@@ -1039,9 +1036,6 @@ extern int ata_cable_sata(struct ata_port *ap); | |||
1039 | extern int ata_cable_ignore(struct ata_port *ap); | 1036 | extern int ata_cable_ignore(struct ata_port *ap); |
1040 | extern int ata_cable_unknown(struct ata_port *ap); | 1037 | extern int ata_cable_unknown(struct ata_port *ap); |
1041 | 1038 | ||
1042 | extern void ata_pio_queue_task(struct ata_port *ap, void *data, | ||
1043 | unsigned long delay); | ||
1044 | |||
1045 | /* Timing helpers */ | 1039 | /* Timing helpers */ |
1046 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); | 1040 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
1047 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | 1041 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); |
@@ -1443,7 +1437,11 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf) | |||
1443 | { | 1437 | { |
1444 | memset(tf, 0, sizeof(*tf)); | 1438 | memset(tf, 0, sizeof(*tf)); |
1445 | 1439 | ||
1440 | #ifdef CONFIG_ATA_SFF | ||
1446 | tf->ctl = dev->link->ap->ctl; | 1441 | tf->ctl = dev->link->ap->ctl; |
1442 | #else | ||
1443 | tf->ctl = ATA_DEVCTL_OBS; | ||
1444 | #endif | ||
1447 | if (dev->devno == 0) | 1445 | if (dev->devno == 0) |
1448 | tf->device = ATA_DEVICE_OBS; | 1446 | tf->device = ATA_DEVICE_OBS; |
1449 | else | 1447 | else |
@@ -1564,7 +1562,6 @@ extern void sata_pmp_error_handler(struct ata_port *ap); | |||
1564 | #ifdef CONFIG_ATA_SFF | 1562 | #ifdef CONFIG_ATA_SFF |
1565 | 1563 | ||
1566 | extern const struct ata_port_operations ata_sff_port_ops; | 1564 | extern const struct ata_port_operations ata_sff_port_ops; |
1567 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1568 | extern const struct ata_port_operations ata_bmdma32_port_ops; | 1565 | extern const struct ata_port_operations ata_bmdma32_port_ops; |
1569 | 1566 | ||
1570 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ | 1567 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ |
@@ -1573,13 +1570,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops; | |||
1573 | .sg_tablesize = LIBATA_MAX_PRD, \ | 1570 | .sg_tablesize = LIBATA_MAX_PRD, \ |
1574 | .dma_boundary = ATA_DMA_BOUNDARY | 1571 | .dma_boundary = ATA_DMA_BOUNDARY |
1575 | 1572 | ||
1576 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1577 | ATA_BASE_SHT(drv_name), \ | ||
1578 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1579 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1580 | |||
1581 | extern void ata_sff_qc_prep(struct ata_queued_cmd *qc); | ||
1582 | extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); | ||
1583 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); | 1573 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); |
1584 | extern u8 ata_sff_check_status(struct ata_port *ap); | 1574 | extern u8 ata_sff_check_status(struct ata_port *ap); |
1585 | extern void ata_sff_pause(struct ata_port *ap); | 1575 | extern void ata_sff_pause(struct ata_port *ap); |
@@ -1597,13 +1587,14 @@ extern unsigned int ata_sff_data_xfer32(struct ata_device *dev, | |||
1597 | unsigned char *buf, unsigned int buflen, int rw); | 1587 | unsigned char *buf, unsigned int buflen, int rw); |
1598 | extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, | 1588 | extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, |
1599 | unsigned char *buf, unsigned int buflen, int rw); | 1589 | unsigned char *buf, unsigned int buflen, int rw); |
1600 | extern u8 ata_sff_irq_on(struct ata_port *ap); | 1590 | extern void ata_sff_irq_on(struct ata_port *ap); |
1601 | extern void ata_sff_irq_clear(struct ata_port *ap); | 1591 | extern void ata_sff_irq_clear(struct ata_port *ap); |
1602 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | 1592 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
1603 | u8 status, int in_wq); | 1593 | u8 status, int in_wq); |
1594 | extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay); | ||
1604 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); | 1595 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
1605 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); | 1596 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); |
1606 | extern unsigned int ata_sff_host_intr(struct ata_port *ap, | 1597 | extern unsigned int ata_sff_port_intr(struct ata_port *ap, |
1607 | struct ata_queued_cmd *qc); | 1598 | struct ata_queued_cmd *qc); |
1608 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); | 1599 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); |
1609 | extern void ata_sff_lost_interrupt(struct ata_port *ap); | 1600 | extern void ata_sff_lost_interrupt(struct ata_port *ap); |
@@ -1621,21 +1612,8 @@ extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class, | |||
1621 | extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); | 1612 | extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); |
1622 | extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc); | 1613 | extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc); |
1623 | extern void ata_sff_error_handler(struct ata_port *ap); | 1614 | extern void ata_sff_error_handler(struct ata_port *ap); |
1624 | extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc); | ||
1625 | extern int ata_sff_port_start(struct ata_port *ap); | ||
1626 | extern int ata_sff_port_start32(struct ata_port *ap); | ||
1627 | extern void ata_sff_std_ports(struct ata_ioports *ioaddr); | 1615 | extern void ata_sff_std_ports(struct ata_ioports *ioaddr); |
1628 | extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev, | ||
1629 | unsigned long xfer_mask); | ||
1630 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | ||
1631 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | ||
1632 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | ||
1633 | extern u8 ata_bmdma_status(struct ata_port *ap); | ||
1634 | extern void ata_bus_reset(struct ata_port *ap); | ||
1635 | |||
1636 | #ifdef CONFIG_PCI | 1616 | #ifdef CONFIG_PCI |
1637 | extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev); | ||
1638 | extern int ata_pci_bmdma_init(struct ata_host *host); | ||
1639 | extern int ata_pci_sff_init_host(struct ata_host *host); | 1617 | extern int ata_pci_sff_init_host(struct ata_host *host); |
1640 | extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, | 1618 | extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, |
1641 | const struct ata_port_info * const * ppi, | 1619 | const struct ata_port_info * const * ppi, |
@@ -1648,6 +1626,44 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
1648 | struct scsi_host_template *sht, void *host_priv, int hflags); | 1626 | struct scsi_host_template *sht, void *host_priv, int hflags); |
1649 | #endif /* CONFIG_PCI */ | 1627 | #endif /* CONFIG_PCI */ |
1650 | 1628 | ||
1629 | #ifdef CONFIG_ATA_BMDMA | ||
1630 | |||
1631 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1632 | |||
1633 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1634 | ATA_BASE_SHT(drv_name), \ | ||
1635 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1636 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1637 | |||
1638 | extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc); | ||
1639 | extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); | ||
1640 | extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); | ||
1641 | extern unsigned int ata_bmdma_port_intr(struct ata_port *ap, | ||
1642 | struct ata_queued_cmd *qc); | ||
1643 | extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance); | ||
1644 | extern void ata_bmdma_error_handler(struct ata_port *ap); | ||
1645 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); | ||
1646 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | ||
1647 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | ||
1648 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | ||
1649 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | ||
1650 | extern u8 ata_bmdma_status(struct ata_port *ap); | ||
1651 | extern int ata_bmdma_port_start(struct ata_port *ap); | ||
1652 | extern int ata_bmdma_port_start32(struct ata_port *ap); | ||
1653 | |||
1654 | #ifdef CONFIG_PCI | ||
1655 | extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev); | ||
1656 | extern void ata_pci_bmdma_init(struct ata_host *host); | ||
1657 | extern int ata_pci_bmdma_prepare_host(struct pci_dev *pdev, | ||
1658 | const struct ata_port_info * const * ppi, | ||
1659 | struct ata_host **r_host); | ||
1660 | extern int ata_pci_bmdma_init_one(struct pci_dev *pdev, | ||
1661 | const struct ata_port_info * const * ppi, | ||
1662 | struct scsi_host_template *sht, | ||
1663 | void *host_priv, int hflags); | ||
1664 | #endif /* CONFIG_PCI */ | ||
1665 | #endif /* CONFIG_ATA_BMDMA */ | ||
1666 | |||
1651 | /** | 1667 | /** |
1652 | * ata_sff_busy_wait - Wait for a port status register | 1668 | * ata_sff_busy_wait - Wait for a port status register |
1653 | * @ap: Port to wait for. | 1669 | * @ap: Port to wait for. |