Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  DECstation PROM-based early console support.
0004  *
0005  *  Copyright (C) 2004, 2007  Maciej W. Rozycki
0006  */
0007 #include <linux/console.h>
0008 #include <linux/init.h>
0009 #include <linux/kernel.h>
0010 #include <linux/string.h>
0011 
0012 #include <asm/dec/prom.h>
0013 
0014 static void __init prom_console_write(struct console *con, const char *s,
0015                       unsigned int c)
0016 {
0017     char buf[81];
0018     unsigned int chunk = sizeof(buf) - 1;
0019 
0020     while (c > 0) {
0021         if (chunk > c)
0022             chunk = c;
0023         memcpy(buf, s, chunk);
0024         buf[chunk] = '\0';
0025         prom_printf("%s", buf);
0026         s += chunk;
0027         c -= chunk;
0028     }
0029 }
0030 
0031 static struct console promcons __initdata = {
0032     .name   = "prom",
0033     .write  = prom_console_write,
0034     .flags  = CON_BOOT | CON_PRINTBUFFER,
0035     .index  = -1,
0036 };
0037 
0038 void __init register_prom_console(void)
0039 {
0040     register_console(&promcons);
0041 }