Commit b9e809f9 authored by Philippe Gerum's avatar Philippe Gerum

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.
parent 328b0447
......@@ -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 \
......
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"
obj-$(CONFIG_XENOMAI) += xenomai.o
xenomai-y := machine.o mayday.o thread.o trampoline.o
ccflags-y := -Iarch/sh/xenomai/include -Iinclude/xenomai
/*
* Copyright (C) 2011 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_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 */
/*
* Copyright (C) 2011 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_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 */
/*
* 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_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 */
/**
* Copyright &copy; 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 */
/*
* Copyright (C) 2011 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_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 */
/*
* 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_SH_ASM_SYSCALL32_H
#define _COBALT_SH_ASM_SYSCALL32_H
#include <asm-generic/xenomai/syscall32.h>
#endif /* !_COBALT_SH_ASM_SYSCALL32_H */
/*
* Copyright (C) 2011,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_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 */
/*
* Copyright (C) 2011 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_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 */
/*
* Copyright (C) 2011 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_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 */
/*
* 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_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 */
/*
* Copyright (C) 2011 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_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 */
/*
* Copyright (C) 2011 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_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 */
/**
* 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,
};
/*
* Copyright (C) 2011 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 <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
*/