summaryrefslogtreecommitdiff
path: root/src/lib/coreboot_table.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-03-15 01:32:55 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-04-09 11:19:27 +0200
commitbbf6f3d384caf25efdfeca0fc5eaac13319a6a43 (patch)
tree4f4ae6c11cfef319ef2a91b02d70cd2b64639a0d /src/lib/coreboot_table.c
parentc2610a4a186c6e5a05f6518c2c7a734fde8f6cfd (diff)
downloadcoreboot-bbf6f3d384caf25efdfeca0fc5eaac13319a6a43.tar.xz
console uart: Fill coreboot table entries
Also fixes the reported baudrate to take get_option() into account. Change-Id: Ieadad70b00df02a530b0ccb6fa4e1b51526089f3 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/5310 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/lib/coreboot_table.c')
-rw-r--r--src/lib/coreboot_table.c66
1 files changed, 18 insertions, 48 deletions
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 9bfe34fcf3..e4554d7b94 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -102,43 +102,22 @@ static struct lb_memory *lb_memory(struct lb_header *header)
return mem;
}
-static struct lb_serial *lb_serial(struct lb_header *header)
+void lb_add_serial(struct lb_serial *new_serial, void *data)
{
-#if CONFIG_CONSOLE_SERIAL8250
- struct lb_record *rec;
+ struct lb_header *header = (struct lb_header *)data;
struct lb_serial *serial;
- rec = lb_new_record(header);
- serial = (struct lb_serial *)rec;
+
+ serial = (struct lb_serial *)lb_new_record(header);
serial->tag = LB_TAG_SERIAL;
serial->size = sizeof(*serial);
- serial->type = LB_SERIAL_TYPE_IO_MAPPED;
- serial->baseaddr = CONFIG_TTYS0_BASE;
- serial->baud = CONFIG_TTYS0_BAUD;
- return serial;
-#elif CONFIG_CONSOLE_SERIAL8250MEM || CONFIG_CONSOLE_SERIAL_UART
- if (uartmem_getbaseaddr()) {
- struct lb_record *rec;
- struct lb_serial *serial;
- rec = lb_new_record(header);
- serial = (struct lb_serial *)rec;
- serial->tag = LB_TAG_SERIAL;
- serial->size = sizeof(*serial);
- serial->type = LB_SERIAL_TYPE_MEMORY_MAPPED;
- serial->baseaddr = uartmem_getbaseaddr();
- serial->baud = CONFIG_TTYS0_BAUD;
- return serial;
- } else {
- return NULL;
- }
-#else
- return NULL;
-#endif
+ serial->type = new_serial->type;
+ serial->baseaddr = new_serial->baseaddr;
+ serial->baud = new_serial->baud;
}
-#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM || \
- CONFIG_CONSOLE_SERIAL_UART || CONFIG_CONSOLE_USB
-static void add_console(struct lb_header *header, u16 consoletype)
+void lb_add_console(uint16_t consoletype, void *data)
{
+ struct lb_header *header = (struct lb_header *)data;
struct lb_console *console;
console = (struct lb_console *)lb_new_record(header);
@@ -146,20 +125,6 @@ static void add_console(struct lb_header *header, u16 consoletype)
console->size = sizeof(*console);
console->type = consoletype;
}
-#endif
-
-static void lb_console(struct lb_header *header)
-{
-#if CONFIG_CONSOLE_SERIAL8250
- add_console(header, LB_TAG_CONSOLE_SERIAL8250);
-#endif
-#if CONFIG_CONSOLE_SERIAL8250MEM || CONFIG_CONSOLE_SERIAL_UART
- add_console(header, LB_TAG_CONSOLE_SERIAL8250MEM);
-#endif
-#if CONFIG_CONSOLE_USB
- add_console(header, LB_TAG_CONSOLE_EHCI);
-#endif
-}
static void lb_framebuffer(struct lb_header *header)
{
@@ -423,10 +388,15 @@ unsigned long write_coreboot_table(
/* Record our motherboard */
lb_mainboard(head);
- /* Record the serial port, if present */
- lb_serial(head);
- /* Record our console setup */
- lb_console(head);
+
+ /* Record the serial ports and consoles */
+#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM || CONFIG_CONSOLE_SERIAL_UART
+ uart_fill_lb(head);
+#endif
+#if CONFIG_CONSOLE_USB
+ lb_add_console(LB_TAG_CONSOLE_EHCI, head);
+#endif
+
/* Record our various random string information */
lb_strings(head);
/* Record our framebuffer */