Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Wrap-around code for a console using the
0004  * ARC io-routines.
0005  *
0006  * Copyright (c) 1998 Harald Koerfgen
0007  * Copyright (c) 2001 Ralf Baechle
0008  * Copyright (c) 2002 Thiemo Seufer
0009  */
0010 #include <linux/tty.h>
0011 #include <linux/major.h>
0012 #include <linux/init.h>
0013 #include <linux/console.h>
0014 #include <linux/fs.h>
0015 #include <asm/setup.h>
0016 #include <asm/sgialib.h>
0017 
0018 static void prom_console_write(struct console *co, const char *s,
0019                    unsigned count)
0020 {
0021     /* Do each character */
0022     while (count--) {
0023         if (*s == '\n')
0024             prom_putchar('\r');
0025         prom_putchar(*s++);
0026     }
0027 }
0028 
0029 static int prom_console_setup(struct console *co, char *options)
0030 {
0031     if (prom_flags & PROM_FLAG_USE_AS_CONSOLE)
0032         return 0;
0033     return -ENODEV;
0034 }
0035 
0036 static struct console arc_cons = {
0037     .name       = "arc",
0038     .write      = prom_console_write,
0039     .setup      = prom_console_setup,
0040     .flags      = CON_PRINTBUFFER,
0041     .index      = -1,
0042 };
0043 
0044 /*
0045  *    Register console.
0046  */
0047 
0048 static int __init arc_console_init(void)
0049 {
0050     register_console(&arc_cons);
0051 
0052     return 0;
0053 }
0054 console_initcall(arc_console_init);