lkml.org 
[lkml]   [2000]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] 2.3.39: Don't use bounce buffer when not needed (parport)
On Tue, 18 Jan 2000, Alan Cox wrote:

> > + 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) */
> > + }
>
> You are missing a test here. You also have to check if the start and
> end of the block are in the same 64K range (the PC DMA controller
> doesnt increment the top byte on a wrap)

Does it look any better with this applied on top?

Tim.
*/

Index: drivers/parport/parport_pc.c
===================================================================
RCS file: /usr/local/src/cvsroot/linux/drivers/parport/parport_pc.c,v
retrieving revision 1.19
diff -d -u -r1.19 parport_pc.c
--- drivers/parport/parport_pc.c 2000/01/18 13:23:03 1.19
+++ drivers/parport/parport_pc.c 2000/01/20 15:55:56
@@ -552,12 +552,16 @@
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 */
+ size_t maxlen = 1<<16; /* 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)
+ if (buf+length <= MAX_DMA_ADDRESS) {
+ /* If it would cross a 64k boundary, cap it at the end. */
+ if ((buf & ~((1<<16) - 1)) != ((buf+length) & ~((1<<16) - 1)))
+ maxlen = ((1<<16) - 1) & ~buf;
+
dma_addr = virt_to_bus(buf);
- else {
+ } else {
dma_addr = virt_to_bus(priv->dma_buf);
maxlen = PAGE_SIZE; /* sizeof(priv->dma_buf) */
}

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site