Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/yamt-km]: src/sys/arch/sun68k/sun68k use new apis.



details:   https://anonhg.NetBSD.org/src/rev/bf849d429934
branches:  yamt-km
changeset: 573333:bf849d429934
user:      yamt <yamt%NetBSD.org@localhost>
date:      Fri Feb 11 14:24:47 2005 +0000

description:
use new apis.
desupport "skew" of _bus_dma_valloc_skewed for now,
as it doesn't seem to be used.

diffstat:

 sys/arch/sun68k/sun68k/bus.c |  37 ++++++++++++-------------------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diffs (93 lines):

diff -r 2785bfbc7367 -r bf849d429934 sys/arch/sun68k/sun68k/bus.c
--- a/sys/arch/sun68k/sun68k/bus.c      Fri Feb 11 14:03:32 2005 +0000
+++ b/sys/arch/sun68k/sun68k/bus.c      Fri Feb 11 14:24:47 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.c,v 1.12 2005/01/22 15:36:12 chs Exp $     */
+/*     $NetBSD: bus.c,v 1.12.2.1 2005/02/11 14:24:47 yamt Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -160,7 +160,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.12 2005/01/22 15:36:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.12.2.1 2005/02/11 14:24:47 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -331,7 +331,7 @@
 
        size = m68k_round_page(size);
 
-       va = uvm_km_valloc(kernel_map, size);
+       va = uvm_km_alloc(kernel_map, size, 0, UVM_KMF_VAONLY);
        if (va == 0)
                return (ENOMEM);
 
@@ -393,8 +393,7 @@
 vaddr_t 
 _bus_dma_valloc_skewed(size_t size, u_long boundary, u_long align, u_long skew)
 {
-       size_t oversize;
-       vaddr_t va, sva;
+       vaddr_t va;
 
        /*
         * Find a region of kernel virtual addresses that is aligned
@@ -422,31 +421,16 @@
 #endif
 
        /* XXX - Implement this! */
-       if (boundary)
+       if (boundary || skew)
                panic("_bus_dma_valloc_skewed: not implemented");
 
        /*
         * First, find a region large enough to contain any aligned chunk
         */
-       oversize = size + align - PAGE_SIZE;
-       sva = uvm_km_valloc(kernel_map, oversize);
-       if (sva == 0)
+       va = uvm_km_alloc(kernel_map, size, align, UVM_KMF_VAONLY);
+       if (va == 0)
                return (ENOMEM);
 
-       /*
-        * Compute start of aligned region
-        */
-       va = sva;
-       va += (skew + align - va) & (align - 1);
-
-       /*
-        * Return excess virtual addresses
-        */
-       if (va != sva)
-               (void)uvm_unmap(kernel_map, sva, va);
-       if (va + size != sva + oversize)
-               (void)uvm_unmap(kernel_map, va + size, sva + oversize);
-
        return (va);
 }
 
@@ -617,7 +601,8 @@
        if (vaddr)
                v = vaddr;
        else
-               v = uvm_km_valloc_wait(kernel_map, size);
+               v = uvm_km_alloc(kernel_map, size, 0,
+                   UVM_KMF_VAONLY | UVM_KMF_WAITVA);
        if (v == 0)
                panic("sun68k_bus_map: no memory");
 
@@ -663,7 +648,9 @@
        if (va >= SUN_MONSTART && va < SUN_MONEND)
                return (0);
 
-       uvm_km_free_wakeup(kernel_map, va, size);
+       pmap_remove(pmap_kernel(), va, va + size);
+       pmap_update(pmap_kernel());
+       uvm_km_free(kernel_map, va, size, UVM_KMF_VAONLY);
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index