summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/pci
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-03-24 02:50:53 +0000
committertmm <tmm@FreeBSD.org>2002-03-24 02:50:53 +0000
commit6f021cf47c5937b0d64aa35385a519c0b7ab3538 (patch)
tree2e665abb3d115afe854ba801ae241f7d46e15477 /sys/sparc64/pci
parente70f6b318dd8319c43aa52a83c367f40df3ebe0e (diff)
downloadFreeBSD-src-6f021cf47c5937b0d64aa35385a519c0b7ab3538.zip
FreeBSD-src-6f021cf47c5937b0d64aa35385a519c0b7ab3538.tar.gz
Revamp the busdma implementation a bit:
- change the IOMMU support code so that it supports overcommittting the available DVMA memory, while still allocating as lazily as possible. This is achieved by limiting the preallocation, and deferring the allocation to map load time when it fails. In the latter case, the DVMA memory reserved for unloaded maps can be stolen to free up enough memory for loading a map. - allow NULL settings in the method tables, and search the parent tags until an appropriate implementation is found. This allows to remove some kluges in the old implementation.
Diffstat (limited to 'sys/sparc64/pci')
-rw-r--r--sys/sparc64/pci/psycho.c73
1 files changed, 41 insertions, 32 deletions
diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c
index bd26e84..49109df 100644
--- a/sys/sparc64/pci/psycho.c
+++ b/sys/sparc64/pci/psycho.c
@@ -99,14 +99,18 @@ static void psycho_iommu_init(struct psycho_softc *, int);
* bus space and bus dma support for UltraSPARC `psycho'. note that most
* of the bus dma support is provided by the iommu dvma controller.
*/
-static int psycho_dmamap_create(bus_dma_tag_t, int, bus_dmamap_t *);
-static int psycho_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
-static int psycho_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
- bus_dmamap_callback_t *, void *, int);
-static void psycho_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
-static void psycho_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);
-static int psycho_dmamem_alloc(bus_dma_tag_t, void **, int, bus_dmamap_t *);
-static void psycho_dmamem_free(bus_dma_tag_t, void *, bus_dmamap_t);
+static int psycho_dmamap_create(bus_dma_tag_t, bus_dma_tag_t, int,
+ bus_dmamap_t *);
+static int psycho_dmamap_destroy(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
+static int psycho_dmamap_load(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
+ void *, bus_size_t, bus_dmamap_callback_t *, void *, int);
+static void psycho_dmamap_unload(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
+static void psycho_dmamap_sync(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
+ bus_dmasync_op_t);
+static int psycho_dmamem_alloc(bus_dma_tag_t, bus_dma_tag_t, void **, int,
+ bus_dmamap_t *);
+static void psycho_dmamem_free(bus_dma_tag_t, bus_dma_tag_t, void *,
+ bus_dmamap_t);
/*
* autoconfiguration
@@ -1274,69 +1278,74 @@ psycho_alloc_bus_tag(struct psycho_softc *sc, int type)
* hooks into the iommu dvma calls.
*/
static int
-psycho_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, bus_dmamap_t *mapp)
+psycho_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
+ int flags, bus_dmamap_t *mapp)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- return (iommu_dvmamem_alloc(dmat, sc->sc_is, vaddr, flags, mapp));
+ sc = (struct psycho_softc *)pdmat->cookie;
+ return (iommu_dvmamem_alloc(pdmat, ddmat, sc->sc_is, vaddr, flags,
+ mapp));
}
static void
-psycho_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
+psycho_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
+ bus_dmamap_t map)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- iommu_dvmamem_free(dmat, sc->sc_is, vaddr, map);
+ sc = (struct psycho_softc *)pdmat->cookie;
+ iommu_dvmamem_free(pdmat, ddmat, sc->sc_is, vaddr, map);
}
static int
-psycho_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
+psycho_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
+ bus_dmamap_t *mapp)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- return (iommu_dvmamap_create(dmat, sc->sc_is, flags, mapp));
+ sc = (struct psycho_softc *)pdmat->cookie;
+ return (iommu_dvmamap_create(pdmat, ddmat, sc->sc_is, flags, mapp));
}
static int
-psycho_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
+psycho_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
+ bus_dmamap_t map)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- return (iommu_dvmamap_destroy(dmat, sc->sc_is, map));
+ sc = (struct psycho_softc *)pdmat->cookie;
+ return (iommu_dvmamap_destroy(pdmat, ddmat, sc->sc_is, map));
}
static int
-psycho_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
- bus_size_t buflen, bus_dmamap_callback_t *callback, void *callback_arg,
- int flags)
+psycho_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
+ void *buf, bus_size_t buflen, bus_dmamap_callback_t *callback,
+ void *callback_arg, int flags)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- return (iommu_dvmamap_load(dmat, sc->sc_is, map, buf, buflen, callback,
- callback_arg, flags));
+ sc = (struct psycho_softc *)pdmat->cookie;
+ return (iommu_dvmamap_load(pdmat, ddmat, sc->sc_is, map, buf, buflen,
+ callback, callback_arg, flags));
}
static void
-psycho_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map)
+psycho_dmamap_unload(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- iommu_dvmamap_unload(dmat, sc->sc_is, map);
+ sc = (struct psycho_softc *)pdmat->cookie;
+ iommu_dvmamap_unload(pdmat, ddmat, sc->sc_is, map);
}
static void
-psycho_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
+psycho_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
bus_dmasync_op_t op)
{
struct psycho_softc *sc;
- sc = (struct psycho_softc *)dmat->cookie;
- iommu_dvmamap_sync(dmat, sc->sc_is, map, op);
+ sc = (struct psycho_softc *)pdmat->cookie;
+ iommu_dvmamap_sync(pdmat, ddmat, sc->sc_is, map, op);
}
OpenPOWER on IntegriCloud