aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
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 /drivers/ata/sata_nv.c
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 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 20cc510595db..a007b20c1991 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1156,7 +1156,8 @@ static int nv_adma_port_start(struct ata_port *ap)
1156 if (rc) 1156 if (rc)
1157 return rc; 1157 return rc;
1158 1158
1159 rc = ata_port_start(ap); 1159 /* we might fallback to bmdma, allocate bmdma resources */
1160 rc = ata_bmdma_port_start(ap);
1160 if (rc) 1161 if (rc)
1161 return rc; 1162 return rc;
1162 1163
@@ -1985,7 +1986,8 @@ static int nv_swncq_port_start(struct ata_port *ap)
1985 struct nv_swncq_port_priv *pp; 1986 struct nv_swncq_port_priv *pp;
1986 int rc; 1987 int rc;
1987 1988
1988 rc = ata_port_start(ap); 1989 /* we might fallback to bmdma, allocate bmdma resources */
1990 rc = ata_bmdma_port_start(ap);
1989 if (rc) 1991 if (rc)
1990 return rc; 1992 return rc;
1991 1993