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
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /* console.c: Routines that deal with sending and receiving IO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *            to/from the current console device using the PROM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/openprom.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/oplib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static int __prom_console_write_buf(const char *buf, int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	unsigned long args[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	args[0] = (unsigned long) "write";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	args[1] = 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	args[2] = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	args[3] = (unsigned int) prom_stdout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	args[4] = (unsigned long) buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	args[5] = (unsigned int) len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	args[6] = (unsigned long) -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	p1275_cmd_direct(args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	ret = (int) args[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void prom_console_write_buf(const char *buf, int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	while (len) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		int n = __prom_console_write_buf(buf, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		if (n < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		len -= n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 		buf += len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) }