summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/allwinner/a10/uart_console.c23
-rw-r--r--src/cpu/samsung/exynos5250/uart.c21
-rw-r--r--src/cpu/samsung/exynos5420/uart.c21
-rw-r--r--src/cpu/ti/am335x/uart.c21
-rw-r--r--src/drivers/oxford/oxpcie/oxpcie_early.c12
-rw-r--r--src/drivers/uart/pl011.c21
-rw-r--r--src/drivers/uart/uart8250io.c22
-rw-r--r--src/include/boot/coreboot_tables.h4
-rw-r--r--src/include/console/uart.h1
-rw-r--r--src/lib/coreboot_table.c66
10 files changed, 127 insertions, 85 deletions
diff --git a/src/cpu/allwinner/a10/uart_console.c b/src/cpu/allwinner/a10/uart_console.c
index aea1189e66..d6b91e763a 100644
--- a/src/cpu/allwinner/a10/uart_console.c
+++ b/src/cpu/allwinner/a10/uart_console.c
@@ -10,6 +10,7 @@
#include <types.h>
#include <console/uart.h>
#include <arch/io.h>
+#include <boot/coreboot_tables.h>
#include <cpu/allwinner/a10/uart.h>
@@ -43,6 +44,11 @@ unsigned int uart_platform_refclk(void)
return 24000000;
}
+unsigned int uart_platform_base(int idx)
+{
+ return (unsigned int)get_console_uart_base_addr();
+}
+
void uart_init(void)
{
void *uart_base = get_console_uart_base_addr();
@@ -63,14 +69,19 @@ void uart_tx_byte(unsigned char data)
a10_uart_tx_blocking(get_console_uart_base_addr(), data);
}
-#if !defined(__PRE_RAM__)
-uint32_t uartmem_getbaseaddr(void)
+void uart_tx_flush(void)
{
- return (uint32_t) get_console_uart_base_addr();
}
-#endif
-void uart_tx_flush(void)
+#ifndef __PRE_RAM__
+void uart_fill_lb(void *data)
{
-}
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+}
+#endif
diff --git a/src/cpu/samsung/exynos5250/uart.c b/src/cpu/samsung/exynos5250/uart.c
index 860d020a92..1dabc093eb 100644
--- a/src/cpu/samsung/exynos5250/uart.c
+++ b/src/cpu/samsung/exynos5250/uart.c
@@ -19,6 +19,7 @@
#include <console/uart.h>
#include <arch/io.h>
+#include <boot/coreboot_tables.h>
#include "uart.h"
#include "clk.h"
#include "cpu.h"
@@ -159,13 +160,6 @@ unsigned int uart_platform_base(int idx)
return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
}
-#if !defined(__PRE_RAM__)
-uint32_t uartmem_getbaseaddr(void)
-{
- return uart_platform_base(0);
-}
-#endif
-
void uart_init(void)
{
struct s5p_uart *uart = uart_platform_baseptr(0);
@@ -189,3 +183,16 @@ void uart_tx_flush(void)
struct s5p_uart *uart = uart_platform_baseptr(0);
exynos5_uart_tx_flush(uart);
}
+
+#ifndef __PRE_RAM__
+void uart_fill_lb(void *data)
+{
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+}
+#endif
diff --git a/src/cpu/samsung/exynos5420/uart.c b/src/cpu/samsung/exynos5420/uart.c
index 82b1265972..290eb35a8d 100644
--- a/src/cpu/samsung/exynos5420/uart.c
+++ b/src/cpu/samsung/exynos5420/uart.c
@@ -19,6 +19,7 @@
#include <console/uart.h>
#include <arch/io.h>
+#include <boot/coreboot_tables.h>
#include "uart.h"
#include "clk.h"
#include "cpu.h"
@@ -151,13 +152,6 @@ unsigned int uart_platform_base(int idx)
return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
}
-#if !defined(__PRE_RAM__)
-uint32_t uartmem_getbaseaddr(void)
-{
- return uart_platform_base(0);
-}
-#endif
-
void uart_init(void)
{
struct s5p_uart *uart = uart_platform_baseptr(0);
@@ -180,3 +174,16 @@ void uart_tx_flush(void)
{
/* Exynos5250 implements this too. */
}
+
+#ifndef __PRE_RAM__
+void uart_fill_lb(void *data)
+{
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+}
+#endif
diff --git a/src/cpu/ti/am335x/uart.c b/src/cpu/ti/am335x/uart.c
index 09bb96ece3..858926bc31 100644
--- a/src/cpu/ti/am335x/uart.c
+++ b/src/cpu/ti/am335x/uart.c
@@ -20,6 +20,7 @@
#include <types.h>
#include <console/uart.h>
#include <arch/io.h>
+#include <boot/coreboot_tables.h>
#include <cpu/ti/am335x/uart.h>
#define EFR_ENHANCED_EN (1 << 4)
@@ -156,13 +157,6 @@ unsigned int uart_platform_base(int idx)
return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
}
-#if !defined(__PRE_RAM__)
-uint32_t uartmem_getbaseaddr(void)
-{
- return uart_platform_base(0);
-}
-#endif
-
void uart_init(void)
{
struct am335x_uart *uart = uart_platform_baseptr(0);
@@ -186,3 +180,16 @@ void uart_tx_byte(unsigned char data)
void uart_tx_flush(void)
{
}
+
+#ifndef __PRE_RAM__
+void uart_fill_lb(void *data)
+{
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+}
+#endif
diff --git a/src/drivers/oxford/oxpcie/oxpcie_early.c b/src/drivers/oxford/oxpcie/oxpcie_early.c
index d7f473ed78..7de9da6b46 100644
--- a/src/drivers/oxford/oxpcie/oxpcie_early.c
+++ b/src/drivers/oxford/oxpcie/oxpcie_early.c
@@ -24,7 +24,9 @@
#include <arch/io.h>
#include <arch/early_variables.h>
#include <delay.h>
+#include <boot/coreboot_tables.h>
#include <console/uart.h>
+#include <device/pci.h>
#include <device/pci_def.h>
static unsigned int oxpcie_present CAR_GLOBAL;
@@ -139,9 +141,15 @@ void oxford_remap(u32 new_base)
uart1_base = new_base + 0x2000;
}
-uint32_t uartmem_getbaseaddr(void)
+void uart_fill_lb(void *data)
{
- return uart_platform_base(0);
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
}
#endif
diff --git a/src/drivers/uart/pl011.c b/src/drivers/uart/pl011.c
index e4bfdc6136..41e66face8 100644
--- a/src/drivers/uart/pl011.c
+++ b/src/drivers/uart/pl011.c
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/
+#include <boot/coreboot_tables.h>
#include <console/uart.h>
static void pl011_uart_tx_byte(unsigned int *uart_base, unsigned char data)
@@ -25,13 +26,6 @@ unsigned int uart_platform_base(int idx)
return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
}
-#if !defined(__PRE_RAM__)
-uint32_t uartmem_getbaseaddr(void)
-{
- return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
-}
-#endif
-
void uart_init(void)
{
}
@@ -50,3 +44,16 @@ unsigned char uart_rx_byte(void)
{
return 0;
}
+
+#ifndef __PRE_RAM__
+void uart_fill_lb(void *data)
+{
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+}
+#endif
diff --git a/src/drivers/uart/uart8250io.c b/src/drivers/uart/uart8250io.c
index e4e8b6cfd7..1eebb18234 100644
--- a/src/drivers/uart/uart8250io.c
+++ b/src/drivers/uart/uart8250io.c
@@ -23,6 +23,10 @@
#include <trace.h>
#include "uart8250reg.h"
+#ifndef __ROMCC__
+#include <boot/coreboot_tables.h>
+#endif
+
/* Should support 8250, 16450, 16550, 16550A type UARTs */
/* Nominal values only, good for the range of choices Kconfig offers for
@@ -102,6 +106,11 @@ static void uart8250_init(unsigned base_port, unsigned divisor)
*/
static const unsigned bases[1] = { CONFIG_TTYS0_BASE };
+unsigned int uart_platform_base(int idx)
+{
+ return bases[idx];
+}
+
void uart_init(void)
{
unsigned int div;
@@ -129,3 +138,16 @@ void uart_tx_flush(void)
{
uart8250_tx_flush(bases[0]);
}
+
+#ifndef __PRE_RAM__
+void uart_fill_lb(void *data)
+{
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_IO_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250, data);
+}
+#endif
diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h
index c4ad5728ed..08a89bc02b 100644
--- a/src/include/boot/coreboot_tables.h
+++ b/src/include/boot/coreboot_tables.h
@@ -340,4 +340,8 @@ unsigned long write_coreboot_table(
void fill_lb_gpios(struct lb_gpios *gpios);
+void uart_fill_lb(void *data);
+void lb_add_serial(struct lb_serial *serial, void *data);
+void lb_add_console(uint16_t consoletype, void *data);
+
#endif /* COREBOOT_TABLES_H */
diff --git a/src/include/console/uart.h b/src/include/console/uart.h
index 6a1251e5d0..ed922f10ae 100644
--- a/src/include/console/uart.h
+++ b/src/include/console/uart.h
@@ -46,7 +46,6 @@ unsigned char uart_rx_byte(void);
int uart_can_rx_byte(void);
unsigned int uart_platform_base(int idx);
-uint32_t uartmem_getbaseaddr(void);
#if !defined(__ROMCC__)
static inline void *uart_platform_baseptr(int idx)
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 */