From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 078CED8030C for ; Fri, 15 Mar 2024 10:59:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=y3S5bvUuB1hv1o6nVjXEBMsJgCUHoHTfj0wiqv/cC4U=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1710500379; v=1; b=LR/9Mxdo50iH8xIv+g3OA03ZWXjZmKPZifuk2+XbxIocFZZdhjrh4qjvfhbQinUq3DJUuHOW rd5MsxHYk0nO4nUNJz/ywaEnti+C5ZrBDASHRnr3/HaLha1RsxfilcZnpKoSyuwrC3BzAsiAG0J OwVAbYTuwMdcWxgf6vVYPYlf5dEfuQhznvogjHqC5rHhjpkQfvkhWyLvkekxGYVr60qWuAzQA+M yOKhv0K1RY9qxLpykSsjRgvxhQRGHZBRAhG5L52VI6kD0U5QPMwl9bnBOGcMWJN+l4/1xUQn3jm HAA+KINW09kfU1Ls+nHWm6rfdrSOCUwXcSWh3Wo3IXJ7w== X-Received: by 127.0.0.2 with SMTP id 36jwYY7687511xkDKWQvjvPB; Fri, 15 Mar 2024 03:59:39 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.19221.1710500379154305161 for ; Fri, 15 Mar 2024 03:59:39 -0700 X-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 275BE1474; Fri, 15 Mar 2024 04:00:14 -0700 (PDT) X-Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 24B0B3F762; Fri, 15 Mar 2024 03:59:38 -0700 (PDT) From: "levi.yun" To: devel@edk2.groups.io Cc: yeoreum.yun@arm.com, sami.mujawar@arm.com Subject: [edk2-devel] [PATCH edk2-platform v2 1/3] Platform/Arm: FVP: Add a NorFlashLib instance for StandaloneMm Date: Fri, 15 Mar 2024 10:59:34 +0000 Message-Id: <20240315105936.499262-2-yeoreum.yun@arm.com> In-Reply-To: <20240315105936.499262-1-yeoreum.yun@arm.com> References: <20240315105936.499262-1-yeoreum.yun@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 15 Mar 2024 03:59:39 -0700 Reply-To: devel@edk2.groups.io,yeoreum.yun@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: xI36mUCDB5VoOR0I7h8K73Lhx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="LR/9Mxdo"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none) Cc: sami.mujawar@arm.com, pierre.gondois@arm.com, nd@arm.com, thomas.abraham@arm.com The NOR Flash1 is used for UEFI Variable storage. When Standalone MM is enabled the variable storage is managed in the secure world by Standalone MM. Therefore, add a new instance of NorFlashLib for that has the NOR Flash1 definitions for Standalone MM. Also, disable the NOR Flash1 definitions from the Normal world NorFlashLib instance when Standalone MM is enabled using the ENABLE_STMM build flag. Signed-off-by: levi.yun --- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpres= sLib.inf | 3 +- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.in= f | 30 ++++++++++++++ Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpres= s.c | 34 ++-------------- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c = | 42 ++++++++++++++++++++ Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmInfo.c= | 28 +++++++++++++ 5 files changed, 106 insertions(+), 31 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFla= shArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpress= Lib/NorFlashArmVExpressLib.inf index c9fbd80d47eb865b81e85bb513a44f7c18b58927..1a656836675876b492cdb33f3bf= 6bfc0b76d15b7 100644 --- a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVE= xpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVE= xpressLib.inf @@ -1,6 +1,6 @@ #/** @file=0D #=0D -# Copyright (c) 2011, ARM Ltd. All rights reserved.
=0D +# Copyright (c) 2011-2024, ARM Ltd. All rights reserved.
=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D #**/=0D @@ -15,6 +15,7 @@ [Defines] =0D [Sources.common]=0D NorFlashArmVExpress.c=0D + NorFlashInfo.c=0D =0D [Packages]=0D MdePkg/MdePkg.dec=0D diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFla= shStMmLib.inf b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/Nor= FlashStMmLib.inf new file mode 100644 index 0000000000000000000000000000000000000000..79f3723d62a36577c1242f87265= b7fc1c07cbee1 --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmL= ib.inf @@ -0,0 +1,30 @@ +## @file +# StandaloneMM instance of NOR Flash library. +# +# Copyright (c) 2024, ARM Limited. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D NorFlashStMmLib + FILE_GUID =3D 011baec0-ae08-11ee-93fa-bb327a85ca4a + MODULE_TYPE =3D MM_STANDALONE + VERSION_STRING =3D 1.0 + PI_SPECIFICATION_VERSION =3D 0x00010032 + LIBRARY_CLASS =3D NorFlashPlatformLib + +[Sources.common] + NorFlashArmVExpress.c + NorFlashStMmInfo.c + +[Packages] + MdePkg/MdePkg.dec + Platform/ARM/ARM.dec + Platform/ARM/VExpressPkg/ArmVExpressPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFla= shArmVExpress.c b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/N= orFlashArmVExpress.c index ec5ac8cc625fa3037edf63551baa43dab327ec5b..9b71df991a7a288f63f7dc2f50f= fba251beaf8f2 100644 --- a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVE= xpress.c +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVE= xpress.c @@ -1,6 +1,6 @@ /** @file=0D =0D - Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
=0D + Copyright (c) 2011-2024, ARM Ltd. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -12,34 +12,8 @@ #include =0D #include =0D =0D -#define NOR_FLASH_DEVICE_COUNT 4=0D -=0D -NOR_FLASH_DESCRIPTION mNorFlashDevices[NOR_FLASH_DEVICE_COUNT] =3D {=0D - { // BootMon=0D - ARM_VE_SMB_NOR0_BASE,=0D - ARM_VE_SMB_NOR0_BASE,=0D - SIZE_256KB * 255,=0D - SIZE_256KB,=0D - },=0D - { // BootMon non-volatile storage=0D - ARM_VE_SMB_NOR0_BASE,=0D - ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,=0D - SIZE_64KB * 4,=0D - SIZE_64KB,=0D - },=0D - { // UEFI=0D - ARM_VE_SMB_NOR1_BASE,=0D - ARM_VE_SMB_NOR1_BASE,=0D - SIZE_256KB * 255,=0D - SIZE_256KB,=0D - },=0D - { // UEFI Variable Services non-volatile storage=0D - ARM_VE_SMB_NOR1_BASE,=0D - ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255,=0D - SIZE_64KB * 3, //FIXME: Set 3 blocks because I did not succeed to copy= 4 blocks into the ARM Versatile Express NOR Flash in the last NOR Flash. I= t should be 4 blocks=0D - SIZE_64KB,=0D - }=0D -};=0D +extern NOR_FLASH_DESCRIPTION mNorFlashDevices[];=0D +extern UINT32 mNorFlashCount;=0D =0D EFI_STATUS=0D NorFlashPlatformInitialization (=0D @@ -68,7 +42,7 @@ NorFlashPlatformGetDevices ( }=0D =0D *NorFlashDevices =3D mNorFlashDevices;=0D - *Count =3D NOR_FLASH_DEVICE_COUNT;=0D + *Count =3D mNorFlashCount;=0D =0D return EFI_SUCCESS;=0D }=0D diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFla= shInfo.c b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlash= Info.c new file mode 100644 index 0000000000000000000000000000000000000000..fd515305fbbf1bbbfe5213329a8= 8e40ed5b3f7a6 --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c @@ -0,0 +1,42 @@ +/** @file=0D +=0D + Copyright (c) 2011-2024, Arm Ltd. All rights reserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D + **/=0D +=0D +#include =0D +#include =0D +#include =0D +=0D +NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D {=0D + { // BootMon=0D + ARM_VE_SMB_NOR0_BASE,=0D + ARM_VE_SMB_NOR0_BASE,=0D + SIZE_256KB * 255,=0D + SIZE_256KB,=0D + },=0D + { // BootMon non-volatile storage=0D + ARM_VE_SMB_NOR0_BASE,=0D + ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,=0D + SIZE_64KB * 4,=0D + SIZE_64KB,=0D + },=0D +#ifndef ENABLE_UEFI_SECURE_VARIABLE=0D + { // UEFI=0D + ARM_VE_SMB_NOR1_BASE,=0D + ARM_VE_SMB_NOR1_BASE,=0D + SIZE_256KB * 255,=0D + SIZE_256KB,=0D + },=0D + { // UEFI Variable Services non-volatile storage=0D + ARM_VE_SMB_NOR1_BASE,=0D + ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255,=0D + SIZE_64KB * 3, //FIXME: Set 3 blocks because I did not succeed to copy= 4 blocks into the ARM Versatile Express NOR Flash in the last NOR Flash. I= t should be 4 blocks=0D + SIZE_64KB,=0D + },=0D +#endif=0D +};=0D +=0D +UINT32 mNorFlashCount =3D ARRAY_SIZE(mNorFlashDevices);=0D diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFla= shStMmInfo.c b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorF= lashStMmInfo.c new file mode 100644 index 0000000000000000000000000000000000000000..165e265e2c47a4ab66326fcc924= c3aeaeaf68c62 --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmI= nfo.c @@ -0,0 +1,28 @@ +/** @file=0D +=0D + Copyright (c) 2024, Arm Limited. All rights reserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D + **/=0D +=0D +#include =0D +#include =0D +#include =0D +=0D +NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D {=0D + {=0D + ARM_VE_SMB_NOR1_BASE,=0D + ARM_VE_SMB_NOR1_BASE,=0D + SIZE_256KB * 255,=0D + SIZE_256KB,=0D + },=0D + { // UEFI Variable Services non-volatile storage=0D + ARM_VE_SMB_NOR1_BASE,=0D + ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255,=0D + SIZE_64KB * 4,=0D + SIZE_64KB,=0D + },=0D +};=0D +=0D +UINT32 mNorFlashCount =3D ARRAY_SIZE (mNorFlashDevices);=0D -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116809): https://edk2.groups.io/g/devel/message/116809 Mute This Topic: https://groups.io/mt/104945005/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-