]> git.ipfire.org Git - thirdparty/kernel/linux.git/blame - arch/sparc/prom/console_64.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[thirdparty/kernel/linux.git] / arch / sparc / prom / console_64.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
d979f179 2/* console.c: Routines that deal with sending and receiving IO
1da177e4
LT
3 * to/from the current console device using the PROM.
4 *
d979f179 5 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
1da177e4
LT
6 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */
8
9#include <linux/types.h>
10#include <linux/kernel.h>
11#include <linux/sched.h>
12#include <asm/openprom.h>
13#include <asm/oplib.h>
1da177e4
LT
14#include <linux/string.h>
15
595a251c 16static int __prom_console_write_buf(const char *buf, int len)
1da177e4 17{
25edd694 18 unsigned long args[7];
595a251c 19 int ret;
25edd694
DM
20
21 args[0] = (unsigned long) "write";
22 args[1] = 3;
23 args[2] = 1;
24 args[3] = (unsigned int) prom_stdout;
e62cac1f 25 args[4] = (unsigned long) buf;
595a251c 26 args[5] = (unsigned int) len;
25edd694
DM
27 args[6] = (unsigned long) -1;
28
29 p1275_cmd_direct(args);
30
595a251c
DM
31 ret = (int) args[6];
32 if (ret < 0)
1da177e4 33 return -1;
595a251c 34 return ret;
1da177e4
LT
35}
36
595a251c 37void prom_console_write_buf(const char *buf, int len)
1da177e4 38{
595a251c
DM
39 while (len) {
40 int n = __prom_console_write_buf(buf, len);
41 if (n < 0)
42 continue;
43 len -= n;
44 buf += len;
e62cac1f 45 }
1da177e4 46}