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/alpha/common adapt alpha.
details: https://anonhg.NetBSD.org/src/rev/0b46174b9520
branches: yamt-uio_vmspace
changeset: 586716:0b46174b9520
user: yamt <yamt%NetBSD.org@localhost>
date: Sun Feb 05 13:53:39 2006 +0000
description:
adapt alpha.
diffstat:
sys/arch/alpha/common/bus_dma.c | 29 +++++++++++------------------
sys/arch/alpha/common/sgmap_typedep.c | 30 ++++++++++++------------------
2 files changed, 23 insertions(+), 36 deletions(-)
diffs (206 lines):
diff -r 32f53b4e0da5 -r 0b46174b9520 sys/arch/alpha/common/bus_dma.c
--- a/sys/arch/alpha/common/bus_dma.c Sun Feb 05 13:20:21 2006 +0000
+++ b/sys/arch/alpha/common/bus_dma.c Sun Feb 05 13:53:39 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.61 2005/12/11 12:16:16 christos Exp $ */
+/* $NetBSD: bus_dma.c,v 1.61.2.1 2006/02/05 13:53:39 yamt Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.61 2005/12/11 12:16:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.61.2.1 2006/02/05 13:53:39 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,7 +56,7 @@
#include <machine/intr.h>
int _bus_dmamap_load_buffer_direct(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);
extern paddr_t avail_start, avail_end; /* from pmap.c */
@@ -129,7 +129,7 @@
*/
int
_bus_dmamap_load_buffer_direct(bus_dma_tag_t t, bus_dmamap_t map,
- void *buf, size_t buflen, struct proc *p, int flags, paddr_t *lastaddrp,
+ void *buf, size_t buflen, struct vmspace *vm, int flags, paddr_t *lastaddrp,
int *segp, int first)
{
bus_size_t sgsize;
@@ -144,9 +144,8 @@
/*
* Get the physical address for this segment.
*/
- if (p != NULL)
- (void) pmap_extract(p->p_vmspace->vm_map.pmap,
- vaddr, &curaddr);
+ if (!VMSPACE_IS_KERNEL_P(vm))
+ (void) pmap_extract(vm->vm_map.pmap, vaddr, &curaddr);
else
curaddr = vtophys(vaddr);
@@ -236,6 +235,7 @@
{
paddr_t lastaddr;
int seg, error;
+ struct vmspace *vm = p->p_vmspace;
/*
* Make sure that on error condition we return "no valid mappings".
@@ -250,7 +250,7 @@
seg = 0;
error = _bus_dmamap_load_buffer_direct(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;
@@ -363,7 +363,7 @@
paddr_t lastaddr;
int seg, i, error, first;
bus_size_t minlen, resid;
- struct proc *p = NULL;
+ struct vmspace *vm;
struct iovec *iov;
caddr_t addr;
@@ -378,14 +378,7 @@
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_uio_direct: "
- "USERSPACE but no proc");
-#endif
- }
+ vm = uio->uio_vmspace;
first = 1;
seg = 0;
@@ -399,7 +392,7 @@
addr = (caddr_t)iov[i].iov_base;
error = _bus_dmamap_load_buffer_direct(t, map,
- addr, minlen, p, flags, &lastaddr, &seg, first);
+ addr, minlen, vm, flags, &lastaddr, &seg, first);
first = 0;
resid -= minlen;
diff -r 32f53b4e0da5 -r 0b46174b9520 sys/arch/alpha/common/sgmap_typedep.c
--- a/sys/arch/alpha/common/sgmap_typedep.c Sun Feb 05 13:20:21 2006 +0000
+++ b/sys/arch/alpha/common/sgmap_typedep.c Sun Feb 05 13:53:39 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap_typedep.c,v 1.32 2005/12/11 12:16:16 christos Exp $ */
+/* $NetBSD: sgmap_typedep.c,v 1.32.2.1 2006/02/05 13:53:40 yamt Exp $ */
/*-
* Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.32 2005/12/11 12:16:16 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.32.2.1 2006/02/05 13:53:40 yamt Exp $");
#include "opt_ddb.h"
@@ -50,7 +50,7 @@
int __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag_t,
bus_dmamap_t, void *buf, size_t buflen,
- struct proc *, int, int, struct alpha_sgmap *);
+ struct vmspace *, int, int, struct alpha_sgmap *);
void
__C(SGMAP_TYPE,_init_spill_page_pte)(void)
@@ -63,7 +63,7 @@
int
__C(SGMAP_TYPE,_load_buffer)(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
- size_t buflen, struct proc *p, int flags, int seg,
+ size_t buflen, struct vmspace *vm, int flags, int seg,
struct alpha_sgmap *sgmap)
{
vaddr_t endva, va = (vaddr_t)buf;
@@ -168,8 +168,8 @@
for (; va < endva; va += PAGE_SIZE, pteidx++,
pte = &page_table[pteidx * SGMAP_PTE_SPACING]) {
/* Get the physical address for this segment. */
- if (p != NULL)
- (void) pmap_extract(p->p_vmspace->vm_map.pmap, va, &pa);
+ if (!VMSPACE_IS_KERNEL_P(vm))
+ (void) pmap_extract(vm->vm_map.pmap, va, &pa);
else
pa = vtophys(va);
@@ -203,6 +203,7 @@
bus_size_t buflen, struct proc *p, int flags, struct alpha_sgmap *sgmap)
{
int seg, error;
+ struct vmspace *vm = p->p_vmspace;
/*
* Make sure that on error condition we return "no valid mappings".
@@ -220,7 +221,7 @@
map->_dm_flags |= flags & (BUS_DMA_READ|BUS_DMA_WRITE);
seg = 0;
- error = __C(SGMAP_TYPE,_load_buffer)(t, map, buf, buflen, p,
+ error = __C(SGMAP_TYPE,_load_buffer)(t, map, buf, buflen, vm,
flags, seg, sgmap);
alpha_mb();
@@ -278,7 +279,7 @@
if (m->m_len == 0)
continue;
error = __C(SGMAP_TYPE,_load_buffer)(t, map,
- m->m_data, m->m_len, NULL, flags, seg, sgmap);
+ m->m_data, m->m_len, vmspace_kernel(), flags, seg, sgmap);
seg++;
}
@@ -313,7 +314,7 @@
int flags, struct alpha_sgmap *sgmap)
{
bus_size_t minlen, resid;
- struct proc *p = NULL;
+ struct vmspace *vm;
struct iovec *iov;
caddr_t addr;
int i, seg, error;
@@ -333,14 +334,7 @@
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(__S(__C(SGMAP_TYPE,_load_uio))
- ": USERSPACE but no proc");
-#endif
- }
+ vm = uio->uio_vmspace;
seg = 0;
error = 0;
@@ -354,7 +348,7 @@
addr = (caddr_t)iov[i].iov_base;
error = __C(SGMAP_TYPE,_load_buffer)(t, map,
- addr, minlen, p, flags, seg, sgmap);
+ addr, minlen, vm, flags, seg, sgmap);
resid -= minlen;
}
Home |
Main Index |
Thread Index |
Old Index