aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/au1xxx-ide.c9
-rw-r--r--drivers/ide/ide-dma-sff.c2
-rw-r--r--drivers/ide/ide-dma.c8
-rw-r--r--drivers/ide/pmac.c11
-rw-r--r--drivers/ide/scc_pata.c4
-rw-r--r--drivers/ide/sgiioc4.c9
-rw-r--r--drivers/ide/trm290.c5
-rw-r--r--drivers/ide/tx4939ide.c6
8 files changed, 17 insertions, 37 deletions
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index ba2a211758a9..239643806b97 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -236,7 +236,7 @@ static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
236 if (++count >= PRD_ENTRIES) { 236 if (++count >= PRD_ENTRIES) {
237 printk(KERN_WARNING "%s: DMA table too small\n", 237 printk(KERN_WARNING "%s: DMA table too small\n",
238 drive->name); 238 drive->name);
239 goto use_pio_instead; 239 return 0;
240 } 240 }
241 241
242 /* Lets enable intr for the last descriptor only */ 242 /* Lets enable intr for the last descriptor only */
@@ -272,9 +272,6 @@ static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
272 if (count) 272 if (count)
273 return 1; 273 return 1;
274 274
275 use_pio_instead:
276 ide_destroy_dmatable(drive);
277
278 return 0; /* revert to PIO for this request */ 275 return 0; /* revert to PIO for this request */
279} 276}
280 277
@@ -290,10 +287,8 @@ static void auide_dma_start(ide_drive_t *drive )
290 287
291static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) 288static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
292{ 289{
293 if (auide_build_dmatable(drive, cmd) == 0) { 290 if (auide_build_dmatable(drive, cmd) == 0)
294 ide_map_sg(drive, cmd);
295 return 1; 291 return 1;
296 }
297 292
298 drive->waiting_for_dma = 1; 293 drive->waiting_for_dma = 1;
299 return 0; 294 return 0;
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c
index f8adbb5eb339..e10054b827a0 100644
--- a/drivers/ide/ide-dma-sff.c
+++ b/drivers/ide/ide-dma-sff.c
@@ -166,8 +166,6 @@ use_pio_instead:
166 printk(KERN_ERR "%s: %s\n", drive->name, 166 printk(KERN_ERR "%s: %s\n", drive->name,
167 count ? "DMA table too small" : "empty DMA table?"); 167 count ? "DMA table too small" : "empty DMA table?");
168 168
169 ide_destroy_dmatable(drive);
170
171 return 0; /* revert to PIO for this request */ 169 return 0; /* revert to PIO for this request */
172} 170}
173EXPORT_SYMBOL_GPL(ide_build_dmatable); 171EXPORT_SYMBOL_GPL(ide_build_dmatable);
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index c0505e2dfc2e..d61f9a8cc18a 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -570,8 +570,12 @@ int ide_dma_prepare(ide_drive_t *drive, struct ide_cmd *cmd)
570 570
571 if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || 571 if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 ||
572 (dma_ops->dma_check && dma_ops->dma_check(drive, cmd)) || 572 (dma_ops->dma_check && dma_ops->dma_check(drive, cmd)) ||
573 ide_build_sglist(drive, cmd) == 0 || 573 ide_build_sglist(drive, cmd) == 0)
574 dma_ops->dma_setup(drive, cmd))
575 return 1; 574 return 1;
575 if (dma_ops->dma_setup(drive, cmd)) {
576 ide_destroy_dmatable(drive);
577 ide_map_sg(drive, cmd);
578 return 1;
579 }
576 return 0; 580 return 0;
577} 581}
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index 5643a8b957bf..1df7b7636453 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1455,7 +1455,7 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1455 "switching to PIO on Ohare chipset\n", drive->name); 1455 "switching to PIO on Ohare chipset\n", drive->name);
1456 pmif->broken_dma_warn = 1; 1456 pmif->broken_dma_warn = 1;
1457 } 1457 }
1458 goto use_pio_instead; 1458 return 0;
1459 } 1459 }
1460 while (cur_len) { 1460 while (cur_len) {
1461 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00; 1461 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;
@@ -1463,7 +1463,7 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1463 if (count++ >= MAX_DCMDS) { 1463 if (count++ >= MAX_DCMDS) {
1464 printk(KERN_WARNING "%s: DMA table too small\n", 1464 printk(KERN_WARNING "%s: DMA table too small\n",
1465 drive->name); 1465 drive->name);
1466 goto use_pio_instead; 1466 return 0;
1467 } 1467 }
1468 st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE); 1468 st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE);
1469 st_le16(&table->req_count, tc); 1469 st_le16(&table->req_count, tc);
@@ -1492,9 +1492,6 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1492 1492
1493 printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name); 1493 printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name);
1494 1494
1495use_pio_instead:
1496 ide_destroy_dmatable(drive);
1497
1498 return 0; /* revert to PIO for this request */ 1495 return 0; /* revert to PIO for this request */
1499} 1496}
1500 1497
@@ -1510,10 +1507,8 @@ static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
1510 u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4); 1507 u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4);
1511 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); 1508 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
1512 1509
1513 if (pmac_ide_build_dmatable(drive, cmd) == 0) { 1510 if (pmac_ide_build_dmatable(drive, cmd) == 0)
1514 ide_map_sg(drive, cmd);
1515 return 1; 1511 return 1;
1516 }
1517 1512
1518 /* Apple adds 60ns to wrDataSetup on reads */ 1513 /* Apple adds 60ns to wrDataSetup on reads */
1519 if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) { 1514 if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 693536ebe331..2cdf51d8917a 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -321,10 +321,8 @@ static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
321 u8 dma_stat; 321 u8 dma_stat;
322 322
323 /* fall back to pio! */ 323 /* fall back to pio! */
324 if (ide_build_dmatable(drive, cmd) == 0) { 324 if (ide_build_dmatable(drive, cmd) == 0)
325 ide_map_sg(drive, cmd);
326 return 1; 325 return 1;
327 }
328 326
329 /* PRD table */ 327 /* PRD table */
330 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); 328 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index 457a762a1f29..d90e8c5af0a2 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -442,7 +442,7 @@ static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
442 printk(KERN_WARNING 442 printk(KERN_WARNING
443 "%s: DMA table too small\n", 443 "%s: DMA table too small\n",
444 drive->name); 444 drive->name);
445 goto use_pio_instead; 445 return 0;
446 } else { 446 } else {
447 u32 bcount = 447 u32 bcount =
448 0x10000 - (cur_addr & 0xffff); 448 0x10000 - (cur_addr & 0xffff);
@@ -477,9 +477,6 @@ static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
477 return count; 477 return count;
478 } 478 }
479 479
480use_pio_instead:
481 ide_destroy_dmatable(drive);
482
483 return 0; /* revert to PIO for this request */ 480 return 0; /* revert to PIO for this request */
484} 481}
485 482
@@ -488,11 +485,9 @@ static int sgiioc4_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
488 int ddir; 485 int ddir;
489 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); 486 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
490 487
491 if (sgiioc4_build_dmatable(drive, cmd) == 0) { 488 if (sgiioc4_build_dmatable(drive, cmd) == 0)
492 /* try PIO instead of DMA */ 489 /* try PIO instead of DMA */
493 ide_map_sg(drive, cmd);
494 return 1; 490 return 1;
495 }
496 491
497 if (write) 492 if (write)
498 /* Writes TO the IOC4 FROM Main Memory */ 493 /* Writes TO the IOC4 FROM Main Memory */
diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c
index 1076efd050dc..0be27cae27d5 100644
--- a/drivers/ide/trm290.c
+++ b/drivers/ide/trm290.c
@@ -193,11 +193,10 @@ static int trm290_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
193 unsigned int count, rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 2; 193 unsigned int count, rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 2;
194 194
195 count = ide_build_dmatable(drive, cmd); 195 count = ide_build_dmatable(drive, cmd);
196 if (count == 0) { 196 if (count == 0)
197 ide_map_sg(drive, cmd);
198 /* try PIO instead of DMA */ 197 /* try PIO instead of DMA */
199 return 1; 198 return 1;
200 } 199
201 outl(hwif->dmatable_dma | rw, hwif->dma_base); 200 outl(hwif->dmatable_dma | rw, hwif->dma_base);
202 drive->waiting_for_dma = 1; 201 drive->waiting_for_dma = 1;
203 /* start DMA */ 202 /* start DMA */
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index f62ced855cf3..7267c46c07cd 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -279,8 +279,6 @@ use_pio_instead:
279 printk(KERN_ERR "%s: %s\n", drive->name, 279 printk(KERN_ERR "%s: %s\n", drive->name,
280 count ? "DMA table too small" : "empty DMA table?"); 280 count ? "DMA table too small" : "empty DMA table?");
281 281
282 ide_destroy_dmatable(drive);
283
284 return 0; /* revert to PIO for this request */ 282 return 0; /* revert to PIO for this request */
285} 283}
286#else 284#else
@@ -294,10 +292,8 @@ static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
294 u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; 292 u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR;
295 293
296 /* fall back to PIO! */ 294 /* fall back to PIO! */
297 if (tx4939ide_build_dmatable(drive, cmd) == 0) { 295 if (tx4939ide_build_dmatable(drive, cmd) == 0)
298 ide_map_sg(drive, cmd);
299 return 1; 296 return 1;
300 }
301 297
302 /* PRD table */ 298 /* PRD table */
303 tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); 299 tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr);