summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-06-26 11:50:40 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-06-26 11:50:40 +0000
commit2dc89f8858edcc5ae59db7c35f4d39903358fb83 (patch)
tree5aef3d9e891d6d778ab76673dc0cfb32bea5c458 /sys
parenteef0ba636319118d8f828b471ca647080ea75369 (diff)
There is no excuse for using dma_alloc(9) when a bus_dma_tag_t is available.
deraadt@ thinks this isn't worth it, but reyk@ and mlarkin@ tested it anyway
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_de.c20
-rw-r--r--sys/dev/pci/if_devar.h4
2 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c
index af660e2d4d2..2c3129264b9 100644
--- a/sys/dev/pci/if_de.c
+++ b/sys/dev/pci/if_de.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_de.c,v 1.122 2015/06/25 18:35:48 deraadt Exp $ */
+/* $OpenBSD: if_de.c,v 1.123 2015/06/26 11:50:39 kettenis Exp $ */
/* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */
/*-
@@ -4085,7 +4085,8 @@ tulip_txput_setup(tulip_softc_t * const sc)
sc->tulip_if.if_start = tulip_ifstart;
return;
}
- bcopy(sc->tulip_setupdata, sc->tulip_setupdma, sizeof(sc->tulip_setupdata));
+ bcopy(sc->tulip_setupdata, sc->tulip_setupbuf,
+ sizeof(sc->tulip_setupdata));
/*
* Clear WANTSETUP and set DOINGSETUP. Set know that WANTSETUP is
* set and DOINGSETUP is clear doing an XOR of the two will DTRT.
@@ -4356,19 +4357,12 @@ tulip_busdma_init(tulip_softc_t * const sc)
{
int error = 0;
- sc->tulip_setupdma = dma_alloc(sizeof(sc->tulip_setupdata), PR_WAITOK);
-
/*
- * Allocate dmamap for setup descriptor
+ * Allocate space and dmamap for setup descriptor
*/
- error = bus_dmamap_create(sc->tulip_dmatag, TULIP_SETUP, 2,
- TULIP_SETUP, 0, BUS_DMA_NOWAIT, &sc->tulip_setupmap);
- if (error == 0) {
- error = bus_dmamap_load(sc->tulip_dmatag, sc->tulip_setupmap,
- sc->tulip_setupdma, TULIP_SETUP, NULL, BUS_DMA_NOWAIT);
- if (error)
- bus_dmamap_destroy(sc->tulip_dmatag, sc->tulip_setupmap);
- }
+ error = tulip_busdma_allocmem(sc, sizeof(sc->tulip_setupdata),
+ &sc->tulip_setupmap, &sc->tulip_setupbuf);
+
/*
* Allocate space and dmamap for transmit ring
*/
diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h
index e1e1cd8d7ec..e6c150cbbf6 100644
--- a/sys/dev/pci/if_devar.h
+++ b/sys/dev/pci/if_devar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_devar.h,v 1.34 2015/06/25 18:35:48 deraadt Exp $ */
+/* $OpenBSD: if_devar.h,v 1.35 2015/06/26 11:50:39 kettenis Exp $ */
/* $NetBSD: if_devar.h,v 1.13 1997/06/08 18:46:36 thorpej Exp $ */
/*-
@@ -601,7 +601,7 @@ struct _tulip_softc_t {
* filled.
*/
#define TULIP_SETUP 192
- u_int32_t *tulip_setupdma;
+ tulip_desc_t *tulip_setupbuf;
u_int32_t tulip_setupdata[TULIP_SETUP / sizeof(u_int32_t)];
char tulip_boardid[16]; /* buffer for board ID */