summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-09-15 01:40:37 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-09-15 01:40:37 +0000
commit1ab8e9fbb4b6d11a0dee60e7a977fb3d2b3496d6 (patch)
tree0cd7cb24db6a7d7693d083e5e2e0ba4e4c42f635 /sys
parentef58acd8c960ee079ddf4957bda2fd5b58617785 (diff)
implement _bus_dmamap_load_raw; drahn@ ok
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/macppc/dma.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c
index ef8c1a3291c..68acbec18f1 100644
--- a/sys/arch/macppc/macppc/dma.c
+++ b/sys/arch/macppc/macppc/dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma.c,v 1.1 2001/09/01 15:44:20 drahn Exp $ */
+/* $OpenBSD: dma.c,v 1.2 2001/09/15 01:40:36 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -260,8 +260,28 @@ _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);
}
/*