summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/serial.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2008-10-21 15:08:18 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2008-10-21 15:08:18 +0000
commit657a6dc390871721711c2becc8501d05095891e5 (patch)
tree145b4de959fa8b76f5585ea85b1c5960e76d37c9 /payloads/libpayload/drivers/serial.c
parent97f56a4b7e36a49f8d7d24dcf741df1c181f13cb (diff)
This patch removes most of the #ifdefs in libc/console.c, and
replaces it with two queues (input, output) where drivers (serial, keyboard, video, usb) can attach. The only things left with #ifdefs are initialization (at some point the drivers must get a chance to register) Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Jordan Crouse <jordan.crouse@amd.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3679 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/drivers/serial.c')
-rw-r--r--payloads/libpayload/drivers/serial.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/serial.c b/payloads/libpayload/drivers/serial.c
index 95f5b4855e..7a6590cb16 100644
--- a/payloads/libpayload/drivers/serial.c
+++ b/payloads/libpayload/drivers/serial.c
@@ -58,15 +58,27 @@ void serial_hardware_init(int port, int speed, int word_bits, int parity, int st
outb(reg &= ~0x80, port + 0x03);
}
+static struct console_input_driver consin = {
+ .havekey = serial_havechar,
+ .getchar = serial_getchar
+};
+
+static struct console_output_driver consout = {
+ .putchar = serial_putchar
+};
+
void serial_init(void)
{
#ifdef CONFIG_SERIAL_SET_SPEED
serial_hardware_init(IOBASE, CONFIG_SERIAL_BAUD_RATE, 8, 0, 1);
#endif
+ console_add_input_driver(&consin);
+ console_add_output_driver(&consout);
}
-void serial_putchar(unsigned char c)
+void serial_putchar(unsigned int c)
{
+ c &= 0xff;
while ((inb(IOBASE + 0x05) & 0x20) == 0) ;
outb(c, IOBASE);
}