summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2019-10-23 10:14:46 +0000
committerjsg <jsg@openbsd.org>2019-10-23 10:14:46 +0000
commit1b5f5271ff1812c82fd7265ed1c784d6f6a84cc2 (patch)
tree18d3d0fb3336aadb67e595cc9657b605294b5a82
parentProvide hw.serialno using the root node's serial-number property. (diff)
downloadwireguard-openbsd-1b5f5271ff1812c82fd7265ed1c784d6f6a84cc2.tar.xz
wireguard-openbsd-1b5f5271ff1812c82fd7265ed1c784d6f6a84cc2.zip
store specific strings for smbios baseboard vendor, product and serial
Often vendor and product strings will match for system information and baseboard but in the case of the GPD Pocket system information vendor is 'Default string' and baseboard information vendor is expected to be 'AMI Corporation'. This is needed for a drm panel orientation quirk.
-rw-r--r--sys/arch/amd64/amd64/bios.c32
-rw-r--r--sys/arch/arm64/dev/smbios.c32
-rw-r--r--sys/arch/i386/i386/bios.c33
3 files changed, 91 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c
index e0d0a951c29..f5a3359b9ea 100644
--- a/sys/arch/amd64/amd64/bios.c
+++ b/sys/arch/amd64/amd64/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.40 2019/08/04 14:28:58 kettenis Exp $ */
+/* $OpenBSD: bios.c,v 1.41 2019/10/23 10:14:46 jsg Exp $ */
/*
* Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca>
*
@@ -68,6 +68,9 @@ const char *smbios_uninfo[] = {
};
char smbios_bios_date[64];
+char smbios_board_vendor[64];
+char smbios_board_prod[64];
+char smbios_board_serial[64];
int
bios_match(struct device *parent, void *match , void *aux)
@@ -384,8 +387,33 @@ smbios_info(char *str)
havebb = smbios_find_table(SMBIOS_TYPE_BASEBOARD, &btbl);
sys = (struct smbios_sys *)stbl.tblhdr;
- if (havebb)
+ if (havebb) {
board = (struct smbios_board *)btbl.tblhdr;
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->vendor,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_vendor, sminfop,
+ sizeof(smbios_board_vendor));
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->product,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_prod, sminfop,
+ sizeof(smbios_board_prod));
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->serial,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_serial, sminfop,
+ sizeof(smbios_board_serial));
+ }
/*
* Some smbios implementations have no system vendor or
* product strings, some have very uninformative data which is
diff --git a/sys/arch/arm64/dev/smbios.c b/sys/arch/arm64/dev/smbios.c
index d9e9d906a63..0bde7ae2c04 100644
--- a/sys/arch/arm64/dev/smbios.c
+++ b/sys/arch/arm64/dev/smbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smbios.c,v 1.3 2019/08/04 14:28:58 kettenis Exp $ */
+/* $OpenBSD: smbios.c,v 1.4 2019/10/23 10:14:46 jsg Exp $ */
/*
* Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca>
* Copyright (c) 2019 Mark Kettenis <kettenis@openbsd.org>
@@ -42,6 +42,9 @@ const char *smbios_uninfo[] = {
};
char smbios_bios_date[64];
+char smbios_board_vendor[64];
+char smbios_board_prod[64];
+char smbios_board_serial[64];
void smbios_info(char *);
char *fixstring(char *);
@@ -292,8 +295,33 @@ smbios_info(char *str)
havebb = smbios_find_table(SMBIOS_TYPE_BASEBOARD, &btbl);
sys = (struct smbios_sys *)stbl.tblhdr;
- if (havebb)
+ if (havebb) {
board = (struct smbios_board *)btbl.tblhdr;
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->vendor,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_vendor, sminfop,
+ sizeof(smbios_board_vendor));
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->product,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_prod, sminfop,
+ sizeof(smbios_board_prod));
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->serial,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_serial, sminfop,
+ sizeof(smbios_board_serial));
+ }
/*
* Some smbios implementations have no system vendor or
* product strings, some have very uninformative data which is
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index 13980f7c21c..278c5c58e48 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.123 2019/08/04 14:28:58 kettenis Exp $ */
+/* $OpenBSD: bios.c,v 1.124 2019/10/23 10:14:46 jsg Exp $ */
/*
* Copyright (c) 1997-2001 Michael Shalayeff
@@ -141,6 +141,9 @@ const char *smbios_uninfo[] = {
char smbios_bios_date[64];
+char smbios_board_vendor[64];
+char smbios_board_prod[64];
+char smbios_board_serial[64];
int
biosprobe(struct device *parent, void *match, void *aux)
@@ -962,8 +965,34 @@ smbios_info(char *str)
havebb = smbios_find_table(SMBIOS_TYPE_BASEBOARD, &btbl);
sys = (struct smbios_sys *)stbl.tblhdr;
- if (havebb)
+ if (havebb) {
board = (struct smbios_board *)btbl.tblhdr;
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->vendor,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_vendor, sminfop,
+ sizeof(smbios_board_vendor));
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->product,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_prod, sminfop,
+ sizeof(smbios_board_prod));
+
+ sminfop = NULL;
+ if ((p = smbios_get_string(&btbl, board->serial,
+ sminfo, sizeof(sminfo))) != NULL)
+ sminfop = fixstring(p);
+ if (sminfop)
+ strlcpy(smbios_board_serial, sminfop,
+ sizeof(smbios_board_serial));
+ }
+
/*
* Some smbios implementations have no system vendor or
* product strings, some have very uninformative data which is