diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 7ee013ad7717..ad5f22921c34 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.249 1997/08/26 18:56:40 fvdl Exp $ */ +/* $NetBSD: machdep.c,v 1.250 1997/09/05 01:44:42 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -2437,8 +2437,28 @@ _bus_dmamem_mmap(t, segs, nsegs, off, prot, flags) bus_dma_segment_t *segs; int nsegs, off, prot, flags; { + int i; - panic("_bus_dmamem_mmap: not implemented"); + for (i = 0; i < nsegs; i++) { +#ifdef DIAGNOSTIC + if (off & PGOFSET) + panic("_bus_dmamem_mmap: offset unaligned"); + if (segs[i].ds_addr & PGOFSET) + panic("_bus_dmamem_mmap: segment unaligned"); + if (segs[i].ds_len & PGOFSET) + panic("_bus_dmamem_mmap: segment size not multiple" + " of page size"); +#endif + if (off >= segs[i].ds_len) { + off -= segs[i].ds_len; + continue; + } + + return (i386_btop((caddr_t)segs[i].ds_addr + off)); + } + + /* Page not found. */ + return (-1); } /**********************************************************************