90 lines
2.7 KiB
Diff
90 lines
2.7 KiB
Diff
--- /dev/null 2018-10-16 15:37:47.150104464 +0300
|
|
+++ b/urcu/arch/e2k.h 2020-03-03 17:55:17.066797681 +0300
|
|
@@ -0,0 +1,86 @@
|
|
+#ifndef _URCU_ARCH_E2K_H
|
|
+#define _URCU_ARCH_E2K_H
|
|
+
|
|
+/*
|
|
+ * arch_e2k.h: trivial definitions for the e2k architecture.
|
|
+ *
|
|
+ * This library is free software; you can redistribute it and/or
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
+ * License as published by the Free Software Foundation; either
|
|
+ * version 2.1 of the License, or (at your option) any later version.
|
|
+ *
|
|
+ * This library is distributed in the hope that it will be useful,
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
+ * Lesser General Public License for more details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU Lesser General Public
|
|
+ * License along with this library; if not, write to the Free Software
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
+ */
|
|
+
|
|
+#include <urcu/compiler.h>
|
|
+#include <urcu/config.h>
|
|
+
|
|
+#ifdef __cplusplus
|
|
+extern "C" {
|
|
+#endif
|
|
+
|
|
+#define E2K_GET_DSREG(reg_mnemonic) \
|
|
+({ \
|
|
+ unsigned long long __res; \
|
|
+ asm volatile ("rrd %%" #reg_mnemonic ", %0" : "=r" (__res)); \
|
|
+ __res; \
|
|
+})
|
|
+
|
|
+#define _ld_c 0x8 /* stop until all load operations complete */
|
|
+#define _st_c 0x4 /* stop until store operations complete */
|
|
+#define E2K_WAIT(num) \
|
|
+({ \
|
|
+ asm volatile ("{wait \tma_c = %0, fl_c = %1, ld_c = %2, " \
|
|
+ "st_c = %3, all_e = %4, all_c = %5}" \
|
|
+ : \
|
|
+ : "i" (((num) & 0x20) >> 5), \
|
|
+ "i" (((num) & 0x10) >> 4), \
|
|
+ "i" (((num) & 0x8) >> 3), \
|
|
+ "i" (((num) & 0x4) >> 2), \
|
|
+ "i" (((num) & 0x2) >> 1), \
|
|
+ "i" (((num) & 0x1)) \
|
|
+ : "memory" ); \
|
|
+})
|
|
+
|
|
+#define barrier() __asm__ __volatile__("{nop}" ::: "memory")
|
|
+
|
|
+#define caa_cpu_relax() __asm__ __volatile__("{nop 7}" ::: "memory")
|
|
+
|
|
+
|
|
+#define cmm_mb() E2K_WAIT(_st_c|_ld_c)
|
|
+#define cmm_wmb() E2K_WAIT(_st_c)
|
|
+#define cmm_rmb() E2K_WAIT(_ld_c)
|
|
+
|
|
+#ifdef CONFIG_RCU_SMP
|
|
+#define cmm_smp_mb() cmm_mb()
|
|
+#define cmm_smp_rmb() cmm_rmb()
|
|
+#define cmm_smp_wmb() cmm_wmb()
|
|
+#else
|
|
+#define cmm_smp_mb() barrier()
|
|
+#define cmm_smp_rmb() barrier()
|
|
+#define cmm_smp_wmb() barrier()
|
|
+#endif
|
|
+
|
|
+#define cmm_read_barrier_depends() do { } while (0)
|
|
+
|
|
+#define HAS_CAA_GET_CYCLES
|
|
+typedef unsigned long long caa_cycles_t;
|
|
+static inline caa_cycles_t caa_get_cycles(void)
|
|
+{
|
|
+ return E2K_GET_DSREG(clkr);
|
|
+}
|
|
+
|
|
+#ifdef __cplusplus
|
|
+}
|
|
+#endif
|
|
+
|
|
+#include <urcu/arch/generic.h>
|
|
+
|
|
+#endif /* _URCU_ARCH_E2K_H */
|