summaryrefslogtreecommitdiffstats
path: root/src/core/serial.c
diff options
context:
space:
mode:
authorShao Miller2012-10-05 16:14:12 +0200
committerMichael Brown2012-10-05 16:18:57 +0200
commita712dae709adc76c76646fa1c86d2cfb5c3edfbc (patch)
tree246fe611b372b7ec0b86acba5b0354e88b6a6ab3 /src/core/serial.c
parent[int13] Do not zero %edx when jumping to a boot sector (diff)
downloadipxe-a712dae709adc76c76646fa1c86d2cfb5c3edfbc.tar.gz
ipxe-a712dae709adc76c76646fa1c86d2cfb5c3edfbc.tar.xz
ipxe-a712dae709adc76c76646fa1c86d2cfb5c3edfbc.zip
[serial] Don't enable serial console without serial support
serial_console_init() would enable serial console support without knowing if the serial driver succeeded or not. As a result, the serial console would interfere with a normal keyboard on a system lacking serial support. Reported-by: Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> Signed-off-by: Shao Miller <sha0.miller@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/serial.c')
-rw-r--r--src/core/serial.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/serial.c b/src/core/serial.c
index a5551b13..8f5a159c 100644
--- a/src/core/serial.c
+++ b/src/core/serial.c
@@ -93,6 +93,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define uart_writeb(val,addr) outb((val),(addr))
#endif
+/* Boolean for the state of serial driver initialization */
+int serial_initialized = 0;
+
/*
* void serial_putc(int ch);
* Write character `ch' to port UART_BASE.
@@ -207,7 +210,6 @@ static void serial_init ( void ) {
/* Set clear to send, so flow control works... */
uart_writeb((1<<1), UART_BASE + UART_MCR);
-
/* Flush the input buffer. */
do {
/* rx buffer reg
@@ -217,6 +219,9 @@ static void serial_init ( void ) {
/* line status reg */
status = uart_readb(UART_BASE + UART_LSR);
} while(status & UART_LSR_DR);
+
+ /* Note that serial support has been initialized */
+ serial_initialized = 1;
out:
return;
}