From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::232; helo=mail-wm0-x232.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C99CA2217CE47 for ; Fri, 8 Dec 2017 06:57:23 -0800 (PST) Received: by mail-wm0-x232.google.com with SMTP id 64so3627918wme.3 for ; Fri, 08 Dec 2017 07:01:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=MXLxJld7UIF+GX72+n9AzZQexsmgJiDAfH82sOP7erI=; b=M+zAo+wFRmH4TYQBfx05gYmsvT75j5CNgjG57FU0evj9k9tfe55xHxm8YM8Wf+dCUb S06TPQwFg/6Pk2qe3xJ2gEJhHCJDkhQNXJL/XpCqVD8uKf82JNW7vbZoeSOu/5uZ2XR8 ubZI6yts6BNZIaZOU54UDe0+GsRWVlMkRt2ds= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MXLxJld7UIF+GX72+n9AzZQexsmgJiDAfH82sOP7erI=; b=dofYks8iYCA92+8XAPpo7ydpVyQRyrXD5vtrJDtnRIkiN7KNXsAs3lTUDd/isvvD9E gvGnPyBZbmpGYOVueUmt5voqAiN0vHT+rm1BJampR0pMNiK2bl1lQ+iQ4Ara2CBit0pC pU78HWRucKSJv3twbUQFif8M77V4mnrx7aRDvc1IjjgKGaq1X4lryGjDfV5nBLbw65Ol GqrQ4OOdJCMnCPuQE3EsVxpS8ciMvvB7UE6SwsE5mhG83Ld02GVTbIULXtO+0CB88p8Q qhy87cv+1WIre+n38c4wPVDTivBMvBLm9Q4tMRpxQWC/54Zb7xvNHwsnFdvi9yHphA0+ VFhA== X-Gm-Message-State: AKGB3mKQZk8WmTSFy0qgm99O7gBnYTOd1rnNnRkwJdfAinJPWwedQjIs mfVBRh7frb5wR2TdjAEzZUJDNIx6mrA= X-Google-Smtp-Source: AGs4zMZnkgi2HGEwNdVd5MwWj3KCBRKdnJRahEZMVlDWI5o0KJUGGv5WPfcbNwXGlBd5QuQuIpVFQg== X-Received: by 10.28.101.11 with SMTP id z11mr3878929wmb.110.1512745315866; Fri, 08 Dec 2017 07:01:55 -0800 (PST) Received: from localhost.localdomain ([160.171.158.223]) by smtp.gmail.com with ESMTPSA id a203sm1740784wmh.45.2017.12.08.07.01.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Dec 2017 07:01:54 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: Ard Biesheuvel Date: Fri, 8 Dec 2017 15:01:49 +0000 Message-Id: <20171208150149.10731-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [PATCH] ArmPkg/PlatformBootManagerLib: print firmware version to console X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2017 14:57:24 -0000 If gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString is set to a non-empty string, print it to the console at boot. Note that this is independent of DEBUG/RELEASE or graphical vs serial console, although we do attempt to stay clear of the logo and progress bar in graphical mode, by printing it top center. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 25 ++++++++++++++++++++ ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + 2 files changed, 26 insertions(+) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c index 95e739c66c29..ccdb3e0a5d78 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -515,6 +515,8 @@ PlatformBootManagerBeforeConsole ( PlatformRegisterOptionsAndKeys (); } +#define VERSION_STRING_PREFIX L"Tianocore/EDK2 firmware version " + /** Do the platform specific action after the console is ready Possible things that can be done in PlatformBootManagerAfterConsole: @@ -534,14 +536,37 @@ PlatformBootManagerAfterConsole ( { ESRT_MANAGEMENT_PROTOCOL *EsrtManagement; EFI_STATUS Status; + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + UINTN FirmwareVerLength; + UINTN PosX; + UINTN PosY; + + FirmwareVerLength = StrLen (PcdGetPtr (PcdFirmwareVersionString)); // // Show the splash screen. // Status = BootLogoEnableLogo (); if (EFI_ERROR (Status)) { + if (FirmwareVerLength > 0) { + Print (VERSION_STRING_PREFIX L"%s", + PcdGetPtr (PcdFirmwareVersionString)); + } Print (L"Press ESCAPE for boot options "); + } else if (FirmwareVerLength > 0) { + Status = gBS->HandleProtocol (gST->ConsoleOutHandle, + &gEfiGraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput); + if (!EFI_ERROR (Status)) { + PosX = (GraphicsOutput->Mode->Info->HorizontalResolution - + (StrLen (VERSION_STRING_PREFIX) + FirmwareVerLength) * + EFI_GLYPH_WIDTH) / 2; + PosY = 0; + + PrintXY (PosX, PosY, NULL, NULL, VERSION_STRING_PREFIX L"%s", + PcdGetPtr (PcdFirmwareVersionString)); + } } + // // Connect the rest of the devices. // diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index fce7349ff867..71f1d04a87ee 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -59,6 +59,7 @@ [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport [FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity -- 2.11.0