mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 11:44:01 +08:00
d0380e6c3c
The early console implementations are the same all over the place. Move the print function to kernel/printk and get rid of the copies. [akpm@linux-foundation.org: arch/mips/kernel/early_printk.c needs kernel.h for va_list] [paul.gortmaker@windriver.com: sh4: make the bios early console support depend on EARLY_PRINTK] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Russell King <linux@arm.linux.org.uk> Acked-by: Mike Frysinger <vapier@gentoo.org> Cc: Michal Simek <monstr@monstr.eu> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Richard Weinberger <richard@nod.at> Reviewed-by: Ingo Molnar <mingo@kernel.org> Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
/*
|
|
* linux/arch/unicore32/kernel/early_printk.c
|
|
*
|
|
* Code specific to PKUnity SoC and UniCore ISA
|
|
*
|
|
* Copyright (C) 2001-2010 GUAN Xue-tao
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/console.h>
|
|
#include <linux/init.h>
|
|
#include <linux/string.h>
|
|
#include <mach/ocd.h>
|
|
|
|
/* On-Chip-Debugger functions */
|
|
|
|
static void early_ocd_write(struct console *con, const char *s, unsigned n)
|
|
{
|
|
while (*s && n-- > 0) {
|
|
if (*s == '\n')
|
|
ocd_putc((int)'\r');
|
|
ocd_putc((int)*s);
|
|
s++;
|
|
}
|
|
}
|
|
|
|
static struct console early_ocd_console = {
|
|
.name = "earlyocd",
|
|
.write = early_ocd_write,
|
|
.flags = CON_PRINTBUFFER,
|
|
.index = -1,
|
|
};
|
|
|
|
static int __init setup_early_printk(char *buf)
|
|
{
|
|
int keep_early;
|
|
|
|
if (!buf || early_console)
|
|
return 0;
|
|
|
|
if (strstr(buf, "keep"))
|
|
keep_early = 1;
|
|
|
|
early_console = &early_ocd_console;
|
|
|
|
if (keep_early)
|
|
early_console->flags &= ~CON_BOOT;
|
|
else
|
|
early_console->flags |= CON_BOOT;
|
|
register_console(early_console);
|
|
return 0;
|
|
}
|
|
early_param("earlyprintk", setup_early_printk);
|