Allow SD/MMC controller drivers to allocate their own DMA mapping structure
authorkettenis <kettenis@openbsd.org>
Sun, 24 Dec 2017 12:55:52 +0000 (12:55 +0000)
committerkettenis <kettenis@openbsd.org>
Sun, 24 Dec 2017 12:55:52 +0000 (12:55 +0000)
to account for any relevant hardware constraints.

ok stsp@

sys/dev/sdmmc/sdmmc.c
sys/dev/sdmmc/sdmmcchip.h

index 81c5a10..863f4ee 100644 (file)
@@ -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 <uwe@openbsd.org>
@@ -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) {
index f2acb6a..4645216 100644 (file)
@@ -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 <uwe@openbsd.org>
@@ -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;