summaryrefslogtreecommitdiff
path: root/kern/log.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-07-13 20:07:07 +0200
committerRichard Braun <rbraun@sceen.net>2017-07-13 20:07:07 +0200
commitb2ad7d862388558556288877a65f2797528168f4 (patch)
tree4d3080abf0cbcca7c058cba5cad2ed71e5d5e1e5 /kern/log.c
parentcacd797c0c1825301f21aab18a7ce2c410d14535 (diff)
Switch to initialization operations
Diffstat (limited to 'kern/log.c')
-rw-r--r--kern/log.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/kern/log.c b/kern/log.c
index 96be152..0ddf679 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -24,6 +24,7 @@
#include <stdint.h>
#include <string.h>
+#include <kern/arg.h>
#include <kern/cbuf.h>
#include <kern/init.h>
#include <kern/log.h>
@@ -32,6 +33,8 @@
#include <kern/shell.h>
#include <kern/spinlock.h>
#include <kern/thread.h>
+#include <machine/boot.h>
+#include <machine/cpu.h>
#define LOG_BUFFER_SIZE 16384
@@ -396,18 +399,40 @@ static struct shell_cmd log_shell_cmds[] = {
" 7: debug"),
};
+static int __init
+log_setup_shell(void)
+{
+ SHELL_REGISTER_CMDS(log_shell_cmds);
+ return 0;
+}
+
+INIT_OP_DEFINE(log_setup_shell,
+ INIT_OP_DEP(log_setup, true),
+ INIT_OP_DEP(shell_setup, true));
+
#endif /* X15_SHELL */
-void __init
+static int __init
log_setup(void)
{
cbuf_init(&log_cbuf, log_buffer, sizeof(log_buffer));
log_index = cbuf_start(&log_cbuf);
spinlock_init(&log_lock);
log_print_level = LOG_INFO;
+
+ boot_log_info();
+ arg_log_info();
+ cpu_log_info(cpu_current());
+
+ return 0;
}
-void __init
+INIT_OP_DEFINE(log_setup,
+ INIT_OP_DEP(arg_setup, true),
+ INIT_OP_DEP(cpu_setup, true),
+ INIT_OP_DEP(spinlock_setup, true));
+
+static int __init
log_start(void)
{
struct thread_attr attr;
@@ -421,9 +446,14 @@ log_start(void)
panic("log: unable to create thread");
}
- SHELL_REGISTER_CMDS(log_shell_cmds);
+ return 0;
}
+INIT_OP_DEFINE(log_start,
+ INIT_OP_DEP(log_setup, true),
+ INIT_OP_DEP(panic_setup, true),
+ INIT_OP_DEP(thread_setup, true));
+
static void
log_write(const void *s, size_t size)
{