From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web08.6042.1666698088735456617 for ; Tue, 25 Oct 2022 04:41:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hN4PSwgJ; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.168.131, mailfrom: quic_llindhol@quicinc.com) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29P8mI20032738; Tue, 25 Oct 2022 11:41:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=am4Y2sW8/1frxFWaUS1QGJ8wDiQzGZFRVYTmNjHpfu8=; b=hN4PSwgJz8CfLe2ogxaXgN8XK1AZkYfwZ2usu+fEAkrKYDNekNg2okp4SXi1xxv20pEz 3bSL8Ft2etCQKCuyU56i3JuUYPYAlzf/vltFcf6xvOgDRmDyyvk3KaFvHXrA3Ce4wRi2 dnIvIKhWPK9HuuiT3sPagcoK1F7PJQXqK4QdDVWNpZ5CC+2GIhxlyNbO7YpG/jPcs0kv 21IgECr2UylacB/iNk4RDaXs2Sjyv+Xldyn00bUb1sb9n75eT9iL+waEY64zwWwsNWGF 5sC7EW+qCcN69UD2UCdYrIwHuKMzf+kknZ31cAn056eIpKRX4KGuULxRlmoVZ0qSgIYI uA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ke6qs1agr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Oct 2022 11:41:24 +0000 Received: from pps.filterd (NASANPPMTA01.qualcomm.com [127.0.0.1]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 29PBfOS3022827; Tue, 25 Oct 2022 11:41:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA01.qualcomm.com (PPS) with ESMTPS id 3keay3hqux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Oct 2022 11:41:24 +0000 Received: from NASANPPMTA01.qualcomm.com (NASANPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29PBfOxp022822; Tue, 25 Oct 2022 11:41:24 GMT Received: from nasanex01c.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA01.qualcomm.com (PPS) with ESMTPS id 29PBfOLX022821 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Oct 2022 11:41:24 +0000 Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 25 Oct 2022 04:41:22 -0700 Date: Tue, 25 Oct 2022 12:41:19 +0100 From: "Leif Lindholm" To: Rebecca Cran CC: , Oliver Steffen , "Gerd Hoffmann" , Ard Biesheuvel , Sami Mujawar Subject: Re: [PATCH v3 1/1] ArmPlatformPkg/PrePeiCore: Print the firmware version early in boot Message-ID: References: <20221011205952.357499-1-rebecca@quicinc.com> <20221011205952.357499-2-rebecca@quicinc.com> MIME-Version: 1.0 In-Reply-To: <20221011205952.357499-2-rebecca@quicinc.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ZdO5JKyKeOrxch-BSSxArupslSWZyVLE X-Proofpoint-GUID: ZdO5JKyKeOrxch-BSSxArupslSWZyVLE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-25_05,2022-10-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 adultscore=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210250067 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Tue, Oct 11, 2022 at 14:59:52 -0600, Rebecca Cran wrote: > Copy code from PrePi to PrePeiCore that prints the firmware version > and build date early in the boot process. I'm good with this, but I'd prefer to break the printout into a helper function in order to reduce clutter in CEntryPoint. i.e. fold in --- diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c index 674f4f7df498..225e22f75c23 100644 --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c @@ -54,15 +54,32 @@ CreatePpiList ( *PpiListSize = sizeof (gCommonPpiTable) + PlatformPpiListSize; } +STATIC +VOID +PrintFirmwareVersion ( + VOID + ) +{ + CHAR8 Buffer[100]; + UINTN CharCount; + + CharCount = AsciiSPrint ( + Buffer, + sizeof (Buffer), + "UEFI firmware (version %s built at %a on %a)\n\r", + (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString), + __TIME__, + __DATE__ + ); + SerialPortWrite ((UINT8 *)Buffer, CharCount); +} + VOID CEntryPoint ( IN UINTN MpId, IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint ) { - CHAR8 Buffer[100]; - UINTN CharCount; - if (!ArmMmuEnabled ()) { // Data Cache enabled on Primary core when MMU is enabled. ArmDisableDataCache (); @@ -100,15 +117,8 @@ CEntryPoint ( // Invoke "ProcessLibraryConstructorList" to have all library constructors // called. ProcessLibraryConstructorList (); - CharCount = AsciiSPrint ( - Buffer, - sizeof (Buffer), - "UEFI firmware (version %s built at %a on %a)\n\r", - (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString), - __TIME__, - __DATE__ - ); - SerialPortWrite ((UINT8 *)Buffer, CharCount); + + PrintFirmwareVersion(); // Initialize the Debug Agent for Source Level Debugging InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); --- If you're happy with that, I can apply and push. / Leif > Signed-off-by: Rebecca Cran > Reviewed-by: Sami Mujawar > Tested-by: Oliver Steffen > --- > ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf | 3 +++ > ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf | 3 +++ > ArmPlatformPkg/PrePeiCore/PrePeiCore.c | 14 ++++++++++++++ > 3 files changed, 20 insertions(+) > > diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf > index a5b4722459d1..4a3112b58dcb 100644 > --- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf > +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf > @@ -54,6 +54,9 @@ [Ppis] > gEfiTemporaryRamSupportPpiGuid > gArmMpCoreInfoPpiGuid > > +[Pcd] > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString > + > [FeaturePcd] > gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores > > diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf > index 466a2b01c384..ab5bf1dac2d8 100644 > --- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf > +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf > @@ -52,6 +52,9 @@ [LibraryClasses] > [Ppis] > gEfiTemporaryRamSupportPpiGuid > > +[Pcd] > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString > + > [FeaturePcd] > gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores > > diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c > index 9c4b25df953d..1d4f6969b660 100644 > --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c > +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c > @@ -11,6 +11,8 @@ > #include > #include > #include > +#include > +#include > > #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 > @@ -93,6 +98,15 @@ CEntryPoint ( > // Invoke "ProcessLibraryConstructorList" to have all library constructors > // called. > ProcessLibraryConstructorList (); > + CharCount = AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "UEFI firmware (version %s built at %a on %a)\n\r", > + (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString), > + __TIME__, > + __DATE__ > + ); > + SerialPortWrite ((UINT8 *)Buffer, CharCount); > > // Initialize the Debug Agent for Source Level Debugging > InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); > -- > 2.30.2 >