[U-Boot] [PATCH v4 12/17] board_f: Use static print_cpuinfo if CONFIG_CPU is active

Stefan Roese sr at denx.de
Fri Oct 12 14:00:33 UTC 2018


Hi!

I just tested the latest U-Boot version on one of my x86
platforms (Baytrail theadorable-x86-dfi-bt700_defconfig).
Unfortunately this patch break the board port, resulting in
this output:

U-Boot 2018.11-rc1-00268-g1f7888b626 (Oct 12 2018 - 15:23:52 +0200)

initcall sequence fff5aa40 failed at call fff129bc (err=-19)
### ERROR ### Please RESET the board ###

This is related to the fact that this platform does not support
a proper DM CPU driver. When I revert this patch, all is fine
again:

U-Boot 2018.11-rc1-00269-g82e3eecc2b (Oct 12 2018 - 15:50:36 +0200)

CPU: x86_64, vendor Intel, device 30679h
DRAM:  4 GiB
MMC:   pci_mmc: 0, pci_mmc: 1, pci_mmc: 2
Loading Environment from SPI Flash... SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB
OK
Model: theadorable-x86-DFI-BT700
...

How should we proceed with this patch. Since multiple boards /
platforms could be affected (I remember this also hitting me
with my latest MIPS port), we should probably revert this patch
for this upcoming release.

Thoughts?

Thanks,
Stefan

On 06.08.2018 10:23, Mario Six 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.
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Signed-off-by: Mario Six <mario.six at gdsys.cc>
> ---
> 
> Notes:
>      v3 -> v4:
>      * Print error if CPU description could not be retrieved
>      * Improved error handling and debug reporting
>      * Added documentation
>      
>      v2 -> v3:
>      No changes
>      
>      v1 -> v2:
>      New in v2
> 
>   common/board_f.c | 28 ++++++++++++++++++++++++++++
>   include/init.h   |  7 +++++++
>   2 files changed, 35 insertions(+)
> 
> diff --git a/common/board_f.c b/common/board_f.c
> index afafec5e4d0..fcc89df8160 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,33 @@ 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];
> +	int ret;
> +
> +	ret = uclass_first_device_err(UCLASS_CPU, &dev);
> +	if (ret) {
> +		debug("%s: Could not get CPU device (err = %d)\n",
> +		      __func__, ret);
> +		return ret;
> +	}
> +
> +	ret = cpu_get_desc(dev, desc, sizeof(desc));
> +	if (ret) {
> +		debug("%s: Could not get CPU description (err = %d)\n",
> +		      dev->name, ret);
> +		return ret;
> +	}
> +
> +	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 a58d7a6917f..a76d747b035 100644
> --- a/include/init.h
> +++ b/include/init.h
> @@ -109,7 +109,14 @@ int arch_reserve_stacks(void);
>    */
>   int init_cache_f_r(void);
>   
> +#ifndef CONFIG_CPU
> +/**
> + * print_cpuinfo() - Display information about the CPU
> + *
> + * Return: 0 if OK, -ve on error
> + */
>   int print_cpuinfo(void);
> +#endif
>   int timer_init(void);
>   int reserve_mmu(void);
>   int misc_init_f(void);
> 

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list