Changeset 7ee59313 in rtems for bsps/arm


Ignore:
Timestamp:
Jun 1, 2018, 5:11:12 AM (19 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
196ce18
Parents:
718a84af
git-author:
Sebastian Huber <sebastian.huber@…> (06/01/18 05:11:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/27/18 06:58:16)
Message:

Remove Clock_driver_support_shutdown_hardware()

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.

Location:
bsps/arm
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/beagle/clock/clock.c

    r718a84af r7ee59313  
    291291}
    292292
    293 static void beagle_clock_cleanup(void)
    294 {
    295   rtems_status_code sc = RTEMS_SUCCESSFUL;
    296 
    297   /* Disable timer */
    298   mmio_clear(timer->base + timer->regs->TCLR, OMAP3_TCLR_ST);
    299 
    300   /* Remove interrupt handler */
    301   sc = rtems_interrupt_handler_remove(
    302     timer->irq_nr,
    303     clock_isr,
    304     NULL
    305   );
    306   if (sc != RTEMS_SUCCESSFUL) {
    307     rtems_fatal_error_occurred(0xdeadbeef);
    308   }
    309   clock_isr = NULL;
    310 
    311   /* stop frclock */
    312   mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST);
    313 }
    314 
    315293#define Clock_driver_support_at_tick() beagle_clock_at_tick()
    316294#define Clock_driver_support_initialize_hardware() beagle_clock_initialize()
     
    318296  beagle_clock_handler_install(isr)
    319297
    320 #define Clock_driver_support_shutdown_hardware() beagle_clock_cleanup()
    321 
    322298/* Include shared source clock driver code */
    323299#include "../../shared/dev/clock/clockimpl.h"
  • bsps/arm/csb336/clock/clockdrv.c

    r718a84af r7ee59313  
    8383
    8484/**
    85  * Do whatever you need to shut the clock down and remove the
    86  * interrupt handler. Since this normally only gets called on
    87  * RTEMS shutdown, you may not need to do anything other than
    88  * remove the ISR.
    89  */
    90 #define Clock_driver_support_shutdown_hardware()                        \
    91   do {                                                                  \
    92     /* Disable timer */ \
    93     MC9328MXL_TMR1_TCTL = 0; \
    94     BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
    95   } while (0)
    96 
    97 /**
    9885 * Enables clock interrupt.
    9986 *
  • bsps/arm/csb337/clock/clock.c

    r718a84af r7ee59313  
    104104  } while (0)
    105105
    106 #define Clock_driver_support_shutdown_hardware() \
    107   do { \
    108     BSP_remove_rtems_irq_handler(&clock_isr_data); \
    109   } while (0)
    110 
    111106#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
    112107
  • bsps/arm/edb7312/clock/clockdrv.c

    r718a84af r7ee59313  
    5757  } while (0)
    5858
    59 #define Clock_driver_support_shutdown_hardware()    \
    60   do {                                              \
    61     rtems_status_code status = RTEMS_SUCCESSFUL;    \
    62     status = rtems_interrupt_handler_remove(        \
    63         BSP_TC1OI,                                  \
    64         Clock_isr,                                  \
    65         NULL                                        \
    66     );                                              \
    67     assert(status == RTEMS_SUCCESSFUL);             \
    68   } while (0)
    69 
    7059#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
    7160
  • bsps/arm/gumstix/clock/clock.c

    r718a84af r7ee59313  
    109109  } while (0)
    110110
    111 #define Clock_driver_support_shutdown_hardware() \
    112   do { \
    113     BSP_remove_rtems_irq_handler(&clock_isr_data); \
    114   } while (0)
    115 
    116111#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
    117112
  • bsps/arm/raspberrypi/clock/clockdrv.c

    r718a84af r7ee59313  
    9696}
    9797
    98 static void raspberrypi_clock_cleanup(void)
    99 {
    100   bsp_interrupt_vector_disable(BCM2835_IRQ_ID_GPU_TIMER_M3);
    101 }
    102 
    10398#define Clock_driver_support_at_tick() raspberrypi_clock_at_tick()
    10499
    105100#define Clock_driver_support_initialize_hardware() raspberrypi_clock_initialize_hardware()
    106 
    107 #define Clock_driver_support_shutdown_hardware() raspberrypi_clock_cleanup()
    108101
    109102#define Clock_driver_support_install_isr(clock_isr) \
  • bsps/arm/rtl22xx/clock/clockdrv.c

    r718a84af r7ee59313  
    128128
    129129/**
    130  * Do whatever you need to shut the clock down and remove the
    131  * interrupt handler. Since this normally only gets called on
    132  * RTEMS shutdown, you may not need to do anything other than
    133  * remove the ISR.
    134  */
    135 #define Clock_driver_support_shutdown_hardware()                        \
    136   do {                                                                  \
    137     /* Disable timer */ \
    138     T0TCR&=~0x02; \
    139     BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
    140   } while (0)
    141 
    142 /**
    143130 * Enables clock interrupt.
    144131 *
  • bsps/arm/shared/clock/clock-a9mpcore.c

    r718a84af r7ee59313  
    170170}
    171171
    172 static void a9mpcore_clock_cleanup_isr(void *arg)
    173 {
    174   volatile a9mpcore_gt *gt = A9MPCORE_GT;
    175 
    176   (void) arg;
    177 
    178   gt->ctrl &= A9MPCORE_GT_CTRL_TMR_EN;
    179   gt->irqst = A9MPCORE_GT_IRQST_EFLG;
    180 }
    181 
    182 static void a9mpcore_clock_cleanup(void)
    183 {
    184   rtems_status_code sc;
    185 
    186   /*
    187    * The relevant registers / bits of the global timer are banked and chances
    188    * are on an SPM system, that we are executing on the wrong CPU to reset
    189    * them. Thus we will have the actual cleanup done with the next clock tick.
    190    * The ISR will execute on the right CPU for the cleanup.
    191    */
    192   sc = rtems_interrupt_handler_install(
    193     A9MPCORE_IRQ_GT,
    194     "Clock",
    195     RTEMS_INTERRUPT_REPLACE,
    196     a9mpcore_clock_cleanup_isr,
    197     NULL
    198   );
    199   if (sc != RTEMS_SUCCESSFUL) {
    200     bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE);
    201   }
    202 }
    203 
    204172#define Clock_driver_support_at_tick() \
    205173  a9mpcore_clock_at_tick()
     
    211179  a9mpcore_clock_handler_install()
    212180
    213 #define Clock_driver_support_shutdown_hardware() \
    214   a9mpcore_clock_cleanup()
    215 
    216181/* Include shared source clock driver code */
    217182#include "../../shared/dev/clock/clockimpl.h"
  • bsps/arm/shared/clock/clock-armv7m.c

    r718a84af r7ee59313  
    8989);
    9090
    91 static void _ARMV7M_Clock_cleanup(void)
    92 {
    93   volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
    94 
    95   systick->csr = 0;
    96 }
    97 
    9891#define Clock_driver_support_initialize_hardware() \
    9992  _ARMV7M_Clock_initialize()
     
    10295  _ARMV7M_Clock_handler_install()
    10396
    104 #define Clock_driver_support_shutdown_hardware() \
    105   _ARMV7M_Clock_cleanup()
    106 
    10797/* Include shared source clock driver code */
    10898#include "../../../shared/dev/clock/clockimpl.h"
  • bsps/arm/shared/clock/clock-nxp-lpc.c

    r718a84af r7ee59313  
    106106}
    107107
    108 static void lpc_clock_cleanup(void)
    109 {
    110   rtems_status_code sc = RTEMS_SUCCESSFUL;
    111 
    112   /* Disable timer */
    113   lpc_clock->tcr = 0x0;
    114 
    115   /* Remove interrupt handler */
    116   sc = rtems_interrupt_handler_remove(
    117     LPC_CLOCK_INTERRUPT,
    118     (rtems_interrupt_handler) Clock_isr,
    119     NULL
    120   );
    121   if (sc != RTEMS_SUCCESSFUL) {
    122     rtems_fatal_error_occurred(0xdeadbeef);
    123   }
    124 }
    125 
    126108#define Clock_driver_support_at_tick() lpc_clock_at_tick()
    127109#define Clock_driver_support_initialize_hardware() lpc_clock_initialize()
     
    129111  lpc_clock_handler_install()
    130112
    131 #define Clock_driver_support_shutdown_hardware() lpc_clock_cleanup()
    132 
    133113/* Include shared source clock driver code */
    134114#include "../../../shared/dev/clock/clockimpl.h"
  • bsps/arm/smdk2410/clock/clockdrv.c

    r718a84af r7ee59313  
    7777
    7878/**
    79  * Do whatever you need to shut the clock down and remove the
    80  * interrupt handler. Since this normally only gets called on
    81  * RTEMS shutdown, you may not need to do anything other than
    82  * remove the ISR.
    83  */
    84 #define Clock_driver_support_shutdown_hardware()                        \
    85   do {                                                                  \
    86         /* Disable timer */ \
    87         BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
    88      } while (0)
    89 
    90 /**
    9179 * Enables clock interrupt.
    9280 *
  • bsps/arm/tms570/clock/clock.c

    r718a84af r7ee59313  
    160160}
    161161
    162 /**
    163  * @brief disables RTI interrupt
    164  *
    165  * Called when closing clock driver
    166  *
    167  * @retval Void
    168  */
    169 static void tms570_clock_driver_support_shutdown_hardware( void )
    170 {
    171   /* turn off the timer interrupts */
    172   TMS570_RTI.CLEARINTENA = TMS570_RTI_CLEARINTENA_CLEAROVL0INT |
    173                            TMS570_RTI_CLEARINTENA_CLEARINT0; 
    174 }
    175 
    176162#define Clock_driver_support_initialize_hardware \
    177163                        tms570_clock_driver_support_initialize_hardware
     
    180166#define Clock_driver_support_initialize_hardware \
    181167                        tms570_clock_driver_support_initialize_hardware
    182 #define Clock_driver_support_shutdown_hardware \
    183                         tms570_clock_driver_support_shutdown_hardware
    184168
    185169#define Clock_driver_support_install_isr(Clock_isr) \
Note: See TracChangeset for help on using the changeset viewer.