summaryrefslogtreecommitdiff
path: root/sys/arch/octeon
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2018-01-08 13:44:44 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2018-01-08 13:44:44 +0000
commit6ad42660d1802ff8b6d5e03bd119d44ced456a7f (patch)
tree412f456bc50b0e121cbf27440c8ead7ea8a7bd76 /sys/arch/octeon
parentd670e4bcf8842d82ede109e6e9ccc966a53cd56c (diff)
Override membar_producer() for octeon.
OK dlg@
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r--sys/arch/octeon/include/atomic.h45
1 files changed, 43 insertions, 2 deletions
diff --git a/sys/arch/octeon/include/atomic.h b/sys/arch/octeon/include/atomic.h
index 83424e7c044..ca9113598b3 100644
--- a/sys/arch/octeon/include/atomic.h
+++ b/sys/arch/octeon/include/atomic.h
@@ -1,3 +1,44 @@
-/* $OpenBSD: atomic.h,v 1.1 2010/09/20 06:32:30 syuu Exp $ */
-/* public domain */
+/* $OpenBSD: atomic.h,v 1.2 2018/01/08 13:44:43 visa Exp $ */
+
+/*
+ * Copyright (c) 2017 Visa Hankala
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _OCTEON_ATOMIC_H_
+#define _OCTEON_ATOMIC_H_
+
+#ifdef _KERNEL
+
+static inline void
+octeon_syncw(void)
+{
+ __asm__ volatile (
+ " .set push\n"
+ " .set arch=octeon\n"
+ /* Issue the barrier twice to work around CN3xxx erratum Core-401.
+ * A single syncw might not enforce write ordering properly. */
+ " syncw\n"
+ " syncw\n"
+ " .set pop\n"
+ : : : "memory");
+}
+
+#define membar_producer() octeon_syncw()
+
+#endif /* _KERNEL */
+
#include <mips64/atomic.h>
+
+#endif /* !_OCTEON_ATOMIC_H_ */