aboutsummaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-01-06 00:03:23 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-01-10 14:17:43 +1100
commit6e1eb06aadd6a59caa75c4ceeec99f07918d57ce (patch)
tree063afaadd654cecbbecedb1c6b7483165306d520 /platforms
parentd57264232a6e2087a0506a4beca24ade14b53d55 (diff)
downloadskiboot-6e1eb06aadd6a59caa75c4ceeec99f07918d57ce.zip
skiboot-6e1eb06aadd6a59caa75c4ceeec99f07918d57ce.tar.gz
skiboot-6e1eb06aadd6a59caa75c4ceeec99f07918d57ce.tar.bz2
mambo: add mprintf()
mprintf() is printf(), but it goes straight to the mambo console. This allows it to be independent of Skiboot's actual console infrastructure so it can be used for debugging the console drivers and for debugging code that runs before the console is setup. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/mambo/console.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/platforms/mambo/console.c b/platforms/mambo/console.c
index c7d7ab0..d02cde9 100644
--- a/platforms/mambo/console.c
+++ b/platforms/mambo/console.c
@@ -66,3 +66,22 @@ void enable_mambo_console(void)
prlog(PR_NOTICE, "Enabling Mambo console\n");
set_console(&mambo_con_driver);
}
+
+/*
+ * mambo console based printf(), this is useful for debugging the console
+ * since mambo_console_write() can be safely called from anywhere.
+ *
+ * This is a debug hack and you shouldn't use it in real code.
+ */
+void mprintf(const char *fmt, ...)
+{
+ char buf[320];
+ va_list args;
+ int i;
+
+ va_start(args, fmt);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
+ va_end(args);
+
+ mambo_console_write(buf, i);
+}