If the memory mapped UART isn't present, leave it out of the cb tables.
authorGabe Black <gabeblack@google.com>
Wed, 5 Oct 2011 08:57:03 +0000 (01:57 -0700)
committerPatrick Georgi <patrick@georgi-clan.de>
Sat, 10 Mar 2012 07:58:19 +0000 (08:58 +0100)
This way u-boot won't try to use a UART that isn't plugged in.

Change-Id: I9a3a0d074dd03add8afbd4dad836c4c6a05abe6f
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/729
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
src/arch/x86/boot/coreboot_table.c

index b0dcc9e65aa57d109328f5e12d17ec1642422c5c..b6e7e77962716a864003b82c8a35075df89acd9c 100644 (file)
@@ -117,16 +117,20 @@ static struct lb_serial *lb_serial(struct lb_header *header)
        serial->baud = CONFIG_TTYS0_BAUD;
        return serial;
 #elif CONFIG_CONSOLE_SERIAL8250MEM
-       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;
+       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