Module: xenomai-2.4
Branch: master
Commit: e9d1e36e8da5b670b44f7a7d4af18a55956decbc
URL:    
http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=e9d1e36e8da5b670b44f7a7d4af18a55956decbc

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Jul 19 13:20:11 2009 +0200

powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2.1-00

This patch fixes FPU issues induced by real-time activity.

---

 ...ch => adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch} |  136 ++++++++++++++++----
 1 files changed, 113 insertions(+), 23 deletions(-)

diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.0-01.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
similarity index 97%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.0-01.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
index 5a2860f..ca9a892 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.0-01.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.4.25-ppc-DENX-2.1-00.patch
@@ -95,7 +95,7 @@ index d19d49d..cdb86ff 100644
        andi.   r3,r3,MSR_PR
        beq+    do_signal_ret   /* if so, check need_resched and signals */
 diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
-index 7b9e0c2..2605305 100644
+index 7b9e0c2..befb024 100644
 --- a/arch/ppc/kernel/head.S
 +++ b/arch/ppc/kernel/head.S
 @@ -435,7 +435,11 @@ HardwareInterrupt:
@@ -123,6 +123,47 @@ index 7b9e0c2..2605305 100644
        .long   ret_from_intercept
  
        STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
+@@ -1103,7 +1111,12 @@ giveup_altivec:
+  */
+       .globl  giveup_fpu
+ giveup_fpu:
++#ifdef CONFIG_IPIPE   
++      mfmsr   r6
++      rlwinm  r5,r6,0,17,15           /* clear MSR_EE */
++#else 
+       mfmsr   r5
++#endif        
+       ori     r5,r5,MSR_FP
+       SYNC_601
+       ISYNC_601
+@@ -1111,7 +1124,7 @@ giveup_fpu:
+       SYNC_601
+       isync
+       cmpi    0,r3,0
+-      beqlr-                          /* if no previous owner, done */
++      beq-    2f                      /* if no previous owner, done */
+       addi    r3,r3,THREAD            /* want THREAD of task */
+       lwz     r5,PT_REGS(r3)
+       cmpi    0,r5,0
+@@ -1129,6 +1142,18 @@ giveup_fpu:
+       lis     r4,last_task_used_m...@ha
+       stw     r5,last_task_used_m...@l(r4)
+ #endif /* CONFIG_SMP */
++2:
++#ifdef CONFIG_IPIPE           /* restore interrupt state */
++      andi.   r6,r6,MSR_EE
++      beqlr
++      mfmsr   r5
++      ori     r5,r5,MSR_EE
++      SYNC_601
++      ISYNC_601
++      mtmsr   r5
++      SYNC_601
++      isync
++#endif
+       blr
+ 
+ /*
 diff --git a/arch/ppc/kernel/head_440.S b/arch/ppc/kernel/head_440.S
 index a52bf16..d8cbb41 100644
 --- a/arch/ppc/kernel/head_440.S
@@ -998,6 +1039,29 @@ index d90d323..513c65d 100644
  EXPORT_SYMBOL(timer_interrupt_intercept);
  EXPORT_SYMBOL(timer_interrupt);
  EXPORT_SYMBOL(do_IRQ_intercept);
+diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
+index b78fee1..05b9286 100644
+--- a/arch/ppc/kernel/process.c
++++ b/arch/ppc/kernel/process.c
+@@ -211,7 +211,7 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
+         struct task_struct **last)
+ {
+       struct thread_struct *new_thread, *old_thread;
+-      unsigned long s;
++      unsigned long s, flags;
+ 
+       __save_flags(s);
+       __cli();
+@@ -276,7 +276,9 @@ _switch_to(struct task_struct *prev, struct task_struct 
*new,
+ #endif
+       new_thread = &new->thread;
+       old_thread = &current->thread;
++      local_irq_save_hw_cond(flags);
+       *last = _switch(old_thread, new_thread);
++      local_irq_restore_hw_cond(flags);
+       __restore_flags(s);
+ }
+ 
 diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
 index aa4eaff..6f37807 100644
 --- a/arch/ppc/kernel/traps.c
@@ -1140,20 +1204,6 @@ index 19fe78e..a3b36f8 100644
  #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
        if (debugger_fault_handler && regs->trap == 0x300) {
                debugger_fault_handler(regs);
-diff --git a/arch/ppc/platforms/icecube.c b/arch/ppc/platforms/icecube.c
-index 40b6040..c35c2fa 100644
---- a/arch/ppc/platforms/icecube.c
-+++ b/arch/ppc/platforms/icecube.c
-@@ -46,6 +46,9 @@
- unsigned char __res[sizeof(bd_t)];
- #endif
- 
-+void
-+mpc5xxx_progress(char *s, unsigned short hex);
-+
- extern int mpc5xxx_setkeycode(unsigned int scancode, unsigned int keycode);
- extern int mpc5xxx_getkeycode(unsigned int scancode);
- extern int mpc5xxx_translate(unsigned char scancode, unsigned char *keycode,
 diff --git a/include/asm-ppc/hw_irq.h b/include/asm-ppc/hw_irq.h
 index 8f0e170..ba649dc 100644
 --- a/include/asm-ppc/hw_irq.h
@@ -1257,7 +1307,7 @@ index 8f0e170..ba649dc 100644
  extern void do_lost_interrupts(unsigned long);
 diff --git a/include/asm-ppc/ipipe.h b/include/asm-ppc/ipipe.h
 new file mode 100644
-index 0000000..c4f52a0
+index 0000000..6e6fad1
 --- /dev/null
 +++ b/include/asm-ppc/ipipe.h
 @@ -0,0 +1,183 @@
@@ -1301,10 +1351,10 @@ index 0000000..c4f52a0
 +#include <asm/irq.h>
 +#include <asm/bitops.h>
 +
-+#define IPIPE_ARCH_STRING     "2.0-01"
++#define IPIPE_ARCH_STRING     "2.1-00"
 +#define IPIPE_MAJOR_NUMBER    2
-+#define IPIPE_MINOR_NUMBER    0
-+#define IPIPE_PATCH_NUMBER    1
++#define IPIPE_MINOR_NUMBER    1
++#define IPIPE_PATCH_NUMBER    0
 +
 +#define prepare_arch_switch(next)                     \
 +      do {                                            \
@@ -1591,6 +1641,18 @@ index 6c6c141..38c33de 100644
  }
  
  extern void mmu_context_init(void);
+diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h
+index 855b815..f50df97 100644
+--- a/include/asm-ppc/spinlock.h
++++ b/include/asm-ppc/spinlock.h
+@@ -30,6 +30,7 @@ typedef struct {
+ #endif
+ 
+ #define SPIN_LOCK_UNLOCKED    (spinlock_t) { 0 SPINLOCK_DEBUG_INIT }
++#define __SPIN_LOCK_UNLOCKED  { 0 SPINLOCK_DEBUG_INIT }
+ 
+ #define spin_lock_init(x)     do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
+ #define spin_is_locked(x)     ((x)->lock != 0)
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
 index 0000000..967204c
@@ -2650,7 +2712,7 @@ index 90bd418..405121d 100644
  #define PF_SUPERPRIV  0x00000100      /* used super-user privileges */
  #define PF_DUMPCORE   0x00000200      /* dumped core */
 diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
-index bae52d3..1462732 100644
+index bae52d3..fe56f59 100644
 --- a/include/linux/spinlock.h
 +++ b/include/linux/spinlock.h
 @@ -5,12 +5,56 @@
@@ -2723,7 +2785,35 @@ index bae52d3..1462732 100644
  #define spin_unlock_bh(lock)                  do { spin_unlock(lock);  
local_bh_enable();        } while (0)
  
  #define read_unlock_irqrestore(lock, flags)   do { read_unlock(lock);  
local_irq_restore(flags); } while (0)
-@@ -153,6 +197,44 @@ typedef struct {
+@@ -76,9 +120,11 @@
+ #if (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
+   typedef struct { } spinlock_t;
+   #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
++  #define __SPIN_LOCK_UNLOCKED { }
+ #else
+   typedef struct { int gcc_is_buggy; } spinlock_t;
+   #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
++  #define __SPIN_LOCK_UNLOCKED { 0 }
+ #endif
+ 
+ #define spin_lock_init(lock)  do { } while(0)
+@@ -94,6 +140,7 @@ typedef struct {
+       volatile unsigned long lock;
+ } spinlock_t;
+ #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
++#define __SPIN_LOCK_UNLOCKED { 0 }
+ 
+ #define spin_lock_init(x)     do { (x)->lock = 0; } while (0)
+ #define spin_is_locked(lock)  (test_bit(0,(lock)))
+@@ -111,6 +158,7 @@ typedef struct {
+       const char *module;
+ } spinlock_t;
+ #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ }
++#define __SPIN_LOCK_UNLOCKED { 0, 25, __BASE_FILE__ }
+ 
+ #include <linux/kernel.h>
+ 
+@@ -153,6 +201,44 @@ typedef struct {
  
  #endif /* !SMP */
  
@@ -2732,7 +2822,7 @@ index bae52d3..1462732 100644
 +} __ipipe_spinlock_t;
 +
 +#ifdef CONFIG_IPIPE
-+#define IPIPE_SPIN_LOCK_UNLOCKED      { .__lock = SPIN_LOCK_UNLOCKED }
++#define IPIPE_SPIN_LOCK_UNLOCKED      (__ipipe_spinlock_t) { .__lock = 
__SPIN_LOCK_UNLOCKED }
 +#define ipipe_spinlock_t              __ipipe_spinlock_t
 +#define IPIPE_DEFINE_SPINLOCK(x)      ipipe_spinlock_t x = 
IPIPE_SPIN_LOCK_UNLOCKED
 +#define IPIPE_DECLARE_SPINLOCK(x)     extern ipipe_spinlock_t x
@@ -2749,7 +2839,7 @@ index bae52d3..1462732 100644
 +      spin_unlock_irqrestore(lock, flags)
 +#else /* !CONFIG_IPIPE */
 +#define ipipe_spinlock_t              spinlock_t
-+#define IPIPE_SPIN_LOCK_UNLOCKED      SPIN_LOCK_UNLOCKED
++#define IPIPE_SPIN_LOCK_UNLOCKED      __SPIN_LOCK_UNLOCKED
 +#define IPIPE_DEFINE_SPINLOCK(x)      spinlock_t x
 +#define IPIPE_DECLARE_SPINLOCK(x)     extern spinlock_t x
 +


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to