summaryrefslogtreecommitdiff
path: root/drivers/cpu
diff options
context:
space:
mode:
authorSagar Shrikant Kadam <sagar.kadam@sifive.com>2020-06-28 07:45:01 -0700
committerAndes <uboot@andestech.com>2020-07-01 15:01:27 +0800
commit969251a5a4d3515abc233621bc8ca6f1c93d6dd4 (patch)
treec8fbd68e7b55c00efd635f41a4d8b3774ff6d1aa /drivers/cpu
parenteb75ee4bd63cbd3b9dd0a0696f1457fb38c22024 (diff)
downloadu-boot-969251a5a4d3515abc233621bc8ca6f1c93d6dd4.tar.gz
u-boot-969251a5a4d3515abc233621bc8ca6f1c93d6dd4.tar.bz2
u-boot-969251a5a4d3515abc233621bc8ca6f1c93d6dd4.zip
uclass: cpu: fix to display proper CPU features
The cmd "cpu detail" fetches uninitialized cpu feature information and thus displays wrong / inconsitent details as below. For eg: FU540-C000 doesn't have any microcode, yet the cmd display's it. => cpu detail 1: cpu@1 rv64imafdc ID = 1, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 2: cpu@2 rv64imafdc ID = 2, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 3: cpu@3 rv64imafdc ID = 3, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 4: cpu@4 rv64imafdc ID = 4, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 The L1 cache or MMU entry seen above is also displayed inconsistently. So initialize cpu information to zero into cpu-uclass itself so that similar issues can be avoided for other CPU drivers. We now see correct features as: => cpu detail 1: cpu@1 rv64imafdc ID = 1, freq = 999.100 MHz 2: cpu@2 rv64imafdc ID = 2, freq = 999.100 MHz 3: cpu@3 rv64imafdc ID = 3, freq = 999.100 MHz 4: cpu@4 rv64imafdc ID = 4, freq = 999.100 MHz Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com> Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Bin Meng <bin.meng@windriver.com>
Diffstat (limited to 'drivers/cpu')
-rw-r--r--drivers/cpu/cpu-uclass.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c
index 7418c26ed8..cbb4419ec0 100644
--- a/drivers/cpu/cpu-uclass.c
+++ b/drivers/cpu/cpu-uclass.c
@@ -86,6 +86,9 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info)
if (!ops->get_info)
return -ENOSYS;
+ /* Init cpu_info to 0 */
+ memset(info, 0, sizeof(struct cpu_info));
+
return ops->get_info(dev, info);
}