Source-Changes-HG archive

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

[src/trunk]: src/sys Define isb(), dsb(option), and dmb(option)



details:   https://anonhg.NetBSD.org/src/rev/8a4a87545b7f
branches:  trunk
changeset: 944320:8a4a87545b7f
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Sep 26 12:58:22 2020 +0000

description:
Define isb(), dsb(option), and dmb(option)

Catch up with vchiq upstream to allow this.

diffstat:

 sys/arch/arm/include/cpufunc.h                                      |  20 ++++++++++
 sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h             |   2 -
 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c    |   2 +-
 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c        |   2 +-
 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h        |   6 +-
 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c |   6 +-
 6 files changed, 28 insertions(+), 10 deletions(-)

diffs (111 lines):

diff -r a10f8c44803a -r 8a4a87545b7f sys/arch/arm/include/cpufunc.h
--- a/sys/arch/arm/include/cpufunc.h    Sat Sep 26 11:57:05 2020 +0000
+++ b/sys/arch/arm/include/cpufunc.h    Sat Sep 26 12:58:22 2020 +0000
@@ -42,6 +42,26 @@
 #ifndef _ARM_CPUFUNC_H_
 #define _ARM_CPUFUNC_H_
 
+#define        isb()           __asm __volatile("isb" : : : "memory")
+
+/*
+ * Options for DMB and DSB:
+ *     oshld   Outer Shareable, load
+ *     oshst   Outer Shareable, store
+ *     osh     Outer Shareable, all
+ *     nshld   Non-shareable, load
+ *     nshst   Non-shareable, store
+ *     nsh     Non-shareable, all
+ *     ishld   Inner Shareable, load
+ *     ishst   Inner Shareable, store
+ *     ish     Inner Shareable, all
+ *     ld      Full system, load
+ *     st      Full system, store
+ *     sy      Full system, all
+ */
+#define        dsb(opt)        __asm __volatile("dsb " __STRING(opt) : : : "memory")
+#define        dmb(opt)        __asm __volatile("dmb " __STRING(opt) : : : "memory")
+
 #ifdef __arm__
 
 #ifdef _KERNEL
diff -r a10f8c44803a -r 8a4a87545b7f sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h
--- a/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h   Sat Sep 26 11:57:05 2020 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h   Sat Sep 26 12:58:22 2020 +0000
@@ -302,8 +302,6 @@
 #define BCM2835_MBOX_CHAN_VCHIQ        3
 #define bcm_mbox_write bcmmbox_write
 
-#define dsb    membar_producer
-
 #define device_print_prettyname(dev)   device_printf((dev), "")
 
 #endif /* __VCHI_NETBSD_H__ */
diff -r a10f8c44803a -r 8a4a87545b7f sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c  Sat Sep 26 11:57:05 2020 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c  Sat Sep 26 12:58:22 2020 +0000
@@ -181,7 +181,7 @@
        }
 
        /* Send the base address of the slots to VideoCore */
-       dsb(); /* Ensure all writes have completed */
+       dsb(sy); /* Ensure all writes have completed */
 
        bus_dmamap_sync(dma_tag, dma_map, 0, slot_mem_size,
            BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
diff -r a10f8c44803a -r 8a4a87545b7f sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c      Sat Sep 26 11:57:05 2020 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c      Sat Sep 26 12:58:22 2020 +0000
@@ -439,7 +439,7 @@
 {
        if (!event->fired) {
                event->armed = 1;
-               dsb();
+               dsb(sy);
                if (!event->fired) {
                        if (down_interruptible(
                                        (struct semaphore *)
diff -r a10f8c44803a -r 8a4a87545b7f sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h      Sat Sep 26 11:57:05 2020 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h      Sat Sep 26 12:58:22 2020 +0000
@@ -185,11 +185,11 @@
 
 #define DEBUG_INITIALISE(local) int *debug_ptr = (local)->debug;
 #define DEBUG_TRACE(d) \
-       do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(); } while (0)
+       do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(sy); } while (0)
 #define DEBUG_VALUE(d, v) \
-       do { debug_ptr[DEBUG_ ## d] = (v); dsb(); } while (0)
+       do { debug_ptr[DEBUG_ ## d] = (v); dsb(sy); } while (0)
 #define DEBUG_COUNT(d) \
-       do { debug_ptr[DEBUG_ ## d]++; dsb(); } while (0)
+       do { debug_ptr[DEBUG_ ## d]++; dsb(sy); } while (0)
 
 #else /* VCHIQ_ENABLE_DEBUG */
 
diff -r a10f8c44803a -r 8a4a87545b7f sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c       Sat Sep 26 11:57:05 2020 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c       Sat Sep 26 12:58:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vchiq_kmod_netbsd.c,v 1.11 2019/12/31 01:00:23 jmcneill Exp $ */
+/* $NetBSD: vchiq_kmod_netbsd.c,v 1.12 2020/09/26 12:58:23 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.11 2019/12/31 01:00:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.12 2020/09/26 12:58:23 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,7 +98,7 @@
 
        event->fired = 1;
 
-       dsb();          /* data barrier operation */
+       dsb(sy);                /* data barrier operation */
 
        if (event->armed) {
                bus_space_write_4(vchiq_softc->sc_iot, vchiq_softc->sc_ioh,



Home | Main Index | Thread Index | Old Index