OSDN Git Service

rx: Switch EARLYCON
authorYoshinori Sato <ysato@users.sourceforge.jp>
Sat, 26 Dec 2015 13:38:32 +0000 (22:38 +0900)
committerYoshinori Sato <yo-satoh@sios.com>
Fri, 28 Jan 2022 12:35:34 +0000 (21:35 +0900)
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
arch/rx/kernel/early-printk.c [deleted file]
arch/rx/kernel/sim-console.c [new file with mode: 0644]

diff --git a/arch/rx/kernel/early-printk.c b/arch/rx/kernel/early-printk.c
deleted file mode 100644 (file)
index bdc39d0..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * arch/rx/kernel/early-printk.c
- *
- *  Copyright (C) 2009 Yoshinori Sato <ysato@users.sourceforge.jp>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/console.h>
-#include <linux/tty.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-
-#if defined(CONFIG_RX_GDB_SIM)
-static void gdb_write(struct console *co, const char *ptr,
-                                unsigned len)
-{
-       register const int fd __asm__("r1") = 1; /* stdout */
-       register const char *_ptr __asm__("r2") = ptr;
-       register const unsigned _len __asm__("r3") = len;
-       register const unsigned syscall __asm__("r5") = 5; /* sys_write */
-       __asm__("int #255"
-               ::"g"(fd),"g"(_ptr),"g"(_len),"g"(syscall));
-}
-
-static struct console gdb_console = {
-       .name           = "gdb_console",
-       .write          = gdb_write,
-       .setup          = NULL,
-       .flags          = CON_PRINTBUFFER,
-       .index          = -1,
-};
-#endif
-
-static int __init setup_early_printk(char *buf)
-{
-       if (!buf)
-               return 0;
-
-#if defined(CONFIG_RX_GDB_SIM)
-       if (!strncmp(buf, "gdb", 3))
-               early_console = &gdb_console;
-#endif
-#if defined(CONFIG_EARLY_SCI_CONSOLE)
-       if (!strncmp(buf, "serial", 6)) {
-               early_console = &sci_console;
-               sci_early_init(buf + 6);
-       }
-#endif
-       if (!early_console)
-               return 0;
-
-       if (strstr(buf, "keep"))
-               early_console->flags &= ~CON_BOOT;
-       else
-               early_console->flags |= CON_BOOT;
-       register_console(early_console);
-
-       return 0;
-}
-early_param("earlyprintk", setup_early_printk);
diff --git a/arch/rx/kernel/sim-console.c b/arch/rx/kernel/sim-console.c
new file mode 100644 (file)
index 0000000..e773d5b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * arch/rx/kernel/sim-console.c
+ *
+ *  Copyright (C) 2015 Yoshinori Sato <ysato@users.sourceforge.jp>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/console.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+
+static void gdb_write(struct console *co, const char *ptr,
+                                unsigned len)
+{
+       register const int fd __asm__("r1") = 1; /* stdout */
+       register const char *_ptr __asm__("r2") = ptr;
+       register const unsigned _len __asm__("r3") = len;
+       register const unsigned syscall __asm__("r5") = 5; /* sys_write */
+       __asm__("int #255"
+               ::"g"(fd),"g"(_ptr),"g"(_len),"g"(syscall));
+}
+
+static int __init sim_setup(struct earlycon_device *device, const char *opt)
+{
+       device->con->write = gdb_write;
+       return 0;
+}
+
+EARLYCON_DECLARE(rxsim, sim_setup);