Linux Audio

Check our new training course

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