[coreboot-gerrit] New patch to review for coreboot: coreboot_tables: Extend serial port description

Leroy P Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Thu May 5 02:05:19 CEST 2016


Leroy P Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14609

-gerrit

commit 25c8a79f3f9e5712985b1fef59ae788ab5085248
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Wed May 4 11:59:19 2016 -0700

    coreboot_tables: Extend serial port description
    
    Extend the serial port description to include the input clock frequency
    and a payload specific value.
    
    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.
    
    Add a payload specific value to provide the payload with additional
    data.  The UART_PAYLOAD_PARAM Kconfig value provides the default for
    this field to prevent breaking existing coreboot implementations and
    allow this value to be easily selected for the payloads.
    
    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
    *  Testing is successful when CorebootPayloadPkg is able to properly
       initialize the serial port without using built-in values.
    
    Change-Id: Id4b4455bbf9583f0d66c315d38c493a81fd852a8
    Signed-off-by: Lee Leahy <leroy.p.leahy at intel.com>
---
 payloads/libpayload/include/coreboot_tables.h     | 10 ++++++++++
 src/commonlib/include/commonlib/coreboot_tables.h | 10 ++++++++++
 src/drivers/uart/Kconfig                          | 13 +++++++++++++
 src/drivers/uart/oxpcie_early.c                   |  5 +++++
 src/drivers/uart/pl011.c                          |  5 +++++
 src/drivers/uart/uart8250io.c                     |  5 +++++
 src/drivers/uart/uart8250mem.c                    |  5 +++++
 src/lib/coreboot_table.c                          |  2 ++
 8 files changed, 55 insertions(+)

diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index 276f25f..039bb66 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -121,6 +121,16 @@ struct cb_serial {
 	u32 baseaddr;
 	u32 baud;
 	u32 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 */
+	uint32_t payload_param;
 };
 
 #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..ed9abbb 100644
--- a/src/commonlib/include/commonlib/coreboot_tables.h
+++ b/src/commonlib/include/commonlib/coreboot_tables.h
@@ -173,6 +173,16 @@ 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 */
+	uint32_t payload_param;
 };
 
 #define LB_TAG_CONSOLE		0x0010
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index f4ad011..dbdfcb0 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -41,3 +41,16 @@ config DRIVERS_UART_PL011
 	bool
 	default n
 	select HAVE_UART_SPECIAL
+
+config UART_USE_REFCLK_AS_INPUT_CLOCK
+	bool
+	default n
+	help
+	  Use uart_platform_refclk to specify the input clock value.
+
+config UART_PAYLOAD_PARAM
+	hex "Payload specific parameter for UART configuration"
+	default 0
+	help
+	  Payload specific value to help with UART configuration.  Refer to
+	  the payload to determine the proper value to use.
diff --git a/src/drivers/uart/oxpcie_early.c b/src/drivers/uart/oxpcie_early.c
index eb91d31..60a598a 100644
--- a/src/drivers/uart/oxpcie_early.c
+++ b/src/drivers/uart/oxpcie_early.c
@@ -92,6 +92,11 @@ void uart_fill_lb(void *data)
 	serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
 	serial.baud = default_baudrate();
 	serial.regwidth = 1;
+	if (IS_ENABLED(CONFIG_UART_USE_REFCLK_AS_INPUT_CLOCK))
+		serial.input_hertz = uart_platform_refclk();
+	else
+		serial.input_hertz = 0;
+	serial.payload_param = CONFIG_UART_PAYLOAD_PARAM;
 	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..9e9e6bd 100644
--- a/src/drivers/uart/pl011.c
+++ b/src/drivers/uart/pl011.c
@@ -48,6 +48,11 @@ void uart_fill_lb(void *data)
 	serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
 	serial.baud = default_baudrate();
 	serial.regwidth = 1;
+	if (IS_ENABLED(CONFIG_UART_USE_REFCLK_AS_INPUT_CLOCK))
+		serial.input_hertz = uart_platform_refclk();
+	else
+		serial.input_hertz = 0;
+	serial.payload_param = CONFIG_UART_PAYLOAD_PARAM;
 	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..9fdf8a1 100644
--- a/src/drivers/uart/uart8250io.c
+++ b/src/drivers/uart/uart8250io.c
@@ -139,6 +139,11 @@ void uart_fill_lb(void *data)
 	serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
 	serial.baud = default_baudrate();
 	serial.regwidth = 1;
+	if (IS_ENABLED(CONFIG_UART_USE_REFCLK_AS_INPUT_CLOCK))
+		serial.input_hertz = uart_platform_refclk();
+	else
+		serial.input_hertz = 0;
+	serial.payload_param = CONFIG_UART_PAYLOAD_PARAM;
 	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..f7e0cdf 100644
--- a/src/drivers/uart/uart8250mem.c
+++ b/src/drivers/uart/uart8250mem.c
@@ -156,6 +156,11 @@ void uart_fill_lb(void *data)
 		serial.regwidth = sizeof(uint32_t);
 	else
 		serial.regwidth = sizeof(uint8_t);
+	if (IS_ENABLED(CONFIG_UART_USE_REFCLK_AS_INPUT_CLOCK))
+		serial.input_hertz = uart_platform_refclk();
+	else
+		serial.input_hertz = 0;
+	serial.payload_param = CONFIG_UART_PAYLOAD_PARAM;
 	lb_add_serial(&serial, data);
 
 	lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 4dbac19..f532e36 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->payload_param = new_serial->payload_param;
 }
 
 void lb_add_console(uint16_t consoletype, void *data)



More information about the coreboot-gerrit mailing list