<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-05-23)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>jennifer</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-05-23 Jennifer Averett <Jennifer.Averett@OARcorp.com>

        * score/Makefile.am, score/include/rtems/score/thread.h,
        score/inline/rtems/score/thread.inl: Add smp support to dispable
        dispatch level accesses.
        * score/src/threaddispatchdisablelevel.c: New file.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2840&r2=text&tr2=1.2841&diff_format=h">M</a></td><td width='1%'>1.2841</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/Makefile.am.diff?r1=text&tr1=1.102&r2=text&tr2=1.103&diff_format=h">M</a></td><td width='1%'>1.103</td><td width='100%'>cpukit/score/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/include/rtems/score/thread.h.diff?r1=text&tr1=1.103&r2=text&tr2=1.104&diff_format=h">M</a></td><td width='1%'>1.104</td><td width='100%'>cpukit/score/include/rtems/score/thread.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/inline/rtems/score/thread.inl.diff?r1=text&tr1=1.45&r2=text&tr2=1.46&diff_format=h">M</a></td><td width='1%'>1.46</td><td width='100%'>cpukit/score/inline/rtems/score/thread.inl</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/src/threaddispatchdisablelevel.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/src/threaddispatchdisablelevel.c</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2840 rtems/cpukit/ChangeLog:1.2841
--- rtems/cpukit/ChangeLog:1.2840       Fri May 20 07:35:56 2011
+++ rtems/cpukit/ChangeLog      Mon May 23 08:30:10 2011
</font><font color='#997700'>@@ -1,3 +1,10 @@
</font><font color='#000088'>+2011-05-23    Jennifer Averett <Jennifer.Averett@OARcorp.com>
+
+       * score/Makefile.am, score/include/rtems/score/thread.h,
+       score/inline/rtems/score/thread.inl: Add smp support to dispable
+       dispatch level accesses.
+       * score/src/threaddispatchdisablelevel.c: New file.
+
</font> 2011-05-20        Jennifer Averett <Jennifer.Averett@OARcorp.com>
 
        PR 1787/cpukit

<font color='#006600'>diff -u rtems/cpukit/score/Makefile.am:1.102 rtems/cpukit/score/Makefile.am:1.103
--- rtems/cpukit/score/Makefile.am:1.102        Wed May 18 08:05:31 2011
+++ rtems/cpukit/score/Makefile.am      Mon May 23 08:30:14 2011
</font><font color='#997700'>@@ -241,6 +241,10 @@
</font>     src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \
     src/threadstartmultitasking.c src/threadtickletimeslice.c \
     src/iterateoverthreads.c src/threadblockingoperationcancel.c
<font color='#000088'>+<span style="background-color: #FF0000">    </span>
+if HAS_SMP
+libscore_a_SOURCES += src/threaddispatchdisablelevel.c
+endif
</font> 
 ## THREADQ_C_FILES
 libscore_a_SOURCES += src/threadq.c src/threadqdequeue.c \

<font color='#006600'>diff -u rtems/cpukit/score/include/rtems/score/thread.h:1.103 rtems/cpukit/score/include/rtems/score/thread.h:1.104
--- rtems/cpukit/score/include/rtems/score/thread.h:1.103       Thu May 12 08:23:12 2011
+++ rtems/cpukit/score/include/rtems/score/thread.h     Mon May 23 08:30:15 2011
</font><font color='#997700'>@@ -464,6 +464,14 @@
</font>  */
 SCORE_EXTERN volatile uint32_t   _Thread_Dispatch_disable_level;
 
<font color='#000088'>+#if defined(RTEMS_SMP)
+  /**
+   * The following declares the smp spinlock to be used to control
+   * the dispatch critical section accesses across cpus.
+   */
+  SCORE_EXTERN SMP_lock_spinlock_nested_Control _Thread_Dispatch_disable_level_lock;
+#endif
+
</font> /**
  *  The following holds how many user extensions are in the system.  This
  *  is used to determine how many user extension data areas to allocate
<font color='#997700'>@@ -784,6 +792,53 @@
</font>   ISR_Level                         level
 );
 
<font color='#000088'>+
+#if defined(RTEMS_SMP)
+
+  /** @brief _Thread_Dispatch_initialization
+   *<span style="background-color: #FF0000"> </span>
+   *  This routine initializes the thread dispatching subsystem.
+   */
+  void _Thread_Dispatch_initialization(void);
+
+  /** @brief _Thread_Dispatch_in_critical_section
+   *<span style="background-color: #FF0000"> </span>
+   * This routine returns true if thread dispatch indicates
+   * that we are in a critical section.
+   */
+  bool _Thread_Dispatch_in_critical_section(void);
+
+  /** @brief _Thread_Dispatch_get_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This routine returns value of the the thread dispatch level.
+   */
+  uint32_t _Thread_Dispatch_get_disable_level(void);
+
+  /** @brief _Thread_Dispatch_set_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This routine sets thread dispatch level to the<span style="background-color: #FF0000"> </span>
+   * value passed in.
+   */
+  uint32_t _Thread_Dispatch_set_disable_level(uint32_t value);
+
+  /** @brief _Thread_Dispatch_increment_disable_level
+   *
+   * This rountine increments the thread dispatch level
+   */
+  uint32_t _Thread_Dispatch_increment_disable_level(void);
+
+  /** @brief _Thread_Dispatch_decrement_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This routine decrements the thread dispatch level.
+   */
+  uint32_t _Thread_Dispatch_decrement_disable_level(void);
+
+#else
+  /*
+   * The _Thread_Dispatch_... functions are in thread.inl
+   */
+#endif
+
</font> #ifndef __RTEMS_APPLICATION__
 #include <rtems/score/thread.inl>
 #endif

<font color='#006600'>diff -u rtems/cpukit/score/inline/rtems/score/thread.inl:1.45 rtems/cpukit/score/inline/rtems/score/thread.inl:1.46
--- rtems/cpukit/score/inline/rtems/score/thread.inl:1.45       Thu Apr 21 14:05:15 2011
+++ rtems/cpukit/score/inline/rtems/score/thread.inl    Mon May 23 08:30:15 2011
</font><font color='#997700'>@@ -31,63 +31,77 @@
</font>  *  @{
  */
 
<font color='#880000'>-/**
- * This routine returns true if thread dispatch indicates
- * that we are in a critical section.
- */
-RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
-{
-   if (  _Thread_Dispatch_disable_level == 0 )
-    return false;
</font><font color='#000088'>+#if defined(RTEMS_SMP)
</font> 
<font color='#880000'>-   return true;
-}
</font><font color='#000088'>+  /*
+   * The _Thread_Dispatch_... functions are prototyped in thread.h.
+   */
</font> 
<font color='#880000'>-/**
- * This routine returns value of the the thread dispatch level.
- */
-RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
-{
-  return _Thread_Dispatch_disable_level;
-}
</font><font color='#000088'>+#else
</font> 
<font color='#880000'>-/**
- * This routine sets thread dispatch level to the<span style="background-color: #FF0000"> </span>
- * value passed in.
- */
-RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
-{
-  _Thread_Dispatch_disable_level = value;
-  return value;
-}
</font><font color='#000088'>+  /** @brief _Thread_Dispatch_in_critical_section
+   *<span style="background-color: #FF0000"> </span>
+   * This routine returns true if thread dispatch indicates
+   * that we are in a critical section.
+   */
+  RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
+  {
+     if (  _Thread_Dispatch_disable_level == 0 )
+      return false;
</font> 
<font color='#880000'>-/**
- * This rountine increments the thread dispatch level
- */
-RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
-{
-  _Thread_Dispatch_disable_level++;
-  return _Thread_Dispatch_disable_level;
-}
</font><font color='#000088'>+     return true;
+  }
</font> 
<font color='#880000'>-/**
- * This routine decrements the thread dispatch level.
- */
-RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
-{
-  _Thread_Dispatch_disable_level--;
-  return _Thread_Dispatch_disable_level;
-}
</font><font color='#000088'>+  /** @brief _Thread_Dispatch_get_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This routine returns value of the the thread dispatch level.
+   */
+  RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
+  {
+    return _Thread_Dispatch_disable_level;
+  }
</font> 
<font color='#880000'>-/**
- *  This routine initializes the thread dispatching subsystem.
- */
</font><font color='#000088'>+  /** @brief _Thread_Dispatch_set_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This routine sets thread dispatch level to the<span style="background-color: #FF0000"> </span>
+   * value passed in.
+   */
+  RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
+  {
+    _Thread_Dispatch_disable_level = value;
+    return value;
+  }
</font> 
<font color='#880000'>-RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
-{
-  _Thread_Dispatch_set_disable_level( 1 );
-}
</font><font color='#000088'>+  /** @brief _Thread_Dispatch_increment_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This rountine increments the thread dispatch level
+   */
+  RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
+  {
+    _Thread_Dispatch_disable_level++;
+    return _Thread_Dispatch_disable_level;
+  }
+
+  /** @brief _Thread_Dispatch_decrement_disable_level
+   *<span style="background-color: #FF0000"> </span>
+   * This routine decrements the thread dispatch level.
+   */
+  RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
+  {
+    _Thread_Dispatch_disable_level--;
+    return _Thread_Dispatch_disable_level;
+  }
+
+  /** @brief _Thread_Dispatch_initialization
+   *<span style="background-color: #FF0000"> </span>
+   *  This routine initializes the thread dispatching subsystem.
+   */
+  RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
+  {
+    _Thread_Dispatch_set_disable_level( 1 );
+  }
</font> 
<font color='#000088'>+#endif
</font> 
 /**
  *  This routine halts multitasking and returns control to

<font color='#006600'>diff -u /dev/null rtems/cpukit/score/src/threaddispatchdisablelevel.c:1.1
--- /dev/null   Mon May 23 09:11:56 2011
+++ rtems/cpukit/score/src/threaddispatchdisablelevel.c Mon May 23 08:30:15 2011
</font><font color='#997700'>@@ -0,0 +1,133 @@
</font><font color='#000088'>+/*
+ *  Thread Dispatch Disable Level Methods
+ *
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/context.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+
+void _Thread_Dispatch_initialization( void )
+{
+  _Thread_Dispatch_disable_level = 0;<span style="background-color: #FF0000"> </span>
+  _SMP_lock_spinlock_nested_Initialize(&_Thread_Dispatch_disable_level_lock);
+  _Thread_Dispatch_set_disable_level( 1 );
+}
+
+bool _Thread_Dispatch_in_critical_section(void)
+{
+  if (  _Thread_Dispatch_disable_level == 0 )
+   return false;
+
+  return true;
+}
+
+uint32_t _Thread_Dispatch_get_disable_level(void)
+{
+  return _Thread_Dispatch_disable_level;
+}
+
+uint32_t _Thread_Dispatch_increment_disable_level(void)
+{
+  ISR_Level  isr_level;
+  uint32_t   level;
+
+  /*
+   * Note: _SMP_lock_spinlock_nested_Obtain returns
+   *       with ISR's disabled and the isr_level that
+   *       should be restored after a short period.
+   *
+   * Here we obtain the lock and increment the<span style="background-color: #FF0000"> </span>
+   * Thread dispatch disable level while under the
+   * protection of the isr being off.  After this
+   * point it is safe to re-enable ISRs and allow
+   * the dispatch disable lock to provide protection.
+   */
+
+  isr_level = _SMP_lock_spinlock_nested_Obtain(
+    &_Thread_Dispatch_disable_level_lock
+  );
+<span style="background-color: #FF0000">  </span>
+  _Thread_Dispatch_disable_level++;
+  level = _Thread_Dispatch_disable_level;
+
+  _ISR_Enable(isr_level);<span style="background-color: #FF0000"> </span>
+
+  return level;
+}
+
+uint32_t _Thread_Dispatch_decrement_disable_level(void)
+{
+  ISR_Level  isr_level;
+  uint32_t   level;
+
+  /*  First we must disable ISRs in order to protect
+   *  accesses to the dispatch disable level.
+   */
+
+  _ISR_Disable( isr_level );
+
+  _Thread_Dispatch_disable_level--;
+  level = _Thread_Dispatch_disable_level;
+
+
+  /*<span style="background-color: #FF0000"> </span>
+   * Note: _SMP_lock_spinlock_nested_Obtain returns with
+   *        ISR's disabled and _SMP_lock_spinlock_nested_Release
+   *        is responsable for re-enabling interrupts.
+   */
+  _SMP_lock_spinlock_nested_Release(<span style="background-color: #FF0000"> </span>
+    &_Thread_Dispatch_disable_level_lock,
+    isr_level
+  );<span style="background-color: #FF0000"> </span>
+
+  return level;
+}
+
+
+/*
+ * Note this method is taking a heavy handed approach to<span style="background-color: #FF0000"> </span>
+ * setting the dispatch level. This may be optimized at a<span style="background-color: #FF0000"> </span>
+ * later timee, but it must be in such a way that the nesting
+ * level is decremented by the same number as the dispatch level.
+ * This approach is safest until we are sure the nested spinlock
+ * is successfully working with smp isr source code.<span style="background-color: #FF0000">  </span>
+ */
+
+uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
+{
+  /*
+   * If we need the dispatch level to go higher<span style="background-color: #FF0000"> </span>
+   * call increment method the desired number of times.
+   */
+
+  while ( value > _Thread_Dispatch_disable_level ) {
+    _Thread_Dispatch_increment_disable_level();
+  }
+
+  /*
+   * If we need the dispatch level to go lower
+   * call increment method the desired number of times.
+   */
+
+  while ( value < _Thread_Dispatch_disable_level ) {
+    _Thread_Dispatch_decrement_disable_level();
+  }
+
+  return value;
+}
</font></pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>jennifer</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>Add PR to changelog.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2841&r2=text&tr2=1.2842&diff_format=h">M</a></td><td width='1%'>1.2842</td><td width='100%'>cpukit/ChangeLog</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2841 rtems/cpukit/ChangeLog:1.2842
--- rtems/cpukit/ChangeLog:1.2841       Mon May 23 08:30:10 2011
+++ rtems/cpukit/ChangeLog      Mon May 23 08:56:40 2011
</font><font color='#997700'>@@ -1,5 +1,6 @@
</font> 2011-05-23        Jennifer Averett <Jennifer.Averett@OARcorp.com>
 
<font color='#000088'>+   PR 1791/cpukit
</font>   * score/Makefile.am, score/include/rtems/score/thread.h,
        score/inline/rtems/score/thread.inl: Add smp support to dispable
        dispatch level accesses.
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>