MIPS fixes based on suggestions from Jiang.
authorJustin Pettit <jpettit@nicira.com>
Mon, 14 Apr 2008 07:10:48 +0000 (00:10 -0700)
committerJustin Pettit <jpettit@nicira.com>
Mon, 14 Apr 2008 07:10:48 +0000 (00:10 -0700)
datapath/linux-2.4/Makefile.in
datapath/linux-2.4/compat-2.4/include-mips/asm/atomic.h
datapath/linux-2.4/compat-2.4/include-mips/asm/barrier.h
datapath/linux-2.4/compat-2.4/include-mips/asm/break.h [new file with mode: 0644]
datapath/linux-2.4/compat-2.4/include-mips/asm/page.h [new file with mode: 0644]
datapath/linux-2.4/compat-2.4/include-mips/asm/system.h
datapath/linux-2.4/compat-2.4/include/linux/module.h

index c9308dcaf5004b1d63b47806da948f9aa48ad7a9..25a53b379aab0bd0c1f77e40b5e7139c993aedf7 100644 (file)
@@ -38,7 +38,7 @@ SHARED_T_FILES =                                \
     ../unit.c
 UNIT_CFILES = $(patsubst ../%,%, $(SHARED_T_FILES))
 
-kFILES = ../datapath.h                                 \
+HFILES = ../datapath.h                                 \
        ../chain.h                              \
        ../crc32.h                              \
        ../flow.h                               \
index 735c61680cb2513dc6a4e4e97b35dccdc3d2a62b..09802e57614ce271ff751b24eabae2fa0a6ef190 100644 (file)
@@ -4,8 +4,6 @@
 #include_next <asm/atomic.h>
 #include <asm/system.h>
 
-#error "Cribbed from linux-2.6/include/asm-mips but not tested."
-
 #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
 
 #endif /* asm/atomic.h */
index ae1d6460c314cea0a260dd8b0038b5d8aa57dd36..8a51548876a09c32ab6318a362a4097016f58881 100644 (file)
@@ -3,8 +3,6 @@
 
 #include <asm/system.h>
 
-#error "Cribbed from linux-2.6/include/asm-mips/barrier.h but untested."
-
 /* Not sure whether these really need to be defined, but the conservative
  * choice seems to be to define them. */
 #define CONFIG_WEAK_ORDERING 1
diff --git a/datapath/linux-2.4/compat-2.4/include-mips/asm/break.h b/datapath/linux-2.4/compat-2.4/include-mips/asm/break.h
new file mode 100644 (file)
index 0000000..53b0641
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __ASM_MIPS_BREAK_H_WRAPPER
+#define __ASM_MIPS_BREAK_H_WRAPPER 1
+
+#include <linux/version.h>
+#include_next <asm/break.h>
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25)
+
+/*
+ * The following break codes are or were in use for specific purposes in
+ * other MIPS operating systems.  Linux/MIPS doesn't use all of them.  The
+ * unused ones are here as placeholders; we might encounter them in
+ * non-Linux/MIPS object files or make use of them in the future.
+ */
+#define BRK_USERBP  0   /* User bp (used by debuggers) */
+#define BRK_KERNELBP    1   /* Break in the kernel */
+#define BRK_ABORT   2   /* Sometimes used by abort(3) to SIGIOT */
+#define BRK_BD_TAKEN    3   /* For bd slot emulation - not implemented */
+#define BRK_BD_NOTTAKEN 4   /* For bd slot emulation - not implemented */
+#define BRK_SSTEPBP 5   /* User bp (used by debuggers) */
+#define BRK_OVERFLOW    6   /* Overflow check */
+#define BRK_DIVZERO 7   /* Divide by zero check */
+#define BRK_RANGE   8   /* Range error check */
+#define BRK_STACKOVERFLOW 9 /* For Ada stackchecking */
+#define BRK_NORLD   10  /* No rld found - not used by Linux/MIPS */
+#define _BRK_THREADBP   11  /* For threads, user bp (used by debuggers) */
+#define BRK_MULOVF  1023    /* Multiply overflow */
+#define BRK_BUG     512 /* Used by BUG() */
+
+#endif /* linux kernel < 2.4.25 */
+
+#endif /* asm/break.h */
diff --git a/datapath/linux-2.4/compat-2.4/include-mips/asm/page.h b/datapath/linux-2.4/compat-2.4/include-mips/asm/page.h
new file mode 100644 (file)
index 0000000..93a3dff
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __ASM_MIPS_PAGE_H_WRAPPER
+#define __ASM_MIPS_PAGE_H_WRAPPER 1
+
+#include <linux/version.h>
+#include_next <asm/page.h>
+#include <asm/break.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25)
+
+#define BUG()                                                           \
+do {                                                                    \
+        __asm__ __volatile__("break %0" : : "i" (BRK_BUG));             \
+} while (0)
+
+#endif /* linux kernel < 2.4.25 */
+
+#endif /* asm/page.h */
index c1b081540cebd1be911d329d7e1c7d39815f08d9..815b8530b2b097224412640a9ab4de17361350cb 100644 (file)
@@ -3,8 +3,6 @@
 
 #include_next <asm/system.h>
 
-#error "Cribbed from linux-2.6/include/asm-mips/system.h but untested."
-
 #define __HAVE_ARCH_CMPXCHG 1
 
 static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
@@ -52,11 +50,11 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
        } else {
                unsigned long flags;
 
-               raw_local_irq_save(flags);
+               local_irq_save(flags);
                retval = *m;
                if (retval == old)
                        *m = new;
-               raw_local_irq_restore(flags);   /* implies memory barrier  */
+               local_irq_restore(flags);       /* implies memory barrier  */
        }
 
        smp_llsc_mb();
@@ -158,11 +156,11 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
        } else {
                unsigned long flags;
 
-               raw_local_irq_save(flags);
+               local_irq_save(flags);
                retval = *m;
                if (retval == old)
                        *m = new;
-               raw_local_irq_restore(flags);   /* implies memory barrier  */
+               local_irq_restore(flags);       /* implies memory barrier  */
        }
 
        smp_llsc_mb();
index 797a330a47dba0aa9df39b4623186a931268667f..8ba5b781d5c340cca020c7b66ac138b3b5be6455 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_MODULE_WRAPPER_H
 #define __LINUX_MODULE_WRAPPER_H 1
 
+#include <linux/kernel.h>
 #include_next <linux/module.h>
 
 static inline int try_module_get(struct module *module)