summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/core/serial_console.c
blob: de9b84ca731940c9eb69aa986ce18d9869c59463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <ipxe/init.h>
#include <ipxe/serial.h>
#include <ipxe/console.h>
#include <config/console.h>

/** @file
 *
 * Serial console
 *
 */

/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_SERIAL ) && CONSOLE_EXPLICIT ( CONSOLE_SERIAL ) )
#undef CONSOLE_SERIAL
#define CONSOLE_SERIAL ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
#endif

struct console_driver serial_console __console_driver;

static void serial_console_init ( void ) {
	/*
	 * Check if serial driver initialization is done.
	 * If so, it's time to enable the serial console.
	 */
	if ( serial_initialized )
		serial_console.disabled = 0;
}

struct console_driver serial_console __console_driver = {
	.putchar = serial_putc,
	.getchar = serial_getc,
	.iskey = serial_ischar,
	.disabled = CONSOLE_DISABLED,
	.usage = CONSOLE_SERIAL,
};

/**
 * Serial console initialisation function
 */
struct init_fn serial_console_init_fn __init_fn ( INIT_CONSOLE ) = {
	.initialise = serial_console_init,
};