diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-10-23 10:14:47 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-10-23 10:14:47 +0000 |
commit | 82824f615c4ad647de0609478d6c10bd9a97b684 (patch) | |
tree | 72b23af92c4847458cf34a541aabf846cb6241a5 /sys/arch | |
parent | 8d47f618b1c0acab1a832a81bec93239f772c2ba (diff) |
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.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/bios.c | 32 | ||||
-rw-r--r-- | sys/arch/arm64/dev/smbios.c | 32 | ||||
-rw-r--r-- | sys/arch/i386/i386/bios.c | 33 |
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 |