[PATCH] Remove Clock_driver_support_shutdown_hardware()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 19 06:16:48 UTC 2018


The aim of this clock driver hook was to stop clock tick interrupts at
some late point in the exit() procedure.

The use of atexit() pulls in malloc() which pulls in errno. It is
incompatible with the intention of the
CONFIGURE_DISABLE_NEWLIB_REENTRANCY configuration option.

The exit() function must be called from thread context, so accompanied
clock tick interrupts should cause no harm.  On the contrary, someone
may assume a normal operating system operation, e.g. working timeouts.

Remove the Clock_driver_support_shutdown_hardware() clock driver hook.

Close #3436.
---
 bsps/arm/beagle/clock/clock.c                | 24 -------------------
 bsps/arm/csb336/clock/clockdrv.c             | 13 -----------
 bsps/arm/csb337/clock/clock.c                |  5 ----
 bsps/arm/edb7312/clock/clockdrv.c            | 11 ---------
 bsps/arm/gumstix/clock/clock.c               |  5 ----
 bsps/arm/raspberrypi/clock/clockdrv.c        |  7 ------
 bsps/arm/rtl22xx/clock/clockdrv.c            | 13 -----------
 bsps/arm/shared/clock/clock-a9mpcore.c       | 35 ----------------------------
 bsps/arm/shared/clock/clock-armv7m.c         | 10 --------
 bsps/arm/shared/clock/clock-nxp-lpc.c        | 20 ----------------
 bsps/arm/smdk2410/clock/clockdrv.c           | 12 ----------
 bsps/arm/tms570/clock/clock.c                | 16 -------------
 bsps/i386/pc386/clock/ckinit.c               | 24 -------------------
 bsps/lm32/shared/clock/ckinit.c              |  7 ------
 bsps/lm32/shared/milkymist_clock/ckinit.c    |  6 -----
 bsps/m68k/av5282/clock/clock.c               |  8 -------
 bsps/m68k/gen68360/clock/clock.c             |  8 -------
 bsps/m68k/genmcf548x/clock/clock.c           |  8 -------
 bsps/m68k/mcf52235/clock/clock.c             |  8 -------
 bsps/m68k/mcf5225x/clock/clock.c             |  8 -------
 bsps/m68k/mcf5235/clock/clock.c              |  8 -------
 bsps/m68k/mcf5329/clock/clock.c              |  8 -------
 bsps/m68k/uC5282/clock/clock.c               |  8 -------
 bsps/mips/csb350/clock/clockdrv.c            |  2 --
 bsps/mips/jmr3904/clock/clockdrv.c           |  2 --
 bsps/mips/rbtx4925/clock/clockdrv.c          | 12 ----------
 bsps/mips/rbtx4938/clock/clockdrv.c          | 14 -----------
 bsps/mips/shared/clock/clockdrv.c            |  5 ----
 bsps/nios2/nios2_iss/clock/clock.c           |  8 -------
 bsps/or1k/generic_or1k/clock/clockdrv.c      | 17 --------------
 bsps/powerpc/mpc55xxevb/clock/clock-config.c | 10 --------
 bsps/powerpc/qoriq/clock/clock-config.c      | 19 ---------------
 bsps/riscv/riscv_generic/clock/clockdrv.c    |  9 -------
 bsps/shared/dev/clock/clock-simidle.c        | 25 ++++++--------------
 bsps/shared/dev/clock/clockimpl.h            | 21 +----------------
 bsps/sparc/erc32/clock/ckinit.c              |  9 -------
 bsps/sparc/leon2/clock/ckinit.c              |  6 -----
 bsps/sparc/leon3/clock/ckinit.c              |  6 -----
 bsps/sparc/shared/btimer/tlib_ckinit.c       | 14 -----------
 bsps/sparc64/shared/clock/ckinit.c           |  5 ----
 40 files changed, 8 insertions(+), 448 deletions(-)

diff --git a/bsps/arm/beagle/clock/clock.c b/bsps/arm/beagle/clock/clock.c
index d8b2062e80..d42b051c98 100644
--- a/bsps/arm/beagle/clock/clock.c
+++ b/bsps/arm/beagle/clock/clock.c
@@ -290,34 +290,10 @@ static void beagle_clock_handler_install(rtems_interrupt_handler isr)
   clock_isr = isr;
 }
 
-static void beagle_clock_cleanup(void)
-{
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  /* Disable timer */
-  mmio_clear(timer->base + timer->regs->TCLR, OMAP3_TCLR_ST);
-
-  /* Remove interrupt handler */
-  sc = rtems_interrupt_handler_remove(
-    timer->irq_nr,
-    clock_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(0xdeadbeef);
-  }
-  clock_isr = NULL;
-
-  /* stop frclock */
-  mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST);
-}
-
 #define Clock_driver_support_at_tick() beagle_clock_at_tick()
 #define Clock_driver_support_initialize_hardware() beagle_clock_initialize()
 #define Clock_driver_support_install_isr(isr) \
   beagle_clock_handler_install(isr)
 
-#define Clock_driver_support_shutdown_hardware() beagle_clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/csb336/clock/clockdrv.c b/bsps/arm/csb336/clock/clockdrv.c
index ec566154e1..58f98d87be 100644
--- a/bsps/arm/csb336/clock/clockdrv.c
+++ b/bsps/arm/csb336/clock/clockdrv.c
@@ -82,19 +82,6 @@ rtems_irq_connect_data clock_isr_data = {
      } while (0)
 
 /**
- * Do whatever you need to shut the clock down and remove the
- * interrupt handler. Since this normally only gets called on
- * RTEMS shutdown, you may not need to do anything other than
- * remove the ISR.
- */
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-    /* Disable timer */ \
-    MC9328MXL_TMR1_TCTL = 0; \
-    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
-  } while (0)
-
-/**
  * Enables clock interrupt.
  *
  * If the interrupt is always on, this can be a NOP.
diff --git a/bsps/arm/csb337/clock/clock.c b/bsps/arm/csb337/clock/clock.c
index 5611144112..69a3dafd81 100644
--- a/bsps/arm/csb337/clock/clock.c
+++ b/bsps/arm/csb337/clock/clock.c
@@ -103,11 +103,6 @@ static void Clock_driver_support_initialize_hardware(void)
     (void) st_str; /* avoid set but not used warning */ \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    BSP_remove_rtems_irq_handler(&clock_isr_data); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/edb7312/clock/clockdrv.c b/bsps/arm/edb7312/clock/clockdrv.c
index 26839f35ca..8c7cc4f26a 100644
--- a/bsps/arm/edb7312/clock/clockdrv.c
+++ b/bsps/arm/edb7312/clock/clockdrv.c
@@ -56,17 +56,6 @@ void Clock_isr(void * arg);
     *EP7312_TC1EOI = 0xFFFFFFFF;                    \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware()    \
-  do {                                              \
-    rtems_status_code status = RTEMS_SUCCESSFUL;    \
-    status = rtems_interrupt_handler_remove(        \
-        BSP_TC1OI,                                  \
-        Clock_isr,                                  \
-        NULL                                        \
-    );                                              \
-    assert(status == RTEMS_SUCCESSFUL);             \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/gumstix/clock/clock.c b/bsps/arm/gumstix/clock/clock.c
index 0c4e1f8758..c844f50a37 100644
--- a/bsps/arm/gumstix/clock/clock.c
+++ b/bsps/arm/gumstix/clock/clock.c
@@ -108,11 +108,6 @@ static void Clock_driver_support_initialize_hardware(void)
     XSCALE_OS_TIMER_MR0 = XSCALE_OS_TIMER_TCR + period_num; \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    BSP_remove_rtems_irq_handler(&clock_isr_data); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c b/bsps/arm/raspberrypi/clock/clockdrv.c
index 2f6ec5b142..9954d41741 100644
--- a/bsps/arm/raspberrypi/clock/clockdrv.c
+++ b/bsps/arm/raspberrypi/clock/clockdrv.c
@@ -95,17 +95,10 @@ static void raspberrypi_clock_initialize_hardware(void)
   rtems_timecounter_install(&raspberrypi_tc);
 }
 
-static void raspberrypi_clock_cleanup(void)
-{
-  bsp_interrupt_vector_disable(BCM2835_IRQ_ID_GPU_TIMER_M3);
-}
-
 #define Clock_driver_support_at_tick() raspberrypi_clock_at_tick()
 
 #define Clock_driver_support_initialize_hardware() raspberrypi_clock_initialize_hardware()
 
-#define Clock_driver_support_shutdown_hardware() raspberrypi_clock_cleanup()
-
 #define Clock_driver_support_install_isr(clock_isr) \
   raspberrypi_clock_handler_install_isr(clock_isr)
 
diff --git a/bsps/arm/rtl22xx/clock/clockdrv.c b/bsps/arm/rtl22xx/clock/clockdrv.c
index 84ab9c063b..0e8fa274a7 100644
--- a/bsps/arm/rtl22xx/clock/clockdrv.c
+++ b/bsps/arm/rtl22xx/clock/clockdrv.c
@@ -127,19 +127,6 @@ rtems_irq_connect_data clock_isr_data = {
   } while (0)
 
 /**
- * Do whatever you need to shut the clock down and remove the
- * interrupt handler. Since this normally only gets called on
- * RTEMS shutdown, you may not need to do anything other than
- * remove the ISR.
- */
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-    /* Disable timer */ \
-    T0TCR&=~0x02; \
-    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
-  } while (0)
-
-/**
  * Enables clock interrupt.
  *
  * If the interrupt is always on, this can be a NOP.
diff --git a/bsps/arm/shared/clock/clock-a9mpcore.c b/bsps/arm/shared/clock/clock-a9mpcore.c
index a68a627c5b..05d3c0961d 100644
--- a/bsps/arm/shared/clock/clock-a9mpcore.c
+++ b/bsps/arm/shared/clock/clock-a9mpcore.c
@@ -169,38 +169,6 @@ CPU_Counter_ticks _CPU_Counter_read(void)
   return gt->cntrlower;
 }
 
-static void a9mpcore_clock_cleanup_isr(void *arg)
-{
-  volatile a9mpcore_gt *gt = A9MPCORE_GT;
-
-  (void) arg;
-
-  gt->ctrl &= A9MPCORE_GT_CTRL_TMR_EN;
-  gt->irqst = A9MPCORE_GT_IRQST_EFLG;
-}
-
-static void a9mpcore_clock_cleanup(void)
-{
-  rtems_status_code sc;
-
-  /*
-   * The relevant registers / bits of the global timer are banked and chances
-   * are on an SPM system, that we are executing on the wrong CPU to reset
-   * them. Thus we will have the actual cleanup done with the next clock tick.
-   * The ISR will execute on the right CPU for the cleanup.
-   */
-  sc = rtems_interrupt_handler_install(
-    A9MPCORE_IRQ_GT,
-    "Clock",
-    RTEMS_INTERRUPT_REPLACE,
-    a9mpcore_clock_cleanup_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE);
-  }
-}
-
 #define Clock_driver_support_at_tick() \
   a9mpcore_clock_at_tick()
 
@@ -210,8 +178,5 @@ static void a9mpcore_clock_cleanup(void)
 #define Clock_driver_support_install_isr(isr) \
   a9mpcore_clock_handler_install()
 
-#define Clock_driver_support_shutdown_hardware() \
-  a9mpcore_clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/shared/clock/clock-armv7m.c b/bsps/arm/shared/clock/clock-armv7m.c
index 2efe4c2654..7a51690562 100644
--- a/bsps/arm/shared/clock/clock-armv7m.c
+++ b/bsps/arm/shared/clock/clock-armv7m.c
@@ -88,22 +88,12 @@ RTEMS_SYSINIT_ITEM(
   RTEMS_SYSINIT_ORDER_FIRST
 );
 
-static void _ARMV7M_Clock_cleanup(void)
-{
-  volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
-
-  systick->csr = 0;
-}
-
 #define Clock_driver_support_initialize_hardware() \
   _ARMV7M_Clock_initialize()
 
 #define Clock_driver_support_install_isr(isr) \
   _ARMV7M_Clock_handler_install()
 
-#define Clock_driver_support_shutdown_hardware() \
-  _ARMV7M_Clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../../shared/dev/clock/clockimpl.h"
 
diff --git a/bsps/arm/shared/clock/clock-nxp-lpc.c b/bsps/arm/shared/clock/clock-nxp-lpc.c
index c551f75f68..feb7f83ff8 100644
--- a/bsps/arm/shared/clock/clock-nxp-lpc.c
+++ b/bsps/arm/shared/clock/clock-nxp-lpc.c
@@ -105,31 +105,11 @@ static void lpc_clock_initialize(void)
   rtems_timecounter_install(&lpc_clock_tc);
 }
 
-static void lpc_clock_cleanup(void)
-{
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  /* Disable timer */
-  lpc_clock->tcr = 0x0;
-
-  /* Remove interrupt handler */
-  sc = rtems_interrupt_handler_remove(
-    LPC_CLOCK_INTERRUPT,
-    (rtems_interrupt_handler) Clock_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(0xdeadbeef);
-  }
-}
-
 #define Clock_driver_support_at_tick() lpc_clock_at_tick()
 #define Clock_driver_support_initialize_hardware() lpc_clock_initialize()
 #define Clock_driver_support_install_isr(isr) \
   lpc_clock_handler_install()
 
-#define Clock_driver_support_shutdown_hardware() lpc_clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../../shared/dev/clock/clockimpl.h"
 
diff --git a/bsps/arm/smdk2410/clock/clockdrv.c b/bsps/arm/smdk2410/clock/clockdrv.c
index 0430826254..6e32b7daed 100644
--- a/bsps/arm/smdk2410/clock/clockdrv.c
+++ b/bsps/arm/smdk2410/clock/clockdrv.c
@@ -76,18 +76,6 @@ rtems_irq_connect_data clock_isr_data = {
     } while (0)
 
 /**
- * Do whatever you need to shut the clock down and remove the
- * interrupt handler. Since this normally only gets called on
- * RTEMS shutdown, you may not need to do anything other than
- * remove the ISR.
- */
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-        /* Disable timer */ \
-        BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
-     } while (0)
-
-/**
  * Enables clock interrupt.
  *
  * If the interrupt is always on, this can be a NOP.
diff --git a/bsps/arm/tms570/clock/clock.c b/bsps/arm/tms570/clock/clock.c
index 2c1a54b70e..8290504396 100644
--- a/bsps/arm/tms570/clock/clock.c
+++ b/bsps/arm/tms570/clock/clock.c
@@ -159,28 +159,12 @@ static void tms570_clock_driver_support_install_isr(
   }
 }
 
-/**
- * @brief disables RTI interrupt
- *
- * Called when closing clock driver
- *
- * @retval Void
- */
-static void tms570_clock_driver_support_shutdown_hardware( void )
-{
-  /* turn off the timer interrupts */
-  TMS570_RTI.CLEARINTENA = TMS570_RTI_CLEARINTENA_CLEAROVL0INT |
-                           TMS570_RTI_CLEARINTENA_CLEARINT0;  
-}
-
 #define Clock_driver_support_initialize_hardware \
                         tms570_clock_driver_support_initialize_hardware
 #define Clock_driver_support_at_tick \
                         tms570_clock_driver_support_at_tick
 #define Clock_driver_support_initialize_hardware \
                         tms570_clock_driver_support_initialize_hardware
-#define Clock_driver_support_shutdown_hardware \
-                        tms570_clock_driver_support_shutdown_hardware
 
 #define Clock_driver_support_install_isr(Clock_isr) \
               tms570_clock_driver_support_install_isr( Clock_isr )
diff --git a/bsps/i386/pc386/clock/ckinit.c b/bsps/i386/pc386/clock/ckinit.c
index fce267bda7..afd5d01f1e 100644
--- a/bsps/i386/pc386/clock/ckinit.c
+++ b/bsps/i386/pc386/clock/ckinit.c
@@ -38,7 +38,6 @@ uint32_t pc386_clock_click_count;
 
 /* forward declaration */
 void Clock_isr(void *param);
-static void clockOff(void);
 static void Clock_isr_handler(void *param);
 
 /*
@@ -173,17 +172,6 @@ static void clockOn(void)
     calibrate_tsc();
 }
 
-static void clockOff(void)
-{
-  rtems_interrupt_lock_context lock_context;
-  rtems_interrupt_lock_acquire(&rtems_i386_i8254_access_lock, &lock_context);
-  /* reset timer mode to standard (BIOS) value */
-  outport_byte(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
-  outport_byte(TIMER_CNTR0, 0);
-  outport_byte(TIMER_CNTR0, 0);
-  rtems_interrupt_lock_release(&rtems_i386_i8254_access_lock, &lock_context);
-} /* Clock_exit */
-
 bool Clock_isr_enabled = false;
 static void Clock_isr_handler(void *param)
 {
@@ -247,16 +235,4 @@ void Clock_driver_support_initialize_hardware(void)
   Clock_isr_enabled = true;
 }
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    rtems_status_code status; \
-    clockOff(); \
-    status = rtems_interrupt_handler_remove(  \
-      BSP_PERIODIC_TIMER, \
-      Clock_isr_handler,  \
-      NULL  \
-    );  \
-    assert(status == RTEMS_SUCCESSFUL); \
-  } while (0)
-
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/lm32/shared/clock/ckinit.c b/bsps/lm32/shared/clock/ckinit.c
index 4d235e744f..4c64d4770f 100644
--- a/bsps/lm32/shared/clock/ckinit.c
+++ b/bsps/lm32/shared/clock/ckinit.c
@@ -65,13 +65,6 @@ static void Clock_driver_support_initialize_hardware(void)
   lm32_interrupt_unmask(CLOCK_IRQMASK);
 }
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    /* Disable clock interrupts and stop */ \
-    lm32_interrupt_unmask(CLOCK_IRQMASK); \
-    clockwrite(LM32_CLOCK_CR, LM32_CLOCK_CR_STOP); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/lm32/shared/milkymist_clock/ckinit.c b/bsps/lm32/shared/milkymist_clock/ckinit.c
index c138309982..b10eb858c7 100644
--- a/bsps/lm32/shared/milkymist_clock/ckinit.c
+++ b/bsps/lm32/shared/milkymist_clock/ckinit.c
@@ -41,12 +41,6 @@ static void Clock_driver_support_initialize_hardware(void)
   bsp_interrupt_vector_enable(MM_IRQ_TIMER0);
 }
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    bsp_interrupt_vector_disable(MM_IRQ_TIMER0); \
-    MM_WRITE(MM_TIMER0_CONTROL, 0); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/m68k/av5282/clock/clock.c b/bsps/m68k/av5282/clock/clock.c
index f6e42f254d..b1e169b4c9 100644
--- a/bsps/m68k/av5282/clock/clock.c
+++ b/bsps/m68k/av5282/clock/clock.c
@@ -26,14 +26,6 @@
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()   \
-    do {                                           \
-        MCF5282_PIT3_PCSR &= ~MCF5282_PIT_PCSR_EN; \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every 10,000 microseconds
diff --git a/bsps/m68k/gen68360/clock/clock.c b/bsps/m68k/gen68360/clock/clock.c
index b95ca5d275..4bd3204fcb 100644
--- a/bsps/m68k/gen68360/clock/clock.c
+++ b/bsps/m68k/gen68360/clock/clock.c
@@ -55,14 +55,6 @@ static unsigned long nsec;
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-    do {                       \
-        m360.pitr &= ~0xFF;    \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *     The rate at which the periodic interval timer
  *     can generate interrupts is almost certainly not
diff --git a/bsps/m68k/genmcf548x/clock/clock.c b/bsps/m68k/genmcf548x/clock/clock.c
index 68b7c5f61b..b3a574dab6 100644
--- a/bsps/m68k/genmcf548x/clock/clock.c
+++ b/bsps/m68k/genmcf548x/clock/clock.c
@@ -73,14 +73,6 @@
     set_vector(_new, CLOCK_IRQ + 64, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()                         \
-    do {                                                                 \
-        MCF548X_SLT_SCR0 &= ~(MCF548X_SLT_SCR_TEN | MCF548X_SLT_SCR_RUN | MCF548X_SLT_SCR_IEN); \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every 10,000 microseconds
diff --git a/bsps/m68k/mcf52235/clock/clock.c b/bsps/m68k/mcf52235/clock/clock.c
index a879a770b1..d5e1817536 100644
--- a/bsps/m68k/mcf52235/clock/clock.c
+++ b/bsps/m68k/mcf52235/clock/clock.c
@@ -53,14 +53,6 @@ static void mcf52235_tc_tick(void)
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every rtems_configuration_get_microseconds_per_tick()
diff --git a/bsps/m68k/mcf5225x/clock/clock.c b/bsps/m68k/mcf5225x/clock/clock.c
index b01c37aef7..9a9c7cabe4 100644
--- a/bsps/m68k/mcf5225x/clock/clock.c
+++ b/bsps/m68k/mcf5225x/clock/clock.c
@@ -53,14 +53,6 @@ static void mcf5225x_tc_tick(void)
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every BSP_rtems_configuration_get_microseconds_per_tick()
diff --git a/bsps/m68k/mcf5235/clock/clock.c b/bsps/m68k/mcf5235/clock/clock.c
index db3a5850fb..8b848de006 100644
--- a/bsps/m68k/mcf5235/clock/clock.c
+++ b/bsps/m68k/mcf5235/clock/clock.c
@@ -26,14 +26,6 @@
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()   \
-    do {                                           \
-        MCF5235_PIT_PCSR3 &= ~MCF5235_PIT_PCSR_EN; \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every 10,000 microseconds
diff --git a/bsps/m68k/mcf5329/clock/clock.c b/bsps/m68k/mcf5329/clock/clock.c
index 5638238921..6ad46fe5a1 100644
--- a/bsps/m68k/mcf5329/clock/clock.c
+++ b/bsps/m68k/mcf5329/clock/clock.c
@@ -53,14 +53,6 @@ static void mcf5329_tc_tick(void)
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    MCF_PIT3_PCSR &= ~MCF_PIT_PCSR_EN; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every rtems_configuration_get_microseconds_per_tick()
diff --git a/bsps/m68k/uC5282/clock/clock.c b/bsps/m68k/uC5282/clock/clock.c
index 8fffdc0457..b156d660b1 100644
--- a/bsps/m68k/uC5282/clock/clock.c
+++ b/bsps/m68k/uC5282/clock/clock.c
@@ -79,14 +79,6 @@ static void uC5282_tc_tick(void)
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()   \
-    do {                                           \
-        MCF5282_PIT3_PCSR &= ~MCF5282_PIT_PCSR_EN; \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * f_pit = f_clk / 2^(preScaleCode+1) / N  = 1/(us_per_tick/us_per_s)
diff --git a/bsps/mips/csb350/clock/clockdrv.c b/bsps/mips/csb350/clock/clockdrv.c
index e42261e529..3816bc1ef3 100644
--- a/bsps/mips/csb350/clock/clockdrv.c
+++ b/bsps/mips/csb350/clock/clockdrv.c
@@ -83,8 +83,6 @@ void au1x00_clock_init(void)
      au1x00_clock_init(); \
   } while(0)
 
-#define Clock_driver_support_shutdown_hardware()
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/jmr3904/clock/clockdrv.c b/bsps/mips/jmr3904/clock/clockdrv.c
index e0539f1f3f..29f616f42f 100644
--- a/bsps/mips/jmr3904/clock/clockdrv.c
+++ b/bsps/mips/jmr3904/clock/clockdrv.c
@@ -43,8 +43,6 @@
     *((volatile uint32_t*) 0xFFFFC01C) = 0x00000700; \
   } while(0)
 
-#define Clock_driver_support_shutdown_hardware()
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/rbtx4925/clock/clockdrv.c b/bsps/mips/rbtx4925/clock/clockdrv.c
index 2a3121a58e..395be9f320 100644
--- a/bsps/mips/rbtx4925/clock/clockdrv.c
+++ b/bsps/mips/rbtx4925/clock/clockdrv.c
@@ -103,18 +103,6 @@
   } while(0)
 
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-  	uint32_t temp; \
-    temp = TX4925_REG_READ( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_ITMR ); /* Disable interval timer interrupt */ \
-    temp &= ~TIMER_INT_ENABLE_MASK; \
-    TX4925_REG_WRITE( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_ITMR, temp ); \
-    temp = TX4925_REG_READ( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_PGMR ); /* Disable pulse generator interrupt */ \
-    temp &= ~(TPIAE | TPIBE); \
-    TX4925_REG_WRITE( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_PGMR, temp ); \
-    TX4925_REG_WRITE( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_TCR, 0x0 ); /* Disable timer */ \
-  } while(0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/rbtx4938/clock/clockdrv.c b/bsps/mips/rbtx4938/clock/clockdrv.c
index 616defc91e..c952424f42 100644
--- a/bsps/mips/rbtx4938/clock/clockdrv.c
+++ b/bsps/mips/rbtx4938/clock/clockdrv.c
@@ -100,20 +100,6 @@ void new_brk_esr(void)
   } while(0)
 
 
-
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-  	uint32_t temp; \
-    temp = TX4938_REG_READ( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_ITMR ); /* Disable interval timer interrupt */ \
-    temp &= ~TIMER_INT_ENABLE_MASK; \
-    TX4938_REG_WRITE( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_ITMR, temp ); \
-    temp = TX4938_REG_READ( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_PGMR ); /* Disable pulse generator interrupt */ \
-    temp &= ~(TPIAE | TPIBE); \
-    TX4938_REG_WRITE( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_PGMR, temp ); \
-    TX4938_REG_WRITE( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_TCR, 0x0 ); /* Disable timer */ \
-  } while(0)
-
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/shared/clock/clockdrv.c b/bsps/mips/shared/clock/clockdrv.c
index 658666c887..f1074a652a 100644
--- a/bsps/mips/shared/clock/clockdrv.c
+++ b/bsps/mips/shared/clock/clockdrv.c
@@ -39,11 +39,6 @@ static uint32_t mips_timer_rate = 0;
     mips_enable_in_interrupt_mask(CLOCK_VECTOR_MASK); \
   } while(0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    mips_disable_in_interrupt_mask(CLOCK_VECTOR_MASK); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/nios2/nios2_iss/clock/clock.c b/bsps/nios2/nios2_iss/clock/clock.c
index 0ec0a71c71..5b9b6bb1b5 100644
--- a/bsps/nios2/nios2_iss/clock/clock.c
+++ b/bsps/nios2/nios2_iss/clock/clock.c
@@ -22,14 +22,6 @@
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  */
 static void Clock_driver_support_initialize_hardware(void)
diff --git a/bsps/or1k/generic_or1k/clock/clockdrv.c b/bsps/or1k/generic_or1k/clock/clockdrv.c
index d9c2944703..059cbd7549 100644
--- a/bsps/or1k/generic_or1k/clock/clockdrv.c
+++ b/bsps/or1k/generic_or1k/clock/clockdrv.c
@@ -112,21 +112,6 @@ static void generic_or1k_clock_initialize(void)
   rtems_timecounter_install(&or1ksim_tc);
 }
 
-static void generic_or1k_clock_cleanup(void)
-{
- uint32_t sr;
-
-  sr = _OR1K_mfspr(CPU_OR1K_SPR_SR);
-
-  /* Disable tick timer exceptions */
-  _OR1K_mtspr(CPU_OR1K_SPR_SR, (sr & ~CPU_OR1K_SPR_SR_IEE)
-  & ~CPU_OR1K_SPR_SR_TEE);
-
-  /* Invalidate tick timer config registers */
-  _OR1K_mtspr(CPU_OR1K_SPR_TTCR, 0);
-  _OR1K_mtspr(CPU_OR1K_SPR_TTMR, 0);
-}
-
 #define Clock_driver_support_at_tick() generic_or1k_clock_at_tick()
 
 #define Clock_driver_support_initialize_hardware() generic_or1k_clock_initialize()
@@ -134,6 +119,4 @@ static void generic_or1k_clock_cleanup(void)
 #define Clock_driver_support_install_isr(isr) \
   generic_or1k_clock_handler_install(isr)
 
-#define Clock_driver_support_shutdown_hardware() generic_or1k_clock_cleanup()
-
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/powerpc/mpc55xxevb/clock/clock-config.c b/bsps/powerpc/mpc55xxevb/clock/clock-config.c
index 41320c842c..2c2122a7c6 100644
--- a/bsps/powerpc/mpc55xxevb/clock/clock-config.c
+++ b/bsps/powerpc/mpc55xxevb/clock/clock-config.c
@@ -235,14 +235,6 @@ static void mpc55xx_clock_initialize(void)
   );
 }
 
-static void mpc55xx_clock_cleanup(void)
-{
-  volatile PIT_RTI_CHANNEL_tag *channel =
-    &PIT_RTI.CHANNEL [MPC55XX_CLOCK_PIT_CHANNEL];
-
-  channel->TCTRL.R = 0;
-}
-
 #endif
 
 #define Clock_driver_timecounter_tick() mpc55xx_tc_tick()
@@ -250,8 +242,6 @@ static void mpc55xx_clock_cleanup(void)
   mpc55xx_clock_initialize()
 #define Clock_driver_support_install_isr(isr) \
   mpc55xx_clock_handler_install(isr)
-#define Clock_driver_support_shutdown_hardware() \
-  mpc55xx_clock_cleanup()
 
 /* Include shared source clock driver code */
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/powerpc/qoriq/clock/clock-config.c b/bsps/powerpc/qoriq/clock/clock-config.c
index 335b1564ab..6fb28ce266 100644
--- a/bsps/powerpc/qoriq/clock/clock-config.c
+++ b/bsps/powerpc/qoriq/clock/clock-config.c
@@ -144,31 +144,12 @@ static void qoriq_clock_initialize(void)
   rtems_timecounter_install(&qoriq_clock_tc);
 }
 
-static void qoriq_clock_cleanup(void)
-{
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  qoriq_clock->bcr = GTBCR_CI;
-
-  sc = rtems_interrupt_handler_remove(
-    CLOCK_INTERRUPT,
-    Clock_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(0xdeadbeef);
-  }
-}
-
 #define Clock_driver_support_install_isr(clock_isr) \
   qoriq_clock_handler_install()
 
 #define Clock_driver_support_set_interrupt_affinity(online_processors) \
   bsp_interrupt_set_affinity(CLOCK_INTERRUPT, online_processors)
 
-#define Clock_driver_support_shutdown_hardware() \
-  qoriq_clock_cleanup()
-
 #endif /* QORIQ_IS_HYPERVISOR_GUEST */
 
 #define Clock_driver_support_initialize_hardware() \
diff --git a/bsps/riscv/riscv_generic/clock/clockdrv.c b/bsps/riscv/riscv_generic/clock/clockdrv.c
index 444eb89184..9db96ee4cd 100644
--- a/bsps/riscv/riscv_generic/clock/clockdrv.c
+++ b/bsps/riscv/riscv_generic/clock/clockdrv.c
@@ -104,13 +104,6 @@ static void riscv_generic_clock_initialize(void)
   rtems_timecounter_install(&riscv_generic_tc);
 }
 
-static void riscv_generic_clock_cleanup(void)
-{
-  /* Disable mtimer interrupts */
-  clear_csr(mie, MIP_MTIP);
-  clear_csr(mip, MIP_MTIP);
-}
-
 #define Clock_driver_support_at_tick() riscv_generic_clock_at_tick()
 
 #define Clock_driver_support_initialize_hardware() riscv_generic_clock_initialize()
@@ -118,6 +111,4 @@ static void riscv_generic_clock_cleanup(void)
 #define Clock_driver_support_install_isr(isr) \
   riscv_generic_clock_handler_install(isr)
 
-#define Clock_driver_support_shutdown_hardware() riscv_generic_clock_cleanup()
-
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/shared/dev/clock/clock-simidle.c b/bsps/shared/dev/clock/clock-simidle.c
index def406a1df..c81f894b71 100644
--- a/bsps/shared/dev/clock/clock-simidle.c
+++ b/bsps/shared/dev/clock/clock-simidle.c
@@ -11,17 +11,8 @@
 
 #define CLOCK_VECTOR 0
 
-volatile bool clock_driver_enabled;
-
 #define Clock_driver_support_initialize_hardware() \
-  do { \
-    clock_driver_enabled = true; \
-  } while (0)
-
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    clock_driver_enabled = false; \
-  } while (0)
+  do { } while (0)
 
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
@@ -46,14 +37,12 @@ void *clock_driver_sim_idle_body(
 )
 {
   for( ; ; ) {
-    if ( clock_driver_enabled ) {
-      Per_CPU_Control *cpu = _Thread_Dispatch_disable();
-      _ISR_Nest_level++;
-      rtems_clock_tick();
-      _ISR_Nest_level--;
-      _Thread_Dispatch_enable( cpu );
-      BSP_CLOCK_DRIVER_DELAY();
-    }
+    Per_CPU_Control *cpu = _Thread_Dispatch_disable();
+    _ISR_Nest_level++;
+    rtems_clock_tick();
+    _ISR_Nest_level--;
+    _Thread_Dispatch_enable( cpu );
+    BSP_CLOCK_DRIVER_DELAY();
   }
   return 0;   /* to avoid warning */
 }
diff --git a/bsps/shared/dev/clock/clockimpl.h b/bsps/shared/dev/clock/clockimpl.h
index 6eaa6c94e5..f64d6fb3a1 100644
--- a/bsps/shared/dev/clock/clockimpl.h
+++ b/bsps/shared/dev/clock/clockimpl.h
@@ -110,7 +110,7 @@ static void Clock_driver_timecounter_tick( void )
 volatile uint32_t    Clock_driver_ticks;
 
 #ifdef Clock_driver_support_shutdown_hardware
-void Clock_exit( void );
+#error "Clock_driver_support_shutdown_hardware() is no longer supported"
 #endif
 
 /**
@@ -190,21 +190,6 @@ rtems_isr Clock_isr(
   #endif
 }
 
-#ifdef Clock_driver_support_shutdown_hardware
-/**
- *  @brief Clock_exit
- *
- *  This routine allows the clock driver to exit by masking the interrupt and
- *  disabling the clock's counter.
- */
-void Clock_exit( void )
-{
-  Clock_driver_support_shutdown_hardware();
-
-  /* do not restore old vector */
-}
-#endif
-
 /**
  * @brief Clock_initialize
  *
@@ -245,10 +230,6 @@ rtems_device_driver Clock_initialize(
    */
   Clock_driver_support_initialize_hardware();
 
-#ifdef Clock_driver_support_shutdown_hardware
-  atexit( Clock_exit );
-#endif
-
   /*
    *  If we are counting ISRs per tick, then initialize the counter.
    */
diff --git a/bsps/sparc/erc32/clock/ckinit.c b/bsps/sparc/erc32/clock/ckinit.c
index 2c6a556382..20ef28b03a 100644
--- a/bsps/sparc/erc32/clock/ckinit.c
+++ b/bsps/sparc/erc32/clock/ckinit.c
@@ -151,15 +151,6 @@ RTEMS_SYSINIT_ITEM(
 
 #define Clock_driver_timecounter_tick() erc32_tc_tick()
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    ERC32_Mask_interrupt( ERC32_INTERRUPT_REAL_TIME_CLOCK ); \
-     \
-    ERC32_MEC_Set_Real_Time_Clock_Timer_Control( \
-      ERC32_MEC_TIMER_COUNTER_DISABLE_COUNTING \
-    ); \
-  } while (0)
-
 #include "../../../shared/dev/clock/clockimpl.h"
 
 SPARC_COUNTER_DEFINITION;
diff --git a/bsps/sparc/leon2/clock/ckinit.c b/bsps/sparc/leon2/clock/ckinit.c
index a1dfc12806..f622975832 100644
--- a/bsps/sparc/leon2/clock/ckinit.c
+++ b/bsps/sparc/leon2/clock/ckinit.c
@@ -91,12 +91,6 @@ extern int CLOCK_SPEED;
     ); \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    LEON_Mask_interrupt( LEON_INTERRUPT_TIMER1 ); \
-    LEON_REG.Timer_Control_1 = 0; \
-  } while (0)
-
 #define Clock_driver_timecounter_tick() leon2_tc_tick()
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/sparc/leon3/clock/ckinit.c b/bsps/sparc/leon3/clock/ckinit.c
index 19a7566fef..cb0c48e74b 100644
--- a/bsps/sparc/leon3/clock/ckinit.c
+++ b/bsps/sparc/leon3/clock/ckinit.c
@@ -271,12 +271,6 @@ static void leon3_clock_initialize(void)
 #define Clock_driver_support_initialize_hardware() \
   leon3_clock_initialize()
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    LEON_Mask_interrupt(LEON_TRAP_TYPE(clkirq)); \
-    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].ctrl = 0; \
-  } while (0)
-
 #define Clock_driver_timecounter_tick() leon3_tc_do_tick()
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/sparc/shared/btimer/tlib_ckinit.c b/bsps/sparc/shared/btimer/tlib_ckinit.c
index 3f56d725d9..3e2feb1221 100644
--- a/bsps/sparc/shared/btimer/tlib_ckinit.c
+++ b/bsps/sparc/shared/btimer/tlib_ckinit.c
@@ -174,17 +174,6 @@ static rtems_device_driver tlib_clock_install_isr(rtems_isr *isr)
   return RTEMS_SUCCESSFUL;
 }
 
-static void tlib_clock_shutdown_hardware(void)
-{
-  if (priv.tlib_tick) {
-    tlib_stop(priv.tlib_tick);
-    priv.tlib_tick = NULL;
-  }
-  if (priv.ops->shutdown_hardware) {
-    priv.ops->shutdown_hardware();
-  }
-}
-
 /** Simple counter **/
 static uint32_t simple_tlib_tc_get(rtems_timecounter_simple *tc)
 {
@@ -432,9 +421,6 @@ static const struct ops ops_irqamp = {
     } \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  tlib_clock_shutdown_hardware()
-
 #define Clock_driver_timecounter_tick() \
   tlib_clock_timecounter_tick()
 
diff --git a/bsps/sparc64/shared/clock/ckinit.c b/bsps/sparc64/shared/clock/ckinit.c
index 6a82806b31..230e1fbab7 100644
--- a/bsps/sparc64/shared/clock/ckinit.c
+++ b/bsps/sparc64/shared/clock/ckinit.c
@@ -111,11 +111,6 @@ static void Clock_driver_support_initialize_hardware(void)
 #endif
 }
 
-#define Clock_driver_support_shutdown_hardware( ) \
-  do { \
-    \
-  } while ( 0 )
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
-- 
2.13.7



More information about the devel mailing list