From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.10187.1658509391027972353 for ; Fri, 22 Jul 2022 10:03:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: rohit.mathew@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 65EBA1063; Fri, 22 Jul 2022 10:03:10 -0700 (PDT) Received: from usa.arm.com (unknown [10.57.13.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D20183F73D; Fri, 22 Jul 2022 10:03:08 -0700 (PDT) From: "Rohit Mathew" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois , Thomas Abraham Subject: [edk2][PATCH V4 1/1] ArmPlatformPkg/PrePeiCore: Invoke constructors for SEC phase Date: Fri, 22 Jul 2022 18:02:57 +0100 Message-Id: <20220722170257.32249-1-rohit.mathew@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On platforms that do not have the serial console port pre-initialized prior to the SEC phase and due to the absence of a call to "SerialPortInitialize", this results in missing debug logs. So, call the auto-generated "ProcessLibraryConstructorList" function from SEC phase to have all the dependent library constructors called (this includes a call to "SerialPortInitialize"). Signed-off-by: Rohit Mathew --- ArmPlatformPkg/PrePeiCore/PrePeiCore.h | 12 +++++++++++- ArmPlatformPkg/PrePeiCore/PrePeiCore.c | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) Changes since V1: - Rebased on top of latest master branch. - Addressed comments from Ard. Changes since V2: - Rebased on top of latest master branch. Changes since V3: - Addressed comments from Sami. Link to github branch for the patch - https://github.com/rohit-arm/edk2/tree/sec_constructor_issue diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h b/ArmPlatformPkg/PreP= eiCore/PrePeiCore.h index 0345dd7bdd2a..c1e13e23e11e 100644 --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h @@ -1,7 +1,7 @@ /** @file Main file supporting the transition to PEI Core in Normal World for Ve= rsatile Express =20 - Copyright (c) 2011, ARM Limited. All rights reserved. + Copyright (c) 2011 - 2022, ARM Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -73,4 +73,14 @@ PeiCommonExceptionEntry ( IN UINTN LR ); =20 +/* + * Autogenerated function that calls the library constructors for all of= the + * module's dependent libraries. + */ +VOID +EFIAPI +ProcessLibraryConstructorList ( + VOID + ); + #endif diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PreP= eiCore/PrePeiCore.c index 6dd9bcdea24f..9c4b25df953d 100644 --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c @@ -1,7 +1,7 @@ /** @file Main file supporting the transition to PEI Core in Normal World for Ve= rsatile Express =20 - Copyright (c) 2011-2014, ARM Limited. All rights reserved. + Copyright (c) 2011 - 2022, ARM Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -90,6 +90,10 @@ CEntryPoint ( =20 // If not primary Jump to Secondary Main if (ArmPlatformIsPrimaryCore (MpId)) { + // Invoke "ProcessLibraryConstructorList" to have all library constr= uctors + // called. + ProcessLibraryConstructorList (); + // Initialize the Debug Agent for Source Level Debugging InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); SaveAndSetDebugTimerInterrupt (TRUE); --=20 2.25.1