[U-Boot] [PATCH v2 0/5] x86: Early debug enhancements

This series adds a few more features to the debug UART, making it possible to use it even when the board needs to perform additional init for the UART to work. The debug UART is anabled on link.
Some minor PCI tidy-ups are also included.
Link currently does not boot due to lack of early malloc() memory. For now just increase the size.
Changes in v2: - Adjust all _debug_uart_init() declarations to be static inline - Remove comment block since we now always enable the debug UART - Use a tab after the 'call' instruction
Simon Glass (5): debug_uart: Adjust the declaration of debug_uart_init() debug_uart: Support board-specific UART initialisation debug_uart: Add an option to announce the debug UART x86: Init the debug UART if enabled x86: chromebook_link: Enable the debug UART
arch/x86/cpu/ivybridge/cpu.c | 7 +++++++ arch/x86/cpu/start.S | 11 +++-------- configs/chromebook_link_defconfig | 4 ++++ drivers/serial/Kconfig | 21 +++++++++++++++++++++ drivers/serial/ns16550.c | 2 +- drivers/serial/serial_efi.c | 2 +- drivers/serial/serial_s5p.c | 2 +- include/debug_uart.h | 30 ++++++++++++++++++++++++++++-- lib/efi/efi_stub.c | 2 +- 9 files changed, 67 insertions(+), 14 deletions(-)

We want to be able to add other common code to this function. So change the driver's version to have an underscore before it, just like _debug_uart_putc(). Define debug_uart_init() to call this version.
Update all drivers to this new method.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Adjust all _debug_uart_init() declarations to be static inline
drivers/serial/ns16550.c | 2 +- drivers/serial/serial_efi.c | 2 +- drivers/serial/serial_s5p.c | 2 +- include/debug_uart.h | 9 +++++++-- lib/efi/efi_stub.c | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 6275a11..6433844 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -257,7 +257,7 @@ int NS16550_tstc(NS16550_t com_port) (1 << CONFIG_DEBUG_UART_SHIFT), \ CONFIG_DEBUG_UART_SHIFT)
-void debug_uart_init(void) +static inline void _debug_uart_init(void) { struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index cf57d89..ea25c25 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -107,7 +107,7 @@ static int serial_efi_pending(struct udevice *dev, bool input) * There is nothing to init here since the EFI console is already running by * the time we enter U-Boot. */ -void debug_uart_init(void) +static inline void _debug_uart_init(void) { }
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 3f0b588..feba467 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -207,7 +207,7 @@ U_BOOT_DRIVER(serial_s5p) = {
#include <debug_uart.h>
-void debug_uart_init(void) +static inline void _debug_uart_init(void) { struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
diff --git a/include/debug_uart.h b/include/debug_uart.h index a75e377..257ba00 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -38,7 +38,7 @@ * To enable the debug UART in your serial driver: * * - #include <debug_uart.h> - * - Define debug_uart_init(), trying to avoid using the stack + * - Define _debug_uart_init(), trying to avoid using the stack * - Define _debug_uart_putc() as static inline (avoiding stack usage) * - Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the * functionality (printch(), etc.) @@ -132,6 +132,11 @@ void printhex8(uint value); void printhex8(uint value) \ { \ printhex(value, 8); \ - } + } \ +\ + void debug_uart_init(void) \ + { \ + _debug_uart_init(); \ + } \
#endif diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index d4d3e49..e138709 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -59,7 +59,7 @@ struct __packed desctab_info { * considering if we start needing more U-Boot functionality. Note that we * could then move get_codeseg32() to arch/x86/cpu/cpu.c. */ -void debug_uart_init(void) +void _debug_uart_init(void) { }

Hi Simon,
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
We want to be able to add other common code to this function. So change the driver's version to have an underscore before it, just like _debug_uart_putc(). Define debug_uart_init() to call this version.
Update all drivers to this new method.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Changes in v2:
- Adjust all _debug_uart_init() declarations to be static inline
drivers/serial/ns16550.c | 2 +- drivers/serial/serial_efi.c | 2 +- drivers/serial/serial_s5p.c | 2 +- include/debug_uart.h | 9 +++++++-- lib/efi/efi_stub.c | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 6275a11..6433844 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -257,7 +257,7 @@ int NS16550_tstc(NS16550_t com_port) (1 << CONFIG_DEBUG_UART_SHIFT), \ CONFIG_DEBUG_UART_SHIFT)
-void debug_uart_init(void) +static inline void _debug_uart_init(void) { struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index cf57d89..ea25c25 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -107,7 +107,7 @@ static int serial_efi_pending(struct udevice *dev, bool input)
- There is nothing to init here since the EFI console is already running by
- the time we enter U-Boot.
*/ -void debug_uart_init(void) +static inline void _debug_uart_init(void) { }
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 3f0b588..feba467 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -207,7 +207,7 @@ U_BOOT_DRIVER(serial_s5p) = {
#include <debug_uart.h>
-void debug_uart_init(void) +static inline void _debug_uart_init(void) { struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
diff --git a/include/debug_uart.h b/include/debug_uart.h index a75e377..257ba00 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -38,7 +38,7 @@
- To enable the debug UART in your serial driver:
- #include <debug_uart.h>
- Define debug_uart_init(), trying to avoid using the stack
- Define _debug_uart_init(), trying to avoid using the stack
- Define _debug_uart_putc() as static inline (avoiding stack usage)
- Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the
functionality (printch(), etc.)
@@ -132,6 +132,11 @@ void printhex8(uint value); void printhex8(uint value) \ { \ printhex(value, 8); \
}
} \
+\
void debug_uart_init(void) \
{ \
_debug_uart_init(); \
} \
I think the ending \ in the last line will cause problems.
#endif diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index d4d3e49..e138709 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -59,7 +59,7 @@ struct __packed desctab_info {
- considering if we start needing more U-Boot functionality. Note that we
- could then move get_codeseg32() to arch/x86/cpu/cpu.c.
*/ -void debug_uart_init(void) +void _debug_uart_init(void) { }
--
Regards, Bin

On 18 October 2015 at 21:17, Bin Meng bmeng.cn@gmail.com wrote:
Hi Simon,
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
We want to be able to add other common code to this function. So change the driver's version to have an underscore before it, just like _debug_uart_putc(). Define debug_uart_init() to call this version.
Update all drivers to this new method.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Changes in v2:
- Adjust all _debug_uart_init() declarations to be static inline
drivers/serial/ns16550.c | 2 +- drivers/serial/serial_efi.c | 2 +- drivers/serial/serial_s5p.c | 2 +- include/debug_uart.h | 9 +++++++-- lib/efi/efi_stub.c | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 6275a11..6433844 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -257,7 +257,7 @@ int NS16550_tstc(NS16550_t com_port) (1 << CONFIG_DEBUG_UART_SHIFT), \ CONFIG_DEBUG_UART_SHIFT)
-void debug_uart_init(void) +static inline void _debug_uart_init(void) { struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index cf57d89..ea25c25 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -107,7 +107,7 @@ static int serial_efi_pending(struct udevice *dev, bool input)
- There is nothing to init here since the EFI console is already running by
- the time we enter U-Boot.
*/ -void debug_uart_init(void) +static inline void _debug_uart_init(void) { }
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 3f0b588..feba467 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -207,7 +207,7 @@ U_BOOT_DRIVER(serial_s5p) = {
#include <debug_uart.h>
-void debug_uart_init(void) +static inline void _debug_uart_init(void) { struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
diff --git a/include/debug_uart.h b/include/debug_uart.h index a75e377..257ba00 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -38,7 +38,7 @@
- To enable the debug UART in your serial driver:
- #include <debug_uart.h>
- Define debug_uart_init(), trying to avoid using the stack
- Define _debug_uart_init(), trying to avoid using the stack
- Define _debug_uart_putc() as static inline (avoiding stack usage)
- Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the
functionality (printch(), etc.)
@@ -132,6 +132,11 @@ void printhex8(uint value); void printhex8(uint value) \ { \ printhex(value, 8); \
}
} \
+\
void debug_uart_init(void) \
{ \
_debug_uart_init(); \
} \
I think the ending \ in the last line will cause problems.
It should not be there really. I missed it for this cycle but I'll tidy it up at some point.
Applied to u-boot-x86.

Some boards need to set things up before the debug UART can be used. On these boards a call to debug_uart_init() is insufficient. When this option is enabled, the function board_debug_uart_init() will be called when debug_uart_init() is called. You can put any code here that is needed to set up the UART ready for use, such as set pin multiplexing or enable clocks.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
drivers/serial/Kconfig | 11 +++++++++++ include/debug_uart.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ddb725d..39f6500 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -109,6 +109,17 @@ config DEBUG_UART_SHIFT value. Use this value to specify the shift to use, where 0=byte registers, 2=32-bit word registers, etc.
+config DEBUG_UART_BOARD_INIT + bool "Enable board-specific debug UART init" + depends on DEBUG_UART + help + Some boards need to set things up before the debug UART can be used. + On these boards a call to debug_uart_init() is insufficient. When + this option is enabled, the function board_debug_uart_init() will + be called when debug_uart_init() is called. You can put any code + here that is needed to set up the UART ready for use, such as set + pin multiplexing or enable clocks. + config ROCKCHIP_SERIAL bool "Rockchip on-chip UART support" depends on ARCH_ROCKCHIP && DM_SERIAL diff --git a/include/debug_uart.h b/include/debug_uart.h index 257ba00..a6b7ce8 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -42,6 +42,11 @@ * - Define _debug_uart_putc() as static inline (avoiding stack usage) * - Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the * functionality (printch(), etc.) + * + * If your board needs additional init for the UART to work, enable + * CONFIG_DEBUG_UART_BOARD_INIT and write a function called + * board_debug_uart_init() to perform that init. When debug_uart_init() is + * called, the init will happen automatically. */
/** @@ -57,6 +62,14 @@ */ void debug_uart_init(void);
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void); +#else +static inline void board_debug_uart_init(void) +{ +} +#endif + /** * printch() - Output a character to the debug UART * @@ -136,6 +149,7 @@ void printhex8(uint value); \ void debug_uart_init(void) \ { \ + board_debug_uart_init(); \ _debug_uart_init(); \ } \

On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
Some boards need to set things up before the debug UART can be used. On these boards a call to debug_uart_init() is insufficient. When this option is enabled, the function board_debug_uart_init() will be called when debug_uart_init() is called. You can put any code here that is needed to set up the UART ready for use, such as set pin multiplexing or enable clocks.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
drivers/serial/Kconfig | 11 +++++++++++ include/debug_uart.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ddb725d..39f6500 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -109,6 +109,17 @@ config DEBUG_UART_SHIFT value. Use this value to specify the shift to use, where 0=byte registers, 2=32-bit word registers, etc.
+config DEBUG_UART_BOARD_INIT
bool "Enable board-specific debug UART init"
depends on DEBUG_UART
help
Some boards need to set things up before the debug UART can be used.
On these boards a call to debug_uart_init() is insufficient. When
this option is enabled, the function board_debug_uart_init() will
be called when debug_uart_init() is called. You can put any code
here that is needed to set up the UART ready for use, such as set
pin multiplexing or enable clocks.
config ROCKCHIP_SERIAL bool "Rockchip on-chip UART support" depends on ARCH_ROCKCHIP && DM_SERIAL diff --git a/include/debug_uart.h b/include/debug_uart.h index 257ba00..a6b7ce8 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -42,6 +42,11 @@
- Define _debug_uart_putc() as static inline (avoiding stack usage)
- Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the
functionality (printch(), etc.)
- If your board needs additional init for the UART to work, enable
- CONFIG_DEBUG_UART_BOARD_INIT and write a function called
- board_debug_uart_init() to perform that init. When debug_uart_init() is
*/
- called, the init will happen automatically.
/** @@ -57,6 +62,14 @@ */ void debug_uart_init(void);
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void); +#else +static inline void board_debug_uart_init(void) +{ +} +#endif
/**
- printch() - Output a character to the debug UART
@@ -136,6 +149,7 @@ void printhex8(uint value); \ void debug_uart_init(void) \ { \
board_debug_uart_init(); \ _debug_uart_init(); \ } \
--
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On 18 October 2015 at 21:17, Bin Meng bmeng.cn@gmail.com wrote:
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
Some boards need to set things up before the debug UART can be used. On these boards a call to debug_uart_init() is insufficient. When this option is enabled, the function board_debug_uart_init() will be called when debug_uart_init() is called. You can put any code here that is needed to set up the UART ready for use, such as set pin multiplexing or enable clocks.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
drivers/serial/Kconfig | 11 +++++++++++ include/debug_uart.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+)
[snip]
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Applied to u-boot-x86.

It is useful to see a message from the debug UART early during boot so that you know things are working. Add an option to enable this. The message will be displayed as soon as debug_uart_init() is called.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
drivers/serial/Kconfig | 10 ++++++++++ include/debug_uart.h | 7 +++++++ 2 files changed, 17 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 39f6500..ac5920a 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -120,6 +120,16 @@ config DEBUG_UART_BOARD_INIT here that is needed to set up the UART ready for use, such as set pin multiplexing or enable clocks.
+config DEBUG_UART_ANNOUNCE + bool "Show a message when the debug UART starts up" + depends on DEBUG_UART + help + Enable this option to show a message when the debug UART is ready + for use. You will see a message like "<debug_uart> " as soon as + U-Boot has the UART ready for use (i.e. your code calls + debug_uart_init()). This can be useful just as a check that + everything is working. + config ROCKCHIP_SERIAL bool "Rockchip on-chip UART support" depends on ARCH_ROCKCHIP && DM_SERIAL diff --git a/include/debug_uart.h b/include/debug_uart.h index a6b7ce8..5d5349b 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -105,6 +105,12 @@ void printhex4(uint value); */ void printhex8(uint value);
+#ifdef CONFIG_DEBUG_UART_ANNOUNCE +#define _DEBUG_UART_ANNOUNCE printascii("<debug_uart> "); +#else +#define _DEBUG_UART_ANNOUNCE +#endif + /* * Now define some functions - this should be inserted into the serial driver */ @@ -151,6 +157,7 @@ void printhex8(uint value); { \ board_debug_uart_init(); \ _debug_uart_init(); \ + _DEBUG_UART_ANNOUNCE \ } \
#endif

On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
It is useful to see a message from the debug UART early during boot so that you know things are working. Add an option to enable this. The message will be displayed as soon as debug_uart_init() is called.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
drivers/serial/Kconfig | 10 ++++++++++ include/debug_uart.h | 7 +++++++ 2 files changed, 17 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 39f6500..ac5920a 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -120,6 +120,16 @@ config DEBUG_UART_BOARD_INIT here that is needed to set up the UART ready for use, such as set pin multiplexing or enable clocks.
+config DEBUG_UART_ANNOUNCE
bool "Show a message when the debug UART starts up"
depends on DEBUG_UART
help
Enable this option to show a message when the debug UART is ready
for use. You will see a message like "<debug_uart> " as soon as
U-Boot has the UART ready for use (i.e. your code calls
debug_uart_init()). This can be useful just as a check that
everything is working.
config ROCKCHIP_SERIAL bool "Rockchip on-chip UART support" depends on ARCH_ROCKCHIP && DM_SERIAL diff --git a/include/debug_uart.h b/include/debug_uart.h index a6b7ce8..5d5349b 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -105,6 +105,12 @@ void printhex4(uint value); */ void printhex8(uint value);
+#ifdef CONFIG_DEBUG_UART_ANNOUNCE +#define _DEBUG_UART_ANNOUNCE printascii("<debug_uart> "); +#else +#define _DEBUG_UART_ANNOUNCE +#endif
/*
- Now define some functions - this should be inserted into the serial driver
*/ @@ -151,6 +157,7 @@ void printhex8(uint value); { \ board_debug_uart_init(); \ _debug_uart_init(); \
_DEBUG_UART_ANNOUNCE \ } \
#endif
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On 18 October 2015 at 21:17, Bin Meng bmeng.cn@gmail.com wrote:
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
It is useful to see a message from the debug UART early during boot so that you know things are working. Add an option to enable this. The message will be displayed as soon as debug_uart_init() is called.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
drivers/serial/Kconfig | 10 ++++++++++ include/debug_uart.h | 7 +++++++ 2 files changed, 17 insertions(+)
[snip]
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Applied to u-boot-x86.

If the debug UART is enabled, get it ready for use at the earliest possible opportunity. This is not actually very early, but until we have a stack it is difficult to make it work.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Remove comment block since we now always enable the debug UART - Use a tab after the 'call' instruction
arch/x86/cpu/start.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index d072825..5b4ee79 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -126,14 +126,9 @@ car_init_ret: call board_init_f_mem mov %eax, %esp
- /* - * Debug UART is available here although it may not be plumbed out - * to pins depending on the board. To use it: - * - * call debug_uart_init - * mov $'a', %eax - * call printch - */ +#ifdef CONFIG_DEBUG_UART + call debug_uart_init +#endif
/* Get address of global_data */ mov %fs:0, %edx

On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
If the debug UART is enabled, get it ready for use at the earliest possible opportunity. This is not actually very early, but until we have a stack it is difficult to make it work.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Remove comment block since we now always enable the debug UART
- Use a tab after the 'call' instruction
arch/x86/cpu/start.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index d072825..5b4ee79 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -126,14 +126,9 @@ car_init_ret: call board_init_f_mem mov %eax, %esp
/*
* Debug UART is available here although it may not be plumbed out
* to pins depending on the board. To use it:
*
* call debug_uart_init
* mov $'a', %eax
* call printch
*/
+#ifdef CONFIG_DEBUG_UART
call debug_uart_init
+#endif
/* Get address of global_data */ mov %fs:0, %edx
--
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On 18 October 2015 at 21:17, Bin Meng bmeng.cn@gmail.com wrote:
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
If the debug UART is enabled, get it ready for use at the earliest possible opportunity. This is not actually very early, but until we have a stack it is difficult to make it work.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Remove comment block since we now always enable the debug UART
- Use a tab after the 'call' instruction
arch/x86/cpu/start.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
[snip]
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Applied to u-boot-x86.

Add support for the debug UART on link. This is useful for early debugging.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
arch/x86/cpu/ivybridge/cpu.c | 7 +++++++ configs/chromebook_link_defconfig | 4 ++++ 2 files changed, 11 insertions(+)
diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index cce5923..0e6512c 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -340,3 +340,10 @@ int print_cpuinfo(void)
return 0; } + +void board_debug_uart_init(void) +{ + /* This enables the debug UART */ + pci_x86_write_config(NULL, PCH_LPC_DEV, LPC_EN, COMA_LPC_EN, + PCI_SIZE_16); +} diff --git a/configs/chromebook_link_defconfig b/configs/chromebook_link_defconfig index fbecf8b..78a9470 100644 --- a/configs/chromebook_link_defconfig +++ b/configs/chromebook_link_defconfig @@ -22,6 +22,10 @@ CONFIG_CROS_EC_LPC=y CONFIG_SPI_FLASH=y CONFIG_DM_PCI=y CONFIG_DM_RTC=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_BASE=0x3f8 +CONFIG_DEBUG_UART_CLOCK=1843200 +CONFIG_DEBUG_UART_BOARD_INIT=y CONFIG_DM_TPM=y CONFIG_TPM_TIS_LPC=y CONFIG_VIDEO_VESA=y

On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
Add support for the debug UART on link. This is useful for early debugging.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
arch/x86/cpu/ivybridge/cpu.c | 7 +++++++ configs/chromebook_link_defconfig | 4 ++++ 2 files changed, 11 insertions(+)
diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index cce5923..0e6512c 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -340,3 +340,10 @@ int print_cpuinfo(void)
return 0;
}
+void board_debug_uart_init(void) +{
/* This enables the debug UART */
pci_x86_write_config(NULL, PCH_LPC_DEV, LPC_EN, COMA_LPC_EN,
PCI_SIZE_16);
+} diff --git a/configs/chromebook_link_defconfig b/configs/chromebook_link_defconfig index fbecf8b..78a9470 100644 --- a/configs/chromebook_link_defconfig +++ b/configs/chromebook_link_defconfig @@ -22,6 +22,10 @@ CONFIG_CROS_EC_LPC=y CONFIG_SPI_FLASH=y CONFIG_DM_PCI=y CONFIG_DM_RTC=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_BASE=0x3f8 +CONFIG_DEBUG_UART_CLOCK=1843200 +CONFIG_DEBUG_UART_BOARD_INIT=y CONFIG_DM_TPM=y CONFIG_TPM_TIS_LPC=y CONFIG_VIDEO_VESA=y --
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On 18 October 2015 at 21:18, Bin Meng bmeng.cn@gmail.com wrote:
On Mon, Oct 19, 2015 at 9:51 AM, Simon Glass sjg@chromium.org wrote:
Add support for the debug UART on link. This is useful for early debugging.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
arch/x86/cpu/ivybridge/cpu.c | 7 +++++++ configs/chromebook_link_defconfig | 4 ++++ 2 files changed, 11 insertions(+)
[snip]
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Applied to u-boot-x86.
participants (2)
-
Bin Meng
-
Simon Glass