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/14612
-gerrit
commit 54c609fa6fe75a42a6b1d6faa15e02f138992b10
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Wed Mar 16 10:21:59 2016 -0700
drivers/uart: Use uart_platform_refclk for all UART models
Allow the platform to override the input clock for the UART by
implementing the routine uart_platform_refclk and setting the Kconfig
value UART_OVERRIDE_REFCLK. Provide a default uart_platform_refclk
routine which is disabled when UART_OVERRIDE_REFCLK is selected. This
works around ROMCC not supporting weak routines.
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: If4afc45a828e5ba935fecb6d95b239625e912d14
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/cpu/allwinner/a10/Kconfig | 1 +
src/cpu/ti/am335x/Kconfig | 1 +
src/drivers/uart/Kconfig | 8 ++++++++
src/drivers/uart/uart8250io.c | 7 +------
src/drivers/uart/util.c | 7 +++++++
src/soc/imgtec/pistachio/Kconfig | 1 +
src/soc/intel/apollolake/uart_early.c | 6 ------
src/soc/intel/quark/Kconfig | 1 +
src/soc/intel/skylake/uart_debug.c | 11 -----------
src/soc/marvell/armada38x/Kconfig | 1 +
src/soc/nvidia/tegra132/Kconfig | 1 +
src/southbridge/amd/pi/hudson/Kconfig | 1 +
12 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/cpu/allwinner/a10/Kconfig b/src/cpu/allwinner/a10/Kconfig
index 814b69e..0e5aba9 100644
--- a/src/cpu/allwinner/a10/Kconfig
+++ b/src/cpu/allwinner/a10/Kconfig
@@ -13,5 +13,6 @@ config CPU_SPECIFIC_OPTIONS
select HAVE_MONOTONIC_TIMER
select HAVE_UART_SPECIAL
select BOOTBLOCK_CONSOLE
+ select UART_OVERRIDE_REFCLK
endif # if CPU_ALLWINNER_A10
diff --git a/src/cpu/ti/am335x/Kconfig b/src/cpu/ti/am335x/Kconfig
index 8d3c691..f44c69d 100644
--- a/src/cpu/ti/am335x/Kconfig
+++ b/src/cpu/ti/am335x/Kconfig
@@ -7,5 +7,6 @@ config CPU_TI_AM335X
select HAVE_UART_SPECIAL
select BOOTBLOCK_CONSOLE
select GENERIC_UDELAY
+ select UART_OVERRIDE_REFCLK
bool
default n
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index aaf6e0e..cae9453 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -20,6 +20,13 @@ config UART_OVERRIDE_INPUT_CLOCK_DIVIDER
Set to "y" when the platform overrides the uart_input_clock_divider
routine.
+config UART_OVERRIDE_REFCLK
+ boolean
+ default n
+ help
+ Set to "y" when the platform overrides the uart_platform_refclk
+ routine.
+
config DRIVERS_UART_8250MEM
bool
default n
@@ -39,6 +46,7 @@ config DRIVERS_UART_OXPCIE
depends on PCI
select DRIVERS_UART_8250MEM
select EARLY_PCI_BRIDGE
+ select UART_OVERRIDE_REFCLK
help
Support for Oxford OXPCIe952 serial port PCIe cards.
Currently only devices with the vendor ID 0x1415 and device ID
diff --git a/src/drivers/uart/uart8250io.c b/src/drivers/uart/uart8250io.c
index d85e497..59e0b11 100644
--- a/src/drivers/uart/uart8250io.c
+++ b/src/drivers/uart/uart8250io.c
@@ -27,11 +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 * 16)
-
/* 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.
@@ -110,7 +105,7 @@ uintptr_t uart_platform_base(int idx)
void uart_init(int idx)
{
unsigned int div;
- div = uart_baudrate_divisor(default_baudrate(), BAUDRATE_REFCLK,
+ div = uart_baudrate_divisor(default_baudrate(), uart_platform_refclk(),
uart_input_clock_divider());
uart8250_init(uart_platform_base(idx), div);
}
diff --git a/src/drivers/uart/util.c b/src/drivers/uart/util.c
index 53c32ed..d92c7e4 100644
--- a/src/drivers/uart/util.c
+++ b/src/drivers/uart/util.c
@@ -49,3 +49,10 @@ unsigned int uart_input_clock_divider(void)
return 16;
}
#endif
+
+# if !IS_ENABLED(CONFIG_UART_OVERRIDE_REFCLK)
+unsigned int uart_platform_refclk(void)
+{
+ return 115200 * 16;
+}
+#endif
diff --git a/src/soc/imgtec/pistachio/Kconfig b/src/soc/imgtec/pistachio/Kconfig
index 5ea6b95..da33cc5 100644
--- a/src/soc/imgtec/pistachio/Kconfig
+++ b/src/soc/imgtec/pistachio/Kconfig
@@ -25,6 +25,7 @@ config CPU_IMGTEC_PISTACHIO
select SPI_ATOMIC_SEQUENCING
select GENERIC_GPIO_LIB
select HAVE_HARD_RESET
+ select UART_OVERRIDE_REFCLK
bool
if CPU_IMGTEC_PISTACHIO
diff --git a/src/soc/intel/apollolake/uart_early.c b/src/soc/intel/apollolake/uart_early.c
index e8dfeda..0e53060 100644
--- a/src/soc/intel/apollolake/uart_early.c
+++ b/src/soc/intel/apollolake/uart_early.c
@@ -68,12 +68,6 @@ uintptr_t uart_platform_base(int idx)
return (CONFIG_CONSOLE_UART_BASE_ADDRESS);
}
-unsigned int uart_platform_refclk(void)
-{
- /* That's within 0.5% of the actual value we've set earlier */
- return 115200 * 16;
-}
-
static const struct pad_config uart_gpios[] = {
PAD_CFG_NF(GPIO_42, NATIVE, DEEP, NF1), /* UART1 RX */
PAD_CFG_NF(GPIO_43, NATIVE, DEEP, NF1), /* UART1 TX */
diff --git a/src/soc/intel/quark/Kconfig b/src/soc/intel/quark/Kconfig
index ebdc899..1eb4fff 100644
--- a/src/soc/intel/quark/Kconfig
+++ b/src/soc/intel/quark/Kconfig
@@ -30,6 +30,7 @@ config CPU_SPECIFIC_OPTIONS
select SOC_INTEL_COMMON
select SOC_SETS_MTRRS
select TSC_CONSTANT_RATE
+ select UART_OVERRIDE_REFCLK
select UDELAY_TSC
select UNCOMPRESSED_RAMSTAGE
select USE_MARCH_586
diff --git a/src/soc/intel/skylake/uart_debug.c b/src/soc/intel/skylake/uart_debug.c
index c463bea..f3d576b 100644
--- a/src/soc/intel/skylake/uart_debug.c
+++ b/src/soc/intel/skylake/uart_debug.c
@@ -18,17 +18,6 @@
#include <soc/iomap.h>
#include <soc/serialio.h>
-unsigned int uart_platform_refclk(void)
-{
- /*
- * Set M and N divisor inputs and enable clock.
- * Main reference frequency to UART is:
- * 120MHz * M / N = 120MHz * 48 / 3125 = 1843200Hz
- * The different order below is to handle integer math overflow.
- */
- return 120 * MHz / SIO_REG_PPR_CLOCK_N_DIV * SIO_REG_PPR_CLOCK_M_DIV;
-}
-
uintptr_t uart_platform_base(int idx)
{
/* Same base address for all debug port usage. In reality UART2
diff --git a/src/soc/marvell/armada38x/Kconfig b/src/soc/marvell/armada38x/Kconfig
index 6754a0f..ed8cbe8 100644
--- a/src/soc/marvell/armada38x/Kconfig
+++ b/src/soc/marvell/armada38x/Kconfig
@@ -10,6 +10,7 @@ config SOC_MARVELL_ARMADA38X
select RETURN_FROM_VERSTAGE
select BOOTBLOCK_CUSTOM
select GENERIC_UDELAY
+ select UART_OVERRIDE_REFCLK
if SOC_MARVELL_ARMADA38X
diff --git a/src/soc/nvidia/tegra132/Kconfig b/src/soc/nvidia/tegra132/Kconfig
index 502e7c4..08ed475 100644
--- a/src/soc/nvidia/tegra132/Kconfig
+++ b/src/soc/nvidia/tegra132/Kconfig
@@ -13,6 +13,7 @@ config SOC_NVIDIA_TEGRA132
select HAVE_HARD_RESET
select HAVE_UART_SPECIAL
select GENERIC_GPIO_LIB
+ select UART_OVERRIDE_REFCLK
if SOC_NVIDIA_TEGRA132
diff --git a/src/southbridge/amd/pi/hudson/Kconfig b/src/southbridge/amd/pi/hudson/Kconfig
index aa55339..8fe3b2d 100644
--- a/src/southbridge/amd/pi/hudson/Kconfig
+++ b/src/southbridge/amd/pi/hudson/Kconfig
@@ -235,6 +235,7 @@ config HUDSON_UART
select DRIVERS_UART_8250MEM
select DRIVERS_UART_8250MEM_32
select NO_UART_ON_SUPERIO
+ select UART_OVERRIDE_REFCLK
help
There are two UART controllers in Kern.
The UART registers are memory-mapped. UART
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/14611
-gerrit
commit 51f39261b7228eecff4c59bd3390c5df23a74711
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Wed May 4 13:13:20 2016 -0700
drivers/uart: Enable override for input clock divider
Allow the platform to override the input clock divider by adding the
uart_input_clock_divider routine. This routine combines the baud-rate
oversample divider with any other input clock divider. The default
routine returns 16 which is the standard baud-rate oversampling value.
A platform may override this default "weak" routine by providing a new
routine and selecting UART_OVERRIDE_INPUT_CLOCK_DIVIDER. This works
around ROMCC not supporting weak routines.
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: Ieb6453b045d84702b8f730988d0fed9f253f63e2
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/drivers/uart/Kconfig | 7 +++++++
src/drivers/uart/uart8250io.c | 5 ++---
src/drivers/uart/uart8250mem.c | 3 ++-
src/drivers/uart/util.c | 7 +++++++
src/include/console/uart.h | 4 ++++
5 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index dbdfcb0..aaf6e0e 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -13,6 +13,13 @@ config DRIVERS_UART_8250IO
config NO_UART_ON_SUPERIO
def_bool n
+config UART_OVERRIDE_INPUT_CLOCK_DIVIDER
+ boolean
+ default n
+ help
+ Set to "y" when the platform overrides the uart_input_clock_divider
+ routine.
+
config DRIVERS_UART_8250MEM
bool
default n
diff --git a/src/drivers/uart/uart8250io.c b/src/drivers/uart/uart8250io.c
index 9fdf8a1..d85e497 100644
--- a/src/drivers/uart/uart8250io.c
+++ b/src/drivers/uart/uart8250io.c
@@ -30,8 +30,7 @@
/* Nominal values only, good for the range of choices Kconfig offers for
* set of standard baudrates.
*/
-#define BAUDRATE_REFCLK (115200)
-#define BAUDRATE_OVERSAMPLE (1)
+#define BAUDRATE_REFCLK (115200 * 16)
/* Expected character delay at 1200bps is 9ms for a working UART
* and no flow-control. Assume UART as stuck if shift register
@@ -112,7 +111,7 @@ void uart_init(int idx)
{
unsigned int div;
div = uart_baudrate_divisor(default_baudrate(), BAUDRATE_REFCLK,
- BAUDRATE_OVERSAMPLE);
+ uart_input_clock_divider());
uart8250_init(uart_platform_base(idx), div);
}
diff --git a/src/drivers/uart/uart8250mem.c b/src/drivers/uart/uart8250mem.c
index f7e0cdf..9dac2f7 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);
}
diff --git a/src/drivers/uart/util.c b/src/drivers/uart/util.c
index 4121f60..53c32ed 100644
--- a/src/drivers/uart/util.c
+++ b/src/drivers/uart/util.c
@@ -42,3 +42,10 @@ unsigned int uart_baudrate_divisor(unsigned int baudrate,
{
return (1 + (2 * refclk) / (baudrate * oversample)) / 2;
}
+
+# if !IS_ENABLED(CONFIG_UART_OVERRIDE_INPUT_CLOCK_DIVIDER)
+unsigned int uart_input_clock_divider(void)
+{
+ return 16;
+}
+#endif
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);
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/14610
-gerrit
commit 720d8c64b78b4121eb15362180a2ea5ba1539530
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Wed May 4 12:50:51 2016 -0700
soc/intel/quark: Identify the console UART
Pass the UART identifier to 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: I9db1c31c3544d56b66f5a79ac8c3acee41788983
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/soc/intel/quark/Kconfig | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/soc/intel/quark/Kconfig b/src/soc/intel/quark/Kconfig
index 8485aa3..ebdc899 100644
--- a/src/soc/intel/quark/Kconfig
+++ b/src/soc/intel/quark/Kconfig
@@ -60,6 +60,12 @@ config TTYS0_LCS
depends on ENABLE_BUILTIN_HSUART1
default 3
+# Console: PCI UART bus 0 << 20, device 20 << 15, function 5 << 12
+config UART_PAYLOAD_PARAM
+ hex
+ depends on ENABLE_BUILTIN_HSUART1
+ default 0x000a5000
+
#####
# 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/14609
-gerrit
commit 25c8a79f3f9e5712985b1fef59ae788ab5085248
Author: Lee Leahy <leroy.p.leahy(a)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(a)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)
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14608
-gerrit
commit 135c70c0b358f48de044f49fee13655f251fbcd4
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed May 4 16:07:15 2016 -0500
util/cbfstool: fix x86 execute-in-place semantics for all fmd regions
A previous patch [1] to make top-aligned addresses work within per
fmap regions caused a significant regression in the semantics of
adding programs that need to be execute-in-place (XIP) on x86
systems. Correct the regression by providing new function,
convert_to_from_absolute_top_aligned(), which top aligns against
the entire boot media.
[1] 9731119b cbfstool: make top-aligned address work per-region
Change-Id: I3b685abadcfc76dab8846eec21e9114a23577578
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
util/cbfstool/cbfstool.c | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 1d1577f..b1b410f 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -106,6 +106,21 @@ static bool region_is_modern_cbfs(const char *region)
/*
* Converts between offsets from the start of the specified image region and
+ * "top-aligned" offsets from the top of the entire boot media. See comment
+ * below for convert_to_from_top_aligned() about forming addresses.
+ */
+static unsigned convert_to_from_absolute_top_aligned(
+ const struct buffer *region, unsigned offset)
+{
+ assert(region);
+
+ size_t image_size = partitioned_file_total_size(param.image_file);
+
+ return image_size - region->offset - offset;
+}
+
+/*
+ * Converts between offsets from the start of the specified image region and
* "top-aligned" offsets from the top of the image region. Works in either
* direction: pass in one type of offset and receive the other type.
* N.B. A top-aligned offset is always a positive number, and should not be
@@ -123,8 +138,7 @@ static unsigned convert_to_from_top_aligned(const struct buffer *region,
return region->size - offset;
}
- size_t image_size = partitioned_file_total_size(param.image_file);
- return image_size - region->offset - offset;
+ return convert_to_from_absolute_top_aligned(region, offset);
}
static int do_cbfs_locate(int32_t *cbfs_addr, size_t metadata_size)
@@ -462,8 +476,8 @@ static int cbfstool_convert_fsp(struct buffer *buffer,
/* Ensure the address is a memory mapped one. */
if (!IS_TOP_ALIGNED_ADDRESS(address))
- address = -convert_to_from_top_aligned(param.image_region,
- address);
+ address = -convert_to_from_absolute_top_aligned(
+ param.image_region, address);
/* Create a copy of the buffer to attempt relocation. */
if (buffer_create(&fsp, buffer_size(buffer), "fsp"))
@@ -498,9 +512,13 @@ static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset,
return 1;
}
- /* Pass in a top aligned address. */
- address = -convert_to_from_top_aligned(param.image_region,
- address);
+ /*
+ * Ensure the address is a memory mapped one. This assumes
+ * x86 semantics about th boot media being directly mapped
+ * below 4GiB in the CPU address space.
+ **/
+ address = -convert_to_from_absolute_top_aligned(
+ param.image_region, address);
*offset = address;
ret = parse_elf_to_xip_stage(buffer, &output, offset,
Alexandru Gagniuc (alexandrux.gagniuc(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14585
-gerrit
commit 1a234fbf0eee0b3e3cb8f32f0a515a07852c40fe
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Wed Mar 30 14:38:44 2016 -0700
ec/google/chromeec/ec_lpc: Declare used IO ports as a resource
Chrome EC uses IO ports 0x800 -> 0x9ff to communicate over LPC;
however, those ports were not declared as a resource. This had two
major downsides:
* It allowed the allocator to assign said ports to other devices
* It required manually open up an IO window in the LPC bridge.
The LPC bridge on many chromeec boards had to be painstakingly
adjusted to meet these constraints.
The advantage of declaring the resources upfront is that the lpc
bridge can now scan its child resources and automatically open up
IO windows, as requested by its LPC children devices.
Change-Id: I35c4e48dddb7300674d7a9858b590c1f20e3b0e3
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/ec/google/chromeec/ec.h | 4 ++++
src/ec/google/chromeec/ec_lpc.c | 29 ++++++++++++++++++++++++++++-
src/ec/google/chromeec/ec_mec.c | 1 -
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h
index 7f52362..85f41ad 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -59,6 +59,10 @@ int google_chromeec_vstore_info(uint32_t *locked);
int google_chromeec_vstore_read(int slot, uint8_t *data);
int google_chromeec_vstore_write(int slot, uint8_t *data, size_t size);
+/* MEC uses 0x800/0x804 as register/index pair, thus an 8-byte resource. */
+#define MEC_EMI_BASE 0x800
+#define MEC_EMI_SIZE 8
+
/* For MEC, access ranges 0x800 thru 0x9ff using EMI interface instead of LPC */
#define MEC_EMI_RANGE_START EC_HOST_CMD_REGION0
#define MEC_EMI_RANGE_END (EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE)
diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c
index 021735e..f9d0f8b 100644
--- a/src/ec/google/chromeec/ec_lpc.c
+++ b/src/ec/google/chromeec/ec_lpc.c
@@ -14,6 +14,7 @@
*/
#include <arch/io.h>
+#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <device/pnp.h>
@@ -407,9 +408,35 @@ static void lpc_ec_init(struct device *dev)
google_chromeec_init();
}
+/*
+ * Declare the IO ports that we are using:
+ *
+ * All ECs (not explicitly declared):
+ * 0x60/0x64, 0x62/0x66, 0x80, 0x200->0x207
+ *
+ * mec1322: 0x800->0x807
+ * All others: 0x800->0x9ff
+ *
+ * EC_GOOGLE_CHROMEEC_ACPI_MEMMAP is only used for MEC ECs.
+ */
static void lpc_ec_read_resources(struct device *dev)
{
- /* Nothing, but this function avoids an error on serial console. */
+ unsigned int idx = 0;
+ struct resource * res;
+
+
+ res = new_resource(dev, idx++);
+ if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_MEC)) {
+ res->base = MEC_EMI_BASE;
+ res->size = MEC_EMI_SIZE;
+ } else {
+ res->base = EC_HOST_CMD_REGION0;
+ res->size = 2 * EC_HOST_CMD_REGION_SIZE;
+ /* Make sure MEMMAP region follows host cmd region. */
+ assert(res->base + res->size == EC_LPC_ADDR_MEMMAP);
+ res->size += EC_MEMMAP_SIZE;
+ }
+ res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
}
static void lpc_ec_enable_resources(struct device *dev)
diff --git a/src/ec/google/chromeec/ec_mec.c b/src/ec/google/chromeec/ec_mec.c
index a9bc282..4cd0823 100644
--- a/src/ec/google/chromeec/ec_mec.c
+++ b/src/ec/google/chromeec/ec_mec.c
@@ -32,7 +32,6 @@ enum {
};
/* EMI registers are relative to base */
-#define MEC_EMI_BASE 0x800
#define MEC_EMI_HOST_TO_EC (MEC_EMI_BASE + 0)
#define MEC_EMI_EC_TO_HOST (MEC_EMI_BASE + 1)
#define MEC_EMI_EC_ADDRESS_B0 (MEC_EMI_BASE + 2)