> Date: Mon, 3 Dec 2012 17:49:49 +0100
> From: Martin Pieuchot <[email protected]>
> 
> On 28/11/12(Wed) 16:49, Mark Kettenis wrote:
> > > Date: Tue, 27 Nov 2012 15:02:31 +0100
> > > From: Martin Pieuchot <[email protected]>
> > > 
> > > While working on drm support for macppc that makes use of non-cached
> > > memory I found that some platforms (amd64, i386, powerpc) use the MD
> > > PMAP_NOCACHE flag where others (sparc, sparc64, solbourne) use PMAP_NC
> > > for the same purpose.
> > > 
> > > Because I'd like to use this flag in the drm code and for coherency
> > > the diff below rename PMAP_NOCACHE into PMAP_NC.
> > > 
> > > Tested on macppc and amd64, ok?
> > 
> > Hi Martin,
> > 
> > These flags are not really supposed to be used in MI code.  So I don't
> > think the drm and agp code should use these flags, at least not
> > directly.  Fortunately doing so isn't really necessary, at least for
> > the agp stuff.  There we can do something like:
> 
> Following your suggestion, here's a diff that implements the
> BUS_DMA_NOCACHE flag for bus_dmamem_mmap(9) on macppc. Ok?

ok kettenis@

> Martin
> 
> Index: macppc/dma.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/macppc/macppc/dma.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 dma.c
> --- macppc/dma.c      30 Aug 2012 18:14:26 -0000      1.36
> +++ macppc/dma.c      3 Dec 2012 11:56:09 -0000
> @@ -522,7 +522,10 @@ paddr_t
>  _dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
>      int prot, int flags)
>  {
> -     int i;
> +     int i, pmapflags = 0;
> +
> +     if (flags & BUS_DMA_NOCACHE)
> +             pmapflags |= PMAP_NOCACHE;
>  
>       for (i = 0; i < nsegs; i++) {
>  #ifdef DIAGNOSTIC
> @@ -539,7 +542,7 @@ _dmamem_mmap(bus_dma_tag_t t, bus_dma_se
>                       continue;
>               }
>  
> -             return (segs[i].ds_addr + off);
> +             return ((segs[i].ds_addr + off) | pmapflags);
>       }
>  
>       /* Page not found. */

Reply via email to