From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [PATCH 1/1] ArmPlatformPkg/PrePeiCore: Print the firmware version early in boot To: Ard Biesheuvel ,devel@edk2.groups.io From: "Sami Mujawar" X-Originating-Location: Cambridge, England, GB (217.140.106.51) X-Originating-Platform: Windows Firefox 102 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Thu, 21 Jul 2022 09:23:13 -0700 References: In-Reply-To: Message-ID: <15026.1658420593869880980@groups.io> Content-Type: multipart/alternative; boundary="JnzTVq38E3reU2EcyriC" --JnzTVq38E3reU2EcyriC Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Rebecca, Ard, On Tue, May 3, 2022 at 12:43 AM, Ard Biesheuvel wrote: >=20 >=20 >> // Data Cache enabled on Primary core when MMU is enabled. >> ArmDisableDataCache (); >> // Invalidate instruction cache >> @@ -90,6 +95,18 @@ CEntryPoint ( >>=20 >> // If not primary Jump to Secondary Main >> if (ArmPlatformIsPrimaryCore (MpId)) { >> + // Initialize the Serial Port >> + SerialPortInitialize (); >> + CharCount =3D AsciiSPrint ( >> + Buffer, >> + sizeof (Buffer), >> + "UEFI firmware (version %s built at %a on %a)\n\r", >> + (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString), >=20 > 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. >=20 > I also wonder whether we need a call to > ProcessLibraryConstructorList() somewhere. [SAMI] There is a patch at https://edk2.groups.io/g/devel/message/91113 whi= ch aims to call ProcessLibraryConstructorList(). The idea being that the De= bugLib constructor would be called which initializes the serial port. So, maybe these patches need adjustment so that we avoid calling SerialPort= Initialize () twice. [/SAMI] regards, Sami Mujawar >=20 >=20 >=20 >> + __TIME__, >> + __DATE__ >> + ); >> + SerialPortWrite ((UINT8 *)Buffer, CharCount); >=20 > --JnzTVq38E3reU2EcyriC Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Rebecca, Ard,

On Tue, May 3, 2022 at 12:43 AM, Ard Biesheuvel= wrote:
// 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 Mai= n
if (ArmPlatformIsPrimaryCore (MpId)) {
+ // Initialize the Seri= al Port
+ SerialPortInitialize ();
+ CharCount =3D AsciiSPrint (<= br />+ Buffer,
+ sizeof (Buffer),
+ "UEFI firmware (version %s bu= ilt at %a on %a)\n\r",
+ (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString= ),
Given that this runs before any library constructors are called, I'd
b= e inclined to use FixedPcdGetPtr() here (and [FixedPcd] in the .INFs
b= elow), to ensure that we don't dereference garbage.

I also wonde= r whether we need a call to
ProcessLibraryConstructorList() somewhere.=
[SAMI] There is a patch at https://edk2.groups.io/g/devel/= message/91113 which aims to call ProcessLibraryConstructorList(). The i= dea being that the DebugLib constructor would be called which initializes t= he serial port.
So, maybe these patches need adjustment so that we avo= id calling SerialPortInitialize () twice.
[/SAMI]

regards,<= br />
Sami Mujawar

+ __TIME__,
+ __DATE__
+ );
+ SerialPortWrite ((= UINT8 *)Buffer, CharCount);
--JnzTVq38E3reU2EcyriC--