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 Change the mailbox handling so that th...



details:   https://anonhg.NetBSD.org/src/rev/f01de0f9cbd9
branches:  trunk
changeset: 782033:f01de0f9cbd9
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Oct 13 08:42:50 2012 +0000

description:
Change the mailbox handling so that the data value top 28 bits are used.

diffstat:

 sys/arch/arm/broadcom/bcm2835_mbox.h      |   7 +------
 sys/arch/arm/broadcom/bcm2835_mbox_subr.c |  14 ++++++++++++--
 2 files changed, 13 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r 7f1f1e82b905 -r f01de0f9cbd9 sys/arch/arm/broadcom/bcm2835_mbox.h
--- a/sys/arch/arm/broadcom/bcm2835_mbox.h      Sat Oct 13 07:57:50 2012 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_mbox.h      Sat Oct 13 08:42:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_mbox.h,v 1.2 2012/08/22 13:19:47 jakllsch Exp $        */
+/*     $NetBSD: bcm2835_mbox.h,v 1.3 2012/10/13 08:42:50 skrll Exp $   */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,11 +34,6 @@
 
 #include <sys/bus.h>
 
-#define        BCM2835_MBOX_CHAN(mbox) ((mbox) & 0xf)
-#define        BCM2835_MBOX_DATA(mbox) (((mbox) & ~0xf) >> 4)
-
-#define        BCM2835_MBOX_MSG(chan, data) (((chan) & 0xf) | ((data) << 4))
-
 void bcm2835_mbox_read(bus_space_tag_t, bus_space_handle_t, uint8_t,
     uint32_t *);
 void bcm2835_mbox_write(bus_space_tag_t, bus_space_handle_t, uint8_t,
diff -r 7f1f1e82b905 -r f01de0f9cbd9 sys/arch/arm/broadcom/bcm2835_mbox_subr.c
--- a/sys/arch/arm/broadcom/bcm2835_mbox_subr.c Sat Oct 13 07:57:50 2012 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_mbox_subr.c Sat Oct 13 08:42:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_mbox_subr.c,v 1.2 2012/10/13 07:57:50 skrll Exp $      */
+/*     $NetBSD: bcm2835_mbox_subr.c,v 1.3 2012/10/13 08:42:50 skrll Exp $      */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox_subr.c,v 1.2 2012/10/13 07:57:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox_subr.c,v 1.3 2012/10/13 08:42:50 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,12 +44,20 @@
 #include <arm/broadcom/bcm2835_mboxreg.h>
 #include <arm/broadcom/bcm2835reg.h>
 
+
+#define        BCM2835_MBOX_CHAN(chan) ((chan) & 0xf)
+#define        BCM2835_MBOX_DATA(data) ((data) & ~0xf)
+
+#define        BCM2835_MBOX_MSG(chan, data) (((chan) & 0xf) | ((data) & ~0xf))
+
 void
 bcm2835_mbox_read(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t chan,
     uint32_t *data)
 {
        uint32_t mbox;
 
+       KASSERT((chan & 0xf) == chan);
+
        for (;;) {
                uint8_t rchan;
                uint32_t rdata;
@@ -79,6 +87,8 @@
 {
        uint32_t rdata;
 
+       KASSERT((chan & 0xf) == chan);
+       KASSERT((data & 0xf) == 0);
        for (;;) {
 
                bus_space_barrier(iot, ioh, 0, BCM2835_MBOX_SIZE,



Home | Main Index | Thread Index | Old Index