From: kettenis Date: Sun, 24 Dec 2017 12:55:52 +0000 (+0000) Subject: Allow SD/MMC controller drivers to allocate their own DMA mapping structure X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b58329e97de94a8cee2422eddb73235b538ccbd6;p=openbsd Allow SD/MMC controller drivers to allocate their own DMA mapping structure to account for any relevant hardware constraints. ok stsp@ --- diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c index 81c5a101454..863f4ee69f4 100644 --- a/sys/dev/sdmmc/sdmmc.c +++ b/sys/dev/sdmmc/sdmmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc.c,v 1.47 2017/04/06 07:07:28 jsg Exp $ */ +/* $OpenBSD: sdmmc.c,v 1.48 2017/12/24 12:55:52 kettenis Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler @@ -115,11 +115,12 @@ sdmmc_attach(struct device *parent, struct device *self, void *aux) sc->sct = saa->sct; sc->sch = saa->sch; sc->sc_dmat = saa->dmat; + sc->sc_dmap = saa->dmap; sc->sc_flags = saa->flags; sc->sc_caps = saa->caps; sc->sc_max_xfer = saa->max_xfer; - if (ISSET(sc->sc_caps, SMC_CAPS_DMA)) { + if (ISSET(sc->sc_caps, SMC_CAPS_DMA) && sc->sc_dmap == NULL) { error = bus_dmamap_create(sc->sc_dmat, MAXPHYS, SDMMC_MAXNSEGS, MAXPHYS, 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, &sc->sc_dmap); if (error) { diff --git a/sys/dev/sdmmc/sdmmcchip.h b/sys/dev/sdmmc/sdmmcchip.h index f2acb6a6925..464521602f7 100644 --- a/sys/dev/sdmmc/sdmmcchip.h +++ b/sys/dev/sdmmc/sdmmcchip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcchip.h,v 1.9 2016/05/05 20:40:48 kettenis Exp $ */ +/* $OpenBSD: sdmmcchip.h,v 1.10 2017/12/24 12:55:52 kettenis Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler @@ -97,6 +97,7 @@ struct sdmmcbus_attach_args { sdmmc_chipset_tag_t sct; sdmmc_chipset_handle_t sch; bus_dma_tag_t dmat; + bus_dmamap_t dmap; int flags; int caps; long max_xfer;