Module: xenomai-3 Branch: next Commit: 942192837c147c5fd03fd180a8a5adb0b663c926 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=942192837c147c5fd03fd180a8a5adb0b663c926
Author: Philippe Gerum <r...@xenomai.org> Date: Sat Aug 15 16:15:36 2015 +0200 cobalt/nios2: drop support for the NIOS2 architecture We don't have any interrupt pipeline implementation for 3.x+ kernels on NIOS2 currently, which is a requirement for running Xenomai 3, so there is no point in keeping this architecture code in-tree. --- configure.ac | 18 +-- kernel/cobalt/arch/nios2/Kconfig | 8 - kernel/cobalt/arch/nios2/Makefile | 6 - .../arch/nios2/include/asm/xenomai/calibration.h | 40 ----- .../arch/nios2/include/asm/xenomai/features.h | 30 ---- .../cobalt/arch/nios2/include/asm/xenomai/fptest.h | 44 ------ .../arch/nios2/include/asm/xenomai/machine.h | 38 ----- .../arch/nios2/include/asm/xenomai/syscall.h | 59 -------- .../arch/nios2/include/asm/xenomai/syscall32.h | 24 --- .../cobalt/arch/nios2/include/asm/xenomai/thread.h | 70 --------- .../arch/nios2/include/asm/xenomai/uapi/arith.h | 40 ----- .../arch/nios2/include/asm/xenomai/uapi/features.h | 44 ------ .../arch/nios2/include/asm/xenomai/uapi/fptest.h | 31 ---- .../arch/nios2/include/asm/xenomai/uapi/syscall.h | 25 ---- .../arch/nios2/include/asm/xenomai/wrappers.h | 26 ---- kernel/cobalt/arch/nios2/machine.c | 61 -------- kernel/cobalt/arch/nios2/mayday.c | 95 ------------ kernel/cobalt/arch/nios2/patches/README | 19 --- kernel/cobalt/arch/nios2/switch.S | 56 ------- kernel/cobalt/arch/nios2/syscall.c | 41 ------ kernel/cobalt/arch/nios2/thread.c | 67 --------- lib/cobalt/arch/Makefile.am | 2 +- lib/cobalt/arch/nios2/Makefile.am | 13 -- lib/cobalt/arch/nios2/features.c | 54 ------- lib/cobalt/arch/nios2/include/Makefile.am | 2 - lib/cobalt/arch/nios2/include/asm/Makefile.am | 2 - .../arch/nios2/include/asm/xenomai/Makefile.am | 5 - .../arch/nios2/include/asm/xenomai/features.h | 30 ---- .../arch/nios2/include/asm/xenomai/syscall.h | 155 -------------------- lib/cobalt/arch/nios2/include/asm/xenomai/tsc.h | 73 --------- 30 files changed, 2 insertions(+), 1176 deletions(-) diff --git a/configure.ac b/configure.ac index 6db4031..8f2136e 100644 --- a/configure.ac +++ b/configure.ac @@ -144,10 +144,6 @@ case "$build_for" in XENO_TARGET_ARCH=x86 CONFIG_XENO_DEFAULT_PERIOD=100000 ;; - nios2-*) - XENO_TARGET_ARCH=nios2 - CONFIG_XENO_DEFAULT_PERIOD=10000000 - ;; *) echo "" echo "*******************************************" echo "Still unsupported target: $build_for -- Sorry." @@ -158,15 +154,7 @@ esac AC_MSG_RESULT([$XENO_TARGET_ARCH]) AM_CONDITIONAL(XENO_TARGET_ARCH_X86,[test $XENO_TARGET_ARCH = x86]) - -case "$XENO_TARGET_ARCH" in - nios2) - AC_DISABLE_SHARED - ;; - *) - AC_ENABLE_SHARED - ;; -esac +AC_ENABLE_SHARED AC_PROG_LIBTOOL dnl @@ -872,10 +860,6 @@ AC_CONFIG_FILES([ \ lib/cobalt/arch/x86/include/Makefile \ lib/cobalt/arch/x86/include/asm/Makefile \ lib/cobalt/arch/x86/include/asm/xenomai/Makefile \ - lib/cobalt/arch/nios2/Makefile \ - lib/cobalt/arch/nios2/include/Makefile \ - lib/cobalt/arch/nios2/include/asm/Makefile \ - lib/cobalt/arch/nios2/include/asm/xenomai/Makefile \ lib/mercury/Makefile \ lib/copperplate/Makefile \ lib/copperplate/regd/Makefile \ diff --git a/kernel/cobalt/arch/nios2/Kconfig b/kernel/cobalt/arch/nios2/Kconfig deleted file mode 100644 index 1ca0278..0000000 --- a/kernel/cobalt/arch/nios2/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -config XENO_ARCH_FPU - def_bool n - -config XENO_ARCH_SYS3264 - def_bool n - -source "kernel/xenomai/Kconfig" -source "drivers/xenomai/Kconfig" diff --git a/kernel/cobalt/arch/nios2/Makefile b/kernel/cobalt/arch/nios2/Makefile deleted file mode 100644 index ce960c8..0000000 --- a/kernel/cobalt/arch/nios2/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -obj-$(CONFIG_XENOMAI) += xenomai.o - -xenomai-y := machine.o mayday.o thread.o switch.o syscall.o - -ccflags-y := -Iarch/nios2/xenomai/include -Iinclude/xenomai diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/calibration.h deleted file mode 100644 index 36cc2a5..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/calibration.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, or - * (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_CALIBRATION_H -#define _COBALT_NIOS2_ASM_CALIBRATION_H - -static inline void xnarch_get_latencies(struct xnclock_gravity *p) -{ -#if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0 -#define __sched_latency CONFIG_XENO_OPT_TIMING_SCHEDLAT -#elif defined(CONFIG_ALTERA_DE2) -#define __sched_latency 10000 -#elif defined(CONFIG_NEEK) -#define __sched_latency 10000 -#else -#error "unsupported NIOS2 platform" -#endif - p->user = __sched_latency; - p->kernel = CONFIG_XENO_OPT_TIMING_KSCHEDLAT; - p->irq = CONFIG_XENO_OPT_TIMING_IRQLAT; -} - -#undef __sched_latency - -#endif /* !_COBALT_NIOS2_ASM_CALIBRATION_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/features.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/features.h deleted file mode 100644 index 78fa5d6..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/features.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, or - * (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_FEATURES_H -#define _COBALT_NIOS2_ASM_FEATURES_H - -#include <linux/ipipe.h> -#include <asm/xenomai/uapi/features.h> - -static inline void collect_arch_features(struct cobalt_featinfo *p) -{ - p->feat_arch.hrclock_membase = __ipipe_hrclock_membase; -} - -#endif /* !_COBALT_NIOS2_ASM_FEATURES_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/fptest.h deleted file mode 100644 index 3282cea..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/fptest.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>. - * - * Xenomai 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 2 of the License, - * or (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_FPTEST_H -#define _COBALT_NIOS2_ASM_FPTEST_H - -#include <linux/errno.h> -#include <asm/xenomai/uapi/fptest.h> - -static inline int fp_kernel_supported(void) -{ - return 0; -} - -static inline int fp_linux_begin(void) -{ - return -ENOSYS; -} - -static inline void fp_linux_end(void) -{ -} - -static inline int fp_detect(void) -{ - return 0; -} - -#endif /* _COBALT_NIOS2_ASM_FPTEST_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/machine.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/machine.h deleted file mode 100644 index 19c8456..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/machine.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright © 2009 Philippe Gerum. - * - * Xenomai 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, Inc., 675 Mass Ave, - * Cambridge MA 02139, USA; either version 2 of the License, or (at - * your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_MACHINE_H -#define _COBALT_NIOS2_ASM_MACHINE_H - -#include <linux/compiler.h> - -/* - * We have a dedicated timer on this arch, so no need for - * piggybacking the kernel timer. - */ -#undef XNARCH_HOST_TICK_IRQ - -static inline __attribute_const__ unsigned long ffnz(unsigned long ul) -{ - return ffs(ul) - 1; -} - -#include <asm-generic/xenomai/machine.h> - -#endif /* !_COBALT_NIOS2_ASM_MACHINE_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h deleted file mode 100644 index c329dc3..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, - * or (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_SYSCALL_H -#define _COBALT_NIOS2_ASM_SYSCALL_H - -#include <linux/errno.h> -#include <asm/uaccess.h> -#include <asm/ptrace.h> -#include <asm-generic/xenomai/syscall.h> - -#define __xn_reg_sys(__regs) ((__regs)->r2) -#define __xn_syscall_p(__regs) (__xn_reg_sys(__regs) & __COBALT_SYSCALL_BIT) -#define __xn_syscall(__regs) (__xn_reg_sys(__regs) & ~__COBALT_SYSCALL_BIT) - -#define __xn_reg_rval(__regs) ((__regs)->r2) -#define __xn_reg_arg1(__regs) ((__regs)->r4) -#define __xn_reg_arg2(__regs) ((__regs)->r5) -#define __xn_reg_arg3(__regs) ((__regs)->r6) -#define __xn_reg_arg4(__regs) ((__regs)->r7) -#define __xn_reg_arg5(__regs) ((__regs)->r8) -#define __xn_reg_pc(__regs) ((__regs)->ea) -#define __xn_reg_sp(__regs) ((__regs)->sp) - -static inline void __xn_error_return(struct pt_regs *regs, int v) -{ - __xn_reg_rval(regs) = v; -} - -static inline void __xn_status_return(struct pt_regs *regs, long v) -{ - __xn_reg_rval(regs) = v; -} - -static inline int __xn_interrupted_p(struct pt_regs *regs) -{ - return __xn_reg_rval(regs) == -EINTR; -} - -int xnarch_local_syscall(unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, - unsigned long a5); - -#endif /* !_COBALT_NIOS2_ASM_SYSCALL_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall32.h deleted file mode 100644 index 72aad64..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall32.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, - * or (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_SYSCALL32_H -#define _COBALT_NIOS2_ASM_SYSCALL32_H - -#include <asm-generic/xenomai/syscall32.h> - -#endif /* !_COBALT_NIOS2_ASM_SYSCALL32_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h deleted file mode 100644 index df473c9..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2009,2013 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, or - * (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_THREAD_H -#define _COBALT_NIOS2_ASM_THREAD_H - -#include <asm-generic/xenomai/thread.h> - -#ifndef CONFIG_MMU -#error "Xenomai: please use Xenomai 2.5.x for MMU-less support" -#endif - -struct xnarchtcb { - struct xntcb core; - struct { - unsigned long ea; - unsigned long r2; - unsigned long r3; - } mayday; -}; - -#define xnarch_fpu_ptr(tcb) NULL -#define xnarch_fault_trap(d) ((d)->exception) -#define xnarch_fault_code(d) (0) /* None on this arch. */ -#define xnarch_fault_pc(d) ((d)->regs->ea) -#define xnarch_fault_fpu_p(d) (0) /* Can't be. */ -#define xnarch_fault_pf_p(d) (0) /* No page faults. */ -#define xnarch_fault_bp_p(d) ((current->ptrace & PT_PTRACED) && \ - ((d)->exception == IPIPE_TRAP_BP)) - -#define xnarch_fault_notify(d) (xnarch_fault_bp_p(d) == 0) - -static inline void xnarch_init_root_tcb(struct xnthread *thread) { } -static inline void xnarch_init_shadow_tcb(struct xnthread *thread) { } -static inline void xnarch_enter_root(struct xnthread *root) { } -static inline void xnarch_leave_root(struct xnthread *thread) { } -static inline void xnarch_save_fpu(struct xnthread *thread) { } -static inline void -xnarch_switch_fpu(struct xnthread *from, struct xnthread *to) -{ - return 0; -} - -static inline int -xnarch_handle_fpu_fault(struct xnthread *from, - struct xnthread *to, struct ipipe_trap_data *d) -{ - return 0; -} - -void xnarch_switch_to(struct xnthread *out, struct xnthread *in); - -int xnarch_escalate(void); - -#endif /* !_COBALT_NIOS2_ASM_THREAD_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/arith.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/arith.h deleted file mode 100644 index 64f16a1..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/arith.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _COBALT_NIOS2_ASM_UAPI_ARITH_H -#define _COBALT_NIOS2_ASM_UAPI_ARITH_H - -#include <asm/xenomai/uapi/features.h> - -#define xnarch_add96and64(l0, l1, l2, s0, s1) \ - do { \ - __asm__ ("add %2, %2, %4\n\t" \ - "cmpltu r8, %2, %4\n\t" \ - "add %1, %1, %3\n\t" \ - "cmpltu r9, %1, %3\n\t" \ - "add %1, %1, r8\n\t" \ - "cmpltu r8, %1, r8\n\t" \ - "add r9, r9, r8\n\t" \ - "add %0, %0, r9\n\t" \ - : "=r"(l0), "=&r"(l1), "=&r"(l2) \ - : "r"(s0), "r"(s1), "0"(l0), "1"(l1), "2"(l2) \ - : "r8", "r9"); \ - } while (0); - -#include <cobalt/uapi/asm-generic/arith.h> - -#endif /* _COBALT_NIOS2_ASM_UAPI_ARITH_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h deleted file mode 100644 index ff9aacc..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/features.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _COBALT_NIOS2_ASM_UAPI_FEATURES_H -#define _COBALT_NIOS2_ASM_UAPI_FEATURES_H - -#include <linux/types.h> - -/* The ABI revision level we use on this arch. */ -#define XENOMAI_ABI_REV 14UL - -#define XENOMAI_FEAT_DEP __xn_feat_generic_mask - -#define XENOMAI_FEAT_MAN __xn_feat_generic_man_mask - -#define XNARCH_HAVE_LLMULSHFT 1 -#define XNARCH_HAVE_NODIV_LLIMD 1 - -struct cobalt_featinfo_archdep { - __u32 hrclock_membase; -}; - -#include <cobalt/uapi/asm-generic/features.h> - -static inline const char *get_feature_label(unsigned int feature) -{ - return get_generic_feature_label(feature); -} - -#endif /* !_COBALT_NIOS2_ASM_UAPI_FEATURES_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/fptest.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/fptest.h deleted file mode 100644 index 092c234..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/fptest.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _COBALT_NIOS2_ASM_UAPI_FPTEST_H -#define _COBALT_NIOS2_ASM_UAPI_FPTEST_H - -static inline void fp_regs_set(int features, unsigned int val) -{ -} - -static inline unsigned int fp_regs_check(int features, unsigned int val, - int (*report)(const char *fmt, ...)) -{ - return val; -} - -#endif /* !_COBALT_NIOS2_ASM_UAPI_FPTEST_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/syscall.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/syscall.h deleted file mode 100644 index b9ab61d..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/uapi/syscall.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _COBALT_NIOS2_ASM_UAPI_SYSCALL_H -#define _COBALT_NIOS2_ASM_UAPI_SYSCALL_H - -#define __xn_syscode(__nr) (__COBALT_SYSCALL_BIT | (__nr)) - -#define __xn_lsys_xchg 0 - -#endif /* !_COBALT_NIOS2_ASM_UAPI_SYSCALL_H */ diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/nios2/include/asm/xenomai/wrappers.h deleted file mode 100644 index a2c0a1b..0000000 --- a/kernel/cobalt/arch/nios2/include/asm/xenomai/wrappers.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, - * or (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#ifndef _COBALT_NIOS2_ASM_WRAPPERS_H -#define _COBALT_NIOS2_ASM_WRAPPERS_H - -#include <asm-generic/xenomai/wrappers.h> /* Read the generic portion. */ - -#define PAGE_SHARED __pgprot(0) - -#endif /* _COBALT_NIOS2_ASM_WRAPPERS_H */ diff --git a/kernel/cobalt/arch/nios2/machine.c b/kernel/cobalt/arch/nios2/machine.c deleted file mode 100644 index 1c5b194..0000000 --- a/kernel/cobalt/arch/nios2/machine.c +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (C) 2009 Philippe Gerum. - * - * Xenomai 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, Inc., 675 Mass Ave, - * Cambridge MA 02139, USA; either version 2 of the License, or (at - * your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#include <linux/stddef.h> -#include <asm/xenomai/machine.h> - -static unsigned long mach_nios2_calibrate(void) -{ - unsigned long flags; - u64 t, v; - int n; - - flags = hard_local_irq_save(); - - ipipe_read_tsc(t); - - barrier(); - - for (n = 1; n <= 100; n++) - ipipe_read_tsc(v); - - hard_local_irq_restore(flags); - - return xnarch_ulldiv(v - t, n, NULL); -} - -static const char *const fault_labels[] = { - [0] = "Breakpoint", - [1] = "Data or instruction access", - [2] = "Unaligned access", - [3] = "Illegal instruction", - [4] = "Supervisor instruction", - [5] = "Division error", - [6] = NULL -}; - -struct cobalt_machine cobalt_machine = { - .name = "nios2", - .init = NULL, - .late_init = NULL, - .cleanup = NULL, - .calibrate = mach_nios2_calibrate, - .prefault = NULL, - .fault_labels = fault_labels, -}; diff --git a/kernel/cobalt/arch/nios2/mayday.c b/kernel/cobalt/arch/nios2/mayday.c deleted file mode 100644 index 15775f3..0000000 --- a/kernel/cobalt/arch/nios2/mayday.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, or - * (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#include <linux/types.h> -#include <linux/ipipe.h> -#include <linux/vmalloc.h> -#include <cobalt/kernel/thread.h> -#include <cobalt/uapi/syscall.h> -#include <asm/cacheflush.h> -#include <asm/ptrace.h> - -static void *mayday; - -static inline void setup_mayday(void *page) -{ - /* - * We want this code to appear at the top of the MAYDAY page: - * - * 00c00334 movhi r3,#sc_cobalt_mayday - * 18c08ac4 addi r3,r3,#cobalt_syscall_tag - * 00800004 movi r2,0 - * 003b683a trap - * 003fff06 br . - */ - static const struct { - u32 movhi_r3h; - u32 addi_r3l; - u32 movi_r2; - u32 syscall; - u32 bug; - } code = { - .movhi_r3h = 0x00c00334, - .addi_r3l = 0x18c08ac4, - .movi_r2 = 0x00800004, - .syscall = 0x003b683a, - .bug = 0x003fff06 - }; - - memcpy(page, &code, sizeof(code)); - - flush_dcache_range((unsigned long)page, - (unsigned long)page + sizeof(code)); -} - -int xnarch_init_mayday(void) -{ - mayday = vmalloc(PAGE_SIZE); - if (mayday == NULL) - return -ENOMEM; - - setup_mayday(mayday); - - return 0; -} - -void xnarch_cleanup_mayday(void) -{ - vfree(mayday); -} - -void *xnarch_get_mayday_page(void) -{ - return mayday; -} - -void xnarch_handle_mayday(struct xnarchtcb *tcb, - struct pt_regs *regs, unsigned long tramp) -{ - tcb->mayday.ea = regs->ea; - tcb->mayday.r2 = regs->r2; - tcb->mayday.r3 = regs->r3; - regs->ea = tramp; -} - -void xnarch_fixup_mayday(struct xnarchtcb *tcb, struct pt_regs *regs) -{ - regs->ea = tcb->mayday.ea; - regs->r2 = tcb->mayday.r2; - regs->r3 = tcb->mayday.r3; -} diff --git a/kernel/cobalt/arch/nios2/patches/README b/kernel/cobalt/arch/nios2/patches/README deleted file mode 100644 index 5654b11..0000000 --- a/kernel/cobalt/arch/nios2/patches/README +++ /dev/null @@ -1,19 +0,0 @@ --- arch/nios2/patches - -Xenomai needs special kernel support to deliver fast and deterministic -response time to external interrupts, and also to provide real-time -services highly integrated with the standard Linux kernel. - -This support is provided by the interrupt pipeline (aka I-pipe) in the -form of a kernel patch you have to apply against a vanilla kernel -tree, before you attempt to compile the Xenomai codebase against the -latter kernel. - -Apply one of the patches found into this directory against the -corresponding kernel release. You may want to have a look at the -README.*INSTALL guides at the top of the Xenomai tree for more -information. - -NOTE: -Xenomai 3.x requires the latest IPIPE core series (API revision >= 2). -nios2 is NOT yet supported over the Xenomai 3.x architecture. diff --git a/kernel/cobalt/arch/nios2/switch.S b/kernel/cobalt/arch/nios2/switch.S deleted file mode 100644 index fef6e3d..0000000 --- a/kernel/cobalt/arch/nios2/switch.S +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum. - * - * This program 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, Inc., 675 Mass Ave, Cambridge MA 02139, - * USA; either version 2 of the License, or (at your option) any later - * version. - * - * This program 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <linux/linkage.h> -#include <asm/asm-offsets.h> -#include <asm/thread_info.h> -#include <asm/entry.h> - -.text -.set noat -.set nobreak - -.macro GET_THREAD_INFO reg -.if THREAD_SIZE & 0xffff0000 - andhi \reg, sp, %hi(~(THREAD_SIZE-1)) -.else - addi \reg, r0, %lo(~(THREAD_SIZE-1)) - and \reg, \reg, sp -.endif -.endm - -/* - * Switch context routine for Xenomai threads. - * - * void __asm_thread_switch(struct thread_struct *prev, - * struct thread_struct *next); - */ -ENTRY(__asm_thread_switch) - rdctl r7,status /* save thread status reg */ - stw r7,THREAD_KPSR(r4) - SAVE_SWITCH_STACK - stw sp,THREAD_KSP(r4) /* save kernel stack pointer */ - ldw sp,THREAD_KSP(r5) /* restore new thread stack */ - movia r24,_current_thread /* save thread */ - GET_THREAD_INFO r1 - stw r1,0(r24) - RESTORE_SWITCH_STACK - ldw r7,THREAD_KPSR(r5) /* restore thread status reg */ - wrctl status,r7 - ret diff --git a/kernel/cobalt/arch/nios2/syscall.c b/kernel/cobalt/arch/nios2/syscall.c deleted file mode 100644 index a354471..0000000 --- a/kernel/cobalt/arch/nios2/syscall.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, or - * (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <asm/xenomai/syscall.h> - -int xnarch_local_syscall(unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, - unsigned long a5) -{ - unsigned long r; - - switch (a1) { - case __xn_lsys_xchg: - - /* lsys_xchg(ptr,newval,&oldval) */ - r = xchg((unsigned long *)a2, a3); - __xn_put_user(r, (unsigned long *)a4); - break; - - default: - return -ENOSYS; - } - - return 0; -} diff --git a/kernel/cobalt/arch/nios2/thread.c b/kernel/cobalt/arch/nios2/thread.c deleted file mode 100644 index fe5d683..0000000 --- a/kernel/cobalt/arch/nios2/thread.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009,2013 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai 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 2 of the License, or - * (at your option) any later version. - * - * Xenomai 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. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <linux/sched.h> -#include <linux/ipipe.h> -#include <linux/mm.h> -#include <asm/mmu_context.h> -#include <cobalt/kernel/thread.h> - -asmlinkage void -__asm_thread_switch(struct thread_struct *prev, - struct thread_struct *next); - -void xnarch_switch_to(struct xnthread *out, struct xnthread *in) -{ - struct xnarchtcb *out_tcb = &out->tcb, *in_tcb = &in->tcb; - struct mm_struct *prev_mm, *next_mm; - struct task_struct *next; - - next = in_tcb->core.host_task; - prev_mm = out_tcb->core.active_mm; - - next_mm = in_tcb->core.mm; - if (next_mm == NULL) { - in_tcb->core.active_mm = prev_mm; - enter_lazy_tlb(prev_mm, next); - } else { - switch_mm(prev_mm, next_mm, next); - /* - * We might be switching back to the root thread, - * which we preempted earlier, shortly after "current" - * dropped its mm context in the do_exit() path - * (next->mm == NULL). In that particular case, the - * kernel expects a lazy TLB state for leaving the mm. - */ - if (next->mm == NULL) - enter_lazy_tlb(prev_mm, next); - } - - __asm_thread_switch(out_tcb->core.tsp, in_tcb->core.tsp); -} - -int xnarch_escalate(void) -{ - if (ipipe_root_p) { - ipipe_raise_irq(cobalt_pipeline.escalate_virq); - return 1; - } - - return 0; -} diff --git a/lib/cobalt/arch/Makefile.am b/lib/cobalt/arch/Makefile.am index 854e784..3073a3f 100644 --- a/lib/cobalt/arch/Makefile.am +++ b/lib/cobalt/arch/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS = @XENO_TARGET_ARCH@ -DIST_SUBDIRS = arm blackfin nios2 powerpc x86 +DIST_SUBDIRS = arm blackfin powerpc x86 diff --git a/lib/cobalt/arch/nios2/Makefile.am b/lib/cobalt/arch/nios2/Makefile.am deleted file mode 100644 index 0aa02d6..0000000 --- a/lib/cobalt/arch/nios2/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -noinst_LTLIBRARIES = libarch.la - -libarch_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 0:0:0 - -libarch_la_SOURCES = features.c - -libarch_la_CPPFLAGS = \ - @XENO_COBALT_CFLAGS@ \ - -I$(srcdir)/../.. \ - -I$(top_srcdir)/include/cobalt \ - -I$(top_srcdir)/include - -SUBDIRS = include diff --git a/lib/cobalt/arch/nios2/features.c b/lib/cobalt/arch/nios2/features.c deleted file mode 100644 index e095373..0000000 --- a/lib/cobalt/arch/nios2/features.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <sys/types.h> -#include <sys/mman.h> -#include <stdio.h> -#include <stdlib.h> -#include <fcntl.h> -#include <unistd.h> -#include <limits.h> -#include <cobalt/wrappers.h> -#include <asm/xenomai/features.h> -#include <asm/xenomai/uapi/fptest.h> -#include <boilerplate/compiler.h> -#include "internal.h" - -__weak volatile void *__cobalt_nios2_hrclock = NULL; - -void cobalt_check_features(struct cobalt_featinfo *finfo) -{ - unsigned long pa = finfo->feat_arch.hrclock_membase; - unsigned int pagesz; - void *p; - int fd; - - fd = __STD(open("/dev/mem", O_RDWR | O_SYNC)); - if (fd == -1) - early_panic("failed open(/dev/mem): %s", strerror(errno)); - - pagesz = sysconf(_SC_PAGESIZE); - p = __STD(mmap(NULL, pagesz, PROT_READ | PROT_WRITE, MAP_SHARED, - fd, pa & ~(pagesz - 1))); - if (p == MAP_FAILED) - early_panic("failed mmap(/dev/mem): %s", strerror(errno)); - - __STD(close(fd)); - - __cobalt_nios2_hrclock = (volatile void *)(p + (pa & (pagesz - 1))); -} diff --git a/lib/cobalt/arch/nios2/include/Makefile.am b/lib/cobalt/arch/nios2/include/Makefile.am deleted file mode 100644 index 5cac5d2..0000000 --- a/lib/cobalt/arch/nios2/include/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIRS = asm diff --git a/lib/cobalt/arch/nios2/include/asm/Makefile.am b/lib/cobalt/arch/nios2/include/asm/Makefile.am deleted file mode 100644 index 55ea661..0000000 --- a/lib/cobalt/arch/nios2/include/asm/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIRS = xenomai diff --git a/lib/cobalt/arch/nios2/include/asm/xenomai/Makefile.am b/lib/cobalt/arch/nios2/include/asm/xenomai/Makefile.am deleted file mode 100644 index d308b06..0000000 --- a/lib/cobalt/arch/nios2/include/asm/xenomai/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ - -noinst_HEADERS = \ - features.h \ - syscall.h \ - tsc.h diff --git a/lib/cobalt/arch/nios2/include/asm/xenomai/features.h b/lib/cobalt/arch/nios2/include/asm/xenomai/features.h deleted file mode 100644 index 6fa7842..0000000 --- a/lib/cobalt/arch/nios2/include/asm/xenomai/features.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2013 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _LIB_COBALT_NIOS2_FEATURES_H -#define _LIB_COBALT_NIOS2_FEATURES_H - -#include_next <features.h> -#include <xeno_config.h> -#include <asm/xenomai/uapi/features.h> - -static inline int cobalt_fp_detect(void) -{ - return 0; -} - -#endif /* !_LIB_COBALT_NIOS2_FEATURES_H */ diff --git a/lib/cobalt/arch/nios2/include/asm/xenomai/syscall.h b/lib/cobalt/arch/nios2/include/asm/xenomai/syscall.h deleted file mode 100644 index ed82be1..0000000 --- a/lib/cobalt/arch/nios2/include/asm/xenomai/syscall.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _LIB_COBALT_NIOS2_SYSCALL_H -#define _LIB_COBALT_NIOS2_SYSCALL_H - -#include <cobalt/uapi/syscall.h> -#include <errno.h> - -#define __emit_syscall0(syscode) \ - ({ \ - long __ret; \ - \ - __asm__ __volatile__ ( \ - "mov r2, %1\n\t" \ - "trap\n\t" \ - "mov %0, r2\n\t" \ - : "=r"(__ret) \ - : "r"(syscode) \ - : "r2", "memory" \ - ); \ - __ret; \ - }) - -#define __emit_syscall1(syscode, a1) \ - ({ \ - long __ret; \ - \ - __asm__ __volatile__ ( \ - "mov r2, %1\n\t" \ - "mov r4, %2\n\t" \ - "trap\n\t" \ - "mov %0, r2\n\t" \ - : "=r"(__ret) \ - : "r"(syscode), \ - "r" ((long)a1) \ - : "r2", "r4", "memory" \ - ); \ - __ret; \ - }) - -#define __emit_syscall2(syscode, a1, a2) \ - ({ \ - long __ret; \ - \ - __asm__ __volatile__ ( \ - "mov r2, %1\n\t" \ - "mov r4, %2\n\t" \ - "mov r5, %3\n\t" \ - "trap\n\t" \ - "mov %0, r2\n\t" \ - : "=r"(__ret) \ - : "r"(syscode), \ - "r" ((long)a1), \ - "r" ((long)a2) \ - : "r2", "r4", "r5", "memory" \ - ); \ - __ret; \ - }) - -#define __emit_syscall3(syscode, a1, a2, a3) \ - ({ \ - long __ret; \ - \ - __asm__ __volatile__ ( \ - "mov r2, %1\n\t" \ - "mov r4, %2\n\t" \ - "mov r5, %3\n\t" \ - "mov r6, %4\n\t" \ - "trap\n\t" \ - "mov %0, r2\n\t" \ - : "=r"(__ret) \ - : "r"(syscode), \ - "r" ((long)a1), \ - "r" ((long)a2), \ - "r" ((long)a3) \ - : "r2", "r4", "r5", "r6", "memory" \ - ); \ - __ret; \ - }) - -#define __emit_syscall4(syscode, a1, a2, a3, a4) \ - ({ \ - long __ret; \ - \ - __asm__ __volatile__ ( \ - "mov r2, %1\n\t" \ - "mov r4, %2\n\t" \ - "mov r5, %3\n\t" \ - "mov r6, %4\n\t" \ - "mov r7, %5\n\t" \ - "trap\n\t" \ - "mov %0, r2\n\t" \ - : "=r"(__ret) \ - : "r"(syscode), \ - "r" ((long)a1), \ - "r" ((long)a2), \ - "r" ((long)a3), \ - "r" ((long)a4) \ - : "r2", "r4", "r5", "r6", "r7", "memory" \ - ); \ - __ret; \ - }) - -#define __emit_syscall5(syscode, a1, a2, a3, a4, a5) \ - ({ \ - long __ret; \ - \ - __asm__ __volatile__ ( \ - "mov r2, %1\n\t" \ - "mov r4, %2\n\t" \ - "mov r5, %3\n\t" \ - "mov r6, %4\n\t" \ - "mov r7, %5\n\t" \ - "mov r8, %6\n\t" \ - "trap\n\t" \ - "mov %0, r2\n\t" \ - : "=r"(__ret) \ - : "r"(syscode), \ - "r" ((long)a1), \ - "r" ((long)a2), \ - "r" ((long)a3), \ - "r" ((long)a4), \ - "r" ((long)a5) \ - : "r2", "r4", "r5", "r6", "r7", "r8", "memory" \ - ); \ - __ret; \ - }) - -#define XENOMAI_DO_SYSCALL(nr, op, args...) \ - __emit_syscall##nr(__xn_syscode(op), ##args) - -#define XENOMAI_SYSCALL0(op) XENOMAI_DO_SYSCALL(0,op) -#define XENOMAI_SYSCALL1(op,a1) XENOMAI_DO_SYSCALL(1,op,a1) -#define XENOMAI_SYSCALL2(op,a1,a2) XENOMAI_DO_SYSCALL(2,op,a1,a2) -#define XENOMAI_SYSCALL3(op,a1,a2,a3) XENOMAI_DO_SYSCALL(3,op,a1,a2,a3) -#define XENOMAI_SYSCALL4(op,a1,a2,a3,a4) XENOMAI_DO_SYSCALL(4,op,a1,a2,a3,a4) -#define XENOMAI_SYSCALL5(op,a1,a2,a3,a4,a5) XENOMAI_DO_SYSCALL(5,op,a1,a2,a3,a4,a5) -#define XENOMAI_SYSBIND(breq) XENOMAI_DO_SYSCALL(1,sc_cobalt_bind,breq) - -#endif /* !_LIB_COBALT_NIOS2_SYSCALL_H */ diff --git a/lib/cobalt/arch/nios2/include/asm/xenomai/tsc.h b/lib/cobalt/arch/nios2/include/asm/xenomai/tsc.h deleted file mode 100644 index 54e51dc..0000000 --- a/lib/cobalt/arch/nios2/include/asm/xenomai/tsc.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef _LIB_COBALT_NIOS2_TSC_H -#define _LIB_COBALT_NIOS2_TSC_H - -extern volatile void *__cobalt_nios2_hrclock; - -static inline unsigned long long cobalt_read_tsc(void) -{ - volatile unsigned short *hrclock; - int64_t t0, t1; - - hrclock = __cobalt_nios2_hrclock; - -#define hrclock_wrsnap(reg, val) \ - (*(hrclock + (12 + ((reg) * 2)))) = (val) - -#define hrclock_rdsnap(reg) \ - (int64_t)(*(hrclock + (12 + ((reg) * 2)))) << (reg * 16) - -#define hrclock_peeksnap() \ - ({ \ - int64_t __snap; \ - __snap = hrclock_rdsnap(3) | hrclock_rdsnap(2) | \ - hrclock_rdsnap(1) | hrclock_rdsnap(0); \ - __snap; \ - }) - -#define hrclock_getsnap() \ - ({ \ - hrclock_wrsnap(0, 0); \ - hrclock_peeksnap(); \ - }) - - /* - * We compete with both the kernel and userland applications - * which may request a snapshot as well, but we don't have any - * simple mutual exclusion mechanism at hand to avoid - * races. In order to keep the overhead of reading the hrclock - * from userland low, we make sure to read two consecutive - * coherent snapshots. In case both readings do not match, we - * have to request a fresh snapshot anew, since it means that - * we have been preempted in the middle of the operation. - */ - do { - t0 = hrclock_getsnap(); /* Request snapshot and read it */ - __asm__ __volatile__("": : :"memory"); - t1 = hrclock_peeksnap(); /* Confirm first reading */ - } while (t0 != t1); - -#undef hrclock_getsnap -#undef hrclock_rdsnap -#undef hrclock_wrsnap - - return ~t0; -} - -#endif /* !_LIB_COBALT_NIOS2_TSC_H */ _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git