From f68f62622239833ef214930c33d45409a616babe Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 2 Aug 2025 00:57:05 -0400 Subject: kernel: dmi: Add dmi_cpu_version() Add DMI helper to grab processor version string Signed-off-by: Ian Moffett --- sys/dev/dmi/dmi.c | 19 +++++++++++++++++++ sys/include/dev/dmi/dmi.h | 1 + 2 files changed, 20 insertions(+) (limited to 'sys') diff --git a/sys/dev/dmi/dmi.c b/sys/dev/dmi/dmi.c index 84288cf..dc4b363 100644 --- a/sys/dev/dmi/dmi.c +++ b/sys/dev/dmi/dmi.c @@ -48,6 +48,7 @@ #define SYSINFO_PRODUCT 0x02 #define SYSINFO_FAMILY 0x03 #define PROCINFO_MANUFACT 0x02 +#define PROCINFO_VERSION 0x03 #define PROCINFO_PARTNO 0x06 static struct limine_smbios_request smbios_req = { @@ -198,6 +199,24 @@ dmi_cpu_manufact(void) return dmi_str_index(hdr, PROCINFO_MANUFACT); } +/* + * Return the CPU version string from the + * DMI/SMBIOS Processor Info structure + * + * Returns NULL if not found + */ +const char * +dmi_cpu_version(void) +{ + struct dmi_shdr *hdr; + + if ((hdr = dmi_shdr(DMI_PROCESSOR_INFO)) == NULL) { + return NULL; + } + + return dmi_str_index(hdr, PROCINFO_VERSION); +} + static int dmi_init(void) { diff --git a/sys/include/dev/dmi/dmi.h b/sys/include/dev/dmi/dmi.h index d24397a..a8f60d4 100644 --- a/sys/include/dev/dmi/dmi.h +++ b/sys/include/dev/dmi/dmi.h @@ -36,5 +36,6 @@ const char *dmi_vendor(void); const char *dmi_prodver(void); const char *dmi_product(void); const char *dmi_cpu_manufact(void); +const char *dmi_cpu_version(void); #endif /* !_DMI_DMI_H_ */ -- cgit v1.2.3