summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}
/*