1 // SPDX-License-Identifier: GPL-2.0+
3 * udbg interface to hvc_console.c
5 * (C) Copyright David Gibson, IBM Corporation 2008.
8 #include <linux/console.h>
9 #include <linux/delay.h>
10 #include <linux/err.h>
11 #include <linux/init.h>
12 #include <linux/moduleparam.h>
13 #include <linux/types.h>
14 #include <linux/irq.h>
18 #include "hvc_console.h"
20 struct hvc_struct
*hvc_udbg_dev
;
22 static int hvc_udbg_put(uint32_t vtermno
, const char *buf
, int count
)
26 for (i
= 0; i
< count
&& udbg_putc
; i
++)
32 static int hvc_udbg_get(uint32_t vtermno
, char *buf
, int count
)
39 for (i
= 0; i
< count
; i
++) {
40 if ((c
= udbg_getc_poll()) == -1)
48 static const struct hv_ops hvc_udbg_ops
= {
49 .get_chars
= hvc_udbg_get
,
50 .put_chars
= hvc_udbg_put
,
53 static int __init
hvc_udbg_init(void)
55 struct hvc_struct
*hp
;
62 hp
= hvc_alloc(0, 0, &hvc_udbg_ops
, 16);
70 device_initcall(hvc_udbg_init
);
72 static int __init
hvc_udbg_console_init(void)
77 hvc_instantiate(0, 0, &hvc_udbg_ops
);
78 add_preferred_console("hvc", 0, NULL
);
82 console_initcall(hvc_udbg_console_init
);