From 144bb7e00836f2e0d9a150f6cd4c364b97af8d52 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 15 Mar 2023 08:20:52 +0000 Subject: [PATCH] store bios version, needed for amdgpu Steam Deck quirk --- sys/arch/amd64/amd64/bios.c | 15 +++++++++++---- sys/arch/i386/i386/bios.c | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c index 038bc89c71b..3a264d09d5b 100644 --- a/sys/arch/amd64/amd64/bios.c +++ b/sys/arch/amd64/amd64/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.46 2022/10/16 15:03:39 kettenis Exp $ */ +/* $OpenBSD: bios.c,v 1.47 2023/03/15 08:20:52 jsg Exp $ */ /* * Copyright (c) 2006 Gordon Willem Klok * @@ -63,6 +63,7 @@ const char *smbios_uninfo[] = { }; char smbios_bios_date[64]; +char smbios_bios_version[64]; char smbios_board_vendor[64]; char smbios_board_prod[64]; char smbios_board_serial[64]; @@ -138,9 +139,15 @@ bios_attach(struct device *parent, struct device *self, void *aux) printf(" vendor %s", fixstring(scratch)); if ((smbios_get_string(&bios, sb->version, - scratch, sizeof(scratch))) != NULL) - printf(" version \"%s\"", - fixstring(scratch)); + scratch, sizeof(scratch))) != NULL) { + sminfop = fixstring(scratch); + if (sminfop != NULL) { + strlcpy(smbios_bios_version, + sminfop, + sizeof(smbios_bios_version)); + printf(" version \"%s\"", sminfop); + } + } if ((smbios_get_string(&bios, sb->release, scratch, sizeof(scratch))) != NULL) { sminfop = fixstring(scratch); diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index f0cfa72b8ba..347f56fa3b2 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.128 2023/01/30 10:49:04 jsg Exp $ */ +/* $OpenBSD: bios.c,v 1.129 2023/03/15 08:20:52 jsg Exp $ */ /* * Copyright (c) 1997-2001 Michael Shalayeff @@ -125,6 +125,7 @@ const char *smbios_uninfo[] = { char smbios_bios_date[64]; +char smbios_bios_version[64]; char smbios_board_vendor[64]; char smbios_board_prod[64]; char smbios_board_serial[64]; @@ -291,9 +292,16 @@ biosattach(struct device *parent, struct device *self, void *aux) printf(" vendor %s", fixstring(scratch)); if ((smbios_get_string(&bios, sb->version, - scratch, sizeof(scratch))) != NULL) - printf(" version \"%s\"", - fixstring(scratch)); + scratch, sizeof(scratch))) != NULL) { + sminfop = fixstring(scratch); + if (sminfop != NULL) { + strlcpy(smbios_bios_version, + sminfop, + sizeof(smbios_bios_version)); + printf(" version \"%s\"", + sminfop); + } + } if ((smbios_get_string(&bios, sb->release, scratch, sizeof(scratch))) != NULL) { sminfop = fixstring(scratch); -- 2.20.1