summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-10-04 21:20:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-10-04 21:20:13 +0000
commitfa01df2e5de645dd9ccbe94769c61fed89db968e (patch)
treefea1bfcaca831404c9eb43cd636899349faca818 /sys/arch
parent1691144b95e117ff4cd9cc4c8a1c03e81aab2516 (diff)
copy of macppc's bus_dmamap_load_raw() implementatio; not used on i386 yet
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/machdep.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index a8883be79e4..3e05c52936d 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.176 2001/09/19 20:50:56 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.177 2001/10/04 21:20:12 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2965,8 +2965,28 @@ _bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
bus_size_t size;
int flags;
{
+ if (nsegs > map->_dm_segcnt || size > map->_dm_size)
+ return (EINVAL);
- panic("_bus_dmamap_load_raw: not implemented");
+ /*
+ * Make sure we don't cross any boundaries.
+ */
+ if (map->_dm_boundary) {
+ bus_addr_t bmask = ~(map->_dm_boundary - 1);
+ int i;
+
+ for (i = 0; i < nsegs; i++) {
+ if (segs[i].ds_len > map->_dm_maxsegsz)
+ return (EINVAL);
+ if ((segs[i].ds_addr & bmask) !=
+ ((segs[i].ds_addr + segs[i].ds_len - 1) & bmask))
+ return (EINVAL);
+ }
+ }
+
+ bcopy(segs, map->dm_segs, nsegs * sizeof(*segs));
+ map->dm_nsegs = nsegs;
+ return (0);
}
/*