Linus,
Here's a patch for 2.3.40pre4 for avoiding bounce buffers when possible
when using DMA in parport_pc.
Tim.
*/
Index: linux/drivers/parport/parport_pc.c
diff -u linux/drivers/parport/parport_pc.c:1.1.1.12 linux/drivers/parport/parport_pc.c:1.19
--- linux/drivers/parport/parport_pc.c:1.1.1.12 Tue Jan 18 11:16:06 2000
+++ linux/drivers/parport/parport_pc.c Tue Jan 18 13:23:03 2000
@@ -549,9 +549,19 @@
{
int ret = 0;
unsigned long dmaflag;
- size_t left = length;
+ size_t left = length;
const struct parport_pc_private *priv = port->physport->private_data;
+ unsigned long dma_addr;
+ size_t maxlen = 0x10000; /* max 64k per DMA transfer */
+ /* above 16 MB we use a bounce buffer as ISA-DMA is not possible */
+ if (buf+length <= MAX_DMA_ADDRESS)
+ dma_addr = virt_to_bus(buf);
+ else {
+ dma_addr = virt_to_bus(priv->dma_buf);
+ maxlen = PAGE_SIZE; /* sizeof(priv->dma_buf) */
+ }
+
port = port->physport;
/* We don't want to be interrupted every character. */
@@ -566,16 +576,17 @@
size_t count = left;
- if (count > PAGE_SIZE)
- count = PAGE_SIZE;
+ if (count > maxlen)
+ count = maxlen;
- memcpy(priv->dma_buf, buf, count);
+ if (maxlen == PAGE_SIZE) /* bounce buffer ! */
+ memcpy(priv->dma_buf, buf, count);
dmaflag = claim_dma_lock();
disable_dma(port->dma);
clear_dma_ff(port->dma);
set_dma_mode(port->dma, DMA_MODE_WRITE);
- set_dma_addr(port->dma, virt_to_bus((volatile char *) priv->dma_buf));
+ set_dma_addr(port->dma, dma_addr);
set_dma_count(port->dma, count);
/* Set DMA mode */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:17 EST