summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/kern/kern_timeout.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-18 14:12:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-31 13:18:48 +0100
commitffcd542fe20b072cdb2b38ff36a62a2c62a4c6f2 (patch)
tree0aee7287e94f453d852441da5c0abe5797bf8b44 /freebsd/sys/kern/kern_timeout.c
parentMove shell items to separate file (diff)
downloadrtems-libbsd-ffcd542fe20b072cdb2b38ff36a62a2c62a4c6f2.tar.bz2
Move TIMEOUT(9) and ZONE(9) initialization
Delete most of virtual memory support.
Diffstat (limited to 'freebsd/sys/kern/kern_timeout.c')
-rw-r--r--freebsd/sys/kern/kern_timeout.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/freebsd/sys/kern/kern_timeout.c b/freebsd/sys/kern/kern_timeout.c
index 67924d08..1d5dbadf 100644
--- a/freebsd/sys/kern/kern_timeout.c
+++ b/freebsd/sys/kern/kern_timeout.c
@@ -157,10 +157,27 @@ MALLOC_DEFINE(M_CALLOUT, "callout", "Callout datastructures");
* This code is called very early in the kernel initialization sequence,
* and may be called more then once.
*/
+#ifdef __rtems__
+static void rtems_bsd_timeout_init(void *);
+
+static void callout_cpu_init(struct callout_cpu *);
+
+SYSINIT(rtems_bsd_timeout, SI_SUB_VM, SI_ORDER_FIRST, rtems_bsd_timeout_init,
+ NULL);
+
+static void
+rtems_bsd_timeout_init(void *unused)
+#else /* __rtems__ */
caddr_t
kern_timeout_callwheel_alloc(caddr_t v)
+#endif /* __rtems__ */
{
struct callout_cpu *cc;
+#ifdef __rtems__
+ caddr_t v;
+
+ (void) unused;
+#endif /* __rtems__ */
timeout_cpu = PCPU_GET(cpuid);
cc = CC_CPU(timeout_cpu);
@@ -173,11 +190,19 @@ kern_timeout_callwheel_alloc(caddr_t v)
;
callwheelmask = callwheelsize - 1;
+#ifdef __rtems__
+ v = malloc(ncallout * sizeof(*cc->cc_callout) + callwheelsize
+ * sizeof(*cc->cc_callwheel), M_CALLOUT, M_ZERO | M_WAITOK);
+#endif /* __rtems__ */
cc->cc_callout = (struct callout *)v;
v = (caddr_t)(cc->cc_callout + ncallout);
cc->cc_callwheel = (struct callout_tailq *)v;
v = (caddr_t)(cc->cc_callwheel + callwheelsize);
+#ifndef __rtems__
return(v);
+#else /* __rtems__ */
+ callout_cpu_init(cc);
+#endif /* __rtems__ */
}
static void
@@ -201,6 +226,7 @@ callout_cpu_init(struct callout_cpu *cc)
}
}
+#ifndef __rtems__
/*
* kern_timeout_callwheel_init() - initialize previously reserved callwheel
* space.
@@ -213,6 +239,7 @@ kern_timeout_callwheel_init(void)
{
callout_cpu_init(CC_CPU(timeout_cpu));
}
+#endif /* __rtems__ */
/*
* Start standard softclock thread.