summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-11-12 18:04:07 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-11-12 18:04:07 +0000
commit83460e80b7d5a287de80361fe233568696ec5aaf (patch)
tree1518f37c1ce7813ace90dbc75b264f7f4647a80d /sys
parent888ff30ee66bd6d1eb3332cd95fce06c9a516445 (diff)
Don't abuse bus_dma(9) API by using dmamap->dm_* to hold results from
bus_dmamem_* operations; instead, store them in softc. This allows the driver to get through autoconf on sparc64 (ok, well it fails the ram test because of endian issues... but it's a start).
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/hifn7751.c19
-rw-r--r--sys/dev/pci/hifn7751var.h4
2 files changed, 10 insertions, 13 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index 529fce095f3..ca847d8b0cf 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.107 2001/11/09 03:11:38 deraadt Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.108 2001/11/12 18:04:06 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -191,19 +191,16 @@ hifn_attach(parent, self, aux)
goto fail_io1;
}
if (bus_dmamem_alloc(sc->sc_dmat, sizeof(*sc->sc_dma), PAGE_SIZE, 0,
- sc->sc_dmamap->dm_segs, 1, &sc->sc_dmamap->dm_nsegs,
- BUS_DMA_NOWAIT)) {
+ sc->sc_dmasegs, 1, &sc->sc_dmansegs, BUS_DMA_NOWAIT)) {
printf(": can't alloc dma buffer\n");
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
goto fail_io1;
}
- if (bus_dmamem_map(sc->sc_dmat, sc->sc_dmamap->dm_segs,
- sc->sc_dmamap->dm_nsegs, sizeof(*sc->sc_dma), &kva,
- BUS_DMA_NOWAIT)) {
+ if (bus_dmamem_map(sc->sc_dmat, sc->sc_dmasegs, sc->sc_dmansegs,
+ sizeof(*sc->sc_dma), &kva, BUS_DMA_NOWAIT)) {
printf(": can't map dma buffers (%lu bytes)\n",
(u_long)sizeof(*sc->sc_dma));
- bus_dmamem_free(sc->sc_dmat, sc->sc_dmamap->dm_segs,
- sc->sc_dmamap->dm_nsegs);
+ bus_dmamem_free(sc->sc_dmat, sc->sc_dmasegs, sc->sc_dmansegs);
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
goto fail_io1;
}
@@ -211,8 +208,7 @@ hifn_attach(parent, self, aux)
sizeof(*sc->sc_dma), NULL, BUS_DMA_NOWAIT)) {
printf(": can't load dma map\n");
bus_dmamem_unmap(sc->sc_dmat, kva, sizeof(*sc->sc_dma));
- bus_dmamem_free(sc->sc_dmat, sc->sc_dmamap->dm_segs,
- sc->sc_dmamap->dm_nsegs);
+ bus_dmamem_free(sc->sc_dmat, sc->sc_dmasegs, sc->sc_dmansegs);
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
goto fail_io1;
}
@@ -327,8 +323,7 @@ fail_intr:
fail_mem:
bus_dmamap_unload(sc->sc_dmat, sc->sc_dmamap);
bus_dmamem_unmap(sc->sc_dmat, kva, sizeof(*sc->sc_dma));
- bus_dmamem_free(sc->sc_dmat, sc->sc_dmamap->dm_segs,
- sc->sc_dmamap->dm_nsegs);
+ bus_dmamem_free(sc->sc_dmat, sc->sc_dmasegs, sc->sc_dmansegs);
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
/* Turn off DMA polling */
diff --git a/sys/dev/pci/hifn7751var.h b/sys/dev/pci/hifn7751var.h
index 9445c3a4294..bee92088acc 100644
--- a/sys/dev/pci/hifn7751var.h
+++ b/sys/dev/pci/hifn7751var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751var.h,v 1.39 2001/11/05 17:25:58 art Exp $ */
+/* $OpenBSD: hifn7751var.h,v 1.40 2001/11/12 18:04:06 jason Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -142,6 +142,8 @@ struct hifn_softc {
struct hifn_dma *sc_dma;
bus_dmamap_t sc_dmamap;
+ bus_dma_segment_t sc_dmasegs[1];
+ int sc_dmansegs;
int32_t sc_cid;
int sc_maxses;
int sc_ramsize;