Re: [PATCH 14/15] ide: rework the code for selecting the best DMAtransfer mode

From: Sergei Shtylyov
Date: Thu Apr 19 2007 - 15:46:24 EST


Hello, I wrote:
Bartlomiej Zolnierkiewicz wrote:

[PATCH] ide: rework the code for selecting the best DMA transfer mode

Depends on the "ide: fix UDMA/MWDMA/SWDMA masks" patch.

I'm now trying to rewrite hpt366.c to benefit more from these patches...
and alas, this very patch seems to be breaking filtering (at least) in this driver. :-]

Index: b/drivers/ide/ide-dma.c
===================================================================
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -705,6 +705,80 @@ int ide_use_dma(ide_drive_t *drive)
EXPORT_SYMBOL_GPL(ide_use_dma);
+static const u8 xfer_mode_bases[] = {
+ XFER_UDMA_0,
+ XFER_MW_DMA_0,
+ XFER_SW_DMA_0,
+};
+
+static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base)
+{
+ struct hd_driveid *id = drive->id;
+ ide_hwif_t *hwif = drive->hwif;
+ unsigned int mask = 0;
+
+ switch(base) {
+ case XFER_UDMA_0:
+ if ((id->field_valid & 4) == 0)
+ break;
+
+ mask = id->dma_ultra & hwif->ultra_mask;
+
+ if (hwif->udma_filter)
+ mask &= hwif->udma_filter(drive);
+
+ if ((mask & 0x78) && (eighty_ninty_three(drive) == 0))
+ mask &= 0x07;


Note the subtle difference between the old and new behavior: the old driver code was applying UltraDMA filter *after*
the cable type limit, and the new code does it *before*.

Was there any particular reason to change that order?

Ah, I see. Cable-reduced mask can't be passed back to driver's filter. This needs changing.

MBR, Sergei
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/