aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-05-10 15:41:34 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-19 13:32:19 -0400
commitc7087652e1890a3feef35b30ee1d4be68e1932cd (patch)
tree04aeca0f44e87a531d7cb5f894b6790391c2c552 /include/linux/libata.h
parent8930ff254a3a80d4477c3391ade07d6dd2a036c7 (diff)
libata-sff: clean up BMDMA initialization
When BMDMA initialization failed or BMDMA was not available for whatever reason, bmdma_addr was left at zero and used as an indication that BMDMA shouldn't be used. This leads to the following problems. p1. For BMDMA drivers which don't use traditional BMDMA register, ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those drivers either have to inherit from ata_sff_port_ops or clear ->mode_filter explicitly. p2. non-BMDMA drivers call into BMDMA PRD table allocation. It doesn't actually allocate PRD table if bmdma_addr is not initialized but is still confusing. p3. For BMDMA drivers which don't use traditional BMDMA register, some methods might not be invoked as expected (e.g. bmdma_stop from ata_sff_post_internal_cmd()). p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops worrying libata core might call into one of them. These problems are caused by the muddy line between SFF and BMDMA and the assumption that all BMDMA controllers initialize bmdma_addr. This patch fixes p1 and p2 by removing the bmdma_addr assumption and moving prd allocation to BMDMA port start. Later patches will fix the remaining issues. This patch improves BMDMA initialization such that * When BMDMA register initialization fails, falls back to PIO instead of failing. ata_pci_bmdma_init() never fails now. * When ata_pci_bmdma_init() falls back to PIO, it clears ap->mwdma_mask and udma_mask instead of depending on ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter() unnecessary thus resolving p1. * ata_port_start() which actually is BMDMA specific is moved to ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start() are killed. * ata_sff_port_start32() is moved and renamed to ata_bmdma_port_start32(). Drivers which no longer call into PRD table allocation are... pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all drivers which inherit from ata_sff_port_ops. pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD but is a BMDMA controller and doesn't have custom port_start like other such controllers. Note that with the previous patch which makes all and only BMDMA drivers inherit from ata_bmdma_port_ops, this change doesn't break drivers which need PRD table. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d735728873b5..45a547e42d47 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1000,7 +1000,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
1000extern int ata_xfer_mode2shift(unsigned long xfer_mode); 1000extern int ata_xfer_mode2shift(unsigned long xfer_mode);
1001extern const char *ata_mode_string(unsigned long xfer_mask); 1001extern const char *ata_mode_string(unsigned long xfer_mask);
1002extern unsigned long ata_id_xfermask(const u16 *id); 1002extern unsigned long ata_id_xfermask(const u16 *id);
1003extern int ata_port_start(struct ata_port *ap);
1004extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 1003extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
1005extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 1004extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
1006extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 1005extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -1616,8 +1615,6 @@ extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1616extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc); 1615extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1617extern void ata_sff_error_handler(struct ata_port *ap); 1616extern void ata_sff_error_handler(struct ata_port *ap);
1618extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc); 1617extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1619extern int ata_sff_port_start(struct ata_port *ap);
1620extern int ata_sff_port_start32(struct ata_port *ap);
1621extern void ata_sff_std_ports(struct ata_ioports *ioaddr); 1618extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1622#ifdef CONFIG_PCI 1619#ifdef CONFIG_PCI
1623extern int ata_pci_sff_init_host(struct ata_host *host); 1620extern int ata_pci_sff_init_host(struct ata_host *host);
@@ -1632,16 +1629,16 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1632 struct scsi_host_template *sht, void *host_priv, int hflags); 1629 struct scsi_host_template *sht, void *host_priv, int hflags);
1633#endif /* CONFIG_PCI */ 1630#endif /* CONFIG_PCI */
1634 1631
1635extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1636 unsigned long xfer_mask);
1637extern void ata_bmdma_setup(struct ata_queued_cmd *qc); 1632extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1638extern void ata_bmdma_start(struct ata_queued_cmd *qc); 1633extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1639extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 1634extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1640extern u8 ata_bmdma_status(struct ata_port *ap); 1635extern u8 ata_bmdma_status(struct ata_port *ap);
1636extern int ata_bmdma_port_start(struct ata_port *ap);
1637extern int ata_bmdma_port_start32(struct ata_port *ap);
1641 1638
1642#ifdef CONFIG_PCI 1639#ifdef CONFIG_PCI
1643extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev); 1640extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1644extern int ata_pci_bmdma_init(struct ata_host *host); 1641extern void ata_pci_bmdma_init(struct ata_host *host);
1645#endif /* CONFIG_PCI */ 1642#endif /* CONFIG_PCI */
1646 1643
1647/** 1644/**