From nobody Mon Feb 9 10:32:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58150+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58150+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1587914340; cv=none; d=zohomail.com; s=zohoarc; b=ZYZX5W5cHbR6v5IUoANICRd6yOiiZ8NV2Aldz3eBQ/qJWESaNqLP0TJtHHPfJKHUpFZY1oBlynOMWG/5CRIRdjNgI33Ufe6fxmlLSEZ7qSwskt3c2XnHncv99Hmk+A6eDodk//Byo96FykXamilGL+XX/OteUhXz+0olIOAdm6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587914340; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=MCyUwn5sn9GdeSMAPQNVQskY41u/gFLJLtSgR6Sr46A=; b=CPf7ipXaZlKMKwrTcYJkXGnSuZThfOqC0V1kcY0bVTKCoDtdPjyxzLi6aRzH2nE+0yN1LwCEolLkWCEZJHiBg2e5FallMED661TtTadJ7C1chX3AT0gd0d/VcRICLz7U9XCporhfE5KRHA/eAB7UCpPJbeCqMaj506QuOvPSTd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58150+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587914340258660.6745495446212; Sun, 26 Apr 2020 08:19:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WwuTYY1788612xrDfFQSqe3g; Sun, 26 Apr 2020 08:18:59 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.12821.1587914339002893055 for ; Sun, 26 Apr 2020 08:18:59 -0700 X-Received: from pps.filterd (m0134422.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03QFHcTM006067; Sun, 26 Apr 2020 15:18:58 GMT X-Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) by mx0b-002e3701.pphosted.com with ESMTP id 30my2nauda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 26 Apr 2020 15:18:58 +0000 X-Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2353.austin.hpe.com (Postfix) with ESMTP id 05CFC65; Sun, 26 Apr 2020 15:18:58 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 9FA0339; Sun, 26 Apr 2020 15:18:56 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Gilbert Chen , Leif Lindholm , Dandan Bi , Liming Gao Subject: [edk2-devel] [PATCH v2 3/3] MdeModulePkg/DxeIplPeim : RISC-V platform level DxeIPL Date: Sun, 26 Apr 2020 22:40:24 +0800 Message-Id: <20200426144024.7265-4-abner.chang@hpe.com> In-Reply-To: <20200426144024.7265-1-abner.chang@hpe.com> References: <20200426144024.7265-1-abner.chang@hpe.com> MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: <27952.devel.edk2.groups.io> Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: GQHH8OxDoMumr2dfSJICiGQox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587914339; bh=5mXikihjuiugdhHQJ8aJWvpu2ESzTQ2K1ol3mCYQjPQ=; h=Cc:Date:From:Reply-To:Subject:To; b=wPyQWiPlx5z+kahEEc+mh6V1Su4214g0M5ITSJlmtvs660bXSJLywxIoPXW8lt4aqKw zFvj1DXP/8XAZzxOWSiiRCl6wyKbYZALWTzApiejksolzcspagHiBgfSb1aq/XnnC0wVr tDR5k5Gb1leoHmU5MleTYmn9C5w7rA9pS68= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Implementation of RISC-V DxeIPL. Signed-off-by: Abner Chang Co-authored-by: Gilbert Chen Reviewed-by: Leif Lindholm Cc: Dandan Bi Cc: Liming Gao Cc: Leif Lindholm Cc: Gilbert Chen Reviewed-by: Dandan Bi --- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 6 +- .../Core/DxeIplPeim/RiscV64/DxeLoadFunc.c | 74 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 MdeModulePkg/Core/DxeIplPeim/RiscV64/DxeLoadFunc.c diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/Dx= eIplPeim/DxeIpl.inf index 98bc17fc9d..3f17028546 100644 --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf @@ -7,6 +7,7 @@ # # Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
# Copyright (c) 2017, AMD Incorporated. All rights reserved.
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -25,7 +26,7 @@ # # The following information is for reference only and not required by the = build tools. # -# VALID_ARCHITECTURES =3D IA32 X64 EBC (EBC is for build only) = AARCH64 +# VALID_ARCHITECTURES =3D IA32 X64 EBC (EBC is for build only) = AARCH64 RISCV64 # =20 [Sources] @@ -49,6 +50,9 @@ [Sources.ARM, Sources.AARCH64] Arm/DxeLoadFunc.c =20 +[Sources.RISCV64] + RiscV64/DxeLoadFunc.c + [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec diff --git a/MdeModulePkg/Core/DxeIplPeim/RiscV64/DxeLoadFunc.c b/MdeModule= Pkg/Core/DxeIplPeim/RiscV64/DxeLoadFunc.c new file mode 100644 index 0000000000..2ce52eb0ec --- /dev/null +++ b/MdeModulePkg/Core/DxeIplPeim/RiscV64/DxeLoadFunc.c @@ -0,0 +1,74 @@ +/** @file + RISC-V specific functionality for DxeLoad. + + Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "DxeIpl.h" + +/** + Transfers control to DxeCore. + + This function performs a CPU architecture specific operations to execute + the entry point of DxeCore with the parameters of HobList. + It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase. + + @param DxeCoreEntryPoint The entry point of DxeCore. + @param HobList The start of HobList passed to DxeCore. + +**/ +VOID +HandOffToDxeCore ( + IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint, + IN EFI_PEI_HOB_POINTERS HobList + ) +{ + VOID *BaseOfStack; + VOID *TopOfStack; + EFI_STATUS Status; + // + // + // Allocate 128KB for the Stack + // + BaseOfStack =3D AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE)); + if (BaseOfStack =3D=3D NULL) { + DEBUG((DEBUG_ERROR, "%a: Can't allocate memory for stack.", __FUNCTION= __)); + ASSERT(FALSE); + } + + // + // Compute the top of the stack we were allocated. Pre-allocate a UINTN + // for safety. + // + TopOfStack =3D (VOID *)((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_S= IZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT); + TopOfStack =3D ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT); + + // + // End of PEI phase signal + // + Status =3D PeiServicesInstallPpi (&gEndOfPeiSignalPpi); + if (EFI_ERROR (Status)) { + DEBUG((DEBUG_ERROR, "%a: Fail to signal End of PEI event.", __FUNCTION= __)); + ASSERT(FALSE); + } + // + // Update the contents of BSP stack HOB to reflect the real stack info p= assed to DxeCore. + // + UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE); + + DEBUG ((DEBUG_INFO, "DXE Core new stack at %x, stack pointer at %x\n", B= aseOfStack, TopOfStack)); + + // + // Transfer the control to the entry point of DxeCore. + // + SwitchStack ( + (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint, + HobList.Raw, + NULL, + TopOfStack + ); +} + --=20 2.25.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58150): https://edk2.groups.io/g/devel/message/58150 Mute This Topic: https://groups.io/mt/73284221/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-