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 adapt the rest of MD code.
details: https://anonhg.NetBSD.org/src/rev/05e1f1427691
branches: yamt-uio_vmspace
changeset: 586729:05e1f1427691
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Feb 18 14:26:06 2006 +0000
description:
adapt the rest of MD code.
diffstat:
sys/arch/macppc/macppc/bus_dma.c | 36 ++++++++++-----------
sys/arch/mipsco/mipsco/bus_dma.c | 15 +-------
sys/arch/mvme68k/mvme68k/bus_dma.c | 48 +++++++++++----------------
sys/arch/newsmips/newsmips/bus.c | 36 ++++++++++-----------
sys/arch/pmax/include/bus.h | 4 +-
sys/arch/pmax/pmax/bus_dma.c | 51 ++++++++++++++---------------
sys/arch/powerpc/marvell/bus_dma.c | 37 ++++++++++-----------
sys/arch/powerpc/powerpc/bus_dma.c | 36 ++++++++++-----------
sys/arch/powerpc/powerpc/process_machdep.c | 7 +--
sys/arch/sgimips/sgimips/bus.c | 36 ++++++++++-----------
sys/arch/sh5/sh5/bus_dma.c | 34 ++++++++++----------
11 files changed, 155 insertions(+), 185 deletions(-)
diffs (truncated from 1098 to 300 lines):
diff -r dd7028b66fc5 -r 05e1f1427691 sys/arch/macppc/macppc/bus_dma.c
--- a/sys/arch/macppc/macppc/bus_dma.c Sat Feb 18 13:52:58 2006 +0000
+++ b/sys/arch/macppc/macppc/bus_dma.c Sat Feb 18 14:26:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.33 2005/12/11 12:18:06 christos Exp $ */
+/* $NetBSD: bus_dma.c,v 1.33.2.1 2006/02/18 14:26:06 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.33 2005/12/11 12:18:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.33.2.1 2006/02/18 14:26:06 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,7 +55,7 @@
#include <machine/intr.h>
int _bus_dmamap_load_buffer __P((bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int, paddr_t *, int *, int));
+ bus_size_t, struct vmspace *vm, int, paddr_t *, int *, int));
/*
* Common function for DMA map creation. May be called by bus-specific
@@ -129,12 +129,12 @@
* first indicates if this is the first invocation of this function.
*/
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;
@@ -152,8 +152,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, (void *)&curaddr);
else
curaddr = vtophys(vaddr);
@@ -238,6 +238,7 @@
{
paddr_t lastaddr;
int seg, error;
+ struct vmspace *vm;
/*
* Make sure that on error condition we return "no valid mappings".
@@ -249,8 +250,14 @@
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,
+ error = _bus_dmamap_load_buffer(t, map, buf, buflen, vm, flags,
&lastaddr, &seg, 1);
if (error == 0) {
map->dm_mapsize = buflen;
@@ -295,7 +302,7 @@
if (m->m_len == 0)
continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
- NULL, flags, &lastaddr, &seg, first);
+ vmspace_kernel(), flags, &lastaddr, &seg, first);
first = 0;
}
if (error == 0) {
@@ -318,7 +325,6 @@
paddr_t lastaddr;
int seg, i, error, first;
bus_size_t minlen, resid;
- struct proc *p = NULL;
struct iovec *iov;
caddr_t addr;
@@ -332,14 +338,6 @@
resid = uio->uio_resid;
iov = uio->uio_iov;
- if (uio->uio_segflg == UIO_USERSPACE) {
- p = uio->uio_lwp ? uio->uio_lwp->l_proc : NULL;
-#ifdef DIAGNOSTIC
- if (p == NULL)
- panic("_bus_dmamap_load_uio: USERSPACE but no proc");
-#endif
- }
-
first = 1;
seg = 0;
error = 0;
@@ -352,7 +350,7 @@
addr = (caddr_t)iov[i].iov_base;
error = _bus_dmamap_load_buffer(t, map, addr, minlen,
- p, flags, &lastaddr, &seg, first);
+ uio->uio_vmspace, flags, &lastaddr, &seg, first);
first = 0;
resid -= minlen;
diff -r dd7028b66fc5 -r 05e1f1427691 sys/arch/mipsco/mipsco/bus_dma.c
--- a/sys/arch/mipsco/mipsco/bus_dma.c Sat Feb 18 13:52:58 2006 +0000
+++ b/sys/arch/mipsco/mipsco/bus_dma.c Sat Feb 18 14:26:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.18 2005/12/11 12:18:13 christos Exp $ */
+/* $NetBSD: bus_dma.c,v 1.18.2.1 2006/02/18 14:26:06 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 2005/12/11 12:18:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.18.2.1 2006/02/18 14:26:06 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -350,7 +350,6 @@
paddr_t lastaddr;
int seg, i, error, first;
bus_size_t minlen, resid;
- struct proc *p = NULL;
struct iovec *iov;
caddr_t addr;
@@ -364,14 +363,6 @@
resid = uio->uio_resid;
iov = uio->uio_iov;
- if (uio->uio_segflg == UIO_USERSPACE) {
- p = uio->uio_lwp ? uio->uio_lwp->l_proc : NULL;
-#ifdef DIAGNOSTIC
- if (p == NULL)
- panic("_bus_dmamap_load_uio: USERSPACE but no proc");
-#endif
- }
-
first = 1;
seg = 0;
error = 0;
@@ -384,7 +375,7 @@
addr = (caddr_t)iov[i].iov_base;
error = _bus_dmamap_load_buffer(t, map, addr, minlen,
- p, flags, &lastaddr, &seg, first);
+ uio->uio_vmspace, flags, &lastaddr, &seg, first);
first = 0;
resid -= minlen;
diff -r dd7028b66fc5 -r 05e1f1427691 sys/arch/mvme68k/mvme68k/bus_dma.c
--- a/sys/arch/mvme68k/mvme68k/bus_dma.c Sat Feb 18 13:52:58 2006 +0000
+++ b/sys/arch/mvme68k/mvme68k/bus_dma.c Sat Feb 18 14:26:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.30 2005/12/11 12:18:17 christos Exp $ */
+/* $NetBSD: bus_dma.c,v 1.30.2.1 2006/02/18 14:26:06 yamt Exp $ */
/*
* This file was taken from from next68k/dev/bus_dma.c, which was originally
@@ -46,7 +46,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.30 2005/12/11 12:18:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.30.2.1 2006/02/18 14:26:06 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,7 +68,7 @@
extern phys_ram_seg_t mem_clusters[];
int _bus_dmamap_load_buffer_direct_common __P((bus_dma_tag_t,
- bus_dmamap_t, void *, bus_size_t, struct proc *, int,
+ bus_dmamap_t, void *, bus_size_t, struct vmspace *, int,
paddr_t *, int *, int));
/*
@@ -142,13 +142,13 @@
* first indicates if this is the first invocation of this function.
*/
int
-_bus_dmamap_load_buffer_direct_common(t, map, buf, buflen, p, flags,
+_bus_dmamap_load_buffer_direct_common(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;
@@ -166,17 +166,9 @@
/*
* Get the physical address for this segment.
*/
- if (p != NULL) {
- (void) pmap_extract(p->p_vmspace->vm_map.pmap,
- vaddr, &curaddr);
- cacheable =
- _pmap_page_is_cacheable(p->p_vmspace->vm_map.pmap,
- vaddr);
- } else {
- (void) pmap_extract(pmap_kernel(),vaddr, &curaddr);
- cacheable =
- _pmap_page_is_cacheable(pmap_kernel(), vaddr);
- }
+ (void) pmap_extract(vm_map_pmap(&vm->vm_map), vaddr, &curaddr);
+ cacheable = _pmap_page_is_cacheable(vm_map_pmap(&vm->vm_map),
+ vaddr);
if (cacheable)
coherent = 0;
@@ -268,6 +260,7 @@
{
paddr_t lastaddr;
int seg, error;
+ struct vmspace *vm;
/*
* Make sure that on error condition we return "no valid mappings".
@@ -279,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_direct_common(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;
@@ -325,7 +324,8 @@
if (m->m_len == 0)
continue;
error = _bus_dmamap_load_buffer_direct_common(t, map,
- m->m_data, m->m_len, NULL, flags, &lastaddr, &seg, first);
+ m->m_data, m->m_len, vmspace_kernel(), flags, &lastaddr,
+ &seg, first);
first = 0;
}
if (error == 0) {
@@ -348,7 +348,6 @@
paddr_t lastaddr;
int seg, i, error, first;
bus_size_t minlen, resid;
- struct proc *p = NULL;
struct iovec *iov;
caddr_t addr;
@@ -362,14 +361,6 @@
resid = uio->uio_resid;
iov = uio->uio_iov;
- if (uio->uio_segflg == UIO_USERSPACE) {
- p = uio->uio_lwp->l_proc;
-#ifdef DIAGNOSTIC
- if (p == NULL)
- panic("_bus_dmamap_load_direct_common: USERSPACE but no proc");
-#endif
- }
-
first = 1;
seg = 0;
error = 0;
@@ -382,7 +373,8 @@
addr = (caddr_t)iov[i].iov_base;
error = _bus_dmamap_load_buffer_direct_common(t, map,
- addr, minlen, p, flags, &lastaddr, &seg, first);
+ addr, minlen, uio->uio_vmspace, flags, &lastaddr, &seg,
+ first);
first = 0;
resid -= minlen;
Home |
Main Index |
Thread Index |
Old Index