Changeset f93630d in rtems


Ignore:
Timestamp:
Sep 12, 2007, 3:23:44 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
3d7fa72
Parents:
23f1974
Message:

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

PR 1257/bsps

  • mpc5xx/exceptions/raw_exception.c, mpc5xx/irq/irq.c, mpc6xx/exceptions/raw_exception.c, mpc8260/exceptions/raw_exception.c, mpc8xx/exceptions/raw_exception.c, new-exceptions/raw_exception.c, ppc403/ictrl/ictrl.c, ppc403/irq/ictrl.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/libcpu/powerpc
Files:
9 edited

Legend:

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

    r23f1974 rf93630d  
     12007-09-12      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        PR 1257/bsps
     4        * mpc5xx/exceptions/raw_exception.c, mpc5xx/irq/irq.c,
     5        mpc6xx/exceptions/raw_exception.c,
     6        mpc8260/exceptions/raw_exception.c,
     7        mpc8xx/exceptions/raw_exception.c, new-exceptions/raw_exception.c,
     8        ppc403/ictrl/ictrl.c, ppc403/irq/ictrl.c: Code outside of cpukit
     9        should use the public API for
     10        rtems_interrupt_disable/rtems_interrupt_enable. By bypassing the
     11        public API and directly accessing _CPU_ISR_Disable and
     12        _CPU_ISR_Enable, they were bypassing the compiler memory barrier
     13        directive which could lead to problems. This patch also changes the
     14        type of the variable passed into these routines and addresses minor
     15        style issues.
     16
    1172007-09-11      Joel Sherrill <joel.sherrill@OARcorp.com>
    218
  • c/src/lib/libcpu/powerpc/mpc5xx/exceptions/raw_exception.c

    r23f1974 rf93630d  
    2121 *  http://www.rtems.com/license/LICENSE.
    2222 *
    23  * $Id$
    2423 */
    2524
    26 #include <rtems/system.h>
    27 #include <rtems/score/cpu.h>
     25#include <rtems.h>
    2826#include <rtems/score/powerpc.h>
    2927#include <libcpu/raw_exception.h>
     
    7674int mpc5xx_set_exception  (const rtems_raw_except_connect_data* except)
    7775{
    78   unsigned int level;
     76  rtems_interrupt_level level;
    7977
    8078  if (!mpc5xx_vector_is_valid(except->exceptIndex)) {
     
    9391  }
    9492
    95   _CPU_ISR_Disable(level);
     93  rtems_interrupt_disable(level);
    9694 
    9795  raw_except_table[except->exceptIndex] = *except;
     
    10098  except->on(except);
    10199 
    102   _CPU_ISR_Enable(level);
     100  rtems_interrupt_enable(level);
    103101  return 1;
    104102}
     
    117115int mpc5xx_delete_exception (const rtems_raw_except_connect_data* except)
    118116{
    119   unsigned int level;
     117  rtems_interrupt_level level;
    120118 
    121119  if (!mpc5xx_vector_is_valid(except->exceptIndex)){
     
    133131  }
    134132
    135   _CPU_ISR_Disable(level);
     133  rtems_interrupt_disable(level);
    136134
    137135  except->off(except);
     
    142140  raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
    143141
    144   _CPU_ISR_Enable(level);
     142  rtems_interrupt_enable(level);
    145143   
    146144  return 1;
     
    155153int mpc5xx_init_exceptions (rtems_raw_except_global_settings* config)
    156154{
    157   unsigned                      i;
    158   unsigned int level;
     155  unsigned              i;
     156  rtems_interrupt_level level;
    159157 
    160158  /*
     
    165163  default_raw_except_entry      = config->defaultRawEntry;
    166164
    167   _CPU_ISR_Disable(level);
     165  rtems_interrupt_disable(level);
    168166
    169167  for (i = 0; i < NUM_EXCEPTIONS; i++) {
     
    177175    }
    178176  }
    179   _CPU_ISR_Enable(level);
     177  rtems_interrupt_enable(level);
    180178
    181179  return 1;
  • c/src/lib/libcpu/powerpc/mpc5xx/irq/irq.c

    r23f1974 rf93630d  
    207207int CPU_install_rtems_irq_handler       (const rtems_irq_connect_data* irq)
    208208{
    209     unsigned int level;
     209    rtems_interrupt_level      level;
    210210 
    211211    if (!isValidInterrupt(irq->name)) {
     
    223223    }
    224224
    225     _CPU_ISR_Disable(level);
     225    rtems_interrupt_disable(level);
    226226
    227227    /*
     
    255255    irq->on(irq);
    256256   
    257     _CPU_ISR_Enable(level);
     257    rtems_interrupt_enable(level);
    258258
    259259    return 1;
     
    272272int CPU_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
    273273{
    274     unsigned int level;
     274    rtems_interrupt_level      level;
    275275 
    276276    if (!isValidInterrupt(irq->name)) {
     
    287287      return 0;
    288288    }
    289     _CPU_ISR_Disable(level);
     289    rtems_interrupt_disable(level);
    290290
    291291    /*
     
    317317    rtems_hdl_tbl[irq->name] = default_rtems_entry;
    318318
    319     _CPU_ISR_Enable(level);
     319    rtems_interrupt_enable(level);
    320320
    321321    return 1;
     
    328328int CPU_rtems_irq_mngt_set      (rtems_irq_global_settings* config)
    329329{
    330     int i;
    331     unsigned int level;
     330    int                    i;
     331    rtems_interrupt_level level;
    332332
    333333   /*
     
    338338    rtems_hdl_tbl               = config->irqHdlTbl;
    339339
    340     _CPU_ISR_Disable(level);
     340    rtems_interrupt_disable(level);
    341341
    342342    /*
     
    388388      }
    389389    }
    390     _CPU_ISR_Enable(level);
     390    rtems_interrupt_enable(level);
    391391    return 1;
    392392}
  • c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c

    r23f1974 rf93630d  
    225225int mpc60x_set_exception  (const rtems_raw_except_connect_data* except)
    226226{
    227     unsigned int level;
     227    rtems_interrupt_level      level;
    228228
    229229    if (!mpc60x_vector_is_valid(except->exceptIndex)) {
     
    247247    }
    248248
    249     _CPU_ISR_Disable(level);
     249    rtems_interrupt_disable(level);
    250250
    251251    raw_except_table [except->exceptIndex] = *except;
     
    256256    except->on(except);
    257257
    258     _CPU_ISR_Enable(level);
     258    rtems_interrupt_enable(level);
    259259    return 1;
    260260}
     
    273273int mpc60x_delete_exception (const rtems_raw_except_connect_data* except)
    274274{
    275   unsigned int level;
     275  rtems_interrupt_level level;
    276276
    277277  if (!mpc60x_vector_is_valid(except->exceptIndex)){
     
    290290      return 0;
    291291  }
    292   _CPU_ISR_Disable(level);
     292  rtems_interrupt_disable(level);
    293293
    294294  except->off(except);
     
    302302  raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
    303303
    304   _CPU_ISR_Enable(level);
     304  rtems_interrupt_enable(level);
    305305
    306306  return 1;
     
    312312int mpc60x_init_exceptions (rtems_raw_except_global_settings* config)
    313313{
    314     unsigned                    i;
    315     unsigned int level;
     314    int                    i;
     315    rtems_interrupt_level level;
    316316
    317317    /*
     
    322322    default_raw_except_entry    = config->defaultRawEntry;
    323323
    324     _CPU_ISR_Disable(level);
     324    rtems_interrupt_disable(level);
    325325
    326326    for (i=0; i <= LAST_VALID_EXC; i++) {
     
    339339      }
    340340    }
    341     _CPU_ISR_Enable(level);
     341    rtems_interrupt_enable(level);
    342342
    343343    return 1;
  • c/src/lib/libcpu/powerpc/mpc8260/exceptions/raw_exception.c

    r23f1974 rf93630d  
    8181int mpc8xx_set_exception  (const rtems_raw_except_connect_data* except)
    8282{
    83     unsigned int level;
     83    rtems_interrupt_level      level;
    8484
    8585    if (!mpc8xx_vector_is_valid(except->exceptIndex)) {
     
    9797    }
    9898
    99     _CPU_ISR_Disable(level);
     99    rtems_interrupt_disable(level);
    100100   
    101101    raw_except_table [except->exceptIndex] = *except;
     
    113113    except->on(except);
    114114   
    115     _CPU_ISR_Enable(level);
     115    rtems_interrupt_enable(level);
    116116    return 1;
    117117}
     
    130130int mpc8xx_delete_exception (const rtems_raw_except_connect_data* except)
    131131{
    132   unsigned int level;
     132  rtems_interrupt_level level;
    133133 
    134134  if (!mpc8xx_vector_is_valid(except->exceptIndex)){
     
    147147      return 0;
    148148  }
    149   _CPU_ISR_Disable(level);
     149  rtems_interrupt_disable(level);
    150150
    151151  except->off(except);
     
    159159  raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
    160160
    161   _CPU_ISR_Enable(level);
     161  rtems_interrupt_enable(level);
    162162   
    163163  return 1;
     
    169169int mpc8xx_init_exceptions (rtems_raw_except_global_settings* config)
    170170{
    171     unsigned                    i;
    172     unsigned int level;
     171    int                    i;
     172    rtems_interrupt_level level;
    173173   
    174174    /*
     
    179179    default_raw_except_entry    = config->defaultRawEntry;
    180180
    181     _CPU_ISR_Disable(level);
     181    rtems_interrupt_disable(level);
    182182
    183183    for (i=0; i <= LAST_VALID_EXC; i++) {
     
    196196      }
    197197    }
    198     _CPU_ISR_Enable(level);
     198    rtems_interrupt_enable(level);
    199199
    200200    return 1;
  • c/src/lib/libcpu/powerpc/mpc8xx/exceptions/raw_exception.c

    r23f1974 rf93630d  
    8383int mpc8xx_set_exception  (const rtems_raw_except_connect_data* except)
    8484{
    85     unsigned int level;
     85    rtems_interrupt_level      level;
    8686
    8787    if (!mpc8xx_vector_is_valid(except->exceptIndex)) {
     
    9999    }
    100100
    101     _CPU_ISR_Disable(level);
     101    rtems_interrupt_disable(level);
    102102   
    103103    raw_except_table [except->exceptIndex] = *except;
     
    108108    except->on(except);
    109109   
    110     _CPU_ISR_Enable(level);
     110    rtems_interrupt_enable(level);
    111111    return 1;
    112112}
     
    125125int mpc8xx_delete_exception (const rtems_raw_except_connect_data* except)
    126126{
    127   unsigned int level;
     127  rtems_interrupt_level level;
    128128 
    129129  if (!mpc8xx_vector_is_valid(except->exceptIndex)){
     
    142142      return 0;
    143143  }
    144   _CPU_ISR_Disable(level);
     144  rtems_interrupt_disable(level);
    145145
    146146  except->off(except);
     
    154154  raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
    155155
    156   _CPU_ISR_Enable(level);
     156  rtems_interrupt_enable(level);
    157157   
    158158  return 1;
     
    164164int mpc8xx_init_exceptions (rtems_raw_except_global_settings* config)
    165165{
    166     unsigned                    i;
    167     unsigned int level;
     166    int                    i;
     167    rtems_interrupt_level level;
    168168   
    169169    /*
     
    174174    default_raw_except_entry    = config->defaultRawEntry;
    175175
    176     _CPU_ISR_Disable(level);
     176    rtems_interrupt_disable(level);
    177177
    178178    for (i=0; i <= LAST_VALID_EXC; i++) {
     
    191191      }
    192192    }
    193     _CPU_ISR_Enable(level);
     193    rtems_interrupt_enable(level);
    194194
    195195    return 1;
  • c/src/lib/libcpu/powerpc/new-exceptions/raw_exception.c

    r23f1974 rf93630d  
    2727#include <rtems/system.h>
    2828#include <rtems/score/powerpc.h>
     29#include <rtems/score/isr.h>
    2930#include <rtems/bspIo.h>
    3031#include <libcpu/raw_exception.h>
     
    386387int ppc_set_exception  (const rtems_raw_except_connect_data* except)
    387388{
    388     unsigned int level;
     389    ISR_Level      level;
    389390
    390391    if (!ppc_vector_is_valid(except->exceptIndex)) {
     
    408409    }
    409410
    410     _CPU_ISR_Disable(level);
     411    _ISR_Disable(level);
    411412
    412413    raw_except_table [except->exceptIndex] = *except;
     
    417418    except->on(except);
    418419
    419     _CPU_ISR_Enable(level);
     420    _ISR_Enable(level);
    420421    return 1;
    421422}
     
    434435int ppc_delete_exception (const rtems_raw_except_connect_data* except)
    435436{
    436   unsigned int level;
     437  ISR_Level level;
    437438
    438439  if (!ppc_vector_is_valid(except->exceptIndex)){
     
    451452      return 0;
    452453  }
    453   _CPU_ISR_Disable(level);
     454  _ISR_Disable(level);
    454455
    455456  except->off(except);
     
    463464  raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
    464465
    465   _CPU_ISR_Enable(level);
     466  _ISR_Enable(level);
    466467
    467468  return 1;
     
    473474int ppc_init_exceptions (rtems_raw_except_global_settings* config)
    474475{
    475     unsigned                    i;
    476     unsigned int level;
     476    int        i;
     477    ISR_Level level;
    477478
    478479    /*
     
    483484    default_raw_except_entry    = config->defaultRawEntry;
    484485
    485     _CPU_ISR_Disable(level);
     486    _ISR_Disable(level);
    486487
    487488    for (i=0; i <= LAST_VALID_EXC; i++) {
     
    500501      }
    501502    }
    502     _CPU_ISR_Enable(level);
     503    _ISR_Enable(level);
    503504
    504505    return 1;
  • c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c

    r23f1974 rf93630d  
    129129enable_ext_irq( uint32_t   mask)
    130130{
    131     uint32_t   isrlvl;
    132     _CPU_ISR_Disable(isrlvl);
     131  rtems_interrupt_level level;
     132
     133  rtems_interrupt_disable(level);
    133134    set_exier(get_exier() | ((mask)&PPC_EXI_MASK));
    134     _CPU_ISR_Enable(isrlvl);
     135  rtems_interrupt_enable(level);
    135136}
    136137
     
    141142disable_ext_irq( uint32_t   mask)
    142143{
    143     uint32_t   isrlvl;
    144     _CPU_ISR_Disable(isrlvl);
     144  rtems_interrupt_level level;
     145
     146  rtems_interrupt_disable(level);
    145147    set_exier(get_exier() & ~(mask) & PPC_EXI_MASK);
    146     _CPU_ISR_Enable(isrlvl);
     148  rtems_interrupt_enable(level);
    147149}
    148150
  • c/src/lib/libcpu/powerpc/ppc403/irq/ictrl.c

    r23f1974 rf93630d  
    129129enable_ext_irq( uint32_t   mask)
    130130{
    131     uint32_t   isrlvl;
    132     _CPU_ISR_Disable(isrlvl);
     131  rtems_interrupt_level level;
     132
     133  rtems_interrupt_disable(level);
    133134    set_exier(get_exier() | ((mask)&PPC_EXI_MASK));
    134     _CPU_ISR_Enable(isrlvl);
     135  rtems_interrupt_enable(level);
    135136}
    136137
     
    141142disable_ext_irq( uint32_t   mask)
    142143{
    143     uint32_t   isrlvl;
    144     _CPU_ISR_Disable(isrlvl);
     144  rtems_interrupt_level level;
     145
     146  rtems_interrupt_disable(level);
    145147    set_exier(get_exier() & ~(mask) & PPC_EXI_MASK);
    146     _CPU_ISR_Enable(isrlvl);
     148  rtems_interrupt_enable(level);
    147149}
    148150
Note: See TracChangeset for help on using the changeset viewer.