summaryrefslogtreecommitdiff
path: root/kern/timer.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-20 22:57:21 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-20 22:57:21 +0100
commit326118bf300cf096cee04cb0a64789151ef8e273 (patch)
tree082660557b642253771c483b1d535e8d3f95eb75 /kern/timer.c
parentda8eb9c244d27fd042adde6234ccec079681d7f4 (diff)
Rework the initialization operations of some kernel modules
In order to avoid workarounds that check whether a module is ready or not, break the initialization of some core modules into a bootstrap step for basic BSP initialization, and a setup step that completes initialization. Most users only need the bootstrap operation as a dependency, especially since scheduling isn't enabled yet.
Diffstat (limited to 'kern/timer.c')
-rw-r--r--kern/timer.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/kern/timer.c b/kern/timer.c
index f61ab71f..cafe49f7 100644
--- a/kern/timer.c
+++ b/kern/timer.c
@@ -410,9 +410,20 @@ timer_bucket_filter(struct timer_bucket *bucket, uint64_t now,
}
static int __init
+timer_bootstrap(void)
+{
+ timer_cpu_data_init(cpu_local_ptr(timer_cpu_data), 0);
+ return 0;
+}
+
+INIT_OP_DEFINE(timer_bootstrap,
+ INIT_OP_DEP(cpu_setup, true),
+ INIT_OP_DEP(spinlock_setup, true));
+
+static int __init
timer_setup(void)
{
- for (unsigned int cpu = 0; cpu < cpu_count(); cpu++) {
+ for (unsigned int cpu = 1; cpu < cpu_count(); cpu++) {
timer_cpu_data_init(percpu_ptr(timer_cpu_data, cpu), cpu);
}
@@ -420,8 +431,8 @@ timer_setup(void)
}
INIT_OP_DEFINE(timer_setup,
- INIT_OP_DEP(boot_setup_intr, true),
- INIT_OP_DEP(cpu_mp_probe, true));
+ INIT_OP_DEP(cpu_mp_probe, true),
+ INIT_OP_DEP(spinlock_setup, true));
void
timer_init(struct timer *timer, timer_fn_t fn, int flags)