aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_prf.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2014-01-22 21:20:08 +0000
committerWarner Losh <imp@FreeBSD.org>2014-01-22 21:20:08 +0000
commit26fbe13c562e0afcab736bf9c462f31f5079d49a (patch)
tree1db8f822f9a50cd3ac1ede7ee1bf35e14aa0bed6 /sys/kern/subr_prf.c
parentde78d5d8fdfc5d310165c9a486cc8d5cb6249959 (diff)
downloadsrc-26fbe13c562e0afcab736bf9c462f31f5079d49a.tar.gz
src-26fbe13c562e0afcab736bf9c462f31f5079d49a.zip
Implement generic support for early printf. Thought I can't find the
paper trail now, this patch is similar to one posted for one of the preliminary versions of a new armv6 port. I took them and made them more generic. Option not enabled by default since each board/port has to provide its own eputc, and possibly do other things as well...
Notes
Notes: svn path=/head/; revision=261038
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r--sys/kern/subr_prf.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 93d8ed372f31..dac940c16382 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1137,3 +1137,25 @@ hexdump(const void *ptr, int length, const char *hdr, int flags)
}
}
+#ifdef EARLY_PRINTF
+/*
+ * Support for calling an alternate printf early in boot (like before
+ * cn_init() can be called). Platforms need to define eputc that want
+ * to use this.
+ */
+static void
+early_putc_func(int ch, void *arg __unused)
+{
+ eputc(ch);
+}
+
+void
+eprintf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ kvprintf(fmt, early_putc_func, NULL, 10, ap);
+ va_end(ap);
+}
+#endif