Subject: Re: kern/19435, kern/19919 and BUS_DMA_NOCACHE
To: None <tech-kern@netbsd.org>
From: TAMURA Kent <kent@netbsd.org>
List: tech-kern
Date: 01/27/2003 03:05:05
Thanks for comments.

> > Dhoyashiki-san posted BUS_DMA_NOCACHE patch to solve the problem
> > in kern/19919.  I revised the patch so that all platforms had
> > BUS_DMA_NOCACHE and the bus_dma manpage had the description for
> > it.
> > 
> > Comments?  I'll commit the following on the weekend If no objections.
> 
> bus_dmamem_mmap() should also handle BUS_DMA_NOCACHE or not?
> It's better to mention in what case BUS_DMA_NOCACHE is required/used.

Ok, I added about them.

> >  #define	BUS_DMA_READ		0x100	/* mapping is device -> memory only */
> >  #define	BUS_DMA_WRITE		0x200	/* mapping is memory -> device only */
> > +#define BUS_DMA_NOCACHE		0x400	/* hint: map non-cached memory */
> 
> IMHO, we should not mix #define<space> and #define<tab>
> in the same source.

I'll modify them so.

-- 
TAMURA Kent <kent2003@hauN.org> <kent@netbsd.org>


Index: share/man/man9/bus_dma.9
===================================================================
RCS file: /cvsroot/src/share/man/man9/bus_dma.9,v
retrieving revision 1.25
diff -u -u -r1.25 bus_dma.9
--- share/man/man9/bus_dma.9	2002/10/14 13:43:16	1.25
+++ share/man/man9/bus_dma.9	2003/01/26 18:03:12
@@ -677,6 +677,13 @@
 See the description of the
 .Fn bus_dmamap_load
 function.
+.It Dv BUS_DMA_NOCACHE
+This flag is a
+.Em hint
+to machine-dependent code.
+If possible, map the unchached memory.
+This flag may be useful in the case that the memory cache causes unexpected
+behavior of the device.
 .El
 .El
 .Pp
@@ -741,6 +748,10 @@
 These flags are placeholders, and may be used by busses to provide
 bus-dependent functionality.
 .It Dv BUS_DMA_COHERENT
+See
+.Fn bus_dmamem_map
+above for a description of this flag.
+.It Dv BUS_DMA_NOCACHE
 See
 .Fn bus_dmamem_map
 above for a description of this flag.