Message ID | 20240326-mips_debug_ll-v2-3-b64abc76f2a1@flygoat.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | MIPS: Unify low-level debugging functionalities | expand |
On 26/3/24 21:35, Jiaxun Yang wrote: > Output earlyprintk to low-level debug functions when it's > available. > > DEBUG_LL takes priority over platform earlyprintk because > people must know what are they doing when they are trying > to enable DEBUG_LL. > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > arch/mips/Kconfig.debug | 2 +- > arch/mips/kernel/early_printk.c | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index 892e31804982..6ef42edc7d67 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug @@ -2,7 +2,7 @@ config EARLY_PRINTK bool "Early printk" if EXPERT - depends on SYS_HAS_EARLY_PRINTK + depends on SYS_HAS_EARLY_PRINTK || DEBUG_LL default y help This option enables special console drivers which allow the kernel diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c index 4a1647ddfbd9..c3f3b0a930f0 100644 --- a/arch/mips/kernel/early_printk.c +++ b/arch/mips/kernel/early_printk.c @@ -14,6 +14,24 @@ #include <asm/setup.h> +#ifdef CONFIG_DEBUG_LL +extern void printascii(const char *); + +static void early_console_write(struct console *con, const char *s, unsigned n) +{ + char buf[128]; + + while (n) { + unsigned int l = min(n, sizeof(buf)-1); + + memcpy(buf, s, l); + buf[l] = 0; + s += l; + n -= l; + printascii(buf); + } +} +#else static void early_console_write(struct console *con, const char *s, unsigned n) { while (n-- && *s) { @@ -23,6 +41,7 @@ static void early_console_write(struct console *con, const char *s, unsigned n) s++; } } +#endif static struct console early_console_prom = { .name = "early",
Output earlyprintk to low-level debug functions when it's available. DEBUG_LL takes priority over platform earlyprintk because people must know what are they doing when they are trying to enable DEBUG_LL. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/Kconfig.debug | 2 +- arch/mips/kernel/early_printk.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-)