aboutsummaryrefslogtreecommitdiffstats
path: root/roms/ipxe/src/core/serial_console.c
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2019-04-29 01:17:54 +0100
committerfishsoupisgood <github@madingley.org>2019-05-27 03:43:43 +0100
commit3f2546b2ef55b661fd8dd69682b38992225e86f6 (patch)
tree65ca85f13617aee1dce474596800950f266a456c /roms/ipxe/src/core/serial_console.c
downloadqemu-master.tar.gz
qemu-master.tar.bz2
qemu-master.zip
Initial import of qemu-2.4.1HEADmaster
Diffstat (limited to 'roms/ipxe/src/core/serial_console.c')
-rw-r--r--roms/ipxe/src/core/serial_console.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/roms/ipxe/src/core/serial_console.c b/roms/ipxe/src/core/serial_console.c
new file mode 100644
index 00000000..de9b84ca
--- /dev/null
+++ b/roms/ipxe/src/core/serial_console.c
@@ -0,0 +1,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,
+};