Skip to content

Commit

Permalink
smbios: provide type 4 RISC-V SMBIOS Processor ID
Browse files Browse the repository at this point in the history
For RISC-V CPUs the SMBIOS Processor ID field contains
the Machine Vendor ID from CSR mvendorid.

Signed-off-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
xypron committed Feb 2, 2024
1 parent 6ebf913 commit 545e0e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/cpu/riscv_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <errno.h>
#include <log.h>
#include <asm/global_data.h>
#include <asm/sbi.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <linux/bitops.h>
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 545e0e4

Please sign in to comment.