]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
ArmPkg/PlatformBootManagerLib: print firmware version to console
[mirror_edk2.git] / ArmPkg / Library / PlatformBootManagerLib / PlatformBm.c
index a3b2d7925f72c66ca8f2f0d4af3b2e7250804ba3..ccdb3e0a5d78a51b3aef96d67fbf429e9e82b1bd 100644 (file)
@@ -25,6 +25,7 @@
 #include <Library/UefiBootManagerLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Protocol/DevicePath.h>\r
+#include <Protocol/EsrtManagement.h>\r
 #include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/PciIo.h>\r
@@ -449,12 +450,19 @@ PlatformBootManagerBeforeConsole (
   VOID\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
+  EFI_STATUS                    Status;\r
+  ESRT_MANAGEMENT_PROTOCOL      *EsrtManagement;\r
 \r
   if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) {\r
     DEBUG ((DEBUG_INFO, "ProcessCapsules Before EndOfDxe ......\n"));\r
     Status = ProcessCapsules ();\r
     DEBUG ((DEBUG_INFO, "ProcessCapsules returned %r\n", Status));\r
+  } else {\r
+    Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,\r
+                    (VOID **)&EsrtManagement);\r
+    if (!EFI_ERROR (Status)) {\r
+      EsrtManagement->SyncEsrtFmp ();\r
+    }\r
   }\r
 \r
   //\r
@@ -507,6 +515,8 @@ PlatformBootManagerBeforeConsole (
   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
@@ -524,20 +534,50 @@ PlatformBootManagerAfterConsole (
   VOID\r
   )\r
 {\r
-  EFI_STATUS      Status;\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
+    if (FirmwareVerLength > 0) {\r
+      Print (VERSION_STRING_PREFIX L"%s",\r
+        PcdGetPtr (PcdFirmwareVersionString));\r
+    }\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
   // Connect the rest of the devices.\r
   //\r
   EfiBootManagerConnectAll ();\r
 \r
+  Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,\r
+                  (VOID **)&EsrtManagement);\r
+  if (!EFI_ERROR (Status)) {\r
+    EsrtManagement->SyncEsrtFmp ();\r
+  }\r
+\r
   if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) {\r
     DEBUG((DEBUG_INFO, "ProcessCapsules After EndOfDxe ......\n"));\r
     Status = ProcessCapsules ();\r