Module: xenomai-forge Branch: master Commit: 577123b3e671416003cc0c3e0523bd52f253b1e0 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=577123b3e671416003cc0c3e0523bd52f253b1e0
Author: Philippe Gerum <r...@xenomai.org> Date: Sun Jan 1 16:37:27 2012 +0100 hal, nucleus: refactor nucleus init code We don't need the bits/init.h indirection for the arch-dep init code anymore. The relevant bits are dispatched to the HAL layer, or directly inlined into the nucleus entry routine. --- config/version | 2 +- include/asm-arm/bits/Makefile.am | 1 - include/asm-arm/bits/Makefile.in | 1 - include/asm-arm/bits/init.h | 71 -------------------------------- include/asm-arm/bits/pod.h | 6 +-- include/asm-arm/calibration.h | 4 -- include/asm-blackfin/bits/Makefile.am | 1 - include/asm-blackfin/bits/Makefile.in | 1 - include/asm-blackfin/bits/init.h | 73 --------------------------------- include/asm-blackfin/bits/pod.h | 6 +-- include/asm-blackfin/calibration.h | 4 -- include/asm-generic/hal.h | 1 + include/asm-nios2/bits/Makefile.am | 1 - include/asm-nios2/bits/Makefile.in | 1 - include/asm-nios2/bits/init.h | 68 ------------------------------ include/asm-nios2/bits/pod.h | 4 +- include/asm-nios2/calibration.h | 4 -- include/asm-powerpc/bits/Makefile.am | 1 - include/asm-powerpc/bits/Makefile.in | 1 - include/asm-powerpc/bits/init.h | 71 -------------------------------- include/asm-powerpc/bits/pod.h | 6 +-- include/asm-powerpc/calibration.h | 6 --- include/asm-sh/bits/Makefile.am | 1 - include/asm-sh/bits/Makefile.in | 1 - include/asm-sh/bits/init.h | 68 ------------------------------ include/asm-sh/bits/pod.h | 6 +-- include/asm-sh/calibration.h | 4 -- include/asm-x86/bits/Makefile.am | 3 - include/asm-x86/bits/Makefile.in | 3 - include/asm-x86/bits/init.h | 5 -- include/asm-x86/bits/init_32.h | 69 ------------------------------- include/asm-x86/bits/init_64.h | 69 ------------------------------- include/asm-x86/bits/pod.h | 33 +++++++++++++++ include/asm-x86/bits/pod_32.h | 12 ----- include/asm-x86/bits/pod_64.h | 12 ----- include/asm-x86/calibration.h | 4 -- include/cobalt/nucleus/version.h | 4 +- kernel/cobalt/arch/blackfin/hal.c | 6 +++ kernel/cobalt/arch/generic/hal.c | 43 ++++++++----------- kernel/cobalt/nucleus/module.c | 73 ++++++++++++--------------------- 40 files changed, 96 insertions(+), 654 deletions(-) diff --git a/config/version b/config/version index e70b452..47d8253 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -2.6.0 +2.99.0 diff --git a/include/asm-arm/bits/Makefile.am b/include/asm-arm/bits/Makefile.am index f373dc4..1a56ee0 100644 --- a/include/asm-arm/bits/Makefile.am +++ b/include/asm-arm/bits/Makefile.am @@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-arm/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-arm/bits/Makefile.in b/include/asm-arm/bits/Makefile.in index 0402e52..dd96a9d 100644 --- a/include/asm-arm/bits/Makefile.in +++ b/include/asm-arm/bits/Makefile.in @@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-arm/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-arm/bits/init.h b/include/asm-arm/bits/init.h deleted file mode 100644 index 453d1cb..0000000 --- a/include/asm-arm/bits/init.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <r...@xenomai.org>. - * - * ARM port - * Copyright (C) 2005 Stelian Pop - * - * 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 _XENO_ASM_ARM_BITS_INIT_H -#define _XENO_ASM_ARM_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -static inline int xnarch_init(void) -{ - int ret; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_ARM_BITS_INIT_H */ diff --git a/include/asm-arm/bits/pod.h b/include/asm-arm/bits/pod.h index 4123ee7..7412586 100644 --- a/include/asm-arm/bits/pod.h +++ b/include/asm-arm/bits/pod.h @@ -239,10 +239,8 @@ static inline void xnarch_restore_fpu(xnarchtcb_t * tcb) static inline int xnarch_escalate(void) { - extern int xnarch_escalation_virq; - - if (ipipe_current_domain == ipipe_root_domain) { - ipipe_raise_irq(xnarch_escalation_virq); + if (ipipe_root_p) { + ipipe_raise_irq(rthal_archdata.escalate_virq); return 1; } diff --git a/include/asm-arm/calibration.h b/include/asm-arm/calibration.h index 38e687e..6385146 100644 --- a/include/asm-arm/calibration.h +++ b/include/asm-arm/calibration.h @@ -23,10 +23,6 @@ #ifndef _XENO_ASM_ARM_CALIBRATION_H #define _XENO_ASM_ARM_CALIBRATION_H -#ifndef _XENO_ASM_ARM_BITS_INIT_H -#error "please don't include asm/calibration.h directly" -#endif - static inline unsigned long xnarch_get_sched_latency (void) { #if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0 diff --git a/include/asm-blackfin/bits/Makefile.am b/include/asm-blackfin/bits/Makefile.am index 46d5249..7fd7f9d 100644 --- a/include/asm-blackfin/bits/Makefile.am +++ b/include/asm-blackfin/bits/Makefile.am @@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-blackfin/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-blackfin/bits/Makefile.in b/include/asm-blackfin/bits/Makefile.in index 362bfdf..3aca3f0 100644 --- a/include/asm-blackfin/bits/Makefile.in +++ b/include/asm-blackfin/bits/Makefile.in @@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-blackfin/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-blackfin/bits/init.h b/include/asm-blackfin/bits/init.h deleted file mode 100644 index 101abc2..0000000 --- a/include/asm-blackfin/bits/init.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005 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 _XENO_ASM_BLACKFIN_BITS_INIT_H -#define _XENO_ASM_BLACKFIN_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -void xnpod_schedule_deferred(void); - -static inline int xnarch_init(void) -{ - int ret; - - __ipipe_irq_tail_hook = (unsigned long)xnpod_schedule_deferred; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - __ipipe_irq_tail_hook = 0; - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_BLACKFIN_BITS_INIT_H */ diff --git a/include/asm-blackfin/bits/pod.h b/include/asm-blackfin/bits/pod.h index 734ec4c..dc9e687 100644 --- a/include/asm-blackfin/bits/pod.h +++ b/include/asm-blackfin/bits/pod.h @@ -167,8 +167,6 @@ static inline void xnarch_restore_fpu(xnarchtcb_t * tcb) static inline int xnarch_escalate(void) { - extern int xnarch_escalation_virq; - /* The following Blackfin-specific check is likely the most * braindamage stuff we need to do for this arch, i.e. deferring * Xenomai's rescheduling procedure whenever: @@ -198,8 +196,8 @@ static inline int xnarch_escalate(void) return 1; } - if (ipipe_current_domain == ipipe_root_domain) { - ipipe_raise_irq(xnarch_escalation_virq); + if (ipipe_root_p) { + ipipe_raise_irq(rthal_archdata.escalate_virq); __ipipe_unlock_root(); return 1; } diff --git a/include/asm-blackfin/calibration.h b/include/asm-blackfin/calibration.h index 789016a..7c9548f 100644 --- a/include/asm-blackfin/calibration.h +++ b/include/asm-blackfin/calibration.h @@ -20,10 +20,6 @@ #ifndef _XENO_ASM_BLACKFIN_CALIBRATION_H #define _XENO_ASM_BLACKFIN_CALIBRATION_H -#ifndef _XENO_ASM_BLACKFIN_BITS_INIT_H -#error "please don't include asm/calibration.h directly" -#endif - static inline unsigned long xnarch_get_sched_latency (void) { diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h index 4adcb68..4e7d6f6 100644 --- a/include/asm-generic/hal.h +++ b/include/asm-generic/hal.h @@ -49,6 +49,7 @@ struct rthal_archdata { unsigned int apc_virq; unsigned long apc_map; unsigned long apc_pending[NR_CPUS]; + unsigned int escalate_virq; struct { void (*handler)(void *cookie); void *cookie; diff --git a/include/asm-nios2/bits/Makefile.am b/include/asm-nios2/bits/Makefile.am index e53056e..d8ef2b6 100644 --- a/include/asm-nios2/bits/Makefile.am +++ b/include/asm-nios2/bits/Makefile.am @@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-nios2/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-nios2/bits/Makefile.in b/include/asm-nios2/bits/Makefile.in index 0569738..df6c8fa 100644 --- a/include/asm-nios2/bits/Makefile.in +++ b/include/asm-nios2/bits/Makefile.in @@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-nios2/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-nios2/bits/init.h b/include/asm-nios2/bits/init.h deleted file mode 100644 index 3971416..0000000 --- a/include/asm-nios2/bits/init.h +++ /dev/null @@ -1,68 +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 _XENO_ASM_NIOS2_BITS_INIT_H -#define _XENO_ASM_NIOS2_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -static inline int xnarch_init(void) -{ - int ret; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_NIOS2_BITS_INIT_H */ diff --git a/include/asm-nios2/bits/pod.h b/include/asm-nios2/bits/pod.h index 24de2ea..66d0d79 100644 --- a/include/asm-nios2/bits/pod.h +++ b/include/asm-nios2/bits/pod.h @@ -147,8 +147,8 @@ static inline void xnarch_restore_fpu(struct xnarchtcb *tcb) static inline int xnarch_escalate(void) { - if (unlikely(ipipe_current_domain == ipipe_root_domain)) { - ipipe_raise_irq(xnarch_escalation_virq); + if (ipipe_root_p) { + ipipe_raise_irq(rthal_archdata.escalate_virq); return 1; } diff --git a/include/asm-nios2/calibration.h b/include/asm-nios2/calibration.h index 4251c01..435df31 100644 --- a/include/asm-nios2/calibration.h +++ b/include/asm-nios2/calibration.h @@ -20,10 +20,6 @@ #ifndef _XENO_ASM_NIOS2_CALIBRATION_H #define _XENO_ASM_NIOS2_CALIBRATION_H -#ifndef _XENO_ASM_NIOS2_BITS_INIT_H -#error "please don't include asm/calibration.h directly" -#endif - static inline unsigned long xnarch_get_sched_latency (void) { #if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0 diff --git a/include/asm-powerpc/bits/Makefile.am b/include/asm-powerpc/bits/Makefile.am index bb524d6..19043e0 100644 --- a/include/asm-powerpc/bits/Makefile.am +++ b/include/asm-powerpc/bits/Makefile.am @@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-powerpc/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-powerpc/bits/Makefile.in b/include/asm-powerpc/bits/Makefile.in index 07cbf6d..9e5ef49 100644 --- a/include/asm-powerpc/bits/Makefile.in +++ b/include/asm-powerpc/bits/Makefile.in @@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-powerpc/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-powerpc/bits/init.h b/include/asm-powerpc/bits/init.h deleted file mode 100644 index 7bf602b..0000000 --- a/include/asm-powerpc/bits/init.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <r...@xenomai.org>. - * - * 64-bit PowerPC adoption - * copyright (C) 2005 Taneli Vähäkangas and Heikki Lindholm - * - * 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 _XENO_ASM_POWERPC_BITS_INIT_H -#define _XENO_ASM_POWERPC_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -static inline int xnarch_init(void) -{ - int ret; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_POWERPC_BITS_INIT_H */ diff --git a/include/asm-powerpc/bits/pod.h b/include/asm-powerpc/bits/pod.h index 5758c65..14fdf31 100644 --- a/include/asm-powerpc/bits/pod.h +++ b/include/asm-powerpc/bits/pod.h @@ -240,10 +240,8 @@ static void xnarch_restore_fpu(xnarchtcb_t * tcb) static inline int xnarch_escalate(void) { - extern int xnarch_escalation_virq; - - if (ipipe_current_domain == ipipe_root_domain) { - ipipe_raise_irq(xnarch_escalation_virq); + if (ipipe_root_p) { + ipipe_raise_irq(rthal_archdata.escalate_virq); return 1; } diff --git a/include/asm-powerpc/calibration.h b/include/asm-powerpc/calibration.h index 14019ce..9fbfe7a 100644 --- a/include/asm-powerpc/calibration.h +++ b/include/asm-powerpc/calibration.h @@ -23,17 +23,11 @@ #ifndef _XENO_ASM_POWERPC_CALIBRATION_H #define _XENO_ASM_POWERPC_CALIBRATION_H -#ifndef _XENO_ASM_POWERPC_BITS_INIT_H -#error "please don't include asm/calibration.h directly" -#endif - static inline unsigned long xnarch_get_sched_latency(void) { #if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0 #define __sched_latency CONFIG_XENO_OPT_TIMING_SCHEDLAT #else - - #if defined(CONFIG_PPC_PASEMI) #define __sched_latency 1000 #elif defined(CONFIG_WALNUT) diff --git a/include/asm-sh/bits/Makefile.am b/include/asm-sh/bits/Makefile.am index b73a9f7..5cf154c 100644 --- a/include/asm-sh/bits/Makefile.am +++ b/include/asm-sh/bits/Makefile.am @@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-sh/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-sh/bits/Makefile.in b/include/asm-sh/bits/Makefile.in index 1a3d904..e531db2 100644 --- a/include/asm-sh/bits/Makefile.in +++ b/include/asm-sh/bits/Makefile.in @@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-sh/bits includesub_HEADERS = \ bind.h \ heap.h \ - init.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-sh/bits/init.h b/include/asm-sh/bits/init.h deleted file mode 100644 index c8d3db4..0000000 --- a/include/asm-sh/bits/init.h +++ /dev/null @@ -1,68 +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 _XENO_ASM_SH_BITS_INIT_H -#define _XENO_ASM_SH_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -static inline int xnarch_init(void) -{ - int ret; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_SH_BITS_INIT_H */ diff --git a/include/asm-sh/bits/pod.h b/include/asm-sh/bits/pod.h index 09ab9fd..69b467d 100644 --- a/include/asm-sh/bits/pod.h +++ b/include/asm-sh/bits/pod.h @@ -186,10 +186,8 @@ static void xnarch_restore_fpu(xnarchtcb_t * tcb) static inline int xnarch_escalate(void) { - extern int xnarch_escalation_virq; - - if (ipipe_current_domain == ipipe_root_domain) { - ipipe_raise_irq(xnarch_escalation_virq); + if (ipipe_root_p) { + ipipe_raise_irq(rthal_archdata.escalate_virq); return 1; } diff --git a/include/asm-sh/calibration.h b/include/asm-sh/calibration.h index 4818e1a..d863cb3 100644 --- a/include/asm-sh/calibration.h +++ b/include/asm-sh/calibration.h @@ -20,10 +20,6 @@ #ifndef _XENO_ASM_SH_CALIBRATION_H #define _XENO_ASM_SH_CALIBRATION_H -#ifndef _XENO_ASM_SH_BITS_INIT_H -#error "please don't include asm/calibration.h directly" -#endif - static inline unsigned long xnarch_get_sched_latency (void) { #if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0 diff --git a/include/asm-x86/bits/Makefile.am b/include/asm-x86/bits/Makefile.am index 695a44d..79fae9b 100644 --- a/include/asm-x86/bits/Makefile.am +++ b/include/asm-x86/bits/Makefile.am @@ -3,9 +3,6 @@ includesubdir = $(includedir)/asm-x86/bits includesub_HEADERS = \ bind.h \ heap.h \ - init_32.h \ - init_64.h \ - init.h \ intr.h \ pod_32.h \ pod_64.h \ diff --git a/include/asm-x86/bits/Makefile.in b/include/asm-x86/bits/Makefile.in index 2c5fe93..23dc849 100644 --- a/include/asm-x86/bits/Makefile.in +++ b/include/asm-x86/bits/Makefile.in @@ -244,9 +244,6 @@ includesubdir = $(includedir)/asm-x86/bits includesub_HEADERS = \ bind.h \ heap.h \ - init_32.h \ - init_64.h \ - init.h \ intr.h \ pod_32.h \ pod_64.h \ diff --git a/include/asm-x86/bits/init.h b/include/asm-x86/bits/init.h deleted file mode 100644 index fdd1e06..0000000 --- a/include/asm-x86/bits/init.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef __i386__ -#include "init_32.h" -#else -#include "init_64.h" -#endif diff --git a/include/asm-x86/bits/init_32.h b/include/asm-x86/bits/init_32.h deleted file mode 100644 index c010b6f..0000000 --- a/include/asm-x86/bits/init_32.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003 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 _XENO_ASM_X86_BITS_INIT_32_H -#define _XENO_ASM_X86_BITS_INIT_32_H -#define _XENO_ASM_X86_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -static inline int xnarch_init(void) -{ - int ret; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_X86_BITS_INIT_32_H */ diff --git a/include/asm-x86/bits/init_64.h b/include/asm-x86/bits/init_64.h deleted file mode 100644 index a744ffb..0000000 --- a/include/asm-x86/bits/init_64.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2007 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 _XENO_ASM_X86_BITS_INIT_64_H -#define _XENO_ASM_X86_BITS_INIT_64_H -#define _XENO_ASM_X86_BITS_INIT_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -#include <linux/init.h> -#include <asm/xenomai/calibration.h> -#include <asm-generic/xenomai/bits/timeconv.h> - -int xnarch_escalation_virq; - -void xnpod_schedule_handler(void); - -static inline int xnarch_init(void) -{ - int ret; - - ret = rthal_init(); - if (ret) - return ret; - - xnarch_init_timeconv(RTHAL_CLOCK_FREQ); - - nktimerlat = rthal_timer_calibrate(); - if (nktimerlat == 0) - return -ENODEV; - - nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; - - xnarch_escalation_virq = ipipe_alloc_virq(); - if (xnarch_escalation_virq == 0) - return -ENOSYS; - - ipipe_request_irq(&rthal_archdata.domain, - xnarch_escalation_virq, - (ipipe_irq_handler_t)xnpod_schedule_handler, - NULL, NULL); - return 0; -} - -static inline void xnarch_exit(void) -{ - ipipe_free_virq(xnarch_escalation_virq); - rthal_exit(); -} - -#endif /* !_XENO_ASM_X86_BITS_INIT_64_H */ diff --git a/include/asm-x86/bits/pod.h b/include/asm-x86/bits/pod.h index 8a7dba4..c96e803 100644 --- a/include/asm-x86/bits/pod.h +++ b/include/asm-x86/bits/pod.h @@ -1,5 +1,38 @@ +/* + * Copyright (C) 2012 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 _XENO_ASM_X86_BITS_POD_H +#define _XENO_ASM_X86_BITS_POD_H + #ifdef __i386__ #include "pod_32.h" #else #include "pod_64.h" #endif + +static inline int xnarch_escalate(void) +{ + if (ipipe_root_p) { + ipipe_raise_irq(rthal_archdata.escalate_virq); + return 1; + } + + return 0; +} + +#endif /* !_XENO_ASM_X86_BITS_POD_H */ diff --git a/include/asm-x86/bits/pod_32.h b/include/asm-x86/bits/pod_32.h index ad0413c..e3f221a 100644 --- a/include/asm-x86/bits/pod_32.h +++ b/include/asm-x86/bits/pod_32.h @@ -282,16 +282,4 @@ static inline void xnarch_enable_fpu(xnarchtcb_t * tcb) #endif /* CONFIG_XENO_HW_FPU */ -static inline int xnarch_escalate(void) -{ - extern int xnarch_escalation_virq; - - if (ipipe_current_domain == ipipe_root_domain) { - ipipe_raise_irq(xnarch_escalation_virq); - return 1; - } - - return 0; -} - #endif /* !_XENO_ASM_X86_BITS_POD_32_H */ diff --git a/include/asm-x86/bits/pod_64.h b/include/asm-x86/bits/pod_64.h index 8af09e3..101a2a9 100644 --- a/include/asm-x86/bits/pod_64.h +++ b/include/asm-x86/bits/pod_64.h @@ -320,16 +320,4 @@ static inline void xnarch_enable_fpu(xnarchtcb_t *tcb) #endif /* CONFIG_XENO_HW_FPU */ -static inline int xnarch_escalate(void) -{ - extern int xnarch_escalation_virq; - - if (ipipe_current_domain == ipipe_root_domain) { - ipipe_raise_irq(xnarch_escalation_virq); - return 1; - } - - return 0; -} - #endif /* !_XENO_ASM_X86_BITS_POD_64_H */ diff --git a/include/asm-x86/calibration.h b/include/asm-x86/calibration.h index 7cd5ac9..864669a 100644 --- a/include/asm-x86/calibration.h +++ b/include/asm-x86/calibration.h @@ -20,10 +20,6 @@ #ifndef _XENO_ASM_X86_CALIBRATION_H #define _XENO_ASM_X86_CALIBRATION_H -#ifndef _XENO_ASM_X86_BITS_INIT_H -#error "please don't include asm/calibration.h directly" -#endif - #include <asm/processor.h> static inline unsigned long xnarch_get_sched_latency (void) diff --git a/include/cobalt/nucleus/version.h b/include/cobalt/nucleus/version.h index c79bb60..6303b17 100644 --- a/include/cobalt/nucleus/version.h +++ b/include/cobalt/nucleus/version.h @@ -26,8 +26,6 @@ CONFIG_XENO_VERSION_MINOR, \ CONFIG_XENO_REVISION_LEVEL) -#define XENO_VERSION_NAME "Movin' On" - -#define XENO_VERSION_STRING "2.6.0" +#define XENO_VERSION_STRING "2.99.0" #endif /* _XENO_NUCLEUS_VERSION_H */ diff --git a/kernel/cobalt/arch/blackfin/hal.c b/kernel/cobalt/arch/blackfin/hal.c index 8291778..fb42b42 100644 --- a/kernel/cobalt/arch/blackfin/hal.c +++ b/kernel/cobalt/arch/blackfin/hal.c @@ -200,8 +200,12 @@ unsigned long rthal_timer_calibrate(void) return 20; /* 20 clock cycles */ } +void xnpod_schedule_deferred(void); + int rthal_arch_init(void) { + __ipipe_irq_tail_hook = (unsigned long)xnpod_schedule_deferred; + if (rthal_clockfreq_arg == 0) rthal_clockfreq_arg = rthal_get_clockfreq(); @@ -215,6 +219,8 @@ int rthal_arch_init(void) void rthal_arch_cleanup(void) { + __ipipe_irq_tail_hook = 0; + smp_mb(); printk(KERN_INFO "Xenomai: hal/blackfin stopped.\n"); } diff --git a/kernel/cobalt/arch/generic/hal.c b/kernel/cobalt/arch/generic/hal.c index 16559dd..3b216ff 100644 --- a/kernel/cobalt/arch/generic/hal.c +++ b/kernel/cobalt/arch/generic/hal.c @@ -237,6 +237,8 @@ void rthal_apc_free(int apc) } EXPORT_SYMBOL_GPL(rthal_apc_free); +void xnpod_schedule_handler(void); + int rthal_init(void) { int ret; @@ -267,45 +269,36 @@ int rthal_init(void) rthal_archdata.timer_freq = rthal_timerfreq_arg; rthal_archdata.clock_freq = rthal_clockfreq_arg; - /* - * Allocate a virtual interrupt to handle apcs within the - * Linux domain. - */ + ipipe_register_head(&rthal_archdata.domain, "Xenomai"); + rthal_archdata.apc_virq = ipipe_alloc_virq(); - if (rthal_archdata.apc_virq == 0) { - printk(KERN_ERR "Xenomai: no virtual interrupt available.\n"); - ret = -EBUSY; - goto out_arch_cleanup; - } + BUG_ON(rthal_archdata.apc_virq == 0); + rthal_archdata.escalate_virq = ipipe_alloc_virq(); + BUG_ON(rthal_archdata.escalate_virq == 0); - ret = ipipe_request_irq(ipipe_current_domain, + ret = ipipe_request_irq(ipipe_root_domain, rthal_archdata.apc_virq, &rthal_apc_handler, NULL, NULL); - if (ret) { - printk(KERN_ERR "Xenomai: failed to request IRQ.\n"); - goto out_free_irq; - } + BUG_ON(ret); - ipipe_register_head(&rthal_archdata.domain, "Xenomai"); - - printk(KERN_INFO "Xenomai: hal/%s enabled.\n", RTHAL_ARCH_NAME); + ret = ipipe_request_irq(&rthal_archdata.domain, + rthal_archdata.escalate_virq, + (ipipe_irq_handler_t)xnpod_schedule_handler, + NULL, NULL); + BUG_ON(ret); return 0; -out_free_irq: - ipipe_free_virq(rthal_archdata.apc_virq); -out_arch_cleanup: - rthal_arch_cleanup(); - - return ret; } EXPORT_SYMBOL_GPL(rthal_init); void rthal_exit(void) { - ipipe_free_irq(ipipe_current_domain, rthal_archdata.apc_virq); - ipipe_free_virq(rthal_archdata.apc_virq); ipipe_unregister_head(&rthal_archdata.domain); + ipipe_free_irq(ipipe_root_domain, rthal_archdata.apc_virq); + ipipe_free_virq(rthal_archdata.apc_virq); + ipipe_free_irq(&rthal_archdata.domain, rthal_archdata.escalate_virq); + ipipe_free_virq(rthal_archdata.escalate_virq); rthal_arch_cleanup(); } EXPORT_SYMBOL_GPL(rthal_exit); diff --git a/kernel/cobalt/nucleus/module.c b/kernel/cobalt/nucleus/module.c index f1b99dc..4584782 100644 --- a/kernel/cobalt/nucleus/module.c +++ b/kernel/cobalt/nucleus/module.c @@ -15,14 +15,12 @@ * along with Xenomai; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. - */ - -/*! + * * \defgroup nucleus Xenomai nucleus. * * An abstract RTOS core. */ - +#include <linux/init.h> #include <nucleus/module.h> #include <nucleus/pod.h> #include <nucleus/timer.h> @@ -34,8 +32,9 @@ #include <nucleus/pipe.h> #endif /* CONFIG_XENO_OPT_PIPE */ #include <nucleus/select.h> -#include <asm/xenomai/bits/init.h> #include <nucleus/vdso.h> +#include <asm/xenomai/calibration.h> +#include <asm-generic/xenomai/bits/timeconv.h> MODULE_DESCRIPTION("Xenomai nucleus"); MODULE_AUTHOR("r...@xenomai.org"); @@ -83,16 +82,26 @@ void xnmod_alloc_glinks(xnqueue_t *freehq) } EXPORT_SYMBOL_GPL(xnmod_alloc_glinks); -int __init __xeno_sys_init(void) +#ifdef CONFIG_XENO_OPT_DEBUG +#define boot_notice " [DEBUG]" +#else +#define boot_notice "" +#endif + +int __init xenomai_init(void) { int ret; xnmod_sysheap_size = module_param_value(sysheap_size_arg) * 1024; - ret = xnarch_init(); + ret = rthal_init(); if (ret) goto fail; + xnarch_init_timeconv(RTHAL_CLOCK_FREQ); + nktimerlat = rthal_timer_calibrate(); + nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat; + ret = xnheap_init_mapped(&__xnsys_global_ppd.sem_heap, CONFIG_XENO_OPT_GLOBAL_SEM_HEAPSZ * 1024, XNARCH_SHARED_HEAP_FLAGS); @@ -124,12 +133,8 @@ int __init __xeno_sys_init(void) if (ret) goto cleanup_shadow; - xnloginfo("real-time nucleus v%s (%s) loaded.\n", - XENO_VERSION_STRING, XENO_VERSION_NAME); - -#ifdef CONFIG_XENO_OPT_DEBUG - xnloginfo("debug mode enabled.\n"); -#endif + xnloginfo("Xenomai/cobalt v%s enabled%s\n", + XENO_VERSION_STRING, boot_notice); initq(&xnmod_glink_queue); @@ -139,30 +144,26 @@ int __init __xeno_sys_init(void) return 0; - cleanup_shadow: - +cleanup_shadow: xnshadow_cleanup(); - cleanup_select: - +cleanup_select: xnselect_umount(); - cleanup_pipe: +cleanup_pipe: #ifdef CONFIG_XENO_OPT_PIPE xnpipe_umount(); - cleanup_proc: +cleanup_proc: #endif /* CONFIG_XENO_OPT_PIPE */ xnpod_umount(); - cleanup_arch: - - xnarch_exit(); - - fail: +cleanup_arch: + rthal_exit(); +fail: xnlogerr("system init failed, code %d.\n", ret); @@ -170,26 +171,4 @@ int __init __xeno_sys_init(void) return ret; } - -void __exit __xeno_sys_exit(void) -{ - xnpod_shutdown(XNPOD_NORMAL_EXIT); - - /* Must take place before xnpod_umount(). */ - xnshadow_cleanup(); - - xnpod_umount(); - - xnarch_exit(); - - xnheap_umount(); -#ifdef CONFIG_XENO_OPT_PIPE - xnpipe_umount(); -#endif - xnheap_destroy_mapped(&__xnsys_global_ppd.sem_heap, NULL, NULL); - - xnloginfo("real-time nucleus unloaded.\n"); -} - -module_init(__xeno_sys_init); -module_exit(__xeno_sys_exit); +__initcall(xenomai_init); _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git