Changeset fc57b7b2 in rtems


Ignore:
Timestamp:
Sep 12, 2007, 3:16:41 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
80231685
Parents:
764b72e
Message:

2007-09-12 Joel Sherrill <joel.sherrill@…>

PR 1257/bsps

  • shared/irq/i8259.c, shared/irq/irq.c: Code outside of cpukit should use the public API for rtems_interrupt_disable/rtems_interrupt_enable. By bypassing the public API and directly accessing _CPU_ISR_Disable and _CPU_ISR_Enable, they were bypassing the compiler memory barrier directive which could lead to problems. This patch also changes the type of the variable passed into these routines and addresses minor style issues.
Location:
c/src/lib/libbsp/powerpc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/ChangeLog

    r764b72e rfc57b7b2  
     12007-09-12      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        PR 1257/bsps
     4        * shared/irq/i8259.c, shared/irq/irq.c: Code outside of cpukit should
     5        use the public API for
     6        rtems_interrupt_disable/rtems_interrupt_enable. By bypassing the
     7        public API and directly accessing _CPU_ISR_Disable and
     8        _CPU_ISR_Enable, they were bypassing the compiler memory barrier
     9        directive which could lead to problems. This patch also changes the
     10        type of the variable passed into these routines and addresses minor
     11        style issues.
     12
    1132007-09-07      Joel Sherrill <joel.sherrill@OARcorp.com>
    214
  • c/src/lib/libbsp/powerpc/shared/irq/i8259.c

    r764b72e rfc57b7b2  
    3434int BSP_irq_disable_at_i8259s    (const rtems_irq_number irqLine)
    3535{
    36   unsigned short mask;
    37   unsigned int  level;
     36  unsigned short        mask;
     37  rtems_interrupt_level level;
    3838
    3939  if ( ((int)irqLine < BSP_ISA_IRQ_LOWEST_OFFSET) ||
     
    4242    return 1;
    4343
    44   _CPU_ISR_Disable(level);
     44  rtems_interrupt_disable(level);
    4545
    4646  mask = 1 << irqLine;
     
    5555    outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
    5656  }
    57   _CPU_ISR_Enable (level);
     57  rtems_interrupt_enable(level);
    5858
    5959  return 0;
     
    6969int BSP_irq_enable_at_i8259s    (const rtems_irq_number irqLine)
    7070{
    71   unsigned short mask;
    72   unsigned int  level;
     71  unsigned short        mask;
     72  rtems_interrupt_level level;
    7373
    7474  if ( ((int)irqLine < BSP_ISA_IRQ_LOWEST_OFFSET) ||
     
    7777    return 1;
    7878
    79   _CPU_ISR_Disable(level);
     79  rtems_interrupt_disable(level);
    8080
    8181  mask = ~(1 << irqLine);
     
    9090    outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
    9191  }
    92   _CPU_ISR_Enable (level);
     92  rtems_interrupt_enable(level);
    9393
    9494  return 0;
  • c/src/lib/libbsp/powerpc/shared/irq/irq.c

    r764b72e rfc57b7b2  
    8585int BSP_install_rtems_shared_irq_handler  (const rtems_irq_connect_data* irq)
    8686{
    87     unsigned int level;
     87    rtems_interrupt_level  level;
    8888    rtems_irq_connect_data* vchain;
    8989
     
    9393    }
    9494
    95     _CPU_ISR_Disable(level);
     95    rtems_interrupt_disable(level);
    9696
    9797    if ( (int)rtems_hdl_tbl[irq->name].next_handler  == -1 ) {
    98       _CPU_ISR_Enable(level);
     98      rtems_interrupt_enable(level);
    9999      printk("IRQ vector %d already connected to an unshared handler\n",irq->name);
    100100      return 0;
     
    126126    irq->on(irq);
    127127
    128     _CPU_ISR_Enable(level);
     128    rtems_interrupt_enable(level);
    129129
    130130    return 1;
     
    137137int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
    138138{
    139     unsigned int level;
     139    rtems_interrupt_level level;
    140140
    141141    if (!isValidInterrupt(irq->name)) {
     
    150150     * to get the previous handler before accepting to disconnect.
    151151     */
    152     _CPU_ISR_Disable(level);
     152    rtems_interrupt_disable(level);
    153153    if (rtems_hdl_tbl[irq->name].hdl != default_rtems_entry.hdl) {
    154       _CPU_ISR_Enable(level);
     154      rtems_interrupt_enable(level);
    155155      printk("IRQ vector %d already connected\n",irq->name);
    156156      return 0;
     
    175175    irq->on(irq);
    176176
    177     _CPU_ISR_Enable(level);
     177    rtems_interrupt_enable(level);
    178178
    179179    return 1;
     
    182182int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* irq)
    183183{
    184      unsigned int level;
    185 
    186      if (!isValidInterrupt(irq->name)) {
    187       return 0;
    188      }
    189      _CPU_ISR_Disable(level);
    190      *irq = rtems_hdl_tbl[irq->name];
    191      _CPU_ISR_Enable(level);
    192      return 1;
     184    rtems_interrupt_level      level;
     185
     186    if (!isValidInterrupt(irq->name)) {
     187      return 0;
     188    }
     189    rtems_interrupt_disable(level);
     190      *irq = rtems_hdl_tbl[irq->name];
     191    rtems_interrupt_enable(level);
     192    return 1;
    193193}
    194194
    195195int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
    196196{
    197    rtems_irq_connect_data *pchain= NULL, *vchain = NULL;
    198     unsigned int level;
     197    rtems_irq_connect_data *pchain= NULL, *vchain = NULL;
     198    rtems_interrupt_level  level;
    199199
    200200    if (!isValidInterrupt(irq->name)) {
     
    208208     * to get the previous handler before accepting to disconnect.
    209209     */
    210     _CPU_ISR_Disable(level);
     210    rtems_interrupt_disable(level);
    211211    if (rtems_hdl_tbl[irq->name].hdl != irq->hdl) {
    212       _CPU_ISR_Enable(level);
     212      rtems_interrupt_enable(level);
    213213      return 0;
    214214    }
     
    230230       if( !found )
    231231       {
    232           _CPU_ISR_Enable(level);
     232          rtems_interrupt_enable(level);
    233233          return 0;
    234234       }
     
    238238       if (rtems_hdl_tbl[irq->name].hdl != irq->hdl)
    239239       {
    240           _CPU_ISR_Enable(level);
     240          rtems_interrupt_enable(level);
    241241         return 0;
    242242       }
     
    282282    }
    283283
    284     _CPU_ISR_Enable(level);
     284    rtems_interrupt_enable(level);
    285285
    286286    return 1;
     
    293293int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)
    294294{
    295     int i;
    296     unsigned int level;
    297         rtems_irq_connect_data* vchain;
    298         rtems_raw_except_connect_data vectorDesc;
    299 
    300         /*
    301         * Store various code accelerators
    302         */
     295    int                           i;
     296    rtems_interrupt_level        level;
     297    rtems_irq_connect_data*      vchain;
     298    rtems_raw_except_connect_data vectorDesc;
     299
     300    /*
     301    * Store various code accelerators
     302    */
    303303    internal_config             = config;
    304304    default_rtems_entry         = config->defaultEntry;
    305     rtems_hdl_tbl                   = config->irqHdlTbl;
    306 
    307     _CPU_ISR_Disable(level);
     305    rtems_hdl_tbl               = config->irqHdlTbl;
     306
     307    rtems_interrupt_disable(level);
    308308
    309309        if ( !BSP_setup_the_pic(config) ) {
     
    321321        }
    322322
    323     _CPU_ISR_Enable(level);
     323    rtems_interrupt_enable(level);
    324324
    325325        /*
Note: See TracChangeset for help on using the changeset viewer.