[edk2-devel] [PATCH 1/1] ArmPlatformPkg/PrePeiCore: Print the firmware version early in boot

Ard Biesheuvel ardb at kernel.org
Tue May 3 07:43:06 UTC 2022


Hello Rebecca,

Apologies for the delay. I'm a bit behind on review, and few other
people appear to take an interest in these changes, unfortunately.


On Thu, 14 Apr 2022 at 00:46, Rebecca Cran <quic_rcran at quicinc.com> wrote:
>
> Copy code from PrePi to PrePeiCore that prints the firmware version
> and build date early in the boot process.
>
> Signed-off-by: Rebecca Cran <quic_rcran at quicinc.com>
> ---
>  ArmPlatformPkg/PrePeiCore/PrePeiCore.c          | 17 +++++++++++++++++
>  ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf  |  3 +++
>  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf |  3 +++
>  3 files changed, 23 insertions(+)
>
> diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
> index 6dd9bcdea24f..9e2a0db676b9 100644
> --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
> +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
> @@ -11,6 +11,8 @@
>  #include <Library/CacheMaintenanceLib.h>
>  #include <Library/DebugAgentLib.h>
>  #include <Library/ArmLib.h>
> +#include <Library/PrintLib.h>
> +#include <Library/SerialPortLib.h>
>
>  #include "PrePeiCore.h"
>
> @@ -58,6 +60,9 @@ CEntryPoint (
>    IN  EFI_PEI_CORE_ENTRY_POINT  PeiCoreEntryPoint
>    )
>  {
> +  CHAR8  Buffer[100];
> +  UINTN  CharCount;
> +
>    // Data Cache enabled on Primary core when MMU is enabled.
>    ArmDisableDataCache ();
>    // Invalidate instruction cache
> @@ -90,6 +95,18 @@ CEntryPoint (
>
>    // If not primary Jump to Secondary Main
>    if (ArmPlatformIsPrimaryCore (MpId)) {
> +    // Initialize the Serial Port
> +    SerialPortInitialize ();
> +    CharCount = AsciiSPrint (
> +                  Buffer,
> +                  sizeof (Buffer),
> +                  "UEFI firmware (version %s built at %a on %a)\n\r",
> +                  (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString),

Given that this runs before any library constructors are called, I'd
be inclined to use FixedPcdGetPtr() here (and [FixedPcd] in the .INFs
below), to ensure that we don't dereference garbage.

I also wonder whether we need a call to
ProcessLibraryConstructorList() somewhere.

> +                  __TIME__,
> +                  __DATE__
> +                  );
> +    SerialPortWrite ((UINT8 *)Buffer, CharCount);
> +
>      // Initialize the Debug Agent for Source Level Debugging
>      InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);
>      SaveAndSetDebugTimerInterrupt (TRUE);
> diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
> index fb01dd1a113e..83029cf08d1a 100644
> --- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
> +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
> @@ -57,6 +57,9 @@
>    gEfiTemporaryRamSupportPpiGuid
>    gArmMpCoreInfoPpiGuid
>
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
> +
>  [FeaturePcd]
>    gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
>
> diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> index e9eb092d3ac9..9f9ad81586ed 100644
> --- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> @@ -55,6 +55,9 @@
>  [Ppis]
>    gEfiTemporaryRamSupportPpiGuid
>
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
> +
>  [FeaturePcd]
>    gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
>
> --
> 2.34.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89476): https://edk2.groups.io/g/devel/message/89476
Mute This Topic: https://groups.io/mt/90452782/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list