svn commit: r261038 - in head/sys: conf kern sys

Warner Losh imp at FreeBSD.org
Wed Jan 22 21:20:09 UTC 2014


Author: imp
Date: Wed Jan 22 21:20:08 2014
New Revision: 261038
URL: http://svnweb.freebsd.org/changeset/base/261038

Log:
  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...

Modified:
  head/sys/conf/options
  head/sys/kern/subr_prf.c
  head/sys/sys/systm.h

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Wed Jan 22 19:57:11 2014	(r261037)
+++ head/sys/conf/options	Wed Jan 22 21:20:08 2014	(r261038)
@@ -62,6 +62,7 @@ KDB_TRACE	opt_kdb.h
 KDB_UNATTENDED	opt_kdb.h
 KLD_DEBUG	opt_kld.h
 SYSCTL_DEBUG	opt_sysctl.h
+EARLY_PRINTF	opt_global.h
 TEXTDUMP_PREFERRED	opt_ddb.h
 TEXTDUMP_VERBOSE	opt_ddb.h
 

Modified: head/sys/kern/subr_prf.c
==============================================================================
--- head/sys/kern/subr_prf.c	Wed Jan 22 19:57:11 2014	(r261037)
+++ head/sys/kern/subr_prf.c	Wed Jan 22 21:20:08 2014	(r261038)
@@ -1137,3 +1137,25 @@ hexdump(const void *ptr, int length, con
 	}
 }
 
+#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

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Wed Jan 22 19:57:11 2014	(r261037)
+++ head/sys/sys/systm.h	Wed Jan 22 21:20:08 2014	(r261038)
@@ -196,6 +196,10 @@ void	init_param1(void);
 void	init_param2(long physpages);
 void	init_static_kenv(char *, size_t);
 void	tablefull(const char *);
+#ifdef  EARLY_PRINTF
+void	eprintf(const char *, ...) __printflike(1, 2);
+void	eputc(int ch);
+#endif
 int	kvprintf(char const *, void (*)(int, void*), void *, int,
 	    __va_list) __printflike(1, 0);
 void	log(int, const char *, ...) __printflike(2, 3);


More information about the svn-src-all mailing list