summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/dev/vmes.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-12-25 21:01:40 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-12-25 21:01:40 +0000
commitc3b04a45928827f106916ea352a0f3934113198e (patch)
treec81c65f6f774f19a48b23e06a6ace9989762feb1 /sys/arch/mvme88k/dev/vmes.c
parentdd1e1635fea390664a952099ef875a12d5357117 (diff)
Provide common D16 vmespace block access functions, instead of vs and vx each
rolling their own. Use them more cleverly in vx, in order to get the driver to at least attach and frob chips. Not tested besides multiuser boot (hence ttyflags -a), and checking cu(1) connects. More testing to come once I remember where I have hidden the 332XT transition module...
Diffstat (limited to 'sys/arch/mvme88k/dev/vmes.c')
-rw-r--r--sys/arch/mvme88k/dev/vmes.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c
index 5a52244f754..2a81cf8c7f9 100644
--- a/sys/arch/mvme88k/dev/vmes.c
+++ b/sys/arch/mvme88k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmes.c,v 1.13 2003/12/19 22:30:18 miod Exp $ */
+/* $OpenBSD: vmes.c,v 1.14 2003/12/25 21:01:39 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -172,3 +172,36 @@ vmesmmap(dev, off, prot)
return (-1);
return (atop(pa));
}
+
+/*
+ * Specific D16 access functions
+ *
+ * D16 cards will trigger bus errors on attempting to read or write more
+ * than 16 bits on the bus. Given how the m88k processor works, this means
+ * basically that all long (D32) accesses must be carefully taken care of.
+ *
+ * Since the kernels bcopy() and bzero() routines will use 32 bit accesses
+ * for performance, here are specific D16-compatible routines. They expect
+ * pointers to be 16-bit aligned.
+ */
+
+void
+d16_bcopy(const void *src, void *dst, size_t len)
+{
+ const u_int16_t *s = (const u_int16_t *)src;
+ u_int16_t *d = (u_int16_t *)dst;
+
+ len >>= 1;
+ while (len-- != 0)
+ *d++ = *s++;
+}
+
+void
+d16_bzero(void *dst, size_t len)
+{
+ u_int16_t *d = (u_int16_t *)dst;
+
+ len >>= 1;
+ while (len-- != 0)
+ *d++ = 0;
+}