summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_cons.c
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-02-12 00:53:38 +0000
committerian <ian@FreeBSD.org>2014-02-12 00:53:38 +0000
commit4ca4e5e36919a8b45fe0de86bf7f016d9b250caa (patch)
treed3f726070c72e06a4205b4833757683bb49c7245 /sys/kern/kern_cons.c
parent92116454f40b3ac6061263ee04a9cc8ba95842f1 (diff)
downloadFreeBSD-src-4ca4e5e36919a8b45fe0de86bf7f016d9b250caa.zip
FreeBSD-src-4ca4e5e36919a8b45fe0de86bf7f016d9b250caa.tar.gz
Rework the EARLY_PRINTF mechanism. Instead of defining a special eprintf()
routine, now a platform can provide a pointer to an early_putc() routine which is used instead of cn_putc(). Control can be handed off from early printf support to standard console support by NULLing out the pointer during standard console init. This leverages all the existing error reporting that uses printf calls, such as panic() which can now be usefully employed even in early platform init code (useful at least to those who maintain that code and build kernels with EARLY_PRINTF defined). Reviewed by: imp, eadler
Diffstat (limited to 'sys/kern/kern_cons.c')
-rw-r--r--sys/kern/kern_cons.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index 72b384f..ad2ba20 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -464,6 +464,15 @@ cnputc(int c)
struct consdev *cn;
char *cp;
+#ifdef EARLY_PRINTF
+ if (early_putc != NULL) {
+ if (c == '\n')
+ early_putc('\r');
+ early_putc(c);
+ return;
+ }
+#endif
+
if (cn_mute || c == '\0')
return;
STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
OpenPOWER on IntegriCloud