#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.
/* Set clear to send, so flow control works... */
uart_writeb((1<<1), UART_BASE + UART_MCR);
-
/* Flush the input buffer. */
do {
/* rx buffer reg
/* 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;
}
struct console_driver serial_console __console_driver;
static void serial_console_init ( void ) {
- /* Serial driver initialization should already be done,
- * time to enable the serial console. */
- serial_console.disabled = 0;
+ /*
+ * 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 = {
extern void serial_putc ( int ch );
extern int serial_getc ( void );
extern int serial_ischar ( void );
+extern int serial_initialized;
#endif /* _IPXE_SERIAL_H */