Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From add566b913e1b5cd4974a2167157dc08d8245ab0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Marek Vasut <marex@denx.de> |
| 3 | Date: Tue, 9 Feb 2016 01:52:26 +0100 |
| 4 | Subject: [PATCH] Support for NIOS2 architecture |
| 5 | |
| 6 | Add support for the Altera NIOS2 CPU archirecture. The atomic operations |
| 7 | are handled by the GCC. The memory barriers on this systems are entirely |
| 8 | trivial too, since the CPU does not support SMP at all. |
| 9 | |
| 10 | Signed-off-by: Marek Vasut <marex@denx.de> |
| 11 | Upstream-Status: Backport [ http://git.lttng.org/?p=userspace-rcu.git;a=commit;h=859050b3088aa3f0cb59d7f51ce24b9a0f18faa5 ] |
| 12 | --- |
| 13 | LICENSE | 1 + |
| 14 | README.md | 1 + |
| 15 | configure.ac | 1 + |
| 16 | urcu/arch/nios2.h | 40 ++++++++++++++++++++++++++++++++++++++++ |
| 17 | urcu/uatomic/nios2.h | 32 ++++++++++++++++++++++++++++++++ |
| 18 | 5 files changed, 75 insertions(+) |
| 19 | create mode 100644 urcu/arch/nios2.h |
| 20 | create mode 100644 urcu/uatomic/nios2.h |
| 21 | |
| 22 | diff --git a/LICENSE b/LICENSE |
| 23 | index 3147094..a06fdcc 100644 |
| 24 | --- a/LICENSE |
| 25 | +++ b/LICENSE |
| 26 | @@ -45,6 +45,7 @@ compiler.h |
| 27 | arch/s390.h |
| 28 | uatomic/alpha.h |
| 29 | uatomic/mips.h |
| 30 | +uatomic/nios2.h |
| 31 | uatomic/s390.h |
| 32 | system.h |
| 33 | |
| 34 | diff --git a/README.md b/README.md |
| 35 | index f6b290f..6fe9c1e 100644 |
| 36 | --- a/README.md |
| 37 | +++ b/README.md |
| 38 | @@ -43,6 +43,7 @@ Currently, the following architectures are supported: |
| 39 | - S390, S390x |
| 40 | - ARM 32/64 |
| 41 | - MIPS |
| 42 | + - NIOS2 |
| 43 | - Alpha |
| 44 | - ia64 |
| 45 | - Sparcv9 32/64 |
| 46 | diff --git a/configure.ac b/configure.ac |
| 47 | index 39a7777..71a7d71 100644 |
| 48 | --- a/configure.ac |
| 49 | +++ b/configure.ac |
| 50 | @@ -124,6 +124,7 @@ AS_CASE([$host_cpu], |
| 51 | [arm*], [ARCHTYPE="arm"], |
| 52 | [aarch64], [ARCHTYPE="aarch64"], |
| 53 | [mips*], [ARCHTYPE="mips"], |
| 54 | + [nios2*], [ARCHTYPE="nios2"], |
| 55 | [tile*], [ARCHTYPE="tile"], |
| 56 | [hppa*], [ARCHTYPE="hppa"], |
| 57 | [ARCHTYPE="unknown"] |
| 58 | diff --git a/urcu/arch/nios2.h b/urcu/arch/nios2.h |
| 59 | new file mode 100644 |
| 60 | index 0000000..030d1bc |
| 61 | --- /dev/null |
| 62 | +++ b/urcu/arch/nios2.h |
| 63 | @@ -0,0 +1,40 @@ |
| 64 | +#ifndef _URCU_ARCH_NIOS2_H |
| 65 | +#define _URCU_ARCH_NIOS2_H |
| 66 | + |
| 67 | +/* |
| 68 | + * arch_nios2.h: trivial definitions for the NIOS2 architecture. |
| 69 | + * |
| 70 | + * Copyright (c) 2016 Marek Vasut <marex@denx.de> |
| 71 | + * |
| 72 | + * This library is free software; you can redistribute it and/or |
| 73 | + * modify it under the terms of the GNU Lesser General Public |
| 74 | + * License as published by the Free Software Foundation; either |
| 75 | + * version 2.1 of the License, or (at your option) any later version. |
| 76 | + * |
| 77 | + * This library is distributed in the hope that it will be useful, |
| 78 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 79 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 80 | + * Lesser General Public License for more details. |
| 81 | + * |
| 82 | + * You should have received a copy of the GNU Lesser General Public |
| 83 | + * License along with this library; if not, write to the Free Software |
| 84 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 85 | + */ |
| 86 | + |
| 87 | +#include <urcu/compiler.h> |
| 88 | +#include <urcu/config.h> |
| 89 | +#include <urcu/syscall-compat.h> |
| 90 | + |
| 91 | +#ifdef __cplusplus |
| 92 | +extern "C" { |
| 93 | +#endif |
| 94 | + |
| 95 | +#define cmm_mb() cmm_barrier() |
| 96 | + |
| 97 | +#ifdef __cplusplus |
| 98 | +} |
| 99 | +#endif |
| 100 | + |
| 101 | +#include <urcu/arch/generic.h> |
| 102 | + |
| 103 | +#endif /* _URCU_ARCH_NIOS2_H */ |
| 104 | diff --git a/urcu/uatomic/nios2.h b/urcu/uatomic/nios2.h |
| 105 | new file mode 100644 |
| 106 | index 0000000..5b3c303 |
| 107 | --- /dev/null |
| 108 | +++ b/urcu/uatomic/nios2.h |
| 109 | @@ -0,0 +1,32 @@ |
| 110 | +#ifndef _URCU_UATOMIC_ARCH_NIOS2_H |
| 111 | +#define _URCU_UATOMIC_ARCH_NIOS2_H |
| 112 | + |
| 113 | +/* |
| 114 | + * Atomic exchange operations for the NIOS2 architecture. Let GCC do it. |
| 115 | + * |
| 116 | + * Copyright (c) 2016 Marek Vasut <marex@denx.de> |
| 117 | + * |
| 118 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 119 | + * of this software and associated documentation files (the "Software"), to |
| 120 | + * deal in the Software without restriction, including without limitation the |
| 121 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 122 | + * sell copies of the Software, and to permit persons to whom the Software is |
| 123 | + * furnished to do so, subject to the following conditions: |
| 124 | + * |
| 125 | + * The above copyright notice and this permission notice shall be included in |
| 126 | + * all copies or substantial portions of the Software. |
| 127 | + * |
| 128 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 129 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 130 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 131 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 132 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 133 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 134 | + * IN THE SOFTWARE. |
| 135 | + */ |
| 136 | + |
| 137 | +#include <urcu/compiler.h> |
| 138 | +#include <urcu/system.h> |
| 139 | +#include <urcu/uatomic/generic.h> |
| 140 | + |
| 141 | +#endif /* _URCU_UATOMIC_ARCH_NIOS2_H */ |
| 142 | -- |
| 143 | 2.7.0 |
| 144 | |