public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] x86: WIP: Enable debug UART for Minnowmax
Date: Mon, 08 Jun 2015 09:49:02 +0200	[thread overview]
Message-ID: <20150608094902.533fbd4a@amdc2363> (raw)
In-Reply-To: <1433342437-23332-1-git-send-email-sjg@chromium.org>

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@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@samsung.com>

-- 
Best regards,

Lukasz Majewski

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

      reply	other threads:[~2015-06-08  7:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 14:40 [U-Boot] [PATCH] x86: WIP: Enable debug UART for Minnowmax Simon Glass
2015-06-08  7:49 ` Lukasz Majewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150608094902.533fbd4a@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox