Path: blob/master/arch/unicore32/kernel/early_printk.c
10817 views
/*1* linux/arch/unicore32/kernel/early_printk.c2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/11#include <linux/console.h>12#include <linux/init.h>13#include <linux/string.h>14#include <mach/ocd.h>1516/* On-Chip-Debugger functions */1718static void early_ocd_write(struct console *con, const char *s, unsigned n)19{20while (*s && n-- > 0) {21if (*s == '\n')22ocd_putc((int)'\r');23ocd_putc((int)*s);24s++;25}26}2728static struct console early_ocd_console = {29.name = "earlyocd",30.write = early_ocd_write,31.flags = CON_PRINTBUFFER,32.index = -1,33};3435/* Direct interface for emergencies */36static struct console *early_console = &early_ocd_console;3738static int __initdata keep_early;3940static int __init setup_early_printk(char *buf)41{42if (!buf)43return 0;4445if (strstr(buf, "keep"))46keep_early = 1;4748if (!strncmp(buf, "ocd", 3))49early_console = &early_ocd_console;5051if (keep_early)52early_console->flags &= ~CON_BOOT;53else54early_console->flags |= CON_BOOT;55register_console(early_console);56return 0;57}58early_param("earlyprintk", setup_early_printk);596061