From 5d6c61ac404c5c7c463ea6ee216145f29a603f60 Mon Sep 17 00:00:00 2001 From: Mario Six Date: Mon, 6 Aug 2018 10:23:41 +0200 Subject: board_f: Use static print_cpuinfo if CONFIG_CPU is active 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 Signed-off-by: Mario Six Changed condition to CONFIG_IS_ENABLED(CPU): Signed-off-by: Simon Glass --- common/board_f.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'common/board_f.c') diff --git a/common/board_f.c b/common/board_f.c index afafec5e4d..213d044066 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -165,6 +166,33 @@ static int print_resetinfo(void) } #endif +#if defined(CONFIG_DISPLAY_CPUINFO) && CONFIG_IS_ENABLED(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: "); -- cgit v1.2.3 From ecfe66330d3093b701a26363470c0b6a32a02d89 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 10 Oct 2018 22:06:55 -0700 Subject: dm: cpu: Fix print_cpuinfo() output It was observed that current output of print_cpuinfo() on QEMU x86 targets does not have an ending '\n', neither have a leading 'CPU:' any more. However it used to have these before. It turns out commit c0434407b595 introduced a unified DM version of print_cpuinfo() that exposed such issue on QEMU x86. Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active") Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/board_f.c') diff --git a/common/board_f.c b/common/board_f.c index 213d044066..96503ff8d3 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -187,7 +187,7 @@ static int print_cpuinfo(void) return ret; } - printf("%s", desc); + printf("CPU: %s\n", desc); return 0; } -- cgit v1.2.3