[U-Boot] [PATCH v3 09/11] board_f: Use static print_cpuinfo if CONFIG_CPU is active

Simon Glass sjg at chromium.org
Fri May 25 02:42:10 UTC 2018


Hi Mario,

On 24 May 2018 at 02:42, Mario Six <mario.six at gdsys.cc> wrote:
> When the DM CPU drivers are active, printing information about a CPU
> should be delegated to a matching driver.
>
> Hence, add a static print_cpuinfo that implements this delegation when
> DM CPU drivers are active.
>
> Signed-off-by: Mario Six <mario.six at gdsys.cc>
>
> ---
>
> v2 -> v3:
> No changes
>
> v1 -> v2:
> New in v2
>
> ---
>  common/board_f.c | 16 ++++++++++++++++
>  include/init.h   |  2 ++
>  2 files changed, 18 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>

See below

>
> diff --git a/common/board_f.c b/common/board_f.c
> index a716eeb8990..327c7d83e2c 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -11,6 +11,7 @@
>
>  #include <common.h>
>  #include <console.h>
> +#include <cpu.h>
>  #include <dm.h>
>  #include <environment.h>
>  #include <fdtdec.h>
> @@ -165,6 +166,21 @@ static int print_resetinfo(void)
>  }
>  #endif
>
> +#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_CPU)
> +static int print_cpuinfo(void)
> +{
> +       struct udevice *dev;
> +       char desc[512];
> +
> +       uclass_first_device_err(UCLASS_CPU, &dev);
> +
> +       cpu_get_desc(dev, desc, sizeof(desc));

If this returns an error, I think you should print the error instead

> +       printf("%s", desc);
> +
> +       return 0;
> +}
> +#endif
> +
>  static int announce_dram_init(void)
>  {
>         puts("DRAM:  ");
> diff --git a/include/init.h b/include/init.h
> index f114a889631..38c9680c7a7 100644
> --- a/include/init.h
> +++ b/include/init.h
> @@ -107,7 +107,9 @@ int arch_reserve_stacks(void);
>   */
>  int init_cache_f_r(void);
>
> +#ifndef CONFIG_CPU
>  int print_cpuinfo(void);
> +#endif
>  int timer_init(void);
>  int reserve_mmu(void);
>  int misc_init_f(void);
> --
> 2.11.0
>

Regards,
SImon


More information about the U-Boot mailing list