2 * arch/h8300/kernel/early_printk.c
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 #include <linux/console.h>
11 #include <linux/tty.h>
12 #include <linux/init.h>
14 #include <linux/platform_device.h>
16 static void sim_write(struct console *co, const char *ptr,
19 register const int fd __asm__("er0") = 1; /* stdout */
20 register const char *_ptr __asm__("er1") = ptr;
21 register const unsigned _len __asm__("er2") = len;
23 __asm__(".byte 0x5e,0x00,0x00,0xc7\n\t" /* jsr @0xc7 (sys_write) */
24 : : "g"(fd), "g"(_ptr), "g"(_len));
27 static struct console sim_console = {
28 .name = "sim_console",
31 .flags = CON_PRINTBUFFER,
35 static char sim_console_buf[32];
37 static int sim_probe(struct platform_device *pdev)
42 if (!strstr(sim_console_buf, "keep"))
43 sim_console.flags |= CON_BOOT;
45 register_console(&sim_console);
49 static int sim_remove(struct platform_device *pdev)
54 static struct platform_driver sim_driver = {
63 early_platform_init_buffer("earlyprintk", &sim_driver,
64 sim_console_buf, ARRAY_SIZE(sim_console_buf));
66 static struct platform_device sim_console_device = {
71 static struct platform_device *devices[] __initdata = {
75 void __init sim_console_register(void)
77 early_platform_add_devices(devices,