[U-Boot] [PATCH v6 3/5] generic board patch of manual reloc and zero gd_t

Wolfgang Denk wd at denx.de
Mon Sep 9 16:21:59 CEST 2013


Dear fenghua at phytium.com.cn,

In message <1378734616-37558-4-git-send-email-fenghua at phytium.com.cn> you wrote:
> From: David Feng <fenghua at phytium.com.cn>
> 
> 1. function board_init_f in board_f.c should firstly zero gd_t structure
>    before it call initcall_run_list, otherwise the debug print will go run
>    if DEBUG is defined. Because the printf function will use global data
>    to determine whether serial port is initialized and could be written.
> 2. function board_init_r in board_r.c should firstly relocate init_sequence_r
>    table before it call initcall_run_list. Command table also should be relocated.

Please restrict the line length of your commit messages to some 70
characters or so.

> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -458,7 +458,11 @@ static int reserve_round_4k(void)
>  static int reserve_mmu(void)
>  {
>  	/* reserve TLB table */
> +#ifndef CONFIG_ARMV8
>  	gd->arch.tlb_size = 4096 * 4;
> +#else
> +	gd->arch.tlb_size = 0x10000;
> +#endif
>  	gd->relocaddr -= gd->arch.tlb_size;

Please avoid such #ifdef's in the code.  Replace the hard coded
default (here 0x10000) by a variable, and define these as needed.

> -#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
> -		!defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
> -		!defined(CONFIG_MPC86xx) && !defined(CONFIG_X86)
> -	zero_global_data,
> -#endif
>  #ifdef CONFIG_SANDBOX
>  	setup_ram_buf,
>  #endif
> @@ -1005,6 +1004,14 @@ void board_init_f(ulong boot_flags)
>  	gd = &data;
>  #endif
>  
> +	/*
> +	 * Zero gd_t first, otherwise the debug print in initcall_run_list
> +	 * function before zero_global_data is called will go wrong.
> +	 */
> +#ifndef CONFIG_X86
> +	zero_global_data();
> +#endif

This change does not look right to me.  The condition was much
different before.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Any fool can make things bigger, more complex, and more  violent.  It
takes  a  touch  of  genius  -  and a lot of courage - to move in the
opposite direction.                                 - Albert Einstein


More information about the U-Boot mailing list