Module: xenomai-3 Branch: next Commit: b9e809f9ddf03684a6e38b35b847391326db10a0 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b9e809f9ddf03684a6e38b35b847391326db10a0
Author: Philippe Gerum <r...@xenomai.org> Date: Sat Aug 15 16:15:36 2015 +0200 cobalt/sh: drop support for the SH4 architecture We don't have any interrupt pipeline implementation for 3.x+ kernels on SH4, currently which is a requirement for running Xenomai 3, so there is no point in keeping this architecture code in-tree. --- configure.ac | 8 - kernel/cobalt/arch/sh/Kconfig | 21 -- kernel/cobalt/arch/sh/Makefile | 6 - .../arch/sh/include/asm/xenomai/calibration.h | 38 --- .../cobalt/arch/sh/include/asm/xenomai/features.h | 30 -- kernel/cobalt/arch/sh/include/asm/xenomai/fptest.h | 44 --- .../cobalt/arch/sh/include/asm/xenomai/machine.h | 38 --- .../cobalt/arch/sh/include/asm/xenomai/syscall.h | 57 ---- .../cobalt/arch/sh/include/asm/xenomai/syscall32.h | 24 -- kernel/cobalt/arch/sh/include/asm/xenomai/thread.h | 76 ----- .../arch/sh/include/asm/xenomai/uapi/arith.h | 35 --- .../arch/sh/include/asm/xenomai/uapi/features.h | 44 --- .../arch/sh/include/asm/xenomai/uapi/fptest.h | 31 -- .../arch/sh/include/asm/xenomai/uapi/syscall.h | 23 -- .../cobalt/arch/sh/include/asm/xenomai/wrappers.h | 24 -- kernel/cobalt/arch/sh/machine.c | 60 ---- kernel/cobalt/arch/sh/mayday.c | 99 ------ kernel/cobalt/arch/sh/patches/README | 18 -- kernel/cobalt/arch/sh/thread.c | 315 -------------------- kernel/cobalt/arch/sh/trampoline.S | 32 -- lib/cobalt/arch/Makefile.am | 2 +- lib/cobalt/arch/sh/Makefile.am | 13 - lib/cobalt/arch/sh/features.c | 63 ---- lib/cobalt/arch/sh/include/Makefile.am | 2 - lib/cobalt/arch/sh/include/asm/Makefile.am | 2 - lib/cobalt/arch/sh/include/asm/xenomai/Makefile.am | 5 - lib/cobalt/arch/sh/include/asm/xenomai/features.h | 30 -- lib/cobalt/arch/sh/include/asm/xenomai/syscall.h | 116 ------- lib/cobalt/arch/sh/include/asm/xenomai/tsc.h | 54 ---- 29 files changed, 1 insertion(+), 1309 deletions(-) diff --git a/configure.ac b/configure.ac index 701d9fd..6db4031 100644 --- a/configure.ac +++ b/configure.ac @@ -148,10 +148,6 @@ case "$build_for" in XENO_TARGET_ARCH=nios2 CONFIG_XENO_DEFAULT_PERIOD=10000000 ;; - sh-*|sh4-*) - XENO_TARGET_ARCH=sh - CONFIG_XENO_DEFAULT_PERIOD=100000 - ;; *) echo "" echo "*******************************************" echo "Still unsupported target: $build_for -- Sorry." @@ -880,10 +876,6 @@ AC_CONFIG_FILES([ \ lib/cobalt/arch/nios2/include/Makefile \ lib/cobalt/arch/nios2/include/asm/Makefile \ lib/cobalt/arch/nios2/include/asm/xenomai/Makefile \ - lib/cobalt/arch/sh/Makefile \ - lib/cobalt/arch/sh/include/Makefile \ - lib/cobalt/arch/sh/include/asm/Makefile \ - lib/cobalt/arch/sh/include/asm/xenomai/Makefile \ lib/mercury/Makefile \ lib/copperplate/Makefile \ lib/copperplate/regd/Makefile \ diff --git a/kernel/cobalt/arch/sh/Kconfig b/kernel/cobalt/arch/sh/Kconfig deleted file mode 100644 index af23fa0..0000000 --- a/kernel/cobalt/arch/sh/Kconfig +++ /dev/null @@ -1,21 +0,0 @@ -config IPIPE_WANT_ACTIVE_MM - bool - -config XENO_ARCH_FPU - def_bool SH_FPU - -config XENO_ARCH_SYS3264 - def_bool n - -menu "Machine/platform-specific options" - -config IPIPE_WANT_PREEMPTIBLE_SWITCH - bool - select IPIPE_WANT_ACTIVE_MM - default y if XENO_ARCH_UNLOCKED_SWITCH - default n if !XENO_ARCH_UNLOCKED_SWITCH - -endmenu - -source "kernel/xenomai/Kconfig" -source "drivers/xenomai/Kconfig" diff --git a/kernel/cobalt/arch/sh/Makefile b/kernel/cobalt/arch/sh/Makefile deleted file mode 100644 index 82477a1..0000000 --- a/kernel/cobalt/arch/sh/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -obj-$(CONFIG_XENOMAI) += xenomai.o - -xenomai-y := machine.o mayday.o thread.o trampoline.o - -ccflags-y := -Iarch/sh/xenomai/include -Iinclude/xenomai diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/sh/include/asm/xenomai/calibration.h deleted file mode 100644 index 834febf..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/calibration.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_CALIBRATION_H -#define _COBALT_SH_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_SH_ST_MB442) -#define __sched_latency 5000 -#else -#define __sched_latency 7000 -#endif - p->user = __sched_latency; - p->kernel = CONFIG_XENO_OPT_TIMING_KSCHEDLAT; - p->irq = CONFIG_XENO_OPT_TIMING_IRQLAT; -} - -#undef __sched_latency - -#endif /* !_COBALT_SH_ASM_CALIBRATION_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/features.h b/kernel/cobalt/arch/sh/include/asm/xenomai/features.h deleted file mode 100644 index 708b156..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/features.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_FEATURES_H -#define _COBALT_SH_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 = __pa(__ipipe_tsc); -} - -#endif /* !_COBALT_SH_ASM_FEATURES_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/sh/include/asm/xenomai/fptest.h deleted file mode 100644 index 4fa46c6..0000000 --- a/kernel/cobalt/arch/sh/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_SH_ASM_FPTEST_H -#define _COBALT_SH_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_SH_ASM_FPTEST_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/machine.h b/kernel/cobalt/arch/sh/include/asm/xenomai/machine.h deleted file mode 100644 index ba66b4c..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/machine.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright © 2011 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_SH_ASM_MACHINE_H -#define _COBALT_SH_ASM_MACHINE_H - -#include <linux/compiler.h> - -#ifndef CONFIG_CPU_SH4 -#error "unsupported SH architecture" -#endif - -#define XNARCH_HOST_TICK_IRQ __ipipe_hrtimer_irq - -static inline __attribute_const__ unsigned long ffnz(unsigned long ul) -{ - return ffs(ul) - 1; -} - -#include <asm-generic/xenomai/machine.h> - -#endif /* !_COBALT_SH_ASM_MACHINE_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h deleted file mode 100644 index b84fb24..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_SYSCALL_H -#define _COBALT_SH_ASM_SYSCALL_H - -#include <linux/errno.h> -#include <asm/ptrace.h> -#include <asm-generic/xenomai/syscall.h> - -#define __xn_reg_sys(__regs) ((__regs)->regs[3]) -#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)->regs[0]) -#define __xn_reg_arg1(__regs) ((__regs)->regs[4]) -#define __xn_reg_arg2(__regs) ((__regs)->regs[5]) -#define __xn_reg_arg3(__regs) ((__regs)->regs[6]) -#define __xn_reg_arg4(__regs) ((__regs)->regs[7]) -#define __xn_reg_arg5(__regs) ((__regs)->regs[0]) - -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; -} - -static inline int xnarch_local_syscall(void) -{ - return -ENOSYS; -} - -#endif /* !_COBALT_SH_ASM_SYSCALL_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/sh/include/asm/xenomai/syscall32.h deleted file mode 100644 index 1a93977..0000000 --- a/kernel/cobalt/arch/sh/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_SH_ASM_SYSCALL32_H -#define _COBALT_SH_ASM_SYSCALL32_H - -#include <asm-generic/xenomai/syscall32.h> - -#endif /* !_COBALT_SH_ASM_SYSCALL32_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h b/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h deleted file mode 100644 index 654bfa7..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2011,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_SH_ASM_THREAD_H -#define _COBALT_SH_ASM_THREAD_H - -#include <asm-generic/xenomai/thread.h> - -struct xnarchtcb { - struct xntcb core; -#ifdef CONFIG_XENO_ARCH_FPU - struct thread_struct *fpup; -#define xnarch_fpu_ptr(tcb) ((tcb)->fpup) -#else -#define xnarch_fpu_ptr(tcb) NULL -#endif - struct { - unsigned long pc; - unsigned long r3; - } mayday; -}; - -#define xnarch_fault_trap(d) ((d)->exception) -#define xnarch_fault_code(d) 0 -#define xnarch_fault_pc(d) ((d)->regs->pc) -#define xnarch_fault_fpu_p(d) ((d)->exception == IPIPE_TRAP_FPUERR) -#define xnarch_fault_pf_p(d) ((d)->exception == IPIPE_TRAP_PF) -#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_enter_root(struct xnthread *root) { } - -#ifdef CONFIG_XENO_ARCH_FPU - -void xnarch_leave_root(struct xnthread *root); - -static inline void xnarch_init_root_tcb(struct xnthread *thread) -{ - struct xnarchtcb *tcb = xnthread_archtcb(thread); - tcb->fpup = NULL; -} - -void xnarch_init_shadow_tcb(struct xnthread *thread); - -#else /* !CONFIG_XENO_ARCH_FPU */ - -static inline void xnarch_leave_root(struct xnthread *root) { } -static inline void xnarch_init_root_tcb(struct xnthread *thread) { } -static inline void xnarch_init_shadow_tcb(struct xnthread *thread) { } - -#endif /* !CONFIG_XENO_ARCH_FPU */ - -static inline int -xnarch_handle_fpu_fault(struct xnthread *from, - struct xnthread *to, struct ipipe_trap_data *d) -{ - return 0; -} - -#endif /* !_COBALT_SH_ASM_THREAD_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/arith.h b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/arith.h deleted file mode 100644 index f1e2994..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/arith.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_UAPI_ARITH_H -#define _COBALT_SH_ASM_UAPI_ARITH_H - -#include <asm/xenomai/uapi/features.h> - -#define xnarch_add96and64(l0, l1, l2, s0, s1) \ - do { \ - __asm__ ("clrt\n\t" \ - "addc %4, %2\n\t" \ - "addc %3, %1\n\t" \ - "addc %5, %0\n\t" \ - : "+r"(l0), "+r"(l1), "+r"(l2) \ - : "r"(s0), "r"(s1), "r" (0) : "t"); \ - } while (0) - -#include <cobalt/uapi/asm-generic/arith.h> - -#endif /* _COBALT_SH_ASM_UAPI_ARITH_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h deleted file mode 100644 index c5465d8..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/features.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_FEATURES_H -#define _COBALT_SH_ASM_FEATURES_H - -#include <linux/types.h> - -/* The ABI revision level we use on this arch. */ -#define XENOMAI_ABI_REV 12UL - -#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_SH_ASM_FEATURES_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/fptest.h b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/fptest.h deleted file mode 100644 index a49bcea..0000000 --- a/kernel/cobalt/arch/sh/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_SH_ASM_UAPI_FPTEST_H -#define _COBALT_SH_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_SH_ASM_UAPI_FPTEST_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/syscall.h b/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/syscall.h deleted file mode 100644 index ecf39bc..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/uapi/syscall.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_UAPI_SYSCALL_H -#define _COBALT_SH_ASM_UAPI_SYSCALL_H - -#define __xn_syscode(__nr) (__COBALT_SYSCALL_BIT | (__nr)) - -#endif /* !_COBALT_SH_ASM_UAPI_SYSCALL_H */ diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/sh/include/asm/xenomai/wrappers.h deleted file mode 100644 index 1b4c4ae..0000000 --- a/kernel/cobalt/arch/sh/include/asm/xenomai/wrappers.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_ASM_WRAPPERS_H -#define _COBALT_SH_ASM_WRAPPERS_H - -#include <asm-generic/xenomai/wrappers.h> /* Read the generic portion. */ - -#endif /* _COBALT_SH_ASM_WRAPPERS_H */ diff --git a/kernel/cobalt/arch/sh/machine.c b/kernel/cobalt/arch/sh/machine.c deleted file mode 100644 index f331b9d..0000000 --- a/kernel/cobalt/arch/sh/machine.c +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (C) 2011 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_sh_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] = "Page fault", - [2] = "Address error", - [3] = "FPU error", - [4] = "Exception error", - [5] = NULL -}; - -struct cobalt_machine cobalt_machine = { - .name = "sh", - .init = NULL, - .late_init = NULL, - .cleanup = NULL, - .calibrate = mach_sh_calibrate, - .prefault = NULL, - .fault_labels = fault_labels, -}; diff --git a/kernel/cobalt/arch/sh/mayday.c b/kernel/cobalt/arch/sh/mayday.c deleted file mode 100644 index a138223..0000000 --- a/kernel/cobalt/arch/sh/mayday.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2011 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 <linux/mm.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) -{ - u16 insn[11]; - - /* - * We want this code to appear at the top of the MAYDAY page: - * - * 0: 03 d3 mov.l 12 <pc+0x12>,r3 ! b022b - * 2: 09 00 nop - * 4: 10 c3 trapa #16 - * 6: 0b 20 or r0,r0 - * 8: 0b 20 or r0,r0 - * a: 0b 20 or r0,r0 - * c: 0b 20 or r0,r0 - * e: 0b 20 or r0,r0 - * 10: 3e c3 trapa #62 - * 12: 2b 02 .word 0x022b - * 14: 0b 00 .word 0x000b - */ - insn[0] = 0xd303; - insn[1] = 0x0009; - insn[2] = 0xc310; - insn[3] = 0x200b; - insn[4] = 0x200b; - insn[5] = 0x200b; - insn[6] = 0x200b; - insn[7] = 0x200b; - insn[8] = 0xc33e; - insn[9] = 0x022b; - insn[10] = 0x000b; - memcpy(page, insn, sizeof(insn)); - - flush_dcache_page(vmalloc_to_page(page)); -} - -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.pc = regs->pc; - tcb->mayday.r3 = regs->regs[3]; - regs->pc = tramp; -} - -void xnarch_fixup_mayday(struct xnarchtcb *tcb, struct pt_regs *regs) -{ - regs->pc = tcb->mayday.pc; - regs->regs[3] = tcb->mayday.r3; -} diff --git a/kernel/cobalt/arch/sh/patches/README b/kernel/cobalt/arch/sh/patches/README deleted file mode 100644 index b624bb1..0000000 --- a/kernel/cobalt/arch/sh/patches/README +++ /dev/null @@ -1,18 +0,0 @@ --- arch/sh/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. - -Xenomai 3.x requires the latest IPIPE core series (API revision >= 2). -SH is NOT yet supported over the Xenomai 3.x architecture. diff --git a/kernel/cobalt/arch/sh/thread.c b/kernel/cobalt/arch/sh/thread.c deleted file mode 100644 index 7d7bb51..0000000 --- a/kernel/cobalt/arch/sh/thread.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (C) 2011,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> - -#define do_switch_threads(otcb, itcb, prev, next) \ - ({ \ - register u32 *__ts1 __asm__ ("r1"); \ - register u32 *__ts2 __asm__ ("r2"); \ - register u32 *__ts4 __asm__ ("r4"); \ - register u32 *__ts5 __asm__ ("r5"); \ - register u32 *__ts6 __asm__ ("r6"); \ - register u32 __ts7 __asm__ ("r7"); \ - struct task_struct *__last = prev; \ - struct xnarchtcb *__ltcb = otcb; \ - \ - if (otcb->core.tsp == &prev->thread && \ - is_dsp_enabled(prev)) \ - __save_dsp(prev); \ - \ - __ts1 = (u32 *)&otcb->core.tsp->sp; \ - __ts2 = (u32 *)&otcb->core.tsp->pc; \ - __ts4 = (u32 *)prev; \ - __ts5 = (u32 *)next; \ - __ts6 = (u32 *)&itcb->core.tsp->sp; \ - __ts7 = itcb->core.tsp->pc; \ - \ - __asm__ __volatile__ ( \ - ".balign 4\n\t" \ - "stc.l gbr, @-r15\n\t" \ - "sts.l pr, @-r15\n\t" \ - "mov.l r8, @-r15\n\t" \ - "mov.l r9, @-r15\n\t" \ - "mov.l r10, @-r15\n\t" \ - "mov.l r11, @-r15\n\t" \ - "mov.l r12, @-r15\n\t" \ - "mov.l r13, @-r15\n\t" \ - "mov.l r14, @-r15\n\t" \ - "mov.l r15, @r1\t! save SP\n\t" \ - "mov.l @r6, r15\t! change to new stack\n\t" \ - "mova 1f, %0\n\t" \ - "mov.l %0, @r2\t! save PC\n\t" \ - "mov.l 2f, %0\n\t" \ - "jmp @%0\t! call __switch_to\n\t" \ - " nop\t\n\t" \ - "3:\n\t" \ - "rts\n\t" \ - ".balign 4\n" \ - "2:\n\t" \ - ".long __switch_to\n" \ - "1:\n\t" \ - "mov.l @r15+, r14\n\t" \ - "mov.l @r15+, r13\n\t" \ - "mov.l @r15+, r12\n\t" \ - "mov.l @r15+, r11\n\t" \ - "mov.l @r15+, r10\n\t" \ - "mov.l @r15+, r9\n\t" \ - "mov.l @r15+, r8\n\t" \ - "lds.l @r15+, pr\n\t" \ - "ldc.l @r15+, gbr\n\t" \ - : "=z" (__last) \ - : "r" (__ts1), "r" (__ts2), "r" (__ts4), \ - "r" (__ts5), "r" (__ts6), "r" (__ts7) \ - : "r3", "t"); \ - \ - if (__ltcb->core.tsp == &__last->thread && \ - is_dsp_enabled(__last)) \ - __restore_dsp(__last); \ - \ - __last; \ - }) - -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); - } - - do_switch_threads(out_tcb, in_tcb, prev, next); -} - -#ifdef CONFIG_XENO_ARCH_FPU - -#define FPSCR_RCHG 0x00000000 - -static inline get_fpu_owner(struct task_struct *p) -{ - unsigned long __sr; - __asm__ __volatile__("stc sr, %0\n\t" - : "=&r" (__sr) - : /* empty */); - return (__sr & SR_FD) ? NULL : cur; -} - -static inline void do_save_fpu(struct thread_struct *ts) -{ - unsigned long dummy; - - enable_fpu(); - asm volatile ("sts.l fpul, @-%0\n\t" - "sts.l fpscr, @-%0\n\t" - "lds %2, fpscr\n\t" - "frchg\n\t" - "fmov.s fr15, @-%0\n\t" - "fmov.s fr14, @-%0\n\t" - "fmov.s fr13, @-%0\n\t" - "fmov.s fr12, @-%0\n\t" - "fmov.s fr11, @-%0\n\t" - "fmov.s fr10, @-%0\n\t" - "fmov.s fr9, @-%0\n\t" - "fmov.s fr8, @-%0\n\t" - "fmov.s fr7, @-%0\n\t" - "fmov.s fr6, @-%0\n\t" - "fmov.s fr5, @-%0\n\t" - "fmov.s fr4, @-%0\n\t" - "fmov.s fr3, @-%0\n\t" - "fmov.s fr2, @-%0\n\t" - "fmov.s fr1, @-%0\n\t" - "fmov.s fr0, @-%0\n\t" - "frchg\n\t" - "fmov.s fr15, @-%0\n\t" - "fmov.s fr14, @-%0\n\t" - "fmov.s fr13, @-%0\n\t" - "fmov.s fr12, @-%0\n\t" - "fmov.s fr11, @-%0\n\t" - "fmov.s fr10, @-%0\n\t" - "fmov.s fr9, @-%0\n\t" - "fmov.s fr8, @-%0\n\t" - "fmov.s fr7, @-%0\n\t" - "fmov.s fr6, @-%0\n\t" - "fmov.s fr5, @-%0\n\t" - "fmov.s fr4, @-%0\n\t" - "fmov.s fr3, @-%0\n\t" - "fmov.s fr2, @-%0\n\t" - "fmov.s fr1, @-%0\n\t" - "fmov.s fr0, @-%0\n\t" - "lds %3, fpscr\n\t":"=r" (dummy) - :"0"((char *)(&ts->fpu.hard.status)), - "r"(FPSCR_RCHG), "r"(FPSCR_INIT) - :"memory"); -} - -static inline void do_restore_fpu(struct thread_struct *ts) -{ - unsigned long dummy; - - enable_fpu(); - asm volatile ("lds %2, fpscr\n\t" - "fmov.s @%0+, fr0\n\t" - "fmov.s @%0+, fr1\n\t" - "fmov.s @%0+, fr2\n\t" - "fmov.s @%0+, fr3\n\t" - "fmov.s @%0+, fr4\n\t" - "fmov.s @%0+, fr5\n\t" - "fmov.s @%0+, fr6\n\t" - "fmov.s @%0+, fr7\n\t" - "fmov.s @%0+, fr8\n\t" - "fmov.s @%0+, fr9\n\t" - "fmov.s @%0+, fr10\n\t" - "fmov.s @%0+, fr11\n\t" - "fmov.s @%0+, fr12\n\t" - "fmov.s @%0+, fr13\n\t" - "fmov.s @%0+, fr14\n\t" - "fmov.s @%0+, fr15\n\t" - "frchg\n\t" - "fmov.s @%0+, fr0\n\t" - "fmov.s @%0+, fr1\n\t" - "fmov.s @%0+, fr2\n\t" - "fmov.s @%0+, fr3\n\t" - "fmov.s @%0+, fr4\n\t" - "fmov.s @%0+, fr5\n\t" - "fmov.s @%0+, fr6\n\t" - "fmov.s @%0+, fr7\n\t" - "fmov.s @%0+, fr8\n\t" - "fmov.s @%0+, fr9\n\t" - "fmov.s @%0+, fr10\n\t" - "fmov.s @%0+, fr11\n\t" - "fmov.s @%0+, fr12\n\t" - "fmov.s @%0+, fr13\n\t" - "fmov.s @%0+, fr14\n\t" - "fmov.s @%0+, fr15\n\t" - "frchg\n\t" - "lds.l @%0+, fpscr\n\t" - "lds.l @%0+, fpul\n\t" - :"=r" (dummy) - :"0"(&ts->fpu), "r"(FPSCR_RCHG) - :"memory"); -} - -static inline void xnarch_enable_fpu(struct xnthread *thread) -{ - struct xnarchtcb *tcb = xnthread_archtcb(thread); - struct task_struct *task = tcb->core.host_task; - - if (task != tcb->core.user_fpu_owner) - disable_fpu(); - else - enable_fpu(); -} - -void xnarch_save_fpu(struct xnthread *thread) -{ - struct xnarchtcb *tcb = xnthread_archtcb(thread); - struct pt_regs *regs; - - if (tcb->fpup) { - do_save_fpu(tcb->fpup); - if (tcb->core.user_fpu_owner) { - regs = task_pt_regs(tcb->core.user_fpu_owner); - regs->sr |= SR_FD; - } - } -} - -static void xnarch_restore_fpu(struct xnthread *thread) -{ - struct xnarchtcb *tcb = xnthread_archtcb(thread); - struct pt_regs *regs; - - if (tcb->fpup) { - do_restore_fpu(tcb->fpup); - /* - * Note: Only enable FPU in SR, if it was enabled when - * we saved the fpu state. - */ - if (tcb->core.user_fpu_owner) { - regs = task_pt_regs(tcb->core.user_fpu_owner); - regs->sr &= ~SR_FD; - } - } - - if (tcb->core.host_task != tcb->core.user_fpu_owner) - disable_fpu(); -} - -void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to) -{ - if (from == to || - xnarch_fpu_ptr(xnthread_archtcb(from)) == - xnarch_fpu_ptr(xnthread_archtcb(to))) { - xnarch_enable_fpu(to); - return; - } - - if (from) - xnarch_save_fpu(from); - - xnarch_restore_fpu(to); -} - -void xnarch_leave_root(struct xnthread *root) -{ - struct xnarchtcb *rootcb = xnthread_archtcb(root); - rootcb->core.user_fpu_owner = get_fpu_owner(rootcb->core.host_task); - rootcb->fpup = rootcb->core.user_fpu_owner ? - &rootcb->core.user_fpu_owner->thread : NULL; -} - -#endif /* CONFIG_XENO_ARCH_FPU */ - -int xnarch_escalate(void) -{ - if (ipipe_root_p) { - ipipe_raise_irq(cobalt_pipeline.escalate_virq); - return 1; - } - - return 0; -} - -void xnarch_init_shadow_tcb(struct xnthread *thread) -{ - struct xnarchtcb *tcb = xnthread_archtcb(thread); - tcb->fpup = &tcb->core.host_task->thread; -} diff --git a/kernel/cobalt/arch/sh/trampoline.S b/kernel/cobalt/arch/sh/trampoline.S deleted file mode 100644 index c7eccf3..0000000 --- a/kernel/cobalt/arch/sh/trampoline.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2011 Philippe Gerum <r...@xenomai.org> - * - * 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. - */ - - .align 2 - .globl __asm_thread_trampoline - .balign 32 -__asm_thread_trampoline: - mov.l @r15+, r10 - mov.l @r15+, r9 - mov.l @r15+, r4 - ldc r9, sr - mov.l 1f, r9 - jmp @r9 - ldc r10, gbr - .balign 4 -1: .long xnarch_thread_trampoline diff --git a/lib/cobalt/arch/Makefile.am b/lib/cobalt/arch/Makefile.am index 276414b..854e784 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 sh x86 +DIST_SUBDIRS = arm blackfin nios2 powerpc x86 diff --git a/lib/cobalt/arch/sh/Makefile.am b/lib/cobalt/arch/sh/Makefile.am deleted file mode 100644 index 0aa02d6..0000000 --- a/lib/cobalt/arch/sh/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/sh/features.c b/lib/cobalt/arch/sh/features.c deleted file mode 100644 index a46a307..0000000 --- a/lib/cobalt/arch/sh/features.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2011 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/stat.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/uapi/features.h> -#include <boilerplate/compiler.h> -#include "internal.h" - -struct xnarch_tsc_area; - -__weak volatile struct xnarch_tsc_area *__cobalt_sh_tsc = NULL; - -__weak volatile unsigned long *__cobalt_sh_tcnt = NULL; - -static volatile void *map_kmem(unsigned long pa, 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)); - - 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)); - - return (volatile void *)(p + (pa & (pagesz - 1))); -} - -void cobalt_chech_features(struct cobalt_featinfo *finfo) -{ - unsigned int pagesz = sysconf(_SC_PAGESIZE); - - __cobalt_sh_tsc = map_kmem(finfo->feat_arch.hrclock_membase, pagesz); - __cobalt_sh_tcnt = map_kmem(__cobalt_sh_tsc->counter_pa, pagesz); -} diff --git a/lib/cobalt/arch/sh/include/Makefile.am b/lib/cobalt/arch/sh/include/Makefile.am deleted file mode 100644 index 5cac5d2..0000000 --- a/lib/cobalt/arch/sh/include/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIRS = asm diff --git a/lib/cobalt/arch/sh/include/asm/Makefile.am b/lib/cobalt/arch/sh/include/asm/Makefile.am deleted file mode 100644 index 55ea661..0000000 --- a/lib/cobalt/arch/sh/include/asm/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIRS = xenomai diff --git a/lib/cobalt/arch/sh/include/asm/xenomai/Makefile.am b/lib/cobalt/arch/sh/include/asm/xenomai/Makefile.am deleted file mode 100644 index d308b06..0000000 --- a/lib/cobalt/arch/sh/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/sh/include/asm/xenomai/features.h b/lib/cobalt/arch/sh/include/asm/xenomai/features.h deleted file mode 100644 index 1a3f6e1..0000000 --- a/lib/cobalt/arch/sh/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_SH_FEATURES_H -#define _LIB_COBALT_SH_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_SH_FEATURES_H */ diff --git a/lib/cobalt/arch/sh/include/asm/xenomai/syscall.h b/lib/cobalt/arch/sh/include/asm/xenomai/syscall.h deleted file mode 100644 index 3c436ae..0000000 --- a/lib/cobalt/arch/sh/include/asm/xenomai/syscall.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_SYSCALL_H -#define _LIB_COBALT_SH_SYSCALL_H - -#include <cobalt/uapi/syscall.h> - -/* Some code pulled from glibc's inline syscalls. */ - -#define SYSCALL_INST_STR0 "trapa #0x10\n\t" -#define SYSCALL_INST_STR1 "trapa #0x11\n\t" -#define SYSCALL_INST_STR2 "trapa #0x12\n\t" -#define SYSCALL_INST_STR3 "trapa #0x13\n\t" -#define SYSCALL_INST_STR4 "trapa #0x14\n\t" -#define SYSCALL_INST_STR5 "trapa #0x15\n\t" -#define SYSCALL_INST_STR6 "trapa #0x16\n\t" - -/* - * Conservatively assume that a known SH-4 silicon bug bites us: 4 - * instruction cycles not accessing cache and TLB are needed after - * trapa instruction. - */ -#define SYSCALL_INST_PAD " \ - or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0" - -#define ASMFMT_0 -#define ASMFMT_1 \ - , "r" (r4) -#define ASMFMT_2 \ - , "r" (r4), "r" (r5) -#define ASMFMT_3 \ - , "r" (r4), "r" (r5), "r" (r6) -#define ASMFMT_4 \ - , "r" (r4), "r" (r5), "r" (r6), "r" (r7) -#define ASMFMT_5 \ - , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0) -#define ASMFMT_6 \ - , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1) -#define ASMFMT_7 \ - , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1), "r" (r2) - -#define SUBSTITUTE_ARGS_0() -#define SUBSTITUTE_ARGS_1(arg1) \ - long int _arg1 = (long int) (arg1); \ - register long int r4 asm ("%r4") = (long int) (_arg1) -#define SUBSTITUTE_ARGS_2(arg1, arg2) \ - long int _arg1 = (long int) (arg1); \ - long int _arg2 = (long int) (arg2); \ - register long int r4 asm ("%r4") = (long int) (_arg1); \ - register long int r5 asm ("%r5") = (long int) (_arg2) -#define SUBSTITUTE_ARGS_3(arg1, arg2, arg3) \ - long int _arg1 = (long int) (arg1); \ - long int _arg2 = (long int) (arg2); \ - long int _arg3 = (long int) (arg3); \ - register long int r4 asm ("%r4") = (long int) (_arg1); \ - register long int r5 asm ("%r5") = (long int) (_arg2); \ - register long int r6 asm ("%r6") = (long int) (_arg3) -#define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4) \ - long int _arg1 = (long int) (arg1); \ - long int _arg2 = (long int) (arg2); \ - long int _arg3 = (long int) (arg3); \ - long int _arg4 = (long int) (arg4); \ - register long int r4 asm ("%r4") = (long int) (_arg1); \ - register long int r5 asm ("%r5") = (long int) (_arg2); \ - register long int r6 asm ("%r6") = (long int) (_arg3); \ - register long int r7 asm ("%r7") = (long int) (_arg4) -#define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) \ - long int _arg1 = (long int) (arg1); \ - long int _arg2 = (long int) (arg2); \ - long int _arg3 = (long int) (arg3); \ - long int _arg4 = (long int) (arg4); \ - long int _arg5 = (long int) (arg5); \ - register long int r4 asm ("%r4") = (long int) (_arg1); \ - register long int r5 asm ("%r5") = (long int) (_arg2); \ - register long int r6 asm ("%r6") = (long int) (_arg3); \ - register long int r7 asm ("%r7") = (long int) (_arg4); \ - register long int r0 asm ("%r0") = (long int) (_arg5) - -#define XENOMAI_DO_SYSCALL(nr, op, args...) \ - ({ \ - unsigned long int __ret; \ - register long int r3 asm ("%r3") = __xn_syscode(op); \ - SUBSTITUTE_ARGS_##nr(args); \ - \ - asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ - : "=z" (__ret) \ - : "r" (r3) ASMFMT_##nr \ - : "memory", "t"); \ - \ - (int) __ret; \ - }) - -#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_SH_SYSCALL_H */ diff --git a/lib/cobalt/arch/sh/include/asm/xenomai/tsc.h b/lib/cobalt/arch/sh/include/asm/xenomai/tsc.h deleted file mode 100644 index 3e5d51d..0000000 --- a/lib/cobalt/arch/sh/include/asm/xenomai/tsc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2011 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_SH_TSC_H -#define _LIB_COBALT_SH_TSC_H - -#include <endian.h> - -struct xnarch_tsc_area { - struct { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned long high; - unsigned long low; -#else /* __LITTLE_ENDIAN */ - unsigned long low; - unsigned long high; -#endif /* __LITTLE_ENDIAN */ - } tsc; - unsigned long counter_pa; -}; - -extern volatile struct xnarch_tsc_area *__cobalt_sh_tsc; - -extern volatile unsigned long *__cobalt_sh_tcnt; - -static inline unsigned long long cobalt_read_tsc(void) -{ - unsigned long long tsc; - unsigned long low; - - tsc = __cobalt_sh_tsc->tsc.high; - low = *__cobalt_sh_tcnt ^ 0xffffffffUL; - if (low < __cobalt_sh_tsc->tsc.low) - tsc++; - tsc = (tsc << 32)|low; - - return tsc; -} - -#endif /* !_LIB_COBALT_SH_TSC_H */ _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git