diff options
-rw-r--r-- | sys/dev/pci/ubsec.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 6f5cae41cc2..d6161d7718d 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.68 2001/08/25 10:13:30 art Exp $ */ +/* $OpenBSD: ubsec.c,v 1.69 2001/08/26 03:29:54 jason Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -100,6 +100,14 @@ void ubsec_dma_free __P((struct ubsec_softc *, struct ubsec_dma_alloc *)); #define SWAP32(x) (x) = swap32((x)) +#ifdef __HAS_NEW_BUS_DMAMAP_SYNC +#define ubsec_bus_dmamap_sync(t, m, o, l, f) \ + bus_dmamap_sync((t), (m), (o), (l), (f)) +#else +#define ubsec_bus_dmamap_sync(t, m, o, l, f) \ + bus_dmamap_sync((t), (m), (f)) +#endif + int ubsec_probe(parent, match, aux) struct device *parent; @@ -295,13 +303,16 @@ ubsec_intr(arg) while (!SIMPLEQ_EMPTY(&sc->sc_qchip2)) { q2 = SIMPLEQ_FIRST(&sc->sc_qchip2); - bus_dmamap_sync(sc->sc_dmat, q2->q_mcr.dma_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + ubsec_bus_dmamap_sync(sc->sc_dmat, q2->q_mcr.dma_map, + 0, q2->q_mcr.dma_map->dm_mapsize, + BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); mcr = (struct ubsec_mcr *)q2->q_mcr.dma_vaddr; if ((mcr->mcr_flags & UBS_MCR_DONE) == 0) { - bus_dmamap_sync(sc->sc_dmat, q2->q_mcr.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + ubsec_bus_dmamap_sync(sc->sc_dmat, + q2->q_mcr.dma_map, 0, + q2->q_mcr.dma_map->dm_mapsize, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); break; } SIMPLEQ_REMOVE_HEAD(&sc->sc_qchip2, q2, q_next); @@ -1035,8 +1046,9 @@ ubsec_process(crp) bcopy(&ctx, dmap->d_alloc.dma_vaddr + offsetof(struct ubsec_dmachunk, d_ctx), sizeof(struct ubsec_pktctx)); - bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, - BUS_DMASYNC_PREREAD); + ubsec_bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, 0, + dmap->d_alloc.dma_map->dm_mapsize, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); s = splnet(); SIMPLEQ_INSERT_TAIL(&sc->sc_queue, q, q_next); @@ -1072,8 +1084,9 @@ ubsec_callback(sc, q) struct cryptodesc *crd; struct ubsec_dma *dmap = q->q_dma; - bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, - BUS_DMASYNC_POSTREAD); + ubsec_bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, 0, + dmap->d_alloc.dma_map->dm_mapsize, + BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); if ((crp->crp_flags & CRYPTO_F_IMBUF) && (q->q_src_m != q->q_dst_m)) { m_freem(q->q_src_m); @@ -1176,9 +1189,11 @@ ubsec_feed2(sc) break; q = SIMPLEQ_FIRST(&sc->sc_queue2); - bus_dmamap_sync(sc->sc_dmat, q->q_mcr.dma_map, + ubsec_bus_dmamap_sync(sc->sc_dmat, q->q_mcr.dma_map, 0, + q->q_mcr.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, + ubsec_bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, 0, + q->q_ctx.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD); WRITE_REG(sc, BS_MCR2, q->q_mcr.dma_paddr); @@ -1197,7 +1212,8 @@ ubsec_callback2(sc, q) struct ubsec_ctx_keyop *ctx; ctx = (struct ubsec_ctx_keyop *)q->q_ctx.dma_vaddr; - bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, BUS_DMASYNC_POSTREAD); + ubsec_bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, 0, + q->q_ctx.dma_map->dm_mapsize, BUS_DMASYNC_POSTREAD); switch (ctx->ctx_op) { case UBS_CTXOP_RNGBYPASS: { @@ -1205,8 +1221,8 @@ ubsec_callback2(sc, q) u_int32_t *p; int i; - bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, - BUS_DMASYNC_POSTWRITE); + ubsec_bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, 0, + rng->rng_buf.dma_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); p = (u_int32_t *)rng->rng_buf.dma_vaddr; for (i = 0; i < UBSEC_RNG_BUFSIZ; p++, i++) add_true_randomness(*p); @@ -1274,8 +1290,8 @@ ubsec_rng(vsc) ctx->rbp_len = sizeof(struct ubsec_ctx_rngbypass); ctx->rbp_op = UBS_CTXOP_RNGBYPASS; - bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, - BUS_DMASYNC_PREWRITE); + ubsec_bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, 0, + rng->rng_buf.dma_map->dm_mapsize, BUS_DMASYNC_PREWRITE); SIMPLEQ_INSERT_TAIL(&sc->sc_queue2, (struct ubsec_q2 *)rng, q_next); rng->rng_used = 1; |