]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/PlatformBootManagerLib: print firmware version to console
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 8 Dec 2017 14:55:22 +0000 (14:55 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 8 Dec 2017 16:33:15 +0000 (16:33 +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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf

index 95e739c66c2931c63f295dc336c6bd32824d12b8..ccdb3e0a5d78a51b3aef96d67fbf429e9e82b1bd 100644 (file)
@@ -515,6 +515,8 @@ PlatformBootManagerBeforeConsole (
   PlatformRegisterOptionsAndKeys ();\r
 }\r
 \r
   PlatformRegisterOptionsAndKeys ();\r
 }\r
 \r
+#define VERSION_STRING_PREFIX    L"Tianocore/EDK2 firmware version "\r
+\r
 /**\r
   Do the platform specific action after the console is ready\r
   Possible things that can be done in PlatformBootManagerAfterConsole:\r
 /**\r
   Do the platform specific action after the console is ready\r
   Possible things that can be done in PlatformBootManagerAfterConsole:\r
@@ -534,14 +536,37 @@ PlatformBootManagerAfterConsole (
 {\r
   ESRT_MANAGEMENT_PROTOCOL      *EsrtManagement;\r
   EFI_STATUS                    Status;\r
 {\r
   ESRT_MANAGEMENT_PROTOCOL      *EsrtManagement;\r
   EFI_STATUS                    Status;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;\r
+  UINTN                         FirmwareVerLength;\r
+  UINTN                         PosX;\r
+  UINTN                         PosY;\r
+\r
+  FirmwareVerLength = StrLen (PcdGetPtr (PcdFirmwareVersionString));\r
 \r
   //\r
   // Show the splash screen.\r
   //\r
   Status = BootLogoEnableLogo ();\r
   if (EFI_ERROR (Status)) {\r
 \r
   //\r
   // Show the splash screen.\r
   //\r
   Status = BootLogoEnableLogo ();\r
   if (EFI_ERROR (Status)) {\r
+    if (FirmwareVerLength > 0) {\r
+      Print (VERSION_STRING_PREFIX L"%s",\r
+        PcdGetPtr (PcdFirmwareVersionString));\r
+    }\r
     Print (L"Press ESCAPE for boot options ");\r
     Print (L"Press ESCAPE for boot options ");\r
+  } else if (FirmwareVerLength > 0) {\r
+    Status = gBS->HandleProtocol (gST->ConsoleOutHandle,\r
+                    &gEfiGraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput);\r
+    if (!EFI_ERROR (Status)) {\r
+      PosX = (GraphicsOutput->Mode->Info->HorizontalResolution -\r
+              (StrLen (VERSION_STRING_PREFIX) + FirmwareVerLength) *\r
+              EFI_GLYPH_WIDTH) / 2;\r
+      PosY = 0;\r
+\r
+      PrintXY (PosX, PosY, NULL, NULL, VERSION_STRING_PREFIX L"%s",\r
+        PcdGetPtr (PcdFirmwareVersionString));\r
+    }\r
   }\r
   }\r
+\r
   //\r
   // Connect the rest of the devices.\r
   //\r
   //\r
   // Connect the rest of the devices.\r
   //\r
index fce7349ff867e913b263d45babe6b7947ad8242a..71f1d04a87ee870b55aa820aed675c546e2151ff 100644 (file)
@@ -59,6 +59,7 @@
   gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
 \r
 [FixedPcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
 \r
 [FixedPcd]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity\r