Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/broadcom serialize bcmmbox_request
details: https://anonhg.NetBSD.org/src/rev/7dddb5ad6f21
branches: trunk
changeset: 783768:7dddb5ad6f21
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Jan 08 09:11:11 2013 +0000
description:
serialize bcmmbox_request
diffstat:
sys/arch/arm/broadcom/bcm2835_mbox.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (60 lines):
diff -r 6ab5ecb49c8a -r 7dddb5ad6f21 sys/arch/arm/broadcom/bcm2835_mbox.c
--- a/sys/arch/arm/broadcom/bcm2835_mbox.c Tue Jan 08 08:55:28 2013 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_mbox.c Tue Jan 08 09:11:11 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_mbox.c,v 1.3 2013/01/07 20:15:32 jmcneill Exp $ */
+/* $NetBSD: bcm2835_mbox.c,v 1.4 2013/01/08 09:11:11 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox.c,v 1.3 2013/01/07 20:15:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox.c,v 1.4 2013/01/08 09:11:11 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -38,6 +38,7 @@
#include <sys/kernel.h>
#include <sys/timetc.h>
#include <sys/bus.h>
+#include <sys/mutex.h>
#include <arm/broadcom/bcm_amba.h>
#include <arm/broadcom/bcm2835_mbox.h>
@@ -51,6 +52,8 @@
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_dma_tag_t sc_dmat;
+
+ kmutex_t sc_lock;
};
static struct bcm2835mbox_softc *bcm2835mbox_sc;
@@ -89,6 +92,7 @@
sc->sc_dev = self;
sc->sc_iot = aaa->aaa_iot;
sc->sc_dmat = aaa->aaa_dmat;
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
if (bus_space_map(aaa->aaa_iot, aaa->aaa_addr, BCM2835_MBOX_SIZE, 0,
&sc->sc_ioh)) {
@@ -151,12 +155,16 @@
memcpy(dma_buf, buf, buflen);
+ mutex_enter(&sc->sc_lock);
+
bus_dmamap_sync(sc->sc_dmat, map, 0, buflen, BUS_DMASYNC_PREWRITE);
bcmmbox_write(chan, map->dm_segs[0].ds_addr);
bus_dmamap_sync(sc->sc_dmat, map, 0, buflen, BUS_DMASYNC_POSTWRITE);
bus_dmamap_sync(sc->sc_dmat, map, 0, buflen, BUS_DMASYNC_PREREAD);
bcmmbox_read(chan, pres);
+ mutex_exit(&sc->sc_lock);
+
memcpy(buf, dma_buf, buflen);
bus_dmamap_unload(sc->sc_dmat, map);
Home |
Main Index |
Thread Index |
Old Index