store bios version, needed for amdgpu Steam Deck quirk
authorjsg <jsg@openbsd.org>
Wed, 15 Mar 2023 08:20:52 +0000 (08:20 +0000)
committerjsg <jsg@openbsd.org>
Wed, 15 Mar 2023 08:20:52 +0000 (08:20 +0000)
sys/arch/amd64/amd64/bios.c
sys/arch/i386/i386/bios.c

index 038bc89..3a264d0 100644 (file)
@@ -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 <gklok@cogeco.ca>
  *
@@ -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);
index f0cfa72..347f56f 100644 (file)
@@ -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);