Source-Changes-HG archive

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

[src/yamt-uio_vmspace]: src/sys/arch/mipsco/mipsco adapt _bus_dmamap_load_buf...



details:   https://anonhg.NetBSD.org/src/rev/76772a2d6f0e
branches:  yamt-uio_vmspace
changeset: 586745:76772a2d6f0e
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sun Feb 19 00:00:51 2006 +0000

description:
adapt _bus_dmamap_load_buffer.

diffstat:

 sys/arch/mipsco/mipsco/bus_dma.c |  27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diffs (89 lines):

diff -r bf58d36f86f8 -r 76772a2d6f0e sys/arch/mipsco/mipsco/bus_dma.c
--- a/sys/arch/mipsco/mipsco/bus_dma.c  Sat Feb 18 23:52:06 2006 +0000
+++ b/sys/arch/mipsco/mipsco/bus_dma.c  Sun Feb 19 00:00:51 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.18.2.1 2006/02/18 14:26:06 yamt Exp $    */
+/*     $NetBSD: bus_dma.c,v 1.18.2.2 2006/02/19 00:00:51 yamt Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.18.2.1 2006/02/18 14:26:06 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.18.2.2 2006/02/19 00:00:51 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,7 +56,7 @@
 paddr_t        kvtophys __P((vaddr_t));        /* XXX */
 
 static int     _bus_dmamap_load_buffer __P((bus_dma_tag_t, bus_dmamap_t,
-                   void *, bus_size_t, struct proc *, int, paddr_t *,
+                   void *, bus_size_t, struct vmspace *, int, paddr_t *,
                    int *, int));
 
 extern paddr_t avail_start, avail_end; /* from pmap.c */
@@ -153,12 +153,12 @@
  * first indicates if this is the first invocation of this function.
  */
 static int
-_bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
+_bus_dmamap_load_buffer(t, map, buf, buflen, vm, flags, lastaddrp, segp, first)
        bus_dma_tag_t t;
        bus_dmamap_t map;
        void *buf;
        bus_size_t buflen;
-       struct proc *p;
+       struct vmspace *vm;
        int flags;
        paddr_t *lastaddrp;
        int *segp;
@@ -177,8 +177,8 @@
                /*
                 * Get the physical address for this segment.
                 */
-               if (p != NULL) {
-                       (void) pmap_extract(p->p_vmspace->vm_map.pmap,
+               if (!VMSPACE_IS_KERNEL_P(vm))
+                       (void) pmap_extract(vm_map_pmap(&vm->vm_map),
                            vaddr, &curaddr);
                } else
                        curaddr = kvtophys(vaddr);
@@ -260,6 +260,7 @@
 {
        paddr_t lastaddr;
        int seg, error;
+       struct vmspace *vm;
 
        /*
         * Make sure that on error condition we return "no valid mappings".
@@ -271,9 +272,15 @@
        if (buflen > map->_dm_size)
                return (EINVAL);
 
+       if (p != NULL) {
+               vm = p->p_vmspace;
+       } else {
+               vm = vmspace_kernel();
+       }
+
        seg = 0;
        error = _bus_dmamap_load_buffer(t, map, buf, buflen,
-           p, flags, &lastaddr, &seg, 1);
+           vm, flags, &lastaddr, &seg, 1);
        if (error == 0) {
                map->dm_mapsize = buflen;
                map->dm_nsegs = seg + 1;
@@ -326,8 +333,8 @@
        for (m = m0; m != NULL && error == 0; m = m->m_next) {
                if (m->m_len == 0)
                        continue;
-               error = _bus_dmamap_load_buffer(t, map,
-                   m->m_data, m->m_len, NULL, flags, &lastaddr, &seg, first);
+               error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
+                   vmspace_kernel(), flags, &lastaddr, &seg, first);
                first = 0;
        }
        if (error == 0) {



Home | Main Index | Thread Index | Old Index