Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch use dma channel mask from firmware



details:   https://anonhg.NetBSD.org/src/rev/a05e09dee0ef
branches:  trunk
changeset: 332227:a05e09dee0ef
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Sep 12 15:29:30 2014 +0000

description:
use dma channel mask from firmware

diffstat:

 sys/arch/arm/broadcom/bcm2835_dmac.c |  11 ++++++-----
 sys/arch/evbarm/rpi/rpi_machdep.c    |   9 +++++++--
 2 files changed, 13 insertions(+), 7 deletions(-)

diffs (72 lines):

diff -r fb50833139bf -r a05e09dee0ef sys/arch/arm/broadcom/bcm2835_dmac.c
--- a/sys/arch/arm/broadcom/bcm2835_dmac.c      Fri Sep 12 14:46:33 2014 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_dmac.c      Fri Sep 12 15:29:30 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_dmac.c,v 1.2 2014/09/07 15:21:27 jmcneill Exp $ */
+/* $NetBSD: bcm2835_dmac.c,v 1.3 2014/09/12 15:29:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.2 2014/09/07 15:21:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.3 2014/09/12 15:29:30 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -109,6 +109,7 @@
 bcm_dmac_attach(device_t parent, device_t self, void *aux)
 {
        struct bcm_dmac_softc *sc = device_private(self);
+       const prop_dictionary_t *cfg = device_properties(self);
        struct bcm_dmac_channel *ch;
        struct amba_attach_args *aaa = aux;
        uint32_t val;
@@ -123,12 +124,12 @@
                return;
        }
 
-       sc->sc_channelmask = BCM_DMAC_CHANNELMASK;
-       sc->sc_nchannels = 31 - __builtin_clz(sc->sc_channelmask);
+       prop_dictionary_get_uint32(cfg, "chanmask", &sc->sc_channelmask);
+       sc->sc_channelmask &= BCM_DMAC_CHANNELMASK;
 
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SCHED);
 
-       sc->sc_nchannels = 31 - __builtin_clz(BCM_DMAC_CHANNELMASK);
+       sc->sc_nchannels = 31 - __builtin_clz(sc->sc_channelmask);
        sc->sc_channels = kmem_alloc(
            sizeof(*sc->sc_channels) * sc->sc_nchannels, KM_SLEEP);
        if (sc->sc_channels == NULL) {
diff -r fb50833139bf -r a05e09dee0ef sys/arch/evbarm/rpi/rpi_machdep.c
--- a/sys/arch/evbarm/rpi/rpi_machdep.c Fri Sep 12 14:46:33 2014 +0000
+++ b/sys/arch/evbarm/rpi/rpi_machdep.c Fri Sep 12 15:29:30 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpi_machdep.c,v 1.46 2014/09/07 15:28:24 skrll Exp $   */
+/*     $NetBSD: rpi_machdep.c,v 1.47 2014/09/12 15:29:30 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.46 2014/09/07 15:28:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.47 2014/09/12 15:29:30 jmcneill Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_ddb.h"
@@ -892,6 +892,11 @@
 {
        prop_dictionary_t dict = device_properties(dev);
 
+       if (device_is_a(dev, "bcmdmac") &&
+           vcprop_tag_success_p(&vb.vbt_dmachan.tag)) {
+               prop_dictionary_set_uint32(dict,
+                   "chanmask", vb.vbt_dmachan.mask);
+       }
 #if NSDHC > 0
        if (device_is_a(dev, "sdhc") &&
            vcprop_tag_success_p(&vb.vbt_emmcclockrate.tag) &&



Home | Main Index | Thread Index | Old Index