Commit ae04635a authored by Philippe Gerum's avatar Philippe Gerum

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.
parent df64db5d
......@@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-arm/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
......@@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-arm/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
/*
* Copyright (C) 2001,2002,2003,2004 Philippe Gerum <rpm@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 */
......@@ -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;
}
......
......@@ -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
......
......@@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-blackfin/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
......@@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-blackfin/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
/*
* Copyright (C) 2005 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 _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 */
......@@ -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;
}
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-nios2/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
......@@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-nios2/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.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 _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 */
......@@ -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;
}
......
......@@ -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
......
......@@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-powerpc/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
......@@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-powerpc/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
/*
* Copyright (C) 2001,2002,2003,2004 Philippe Gerum <rpm@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 */
......@@ -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;
}
......
......@@ -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)
......
......@@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-sh/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.h \
......
......@@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-sh/bits
includesub_HEADERS = \
bind.h \
heap.h \
init.h \
intr.h \
pod.h \
sched.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 _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 */
......@@ -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;
}
......
......@@ -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
......
......@@ -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 \
......
......@@ -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 \
......
#ifdef __i386__
#include "init_32.h"
#else
#include "init_64.h"
#endif
/*
* Copyright (C) 2001,2002,2003 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 _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 */
/*
* Copyright (C) 2007 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 _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;