[PATCH 3/3] bsps/powerpc: Simplify ppc_exc_initialize()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Sep 5 05:49:01 UTC 2018


Remove parameters from ppc_exc_initialize() since all BSP passed the
same values.

Update #3459.
---
 bsps/powerpc/beatnik/start/bspstart.c               | 18 +-----------------
 bsps/powerpc/gen5200/start/bspstart.c               |  7 ++-----
 bsps/powerpc/gen83xx/start/bspstart.c               |  5 +----
 bsps/powerpc/haleakala/start/bspstart.c             |  8 +-------
 bsps/powerpc/include/bsp/vectors.h                  | 15 ++++-----------
 bsps/powerpc/motorola_powerpc/start/bspstart.c      | 13 +------------
 bsps/powerpc/mpc55xxevb/start/bspstart.c            |  4 ----
 bsps/powerpc/mpc8260ads/start/bspstart.c            |  8 +-------
 bsps/powerpc/mvme3100/start/bspstart.c              | 13 +------------
 bsps/powerpc/mvme5500/start/bspstart.c              | 13 +------------
 bsps/powerpc/psim/start/bspstart.c                  |  4 ----
 bsps/powerpc/qemuppc/start/bspstart.c               | 13 +------------
 bsps/powerpc/qoriq/start/bspsmp.c                   |  3 +--
 bsps/powerpc/qoriq/start/bspstart.c                 |  3 +--
 bsps/powerpc/shared/exceptions/ppc_exc_initialize.c |  3 +--
 bsps/powerpc/shared/start/bspgetworkarea.c          |  3 +--
 bsps/powerpc/t32mppc/start/bspstart.c               |  3 +--
 bsps/powerpc/tqm8xx/start/bspstart.c                |  8 +-------
 bsps/powerpc/virtex/start/bspstart.c                |  4 ----
 bsps/powerpc/virtex4/start/bspstart.c               | 11 +----------
 bsps/powerpc/virtex5/start/bspstart.c               | 11 +----------
 21 files changed, 22 insertions(+), 148 deletions(-)

diff --git a/bsps/powerpc/beatnik/start/bspstart.c b/bsps/powerpc/beatnik/start/bspstart.c
index 91913cd0ed..4c1bb0e16f 100644
--- a/bsps/powerpc/beatnik/start/bspstart.c
+++ b/bsps/powerpc/beatnik/start/bspstart.c
@@ -177,8 +177,6 @@ void bsp_start( void )
 {
   unsigned char  *stack;
   char           *chpt;
-  uintptr_t       intrStackStart;
-  uintptr_t       intrStackSize;
 
   Triv121PgTbl	pt=0;
 
@@ -231,21 +229,7 @@ void bsp_start( void )
 
   *((uint32_t *)stack) = 0;
 
-  /*
-   * Initialize the interrupt related settings
-   * SPRG0 = interrupt nesting level count
-   * SPRG1 = software managed IRQ stack
-   *
-   * This could be done latter (e.g in IRQ_INIT) but it helps to understand
-   * some settings below...
-   */
-  intrStackStart = (uintptr_t)_Configuration_Interrupt_stack_area_begin;
-  intrStackSize  = rtems_configuration_get_interrupt_stack_size();
-
-  /*
-   * Initialize default raw exception handlers. See vectors/vectors_init.c
-   */
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   printk("CPU: %s\n", get_ppc_cpu_type_name(current_ppc_cpu));
 
diff --git a/bsps/powerpc/gen5200/start/bspstart.c b/bsps/powerpc/gen5200/start/bspstart.c
index 0f981ffee0..e52119fe67 100644
--- a/bsps/powerpc/gen5200/start/bspstart.c
+++ b/bsps/powerpc/gen5200/start/bspstart.c
@@ -153,13 +153,10 @@ void bsp_start(void)
 
   /* Initialize exception handler */
   ppc_exc_cache_wb_check = 0;
-  ppc_exc_initialize(
-    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size()
-  );
+  ppc_exc_initialize();
   ppc_exc_set_handler(ASM_ALIGN_VECTOR, ppc_exc_alignment_handler);
 
-  /* Initalize interrupt support */
+  /* Initialize interrupt support */
   bsp_interrupt_initialize();
 
   /*
diff --git a/bsps/powerpc/gen83xx/start/bspstart.c b/bsps/powerpc/gen83xx/start/bspstart.c
index 70fcbea36e..733f43e8ec 100644
--- a/bsps/powerpc/gen83xx/start/bspstart.c
+++ b/bsps/powerpc/gen83xx/start/bspstart.c
@@ -113,10 +113,7 @@ void bsp_start( void)
 #ifndef BSP_DATA_CACHE_ENABLED
   ppc_exc_cache_wb_check = 0;
 #endif
-  ppc_exc_initialize(
-    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size()
-  );
+  ppc_exc_initialize();
 
   /* Install default handler for the decrementer exception */
   sc = ppc_exc_set_handler( ASM_DEC_VECTOR, mpc83xx_decrementer_exception_handler);
diff --git a/bsps/powerpc/haleakala/start/bspstart.c b/bsps/powerpc/haleakala/start/bspstart.c
index 986582955a..61fb376e28 100644
--- a/bsps/powerpc/haleakala/start/bspstart.c
+++ b/bsps/powerpc/haleakala/start/bspstart.c
@@ -181,13 +181,7 @@ void bsp_start( void )
   /* timebase register ticks/microsecond = CPU Clk in MHz */
   bsp_clicks_per_usec = 400;
 
-  /*
-   * Initialize default raw exception handlers.
-   */
-  ppc_exc_initialize(
-    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size()
-  );
+  ppc_exc_initialize();
 
   /*
    * Install our own set of exception vectors
diff --git a/bsps/powerpc/include/bsp/vectors.h b/bsps/powerpc/include/bsp/vectors.h
index 81526eb4b0..88c60bc8cd 100644
--- a/bsps/powerpc/include/bsp/vectors.h
+++ b/bsps/powerpc/include/bsp/vectors.h
@@ -300,11 +300,9 @@ rtems_status_code ppc_exc_make_prologue(
   size_t *prologue_size
 );
 
-static inline void ppc_exc_initialize_interrupt_stack(
-  uintptr_t stack_begin,
-  uintptr_t stack_size
-)
+static inline void ppc_exc_initialize_interrupt_stack(uintptr_t stack_begin)
 {
+  uintptr_t stack_size = rtems_configuration_get_interrupt_stack_size();
   uintptr_t stack_end = stack_begin + stack_size;
   uintptr_t stack_pointer = stack_end - PPC_MINIMUM_STACK_FRAME_SIZE;
 
@@ -326,7 +324,6 @@ static inline void ppc_exc_initialize_interrupt_stack(
  */
 void ppc_exc_initialize_with_vector_base(
   uintptr_t interrupt_stack_begin,
-  uintptr_t interrupt_stack_size,
   void *vector_base
 );
 
@@ -343,14 +340,10 @@ void ppc_exc_initialize_with_vector_base(
  *   SVR4/EABI, or
  * - the minimal prologue creation failed.
  */
-static inline void ppc_exc_initialize(
-  uintptr_t interrupt_stack_begin,
-  uintptr_t interrupt_stack_size
-)
+static inline void ppc_exc_initialize(void)
 {
   ppc_exc_initialize_with_vector_base(
-    interrupt_stack_begin,
-    interrupt_stack_size,
+    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
     NULL
   );
 }
diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index c420f6c19b..b742ae949e 100644
--- a/bsps/powerpc/motorola_powerpc/start/bspstart.c
+++ b/bsps/powerpc/motorola_powerpc/start/bspstart.c
@@ -135,8 +135,6 @@ void bsp_start( void )
 #if !defined(mvme2100)
   unsigned l2cr;
 #endif
-  uintptr_t intrStackStart;
-  uintptr_t intrStackSize;
   prep_t boardManufacturer;
   motorolaBoard myBoard;
   Triv121PgTbl	pt=0;
@@ -217,16 +215,7 @@ void bsp_start( void )
     set_L2CR(0xb9A14000);
 #endif
 
-  /*
-   * Initialize the interrupt related settings.
-   */
-  intrStackStart = (uintptr_t)_Configuration_Interrupt_stack_area_begin;
-  intrStackSize = rtems_configuration_get_interrupt_stack_size();
-
-  /*
-   * Initialize default raw exception handlers.
-   */
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   boardManufacturer   =  checkPrepBoardType(&residualCopy);
   if (boardManufacturer != PREP_Motorola) {
diff --git a/bsps/powerpc/mpc55xxevb/start/bspstart.c b/bsps/powerpc/mpc55xxevb/start/bspstart.c
index b7c1d4b036..5d4c1caf43 100644
--- a/bsps/powerpc/mpc55xxevb/start/bspstart.c
+++ b/bsps/powerpc/mpc55xxevb/start/bspstart.c
@@ -88,14 +88,10 @@ void bsp_start(void)
 	/* Time reference value */
 	bsp_clicks_per_usec = bsp_clock_speed / 1000000;
 
-	/* Initialize exceptions */
 	ppc_exc_initialize_with_vector_base(
 		(uintptr_t) _Configuration_Interrupt_stack_area_begin,
-		rtems_configuration_get_interrupt_stack_size(),
 		mpc55xx_exc_vector_base
 	);
-
-	/* Initialize interrupts */
 	bsp_interrupt_initialize();
 
 	#if MPC55XX_CHIP_FAMILY != 566
diff --git a/bsps/powerpc/mpc8260ads/start/bspstart.c b/bsps/powerpc/mpc8260ads/start/bspstart.c
index 503d96b8a1..11aaecef79 100644
--- a/bsps/powerpc/mpc8260ads/start/bspstart.c
+++ b/bsps/powerpc/mpc8260ads/start/bspstart.c
@@ -138,13 +138,7 @@ void bsp_start(void)
   mmu_init();
 */
 
-  /* Initialize exception handler */
-  ppc_exc_initialize(
-    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size()
-  );
-
-  /* Initalize interrupt support */
+  ppc_exc_initialize();
   bsp_interrupt_initialize();
 
 /*
diff --git a/bsps/powerpc/mvme3100/start/bspstart.c b/bsps/powerpc/mvme3100/start/bspstart.c
index 6f15b2d7a3..28cdcf5ffd 100644
--- a/bsps/powerpc/mvme3100/start/bspstart.c
+++ b/bsps/powerpc/mvme3100/start/bspstart.c
@@ -210,8 +210,6 @@ SPR_RW(HID1)
 void bsp_start( void )
 {
   unsigned char       *stack;
-  uintptr_t            intrStackStart;
-  uintptr_t            intrStackSize;
   char                *chpt;
   int                  i;
   ppc_cpu_id_t         myCpu;
@@ -252,16 +250,7 @@ VpdBufRec          vpdData [] = {
   /* tag the bottom */
   *((uint32_t*)stack) = 0;
 
-  /*
-   * Initialize the interrupt related settings.
-   */
-  intrStackStart = (uintptr_t) _Configuration_Interrupt_stack_area_begin;
-  intrStackSize = rtems_configuration_get_interrupt_stack_size();
-
-  /*
-   * Initialize default raw exception handlers.
-   */
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   printk("CPU 0x%x - rev 0x%x\n", myCpu, myCpuRevision);
 
diff --git a/bsps/powerpc/mvme5500/start/bspstart.c b/bsps/powerpc/mvme5500/start/bspstart.c
index 47d413bc91..c79239e3c9 100644
--- a/bsps/powerpc/mvme5500/start/bspstart.c
+++ b/bsps/powerpc/mvme5500/start/bspstart.c
@@ -188,8 +188,6 @@ void bsp_start( void )
 #ifdef SHOW_LCR3_REGISTER
   unsigned l3cr;
 #endif
-  uintptr_t intrStackStart;
-  uintptr_t intrStackSize;
   Triv121PgTbl  pt=0;
 
   /* Till Straumann: 4/2005
@@ -222,16 +220,7 @@ void bsp_start( void )
   printk("Initial L1CR value = %x\n", l1cr);
 #endif
 
-  /*
-   * Initialize the interrupt related settings.
-   */
-  intrStackStart = (uintptr_t) _Configuration_Interrupt_stack_area_begin;
-  intrStackSize = rtems_configuration_get_interrupt_stack_size();
-
-  /*
-   * Initialize default raw exception handlers.
-   */
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   /*
    * Init MMU block address translation to enable hardware
diff --git a/bsps/powerpc/psim/start/bspstart.c b/bsps/powerpc/psim/start/bspstart.c
index e684097788..a7a73b7e7b 100644
--- a/bsps/powerpc/psim/start/bspstart.c
+++ b/bsps/powerpc/psim/start/bspstart.c
@@ -87,12 +87,8 @@ void bsp_start( void )
   bsp_clicks_per_usec      = BSP_bus_frequency;
   BSP_time_base_divisor    = 1;
 
-  /*
-   * Initialize default raw exception handlers.
-   */
   ppc_exc_initialize_with_vector_base(
     (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size(),
     (void *) 0xfff00000
   );
 
diff --git a/bsps/powerpc/qemuppc/start/bspstart.c b/bsps/powerpc/qemuppc/start/bspstart.c
index de3bba0797..c055b1e851 100644
--- a/bsps/powerpc/qemuppc/start/bspstart.c
+++ b/bsps/powerpc/qemuppc/start/bspstart.c
@@ -66,8 +66,6 @@ uint32_t _CPU_Counter_frequency(void)
 void bsp_start( void )
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
-  uintptr_t intrStackStart;
-  uintptr_t intrStackSize;
 
   /*
    * Note we can not get CPU identification dynamically, so
@@ -84,18 +82,9 @@ void bsp_start( void )
   bsp_time_base_frequency  = 20000000;
   bsp_clicks_per_usec      = BSP_bus_frequency;
 
-  /*
-   * Initialize the interrupt related settings.
-   */
-  intrStackStart = (uintptr_t) _Configuration_Interrupt_stack_area_begin;
-  intrStackSize = rtems_configuration_get_interrupt_stack_size();
-
   BSP_mem_size = (uint32_t )RamSize;
 
-  /*
-   * Initialize default raw exception handlers.
-   */
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   /* Install default handler for the decrementer exception */
   sc = ppc_exc_set_handler( ASM_DEC_VECTOR, default_decrementer_exception_handler);
diff --git a/bsps/powerpc/qoriq/start/bspsmp.c b/bsps/powerpc/qoriq/start/bspsmp.c
index 57a61e0776..b5a2686d96 100644
--- a/bsps/powerpc/qoriq/start/bspsmp.c
+++ b/bsps/powerpc/qoriq/start/bspsmp.c
@@ -47,8 +47,7 @@ static bool is_started_by_u_boot(uint32_t cpu_index)
 void qoriq_start_thread(Per_CPU_Control *cpu_self)
 {
   ppc_exc_initialize_interrupt_stack(
-    (uintptr_t) cpu_self->interrupt_stack_low,
-    rtems_configuration_get_interrupt_stack_size()
+    (uintptr_t) cpu_self->interrupt_stack_low
   );
 
   bsp_interrupt_facility_initialize();
diff --git a/bsps/powerpc/qoriq/start/bspstart.c b/bsps/powerpc/qoriq/start/bspstart.c
index 76af17919e..c0b1034736 100644
--- a/bsps/powerpc/qoriq/start/bspstart.c
+++ b/bsps/powerpc/qoriq/start/bspstart.c
@@ -113,8 +113,7 @@ void qoriq_initialize_exceptions(void *interrupt_stack_begin)
   uintptr_t addr;
 
   ppc_exc_initialize_interrupt_stack(
-    (uintptr_t) interrupt_stack_begin,
-    rtems_configuration_get_interrupt_stack_size()
+    (uintptr_t) interrupt_stack_begin
   );
 
   addr = (uintptr_t) bsp_exc_vector_base;
diff --git a/bsps/powerpc/shared/exceptions/ppc_exc_initialize.c b/bsps/powerpc/shared/exceptions/ppc_exc_initialize.c
index 4891ddcaa0..00498e9f00 100644
--- a/bsps/powerpc/shared/exceptions/ppc_exc_initialize.c
+++ b/bsps/powerpc/shared/exceptions/ppc_exc_initialize.c
@@ -82,7 +82,6 @@ static void ppc_exc_fatal_error(void)
 
 void ppc_exc_initialize_with_vector_base(
   uintptr_t interrupt_stack_begin,
-  uintptr_t interrupt_stack_size,
   void *vector_base
 )
 {
@@ -110,7 +109,7 @@ void ppc_exc_initialize_with_vector_base(
     ppc_exc_fatal_error();
   }
 
-  ppc_exc_initialize_interrupt_stack(interrupt_stack_begin, interrupt_stack_size);
+  ppc_exc_initialize_interrupt_stack(interrupt_stack_begin);
 
 #ifndef PPC_EXC_CONFIG_BOOKE_ONLY
 
diff --git a/bsps/powerpc/shared/start/bspgetworkarea.c b/bsps/powerpc/shared/start/bspgetworkarea.c
index 3c86905020..2ee7a54410 100644
--- a/bsps/powerpc/shared/start/bspgetworkarea.c
+++ b/bsps/powerpc/shared/start/bspgetworkarea.c
@@ -26,8 +26,7 @@ static void bsp_work_area_initialize_later(void)
   uintptr_t work_size;
   uintptr_t work_area;
 
-  work_area = (uintptr_t)__rtems_end +
-              rtems_configuration_get_interrupt_stack_size();
+  work_area = (uintptr_t)__rtems_end;
   work_size = (uintptr_t)BSP_mem_size - work_area;
 
   bsp_work_area_initialize_default((void *) work_area, work_size);
diff --git a/bsps/powerpc/t32mppc/start/bspstart.c b/bsps/powerpc/t32mppc/start/bspstart.c
index 5a42ae1bbf..f7d68340ea 100644
--- a/bsps/powerpc/t32mppc/start/bspstart.c
+++ b/bsps/powerpc/t32mppc/start/bspstart.c
@@ -49,8 +49,7 @@ static void t32mppc_initialize_exceptions(void)
   uintptr_t addr;
 
   ppc_exc_initialize_interrupt_stack(
-    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size()
+    (uintptr_t) _Configuration_Interrupt_stack_area_begin
   );
 
   addr = (uintptr_t) bsp_exc_vector_base;
diff --git a/bsps/powerpc/tqm8xx/start/bspstart.c b/bsps/powerpc/tqm8xx/start/bspstart.c
index 2d0b8e3c7e..b42ce1ce6c 100644
--- a/bsps/powerpc/tqm8xx/start/bspstart.c
+++ b/bsps/powerpc/tqm8xx/start/bspstart.c
@@ -143,13 +143,7 @@ void bsp_start( void)
   bsp_time_base_frequency = BSP_bus_frequency / 16;
   bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
 
-  /* Initialize exception handler */
-  ppc_exc_initialize(
-    (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size()
-  );
-
-  /* Initalize interrupt support */
+  ppc_exc_initialize();
   bsp_interrupt_initialize();
 
 #ifdef SHOW_MORE_INIT_SETTINGS
diff --git a/bsps/powerpc/virtex/start/bspstart.c b/bsps/powerpc/virtex/start/bspstart.c
index 5c0547aa24..64dbb60898 100644
--- a/bsps/powerpc/virtex/start/bspstart.c
+++ b/bsps/powerpc/virtex/start/bspstart.c
@@ -94,12 +94,8 @@ void bsp_start( void )
   get_ppc_cpu_type();
   get_ppc_cpu_revision();
 
-  /*
-   * Initialize default raw exception handlers.
-   */
   ppc_exc_initialize_with_vector_base(
     (uintptr_t) _Configuration_Interrupt_stack_area_begin,
-    rtems_configuration_get_interrupt_stack_size(),
     virtex_exc_vector_base
   );
   __asm__ volatile ("mtevpr %0" : : "r" (virtex_exc_vector_base));
diff --git a/bsps/powerpc/virtex4/start/bspstart.c b/bsps/powerpc/virtex4/start/bspstart.c
index 93890c1623..656745139b 100644
--- a/bsps/powerpc/virtex4/start/bspstart.c
+++ b/bsps/powerpc/virtex4/start/bspstart.c
@@ -141,9 +141,6 @@ uint32_t _CPU_Counter_frequency(void)
  */
 void bsp_start(void)
 {
-  uintptr_t          intrStackStart;
-  uintptr_t          intrStackSize;
-
   ppc_cpu_id_t       myCpu;
   ppc_cpu_revision_t myCpuRevision;
 
@@ -168,13 +165,7 @@ void bsp_start(void)
   /* Timebase register ticks/microsecond;  The application may override these */
   bsp_clicks_per_usec        = 350;
 
-  /*
-   * Initialize the interrupt related settings.
-   */
-  intrStackStart = (uintptr_t) _Configuration_Interrupt_stack_area_begin;
-  intrStackSize  = rtems_configuration_get_interrupt_stack_size();
-
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   /* Let the user know what parameters we were compiled with */
   printk("                  Base/Start     End         Size\n"
diff --git a/bsps/powerpc/virtex5/start/bspstart.c b/bsps/powerpc/virtex5/start/bspstart.c
index 8297b164b6..9e70ce4564 100644
--- a/bsps/powerpc/virtex5/start/bspstart.c
+++ b/bsps/powerpc/virtex5/start/bspstart.c
@@ -155,9 +155,6 @@ uint32_t _CPU_Counter_frequency(void)
  */
 void bsp_start(void)
 {
-  uintptr_t          intrStackStart;
-  uintptr_t          intrStackSize;
-
   ppc_cpu_id_t       myCpu;
   ppc_cpu_revision_t myCpuRevision;
 
@@ -187,13 +184,7 @@ void bsp_start(void)
   /* Timebase register ticks/microsecond;  The application may override these */
   bsp_clicks_per_usec        = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
 
-  /*
-   * Initialize the interrupt related settings.
-   */
-  intrStackStart = (uintptr_t)_Configuration_Interrupt_stack_area_begin;
-  intrStackSize  = rtems_configuration_get_interrupt_stack_size();
-
-  ppc_exc_initialize(intrStackStart, intrStackSize);
+  ppc_exc_initialize();
 
   /* Let the user know what parameters we were compiled with */
   printk("                  Base/Start     End         Size\n"
-- 
2.13.7




More information about the devel mailing list