Commit 94219283 authored by Philippe Gerum's avatar Philippe Gerum

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.
parent b9e809f9
......@@ -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 \
......
config XENO_ARCH_FPU
def_bool n
config XENO_ARCH_SYS3264
def_bool n
source "kernel/xenomai/Kconfig"
source "drivers/xenomai/Kconfig"
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
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperdrix@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 */
/**
* Copyright &copy; 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 */
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2014 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2009,2013 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperdrix@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 */
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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 */
/**
* 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,
};
/*
* Copyright (C) 2009 Philippe Gerum <rpm@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