From owner-dev-commits-src-branches@freebsd.org Mon Jun 28 16:02:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E7116586C9; Mon, 28 Jun 2021 16:02:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GDC6g1M5Gz3hGC; Mon, 28 Jun 2021 16:02:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15D4F53E; Mon, 28 Jun 2021 16:02:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15SG2IQb042068; Mon, 28 Jun 2021 16:02:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15SG2IUi042067; Mon, 28 Jun 2021 16:02:18 GMT (envelope-from git) Date: Mon, 28 Jun 2021 16:02:18 GMT Message-Id: <202106281602.15SG2IUi042067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Tuffli Subject: git: 0e6ba563384f - stable/13 - bhyve: add SMBIOS Baseboard Information MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0e6ba563384fb41518648009b391b26d9a3824c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 16:02:19 -0000 The branch stable/13 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=0e6ba563384fb41518648009b391b26d9a3824c0 commit 0e6ba563384fb41518648009b391b26d9a3824c0 Author: Chuck Tuffli AuthorDate: 2021-04-12 15:09:52 +0000 Commit: Chuck Tuffli CommitDate: 2021-06-28 15:48:26 +0000 bhyve: add SMBIOS Baseboard Information Add the System Management BIOS Baseboard (or Module) Information a.k.a. Type 2 structure to the SMBIOS emulation. (cherry picked from commit 0c6282e842b33a1c86e01b27fc40af9c76fd404e) --- usr.sbin/bhyve/smbiostbl.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c index d9f8a649c710..24ebf2838371 100644 --- a/usr.sbin/bhyve/smbiostbl.c +++ b/usr.sbin/bhyve/smbiostbl.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #define SMBIOS_TYPE_BIOS 0 #define SMBIOS_TYPE_SYSTEM 1 +#define SMBIOS_TYPE_BOARD 2 #define SMBIOS_TYPE_CHASSIS 3 #define SMBIOS_TYPE_PROCESSOR 4 #define SMBIOS_TYPE_MEMARRAY 16 @@ -156,10 +157,31 @@ struct smbios_table_type1 { uint8_t family; /* family name string */ } __packed; +/* + * Baseboard (or Module) Information + */ +#define SMBIOS_BRF_HOSTING 0x1 +#define SMBIOS_BRT_MOTHERBOARD 0xa + +struct smbios_table_type2 { + struct smbios_structure header; + uint8_t manufacturer; /* manufacturer string */ + uint8_t product; /* product name string */ + uint8_t version; /* version string */ + uint8_t serial; /* serial number string */ + uint8_t asset; /* asset tag string */ + uint8_t fflags; /* feature flags */ + uint8_t location; /* location in chassis */ + uint16_t chandle; /* chassis handle */ + uint8_t type; /* board type */ + uint8_t n_objs; /* number of contained object handles */ +} __packed; + /* * System Enclosure or Chassis */ #define SMBIOS_CHT_UNKNOWN 0x02 /* unknown */ +#define SMBIOS_CHT_DESKTOP 0x03 /* desktop */ #define SMBIOS_CHST_SAFE 0x03 /* safe */ @@ -359,6 +381,30 @@ const char *smbios_type1_strings[] = { NULL }; +struct smbios_table_type2 smbios_type2_template = { + { SMBIOS_TYPE_BOARD, sizeof (struct smbios_table_type2), 0 }, + 1, /* manufacturer string */ + 2, /* product string */ + 3, /* version string */ + 4, /* serial number string */ + 5, /* asset tag string */ + SMBIOS_BRF_HOSTING, /* feature flags */ + 6, /* location string */ + SMBIOS_CHT_DESKTOP, /* chassis handle */ + SMBIOS_BRT_MOTHERBOARD, /* board type */ + 0 +}; + +const char *smbios_type2_strings[] = { + "FreeBSD", /* manufacturer string */ + "BHYVE", /* product name string */ + "1.0", /* version string */ + "None", /* serial number string */ + "None", /* asset tag string */ + "None", /* location string */ + NULL +}; + struct smbios_table_type3 smbios_type3_template = { { SMBIOS_TYPE_CHASSIS, sizeof (struct smbios_table_type3), 0 }, 1, /* manufacturer string */ @@ -517,6 +563,9 @@ static struct smbios_template_entry smbios_template[] = { { (struct smbios_structure *)&smbios_type1_template, smbios_type1_strings, smbios_type1_initializer }, + { (struct smbios_structure *)&smbios_type2_template, + smbios_type2_strings, + smbios_generic_initializer }, { (struct smbios_structure *)&smbios_type3_template, smbios_type3_strings, smbios_generic_initializer },