Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *	DECstation PROM-based early console support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *	Copyright (C) 2004, 2007  Maciej W. Rozycki
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/console.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/dec/prom.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) static void __init prom_console_write(struct console *con, const char *s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 				      unsigned int c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	char buf[81];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	unsigned int chunk = sizeof(buf) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	while (c > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 		if (chunk > c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 			chunk = c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		memcpy(buf, s, chunk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		buf[chunk] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		prom_printf("%s", buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		s += chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		c -= chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static struct console promcons __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	.name	= "prom",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	.write	= prom_console_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	.flags	= CON_BOOT | CON_PRINTBUFFER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	.index	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void __init register_prom_console(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	register_console(&promcons);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }