Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax Add routines to copy to/from a user process fro...
details: https://anonhg.NetBSD.org/src/rev/58e3a65281ec
branches: trunk
changeset: 477584:58e3a65281ec
user: ragge <ragge%NetBSD.org@localhost>
date: Fri Oct 22 21:10:12 1999 +0000
description:
Add routines to copy to/from a user process from/to the vsbus DMA area.
diffstat:
sys/arch/vax/include/vsbus.h | 4 +-
sys/arch/vax/vsa/vsbus.c | 72 ++++++++++++++++++++++++++++++++++++++-----
2 files changed, 66 insertions(+), 10 deletions(-)
diffs (111 lines):
diff -r 91b763b377f0 -r 58e3a65281ec sys/arch/vax/include/vsbus.h
--- a/sys/arch/vax/include/vsbus.h Fri Oct 22 20:59:08 1999 +0000
+++ b/sys/arch/vax/include/vsbus.h Fri Oct 22 21:10:12 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vsbus.h,v 1.8 1999/04/14 23:14:46 ragge Exp $ */
+/* $NetBSD: vsbus.h,v 1.9 1999/10/22 21:10:13 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -72,4 +72,6 @@
u_char vsbus_setmask __P((unsigned char));
void vsbus_clrintr __P((unsigned char));
+void vsbus_copytoproc(struct proc *, caddr_t, caddr_t, int);
+void vsbus_copyfromproc(struct proc *, caddr_t, caddr_t, int);
#endif /* _VAX_VSBUS_H_ */
diff -r 91b763b377f0 -r 58e3a65281ec sys/arch/vax/vsa/vsbus.c
--- a/sys/arch/vax/vsa/vsbus.c Fri Oct 22 20:59:08 1999 +0000
+++ b/sys/arch/vax/vsa/vsbus.c Fri Oct 22 21:10:12 1999 +0000
@@ -1,6 +1,6 @@
-/* $NetBSD: vsbus.c,v 1.19 1999/08/27 17:45:57 ragge Exp $ */
+/* $NetBSD: vsbus.c,v 1.20 1999/10/22 21:10:12 ragge Exp $ */
/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
+ * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* This code is derived from software contributed to Ludd by Bertram Barth.
@@ -47,6 +47,8 @@
#include <sys/syslog.h>
#include <sys/stat.h>
+#include <vm/vm.h>
+
#define _VAX_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/pte.h>
@@ -261,14 +263,66 @@
*sc->sc_intclr = mask;
}
-#ifdef notyet
/*
- * Allocate/free DMA pages and other bus resources.
- * VS2000: All DMA and register access must be exclusive.
- * VS3100: DMA area may be accessed by anyone anytime.
- * MFM/SCSI: Don't touch reg's while DMA is active.
- * SCSI/SCSI: Legal to touch any register anytime.
+ * Copy data from/to a user process' space from the DMA area.
+ * Use the physical memory directly.
*/
+void
+vsbus_copytoproc(p, from, to, len)
+ struct proc *p;
+ caddr_t from, to;
+ int len;
+{
+ struct pte *pte;
+ paddr_t pa;
+ pte = uvtopte(TRUNC_PAGE(to), (&p->p_addr->u_pcb));
+ if ((vaddr_t)to & PGOFSET) {
+ int cz = ROUND_PAGE(to) - (vaddr_t)to;
+
+ pa = (pte->pg_pfn << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE;
+ bcopy(from, (caddr_t)pa, min(cz, len));
+ from += cz;
+ to += cz;
+ len -= cz;
+ pte += 8; /* XXX */
+ }
+ while (len > 0) {
+ pa = (pte->pg_pfn << VAX_PGSHIFT) | KERNBASE;
+ bcopy(from, (caddr_t)pa, min(NBPG, len));
+ from += NBPG;
+ to += NBPG;
+ len -= NBPG;
+ pte += 8; /* XXX */
+ }
+}
-#endif
+void
+vsbus_copyfromproc(p, from, to, len)
+ struct proc *p;
+ caddr_t from, to;
+ int len;
+{
+ struct pte *pte;
+ paddr_t pa;
+
+ pte = uvtopte(TRUNC_PAGE(from), (&p->p_addr->u_pcb));
+ if ((vaddr_t)from & PGOFSET) {
+ int cz = ROUND_PAGE(from) - (vaddr_t)from;
+
+ pa = (pte->pg_pfn << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE;
+ bcopy((caddr_t)pa, to, min(cz, len));
+ from += cz;
+ to += cz;
+ len -= cz;
+ pte += 8; /* XXX */
+ }
+ while (len > 0) {
+ pa = (pte->pg_pfn << VAX_PGSHIFT) | KERNBASE;
+ bcopy((caddr_t)pa, to, min(NBPG, len));
+ from += NBPG;
+ to += NBPG;
+ len -= NBPG;
+ pte += 8; /* XXX */
+ }
+}
Home |
Main Index |
Thread Index |
Old Index