From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 11:46:05 +0000 (+0100) Subject: smbios: provide type 4 RISC-V SMBIOS Processor ID X-Git-Url: http://git.dujemihanovic.xyz/posts?a=commitdiff_plain;h=545e0e42b966751da48117820891356ccf47baf1;p=u-boot.git smbios: provide type 4 RISC-V SMBIOS Processor ID For RISC-V CPUs the SMBIOS Processor ID field contains the Machine Vendor ID from CSR mvendorid. Signed-off-by: Heinrich Schuchardt --- diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c index a9b253719f..5d1026b37d 100644 --- a/drivers/cpu/riscv_cpu.c +++ b/drivers/cpu/riscv_cpu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -94,13 +95,24 @@ static int riscv_cpu_bind(struct udevice *dev) struct cpu_plat *plat = dev_get_parent_plat(dev); struct driver *drv; int ret; + long mvendorid; /* save the hart id */ plat->cpu_id = dev_read_addr(dev); + /* provide data for SMBIOS */ if (IS_ENABLED(CONFIG_64BIT)) plat->family = 0x201; else plat->family = 0x200; + if (CONFIG_IS_ENABLED(RISCV_SMODE)) { + /* + * For RISC-V CPUs the SMBIOS Processor ID field contains + * the Machine Vendor ID from CSR mvendorid. + */ + ret = sbi_get_mvendorid(&mvendorid); + if (!ret) + plat->id[0] = mvendorid; + } /* first examine the property in current cpu node */ ret = dev_read_u32(dev, "timebase-frequency", &plat->timebase_freq); /* if not found, then look at the parent /cpus node */