[U-Boot] [PATCH] x86: WIP: Enable debug UART for Minnowmax

Lukasz Majewski l.majewski at samsung.com
Mon Jun 8 09:49:02 CEST 2015


Hi Simon,

> Enable the debug UART and emit a single 'a' early in the init
> sequence to show that it is working.
> 
> Unfortunately the debug UART implementation needs a stack to work. I
> cannot seem to remove this limitation as the absolute 'jmp %eax'
> instruction goes off into the weeds.
> 
> So this means that the character output cannot be any earlier than
> car_init_ret, where memory is available for a stack.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  arch/x86/cpu/start.S        |  4 ++++
>  configs/minnowmax_defconfig |  4 ++++
>  include/debug_uart.h        | 20 ++++++++++----------
>  3 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
> index 2e5f9da..c6965b2 100644
> --- a/arch/x86/cpu/start.S
> +++ b/arch/x86/cpu/start.S
> @@ -109,6 +109,10 @@ car_init_ret:
>  	andl	$0xfffffff0, %esp
>  	post_code(POST_START_STACK)
>  
> +	call	debug_uart_init
> +	mov	$'a', %eax
> +	call	printch
> +
>  	/* Zero the global data since it won't happen later */
>  	xorl	%eax, %eax
>  	movl	$GENERATED_GBL_DATA_SIZE, %ecx
> diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig
> index 744aca3..14e21fa 100644
> --- a/configs/minnowmax_defconfig
> +++ b/configs/minnowmax_defconfig
> @@ -12,3 +12,7 @@ CONFIG_CMD_CPU=y
>  CONFIG_CMD_NET=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_CPU=y
> +CONFIG_DEBUG_UART=y
> +CONFIG_DEBUG_UART_NS16550=y
> +CONFIG_DEBUG_UART_BASE=0x3f8
> +CONFIG_DEBUG_UART_CLOCK=1843200
> diff --git a/include/debug_uart.h b/include/debug_uart.h
> index f56797b..0acc91c 100644
> --- a/include/debug_uart.h
> +++ b/include/debug_uart.h
> @@ -64,46 +64,46 @@ void debug_uart_init(void);
>   *
>   * @ch:		Character to output
>   */
> -asmlinkage void printch(int ch);
> +void printch(int ch);
>  
>  /**
>   * printascii() - Output an ASCII string to the debug UART
>   *
>   * @str:	String to output
>   */
> -asmlinkage void printascii(const char *str);
> +void printascii(const char *str);
>  
>  /**
>   * printhex2() - Output a 2-digit hex value
>   *
>   * @value:	Value to output
>   */
> -asmlinkage void printhex2(uint value);
> +void printhex2(uint value);
>  
>  /**
>   * printhex4() - Output a 4-digit hex value
>   *
>   * @value:	Value to output
>   */
> -asmlinkage void printhex4(uint value);
> +void printhex4(uint value);
>  
>  /**
>   * printhex8() - Output a 8-digit hex value
>   *
>   * @value:	Value to output
>   */
> -asmlinkage void printhex8(uint value);
> +void printhex8(uint value);
>  
>  /*
>   * Now define some functions - this should be inserted into the
> serial driver */
>  #define DEBUG_UART_FUNCS \
> -	asmlinkage void printch(int ch) \
> +	void printch(int ch) \
>  	{ \
>  		_debug_uart_putc(ch); \
>  	} \
>  \
> -	asmlinkage void printascii(const char *str) \
> +	void printascii(const char *str) \
>  	{ \
>  		while (*str) \
>  			_debug_uart_putc(*str++); \
> @@ -121,17 +121,17 @@ asmlinkage void printhex8(uint value);
>  			printhex1(value >> (4 * digits)); \
>  	} \
>  \
> -	asmlinkage void printhex2(uint value) \
> +	void printhex2(uint value) \
>  	{ \
>  		printhex(value, 2); \
>  	} \
>  \
> -	asmlinkage void printhex4(uint value) \
> +	void printhex4(uint value) \
>  	{ \
>  		printhex(value, 4); \
>  	} \
>  \
> -	asmlinkage void printhex8(uint value) \
> +	void printhex8(uint value) \
>  	{ \
>  		printhex(value, 8); \
>  	}

This is not quite my domain :-) (Although, I'd like to have a
Minnowmax for testing).

Reviewed-by: Lukasz Majewski <l.majewski at samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list