[PATCH 02/17] powerpc: Change interrupt disable implemetation

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 17 15:51:27 UTC 2014


Instead of SPRG0 (= special purpose register 272) use the new global
symbol _PPC_INTERRUPT_DISABLE_MASK to store the interrupt disable mask.
The benefit is that it is now possible to disable interrupts without
further run-time initialization in boot_card().

At least on Freescale e500 cores this leads also to a faster execution
since the mfmsr and mfspr instruction require four cycles to complete.
The instructions to load the mask value can execute while the mfmsr is
in progress.
---
 .../lib/libbsp/powerpc/beatnik/startup/bspstart.c  |    6 +---
 c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c   |    6 +---
 .../lib/libbsp/powerpc/gen5200/startup/bspstart.c  |    1 -
 .../lib/libbsp/powerpc/gen83xx/startup/bspstart.c  |    1 -
 .../libbsp/powerpc/haleakala/startup/bspstart.c    |    1 -
 c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c |    1 -
 .../libbsp/powerpc/mpc55xxevb/startup/bspstart.c   |    1 -
 .../libbsp/powerpc/mpc8260ads/startup/bspstart.c   |    1 -
 .../lib/libbsp/powerpc/mvme3100/startup/bspstart.c |    6 +---
 .../lib/libbsp/powerpc/mvme5500/startup/bspstart.c |    6 +---
 c/src/lib/libbsp/powerpc/psim/startup/bspstart.c   |    1 -
 .../lib/libbsp/powerpc/qemuppc/startup/bspstart.c  |    6 +---
 c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c  |    1 -
 c/src/lib/libbsp/powerpc/qoriq/startup/smp.c       |    1 -
 .../libbsp/powerpc/score603e/startup/bspstart.c    |    6 +---
 c/src/lib/libbsp/powerpc/shared/startup/bspstart.c |    6 +---
 .../lib/libbsp/powerpc/t32mppc/startup/bspstart.c  |    1 -
 c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c |    6 +---
 c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c |    1 -
 .../lib/libbsp/powerpc/virtex4/startup/bspstart.c  |    4 +--
 .../lib/libbsp/powerpc/virtex5/startup/bspstart.c  |    4 +--
 c/src/lib/libbsp/shared/bootcard.c                 |    8 -----
 .../new-exceptions/bspsupport/ppc_exc_initialize.c |    3 --
 .../powerpc/new-exceptions/bspsupport/vectors.h    |    3 --
 cpukit/score/cpu/powerpc/Makefile.am               |    1 +
 cpukit/score/cpu/powerpc/ppc-isr-disable-mask.S    |   24 ++++++++++++++++
 cpukit/score/cpu/powerpc/rtems/powerpc/registers.h |   30 +++++++------------
 27 files changed, 46 insertions(+), 90 deletions(-)
 create mode 100644 cpukit/score/cpu/powerpc/ppc-isr-disable-mask.S

diff --git a/c/src/lib/libbsp/powerpc/beatnik/startup/bspstart.c b/c/src/lib/libbsp/powerpc/beatnik/startup/bspstart.c
index 763c9d8..d2501b5 100644
--- a/c/src/lib/libbsp/powerpc/beatnik/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/beatnik/startup/bspstart.c
@@ -242,11 +242,7 @@ void bsp_start( void )
   /*
    * Initialize default raw exception handlers. See vectors/vectors_init.c
    */
-  ppc_exc_initialize(
-		  PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-		  intrStackStart,
-		  intrStackSize
-		  );
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   printk("CPU: %s\n", get_ppc_cpu_type_name(current_ppc_cpu));
 
diff --git a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c
index b22a743..1098de2 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c
@@ -323,11 +323,7 @@ ShowBATS();
   /*
    * Initialize default raw exception hanlders.
    */
-  ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-    intrStackStart,
-    intrStackSize
-  );
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   /*
    * Init MMU block address translation to enable hardware
diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
index 56de4a5..8324b44 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
@@ -170,7 +170,6 @@ void bsp_start(void)
   /* Initialize exception handler */
   ppc_exc_cache_wb_check = 0;
   ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) bsp_interrupt_stack_start,
     (uintptr_t) bsp_interrupt_stack_size
   );
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
index 9abf173..abdc2e2 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
@@ -136,7 +136,6 @@ void bsp_start( void)
   ppc_exc_cache_wb_check = 0;
 #endif
   ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) bsp_section_work_begin,
     rtems_configuration_get_interrupt_stack_size()
   );
diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
index fc7e932..3dfecb6 100644
--- a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
@@ -206,7 +206,6 @@ void bsp_start( void )
    * Initialize default raw exception handlers.
    */
   ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) intrStack_start,
     (uintptr_t) intrStack_size
   );
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c
index 6216754..ffa8500 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c
@@ -114,7 +114,6 @@ void bsp_start(void)
 
   /* Initialize exception handler */
   ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) IntrStack_start,
     (uintptr_t) intrStack - (uintptr_t) IntrStack_start
   );
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
index 7f4f935..ed3ef53 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
@@ -108,7 +108,6 @@ void bsp_start(void)
 
 	/* Initialize exceptions */
 	ppc_exc_initialize_with_vector_base(
-		PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
 		(uintptr_t) bsp_section_work_begin,
 		rtems_configuration_get_interrupt_stack_size(),
 		mpc55xx_exc_vector_base
diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c
index ef18cee..81c6809 100644
--- a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c
@@ -174,7 +174,6 @@ void bsp_start(void)
   /* Initialize exception handler */
   /* FIXME: Interrupt stack begin and size */
   ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) IntrStack_start,
     (uintptr_t) intrStack - (uintptr_t) IntrStack_start
   );
diff --git a/c/src/lib/libbsp/powerpc/mvme3100/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mvme3100/startup/bspstart.c
index 78b79ba..71e72f2 100644
--- a/c/src/lib/libbsp/powerpc/mvme3100/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mvme3100/startup/bspstart.c
@@ -270,11 +270,7 @@ VpdBufRec          vpdData [] = {
 	/*
 	 * Initialize default raw exception handlers.
 	 */
-	ppc_exc_initialize(
-		PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-		intrStackStart,
-		intrStackSize
-	);
+	ppc_exc_initialize(intrStackStart, intrStackSize);
 
 	printk("CPU 0x%x - rev 0x%x\n", myCpu, myCpuRevision);
 
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mvme5500/startup/bspstart.c
index 06e4860..7b97906 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mvme5500/startup/bspstart.c
@@ -245,11 +245,7 @@ void bsp_start( void )
   /*
    * Initialize default raw exception handlers.
    */
-  ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-    intrStackStart,
-    intrStackSize
-  );
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   /*
    * Init MMU block address translation to enable hardware
diff --git a/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c b/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
index b156f4d..881d79a 100644
--- a/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
@@ -99,7 +99,6 @@ void bsp_start( void )
    * Initialize default raw exception handlers.
    */
   ppc_exc_initialize_with_vector_base(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) bsp_section_work_begin,
     rtems_configuration_get_interrupt_stack_size(),
     (void *) 0xfff00000
diff --git a/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c b/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c
index 62c5931..878defa 100644
--- a/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c
@@ -94,11 +94,7 @@ void bsp_start( void )
   /*
    * Initialize default raw exception handlers.
    */
-  ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-    intrStackStart,
-    intrStackSize
-  );
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   /* Install default handler for the decrementer exception */
   sc = ppc_exc_set_handler( ASM_DEC_VECTOR, default_decrementer_exception_handler);
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c b/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
index fe726e3..f514558 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
@@ -110,7 +110,6 @@ void bsp_start(void)
 
   /* Initialize exception handler */
   ppc_exc_initialize_with_vector_base(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) bsp_section_work_begin,
     rtems_configuration_get_interrupt_stack_size(),
     bsp_exc_vector_base
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c b/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
index 9caaa99..38a7305 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
@@ -116,7 +116,6 @@ void qoriq_secondary_cpu_initialize(void)
 
   /* Initialize exception handler */
   ppc_exc_initialize_with_vector_base(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) second_cpu->interrupt_stack_low,
     rtems_configuration_get_interrupt_stack_size(),
     bsp_exc_vector_base
diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c b/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
index 3519a59..8caf955 100644
--- a/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
@@ -194,11 +194,7 @@ void bsp_start( void )
   /*
    * Initialize default raw exception handlers.
    */
-  ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-    intrStackStart,
-    intrStackSize
-  );
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   msr_value = 0x2030;
   _CPU_MSR_SET( msr_value );
diff --git a/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c b/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
index abdb774..e8bd070 100644
--- a/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
@@ -232,11 +232,7 @@ void bsp_start( void )
   /*
    * Initialize default raw exception handlers.
    */
-  ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-    intrStackStart,
-    intrStackSize
-  );
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   boardManufacturer   =  checkPrepBoardType(&residualCopy);
   if (boardManufacturer != PREP_Motorola) {
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c b/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c
index 6d2196a..6b6dd1c 100644
--- a/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c
@@ -68,7 +68,6 @@ void bsp_start(void)
 
   /* Initialize exception handler */
   ppc_exc_initialize_with_vector_base(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) bsp_section_work_begin,
     rtems_configuration_get_interrupt_stack_size(),
     bsp_exc_vector_base
diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c
index 0c3a760..af014c6 100644
--- a/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c
@@ -183,11 +183,7 @@ void bsp_start( void)
   rtems_counter_initialize_converter(bsp_time_base_frequency);
 
   /* Initialize exception handler */
-  ppc_exc_initialize(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-    interrupt_stack_start,
-    interrupt_stack_size
-  );
+  ppc_exc_initialize(interrupt_stack_start, interrupt_stack_size);
 
   /* Initalize interrupt support */
   bsp_interrupt_initialize();
diff --git a/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
index b29509f..1625428 100644
--- a/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
@@ -95,7 +95,6 @@ void bsp_start( void )
    * Initialize default raw exception handlers.
    */
   ppc_exc_initialize_with_vector_base(
-    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
     (uintptr_t) bsp_section_work_begin,
     rtems_configuration_get_interrupt_stack_size(),
     virtex_exc_vector_base
diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
index 7628e8d..85f7847 100644
--- a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
@@ -208,9 +208,7 @@ void bsp_start(void)
   intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start);
   intrStackSize  = rtems_configuration_get_interrupt_stack_size();
 
-  ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-                     intrStackStart,
-                     intrStackSize);
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   /* Let the user know what parameters we were compiled with */
   printk("                  Base/Start     End         Size\n"
diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
index 9a041ca..4ff5b2e 100644
--- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
@@ -228,9 +228,7 @@ void bsp_start(void)
   intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start);
   intrStackSize  = rtems_configuration_get_interrupt_stack_size();
 
-  ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
-                     intrStackStart,
-                     intrStackSize);
+  ppc_exc_initialize(intrStackStart, intrStackSize);
 
   /* Let the user know what parameters we were compiled with */
   printk("                  Base/Start     End         Size\n"
diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c
index 8a21bc0..7693a18 100644
--- a/c/src/lib/libbsp/shared/bootcard.c
+++ b/c/src/lib/libbsp/shared/bootcard.c
@@ -69,14 +69,6 @@ void boot_card(
   rtems_interrupt_level  bsp_isr_level;
 
   /*
-   * Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
-   * It must be valid before we can use rtems_interrupt_disable().
-   */
-  #ifdef PPC_INTERRUPT_DISABLE_MASK_DEFAULT
-    ppc_interrupt_set_disable_mask( PPC_INTERRUPT_DISABLE_MASK_DEFAULT );
-  #endif /* PPC_INTERRUPT_DISABLE_MASK_DEFAULT */
-
-  /*
    *  Make sure interrupts are disabled.
    */
   (void) bsp_isr_level;
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c
index d0f9116..07dfbea 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c
@@ -149,7 +149,6 @@ static void ppc_exc_fatal_error(void)
 }
 
 void ppc_exc_initialize_with_vector_base(
-  uint32_t interrupt_disable_mask,
   uintptr_t interrupt_stack_begin,
   uintptr_t interrupt_stack_size,
   void *vector_base
@@ -191,8 +190,6 @@ void ppc_exc_initialize_with_vector_base(
   PPC_SET_SPECIAL_PURPOSE_REGISTER(SPRG1, interrupt_stack_pointer);
   PPC_SET_SPECIAL_PURPOSE_REGISTER(SPRG2, interrupt_stack_begin);
 
-  ppc_interrupt_set_disable_mask(interrupt_disable_mask);
-
 #ifndef PPC_EXC_CONFIG_BOOKE_ONLY
 
   /* Use current MMU / RI settings when running C exception handlers */
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
index bec81c1..d928d70 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
@@ -361,7 +361,6 @@ rtems_status_code ppc_exc_make_prologue(
  * @see ppc_exc_initialize().
  */
 void ppc_exc_initialize_with_vector_base(
-  uint32_t interrupt_disable_mask,
   uintptr_t interrupt_stack_begin,
   uintptr_t interrupt_stack_size,
   void *vector_base
@@ -381,13 +380,11 @@ void ppc_exc_initialize_with_vector_base(
  * - the minimal prologue creation failed.
  */
 static inline void ppc_exc_initialize(
-  uint32_t interrupt_disable_mask,
   uintptr_t interrupt_stack_begin,
   uintptr_t interrupt_stack_size
 )
 {
   ppc_exc_initialize_with_vector_base(
-    interrupt_disable_mask,
     interrupt_stack_begin,
     interrupt_stack_size,
     NULL
diff --git a/cpukit/score/cpu/powerpc/Makefile.am b/cpukit/score/cpu/powerpc/Makefile.am
index b205762..5934dae 100644
--- a/cpukit/score/cpu/powerpc/Makefile.am
+++ b/cpukit/score/cpu/powerpc/Makefile.am
@@ -16,6 +16,7 @@ noinst_LIBRARIES = libscorecpu.a
 libscorecpu_a_SOURCES = cpu.c
 libscorecpu_a_SOURCES += ppc-context-volatile-clobber.S
 libscorecpu_a_SOURCES += ppc-context-validate.S
+libscorecpu_a_SOURCES += ppc-isr-disable-mask.S
 libscorecpu_a_SOURCES += ppc-isr-vector-install.c
 libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
 
diff --git a/cpukit/score/cpu/powerpc/ppc-isr-disable-mask.S b/cpukit/score/cpu/powerpc/ppc-isr-disable-mask.S
new file mode 100644
index 0000000..4784b65
--- /dev/null
+++ b/cpukit/score/cpu/powerpc/ppc-isr-disable-mask.S
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include <rtems/asm.h>
+#include <rtems/score/cpu.h>
+
+.global	_PPC_INTERRUPT_DISABLE_MASK
+.weak	_PPC_INTERRUPT_DISABLE_MASK
+.set	_PPC_INTERRUPT_DISABLE_MASK, PPC_INTERRUPT_DISABLE_MASK_DEFAULT
diff --git a/cpukit/score/cpu/powerpc/rtems/powerpc/registers.h b/cpukit/score/cpu/powerpc/rtems/powerpc/registers.h
index a64291e..6cf7136 100644
--- a/cpukit/score/cpu/powerpc/rtems/powerpc/registers.h
+++ b/cpukit/score/cpu/powerpc/rtems/powerpc/registers.h
@@ -581,8 +581,8 @@ lidate */
 /**
  * @brief Default value for the interrupt disable mask.
  *
- * The interrupt disable mask is stored in the SPRG0 (= special purpose
- * register 272).
+ * The interrupt disable mask is stored in the global symbol
+ * _PPC_INTERRUPT_DISABLE_MASK.
  */
 #define PPC_INTERRUPT_DISABLE_MASK_DEFAULT MSR_EE
 
@@ -603,25 +603,16 @@ extern "C" {
 #define _CPU_MSR_SET( _msr_value ) \
 { __asm__ volatile ("mtmsr %0" : "=&r" ((_msr_value)) : "0" ((_msr_value))); }
 
-static inline void ppc_interrupt_set_disable_mask( uint32_t mask )
-{
-  __asm__ volatile (
-    "mtspr 272, %0"
-    :
-    : "r" (mask)
-  );
-}
+/**
+ * @brief A global symbol used to disable interrupts in the MSR.
+ *
+ * A one bit means that this bit should be cleared.
+ */
+extern char _PPC_INTERRUPT_DISABLE_MASK[];
 
 static inline uint32_t ppc_interrupt_get_disable_mask( void )
 {
-  uint32_t mask;
-
-  __asm__ volatile (
-    "mfspr %0, 272"
-    : "=r" (mask)
-  );
-
-  return mask;
+  return (uint32_t) _PPC_INTERRUPT_DISABLE_MASK;
 }
 
 static inline uint32_t ppc_interrupt_disable( void )
@@ -631,7 +622,8 @@ static inline uint32_t ppc_interrupt_disable( void )
 
   __asm__ volatile (
     "mfmsr %0;"
-    "mfspr %1, 272;"
+    "lis %1, _PPC_INTERRUPT_DISABLE_MASK at h;"
+    "ori %1, %1, _PPC_INTERRUPT_DISABLE_MASK at l;"
     "andc %1, %0, %1;"
     "mtmsr %1"
     : "=r" (level), "=r" (mask)
-- 
1.7.7




More information about the devel mailing list