public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/PlatformBootManagerLib: print firmware version to console
@ 2017-12-08 15:01 Ard Biesheuvel
  2017-12-08 16:31 ` Leif Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2017-12-08 15:01 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel

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>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ArmPkg/PlatformBootManagerLib: print firmware version to console
  2017-12-08 15:01 [PATCH] ArmPkg/PlatformBootManagerLib: print firmware version to console Ard Biesheuvel
@ 2017-12-08 16:31 ` Leif Lindholm
  2017-12-08 16:37   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2017-12-08 16:31 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel

On Fri, Dec 08, 2017 at 03:01:49PM +0000, Ard Biesheuvel wrote:
> 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               | 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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ArmPkg/PlatformBootManagerLib: print firmware version to console
  2017-12-08 16:31 ` Leif Lindholm
@ 2017-12-08 16:37   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2017-12-08 16:37 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel@lists.01.org

On 8 December 2017 at 16:31, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Fri, Dec 08, 2017 at 03:01:49PM +0000, Ard Biesheuvel wrote:
>> 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>
>

Thanks. Pushed as 6c4194c99e2e

>> ---
>>  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
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-08 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-08 15:01 [PATCH] ArmPkg/PlatformBootManagerLib: print firmware version to console Ard Biesheuvel
2017-12-08 16:31 ` Leif Lindholm
2017-12-08 16:37   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox