[Xenomai-git] Philippe Gerum : powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2. 1-00

2009-07-19 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 97d2daf7922f2f1a26c7f062695cf0f08210c25f
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=97d2daf7922f2f1a26c7f062695cf0f08210c25f

Author: Philippe Gerum 
Date:   Sun Jul 19 23:26:10 2009 +0200

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

---

 ...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 +,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
+@@ -,7 +1124,7 @@ giveup_fpu:
+   SYNC_601
+   isync
+   cmpi0,r3,0
+-  beqlr-  /* if no previous owner, done */
++  beq-2f  /* if no previous owner, done */
+   addir3,r3,THREAD/* want THREAD of task */
+   lwz r5,PT_REGS(r3)
+   cmpi0,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 = ¤t->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 000..c4f52a0
+index 000..6e6fad1
 --- /dev/null
 +++ b/include/asm-ppc/ipipe.h
 @@ -0,0 +1,183 @@
@@ -1301,10 +1351,10 @@ index 000..c4f52a0
 +#include 
 +#include 
 +
-+#define IPIP

[Xenomai-git] Philippe Gerum : powerpc: upgrade legacy I-pipe support to 2.4.25-ppc-2. 1-00

2009-07-19 Thread GIT version control
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 
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 +,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
+@@ -,7 +1124,7 @@ giveup_fpu:
+   SYNC_601
+   isync
+   cmpi0,r3,0
+-  beqlr-  /* if no previous owner, done */
++  beq-2f  /* if no previous owner, done */
+   addir3,r3,THREAD/* want THREAD of task */
+   lwz r5,PT_REGS(r3)
+   cmpi0,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 = ¤t->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 000..c4f52a0
+index 000..6e6fad1
 --- /dev/null
 +++ b/include/asm-ppc/ipipe.h
 @@ -0,0 +1,183 @@
@@ -1301,10 +1351,10 @@ index