Add an untested implementation of bus_dmamap_load_raw(9).
This commit is contained in:
parent
109ec163ae
commit
9115bf9945
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $");
|
||||
|
||||
/*
|
||||
* The following is included because _bus_dma_uiomove is derived from
|
||||
|
@ -716,11 +716,44 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
|
|||
*/
|
||||
static int
|
||||
_bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
|
||||
bus_dma_segment_t *segs, int nsegs,
|
||||
bus_size_t size, int flags)
|
||||
bus_dma_segment_t *segs, int nsegs, bus_size_t size0, int flags)
|
||||
{
|
||||
bus_size_t size;
|
||||
int i, error = 0;
|
||||
|
||||
panic("_bus_dmamap_load_raw: not implemented");
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings."
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
|
||||
|
||||
if (size0 > map->_dm_size)
|
||||
return EINVAL;
|
||||
|
||||
for (i = 0, size = size0; i < nsegs && size > 0; i++) {
|
||||
bus_dma_segment_t *ds = &segs[i];
|
||||
bus_size_t sgsize;
|
||||
|
||||
sgsize = MIN(ds->ds_len, size);
|
||||
if (sgsize == 0)
|
||||
continue;
|
||||
error = _bus_dmamap_load_busaddr(t, map, ds->ds_addr, sgsize);
|
||||
if (error != 0)
|
||||
break;
|
||||
size -= sgsize;
|
||||
}
|
||||
|
||||
if (error != 0) {
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* XXX TBD bounce */
|
||||
|
||||
map->dm_mapsize = size0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue