Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / sparc64 / console.c
1 /*
2  * Copyright (C) 2003, 2004 Stefan Reinauer
3  *
4  * See the file "COPYING" for further information about
5  * the copyright and warranty status of this work.
6  */
7
8 #include "config.h"
9 #include "libopenbios/bindings.h"
10 #include "libopenbios/console.h"
11 #include "kernel/kernel.h"
12 #include "drivers/drivers.h"
13 #include "libopenbios/fontdata.h"
14 #include "openbios.h"
15 #include "libc/vsprintf.h"
16 #include "libopenbios/sys_info.h"
17 #include "boot.h"
18
19 /* ******************************************************************
20  *          simple polling video/keyboard console functions
21  * ****************************************************************** */
22
23 #ifdef CONFIG_DEBUG_CONSOLE
24 /* ******************************************************************
25  *      common functions, implementing simple concurrent console
26  * ****************************************************************** */
27
28 static int arch_putchar(int c)
29 {
30 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
31         uart_putchar(c);
32 #endif
33         return c;
34 }
35
36 static int arch_availchar(void)
37 {
38 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
39         if (uart_charav(CONFIG_SERIAL_PORT))
40                 return 1;
41 #endif
42 #ifdef CONFIG_DEBUG_CONSOLE_VGA
43         if (pc_kbd_dataready())
44                 return 1;
45 #endif
46         return 0;
47 }
48
49 static int arch_getchar(void)
50 {
51 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
52         if (uart_charav(CONFIG_SERIAL_PORT))
53                 return (uart_getchar(CONFIG_SERIAL_PORT));
54 #endif
55 #ifdef CONFIG_DEBUG_CONSOLE_VGA
56         if (pc_kbd_dataready())
57                 return (pc_kbd_readdata());
58 #endif
59         return 0;
60 }
61
62 struct _console_ops arch_console_ops = {
63         .putchar = arch_putchar,
64         .availchar = arch_availchar,
65         .getchar = arch_getchar
66 };
67
68 #endif // CONFIG_DEBUG_CONSOLE