root/arch/unicore32/kernel/early_printk.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. early_ocd_write
  2. setup_early_printk

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  * linux/arch/unicore32/kernel/early_printk.c
   4  *
   5  * Code specific to PKUnity SoC and UniCore ISA
   6  *
   7  * Copyright (C) 2001-2010 GUAN Xue-tao
   8  */
   9 #include <linux/console.h>
  10 #include <linux/init.h>
  11 #include <linux/string.h>
  12 #include <mach/ocd.h>
  13 
  14 /* On-Chip-Debugger functions */
  15 
  16 static void early_ocd_write(struct console *con, const char *s, unsigned n)
  17 {
  18         while (*s && n-- > 0) {
  19                 if (*s == '\n')
  20                         ocd_putc((int)'\r');
  21                 ocd_putc((int)*s);
  22                 s++;
  23         }
  24 }
  25 
  26 static struct console early_ocd_console = {
  27         .name =         "earlyocd",
  28         .write =        early_ocd_write,
  29         .flags =        CON_PRINTBUFFER,
  30         .index =        -1,
  31 };
  32 
  33 static int __init setup_early_printk(char *buf)
  34 {
  35         if (!buf || early_console)
  36                 return 0;
  37 
  38         early_console = &early_ocd_console;
  39         if (strstr(buf, "keep"))
  40                 early_console->flags &= ~CON_BOOT;
  41         else
  42                 early_console->flags |= CON_BOOT;
  43         register_console(early_console);
  44         return 0;
  45 }
  46 early_param("earlyprintk", setup_early_printk);

/* [<][>][^][v][top][bottom][index][help] */