[PATCH] [libatomic] Add RTEMS support

2016-04-19 Thread Sebastian Huber
gcc/

* config/rtems.h (LIB_SPEC): Add -latomic.

libatomic/

* configure.tgt (*-*-rtems*): New supported target.
* config/rtems/host-config.h: New file.
* config/rtems/lock.c: Likewise.
---
 gcc/config/rtems.h   |  2 +-
 libatomic/config/rtems/host-config.h | 41 
 libatomic/config/rtems/lock.c| 37 
 libatomic/configure.tgt  | 10 +
 4 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 libatomic/config/rtems/host-config.h
 create mode 100644 libatomic/config/rtems/lock.c

diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index f13f72f..e005547 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -45,6 +45,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \
 "%{!nostdlib: %{qrtems: --start-group \
  -lrtemsbsp -lrtemscpu \
- -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
+ -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
 
 #define TARGET_POSIX_IO
diff --git a/libatomic/config/rtems/host-config.h 
b/libatomic/config/rtems/host-config.h
new file mode 100644
index 000..d11e9ef
--- /dev/null
+++ b/libatomic/config/rtems/host-config.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   Contributed by Sebastian Huber .
+
+   This file is part of the GNU Atomic Library (libatomic).
+
+   Libatomic is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   .  */
+
+/* Included after all more target-specific host-config.h.  */
+
+#include 
+
+static inline UWORD
+protect_start (void *ptr)
+{
+  return _Libatomic_Protect_start (ptr);
+}
+
+static inline void
+protect_end (void *ptr, UWORD isr_level)
+{
+  _Libatomic_Protect_end (ptr, isr_level);
+}
+
+#include_next 
diff --git a/libatomic/config/rtems/lock.c b/libatomic/config/rtems/lock.c
new file mode 100644
index 000..f999f9b
--- /dev/null
+++ b/libatomic/config/rtems/lock.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   Contributed by Sebastian Huber .
+
+   This file is part of the GNU Atomic Library (libatomic).
+
+   Libatomic is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   .  */
+
+#include "libatomic_i.h"
+
+void
+libat_lock_n (void *ptr, size_t n)
+{
+  _Libatomic_Lock_n (ptr, n);
+}
+
+void
+libat_unlock_n (void *ptr, size_t n)
+{
+  _Libatomic_Unlock_n (ptr, n);
+}
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index c5470d7..702286f 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -26,6 +26,10 @@
 # Map the target cpu to an ARCH sub-directory.  At the same time,
 # work out any special compilation flags as necessary.
 
+# Give operating systems the opportunity to discard XCFLAGS modifications based
+# on ${target_cpu}.  For example to allow proper use of multilibs.
+configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
+
 case "${target_cpu}" in
   alpha*)
# fenv.c needs this option to generate inexact exceptions.
@@ -128,6 +132,12 @@ case "${target}" in
 ;;
 esac
;;
+
+  *-*-rtems*)
+   XCFLAGS="${configure_tgt_pre_target

[PATCH] Add RTEMS support for GCC libatomic

2016-04-19 Thread Sebastian Huber
Signed-off-by: Sebastian Huber 
---
 newlib/libc/sys/rtems/include/machine/_libatomic.h | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 newlib/libc/sys/rtems/include/machine/_libatomic.h

diff --git a/newlib/libc/sys/rtems/include/machine/_libatomic.h 
b/newlib/libc/sys/rtems/include/machine/_libatomic.h
new file mode 100644
index 000..3456440
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/machine/_libatomic.h
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2016 embedded brains GmbH
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * The libatomic is a part of GCC.  It provides library support for C11/C++11
+ * atomic operations.  This file defines the interface to the operating system
+ * for the RTEMS configuration of libatomic.
+ */
+
+#include 
+#include 
+
+__BEGIN_DECLS
+
+__uint32_t _Libatomic_Protect_start(void *);
+
+void _Libatomic_Protect_end(void *, __uint32_t);
+
+void _Libatomic_Lock_n(void *, __size_t);
+
+void _Libatomic_Unlock_n(void *, __size_t);
+
+__END_DECLS
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] score: Add libatomic support

2016-04-19 Thread Sebastian Huber
Close #2695.
---
 cpukit/score/Makefile.am|   1 +
 cpukit/score/cpu/sparc/Makefile.am  |   1 -
 cpukit/score/cpu/sparc/sparcv8-atomic.c | 211 
 cpukit/score/src/libatomic.c|  79 
 4 files changed, 80 insertions(+), 212 deletions(-)
 delete mode 100644 cpukit/score/cpu/sparc/sparcv8-atomic.c
 create mode 100644 cpukit/score/src/libatomic.c

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 455c99d..566182f 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -361,6 +361,7 @@ libscore_a_SOURCES += src/sched.c
 libscore_a_SOURCES += src/semaphore.c
 libscore_a_SOURCES += src/smpbarrierwait.c
 libscore_a_SOURCES += src/kern_tc.c
+libscore_a_SOURCES += src/libatomic.c
 
 EXTRA_DIST = src/Unlimited.txt
 
diff --git a/cpukit/score/cpu/sparc/Makefile.am 
b/cpukit/score/cpu/sparc/Makefile.am
index 8cf4f4a..edebbb6 100644
--- a/cpukit/score/cpu/sparc/Makefile.am
+++ b/cpukit/score/cpu/sparc/Makefile.am
@@ -14,7 +14,6 @@ libscorecpu_a_SOURCES = cpu.c cpu_asm.S
 libscorecpu_a_SOURCES += sparc-context-volatile-clobber.S
 libscorecpu_a_SOURCES += sparc-context-validate.S
 libscorecpu_a_SOURCES += sparc-counter.c
-libscorecpu_a_SOURCES += sparcv8-atomic.c
 libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
 
 include $(srcdir)/preinstall.am
diff --git a/cpukit/score/cpu/sparc/sparcv8-atomic.c 
b/cpukit/score/cpu/sparc/sparcv8-atomic.c
deleted file mode 100644
index 2b3bdbc..000
--- a/cpukit/score/cpu/sparc/sparcv8-atomic.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2014-2015 embedded brains GmbH.  All rights reserved.
- *
- *  embedded brains GmbH
- *  Dornierstr. 4
- *  82178 Puchheim
- *  Germany
- *  
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-  #include "config.h"
-#endif
-
-#include 
-#include 
-
-/*
- * This file is a dirty hack.  A proper solution would be to add RTEMS support
- * for libatomic in GCC (see also libatomic/configure.tgt).
- */
-
-#if defined(RTEMS_SMP)
-static volatile uint32_t _SPARCV8_The_one_lock;
-
-static inline uint32_t _SPARCV8_Atomic_swap(
-  volatile uint32_t *address,
-  uint32_t value
-)
-{
-  asm volatile (
-"swap [%2], %0"
-: "=r" (value)
-: "0" (value), "r" (address)
-: "memory"
-  );
-
-  return value;
-}
-#endif
-
-static ISR_Level _SPARCV8_Acquire_the_one_lock( void )
-{
-  ISR_Level level;
-
-  _ISR_Disable_without_giant( level );
-
-#if defined(RTEMS_SMP)
-  do {
-while ( _SPARCV8_The_one_lock ) {
-  /* Wait */
-}
-  } while ( _SPARCV8_Atomic_swap( &_SPARCV8_The_one_lock, 1 ) );
-#endif
-
-  return level;
-}
-
-static void _SPARCV8_Release_the_one_lock( ISR_Level level )
-{
-#if defined(RTEMS_SMP)
-  _SPARCV8_The_one_lock = 0;
-#endif
-  _ISR_Enable_without_giant( level );
-}
-
-uint8_t __atomic_exchange_1( uint8_t *mem, uint8_t val, int model )
-{
-  uint8_t prev;
-  ISR_Level level;
-
-  level = _SPARCV8_Acquire_the_one_lock();
-
-  prev = *mem;
-  *mem = val;
-
-  _SPARCV8_Release_the_one_lock( level );
-
-  return prev;
-}
-
-/*
- * In order to get rid of the warning "conflicting types for built-in function
- * '__atomic_compare_exchange_4' [enabled by default]", you must port libatomic
- * to SPARC/RTEMS.  The libatomic is provided by GCC.
- */
-uint32_t __atomic_exchange_4( uint32_t *mem, uint32_t val, int model )
-{
-  uint32_t prev;
-  ISR_Level level;
-
-  level = _SPARCV8_Acquire_the_one_lock();
-
-  prev = *mem;
-  *mem = val;
-
-  _SPARCV8_Release_the_one_lock( level );
-
-  return prev;
-}
-
-/*
- * You get probably a warning here which can be ignored: "warning: conflicting
- * types for built-in function '__atomic_compare_exchange_4' [enabled by
- * default]"
- */
-bool __atomic_compare_exchange_4(
-  uint32_t *mem,
-  uint32_t *expected,
-  uint32_t desired,
-  int success,
-  int failure
-)
-{
-  bool equal;
-  ISR_Level level;
-  uint32_t actual;
-
-  level = _SPARCV8_Acquire_the_one_lock();
-
-  actual = *mem;
-  equal = ( actual == *expected );
-  if ( equal ) {
-*mem = desired;
-  } else {
-*expected = actual;
-  }
-
-  _SPARCV8_Release_the_one_lock( level );
-
-  return equal;
-}
-
-uint32_t __atomic_fetch_add_4( uint32_t *mem, uint32_t val, int model )
-{
-  uint32_t prev;
-  ISR_Level level;
-
-  level = _SPARCV8_Acquire_the_one_lock();
-
-  prev = *mem;
-  *mem = prev + val;
-
-  _SPARCV8_Release_the_one_lock( level );
-
-  return prev;
-}
-
-uint32_t __atomic_fetch_sub_4( uint32_t *mem, uint32_t val, int model )
-{
-  uint32_t prev;
-  ISR_Level level;
-
-  level = _SPARCV8_Acquire_the_one_lock();
-
-  prev = *mem;
-  *mem = prev - val;
-
-  _SPARCV8_Release_the_one_lock( level );
-
-  return prev;
-}
-
-uint32_t __atomic_fetch_and_4( uint32_t *mem, uint32_t val, int model )
-{
-  uint32_t prev;
-  ISR_Level level;
-
-  level = _SPARCV8_Acquire_the_one_lock()

Re: [PATCH] Add RTEMS support for GCC libatomic

2016-04-19 Thread Sebastian Huber

Sorry, I forgot to add the symbols to crt0.c. I will send a v2 soon.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2] Add RTEMS support for GCC libatomic

2016-04-19 Thread Sebastian Huber
Signed-off-by: Sebastian Huber 
---
 newlib/libc/sys/rtems/crt0.c   |  9 -
 newlib/libc/sys/rtems/include/machine/_libatomic.h | 46 ++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 newlib/libc/sys/rtems/include/machine/_libatomic.h

diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 8d87fd4..3bf7083 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
@@ -16,6 +16,7 @@
 #include  /* struct timespec */
 #include  /* isatty */
 #include  /* _Mutex_recursive_Control */
+#include 
 
 void rtems_provides_crt0( void ) {}  /* dummy symbol so file always has one */
 
@@ -58,7 +59,13 @@ RTEMS_STUB(int, _Sched_Count(void), { return -1; })
 RTEMS_STUB(int, _Sched_Index(void), { return -1; })
 RTEMS_STUB(int, _Sched_Name_to_index(const char *p, size_t s), { return -1; })
 RTEMS_STUB(int, _Sched_Processor_count(int i), { return 1; })
- 
+
+/* Stubs for routines from RTEMS  */
+RTEMS_STUB(__uint32_t, _Libatomic_Protect_start(void *ptr), { return 0; });
+RTEMS_STUB(void, _Libatomic_Protect_end(void *ptr, __uint32_t isr_level), { });
+RTEMS_STUB(void, _Libatomic_Lock_n(void *ptr, __size_t n), { });
+RTEMS_STUB(void, _Libatomic_Unlock_n(void *ptr, __size_t n), { });
+
 #if defined(__GNUC__)
 /*
  * stubs for libstdc++ rtems-threads support functions from gcc/gthr-rtems.h
diff --git a/newlib/libc/sys/rtems/include/machine/_libatomic.h 
b/newlib/libc/sys/rtems/include/machine/_libatomic.h
new file mode 100644
index 000..3456440
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/machine/_libatomic.h
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2016 embedded brains GmbH
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * The libatomic is a part of GCC.  It provides library support for C11/C++11
+ * atomic operations.  This file defines the interface to the operating system
+ * for the RTEMS configuration of libatomic.
+ */
+
+#include 
+#include 
+
+__BEGIN_DECLS
+
+__uint32_t _Libatomic_Protect_start(void *);
+
+void _Libatomic_Protect_end(void *, __uint32_t);
+
+void _Libatomic_Lock_n(void *, __size_t);
+
+void _Libatomic_Unlock_n(void *, __size_t);
+
+__END_DECLS
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Peng Fan
Hi Gedare, Joel,

Kindly ask, Do you any comments on this patch?

Thanks,
Peng.

On Thu, Apr 14, 2016 at 05:49:43PM +0800, Peng Fan wrote:
>Initial BSP support for i.MX 6UltraLite EVK board.
>Add uart driver
>Add gpt driver to service tick function
>
>The i.MX 6UltraLite is a high performance, ultra-efficient processor
>family featuring an advanced implementation of a single ARM® Cortex®-A7
>core, which operates at speeds up to 528 MHz. The i.MX 6UltraLite
>applications processor includes an integrated power management module
>that reduces the complexity of external power supply and simplifies
>power sequencing.
>
>Now, clock management module and pinmux module not added,
>so relies the setting in U-Boot.
>---
> c/src/lib/libbsp/arm/acinclude.m4  |   2 +
> c/src/lib/libbsp/arm/mx6ulevk/Makefile.am  | 139 +
> c/src/lib/libbsp/arm/mx6ulevk/README   |  28 
> c/src/lib/libbsp/arm/mx6ulevk/bsp_specs|  13 ++
> c/src/lib/libbsp/arm/mx6ulevk/configure.ac |  34 +
> .../libbsp/arm/mx6ulevk/console/console-config.c   |  82 +++
> c/src/lib/libbsp/arm/mx6ulevk/console/imx-uart.c   | 131 
> c/src/lib/libbsp/arm/mx6ulevk/gpt.c| 164 +
> c/src/lib/libbsp/arm/mx6ulevk/include/bsp.h| 121 +++
> c/src/lib/libbsp/arm/mx6ulevk/include/imx6-gpt.h   |  48 ++
> c/src/lib/libbsp/arm/mx6ulevk/include/imx6-uart.h  |  60 
> c/src/lib/libbsp/arm/mx6ulevk/include/irq.h|  38 +
> c/src/lib/libbsp/arm/mx6ulevk/include/tm27.h   |  24 +++
> .../libbsp/arm/mx6ulevk/make/custom/mx6ulevk.cfg   |   9 ++
> c/src/lib/libbsp/arm/mx6ulevk/preinstall.am| 151 +++
> c/src/lib/libbsp/arm/mx6ulevk/startup/bspreset.c   |  24 +++
> c/src/lib/libbsp/arm/mx6ulevk/startup/bspstart.c   |  25 
> .../libbsp/arm/mx6ulevk/startup/bspstarthooks.c|  70 +
> .../libbsp/arm/mx6ulevk/startup/linkcmds.mx6ulevk  |  48 ++
> 19 files changed, 1211 insertions(+)
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/README
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/bsp_specs
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/configure.ac
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/console/console-config.c
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/console/imx-uart.c
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/gpt.c
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/bsp.h
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/imx6-gpt.h
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/imx6-uart.h
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/irq.h
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/tm27.h
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/make/custom/mx6ulevk.cfg
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/preinstall.am
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/bspreset.c
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/bspstart.c
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/bspstarthooks.c
> create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/linkcmds.mx6ulevk
>
>diff --git a/c/src/lib/libbsp/arm/acinclude.m4 
>b/c/src/lib/libbsp/arm/acinclude.m4
>index f5ca105..c15dc82 100644
>--- a/c/src/lib/libbsp/arm/acinclude.m4
>+++ b/c/src/lib/libbsp/arm/acinclude.m4
>@@ -26,6 +26,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
> AC_CONFIG_SUBDIRS([lpc24xx]);;
>   lpc32xx )
> AC_CONFIG_SUBDIRS([lpc32xx]);;
>+  mx6ulevk )
>+AC_CONFIG_SUBDIRS([mx6ulevk]);;
>   raspberrypi )
> AC_CONFIG_SUBDIRS([raspberrypi]);;
>   realview-pbx-a9 )
>diff --git a/c/src/lib/libbsp/arm/mx6ulevk/Makefile.am 
>b/c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
>new file mode 100644
>index 000..517b524
>--- /dev/null
>+++ b/c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
>@@ -0,0 +1,139 @@
>+##
>+#
>+# @file
>+#
>+# @brief Makefile of libBSP for the i.MX 6UltraLite EVK platform (Cortex-A7).
>+#
>+
>+ACLOCAL_AMFLAGS = -I ../../../../aclocal
>+
>+include $(top_srcdir)/../../../../automake/compile.am
>+
>+include_bspdir = $(includedir)/bsp
>+include_libcpudir = $(includedir)/libcpu
>+
>+dist_project_lib_DATA = bsp_specs
>+
>+###
>+#  Header 
>#
>+###
>+
>+include_HEADERS = include/bsp.h
>+include_HEADERS += ../../shared/include/tm27.h
>+
>+nodist_include_HEADERS = ../../shared/include/coverhd.h \
>+  include/bspopts.h
>+
>+nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
>+
>+include_bsp_HEADERS =
>+include_bsp_HEADERS += ../../shared/include/utility.h
>+include_bsp_HEADERS += ../../shared/include/irq-generic.h
>+include_bsp_HEADERS += ../../shared/include/irq-i

Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Sebastian Huber



On 19/04/16 11:11, Peng Fan wrote:

+const console_fns imx_uart_fns = {
>+  .deviceProbe = libchip_serial_default_probe,
>+  .deviceFirstOpen = imx_uart_first_open,
>+  .deviceLastClose = imx_uart_last_close,
>+  .deviceRead = imx_uart_read_polled,
>+  .deviceWrite = imx_uart_write_support_polled,
>+  .deviceInitialize = imx_uart_initialize,
>+  .deviceWritePolled = imx_uart_write_polled,
>+  .deviceSetAttributes = imx_uart_set_attribues,
>+  .deviceOutputUsesInterrupts = false
>+};


Please don't use this console driver framework. Use 
rtems_termios_device_handler instead. For an example see:


c/src/lib/libbsp/arm/atsam/console/console.c

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2] [libatomic] Add RTEMS support

2016-04-19 Thread Sebastian Huber
v2: Do not use architecture configuration due to broken ARM libatomic
support.

gcc/

* config/rtems.h (LIB_SPEC): Add -latomic.

libatomic/

* configure.tgt (*-*-rtems*): New supported target.
* config/rtems/host-config.h: New file.
* config/rtems/lock.c: Likewise.
---
 gcc/config/rtems.h   |  2 +-
 libatomic/config/rtems/host-config.h | 41 
 libatomic/config/rtems/lock.c| 37 
 libatomic/configure.tgt  | 10 +
 4 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 libatomic/config/rtems/host-config.h
 create mode 100644 libatomic/config/rtems/lock.c

diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index f13f72f..e005547 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -45,6 +45,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \
 "%{!nostdlib: %{qrtems: --start-group \
  -lrtemsbsp -lrtemscpu \
- -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
+ -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
 
 #define TARGET_POSIX_IO
diff --git a/libatomic/config/rtems/host-config.h 
b/libatomic/config/rtems/host-config.h
new file mode 100644
index 000..d11e9ef
--- /dev/null
+++ b/libatomic/config/rtems/host-config.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   Contributed by Sebastian Huber .
+
+   This file is part of the GNU Atomic Library (libatomic).
+
+   Libatomic is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   .  */
+
+/* Included after all more target-specific host-config.h.  */
+
+#include 
+
+static inline UWORD
+protect_start (void *ptr)
+{
+  return _Libatomic_Protect_start (ptr);
+}
+
+static inline void
+protect_end (void *ptr, UWORD isr_level)
+{
+  _Libatomic_Protect_end (ptr, isr_level);
+}
+
+#include_next 
diff --git a/libatomic/config/rtems/lock.c b/libatomic/config/rtems/lock.c
new file mode 100644
index 000..f999f9b
--- /dev/null
+++ b/libatomic/config/rtems/lock.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   Contributed by Sebastian Huber .
+
+   This file is part of the GNU Atomic Library (libatomic).
+
+   Libatomic is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   .  */
+
+#include "libatomic_i.h"
+
+void
+libat_lock_n (void *ptr, size_t n)
+{
+  _Libatomic_Lock_n (ptr, n);
+}
+
+void
+libat_unlock_n (void *ptr, size_t n)
+{
+  _Libatomic_Unlock_n (ptr, n);
+}
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index c5470d7..eab2765 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -26,6 +26,10 @@
 # Map the target cpu to an ARCH sub-directory.  At the same time,
 # work out any special compilation flags as necessary.
 
+# Give operating systems the opportunity to discard XCFLAGS modifications based
+# on ${target_cpu}.  For example to allow proper use of multilibs.
+configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
+
 case "${target_cpu}" in
   alpha*)
# fenv.c needs this option to generate inexact exceptions.
@@ -128,6 +132,12 @@ case "${target}" in
 ;;
 

[PATCH 05/20] score: Close barrier object before flush

2016-04-19 Thread Sebastian Huber
This prevents use of the object after the flush on uni-processor
configurations.
---
 cpukit/rtems/src/barrierdelete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/rtems/src/barrierdelete.c b/cpukit/rtems/src/barrierdelete.c
index 7dab0c0..5d87e63 100644
--- a/cpukit/rtems/src/barrierdelete.c
+++ b/cpukit/rtems/src/barrierdelete.c
@@ -33,8 +33,8 @@ rtems_status_code rtems_barrier_delete(
   switch ( location ) {
 
 case OBJECTS_LOCAL:
-  _CORE_barrier_Flush( &the_barrier->Barrier, NULL, 0 );
   _Objects_Close( &_Barrier_Information, &the_barrier->Object );
+  _CORE_barrier_Flush( &the_barrier->Barrier, NULL, 0 );
   _Objects_Put( &the_barrier->Object );
   _Barrier_Free( the_barrier );
   _Objects_Allocator_unlock();
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 02/20] score: Simplify _CORE_message_queue_Do_close()

2016-04-19 Thread Sebastian Huber
Remove superfluous _CORE_message_queue_Flush() since we completely
re-initialize the structure in _CORE_message_queue_Initialize().
---
 cpukit/score/src/coremsgclose.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c
index fd026ad..e070d98 100644
--- a/cpukit/score/src/coremsgclose.c
+++ b/cpukit/score/src/coremsgclose.c
@@ -31,8 +31,6 @@ void _CORE_message_queue_Do_close(
 #endif
 )
 {
-  ISR_lock_Context lock_context;
-
   /*
*  This will flush blocked threads whether they were blocked on
*  a send or receive.
@@ -46,15 +44,6 @@ void _CORE_message_queue_Do_close(
 mp_id
   );
 
-  /*
-   *  This removes all messages from the pending message queue.  Since
-   *  we just flushed all waiting threads, we don't have to worry about
-   *  the flush satisfying any blocked senders as a side-effect.
-   */
-
-  _ISR_lock_ISR_disable( &lock_context );
-  (void) _CORE_message_queue_Flush( the_message_queue, &lock_context );
-
   (void) _Workspace_Free( the_message_queue->message_buffers );
 
   _Thread_queue_Destroy( &the_message_queue->Wait_queue );
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 06/20] score: Fix _CORE_semaphore_Flush()

2016-04-19 Thread Sebastian Huber
Use proper CORE_semaphore_Status for _CORE_semaphore_Flush() and
_CORE_semaphore_Destroy() operations.

Close #2696.
---
 cpukit/posix/include/rtems/posix/semaphoreimpl.h |  1 -
 cpukit/posix/src/semaphorecreatesupp.c   | 12 +++---
 cpukit/posix/src/semaphoredeletesupp.c   |  2 +-
 cpukit/posix/src/semaphoretranslatereturncode.c  |  2 +-
 cpukit/rtems/src/semdelete.c |  6 +--
 cpukit/rtems/src/semflush.c  |  1 -
 cpukit/score/include/rtems/score/coresemimpl.h   | 26 
 testsuites/psxtests/psxsem01/init.c  | 52 +++-
 8 files changed, 79 insertions(+), 23 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h 
b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
index 8608e6f..41bfdad 100644
--- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
+++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
@@ -58,7 +58,6 @@ RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free (
   POSIX_Semaphore_Control *the_semaphore
 )
 {
-  _CORE_semaphore_Destroy( &the_semaphore->Semaphore );
   _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object );
 }
 
diff --git a/cpukit/posix/src/semaphorecreatesupp.c 
b/cpukit/posix/src/semaphorecreatesupp.c
index 9a24e0a..79db888 100644
--- a/cpukit/posix/src/semaphorecreatesupp.c
+++ b/cpukit/posix/src/semaphorecreatesupp.c
@@ -54,11 +54,6 @@ int _POSIX_Semaphore_Create_support(
   if (pshared != 0)
 rtems_set_errno_and_return_minus_one( ENOSYS );
 
-  the_semaphore = _POSIX_Semaphore_Allocate_unprotected();
-  if ( !the_semaphore ) {
-rtems_set_errno_and_return_minus_one( ENOSPC );
-  }
-
   /*
* Make a copy of the user's string for name just in case it was
* dynamically constructed.
@@ -66,13 +61,18 @@ int _POSIX_Semaphore_Create_support(
   if ( name_arg != NULL ) {
 name = _Workspace_String_duplicate( name_arg, name_len );
 if ( !name ) {
-  _POSIX_Semaphore_Free( the_semaphore );
   rtems_set_errno_and_return_minus_one( ENOMEM );
 }
   } else {
 name = NULL;
   }
 
+  the_semaphore = _POSIX_Semaphore_Allocate_unprotected();
+  if ( !the_semaphore ) {
+_Workspace_Free( name );
+rtems_set_errno_and_return_minus_one( ENOSPC );
+  }
+
   the_semaphore->process_shared  = pshared;
 
   if ( name ) {
diff --git a/cpukit/posix/src/semaphoredeletesupp.c 
b/cpukit/posix/src/semaphoredeletesupp.c
index 650cdcd..43946746 100644
--- a/cpukit/posix/src/semaphoredeletesupp.c
+++ b/cpukit/posix/src/semaphoredeletesupp.c
@@ -36,7 +36,7 @@ void _POSIX_Semaphore_Delete(
 {
   if ( !the_semaphore->linked && !the_semaphore->open_count ) {
 _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
-_CORE_semaphore_Flush( &the_semaphore->Semaphore, -1, NULL, 0 );
+_CORE_semaphore_Destroy( &the_semaphore->Semaphore, NULL, 0 );
 _POSIX_Semaphore_Free( the_semaphore );
   }
 }
diff --git a/cpukit/posix/src/semaphoretranslatereturncode.c 
b/cpukit/posix/src/semaphoretranslatereturncode.c
index 37e7d07..d7b99ea 100644
--- a/cpukit/posix/src/semaphoretranslatereturncode.c
+++ b/cpukit/posix/src/semaphoretranslatereturncode.c
@@ -25,7 +25,7 @@
 const int _POSIX_Semaphore_Return_codes[CORE_SEMAPHORE_STATUS_LAST + 1] = {
   0,   /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
   EAGAIN,  /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
-  EAGAIN,  /* CORE_SEMAPHORE_WAS_DELETED */
+  EINVAL,  /* CORE_SEMAPHORE_WAS_DELETED */
   ETIMEDOUT,   /* CORE_SEMAPHORE_TIMEOUT */
   /* The next error can not occur since we set the maximum
* count to the largest value the count can hold.
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index 6a83d25..d3d6264 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -73,13 +73,11 @@ rtems_status_code rtems_semaphore_delete(
 );
 _CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
   } else {
-_CORE_semaphore_Flush(
+_CORE_semaphore_Destroy(
   &the_semaphore->Core_control.semaphore,
-  CORE_SEMAPHORE_WAS_DELETED,
   _Semaphore_MP_Send_object_was_deleted,
   id
-);
-_CORE_semaphore_Destroy( &the_semaphore->Core_control.semaphore );
+)
   }
 
   _Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
index ea06883..64386b0 100644
--- a/cpukit/rtems/src/semflush.c
+++ b/cpukit/rtems/src/semflush.c
@@ -60,7 +60,6 @@ rtems_status_code rtems_semaphore_flush(
   } else {
 _CORE_semaphore_Flush(
   &the_semaphore->Core_control.semaphore,
-  CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
   _Semaphore_MP_Send_object_was_deleted,
   id
 );
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h 
b/cpukit/score/include/rtems/score/coresemimpl.h
index

[PATCH 15/20] score: Simplify _Objects_Get_next()

2016-04-19 Thread Sebastian Huber
Remove unused location parameter.
---
 cpukit/libcsupport/src/resource_snapshot.c|  4 +---
 cpukit/libmisc/monitor/mon-manager.c  |  3 +--
 cpukit/score/include/rtems/score/objectimpl.h | 12 ++--
 cpukit/score/src/objectgetnext.c  | 15 ---
 testsuites/sptests/spobjgetnext/init.c| 14 +++---
 5 files changed, 15 insertions(+), 33 deletions(-)

diff --git a/cpukit/libcsupport/src/resource_snapshot.c 
b/cpukit/libcsupport/src/resource_snapshot.c
index 1980155..469df72 100644
--- a/cpukit/libcsupport/src/resource_snapshot.c
+++ b/cpukit/libcsupport/src/resource_snapshot.c
@@ -107,10 +107,8 @@ static void get_heap_info(Heap_Control *heap, 
Heap_Information_block *info)
 
 static POSIX_Keys_Control *get_next_key(Objects_Id *id)
 {
-  Objects_Locations location;
-
   return (POSIX_Keys_Control *)
-_Objects_Get_next(&_POSIX_Keys_Information, *id, &location, id);
+_Objects_Get_next(*id, &_POSIX_Keys_Information, id);
 }
 
 static uint32_t get_active_posix_key_value_pairs(void)
diff --git a/cpukit/libmisc/monitor/mon-manager.c 
b/cpukit/libmisc/monitor/mon-manager.c
index 99c28ac..d165c4f 100644
--- a/cpukit/libmisc/monitor/mon-manager.c
+++ b/cpukit/libmisc/monitor/mon-manager.c
@@ -26,7 +26,6 @@ rtems_monitor_manager_next(
 Objects_Information *table = table_void;
 rtems_monitor_generic_t *copy;
 Objects_Control *object = 0;
-Objects_Locationslocation;
 
 /*
  * When we are called, it must be local
@@ -37,7 +36,7 @@ rtems_monitor_manager_next(
 goto done;
 #endif
 
-object = _Objects_Get_next(table, *next_id, &location, next_id);
+object = _Objects_Get_next(*next_id, table, next_id);
 
 if (object)
 {
diff --git a/cpukit/score/include/rtems/score/objectimpl.h 
b/cpukit/score/include/rtems/score/objectimpl.h
index 47d17dd..6877b8e 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -680,19 +680,19 @@ Objects_Control *_Objects_Get_no_protection(
  *
  *  Locks the object allocator mutex in case a next object exists.
  *
- *  @param[in] information points to an object class information block.
  *  @param[in] id is the Id of the object whose name we are locating.
- *  @param[in] location_p will contain an indication of success or failure.
+ *This is the first parameter since usual callers get the object identifier
+ *as the first parameter themself.
+ *  @param[in] information points to an object class information block.
  *  @param[in] next_id_p is the Id of the next object we will look at.
  *
  *  @retval This method returns the pointer to the object located or
  *  NULL on error.
  */
 Objects_Control *_Objects_Get_next(
-Objects_Information *information,
-Objects_Id   id,
-Objects_Locations   *location_p,
-Objects_Id  *next_id_p
+  Objects_Id id,
+  const Objects_Information *information,
+  Objects_Id*next_id_p
 );
 
 /**
diff --git a/cpukit/score/src/objectgetnext.c b/cpukit/score/src/objectgetnext.c
index c0ebbbe..2d4f252 100644
--- a/cpukit/score/src/objectgetnext.c
+++ b/cpukit/score/src/objectgetnext.c
@@ -20,12 +20,10 @@
 
 #include 
 
-Objects_Control *
-_Objects_Get_next(
-Objects_Information *information,
-Objects_Id   id,
-Objects_Locations   *location_p,
-Objects_Id  *next_id_p
+Objects_Control *_Objects_Get_next(
+  Objects_Id id,
+  const Objects_Information *information,
+  Objects_Id*next_id_p
 )
 {
 Objects_Control *the_object;
@@ -34,9 +32,6 @@ _Objects_Get_next(
 if ( !information )
   return NULL;
 
-if ( !location_p )
-  return NULL;
-
 if ( !next_id_p )
   return NULL;
 
@@ -52,7 +47,6 @@ _Objects_Get_next(
 if (_Objects_Get_index(next_id) > information->maximum)
 {
 _Objects_Allocator_unlock();
-*location_p = OBJECTS_ERROR;
 *next_id_p = OBJECTS_ID_FINAL;
 return NULL;
 }
@@ -64,7 +58,6 @@ _Objects_Get_next(
 
 } while ( the_object == NULL );
 
-*location_p = OBJECTS_LOCAL;
 *next_id_p = next_id;
 return the_object;
 }
diff --git a/testsuites/sptests/spobjgetnext/init.c 
b/testsuites/sptests/spobjgetnext/init.c
index c6b8de5..620185c 100644
--- a/testsuites/sptests/spobjgetnext/init.c
+++ b/testsuites/sptests/spobjgetnext/init.c
@@ -35,7 +35,6 @@ int scan_objects(
 {
   Objects_Control  *o[MAX_SCAN];
   int   i;
-  Objects_Locations location;
   Objects_Idid;
 
   memset( o, 1, sizeof(o) );
@@ -43,15 +42,12 @@ int scan_objects(
   id = start;
   for (i=0 ; ihttp://lists.rtems.org/mailman/listinfo/devel


[PATCH 04/20] score: Simplify _CORE_barrier_Flush()

2016-04-19 Thread Sebastian Huber
---
 cpukit/rtems/src/barrierdelete.c   | 8 +---
 cpukit/score/include/rtems/score/corebarrierimpl.h | 3 +--
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/cpukit/rtems/src/barrierdelete.c b/cpukit/rtems/src/barrierdelete.c
index 9ddfe01..7dab0c0 100644
--- a/cpukit/rtems/src/barrierdelete.c
+++ b/cpukit/rtems/src/barrierdelete.c
@@ -33,13 +33,7 @@ rtems_status_code rtems_barrier_delete(
   switch ( location ) {
 
 case OBJECTS_LOCAL:
-  _CORE_barrier_Flush(
-&the_barrier->Barrier,
-CORE_BARRIER_WAS_DELETED,
-NULL,
-id
-  );
-
+  _CORE_barrier_Flush( &the_barrier->Barrier, NULL, 0 );
   _Objects_Close( &_Barrier_Information, &the_barrier->Object );
   _Objects_Put( &the_barrier->Object );
   _Barrier_Free( the_barrier );
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h 
b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 8754cec..1d77405 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -196,14 +196,13 @@ uint32_t _CORE_barrier_Do_release(
 /* Must be a macro due to the multiprocessing dependent parameters */
 #define _CORE_barrier_Flush( \
   the_barrier, \
-  status, \
   mp_callout, \
   mp_id \
 ) \
   _Thread_queue_Flush( \
 &( the_barrier )->Wait_queue, \
 CORE_BARRIER_TQ_OPERATIONS, \
-status, \
+CORE_BARRIER_WAS_DELETED, \
 mp_callout, \
 mp_id \
   )
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 14/20] score: Simplify _Objects_Initialize_information()

2016-04-19 Thread Sebastian Huber
Remove unused supports_global parameter.  Convert
_Objects_Initialize_information() to a macro to avoid use of
RTEMS_MULTIPROCESSING define for each caller.
---
 cpukit/posix/src/cond.c|  6 +--
 cpukit/posix/src/key.c |  6 +--
 cpukit/posix/src/mqueue.c  | 12 +
 cpukit/posix/src/mutex.c   |  6 +--
 cpukit/posix/src/pbarrier.c|  8 +--
 cpukit/posix/src/prwlock.c |  8 +--
 cpukit/posix/src/pspin.c   |  6 +--
 cpukit/posix/src/pthread.c |  4 --
 cpukit/posix/src/ptimer.c  |  6 +--
 cpukit/posix/src/semaphore.c   |  6 +--
 cpukit/rtems/src/barrier.c |  6 +--
 cpukit/rtems/src/dpmem.c   |  6 +--
 cpukit/rtems/src/msg.c |  6 +--
 cpukit/rtems/src/part.c|  6 +--
 cpukit/rtems/src/ratemon.c |  6 +--
 cpukit/rtems/src/region.c  |  6 +--
 cpukit/rtems/src/rtemstimer.c  |  6 +--
 cpukit/rtems/src/sem.c |  6 +--
 cpukit/rtems/src/tasks.c   |  4 --
 cpukit/sapi/src/extension.c|  6 +--
 cpukit/score/include/rtems/score/objectimpl.h  | 68 +-
 cpukit/score/include/rtems/score/threadimpl.h  |  4 --
 cpukit/score/src/apimutex.c|  6 +--
 cpukit/score/src/objectinitializeinformation.c |  3 +-
 cpukit/score/src/thread.c  | 16 +-
 testsuites/psxtests/psxobj01/init.c|  8 +--
 26 files changed, 83 insertions(+), 148 deletions(-)

diff --git a/cpukit/posix/src/cond.c b/cpukit/posix/src/cond.c
index d0ce8a6..8ee57d8 100644
--- a/cpukit/posix/src/cond.c
+++ b/cpukit/posix/src/cond.c
@@ -53,12 +53,8 @@ static void 
_POSIX_Condition_variables_Manager_initialization(void)
 sizeof( POSIX_Condition_variables_Control ),
 /* size of this object's control block */
 true,   /* true if names for this object are strings */
-_POSIX_PATH_MAX /* maximum length of each object's name */
-#if defined(RTEMS_MULTIPROCESSING)
-,
-false,  /* true if this is a global object class */
+_POSIX_PATH_MAX,/* maximum length of each object's name */
 NULL/* Proxy extraction support callout */
-#endif
   );
 }
 
diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c
index 0bc88ae..6b2dc3d 100644
--- a/cpukit/posix/src/key.c
+++ b/cpukit/posix/src/key.c
@@ -141,12 +141,8 @@ static void _POSIX_Keys_Manager_initialization(void)
 sizeof( POSIX_Keys_Control ),
 /* size of this object's control block */
 true,   /* true if names for this object are strings */
-_POSIX_PATH_MAX /* maximum length of each object's name */
-#if defined(RTEMS_MULTIPROCESSING)
-,
-false,  /* true if this is a global object class */
+_POSIX_PATH_MAX,/* maximum length of each object's name */
 NULL/* Proxy extraction support callout */
-#endif
   );
 
   _POSIX_Keys_Initialize_keypool();
diff --git a/cpukit/posix/src/mqueue.c b/cpukit/posix/src/mqueue.c
index 0f261f6..e5fc3a0 100644
--- a/cpukit/posix/src/mqueue.c
+++ b/cpukit/posix/src/mqueue.c
@@ -58,12 +58,8 @@ static void _POSIX_Message_queue_Manager_initialization(void)
 sizeof( POSIX_Message_queue_Control ),
 /* size of this object's control block */
 true,   /* true if names for this object are strings */
-_POSIX_PATH_MAX /* maximum length of each object's name */
-#if defined(RTEMS_MULTIPROCESSING)
-,
-false,  /* true if this is a global object class */
+_POSIX_PATH_MAX,/* maximum length of each object's name */
 NULL/* Proxy extraction support callout */
-#endif
   );
   _Objects_Initialize_information(
 &_POSIX_Message_queue_Information_fds,
@@ -73,12 +69,8 @@ static void _POSIX_Message_queue_Manager_initialization(void)
 sizeof( POSIX_Message_queue_Control_fd ),
 /* size of this object's control block */
 true,   /* true if names for this object are strings */
-NAME_MAX/* maximum length of each object's name */
-#if defined(RTEMS_MULTIPROCESSING)
-,
-false,  /* true if this is a global object class */
+NAME_MAX,   /* maximum length of each object's name */
 NULL/* Proxy extraction support callout */
-#endif
   );
 }
 
diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c
index ef56d0a..22b14c0 100644
--- a/cpukit/posix/src/mutex.c
+++

[PATCH 10/20] posix: Simplify _POSIX_Mutex_Get_interrupt_disable

2016-04-19 Thread Sebastian Huber
Remove superfluous location parameter.
---
 cpukit/posix/include/rtems/posix/muteximpl.h | 14 +++---
 cpukit/posix/src/mutexget.c  | 13 +++---
 cpukit/posix/src/mutexlocksupp.c | 67 +---
 cpukit/posix/src/mutexsetprioceiling.c   | 55 ---
 cpukit/posix/src/mutexunlock.c   | 45 ++-
 5 files changed, 65 insertions(+), 129 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h 
b/cpukit/posix/include/rtems/posix/muteximpl.h
index c1fab0c..1bd74cc 100644
--- a/cpukit/posix/include/rtems/posix/muteximpl.h
+++ b/cpukit/posix/include/rtems/posix/muteximpl.h
@@ -15,13 +15,14 @@
  *  http://www.rtems.org/license/LICENSE.
  */
 
+#ifndef _RTEMS_POSIX_MUTEXIMPL_H
+#define _RTEMS_POSIX_MUTEXIMPL_H
+
 #include 
 #include 
 
 #include 
-
-#ifndef _RTEMS_POSIX_MUTEXIMPL_H
-#define _RTEMS_POSIX_MUTEXIMPL_H
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -139,10 +140,9 @@ POSIX_Mutex_Control *_POSIX_Mutex_Get (
  *
  *  @note: This version of the method uses an interrupt critical section.
  */
-POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable (
-  pthread_mutex_t   *mutex,
-  Objects_Locations *location,
-  ISR_lock_Context  *lock_context
+POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable(
+  pthread_mutex_t  *mutex,
+  ISR_lock_Context *lock_context
 );
 
 #ifdef __cplusplus
diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c
index 5c0cc42..9ad226a 100644
--- a/cpukit/posix/src/mutexget.c
+++ b/cpukit/posix/src/mutexget.c
@@ -68,20 +68,21 @@ POSIX_Mutex_Control *_POSIX_Mutex_Get (
 _Objects_Get( &_POSIX_Mutex_Information, (Objects_Id) *mutex, location );
 }
 
-POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable (
-  pthread_mutex_t   *mutex,
-  Objects_Locations *location,
-  ISR_lock_Context  *lock_context
+POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable(
+  pthread_mutex_t  *mutex,
+  ISR_lock_Context *lock_context
 )
 {
-  if ( !_POSIX_Mutex_Check_id_and_auto_init( mutex, location ) ) {
+  Objects_Locations location;
+
+  if ( !_POSIX_Mutex_Check_id_and_auto_init( mutex, &location ) ) {
 return NULL;
   }
 
   return (POSIX_Mutex_Control *) _Objects_Get_isr_disable(
 &_POSIX_Mutex_Information,
 (Objects_Id) *mutex,
-location,
+&location,
 lock_context
   );
 }
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index 9e78c9e..3c4e26e 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -18,62 +18,35 @@
 #include "config.h"
 #endif
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 
 THREAD_WAIT_QUEUE_OBJECT_ASSERT( POSIX_Mutex_Control, Mutex.Wait_queue );
 
-/*
- *  _POSIX_Mutex_Lock_support
- *
- *  A support routine which implements guts of the blocking, non-blocking, and
- *  timed wait version of mutex lock.
- */
-
 int _POSIX_Mutex_Lock_support(
-  pthread_mutex_t   *mutex,
-  bool   blocking,
-  Watchdog_Interval  timeout
+  pthread_mutex_t   *mutex,
+  bool   blocking,
+  Watchdog_Interval  timeout
 )
 {
-  POSIX_Mutex_Control  *the_mutex;
-  Objects_Locations location;
-  ISR_lock_Context  lock_context;
-  Thread_Control   *executing;
-
-  the_mutex = _POSIX_Mutex_Get_interrupt_disable(
-mutex,
-&location,
-&lock_context
-  );
-  switch ( location ) {
+  POSIX_Mutex_Control *the_mutex;
+  ISR_lock_Context lock_context;
+  Thread_Control  *executing;
 
-case OBJECTS_LOCAL:
-  executing = _Thread_Executing;
-  _CORE_mutex_Seize(
-&the_mutex->Mutex,
-executing,
-blocking,
-timeout,
-&lock_context
-  );
-  return _POSIX_Mutex_Translate_core_mutex_return_code(
-(CORE_mutex_Status) executing->Wait.return_code
-  );
+  the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &lock_context );
 
-#if defined(RTEMS_MULTIPROCESSING)
-case OBJECTS_REMOTE:
-#endif
-case OBJECTS_ERROR:
-  break;
+  if ( the_mutex == NULL ) {
+return EINVAL;
   }
 
-  return EINVAL;
+  executing = _Thread_Executing;
+  _CORE_mutex_Seize(
+&the_mutex->Mutex,
+executing,
+blocking,
+timeout,
+&lock_context
+  );
+  return _POSIX_Mutex_Translate_core_mutex_return_code(
+(CORE_mutex_Status) executing->Wait.return_code
+  );
 }
diff --git a/cpukit/posix/src/mutexsetprioceiling.c 
b/cpukit/posix/src/mutexsetprioceiling.c
index 718bfc4..1f9f516 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -18,14 +18,7 @@
 #include "config.h"
 #endif
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
 #include 
-#include 
 
 /*
  *  13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
@@ -38,7 +31,6 @@ int pthread_mutex_setprioceiling(
 )
 {
   register POSIX_Mutex_Control 

[PATCH 01/20] score: Delete unused CORE_RWLock_Attributes

2016-04-19 Thread Sebastian Huber
---
 cpukit/posix/src/prwlockinit.c| 10 +-
 cpukit/score/include/rtems/score/corerwlock.h | 14 --
 cpukit/score/include/rtems/score/corerwlockimpl.h | 16 +---
 cpukit/score/src/corerwlock.c |  8 +---
 4 files changed, 3 insertions(+), 45 deletions(-)

diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c
index 7cf781f..afb7056 100644
--- a/cpukit/posix/src/prwlockinit.c
+++ b/cpukit/posix/src/prwlockinit.c
@@ -97,7 +97,6 @@ int pthread_rwlock_init(
 )
 {
   POSIX_RWLock_Control*the_rwlock;
-  CORE_RWLock_Attributes   the_attributes;
   pthread_rwlockattr_t default_attr;
   const pthread_rwlockattr_t  *the_attr;
 
@@ -131,13 +130,6 @@ int pthread_rwlock_init(
   return EINVAL;
   }
 
-  /*
-   * Convert from POSIX attributes to Core RWLock attributes
-   * 
-   * NOTE: Currently there are no core rwlock attributes
-   */
-  _CORE_RWLock_Initialize_attributes( &the_attributes );
-
   the_rwlock = _POSIX_RWLock_Allocate();
 
   if ( !the_rwlock ) {
@@ -145,7 +137,7 @@ int pthread_rwlock_init(
 return EAGAIN;
   }
 
-  _CORE_RWLock_Initialize( &the_rwlock->RWLock, &the_attributes );
+  _CORE_RWLock_Initialize( &the_rwlock->RWLock );
 
   _Objects_Open_u32(
 &_POSIX_RWLock_Information,
diff --git a/cpukit/score/include/rtems/score/corerwlock.h 
b/cpukit/score/include/rtems/score/corerwlock.h
index f211339..89c18c6 100644
--- a/cpukit/score/include/rtems/score/corerwlock.h
+++ b/cpukit/score/include/rtems/score/corerwlock.h
@@ -51,16 +51,6 @@ typedef enum {
 }   CORE_RWLock_States;
 
 /**
- *  The following defines the control block used to manage the
- *  attributes of each RWLock.
- */
-typedef struct {
-  /** This field indicates XXX.
-   */
-  int XXX;
-}   CORE_RWLock_Attributes;
-
-/**
  *  The following defines the control block used to manage each
  *  RWLock.
  */
@@ -69,10 +59,6 @@ typedef struct {
*  which are blocked waiting for the RWLock to be released.
*/
   Thread_queue_Control Wait_queue;
-  /** This element is the set of attributes which define this instance's
-   *  behavior.
-   */
-  CORE_RWLock_Attributes  Attributes;
   /** This element is the current state of the RWLock.
*/
   CORE_RWLock_States   current_state;
diff --git a/cpukit/score/include/rtems/score/corerwlockimpl.h 
b/cpukit/score/include/rtems/score/corerwlockimpl.h
index b9803c4..a8e890f 100644
--- a/cpukit/score/include/rtems/score/corerwlockimpl.h
+++ b/cpukit/score/include/rtems/score/corerwlockimpl.h
@@ -74,11 +74,9 @@ typedef enum {
  *  This routine initializes the RWLock based on the parameters passed.
  *
  *  @param[in] the_rwlock is the RWLock to initialize
- *  @param[in] the_rwlock_attributes define the behavior of this instance
  */
 void _CORE_RWLock_Initialize(
-  CORE_RWLock_Control   *the_rwlock,
-  CORE_RWLock_Attributes*the_rwlock_attributes
+  CORE_RWLock_Control *the_rwlock
 );
 
 RTEMS_INLINE_ROUTINE void _CORE_RWLock_Destroy(
@@ -142,18 +140,6 @@ CORE_RWLock_Status _CORE_RWLock_Release(
   Thread_Control  *executing
 );
 
-/**
- * This method is used to initialize core rwlock attributes.
- *
- * @param[in] the_attributes pointer to the attributes to initialize.
- */
-RTEMS_INLINE_ROUTINE void _CORE_RWLock_Initialize_attributes(
-  CORE_RWLock_Attributes *the_attributes
-)
-{
-  the_attributes->XXX = 0;
-}
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/corerwlock.c b/cpukit/score/src/corerwlock.c
index 23bb5e2..eae6258 100644
--- a/cpukit/score/src/corerwlock.c
+++ b/cpukit/score/src/corerwlock.c
@@ -22,15 +22,9 @@
 #include 
 
 void _CORE_RWLock_Initialize(
-  CORE_RWLock_Control   *the_rwlock,
-  CORE_RWLock_Attributes*the_rwlock_attributes
+  CORE_RWLock_Control *the_rwlock
 )
 {
-
-  the_rwlock->Attributes= *the_rwlock_attributes;
-/*
-  the_rwlock->number_of_waiting_threads = 0;
-*/
   the_rwlock->number_of_readers = 0;
   the_rwlock->current_state = CORE_RWLOCK_UNLOCKED;
 
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 03/20] score: Simplify _CORE_message_queue_Close()

2016-04-19 Thread Sebastian Huber
Drop status parameter since each caller used
CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED.

Remove superfluous _CORE_message_queue_Flush().
---
 cpukit/posix/src/mqueuedeletesupp.c|  1 -
 cpukit/rtems/src/msgqdelete.c  |  1 -
 cpukit/score/include/rtems/score/coremsgimpl.h | 11 ++-
 cpukit/score/src/coremsgclose.c|  5 ++---
 4 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/cpukit/posix/src/mqueuedeletesupp.c 
b/cpukit/posix/src/mqueuedeletesupp.c
index 30b8b7d..b852b04 100644
--- a/cpukit/posix/src/mqueuedeletesupp.c
+++ b/cpukit/posix/src/mqueuedeletesupp.c
@@ -59,7 +59,6 @@ void _POSIX_Message_queue_Delete(
 
   _CORE_message_queue_Close(
 &the_mq->Message_queue,
-CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
 NULL,/* no MP support */
 0
   );
diff --git a/cpukit/rtems/src/msgqdelete.c b/cpukit/rtems/src/msgqdelete.c
index d6e773d..5adeab7 100644
--- a/cpukit/rtems/src/msgqdelete.c
+++ b/cpukit/rtems/src/msgqdelete.c
@@ -47,7 +47,6 @@ rtems_status_code rtems_message_queue_delete(
 
   _CORE_message_queue_Close(
 &the_message_queue->message_queue,
-CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
 _Message_queue_MP_Send_object_was_deleted,
 id
   );
diff --git a/cpukit/score/include/rtems/score/coremsgimpl.h 
b/cpukit/score/include/rtems/score/coremsgimpl.h
index d7d5c46..98d97dd 100644
--- a/cpukit/score/include/rtems/score/coremsgimpl.h
+++ b/cpukit/score/include/rtems/score/coremsgimpl.h
@@ -129,8 +129,7 @@ bool _CORE_message_queue_Initialize(
 );
 
 void _CORE_message_queue_Do_close(
-  CORE_message_queue_Control *the_message_queue,
-  uint32_tstatus
+  CORE_message_queue_Control *the_message_queue
 #if defined(RTEMS_MULTIPROCESSING)
   ,
   Thread_queue_MP_callout mp_callout,
@@ -149,8 +148,6 @@ void _CORE_message_queue_Do_close(
  *  flushing @a the_message_queue's task wait queue.
  *
  *  @param[in] the_message_queue points to the message queue to close
- *  @param[in] status is the status that each waiting thread will return
- * from it's blocking service
  *  @param[in] mp_callout is the routine to call for each thread
  * that is extracted from the set of waiting threads
  *  @param[in] mp_id the object identifier of the message queue object
@@ -158,26 +155,22 @@ void _CORE_message_queue_Do_close(
 #if defined(RTEMS_MULTIPROCESSING)
   #define _CORE_message_queue_Close( \
 the_message_queue, \
-status, \
 mp_callout, \
 mp_id \
   ) \
 _CORE_message_queue_Do_close( \
   the_message_queue, \
-  status, \
   mp_callout, \
   mp_id \
 )
 #else
   #define _CORE_message_queue_Close( \
 the_message_queue, \
-status, \
 mp_callout, \
 mp_id \
   ) \
 _CORE_message_queue_Do_close( \
-  the_message_queue, \
-  status \
+  the_message_queue \
 )
 #endif
 
diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c
index e070d98..1511f83 100644
--- a/cpukit/score/src/coremsgclose.c
+++ b/cpukit/score/src/coremsgclose.c
@@ -22,8 +22,7 @@
 #include 
 
 void _CORE_message_queue_Do_close(
-  CORE_message_queue_Control *the_message_queue,
-  uint32_tstatus
+  CORE_message_queue_Control *the_message_queue
 #if defined(RTEMS_MULTIPROCESSING)
   ,
   Thread_queue_MP_callout mp_callout,
@@ -39,7 +38,7 @@ void _CORE_message_queue_Do_close(
   _Thread_queue_Flush(
 &the_message_queue->Wait_queue,
 the_message_queue->operations,
-status,
+CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
 mp_callout,
 mp_id
   );
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 07/20] score: Close semaphore object before flush

2016-04-19 Thread Sebastian Huber
This prevents use of the object after the flush on uni-processor
configurations.
---
 cpukit/rtems/src/semdelete.c| 55 +
 cpukit/score/include/rtems/score/mrspimpl.h |  9 +++--
 2 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index d3d6264..f503cd9 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -48,9 +48,9 @@ rtems_status_code rtems_semaphore_delete(
   attribute_set = the_semaphore->attribute_set;
 #if defined(RTEMS_SMP)
   if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
-MRSP_Status mrsp_status = _MRSP_Destroy(
-  &the_semaphore->Core_control.mrsp
-);
+MRSP_Status mrsp_status;
+
+mrsp_status = _MRSP_Can_destroy( &the_semaphore->Core_control.mrsp );
 if ( mrsp_status != MRSP_SUCCESSFUL ) {
   _Objects_Put( &the_semaphore->Object );
   _Objects_Allocator_unlock();
@@ -58,26 +58,14 @@ rtems_status_code rtems_semaphore_delete(
 }
   } else
 #endif
-  if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
-if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) &&
- !_Attributes_Is_simple_binary_semaphore( attribute_set ) ) {
-  _Objects_Put( &the_semaphore->Object );
-  _Objects_Allocator_unlock();
-  return RTEMS_RESOURCE_IN_USE;
-}
-_CORE_mutex_Flush(
-  &the_semaphore->Core_control.mutex,
-  CORE_MUTEX_WAS_DELETED,
-  _Semaphore_MP_Send_object_was_deleted,
-  id
-);
-_CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
-  } else {
-_CORE_semaphore_Destroy(
-  &the_semaphore->Core_control.semaphore,
-  _Semaphore_MP_Send_object_was_deleted,
-  id
-)
+  if (
+!_Attributes_Is_counting_semaphore( attribute_set )
+  && _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex )
+  && !_Attributes_Is_simple_binary_semaphore( attribute_set )
+  ) {
+_Objects_Put( &the_semaphore->Object );
+_Objects_Allocator_unlock();
+return RTEMS_RESOURCE_IN_USE;
   }
 
   _Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
@@ -96,6 +84,27 @@ rtems_status_code rtems_semaphore_delete(
   }
 #endif
 
+#if defined(RTEMS_SMP)
+  if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
+_MRSP_Destroy( &the_semaphore->Core_control.mrsp );
+  } else
+#endif
+  if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
+_CORE_mutex_Flush(
+  &the_semaphore->Core_control.mutex,
+  CORE_MUTEX_WAS_DELETED,
+  _Semaphore_MP_Send_object_was_deleted,
+  id
+);
+_CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
+  } else {
+_CORE_semaphore_Destroy(
+  &the_semaphore->Core_control.semaphore,
+  _Semaphore_MP_Send_object_was_deleted,
+  id
+);
+  }
+
   _Objects_Put( &the_semaphore->Object );
   _Semaphore_Free( the_semaphore );
   _Objects_Allocator_unlock();
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h 
b/cpukit/score/include/rtems/score/mrspimpl.h
index 7638fb5..1287ad1 100644
--- a/cpukit/score/include/rtems/score/mrspimpl.h
+++ b/cpukit/score/include/rtems/score/mrspimpl.h
@@ -398,16 +398,19 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Release(
   return MRSP_SUCCESSFUL;
 }
 
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Destroy( MRSP_Control *mrsp )
+RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Can_destroy( MRSP_Control *mrsp )
 {
   if ( _Resource_Get_owner( &mrsp->Resource ) != NULL ) {
 return MRSP_RESOUCE_IN_USE;
   }
 
+  return MRSP_SUCCESSFUL;
+}
+
+RTEMS_INLINE_ROUTINE void _MRSP_Destroy( MRSP_Control *mrsp )
+{
   _ISR_lock_Destroy( &mrsp->Lock );
   _Workspace_Free( mrsp->ceiling_priorities );
-
-  return MRSP_SUCCESSFUL;
 }
 
 /** @} */
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 13/20] score: Introduce _Thread_queue_Flush_critical()

2016-04-19 Thread Sebastian Huber
Replace _Thread_queue_Flush() with _Thread_queue_Flush_critical() and
add a filter function for customization of the thread queue flush
operation.

Update #2555.
---
 cpukit/rtems/src/semdelete.c   |  2 +-
 cpukit/rtems/src/semflush.c|  2 +-
 cpukit/score/include/rtems/score/corebarrierimpl.h | 28 +--
 cpukit/score/include/rtems/score/coremuteximpl.h   | 36 +++--
 cpukit/score/include/rtems/score/coresemimpl.h | 46 ---
 cpukit/score/include/rtems/score/threadqimpl.h | 59 ++
 cpukit/score/src/corebarrier.c | 12 ++-
 cpukit/score/src/coremsgclose.c| 21 -
 cpukit/score/src/coremsgflush.c|  2 +-
 cpukit/score/src/coremutex.c   | 22 ++
 cpukit/score/src/coresem.c | 22 ++
 cpukit/score/src/threadqflush.c| 90 +++---
 12 files changed, 266 insertions(+), 76 deletions(-)

diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index f503cd9..48a9055 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -92,7 +92,7 @@ rtems_status_code rtems_semaphore_delete(
   if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
 _CORE_mutex_Flush(
   &the_semaphore->Core_control.mutex,
-  CORE_MUTEX_WAS_DELETED,
+  _CORE_mutex_Was_deleted,
   _Semaphore_MP_Send_object_was_deleted,
   id
 );
diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
index 64386b0..01c5c0d 100644
--- a/cpukit/rtems/src/semflush.c
+++ b/cpukit/rtems/src/semflush.c
@@ -53,7 +53,7 @@ rtems_status_code rtems_semaphore_flush(
   if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
 _CORE_mutex_Flush(
   &the_semaphore->Core_control.mutex,
-  CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
+  _CORE_mutex_Unsatisfied_nowait,
   _Semaphore_MP_Send_object_was_deleted,
   id
 );
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h 
b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 1d77405..8e923df 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -193,19 +193,33 @@ uint32_t _CORE_barrier_Do_release(
 )
 #endif
 
+Thread_Control *_CORE_barrier_Was_deleted(
+  Thread_Control   *the_thread,
+  Thread_queue_Control *the_thread_queue,
+  ISR_lock_Context *lock_context
+);
+
 /* Must be a macro due to the multiprocessing dependent parameters */
 #define _CORE_barrier_Flush( \
   the_barrier, \
   mp_callout, \
   mp_id \
 ) \
-  _Thread_queue_Flush( \
-&( the_barrier )->Wait_queue, \
-CORE_BARRIER_TQ_OPERATIONS, \
-CORE_BARRIER_WAS_DELETED, \
-mp_callout, \
-mp_id \
-  )
+  do { \
+ISR_lock_Context _core_barrier_flush_lock_context; \
+_Thread_queue_Acquire( \
+  &( the_barrier )->Wait_queue, \
+  &_core_barrier_flush_lock_context \
+); \
+_Thread_queue_Flush_critical( \
+  &( the_barrier )->Wait_queue, \
+  CORE_BARRIER_TQ_OPERATIONS, \
+  _CORE_barrier_Was_deleted, \
+  mp_callout, \
+  mp_id, \
+  &_core_barrier_flush_lock_context \
+); \
+  } while ( 0 )
 
 /**
  * This function returns true if the automatic release attribute is
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h 
b/cpukit/score/include/rtems/score/coremuteximpl.h
index eae6ef1..0f79923 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -338,20 +338,40 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
 )
 #endif
 
+Thread_Control *_CORE_mutex_Was_deleted(
+  Thread_Control   *the_thread,
+  Thread_queue_Control *the_thread_queue,
+  ISR_lock_Context *lock_context
+);
+
+Thread_Control *_CORE_mutex_Unsatisfied_nowait(
+  Thread_Control   *the_thread,
+  Thread_queue_Control *the_thread_queue,
+  ISR_lock_Context *lock_context
+);
+
 /* Must be a macro due to the multiprocessing dependent parameters */
 #define _CORE_mutex_Flush( \
   the_mutex, \
-  status, \
+  filter, \
   mp_callout, \
   mp_id \
 ) \
-  _Thread_queue_Flush( \
-&( the_mutex )->Wait_queue, \
-( the_mutex )->operations, \
-status, \
-mp_callout, \
-mp_id \
-  )
+  do { \
+ISR_lock_Context _core_mutex_flush_lock_context; \
+_Thread_queue_Acquire( \
+  &( the_mutex )->Wait_queue, \
+  &_core_mutex_flush_lock_context \
+); \
+_Thread_queue_Flush_critical( \
+  &( the_mutex )->Wait_queue, \
+  ( the_mutex )->operations, \
+  filter, \
+  mp_callout, \
+  mp_id, \
+  &_core_mutex_flush_lock_context \
+); \
+  } while ( 0 )
 
 /**
  * @brief Is mutex locked.
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h 
b/cpukit/score/include/rtems/score/coresemimpl.h
index d68c3d7..a341f28 

[PATCH 17/20] score: Optimize _Objects_Get_local()

2016-04-19 Thread Sebastian Huber
Make the id the first parameter since usual callers get the object
identifier as the first parameter themself.
---
 cpukit/posix/include/rtems/posix/spinlockimpl.h | 2 +-
 cpukit/posix/include/rtems/posix/timerimpl.h| 2 +-
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h  | 2 +-
 cpukit/rtems/include/rtems/rtems/timerimpl.h| 2 +-
 cpukit/score/include/rtems/score/objectimpl.h   | 7 ---
 cpukit/score/src/objectgetlocal.c   | 2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/spinlockimpl.h 
b/cpukit/posix/include/rtems/posix/spinlockimpl.h
index 0904050..c5aa343 100644
--- a/cpukit/posix/include/rtems/posix/spinlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -85,8 +85,8 @@ RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control 
*_POSIX_Spinlock_Get(
   }
 
   return (POSIX_Spinlock_Control *) _Objects_Get_local(
-&_POSIX_Spinlock_Information,
 *spinlock,
+&_POSIX_Spinlock_Information,
 lock_context
   );
 }
diff --git a/cpukit/posix/include/rtems/posix/timerimpl.h 
b/cpukit/posix/include/rtems/posix/timerimpl.h
index bf25629..95ccc4e 100644
--- a/cpukit/posix/include/rtems/posix/timerimpl.h
+++ b/cpukit/posix/include/rtems/posix/timerimpl.h
@@ -98,8 +98,8 @@ RTEMS_INLINE_ROUTINE POSIX_Timer_Control *_POSIX_Timer_Get (
 )
 {
   return (POSIX_Timer_Control *) _Objects_Get_local(
-&_POSIX_Timer_Information,
 (Objects_Id) id,
+&_POSIX_Timer_Information,
 lock_context
   );
 }
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h 
b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index 28837a2..200ff80 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -90,7 +90,7 @@ RTEMS_INLINE_ROUTINE Rate_monotonic_Control 
*_Rate_monotonic_Get(
 )
 {
   return (Rate_monotonic_Control *)
-_Objects_Get_local( &_Rate_monotonic_Information, id, lock_context );
+_Objects_Get_local( id, &_Rate_monotonic_Information, lock_context );
 }
 
 void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
diff --git a/cpukit/rtems/include/rtems/rtems/timerimpl.h 
b/cpukit/rtems/include/rtems/rtems/timerimpl.h
index 40e2b5f..9a52762 100644
--- a/cpukit/rtems/include/rtems/rtems/timerimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/timerimpl.h
@@ -88,8 +88,8 @@ RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get(
 )
 {
   return (Timer_Control *) _Objects_Get_local(
-&_Timer_Information,
 id,
+&_Timer_Information,
 lock_context
   );
 }
diff --git a/cpukit/score/include/rtems/score/objectimpl.h 
b/cpukit/score/include/rtems/score/objectimpl.h
index fb45977..776c871 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -629,9 +629,10 @@ Objects_Control *_Objects_Get_isr_disable(
  * an associated object exists, then interrupts remain disabled, otherwise the
  * previous interrupt state is restored.
  *
+ * @param id The object identifier.  This is the first parameter since usual
+ *   callers get the object identifier as the first parameter themself.
  * @param information The object class information block.
- * @param[in] id The object identifier.
- * @param[in] lock_context The interrupt lock context.
+ * @param lock_context The interrupt lock context.
  *
  * @retval NULL No associated object exists.
  * @retval other The pointer to the associated object control block.
@@ -639,8 +640,8 @@ Objects_Control *_Objects_Get_isr_disable(
  * context via _ISR_lock_ISR_enable() or _ISR_lock_Release_and_ISR_enable().
  */
 Objects_Control *_Objects_Get_local(
-  const Objects_Information *information,
   Objects_Id id,
+  const Objects_Information *information,
   ISR_lock_Context  *lock_context
 );
 
diff --git a/cpukit/score/src/objectgetlocal.c 
b/cpukit/score/src/objectgetlocal.c
index 8a93a76..1134095 100644
--- a/cpukit/score/src/objectgetlocal.c
+++ b/cpukit/score/src/objectgetlocal.c
@@ -26,8 +26,8 @@
 #include 
 
 Objects_Control *_Objects_Get_local(
-  const Objects_Information *information,
   Objects_Id id,
+  const Objects_Information *information,
   ISR_lock_Context  *lock_context
 )
 {
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 18/20] score: Rename _MRSP_Obtain()

2016-04-19 Thread Sebastian Huber
Rename _MRSP_Obtain() into _MRSP_Seize().  Rename _MRSP_Release() into
_MRSP_Surrender().  This avoids confusion with the ISR lock acquire and
release.
---
 cpukit/rtems/src/semobtain.c| 2 +-
 cpukit/rtems/src/semrelease.c   | 2 +-
 cpukit/score/include/rtems/score/mrspimpl.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 556738f..e3d6f3c 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -69,7 +69,7 @@ rtems_status_code rtems_semaphore_obtain(
   if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
 MRSP_Status mrsp_status;
 
-mrsp_status = _MRSP_Obtain(
+mrsp_status = _MRSP_Seize(
   &the_semaphore->Core_control.mrsp,
   executing,
   wait,
diff --git a/cpukit/rtems/src/semrelease.c b/cpukit/rtems/src/semrelease.c
index 4a6ccb2..762328c 100644
--- a/cpukit/rtems/src/semrelease.c
+++ b/cpukit/rtems/src/semrelease.c
@@ -57,7 +57,7 @@ rtems_status_code rtems_semaphore_release(
   if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
 MRSP_Status mrsp_status;
 
-mrsp_status = _MRSP_Release(
+mrsp_status = _MRSP_Surrender(
   &the_semaphore->Core_control.mrsp,
   _Thread_Executing,
   &lock_context
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h 
b/cpukit/score/include/rtems/score/mrspimpl.h
index 1287ad1..1529b1a 100644
--- a/cpukit/score/include/rtems/score/mrspimpl.h
+++ b/cpukit/score/include/rtems/score/mrspimpl.h
@@ -268,7 +268,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership(
   return status;
 }
 
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Obtain(
+RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
   MRSP_Control  *mrsp,
   Thread_Control*executing,
   bool   wait,
@@ -326,7 +326,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Obtain(
   return status;
 }
 
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Release(
+RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
   MRSP_Control *mrsp,
   Thread_Control   *executing,
   ISR_lock_Context *lock_context
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 16/20] score: Optimize _Objects_Get_no_protection()

2016-04-19 Thread Sebastian Huber
Make the id the first parameter since usual callers get the object
identifier as the first parameter themself.
---
 cpukit/posix/include/rtems/posix/keyimpl.h| 2 +-
 cpukit/rtems/include/rtems/rtems/regionimpl.h | 2 +-
 cpukit/sapi/include/rtems/extensionimpl.h | 2 +-
 cpukit/score/include/rtems/score/objectimpl.h | 8 +---
 cpukit/score/src/objectgetnext.c  | 2 +-
 cpukit/score/src/objectgetnoprotection.c  | 4 ++--
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/keyimpl.h 
b/cpukit/posix/include/rtems/posix/keyimpl.h
index 1f87470..833e652 100644
--- a/cpukit/posix/include/rtems/posix/keyimpl.h
+++ b/cpukit/posix/include/rtems/posix/keyimpl.h
@@ -77,7 +77,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free(
 RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get( pthread_key_t key )
 {
   return (POSIX_Keys_Control *)
-_Objects_Get_no_protection( &_POSIX_Keys_Information, (Objects_Id) key );
+_Objects_Get_no_protection( (Objects_Id) key, &_POSIX_Keys_Information );
 }
 
 RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_acquire(
diff --git a/cpukit/rtems/include/rtems/rtems/regionimpl.h 
b/cpukit/rtems/include/rtems/rtems/regionimpl.h
index 4db6599..e4dcff0 100644
--- a/cpukit/rtems/include/rtems/rtems/regionimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/regionimpl.h
@@ -73,7 +73,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get_and_lock( 
Objects_Id id )
   _RTEMS_Lock_allocator();
 
   the_region = (Region_Control *)
-_Objects_Get_no_protection( &_Region_Information, id );
+_Objects_Get_no_protection( id, &_Region_Information );
 
   if ( the_region != NULL ) {
 /* Keep allocator lock */
diff --git a/cpukit/sapi/include/rtems/extensionimpl.h 
b/cpukit/sapi/include/rtems/extensionimpl.h
index 64ac600..fb4eeaf 100644
--- a/cpukit/sapi/include/rtems/extensionimpl.h
+++ b/cpukit/sapi/include/rtems/extensionimpl.h
@@ -42,7 +42,7 @@ RTEMS_INLINE_ROUTINE void _Extension_Free (
 RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get( Objects_Id id )
 {
   return (Extension_Control *)
-_Objects_Get_no_protection( &_Extension_Information, id );
+_Objects_Get_no_protection( id, &_Extension_Information );
 }
 
 #ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/objectimpl.h 
b/cpukit/score/include/rtems/score/objectimpl.h
index 6877b8e..fb45977 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -656,8 +656,10 @@ Objects_Control *_Objects_Get_local(
  *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
  *  and the_object is undefined.
  *
- *  @param[in] information points to an object class information block.
  *  @param[in] id is the Id of the object whose name we are locating.
+ *This is the first parameter since usual callers get the object identifier
+ *as the first parameter themself.
+ *  @param[in] information points to an object class information block.
  *
  *  @retval This method returns one of the values from the
  *  @ref Objects_Name_or_id_lookup_errors enumeration to indicate
@@ -670,8 +672,8 @@ Objects_Control *_Objects_Get_local(
  *  objects.
  */
 Objects_Control *_Objects_Get_no_protection(
-  const Objects_Information *information,
-  Objects_Id id
+  Objects_Id id,
+  const Objects_Information *information
 );
 
 /**
diff --git a/cpukit/score/src/objectgetnext.c b/cpukit/score/src/objectgetnext.c
index 2d4f252..a46c02f 100644
--- a/cpukit/score/src/objectgetnext.c
+++ b/cpukit/score/src/objectgetnext.c
@@ -52,7 +52,7 @@ Objects_Control *_Objects_Get_next(
 }
 
 /* try to grab one */
-the_object = _Objects_Get_no_protection( information, next_id );
+the_object = _Objects_Get_no_protection( next_id, information );
 
 next_id++;
 
diff --git a/cpukit/score/src/objectgetnoprotection.c 
b/cpukit/score/src/objectgetnoprotection.c
index eaa172c..8569223 100644
--- a/cpukit/score/src/objectgetnoprotection.c
+++ b/cpukit/score/src/objectgetnoprotection.c
@@ -21,8 +21,8 @@
 #include 
 
 Objects_Control *_Objects_Get_no_protection(
-  const Objects_Information *information,
-  Objects_Id id
+  Objects_Id id,
+  const Objects_Information *information
 )
 {
   Objects_Control *the_object;
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 08/20] score: Remove id parameter _CORE_mutex_Seize()

2016-04-19 Thread Sebastian Huber
Parameter was unused.
---
 cpukit/libnetworking/rtems/rtems_glue.c  | 1 -
 cpukit/posix/src/mutexlocksupp.c | 1 -
 cpukit/rtems/src/semobtain.c | 1 -
 cpukit/score/include/rtems/score/coremuteximpl.h | 8 ++--
 cpukit/score/src/apimutexlock.c  | 1 -
 cpukit/score/src/coremutexseize.c| 2 --
 6 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/cpukit/libnetworking/rtems/rtems_glue.c 
b/cpukit/libnetworking/rtems/rtems_glue.c
index 17df156..38c7fd5 100644
--- a/cpukit/libnetworking/rtems/rtems_glue.c
+++ b/cpukit/libnetworking/rtems/rtems_glue.c
@@ -394,7 +394,6 @@ rtems_bsdnet_semaphore_obtain (void)
_CORE_mutex_Seize (
&the_networkSemaphore->Core_control.mutex,
executing,
-   networkSemaphore,
1,  /* wait */
0,  /* forever */
&lock_context
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index 0ec9b85..9e78c9e 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -60,7 +60,6 @@ int _POSIX_Mutex_Lock_support(
   _CORE_mutex_Seize(
 &the_mutex->Mutex,
 executing,
-the_mutex->Object.id,
 blocking,
 timeout,
 &lock_context
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 0b43af4..556738f 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -83,7 +83,6 @@ rtems_status_code rtems_semaphore_obtain(
 _CORE_mutex_Seize(
   &the_semaphore->Core_control.mutex,
   executing,
-  id,
   wait,
   timeout,
   &lock_context
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h 
b/cpukit/score/include/rtems/score/coremuteximpl.h
index 7facabb..e423d84 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -212,7 +212,6 @@ void _CORE_mutex_Seize_interrupt_blocking(
  *  support routine @a _Core_mutex_Seize_interrupt_blocking.
  *
  *  @param[in] the_mutex is the mutex to attempt to lock
- *  @param[in] id is the Id of the owning API level Semaphore object
  *  @param[in] wait is true if the thread is willing to wait
  *  @param[in] timeout is the maximum number of ticks to block
  *  @param[in] lock_context is a temporary variable used to contain the ISR
@@ -234,7 +233,6 @@ void _CORE_mutex_Seize_interrupt_blocking(
 RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
   CORE_mutex_Control  *the_mutex,
   Thread_Control  *executing,
-  Objects_Id   id,
   bool wait,
   Watchdog_Intervaltimeout,
   ISR_lock_Context*lock_context
@@ -269,7 +267,6 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
  *
  *  @param[in] _the_mutex is the mutex to attempt to lock
  *  @param[in] _executing The currently executing thread.
- *  @param[in] _id is the Id of the owning API level Semaphore object
  *  @param[in] _wait is true if the thread is willing to wait
  *  @param[in] _timeout is the maximum number of ticks to block
  *  @param[in] _lock_context is a temporary variable used to contain the ISR
@@ -279,16 +276,15 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
   void _CORE_mutex_Seize(
 CORE_mutex_Control  *_the_mutex,
 Thread_Control  *_executing,
-Objects_Id   _id,
 bool _wait,
 Watchdog_Interval_timeout,
 ISR_lock_Context*_lock_context
   );
 #else
   #define _CORE_mutex_Seize( \
-  _the_mutex, _executing, _id, _wait, _timeout, _lock_context ) \
+  _the_mutex, _executing, _wait, _timeout, _lock_context ) \
_CORE_mutex_Seize_body( \
- _the_mutex, _executing, _id, _wait, _timeout, _lock_context )
+ _the_mutex, _executing, _wait, _timeout, _lock_context )
 #endif
 
 CORE_mutex_Status _CORE_mutex_Do_surrender(
diff --git a/cpukit/score/src/apimutexlock.c b/cpukit/score/src/apimutexlock.c
index bcac71a..2e36518 100644
--- a/cpukit/score/src/apimutexlock.c
+++ b/cpukit/score/src/apimutexlock.c
@@ -35,7 +35,6 @@ void _API_Mutex_Lock( API_Mutex_Control *the_mutex )
   _CORE_mutex_Seize(
 &the_mutex->Mutex,
 _Thread_Executing,
-the_mutex->Object.id,
 true,
 0,
 &lock_context
diff --git a/cpukit/score/src/coremutexseize.c 
b/cpukit/score/src/coremutexseize.c
index fa45151..d76c977 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -28,7 +28,6 @@
 void _CORE_mutex_Seize(
   CORE_mutex_Control  *_the_mutex,
   Thread_Control  *_executing,
-  Objects_Id   _id,
   bool _wait,
   Watchdog_Interval_timeout,
   ISR_Level_level
@@ -37,7 +36,6 @@ void _CORE_mutex_Seize(
   _CORE_mutex_Seize_body(
 _the_mutex,
 _executing,
-_id,
 _wait,
 _timeout,
 _level
-- 
1.8.4.5

___

[PATCH 20/20] score: Rename _CORE_RWLock_Obtain()

2016-04-19 Thread Sebastian Huber
Rename _CORE_RWLock_Obtain_for_reading() into
_CORE_RWLock_Seize_for_reading().  Rename
_CORE_RWLock_Obtain_for_writing() into _CORE_RWLock_Seize_for_writing().
Rename _CORE_RWLock_Release() into _CORE_RWLock_Surrender().  This
avoids confusion with the ISR lock acquire and release.
---
 cpukit/posix/src/prwlockrdlock.c  | 2 +-
 cpukit/posix/src/prwlocktimedrdlock.c | 2 +-
 cpukit/posix/src/prwlocktimedwrlock.c | 2 +-
 cpukit/posix/src/prwlocktryrdlock.c   | 2 +-
 cpukit/posix/src/prwlocktrywrlock.c   | 2 +-
 cpukit/posix/src/prwlockunlock.c  | 2 +-
 cpukit/posix/src/prwlockwrlock.c  | 2 +-
 cpukit/score/include/rtems/score/corerwlockimpl.h | 6 +++---
 cpukit/score/src/corerwlockobtainread.c   | 2 +-
 cpukit/score/src/corerwlockobtainwrite.c  | 2 +-
 cpukit/score/src/corerwlockrelease.c  | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/cpukit/posix/src/prwlockrdlock.c b/cpukit/posix/src/prwlockrdlock.c
index c6bf5fc..7d1bcaa 100644
--- a/cpukit/posix/src/prwlockrdlock.c
+++ b/cpukit/posix/src/prwlockrdlock.c
@@ -47,7 +47,7 @@ int pthread_rwlock_rdlock(
 case OBJECTS_LOCAL:
 
   executing = _Thread_Executing;
-  _CORE_RWLock_Obtain_for_reading(
+  _CORE_RWLock_Seize_for_reading(
 &the_rwlock->RWLock,
 executing,
 true, /* we are willing to wait forever */
diff --git a/cpukit/posix/src/prwlocktimedrdlock.c 
b/cpukit/posix/src/prwlocktimedrdlock.c
index b94fe1b..0f2878b 100644
--- a/cpukit/posix/src/prwlocktimedrdlock.c
+++ b/cpukit/posix/src/prwlocktimedrdlock.c
@@ -73,7 +73,7 @@ int pthread_rwlock_timedrdlock(
 case OBJECTS_LOCAL:
 
   executing = _Thread_Executing;
-  _CORE_RWLock_Obtain_for_reading(
+  _CORE_RWLock_Seize_for_reading(
 &the_rwlock->RWLock,
 executing,
 do_wait,
diff --git a/cpukit/posix/src/prwlocktimedwrlock.c 
b/cpukit/posix/src/prwlocktimedwrlock.c
index 42a8068..51558de 100644
--- a/cpukit/posix/src/prwlocktimedwrlock.c
+++ b/cpukit/posix/src/prwlocktimedwrlock.c
@@ -75,7 +75,7 @@ int pthread_rwlock_timedwrlock(
 case OBJECTS_LOCAL:
 
   executing = _Thread_Executing;
-  _CORE_RWLock_Obtain_for_writing(
+  _CORE_RWLock_Seize_for_writing(
 &the_rwlock->RWLock,
 executing,
 do_wait,
diff --git a/cpukit/posix/src/prwlocktryrdlock.c 
b/cpukit/posix/src/prwlocktryrdlock.c
index 72413e4..642ed86 100644
--- a/cpukit/posix/src/prwlocktryrdlock.c
+++ b/cpukit/posix/src/prwlocktryrdlock.c
@@ -51,7 +51,7 @@ int pthread_rwlock_tryrdlock(
 case OBJECTS_LOCAL:
 
   executing = _Thread_Executing;
-  _CORE_RWLock_Obtain_for_reading(
+  _CORE_RWLock_Seize_for_reading(
 &the_rwlock->RWLock,
 executing,
 false,  /* do not wait for the rwlock */
diff --git a/cpukit/posix/src/prwlocktrywrlock.c 
b/cpukit/posix/src/prwlocktrywrlock.c
index 23f7d80..065199b 100644
--- a/cpukit/posix/src/prwlocktrywrlock.c
+++ b/cpukit/posix/src/prwlocktrywrlock.c
@@ -51,7 +51,7 @@ int pthread_rwlock_trywrlock(
 case OBJECTS_LOCAL:
 
   executing = _Thread_Executing;
-  _CORE_RWLock_Obtain_for_writing(
+  _CORE_RWLock_Seize_for_writing(
 &the_rwlock->RWLock,
 executing,
 false, /* we are not willing to wait */
diff --git a/cpukit/posix/src/prwlockunlock.c b/cpukit/posix/src/prwlockunlock.c
index 9b61a5c..5dc7099 100644
--- a/cpukit/posix/src/prwlockunlock.c
+++ b/cpukit/posix/src/prwlockunlock.c
@@ -51,7 +51,7 @@ int pthread_rwlock_unlock(
   switch ( location ) {
 
 case OBJECTS_LOCAL:
-  status = _CORE_RWLock_Release( &the_rwlock->RWLock, _Thread_Executing );
+  status = _CORE_RWLock_Surrender( &the_rwlock->RWLock, _Thread_Executing 
);
   _Objects_Put( &the_rwlock->Object );
   return _POSIX_RWLock_Translate_core_RWLock_return_code( status );
 
diff --git a/cpukit/posix/src/prwlockwrlock.c b/cpukit/posix/src/prwlockwrlock.c
index 49bc114..aa35a2c 100644
--- a/cpukit/posix/src/prwlockwrlock.c
+++ b/cpukit/posix/src/prwlockwrlock.c
@@ -55,7 +55,7 @@ int pthread_rwlock_wrlock(
 case OBJECTS_LOCAL:
 
   executing = _Thread_Executing;
-  _CORE_RWLock_Obtain_for_writing(
+  _CORE_RWLock_Seize_for_writing(
 &the_rwlock->RWLock,
 executing,
 true,  /* do not timeout -- wait forever */
diff --git a/cpukit/score/include/rtems/score/corerwlockimpl.h 
b/cpukit/score/include/rtems/score/corerwlockimpl.h
index a8e890f..e727ad6 100644
--- a/cpukit/score/include/rtems/score/corerwlockimpl.h
+++ b/cpukit/score/include/rtems/score/corerwlockimpl.h
@@ -99,7 +99,7 @@ RTEMS_INLINE_ROUTINE void _CORE_RWLock_Destroy(
  * @note Status is returned via the thread control block.
  */
 
-void _CORE_RWLock_Obtain_for_reading(
+void _CORE_RWLock_Seize_for_reading(
   CORE_RWLock_Control *the_rwlo

[PATCH 09/20] posix: _POSIX_Condition_variables_Wait_support()

2016-04-19 Thread Sebastian Huber
Simplify _POSIX_Condition_variables_Wait_support(), since there is no
need to validate the mutex twice.
---
 cpukit/posix/src/condwaitsupp.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index 0a7e308..c907f16 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -40,19 +40,11 @@ int _POSIX_Condition_variables_Wait_support(
   bool   already_timedout
 )
 {
-  POSIX_Condition_variables_Control  *the_cond;
-  POSIX_Mutex_Control*the_mutex;
-  Objects_Locations   location;
-  int status;
-  int mutex_status;
-  Thread_Control *executing;
-
-  the_mutex = _POSIX_Mutex_Get( mutex, &location );
-  if ( !the_mutex ) {
- return EINVAL;
-  }
-
-  _Objects_Put_without_thread_dispatch( &the_mutex->Object );
+  POSIX_Condition_variables_Control *the_cond;
+  Objects_Locations  location;
+  intstatus;
+  intmutex_status;
+  Thread_Control*executing;
 
   the_cond = _POSIX_Condition_variables_Get( cond, &location );
   switch ( location ) {
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 19/20] score: Rename _CORE_barrier_Wait()

2016-04-19 Thread Sebastian Huber
Rename _CORE_barrier_Wait() into _CORE_barrier_Seize().  Rename
_CORE_barrier_Release() into _CORE_barrier_Surrender().  This avoids
confusion with the ISR lock acquire and release.
---
 cpukit/posix/src/pbarrierwait.c|  2 +-
 cpukit/rtems/src/barrierrelease.c  |  2 +-
 cpukit/rtems/src/barrierwait.c |  2 +-
 cpukit/score/include/rtems/score/corebarrierimpl.h | 20 ++--
 cpukit/score/src/corebarrierrelease.c  |  2 +-
 cpukit/score/src/corebarrierwait.c |  4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/cpukit/posix/src/pbarrierwait.c b/cpukit/posix/src/pbarrierwait.c
index fd94e45..86bfba7 100644
--- a/cpukit/posix/src/pbarrierwait.c
+++ b/cpukit/posix/src/pbarrierwait.c
@@ -52,7 +52,7 @@ int pthread_barrier_wait(
 
 case OBJECTS_LOCAL:
   executing = _Thread_Executing;
-  _CORE_barrier_Wait(
+  _CORE_barrier_Seize(
 &the_barrier->Barrier,
 executing,
 true,
diff --git a/cpukit/rtems/src/barrierrelease.c 
b/cpukit/rtems/src/barrierrelease.c
index 02500e5..77937b3 100644
--- a/cpukit/rtems/src/barrierrelease.c
+++ b/cpukit/rtems/src/barrierrelease.c
@@ -54,7 +54,7 @@ rtems_status_code rtems_barrier_release(
   switch ( location ) {
 
 case OBJECTS_LOCAL:
-  *released = _CORE_barrier_Release( &the_barrier->Barrier, NULL, 0 );
+  *released = _CORE_barrier_Surrender( &the_barrier->Barrier, NULL, 0 );
   _Objects_Put( &the_barrier->Object );
   return RTEMS_SUCCESSFUL;
 
diff --git a/cpukit/rtems/src/barrierwait.c b/cpukit/rtems/src/barrierwait.c
index b2999eb..f8f9ac3 100644
--- a/cpukit/rtems/src/barrierwait.c
+++ b/cpukit/rtems/src/barrierwait.c
@@ -40,7 +40,7 @@ rtems_status_code rtems_barrier_wait(
 
 case OBJECTS_LOCAL:
   executing = _Thread_Executing;
-  _CORE_barrier_Wait(
+  _CORE_barrier_Seize(
 &the_barrier->Barrier,
 executing,
 true,
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h 
b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 8e923df..239bd9d 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -84,7 +84,7 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Destroy(
   _Thread_queue_Destroy( &the_barrier->Wait_queue );
 }
 
-void _CORE_barrier_Do_wait(
+void _CORE_barrier_Do_seize(
   CORE_barrier_Control*the_barrier,
   Thread_Control  *executing,
   bool wait,
@@ -116,7 +116,7 @@ void _CORE_barrier_Do_wait(
  * @note Status is returned via the thread control block.
  */
 #if defined(RTEMS_MULTIPROCESSING)
-  #define _CORE_barrier_Wait( \
+  #define _CORE_barrier_Seize( \
 the_barrier, \
 executing, \
 wait, \
@@ -124,7 +124,7 @@ void _CORE_barrier_Do_wait(
 mp_callout, \
 mp_id \
   ) \
-_CORE_barrier_Do_wait( \
+_CORE_barrier_Do_seize( \
   the_barrier, \
   executing, \
   wait, \
@@ -133,7 +133,7 @@ void _CORE_barrier_Do_wait(
   mp_id \
 )
 #else
-  #define _CORE_barrier_Wait( \
+  #define _CORE_barrier_Seize( \
 the_barrier, \
 executing, \
 wait, \
@@ -141,7 +141,7 @@ void _CORE_barrier_Do_wait(
 mp_callout, \
 mp_id \
   ) \
-_CORE_barrier_Do_wait( \
+_CORE_barrier_Do_seize( \
   the_barrier, \
   executing, \
   wait, \
@@ -149,7 +149,7 @@ void _CORE_barrier_Do_wait(
 )
 #endif
 
-uint32_t _CORE_barrier_Do_release(
+uint32_t _CORE_barrier_Do_surrender(
   CORE_barrier_Control*the_barrier
 #if defined(RTEMS_MULTIPROCESSING)
   ,
@@ -172,23 +172,23 @@ uint32_t _CORE_barrier_Do_release(
  *  @retval the number of unblocked threads
  */
 #if defined(RTEMS_MULTIPROCESSING)
-  #define _CORE_barrier_Release( \
+  #define _CORE_barrier_Surrender( \
 the_barrier, \
 mp_callout, \
 mp_id \
   ) \
-_CORE_barrier_Do_release( \
+_CORE_barrier_Do_surrender( \
   the_barrier, \
   mp_callout, \
   mp_id \
 )
 #else
-  #define _CORE_barrier_Release( \
+  #define _CORE_barrier_Surrender( \
 the_barrier, \
 mp_callout, \
 mp_id \
   ) \
-_CORE_barrier_Do_release( \
+_CORE_barrier_Do_surrender( \
   the_barrier \
 )
 #endif
diff --git a/cpukit/score/src/corebarrierrelease.c 
b/cpukit/score/src/corebarrierrelease.c
index 4458064..6d72203 100644
--- a/cpukit/score/src/corebarrierrelease.c
+++ b/cpukit/score/src/corebarrierrelease.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 
-uint32_t _CORE_barrier_Do_release(
+uint32_t _CORE_barrier_Do_surrender(
   CORE_barrier_Control*the_barrier
 #if defined(RTEMS_MULTIPROCESSING)
   ,
diff --git a/cpukit/score/src/corebarrierwait.c 
b/cpukit/score/src/corebarrierwait.c
index 689ead0..11495e5 100644
--- a/cpukit/score/src/corebarrierwait.c
+++ b/cpukit/score/src/corebarrierwait.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 
-void _CORE_barrier_Do_wait(
+void _CORE_barrier_D

[PATCH 11/20] score: Add and use _CORE_mutex_Acquire_critical()

2016-04-19 Thread Sebastian Huber
Add and use _CORE_mutex_Release().
---
 cpukit/score/include/rtems/score/coremuteximpl.h | 32 ++--
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h 
b/cpukit/score/include/rtems/score/coremuteximpl.h
index e423d84..eae6ef1 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -113,6 +113,22 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Destroy( 
CORE_mutex_Control *the_mutex )
   _Thread_queue_Destroy( &the_mutex->Wait_queue );
 }
 
+RTEMS_INLINE_ROUTINE void _CORE_mutex_Acquire_critical(
+  CORE_mutex_Control *the_mutex,
+  ISR_lock_Context   *lock_context
+)
+{
+  _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context );
+}
+
+RTEMS_INLINE_ROUTINE void _CORE_mutex_Release(
+  CORE_mutex_Control *the_mutex,
+  ISR_lock_Context   *lock_context
+)
+{
+  _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+}
+
 /**
  *  @brief Attempt to receive a unit from the_mutex.
  *
@@ -245,10 +261,10 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
   INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE
 );
   }
-  _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context );
+  _CORE_mutex_Acquire_critical( the_mutex, lock_context );
   if ( _CORE_mutex_Seize_interrupt_trylock( the_mutex, executing, lock_context 
) ) {
 if ( !wait ) {
-  _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+  _CORE_mutex_Release( the_mutex, lock_context );
   executing->Wait.return_code =
 CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
 } else {
@@ -462,7 +478,7 @@ RTEMS_INLINE_ROUTINE int 
_CORE_mutex_Seize_interrupt_trylock_body(
 }
 
 if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
-  _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+  _CORE_mutex_Release( the_mutex, lock_context );
   return 0;
 } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
*
@@ -476,7 +492,7 @@ RTEMS_INLINE_ROUTINE int 
_CORE_mutex_Seize_interrupt_trylock_body(
   ceiling = the_mutex->Attributes.priority_ceiling;
   current = executing->current_priority;
   if ( current == ceiling ) {
-_Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+_CORE_mutex_Release( the_mutex, lock_context );
 return 0;
   }
 
@@ -484,7 +500,7 @@ RTEMS_INLINE_ROUTINE int 
_CORE_mutex_Seize_interrupt_trylock_body(
 Per_CPU_Control *cpu_self;
 
 cpu_self = _Thread_Dispatch_disable_critical( lock_context );
-_Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+_CORE_mutex_Release( the_mutex, lock_context );
 _Thread_Raise_priority( executing, ceiling );
 _Thread_Dispatch_enable( cpu_self );
 return 0;
@@ -494,7 +510,7 @@ RTEMS_INLINE_ROUTINE int 
_CORE_mutex_Seize_interrupt_trylock_body(
 the_mutex->holder = NULL;
 the_mutex->nest_count = 0; /* undo locking above */
 executing->resource_count--;   /* undo locking above */
-_Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+_CORE_mutex_Release( the_mutex, lock_context );
 return 0;
   }
 }
@@ -510,12 +526,12 @@ RTEMS_INLINE_ROUTINE int 
_CORE_mutex_Seize_interrupt_trylock_body(
 switch ( the_mutex->Attributes.lock_nesting_behavior ) {
   case CORE_MUTEX_NESTING_ACQUIRES:
 the_mutex->nest_count++;
-_Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+_CORE_mutex_Release( the_mutex, lock_context );
 return 0;
   #if defined(RTEMS_POSIX_API)
 case CORE_MUTEX_NESTING_IS_ERROR:
   executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
-  _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+  _CORE_mutex_Release( the_mutex, lock_context );
   return 0;
   #endif
   case CORE_MUTEX_NESTING_BLOCKS:
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 12/20] posix: Avoid Giant lock for mutexes

2016-04-19 Thread Sebastian Huber
Delete _POSIX_Mutex_Get().  Use _POSIX_Mutex_Get_interrupt_disable()
instead.

Update #2555.
---
 cpukit/posix/include/rtems/posix/muteximpl.h | 14 ---
 cpukit/posix/src/mutexdestroy.c  | 56 +++-
 cpukit/posix/src/mutexget.c  | 24 +---
 cpukit/posix/src/mutexgetprioceiling.c   | 40 
 cpukit/posix/src/mutexinit.c |  6 ---
 cpukit/posix/src/mutexsetprioceiling.c   |  1 +
 testsuites/psxtests/psx09/init.c | 46 +++
 testsuites/psxtests/psx09/psx09.doc  |  1 +
 testsuites/psxtests/psx09/system.h   |  2 +-
 9 files changed, 89 insertions(+), 101 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h 
b/cpukit/posix/include/rtems/posix/muteximpl.h
index 1bd74cc..fb30d58 100644
--- a/cpukit/posix/include/rtems/posix/muteximpl.h
+++ b/cpukit/posix/include/rtems/posix/muteximpl.h
@@ -66,7 +66,6 @@ RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free(
   POSIX_Mutex_Control *the_mutex
 )
 {
-  _CORE_mutex_Destroy( &the_mutex->Mutex );
   _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
 }
 
@@ -120,19 +119,6 @@ RTEMS_INLINE_ROUTINE int 
_POSIX_Mutex_Translate_core_mutex_return_code(
 }
 
 /**
- *  @brief POSIX Mutex Get (Thread Dispatch Disable)
- *
- *  A support routine which translates the mutex id into a local pointer.
- *  As a side-effect, it may create the mutex.
- *
- *  @note This version of the method uses a dispatching critical section.
- */
-POSIX_Mutex_Control *_POSIX_Mutex_Get (
-  pthread_mutex_t   *mutex,
-  Objects_Locations *location
-);
-
-/**
  *  @brief POSIX Mutex Get (Interrupt Disable)
  *
  *  A support routine which translates the mutex id into a local pointer.
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index fb5aee6..bebb306 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -18,14 +18,7 @@
 #include "config.h"
 #endif
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
 #include 
-#include 
 
 /*
  *  11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
@@ -35,41 +28,36 @@ int pthread_mutex_destroy(
   pthread_mutex_t   *mutex
 )
 {
-  register POSIX_Mutex_Control *the_mutex;
-  Objects_Locations location;
+  POSIX_Mutex_Control *the_mutex;
+  ISR_lock_Context lock_context;
+  int  eno;
 
   _Objects_Allocator_lock();
-  the_mutex = _POSIX_Mutex_Get( mutex, &location );
-  switch ( location ) {
 
-case OBJECTS_LOCAL:
-   /*
-* XXX: There is an error for the mutex being locked
-*  or being in use by a condition variable.
-*/
+  the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &lock_context );
+
+  if ( the_mutex != NULL ) {
+_CORE_mutex_Acquire_critical( &the_mutex->Mutex, &lock_context );
 
-  if ( _CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
-_Objects_Put( &the_mutex->Object );
-_Objects_Allocator_unlock();
-return EBUSY;
-  }
+/*
+ * XXX: There is an error for the mutex being locked
+ *  or being in use by a condition variable.
+ */
 
+if ( !_CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
   _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
-  _CORE_mutex_Flush( &the_mutex->Mutex, EINVAL, NULL, 0 );
-  _Objects_Put( &the_mutex->Object );
+  _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
+  _CORE_mutex_Destroy( &the_mutex->Mutex );
   _POSIX_Mutex_Free( the_mutex );
-  _Objects_Allocator_unlock();
-
-  return 0;
-
-#if defined(RTEMS_MULTIPROCESSING)
-case OBJECTS_REMOTE:
-#endif
-case OBJECTS_ERROR:
-  break;
+  eno = 0;
+} else {
+  _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
+  eno = EBUSY;
+}
+  } else {
+eno = EINVAL;
   }
 
   _Objects_Allocator_unlock();
-
-  return EINVAL;
+  return eno;
 }
diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c
index 9ad226a..9d34ecb 100644
--- a/cpukit/posix/src/mutexget.c
+++ b/cpukit/posix/src/mutexget.c
@@ -21,14 +21,9 @@
 #include 
 #include 
 
-static bool _POSIX_Mutex_Check_id_and_auto_init(
-  pthread_mutex_t   *mutex,
-  Objects_Locations *location
-)
+static bool _POSIX_Mutex_Check_id_and_auto_init( pthread_mutex_t *mutex )
 {
   if ( mutex == NULL ) {
-*location = OBJECTS_ERROR;
-
 return false;
   }
 
@@ -46,8 +41,6 @@ static bool _POSIX_Mutex_Check_id_and_auto_init(
 _Once_Unlock();
 
 if ( eno != 0 ) {
-  *location = OBJECTS_ERROR;
-
   return false;
 }
   }
@@ -55,19 +48,6 @@ static bool _POSIX_Mutex_Check_id_and_auto_init(
   return true;
 }
 
-POSIX_Mutex_Control *_POSIX_Mutex_Get (
-  pthread_mutex_t   *mutex,
-  Objects_Locations *location
-)
-{
-  if ( !_POSIX_Mutex_Check_id_and_auto_init( mutex, location ) ) {
-return NULL;
-  }
-
-  return (POSIX_Mutex_Control *)
-_Object

Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Peng Fan
Hi Sebastian

2016-04-19 17:31 GMT+08:00 Sebastian Huber <
sebastian.hu...@embedded-brains.de>:

>
>
> On 19/04/16 11:11, Peng Fan wrote:
>
>> +const console_fns imx_uart_fns = {
>> >+  .deviceProbe = libchip_serial_default_probe,
>> >+  .deviceFirstOpen = imx_uart_first_open,
>> >+  .deviceLastClose = imx_uart_last_close,
>> >+  .deviceRead = imx_uart_read_polled,
>> >+  .deviceWrite = imx_uart_write_support_polled,
>> >+  .deviceInitialize = imx_uart_initialize,
>> >+  .deviceWritePolled = imx_uart_write_polled,
>> >+  .deviceSetAttributes = imx_uart_set_attribues,
>> >+  .deviceOutputUsesInterrupts = false
>> >+};
>>
>
> Please don't use this console driver framework. Use
> rtems_termios_device_handler instead. For an example see:
>
> c/src/lib/libbsp/arm/atsam/console/console.c


Thanks for reviewing. Will use the new way in patch V2.

Thanks,
Peng.


>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Joel Sherrill
A few quick things.

Add a bspimpl.h which is private to the bsp. Do not put anything in bsp.h
which
does not need to be public to the application. We have been exceedingly
uncaring about this in the past and the software tax to correct it is going
to
be painful. In general, the bsp.h probably doesn't need much except to
provide the BSP defaults for confdefs.h if it needs to change them.
And no.. there aren't any great examples yet.

There is a shell script in rtems-testing/merge-helpers which is far from
perfect but checks for some common things we have spotted in the
past. It may raise some false positives but it checks a lot. If in doubt,
ask.

Did you "clone and own" anything from another BSP?


On Tue, Apr 19, 2016 at 4:11 AM, Peng Fan  wrote:

> Hi Gedare, Joel,
>
> Kindly ask, Do you any comments on this patch?
>
> Thanks,
> Peng.
>
> On Thu, Apr 14, 2016 at 05:49:43PM +0800, Peng Fan wrote:
> >Initial BSP support for i.MX 6UltraLite EVK board.
> >Add uart driver
> >Add gpt driver to service tick function
> >
> >The i.MX 6UltraLite is a high performance, ultra-efficient processor
> >family featuring an advanced implementation of a single ARM® Cortex®-A7
> >core, which operates at speeds up to 528 MHz. The i.MX 6UltraLite
> >applications processor includes an integrated power management module
> >that reduces the complexity of external power supply and simplifies
> >power sequencing.
> >
> >Now, clock management module and pinmux module not added,
> >so relies the setting in U-Boot.
> >---
> > c/src/lib/libbsp/arm/acinclude.m4  |   2 +
> > c/src/lib/libbsp/arm/mx6ulevk/Makefile.am  | 139
> +
> > c/src/lib/libbsp/arm/mx6ulevk/README   |  28 
> > c/src/lib/libbsp/arm/mx6ulevk/bsp_specs|  13 ++
> > c/src/lib/libbsp/arm/mx6ulevk/configure.ac |  34 +
> > .../libbsp/arm/mx6ulevk/console/console-config.c   |  82 +++
> > c/src/lib/libbsp/arm/mx6ulevk/console/imx-uart.c   | 131 
> > c/src/lib/libbsp/arm/mx6ulevk/gpt.c| 164
> +
> > c/src/lib/libbsp/arm/mx6ulevk/include/bsp.h| 121 +++
> > c/src/lib/libbsp/arm/mx6ulevk/include/imx6-gpt.h   |  48 ++
> > c/src/lib/libbsp/arm/mx6ulevk/include/imx6-uart.h  |  60 
> > c/src/lib/libbsp/arm/mx6ulevk/include/irq.h|  38 +
> > c/src/lib/libbsp/arm/mx6ulevk/include/tm27.h   |  24 +++
> > .../libbsp/arm/mx6ulevk/make/custom/mx6ulevk.cfg   |   9 ++
> > c/src/lib/libbsp/arm/mx6ulevk/preinstall.am| 151
> +++
> > c/src/lib/libbsp/arm/mx6ulevk/startup/bspreset.c   |  24 +++
> > c/src/lib/libbsp/arm/mx6ulevk/startup/bspstart.c   |  25 
> > .../libbsp/arm/mx6ulevk/startup/bspstarthooks.c|  70 +
> > .../libbsp/arm/mx6ulevk/startup/linkcmds.mx6ulevk  |  48 ++
> > 19 files changed, 1211 insertions(+)
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/README
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/bsp_specs
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/configure.ac
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/console/console-config.c
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/console/imx-uart.c
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/gpt.c
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/bsp.h
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/imx6-gpt.h
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/imx6-uart.h
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/irq.h
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/include/tm27.h
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/make/custom/mx6ulevk.cfg
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/preinstall.am
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/bspreset.c
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/bspstart.c
> > create mode 100644 c/src/lib/libbsp/arm/mx6ulevk/startup/bspstarthooks.c
> > create mode 100644
> c/src/lib/libbsp/arm/mx6ulevk/startup/linkcmds.mx6ulevk
> >
> >diff --git a/c/src/lib/libbsp/arm/acinclude.m4
> b/c/src/lib/libbsp/arm/acinclude.m4
> >index f5ca105..c15dc82 100644
> >--- a/c/src/lib/libbsp/arm/acinclude.m4
> >+++ b/c/src/lib/libbsp/arm/acinclude.m4
> >@@ -26,6 +26,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
> > AC_CONFIG_SUBDIRS([lpc24xx]);;
> >   lpc32xx )
> > AC_CONFIG_SUBDIRS([lpc32xx]);;
> >+  mx6ulevk )
> >+AC_CONFIG_SUBDIRS([mx6ulevk]);;
> >   raspberrypi )
> > AC_CONFIG_SUBDIRS([raspberrypi]);;
> >   realview-pbx-a9 )
> >diff --git a/c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
> b/c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
> >new file mode 100644
> >index 000..517b524
> >--- /dev/null
> >+++ b/c/src/lib/libbsp/arm/mx6ulevk/Makefile.am
> >@@ -0,0 +1,139 @@
> >+##
> >+#
> >+# @file
> >+#
> >+# @brief Makefile of libBSP for the i.MX 6UltraLite EVK plat

Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Gedare Bloom
On Tue, Apr 19, 2016 at 9:59 AM, Joel Sherrill  wrote:
> A few quick things.
>
> Add a bspimpl.h which is private to the bsp. Do not put anything in bsp.h
> which
> does not need to be public to the application. We have been exceedingly
> uncaring about this in the past and the software tax to correct it is going
> to
> be painful. In general, the bsp.h probably doesn't need much except to
> provide the BSP defaults for confdefs.h if it needs to change them.
> And no.. there aren't any great examples yet.
>

Another point is to check the current .cfg files for examples of how
to add the per-function and per-sections LTO
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Joel Sherrill
On Tue, Apr 19, 2016 at 10:41 AM, Gedare Bloom  wrote:

> On Tue, Apr 19, 2016 at 9:59 AM, Joel Sherrill  wrote:
> > A few quick things.
> >
> > Add a bspimpl.h which is private to the bsp. Do not put anything in bsp.h
> > which
> > does not need to be public to the application. We have been exceedingly
> > uncaring about this in the past and the software tax to correct it is
> going
> > to
> > be painful. In general, the bsp.h probably doesn't need much except to
> > provide the BSP defaults for confdefs.h if it needs to change them.
> > And no.. there aren't any great examples yet.
> >
>
> Another point is to check the current .cfg files for examples of how
> to add the per-function and per-sections LTO
>

+1 that would be a good think for the script to check.

As well as for the console table structure Sebastian recommended not using.

Also the new code should be warning free. It should also not result in
warnings in formerly warning free shared code.

The script isn't great but if we can use grep to help us review for
repeat offenders, then we can focus on harder issues.

--joel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 13/20] score: Introduce _Thread_queue_Flush_critical()

2016-04-19 Thread Gedare Bloom
On Tue, Apr 19, 2016 at 9:12 AM, Sebastian Huber
 wrote:
> Replace _Thread_queue_Flush() with _Thread_queue_Flush_critical() and
> add a filter function for customization of the thread queue flush
> operation.
>
> Update #2555.
> ---
>  cpukit/rtems/src/semdelete.c   |  2 +-
>  cpukit/rtems/src/semflush.c|  2 +-
>  cpukit/score/include/rtems/score/corebarrierimpl.h | 28 +--
>  cpukit/score/include/rtems/score/coremuteximpl.h   | 36 +++--
>  cpukit/score/include/rtems/score/coresemimpl.h | 46 ---
>  cpukit/score/include/rtems/score/threadqimpl.h | 59 ++
>  cpukit/score/src/corebarrier.c | 12 ++-
>  cpukit/score/src/coremsgclose.c| 21 -
>  cpukit/score/src/coremsgflush.c|  2 +-
>  cpukit/score/src/coremutex.c   | 22 ++
>  cpukit/score/src/coresem.c | 22 ++
>  cpukit/score/src/threadqflush.c| 90 
> +++---
>  12 files changed, 266 insertions(+), 76 deletions(-)
>
> diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
> index f503cd9..48a9055 100644
> --- a/cpukit/rtems/src/semdelete.c
> +++ b/cpukit/rtems/src/semdelete.c
> @@ -92,7 +92,7 @@ rtems_status_code rtems_semaphore_delete(
>if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
>  _CORE_mutex_Flush(
>&the_semaphore->Core_control.mutex,
> -  CORE_MUTEX_WAS_DELETED,
> +  _CORE_mutex_Was_deleted,
>_Semaphore_MP_Send_object_was_deleted,
>id
>  );
> diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
> index 64386b0..01c5c0d 100644
> --- a/cpukit/rtems/src/semflush.c
> +++ b/cpukit/rtems/src/semflush.c
> @@ -53,7 +53,7 @@ rtems_status_code rtems_semaphore_flush(
>if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
>  _CORE_mutex_Flush(
>&the_semaphore->Core_control.mutex,
> -  CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
> +  _CORE_mutex_Unsatisfied_nowait,
>_Semaphore_MP_Send_object_was_deleted,
>id
>  );
> diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h 
> b/cpukit/score/include/rtems/score/corebarrierimpl.h
> index 1d77405..8e923df 100644
> --- a/cpukit/score/include/rtems/score/corebarrierimpl.h
> +++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
> @@ -193,19 +193,33 @@ uint32_t _CORE_barrier_Do_release(
>  )
>  #endif
>
> +Thread_Control *_CORE_barrier_Was_deleted(
> +  Thread_Control   *the_thread,
> +  Thread_queue_Control *the_thread_queue,
> +  ISR_lock_Context *lock_context
> +);
> +
>  /* Must be a macro due to the multiprocessing dependent parameters */
>  #define _CORE_barrier_Flush( \
>the_barrier, \
>mp_callout, \
>mp_id \
>  ) \
> -  _Thread_queue_Flush( \
> -&( the_barrier )->Wait_queue, \
> -CORE_BARRIER_TQ_OPERATIONS, \
> -CORE_BARRIER_WAS_DELETED, \
> -mp_callout, \
> -mp_id \
> -  )
> +  do { \
> +ISR_lock_Context _core_barrier_flush_lock_context; \
> +_Thread_queue_Acquire( \
> +  &( the_barrier )->Wait_queue, \
> +  &_core_barrier_flush_lock_context \
> +); \
> +_Thread_queue_Flush_critical( \
> +  &( the_barrier )->Wait_queue, \
> +  CORE_BARRIER_TQ_OPERATIONS, \
> +  _CORE_barrier_Was_deleted, \
> +  mp_callout, \
> +  mp_id, \
> +  &_core_barrier_flush_lock_context \
> +); \
> +  } while ( 0 )
>
>  /**
>   * This function returns true if the automatic release attribute is
> diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h 
> b/cpukit/score/include/rtems/score/coremuteximpl.h
> index eae6ef1..0f79923 100644
> --- a/cpukit/score/include/rtems/score/coremuteximpl.h
> +++ b/cpukit/score/include/rtems/score/coremuteximpl.h
> @@ -338,20 +338,40 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
>  )
>  #endif
>
> +Thread_Control *_CORE_mutex_Was_deleted(
> +  Thread_Control   *the_thread,
> +  Thread_queue_Control *the_thread_queue,
> +  ISR_lock_Context *lock_context
> +);
> +
> +Thread_Control *_CORE_mutex_Unsatisfied_nowait(
> +  Thread_Control   *the_thread,
> +  Thread_queue_Control *the_thread_queue,
> +  ISR_lock_Context *lock_context
> +);
> +
>  /* Must be a macro due to the multiprocessing dependent parameters */
>  #define _CORE_mutex_Flush( \
>the_mutex, \
> -  status, \
> +  filter, \
>mp_callout, \
>mp_id \
>  ) \
> -  _Thread_queue_Flush( \
> -&( the_mutex )->Wait_queue, \
> -( the_mutex )->operations, \
> -status, \
> -mp_callout, \
> -mp_id \
> -  )
> +  do { \
> +ISR_lock_Context _core_mutex_flush_lock_context; \
> +_Thread_queue_Acquire( \
> +  &( the_mutex )->Wait_queue, \
> +  &_core_mutex_flush_lock_context \
> +); \
> +_Thread_queue_Flush_critical( \
> +  &( the_mutex )->Wait_queue, \
> 

BSP Console support (was Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.)

2016-04-19 Thread Chris Johns

On 19/04/2016 19:31, Sebastian Huber wrote:

Please don't use this console driver framework. Use
rtems_termios_device_handler instead.


I am not on board with saying we do this and I have a few reasons which 
I would like to present and discuss.


The console support in BSPs is a mess and in general we have no standard 
rules so any debate on this topic is destined to be related to style, 
preference and history. We need to sort through these things and get a 
clear understand of the path we want to take and then support it.


To guide us I would like to propose some simple rules and while they 
specifically address consoles it does relate more broadly to all parts 
of a BSP.


1. One method to support consoles in a BSP.

Currently I think we have 4 or more ways console IO happens. There are 
direct low level writes to devices, simulator type writes, and termios, 
and within termios we have a couple of possible paths we can take. Joel, 
is this correct?


We should aim at a single termios solution as preferred. I am not sure 
if this is possible on low memory foot print targets and if it is not 
possible we should address that in a supported way.


2. Technical merit.

We should base the adoption of a solution on technical merit. This 
however needs to be in the context of documentation and migration.


3. Documentation.

For any solution to be accepted there needs to be documentation. 
Existing documentation should be given precedence over any technical merit.


4. Migration of existing BSPs.

There needs to be a defined and clear migration path. Without such a 
path the RTEMS Project ends up having to support all implementations for 
ever. Without a migration plan precedence has to be given to the 
solution that covers the most number of BSPs.


It would be nice to know where we stand with numbers?

5. Tier Status

 [ Tier documentation is coming ]

Any BPS that does not support the preferred console framework cannot be 
tier 1. If an architecture does not have a tier 1 BSP it cannot be a 
tier 1 architecture.


In relation to 'rtems_termios_device_handler' termios framework:

a) What is the technical reasons we adopt this framework?

b) Is the framework documented anywhere?

 ruru rtems.git $ grep -r rtems_termios_device_handler doc/
 ruru rtems.git $

while:

 ruru rtems.git $ grep -r rtems_termios_handler doc/
 doc/bsp_howto/console.t:const rtems_termios_handler 
my_driver_handler_polled = @{
 doc/bsp_howto/console.t:const rtems_termios_handler 
my_driver_handler_interrupt = @{
 doc/bsp_howto/console.t:extern const rtems_termios_handler 
my_driver_handler_polled;
 doc/bsp_howto/console.t:extern const rtems_termios_handler 
my_driver_handler_interrupt;
 doc/bsp_howto/console.t:  const rtems_termios_handler *handler = 
&my_driver_handler_interrupt;
 doc/bsp_howto/console.t:  const rtems_termios_handler *handler = 
&my_driver_handler_polled;

 ruru rtems.git $

c) What is the migration plan?

The PC BSP uses ns16550.c and not ns16550-context.c. This second file is 
almost a copy of the first. If I find a bug in either file should I 
attempt to fix both or ignore the one I cannot test?


If the new 'rtems_termios_device_handler' is adopted the PC BSP may 
loose its tier 1 status. In the future we should avoid doing this and a 
migration plan should address tier 1 BSPs first.


The copied driver change is unfortunate and highlights a concern I have. 
A change like this may allow a technically better solution to be 
delivered however it does not account for the time and effort others 
need to spend to migrate other BSPs. Once a change like this is accepted 
into the project the project becomes responsible for updating any 
dependent BSPs. History shows this does not happen and that is 
understandable, the RTEMS Project has no direct funding to do this work 
and expecting this to be done unfunded is not reasonable. Asking for a 
migration plan is a way the project can understand what else is required 
and how what will be done.


As I stated at the start of this post, I am not yet on board and I would 
like to understand how we address the situation we are now in. Without a 
clear understand of this any new BSP is at risk.


Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.

2016-04-19 Thread Peng Fan
Thanks Joel and Gedare for the comments.

For "Did you "clone and own" anything from another BSP? "
If you are asking me to add the copyright back, I'll check to avoid
discarding the copyrights.

Thanks,
Peng.

2016-04-19 23:47 GMT+08:00 Joel Sherrill :

>
>
> On Tue, Apr 19, 2016 at 10:41 AM, Gedare Bloom  wrote:
>
>> On Tue, Apr 19, 2016 at 9:59 AM, Joel Sherrill  wrote:
>> > A few quick things.
>> >
>> > Add a bspimpl.h which is private to the bsp. Do not put anything in
>> bsp.h
>> > which
>> > does not need to be public to the application. We have been exceedingly
>> > uncaring about this in the past and the software tax to correct it is
>> going
>> > to
>> > be painful. In general, the bsp.h probably doesn't need much except to
>> > provide the BSP defaults for confdefs.h if it needs to change them.
>> > And no.. there aren't any great examples yet.
>> >
>>
>> Another point is to check the current .cfg files for examples of how
>> to add the per-function and per-sections LTO
>>
>
> +1 that would be a good think for the script to check.
>
> As well as for the console table structure Sebastian recommended not using.
>
> Also the new code should be warning free. It should also not result in
> warnings in formerly warning free shared code.
>
> The script isn't great but if we can use grep to help us review for
> repeat offenders, then we can focus on harder issues.
>
> --joel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: BSP Console support (was Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.)

2016-04-19 Thread Sebastian Huber

Hello Chris,

On 20/04/16 01:24, Chris Johns wrote:

On 19/04/2016 19:31, Sebastian Huber wrote:

Please don't use this console driver framework. Use
rtems_termios_device_handler instead.


I am not on board with saying we do this and I have a few reasons 
which I would like to present and discuss.


The console support in BSPs is a mess and in general we have no 
standard rules so any debate on this topic is destined to be related 
to style, preference and history. We need to sort through these things 
and get a clear understand of the path we want to take and then 
support it.


To guide us I would like to propose some simple rules and while they 
specifically address consoles it does relate more broadly to all parts 
of a BSP.


1. One method to support consoles in a BSP.

Currently I think we have 4 or more ways console IO happens. There are 
direct low level writes to devices, simulator type writes, and 
termios, and within termios we have a couple of possible paths we can 
take. Joel, is this correct?


We should aim at a single termios solution as preferred. I am not sure 
if this is possible on low memory foot print targets and if it is not 
possible we should address that in a supported way.


Termios is nothing for low memory targets. However, my comment refers to 
Termios. We have currently two device interfaces to Termios. We have 
several console driver frameworks.




2. Technical merit.

We should base the adoption of a solution on technical merit. This 
however needs to be in the context of documentation and migration.


3. Documentation.

For any solution to be accepted there needs to be documentation. 
Existing documentation should be given precedence over any technical 
merit.


The state of the art Termios device interface is documented in the manual:

https://docs.rtems.org/doc-current/share/rtems/html/bsp_howto/Console-Driver-Serial-Driver-Functioning-Overview.html#Console-Driver-Serial-Driver-Functioning-Overview



4. Migration of existing BSPs.

There needs to be a defined and clear migration path. Without such a 
path the RTEMS Project ends up having to support all implementations 
for ever. Without a migration plan precedence has to be given to the 
solution that covers the most number of BSPs.


It would be nice to know where we stand with numbers?


I spend some days to convert all BSPs to the new Termios device 
interface. I stopped to work on this once I hit the PC BSP. So, if 
someone has enough time to clean up this BSP, the rest should be very easy.




5. Tier Status

 [ Tier documentation is coming ]

Any BPS that does not support the preferred console framework cannot 
be tier 1. If an architecture does not have a tier 1 BSP it cannot be 
a tier 1 architecture.


In relation to 'rtems_termios_device_handler' termios framework:

a) What is the technical reasons we adopt this framework?


Yes, its much easier to write drivers for it since you don't have to 
deal with all the tables. It supports SMP in contrast to the old 
interface. This is the primary reason why we have this new interface.




b) Is the framework documented anywhere?


Yes, in the manual.



 ruru rtems.git $ grep -r rtems_termios_device_handler doc/
 ruru rtems.git $

while:

 ruru rtems.git $ grep -r rtems_termios_handler doc/
 doc/bsp_howto/console.t:const rtems_termios_handler 
my_driver_handler_polled = @{
 doc/bsp_howto/console.t:const rtems_termios_handler 
my_driver_handler_interrupt = @{
 doc/bsp_howto/console.t:extern const rtems_termios_handler 
my_driver_handler_polled;
 doc/bsp_howto/console.t:extern const rtems_termios_handler 
my_driver_handler_interrupt;
 doc/bsp_howto/console.t:  const rtems_termios_handler *handler = 
&my_driver_handler_interrupt;
 doc/bsp_howto/console.t:  const rtems_termios_handler *handler = 
&my_driver_handler_polled;

 ruru rtems.git $


This is a typo. I will fix this once the new documentation repository is 
available.




c) What is the migration plan?

The PC BSP uses ns16550.c and not ns16550-context.c. This second file 
is almost a copy of the first. If I find a bug in either file should I 
attempt to fix both or ignore the one I cannot test?


I copied the ns16550 due to the PC BSP.



If the new 'rtems_termios_device_handler' is adopted the PC BSP may 
loose its tier 1 status. In the future we should avoid doing this and 
a migration plan should address tier 1 BSPs first.


I don't think i386 is tier 1 at the moment.



The copied driver change is unfortunate and highlights a concern I 
have. A change like this may allow a technically better solution to be 
delivered however it does not account for the time and effort others 
need to spend to migrate other BSPs.


I really tried to migrate all BSPs (I spent sever days of work into this 
topic), but I didn''t have infinite time for it. At some point I had to 
stop working on this and decided to keep the exiting interface. So, 
existing BSPs work as before and there is no immediate need for a migration.


O

I2C Driver Support

2016-04-19 Thread Sebastian Huber

Hello,

for I2C drivers we have basically the same problem as for the console 
drivers. Three I2C driver variants exist


* no framework drivers,
* libi2c drivers, and
* drivers using the Linux compatible API (all new BSPs should use this 
framework).


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: BSP Console support (was Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.)

2016-04-19 Thread Sebastian Huber



On 20/04/16 07:50, Sebastian Huber wrote:


Once a change like this is accepted into the project the project 
becomes responsible for updating any dependent BSPs. History shows 
this does not happen and that is understandable, the RTEMS Project 
has no direct funding to do this work and expecting this to be done 
unfunded is not reasonable. Asking for a migration plan is a way the 
project can understand what else is required and how what will be done.


Yes, I missed to provide a migration plan. Sorry for that. 


Actually, there is something like a migration plan here:

https://docs.rtems.org/doc-current/share/rtems/html/bsp_howto/Console-Driver-Basics.html#Console-Driver-Basics

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: BSP Console support (was Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.)

2016-04-19 Thread Chris Johns

On 20/04/2016 15:50, Sebastian Huber wrote:

Hello Chris,

On 20/04/16 01:24, Chris Johns wrote:

On 19/04/2016 19:31, Sebastian Huber wrote:

Please don't use this console driver framework. Use
rtems_termios_device_handler instead.


I am not on board with saying we do this and I have a few reasons
which I would like to present and discuss.

The console support in BSPs is a mess and in general we have no
standard rules so any debate on this topic is destined to be related
to style, preference and history. We need to sort through these things
and get a clear understand of the path we want to take and then
support it.

To guide us I would like to propose some simple rules and while they
specifically address consoles it does relate more broadly to all parts
of a BSP.

1. One method to support consoles in a BSP.

Currently I think we have 4 or more ways console IO happens. There are
direct low level writes to devices, simulator type writes, and
termios, and within termios we have a couple of possible paths we can
take. Joel, is this correct?

We should aim at a single termios solution as preferred. I am not sure
if this is possible on low memory foot print targets and if it is not
possible we should address that in a supported way.


Termios is nothing for low memory targets.


Does this mean it is not suitable or does it mean termios has a low 
memory overhead and can be used?



However, my comment refers to
Termios. We have currently two device interfaces to Termios.


OK.


We have several console driver frameworks.


We should look to move to one.





2. Technical merit.

We should base the adoption of a solution on technical merit. This
however needs to be in the context of documentation and migration.

3. Documentation.

For any solution to be accepted there needs to be documentation.
Existing documentation should be given precedence over any technical
merit.


The state of the art Termios device interface is documented in the manual:

https://docs.rtems.org/doc-current/share/rtems/html/bsp_howto/Console-Driver-Serial-Driver-Functioning-Overview.html#Console-Driver-Serial-Driver-Functioning-Overview


Great. I will migrate this document to the new format.


4. Migration of existing BSPs.

There needs to be a defined and clear migration path. Without such a
path the RTEMS Project ends up having to support all implementations
for ever. Without a migration plan precedence has to be given to the
solution that covers the most number of BSPs.

It would be nice to know where we stand with numbers?


I spend some days to convert all BSPs to the new Termios device
interface. I stopped to work on this once I hit the PC BSP.


Is this covered by ticket #2623? Any other tickets covering this issue?


So, if
someone has enough time to clean up this BSP, the rest should be very easy.


In theory it should be but the recent addition of PCI devices has add a 
little bit more to the task. Looks like I am adding it to my list.



5. Tier Status

 [ Tier documentation is coming ]

Any BPS that does not support the preferred console framework cannot
be tier 1. If an architecture does not have a tier 1 BSP it cannot be
a tier 1 architecture.

In relation to 'rtems_termios_device_handler' termios framework:

a) What is the technical reasons we adopt this framework?


Yes, its much easier to write drivers for it since you don't have to
deal with all the tables. It supports SMP in contrast to the old
interface. This is the primary reason why we have this new interface.


OK, this is important. That relationship was not apparent to me.



b) Is the framework documented anywhere?


Yes, in the manual.


Excellent.



 ruru rtems.git $ grep -r rtems_termios_device_handler doc/
 ruru rtems.git $

while:

 ruru rtems.git $ grep -r rtems_termios_handler doc/
 doc/bsp_howto/console.t:const rtems_termios_handler
my_driver_handler_polled = @{
 doc/bsp_howto/console.t:const rtems_termios_handler
my_driver_handler_interrupt = @{
 doc/bsp_howto/console.t:extern const rtems_termios_handler
my_driver_handler_polled;
 doc/bsp_howto/console.t:extern const rtems_termios_handler
my_driver_handler_interrupt;
 doc/bsp_howto/console.t:  const rtems_termios_handler *handler =
&my_driver_handler_interrupt;
 doc/bsp_howto/console.t:  const rtems_termios_handler *handler =
&my_driver_handler_polled;
 ruru rtems.git $


This is a typo. I will fix this once the new documentation repository is
available.


Great. I am waiting on the LICENSE to be added to the repo as this 
resets the repo requiring a new clone. Amar has the text to add, I just 
need a little bit of his time to get this done. After this happens I 
need to add something to each file. I am looking at SPDX but I am not 
sure how to do this.



c) What is the migration plan?

The PC BSP uses ns16550.c and not ns16550-context.c. This second file
is almost a copy of the first. If I find a bug in either file should I
attempt to fix both or ignore the one I cannot test?


I copied the ns16550 

Re: BSP Console support (was Re: [PATCH] arm: mx6ulevk: Initial BSP support for i.MX 6UltraLite EVK board.)

2016-04-19 Thread Chris Johns

On 20/04/2016 16:01, Sebastian Huber wrote:

Actually, there is something like a migration plan here:


This is the reason to change, I do not see it as a plan that scopes the 
work and defines the effort needed. :)




https://docs.rtems.org/doc-current/share/rtems/html/bsp_howto/Console-Driver-Basics.html#Console-Driver-Basics



I looked at this and missed the importance because I thought it was for 
something else.


Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: I2C Driver Support

2016-04-19 Thread Chris Johns

On 20/04/2016 15:58, Sebastian Huber wrote:


for I2C drivers we have basically the same problem as for the console
drivers.


Thank you for raising this.

In time the old vs the new network stack will need the same review.


Three I2C driver variants exist

* no framework drivers,
* libi2c drivers, and
* drivers using the Linux compatible API (all new BSPs should use this
framework).


Can we please get a list of each of the BSPs which fall in to each group?

Are you able to provide a simple technical break down about each group, 
eg reusable, SMP, user support, etc?


We should select the preferred model and then determine what we can do 
to move all code to that model.


Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel