]> git.sur5r.net Git - u-boot/blobdiff - arch/mips/include/asm/system.h
MIPS: Clear instruction hazards in flush_cache()
[u-boot] / arch / mips / include / asm / system.h
index e6435cce2944247b032e6f16f090fc4b7e24b482..eaf1b2290d89589b734735843b559e31536ed23b 100644 (file)
 #ifndef _ASM_SYSTEM_H
 #define _ASM_SYSTEM_H
 
+#include <asm/asm.h>
 #include <asm/sgidefs.h>
 #include <asm/ptrace.h>
+#include <linux/stringify.h>
 #if 0
 #include <linux/kernel.h>
 #endif
@@ -262,4 +264,23 @@ extern void __die_if_kernel(const char *, struct pt_regs *, const char *where,
 #define die_if_kernel(msg, regs)                                       \
        __die_if_kernel(msg, regs, __FILE__ ":"__FUNCTION__, __LINE__)
 
+static inline void execution_hazard_barrier(void)
+{
+       __asm__ __volatile__(
+               ".set noreorder\n"
+               "ehb\n"
+               ".set reorder");
+}
+
+static inline void instruction_hazard_barrier(void)
+{
+       unsigned long tmp;
+
+       asm volatile(
+       __stringify(PTR_LA) "\t%0, 1f\n"
+       "       jr.hb   %0\n"
+       "1:     .insn"
+       : "=&r"(tmp));
+}
+
 #endif /* _ASM_SYSTEM_H */