mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PATCH 3/8] MIPS: debug: Hook up DEBUG_LL with early printk
Date: Sun, 29 Oct 2023 02:53:04 +0000	[thread overview]
Message-ID: <20231029-mips_debug_ll-v1-3-d7a491e8c278@flygoat.com> (raw)
In-Reply-To: <20231029-mips_debug_ll-v1-0-d7a491e8c278@flygoat.com>

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(-)

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",

-- 
2.34.1


  parent reply	other threads:[~2023-10-29 13:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29  2:53 [PATCH 0/8] MIPS: Unify low-level debugging functionalities Jiaxun Yang
2023-10-29  2:53 ` [PATCH 1/8] MIPS: asm: Move strings to .rodata.str section Jiaxun Yang
2023-10-29  2:53 ` [PATCH 2/8] MIPS: debug: Implement low-level debugging functions Jiaxun Yang
2023-10-29  2:53 ` Jiaxun Yang [this message]
2023-10-29  2:53 ` [PATCH 4/8] MIPS: debug: Provide an early exception vector for low-level debugging Jiaxun Yang
2023-10-29  2:53 ` [PATCH 5/8] MIPS: debug_ll: Add Kconfig symbols for some 8250 uarts Jiaxun Yang
2023-10-29  2:53 ` [PATCH 6/8] MIPS: debug_ll: Implement support for Alchemy uarts Jiaxun Yang
2023-10-29  2:53 ` [PATCH 7/8] MIPS: debug_ll: Implement support for AR933X uarts Jiaxun Yang
2023-10-29  2:53 ` [PATCH 8/8] MIPS: zboot: Convert to use debug_ll facilities Jiaxun Yang
2023-12-01 11:58 ` [PATCH 0/8] MIPS: Unify low-level debugging functionalities Jiaxun Yang
2023-12-20 21:18 ` Thomas Bogendoerfer
2023-12-21  1:40   ` Jiaxun Yang
2023-12-21  2:21   ` Jiaxun Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231029-mips_debug_ll-v1-3-d7a491e8c278@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®