summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2017-09-19 15:46:51 -0400
committerNicolas Pitre <nicolas.pitre@linaro.org>2017-09-19 17:29:34 -0400
commit6f07ebb84ad80c8c8a9aecd9cc9b8f1bf5db7566 (patch)
treebe01716b400d3803f0400d9231fc1b1aec8a066a
parent598cd1731c81236c157cc0282690de637d21dfcf (diff)
downloadlinux-debug_ll.tar.gz
ARM: early_printk: use printascii() rather than printch()debug_ll
With printch() the console messages are sent out one character at a time which is agonizingly slow especially with semihosting as the whole trap intercept, remote byte access, and system resume danse is performed for every single character across a relatively slow remote debug connection. Let's use printascii() to send a whole string at once. This is also going to be more efficient, albeit to a quite lesser extent, with serial ports as well. Signed-off-by: Nicolas Pitre <nico@linaro.org>
-rw-r--r--arch/arm/kernel/early_printk.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
index 4307653..9257736 100644
--- a/arch/arm/kernel/early_printk.c
+++ b/arch/arm/kernel/early_printk.c
@@ -11,16 +11,20 @@
#include <linux/kernel.h>
#include <linux/console.h>
#include <linux/init.h>
+#include <linux/string.h>
-extern void printch(int);
+extern void printascii(const char *);
static void early_write(const char *s, unsigned n)
{
- while (n-- > 0) {
- if (*s == '\n')
- printch('\r');
- printch(*s);
- s++;
+ char buf[128];
+ while (n) {
+ unsigned l = min(n, sizeof(buf)-1);
+ memcpy(buf, s, l);
+ buf[l] = 0;
+ s += l;
+ n -= l;
+ printascii(buf);
}
}