From nobody Fri Sep 02 11:19:46 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MJwRk48Vyz4bmWy; Fri, 2 Sep 2022 11:19:46 +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 4MJwRk3Lkdz401G; Fri, 2 Sep 2022 11:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662117586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iMAs1iEhq/t8U3f9EZrm8dVfLBDO+MwX7cd2NfQA1P0=; b=IBWWJ4Xh8bMrlSrzW3EA1c2IQ0xOYaQVpAvgK4ZQhP7tXspaJJglbkUCkc7YR78HZZ2kC9 nmuHisfJwCoF5+RgWhn8HOcN/SUVeZV/XV9a/5LnIXqce7gn6Eqo33wHBLeUqNXEUdKN2Q jGu+3RPFSvYFO02kPeoQvFJoCDlIaDA0yRW5/f2U/7UbUsRu+JDux+1Ga0v1TGJuQWaqLl sytAoPeyzVOSJ/YTyJMgkaiXmVAo/1XkaHXYQempopXQQ5NsF0EvcJFL3mwgQlvzdgxyG+ 03cUIwB6Y5HDKyPYv98eFrRa596qPMt/9EALQv2VeDyqzqgkac80GOFPFVHk5A== 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 4MJwRk27MLznjm; Fri, 2 Sep 2022 11:19:46 +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 282BJkIc046167; Fri, 2 Sep 2022 11:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 282BJkNE046166; Fri, 2 Sep 2022 11:19:46 GMT (envelope-from git) Date: Fri, 2 Sep 2022 11:19:46 GMT Message-Id: <202209021119.282BJkNE046166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Kornel=20Dul=C4=99ba?= Subject: git: 66c73af7ea59 - main - stand: Parse BIOS revision from SMBIOS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66c73af7ea59382ce5ca7cfb2eedb0491790276c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662117586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iMAs1iEhq/t8U3f9EZrm8dVfLBDO+MwX7cd2NfQA1P0=; b=OQi5D7Aesd2FP1NGKiTE4Ad9+C+eDoFnPx/ATVIRlbsyoiKPtOreCOiQ8ojRnkIIZCAktd 1uR8KSbda4GZpYqI95//ys/AyDoOcu8Xave7hwIyAS6vvLt70Qo7bib7ZpT894XO3QBfVS LSy4mX3mYaRYHwwxO0zuVUhV7UAGyv9hqWLfBaasSY/AaOiBLM6l9oMqBKNtypzX8YKIvp twxVyXMMRjHVT71TaD3ZxWYKcwoS2EFvHe/hJVRAqOspNTTJ3JTvKC76YwsQ0i0DdVOHKg ze7zGnZ6VVddrb1nLxp5JqCQqdxZRV+QDDK0e2IiOGHvcP511CEJqNp2mth6Og== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662117586; a=rsa-sha256; cv=none; b=uLkhkQVKQYaQGF+pmeLd1rjLgu/5O1g5HFWwk+SZaMn9mn4X4P3fT6hQSyj1EL/8bXK7u1 su/vsOa4dPbcie88khumr1veFbOrIKIXoqYKefvrmS5CX1ZnWSU8RN4GxWJojSz7VUr0CF fqL1/+oUcW2jKtydFrEyrM9aWxV4y4Ukauey6zao460Sx010GqTLI6Z+8KJ04sgrjirvf/ eNnUzkwaHQOpvKZD7N8f0G9q0kbaeb3krm8HmQ06Rfyz3hDZfc/Pl8j8/h56SBjfaqi/o+ Jd1dpkoU97TNGPMd6TdKewVhc+jlC6ZEiHl2X8fxbbzGtOFI+AZiLWVE5xYSmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kd: URL: https://cgit.FreeBSD.org/src/commit/?id=66c73af7ea59382ce5ca7cfb2eedb0491790276c commit 66c73af7ea59382ce5ca7cfb2eedb0491790276c Author: Kornel Dulęba AuthorDate: 2022-09-02 11:08:32 +0000 Commit: Kornel Dulęba CommitDate: 2022-09-02 11:10:32 +0000 stand: Parse BIOS revision from SMBIOS Add a smbios.bios.revision kenv, which contains the system BIOS revision as defined in SMBIOS specification, section 3.3.1. Since the revision is stored in two separate byte fields, the smbios_setenv helper can't be used. Read and construct the kenv manually instead. Approved by: mw(mentor) Sponsored by: Stormshield Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D36413 --- stand/libsa/smbios.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stand/libsa/smbios.c b/stand/libsa/smbios.c index 5582a2f3ce90..61bd82f9d6f0 100644 --- a/stand/libsa/smbios.c +++ b/stand/libsa/smbios.c @@ -298,6 +298,8 @@ smbios_parse_table(const caddr_t addr) { caddr_t cp; int proc, size, osize, type; + uint8_t bios_minor, bios_major; + char buf[16]; type = SMBIOS_GET8(addr, 0); /* 3.1.2 Structure Header Format */ switch(type) { @@ -305,6 +307,13 @@ smbios_parse_table(const caddr_t addr) smbios_setenv("smbios.bios.vendor", addr, 0x04); smbios_setenv("smbios.bios.version", addr, 0x05); smbios_setenv("smbios.bios.reldate", addr, 0x08); + bios_major = SMBIOS_GET8(addr, 0x14); + bios_minor = SMBIOS_GET8(addr, 0x15); + if (bios_minor != 0xFF && bios_major != 0xFF) { + snprintf(buf, sizeof(buf), "%u.%u", + bios_major, bios_minor); + setenv("smbios.bios.revision", buf, 1); + } break; case 1: /* 3.3.2 System Information (Type 1) */