Implement bus_dmamem_mmap().

This commit is contained in:
thorpej 1997-09-05 01:44:42 +00:00
parent aa1ae54b08
commit dc50e810ea
1 changed files with 22 additions and 2 deletions

View File

@ -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. * 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; bus_dma_segment_t *segs;
int nsegs, off, prot, flags; 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);
} }
/********************************************************************** /**********************************************************************