From nobody Thu Mar 28 17:36:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53028+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53028+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1578502823; cv=none; d=zohomail.com; s=zohoarc; b=EqFIB3FX8Nn2xiz6PZ9fC7yzPK04f6GSe79YkRjJAaxyAWM48N/HUH+naS05/zMTrNf2oxIeI1YA4FU8em/A66n0yLp+1Q3w+mcS0tuzPgI/a8wcFWn8MH9u33Jj6XaDxIE5NrAxRrkSDudjW5/Sl6TR9gGGuDBn+6Q3h/F+G2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578502823; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=bYIoASxQeLhWZStAQQvAz4NTfRtw8v1CSexGEK7vi+Q=; b=LWr75sJw/uLWKOR/QN+KgFkm/8KelEbRsLJn39ukQew8D3LtZsnbVaPfzojFELM3KoR3cyMmA7Fo5B05HT96eFaLU7H5dSMQS4tNxV2oknSfbSjoonVJRpmnvooTQazdtbzlT0keDTREzIz8TefU5i5PoOLILQoAB+Qclw1fgnU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53028+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578502823161556.9466403270189; Wed, 8 Jan 2020 09:00:23 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ra47YY1788612xur2dG2yMbL; Wed, 08 Jan 2020 09:00:22 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web09.10760.1578502819133740801 for ; Wed, 08 Jan 2020 09:00:19 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id q6so4139580wro.9 for ; Wed, 08 Jan 2020 09:00:18 -0800 (PST) X-Gm-Message-State: aMKzPsifxXMl7YD3qEntUtzOx1787277AA= X-Google-Smtp-Source: APXvYqx1oNwbvIsdj4S+5TtjHKLBh4SxH4FOC8FRIG1YUGoHUoAA1W5BcS37jIE049dlQTP5bbqtbQ== X-Received: by 2002:a5d:53c1:: with SMTP id a1mr5417182wrw.373.1578502817279; Wed, 08 Jan 2020 09:00:17 -0800 (PST) X-Received: from localhost.localdomain ([84.203.81.176]) by smtp.gmail.com with ESMTPSA id i16sm4786496wmb.36.2020.01.08.09.00.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2020 09:00:16 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] Platform/RPi/SmbiosDxe: Report a more human readable firmware revision Date: Wed, 8 Jan 2020 17:00:03 +0000 Message-Id: <20200108170004.6680-2-pete@akeo.ie> In-Reply-To: <20200108170004.6680-1-pete@akeo.ie> References: <20200108170004.6680-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578502822; bh=+9vaQ6FjWOWlxNO+3qlOgknfTiTlKhTxV+6hr8Wmx7Y=; h=Cc:Date:From:Reply-To:Subject:To; b=DOvYhRFSNOgUtS6NBT7zhRAxvMRPcLOTYjw4Zti92TL22Vmwzr0DzCchQCzXWBeRQ4D B4QW61K46F6mVfMz134YN1hWzVvCYpsK/FzYjyr7yHny8sVqFFhgeIRX4xQE74NX0WKzp /f2PRhCC/OnwbmXpwxirrkpF7R5le7xGvAg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The firmware revision that is queried through the VideoCore mailbox is really the 32-bit timestamp of when the VideoCore firmware was generated. To make this more palatable for human reporting, convert it to a YY.MM firmware revision, so that end-users can get an approximative idea of how old their VideoCore firmware is. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 20 = ++++++++++++-------- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 2 = ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 6aa68a0925ba..06c73d691f9d 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include =20 @@ -597,23 +598,26 @@ BIOSInfoUpdateSmbiosType0 ( VOID ) { - UINT32 FirmwareRevision =3D 0; + UINT32 EpochSeconds =3D 0; EFI_STATUS Status =3D EFI_SUCCESS; + EFI_TIME Time; INTN i; INTN State =3D 0; INTN Value[2]; =20 // Populate the Firmware major and minor. - Status =3D mFwProtocol->GetFirmwareRevision (&FirmwareRevision); + Status =3D mFwProtocol->GetFirmwareRevision (&EpochSeconds); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "Failed to get firmware revision: %r\n", Status)); } else { - // This expects Broadcom / The Raspberry Pi Foundation to switch to - // less nonsensical VideoCore firmware revisions in the future... - mBIOSInfoType0.EmbeddedControllerFirmwareMajorRelease =3D - (UINT8)((FirmwareRevision >> 16) & 0xFF); - mBIOSInfoType0.EmbeddedControllerFirmwareMinorRelease =3D - (UINT8)(FirmwareRevision & 0xFF); + // The firmware revision is really an epoch time which we convert to a + // YY.MM major.minor. This is good enough for our purpose, where this + // revision is merely provided as a loose indicator of when the + // VideoCore firmware was generated. + EpochToEfiTime (EpochSeconds, &Time); + ASSERT (Time.Year >=3D 2000 && Time.Year <=3D 2255); + mBIOSInfoType0.EmbeddedControllerFirmwareMajorRelease =3D (UINT8)(Time= .Year - 2000); + mBIOSInfoType0.EmbeddedControllerFirmwareMinorRelease =3D Time.Month; } =20 // mBiosVendor and mBiosVersion, which are referenced in mBIOSInfoType0S= trings, diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.i= nf index 0bd72c3ba6a1..9554c2e998f1 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf @@ -27,6 +27,7 @@ [Packages] ArmPlatformPkg/ArmPlatformPkg.dec ArmPkg/ArmPkg.dec Platform/RaspberryPi/RaspberryPi.dec + EmbeddedPkg/EmbeddedPkg.dec =20 [LibraryClasses] UefiBootServicesTableLib @@ -37,6 +38,7 @@ [LibraryClasses] UefiDriverEntryPoint DebugLib PrintLib + TimeBaseLib =20 [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53028): https://edk2.groups.io/g/devel/message/53028 Mute This Topic: https://groups.io/mt/69532223/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 17:36:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53029+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53029+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1578502823; cv=none; d=zohomail.com; s=zohoarc; b=V4l78zwHMuHgqcZZoL8K1t3vUyrXnuY9li+H6BroX0zAmv4XbBcPxS25Oytq7qeKxVgggwczCIxxnnAvgVvAxUS/e9hLGXB6nW7S2UaTmpAbbDvzT7sXrEMjrCuWnyIBeSYwwbEX/YzZMWslMziLYm2kvkHA7qlJKmjeBi++Kio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578502823; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+wDVLgDAzz22s8O1y46qKfQ+SSYnUy/FodjuKe/CC18=; b=LNHyJKCuRL1gHqqHIOimj4oF3BUWU0XruexHvkCLif8aNqQ+sg+ntLrqG6slxrLxvmM14CyzenV1uNkmE/rT8ahwxEjshraC53dXbTABae1wSGH/AwPN9FNwXLdX8J8DYAj4zItL3kE95anpFNwi3xSaoj5p71eCQGCAuRQR22g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53029+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578502823464343.37053979872496; Wed, 8 Jan 2020 09:00:23 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fKvrYY1788612xMx9gDVQkkx; Wed, 08 Jan 2020 09:00:23 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.10911.1578502820446319941 for ; Wed, 08 Jan 2020 09:00:20 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id q6so4139677wro.9 for ; Wed, 08 Jan 2020 09:00:20 -0800 (PST) X-Gm-Message-State: 7kWSGg4UanaSIHUWlydcY3Kvx1787277AA= X-Google-Smtp-Source: APXvYqwM0rrPeuo2p734TWDdqEUYjmXJ7RhNlE8Y6IhIvpvbpc9fC5crvAFdaSkbRfElZC3WESGklQ== X-Received: by 2002:a05:6000:11c3:: with SMTP id i3mr5635049wrx.244.1578502818834; Wed, 08 Jan 2020 09:00:18 -0800 (PST) X-Received: from localhost.localdomain ([84.203.81.176]) by smtp.gmail.com with ESMTPSA id i16sm4786496wmb.36.2020.01.08.09.00.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2020 09:00:18 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 2/2] Platform/RPi/RPiFirmwareDxe: Fix serial number population for RPi4 Date: Wed, 8 Jan 2020 17:00:04 +0000 Message-Id: <20200108170004.6680-3-pete@akeo.ie> In-Reply-To: <20200108170004.6680-1-pete@akeo.ie> References: <20200108170004.6680-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578502823; bh=il5Zx/KiOKEyRSq+2kXNSkpP3HegkdDZvvS4zI2uN1Q=; h=Cc:Date:From:Reply-To:Subject:To; b=diyQ/2h5WljQxA++4IdahOWbLWskVByx58ogpMUP+dgOb0H1CjvOLk6d+61/M03Du8q QqDwe9suH9eJtwScWGZ+vlnZ45YiI0vdJCSMBo91gF/+32Ip2BCCMS1PgNw98DF60wEPd UnXKz2p2mVUp7V+C+lvTI2Ibd7kEGR8az78= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Some (all?) Raspbery Pi 4 platforms report 0x0000000010000000 as their board serial when queried through the VideoCore mailbox. Fix this by using the MAC address then. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index dd61ef089ca7..75826fdc0e53 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -394,8 +394,9 @@ RpiFirmwareGetSerial ( } =20 *Serial =3D Cmd->TagBody.Serial; - // Some platforms return 0 for serial. For those, try to use the MAC add= ress. - if (*Serial =3D=3D 0) { + // Some platforms return 0 or 0x0000000010000000 for serial. + // For those, try to use the MAC address. + if ((*Serial =3D=3D 0) || ((*Serial & 0xFFFFFFFF0FFFFFFFULL) =3D=3D 0)) { Status =3D RpiFirmwareGetMacAddress ((UINT8*) Serial); // Convert to a more user-friendly value *Serial =3D SwapBytes64 (*Serial << 16); --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53029): https://edk2.groups.io/g/devel/message/53029 Mute This Topic: https://groups.io/mt/69532224/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-