Leroy P Leahy (leroy.p.leahy(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14111
-gerrit
commit df4c3283f7d898498abfd09e17b2c707b6a9303a
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Wed Mar 16 10:21:59 2016 -0700
coreboot_tables: Extend serial port description
Extend the serial port description to include the input clock frequency
and an identifier for the serial port.
Without the input frequency it is impossible for the payload to compute
the baud-rate divisor without making an assumption about the frequency.
This breaks down when the UART is able to support multiple input clock
frequencies.
Use weak functions to allow the platform to override the input clock
frequency and the input clock divisor to enable coreboot to compute
the proper baud-rate divisor.
Add a payload specific ID field used by the payload to identify the
console UART within the system. A Kconfig value provides the default for this field to prevent breaking
existing coreboot implementations.
Currently the only payload to consume these new fields is the EDK-II
CorebootPayloadPkg.
Testing on Galileo:
* Edit the src/mainboard/intel/galileo/Makefile.inc file:
* Add "select ADD_FSP_PDAT_FILE"
* Add "select ADD_FSP_RAW_BIN"
* Add "select ADD_RMU_FILE"
* Place the FSP.bin file in the location specified by CONFIG_FSP_FILE
* Place the pdat.bin files in the location specified by
CONFIG_FSP_PDAT_FILE
* Place the rmu.bin file in the location specified by CONFIG_RMU_FILE
* Build EDK2 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc to generate
UEFIPAYLOAD.fd
* Load the SPI driver stack
* Testing is successful when CorebootPayloadPkg is able to properly
initialize the serial port without using built-in values.
Change-Id: I05a7e864afcd930916658e3efed53ff2efd403ec
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
payloads/libpayload/include/coreboot_tables.h | 2 ++
src/commonlib/include/commonlib/coreboot_tables.h | 8 ++++++++
src/drivers/uart/Kconfig | 7 +++++++
src/drivers/uart/oxpcie_early.c | 2 ++
src/drivers/uart/pl011.c | 2 ++
src/drivers/uart/uart8250io.c | 12 ++++--------
src/drivers/uart/uart8250mem.c | 5 ++++-
src/drivers/uart/util.c | 16 ++++++++++++++++
src/include/console/uart.h | 4 ++++
src/lib/coreboot_table.c | 2 ++
src/soc/intel/quark/Kconfig | 5 +++++
11 files changed, 56 insertions(+), 9 deletions(-)
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index 276f25f..06d1768 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -121,6 +121,8 @@ struct cb_serial {
u32 baseaddr;
u32 baud;
u32 regwidth;
+ u32 input_hertz;
+ u32 id;
};
#define CB_TAG_CONSOLE 0x00010
diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h
index 5c28791..926930d 100644
--- a/src/commonlib/include/commonlib/coreboot_tables.h
+++ b/src/commonlib/include/commonlib/coreboot_tables.h
@@ -173,6 +173,14 @@ struct lb_serial {
uint32_t baseaddr;
uint32_t baud;
uint32_t regwidth;
+ /* Crystal or input frequency to the chip containing the UART.
+ * Provide the board specific details to allow the payload to
+ * initialize the chip containing the UART and make independent
+ * decisions as to which dividers to select and their values
+ * to eventually arrive at the desired console baud-rate. */
+ uint32_t input_hertz;
+ /* Payload specific value to identify the console UART */
+ uint32_t id;
};
#define LB_TAG_CONSOLE 0x0010
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index f4ad011..25dc980 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -41,3 +41,10 @@ config DRIVERS_UART_PL011
bool
default n
select HAVE_UART_SPECIAL
+
+config UART_DEVICE_ID
+ hex
+ default 0
+ help
+ ID to help the payload identify the proper UART
+
diff --git a/src/drivers/uart/oxpcie_early.c b/src/drivers/uart/oxpcie_early.c
index eb91d31..479408b 100644
--- a/src/drivers/uart/oxpcie_early.c
+++ b/src/drivers/uart/oxpcie_early.c
@@ -92,6 +92,8 @@ void uart_fill_lb(void *data)
serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
serial.baud = default_baudrate();
serial.regwidth = 1;
+ serial.input_hertz = uart_platform_refclk();
+ serial.id = CONFIG_UART_DEVICE_ID;
lb_add_serial(&serial, data);
lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
diff --git a/src/drivers/uart/pl011.c b/src/drivers/uart/pl011.c
index aa55c68..915273b 100644
--- a/src/drivers/uart/pl011.c
+++ b/src/drivers/uart/pl011.c
@@ -48,6 +48,8 @@ void uart_fill_lb(void *data)
serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
serial.baud = default_baudrate();
serial.regwidth = 1;
+ serial.input_hertz = uart_platform_refclk();
+ serial.id = CONFIG_UART_DEVICE_ID;
lb_add_serial(&serial, data);
lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
diff --git a/src/drivers/uart/uart8250io.c b/src/drivers/uart/uart8250io.c
index 63bc42f..c83c2d2 100644
--- a/src/drivers/uart/uart8250io.c
+++ b/src/drivers/uart/uart8250io.c
@@ -27,12 +27,6 @@
/* Should support 8250, 16450, 16550, 16550A type UARTs */
-/* Nominal values only, good for the range of choices Kconfig offers for
- * set of standard baudrates.
- */
-#define BAUDRATE_REFCLK (115200)
-#define BAUDRATE_OVERSAMPLE (1)
-
/* Expected character delay at 1200bps is 9ms for a working UART
* and no flow-control. Assume UART as stuck if shift register
* or FIFO takes more than 50ms per character to appear empty.
@@ -111,8 +105,8 @@ uintptr_t uart_platform_base(int idx)
void uart_init(int idx)
{
unsigned int div;
- div = uart_baudrate_divisor(default_baudrate(), BAUDRATE_REFCLK,
- BAUDRATE_OVERSAMPLE);
+ div = uart_baudrate_divisor(default_baudrate(), uart_platform_refclk(),
+ uart_input_clock_divider());
uart8250_init(uart_platform_base(idx), div);
}
@@ -139,6 +133,8 @@ void uart_fill_lb(void *data)
serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
serial.baud = default_baudrate();
serial.regwidth = 1;
+ serial.input_hertz = uart_platform_refclk();
+ serial.id = CONFIG_UART_DEVICE_ID;
lb_add_serial(&serial, data);
lb_add_console(LB_TAG_CONSOLE_SERIAL8250, data);
diff --git a/src/drivers/uart/uart8250mem.c b/src/drivers/uart/uart8250mem.c
index 278ddb8..3fdb511 100644
--- a/src/drivers/uart/uart8250mem.c
+++ b/src/drivers/uart/uart8250mem.c
@@ -117,7 +117,8 @@ void uart_init(int idx)
return;
unsigned int div;
- div = uart_baudrate_divisor(default_baudrate(), uart_platform_refclk(), 16);
+ div = uart_baudrate_divisor(default_baudrate(),
+ uart_platform_refclk(), uart_input_clock_divider());
uart8250_mem_init(base, div);
}
@@ -156,6 +157,8 @@ void uart_fill_lb(void *data)
serial.regwidth = sizeof(uint32_t);
else
serial.regwidth = sizeof(uint8_t);
+ serial.input_hertz = uart_platform_refclk();
+ serial.id = CONFIG_UART_DEVICE_ID;
lb_add_serial(&serial, data);
lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
diff --git a/src/drivers/uart/util.c b/src/drivers/uart/util.c
index 4121f60..9cda8a2 100644
--- a/src/drivers/uart/util.c
+++ b/src/drivers/uart/util.c
@@ -18,6 +18,12 @@
#include "option_table.h"
#endif
+/* Nominal values only, good for the range of choices Kconfig offers for
+ * set of standard baudrates.
+ */
+#define BAUDRATE_REFCLK (115200 * 16)
+#define BAUDRATE_OVERSAMPLE (16)
+
unsigned int default_baudrate(void)
{
#if !defined(__SMM__) && CONFIG_USE_OPTION_TABLE
@@ -42,3 +48,13 @@ unsigned int uart_baudrate_divisor(unsigned int baudrate,
{
return (1 + (2 * refclk) / (baudrate * oversample)) / 2;
}
+
+__attribute__((weak)) unsigned int uart_platform_refclk(void)
+{
+ return BAUDRATE_REFCLK;
+}
+
+__attribute__((weak)) unsigned int uart_input_clock_divider(void)
+{
+ return BAUDRATE_OVERSAMPLE;
+}
diff --git a/src/include/console/uart.h b/src/include/console/uart.h
index 8458086..a3d650b 100644
--- a/src/include/console/uart.h
+++ b/src/include/console/uart.h
@@ -35,6 +35,10 @@ unsigned int default_baudrate(void);
unsigned int uart_baudrate_divisor(unsigned int baudrate,
unsigned int refclk, unsigned int oversample);
+/* Returns the oversample divisor multiplied by any other divisors that act
+ * on the input clock
+ */
+unsigned int uart_input_clock_divider(void);
void uart_init(int idx);
void uart_tx_byte(int idx, unsigned char data);
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 4dbac19..5482660 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -119,6 +119,8 @@ void lb_add_serial(struct lb_serial *new_serial, void *data)
serial->baseaddr = new_serial->baseaddr;
serial->baud = new_serial->baud;
serial->regwidth = new_serial->regwidth;
+ serial->input_hertz = new_serial->input_hertz;
+ serial->id = new_serial->id;
}
void lb_add_console(uint16_t consoletype, void *data)
diff --git a/src/soc/intel/quark/Kconfig b/src/soc/intel/quark/Kconfig
index aab509a..d71af30 100644
--- a/src/soc/intel/quark/Kconfig
+++ b/src/soc/intel/quark/Kconfig
@@ -59,6 +59,11 @@ config TTYS0_LCS
depends on ENABLE_BUILTIN_HSUART1
default 3
+config UART_DEVICE_ID
+ hex
+ depends on ENABLE_BUILTIN_HSUART1
+ default 0x09368086
+
#####
# Debug support
# The following options provide debug support for the Quark coreboot
Leroy P Leahy (leroy.p.leahy(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14558
-gerrit
commit 1f73cfa8d60159cc49336b268395830e82721636
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Sat Apr 30 09:07:14 2016 -0700
mainboard/intel/galileo: Enable I2C and GPIO
Enable the I2C and GPIO controllers
TEST=Build and run on Galileo Gen2
Change-Id: I97bbbb7c5e72edbed14702a4129d9cfa977e1911
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/mainboard/intel/galileo/devicetree.cb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mainboard/intel/galileo/devicetree.cb b/src/mainboard/intel/galileo/devicetree.cb
index 05edffc..66d32a8 100644
--- a/src/mainboard/intel/galileo/devicetree.cb
+++ b/src/mainboard/intel/galileo/devicetree.cb
@@ -39,7 +39,7 @@ chip soc/intel/quark
device pci 14.7 off end # 8086 0937 - 10/100 Ethernet MAC 1
device pci 15.0 on end # 8086 0935 - SPI controller 0
device pci 15.1 on end # 8086 0935 - SPI controller 1
- device pci 15.2 off end # 8086 0934 - I2C/GPIO controller
+ device pci 15.2 on end # 8086 0934 - I2C/GPIO controller
device pci 17.0 on end # 8086 11C3 - PCIe Root Port 0
device pci 17.1 off end # 8086 11C4 - PCIe Root Port 1
device pci 1f.0 on end # 8086 095E - Legacy Bridge
the following patch was just integrated into master:
commit 127c1317542152a89f24f3518ba910815592887d
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Sun May 1 15:20:11 2016 +0200
.gitignore: add build and libpayload dirs for nvramcui payload
Change-Id: I8a29ca1b07df68b50ab54276c9d9b32a81308e02
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
Reviewed-on: https://review.coreboot.org/14562
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
See https://review.coreboot.org/14562 for details.
-gerrit
the following patch was just integrated into master:
commit 98ab22711d6273e70c051a25ed7e76b215e700d5
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Sun May 1 19:41:28 2016 +0200
xcompile: test if gcc is really available
Just because an 'as' with a certain prefix is available does not guarantee
that a 'gcc' with the same prefix is available as well.
Without a check detect_compiler_runtime() would try to execute an
unavailable binary and print something like this:
.../xcompile: line 218: arm-linux-gnueabi-gcc: command not found
Change-Id: Icbadfeb2860152f7cf7696a9122521d0d881f3aa
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
Reviewed-on: https://review.coreboot.org/14563
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
See https://review.coreboot.org/14563 for details.
-gerrit
the following patch was just integrated into master:
commit 2d67d125701a78f488d0478cbf0861b4cd193685
Author: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Date: Sat Apr 30 21:11:48 2016 +0200
board_status/towiki: Link to CGit instead of Gitweb
Gitweb isn't online anymore, so fix a few broken links.
Change-Id: I7fdfcb60f83a718c9a5b6c7f7ef4df9206451d95
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Reviewed-on: https://review.coreboot.org/14559
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
See https://review.coreboot.org/14559 for details.
-gerrit