rework to use bus_dmamem_map() then bus_dmamem_load(), rather than

bus_dmamem_load_raw() then bus_dmamem_map().

tested on SS2 and SS5 and sbus cards.
This commit is contained in:
mrg 2000-10-20 05:57:50 +00:00
parent 43478aaefa
commit 3af567c485
2 changed files with 22 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.14 2000/07/09 20:57:42 pk Exp $ */
/* $NetBSD: if_le.c,v 1.15 2000/10/20 05:57:50 mrg Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -245,27 +245,26 @@ leattach_sbus(parent, self, aux)
return;
}
/* Load DMA buffer */
if ((error = bus_dmamap_load_raw(dmatag, lesc->sc_dmamap,
&seg, rseg,
MEMSIZE, BUS_DMA_NOWAIT)) != 0) {
printf("%s: DMA buffer map load error %d\n",
self->dv_xname, error);
bus_dmamem_free(dmatag, &seg, rseg);
return;
}
/* Map DMA buffer into kernel space */
if ((error = bus_dmamem_map(dmatag, &seg, rseg, MEMSIZE,
(caddr_t *)&sc->sc_mem,
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
printf("%s: DMA buffer map error %d\n",
self->dv_xname, error);
bus_dmamap_unload(dmatag, lesc->sc_dmamap);
bus_dmamem_free(lesc->sc_dmatag, &seg, rseg);
return;
}
/* Load DMA buffer */
if ((error = bus_dmamap_load(dmatag, lesc->sc_dmamap, sc->sc_mem,
MEMSIZE, NULL, BUS_DMA_NOWAIT)) != 0) {
printf("%s: DMA buffer map load error %d\n",
self->dv_xname, error);
bus_dmamem_free(dmatag, &seg, rseg);
bus_dmamem_unmap(dmatag, sc->sc_mem, MEMSIZE);
return;
}
sc->sc_addr = lesc->sc_dmamap->dm_segs[0].ds_addr & 0xffffff;
sc->sc_memsize = MEMSIZE;
sc->sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le_ledma.c,v 1.11 2000/07/09 20:57:43 pk Exp $ */
/* $NetBSD: if_le_ledma.c,v 1.12 2000/10/20 05:57:50 mrg Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -390,26 +390,26 @@ leattach_ledma(parent, self, aux)
return;
}
/* Load DMA buffer */
if ((error = bus_dmamap_load_raw(dmatag, lesc->sc_dmamap,
&seg, rseg, MEMSIZE, BUS_DMA_NOWAIT)) != 0) {
printf("%s: DMA buffer map load error %d\n",
self->dv_xname, error);
bus_dmamem_free(dmatag, &seg, rseg);
return;
}
/* Map DMA buffer into kernel space */
if ((error = bus_dmamem_map(dmatag, &seg, rseg, MEMSIZE,
(caddr_t *)&sc->sc_mem,
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
printf("%s @ ledma: DMA buffer map error %d\n",
self->dv_xname, error);
bus_dmamap_unload(dmatag, lesc->sc_dmamap);
bus_dmamem_free(dmatag, &seg, rseg);
return;
}
/* Load DMA buffer */
if ((error = bus_dmamap_load(dmatag, lesc->sc_dmamap, sc->sc_mem,
MEMSIZE, NULL, BUS_DMA_NOWAIT)) != 0) {
printf("%s: DMA buffer map load error %d\n",
self->dv_xname, error);
bus_dmamem_free(dmatag, &seg, rseg);
bus_dmamem_unmap(dmatag, sc->sc_mem, MEMSIZE);
return;
}
lesc->sc_laddr = lesc->sc_dmamap->dm_segs[0].ds_addr;
sc->sc_addr = lesc->sc_laddr & 0xffffff;
sc->sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON;