* [edk2-devel] [PATCH edk2-platform v2 0/3] StandloneMm support for FVP. @ 2024-03-15 10:59 levi.yun 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 1/3] Platform/Arm: FVP: Add a NorFlashLib instance for StandaloneMm levi.yun 0 siblings, 1 reply; 4+ messages in thread From: levi.yun @ 2024-03-15 10:59 UTC (permalink / raw) To: devel; +Cc: yeoreum.yun, sami.mujawar, pierre.gondois, nd, thomas.abraham This patch adds StandloneMm feature on FVP RevC & AEMvA. StandaloneMm will be used for UEFI secure Variable support on these models. v1->v2: - Rebase to master - Use MmunblockLibNull when ENABLE_STMM == TRUE. levi.yun (3): Platform/Arm: FVP: Add a NorFlashLib instance for StandaloneMm Platform/Arm: Enable UEFI Secure Variable support for FVP Platform/Arm: Add Standalone MM support for FVP Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 49 ++++- Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc | 208 ++++++++++++++++++++ Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf | 9 + Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf | 106 ++++++++++ Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf | 3 +- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.inf | 30 +++ Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c | 34 +--- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c | 42 ++++ Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmInfo.c | 28 +++ 9 files changed, 477 insertions(+), 32 deletions(-) create mode 100644 Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc create mode 100644 Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf create mode 100644 Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.inf create mode 100644 Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c create mode 100644 Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmInfo.c -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116808): https://edk2.groups.io/g/devel/message/116808 Mute This Topic: https://groups.io/mt/104945004/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 4+ messages in thread
* [edk2-devel] [PATCH edk2-platform v2 1/3] Platform/Arm: FVP: Add a NorFlashLib instance for StandaloneMm 2024-03-15 10:59 [edk2-devel] [PATCH edk2-platform v2 0/3] StandloneMm support for FVP levi.yun @ 2024-03-15 10:59 ` levi.yun 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 2/3] Platform/Arm: Enable UEFI Secure Variable support for FVP levi.yun 0 siblings, 1 reply; 4+ messages in thread From: levi.yun @ 2024-03-15 10:59 UTC (permalink / raw) To: devel; +Cc: yeoreum.yun, sami.mujawar 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 <yeoreum.yun@arm.com> --- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf | 3 +- Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.inf | 30 ++++++++++++++ Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.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/NorFlashArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf index c9fbd80d47eb865b81e85bb513a44f7c18b58927..1a656836675876b492cdb33f3bf6bfc0b76d15b7 100644 --- a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpressLib.inf @@ -1,6 +1,6 @@ #/** @file # -# Copyright (c) 2011, ARM Ltd. All rights reserved.<BR> +# Copyright (c) 2011-2024, ARM Ltd. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # #**/ @@ -15,6 +15,7 @@ [Defines] [Sources.common] NorFlashArmVExpress.c + NorFlashInfo.c [Packages] MdePkg/MdePkg.dec diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.inf b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.inf new file mode 100644 index 0000000000000000000000000000000000000000..79f3723d62a36577c1242f87265b7fc1c07cbee1 --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.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 = 0x0001001A + BASE_NAME = NorFlashStMmLib + FILE_GUID = 011baec0-ae08-11ee-93fa-bb327a85ca4a + MODULE_TYPE = MM_STANDALONE + VERSION_STRING = 1.0 + PI_SPECIFICATION_VERSION = 0x00010032 + LIBRARY_CLASS = 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/NorFlashArmVExpress.c b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c index ec5ac8cc625fa3037edf63551baa43dab327ec5b..9b71df991a7a288f63f7dc2f50ffba251beaf8f2 100644 --- a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashArmVExpress.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR> + Copyright (c) 2011-2024, ARM Ltd. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -12,34 +12,8 @@ #include <Library/NorFlashPlatformLib.h> #include <ArmPlatform.h> -#define NOR_FLASH_DEVICE_COUNT 4 - -NOR_FLASH_DESCRIPTION mNorFlashDevices[NOR_FLASH_DEVICE_COUNT] = { - { // BootMon - ARM_VE_SMB_NOR0_BASE, - ARM_VE_SMB_NOR0_BASE, - SIZE_256KB * 255, - SIZE_256KB, - }, - { // BootMon non-volatile storage - ARM_VE_SMB_NOR0_BASE, - ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255, - SIZE_64KB * 4, - SIZE_64KB, - }, - { // UEFI - ARM_VE_SMB_NOR1_BASE, - ARM_VE_SMB_NOR1_BASE, - SIZE_256KB * 255, - SIZE_256KB, - }, - { // UEFI Variable Services non-volatile storage - ARM_VE_SMB_NOR1_BASE, - ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255, - 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. It should be 4 blocks - SIZE_64KB, - } -}; +extern NOR_FLASH_DESCRIPTION mNorFlashDevices[]; +extern UINT32 mNorFlashCount; EFI_STATUS NorFlashPlatformInitialization ( @@ -68,7 +42,7 @@ NorFlashPlatformGetDevices ( } *NorFlashDevices = mNorFlashDevices; - *Count = NOR_FLASH_DEVICE_COUNT; + *Count = mNorFlashCount; return EFI_SUCCESS; } diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c new file mode 100644 index 0000000000000000000000000000000000000000..fd515305fbbf1bbbfe5213329a88e40ed5b3f7a6 --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashInfo.c @@ -0,0 +1,42 @@ +/** @file + + Copyright (c) 2011-2024, Arm Ltd. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + + **/ + +#include <Base.h> +#include <Library/NorFlashPlatformLib.h> +#include <ArmPlatform.h> + +NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { + { // BootMon + ARM_VE_SMB_NOR0_BASE, + ARM_VE_SMB_NOR0_BASE, + SIZE_256KB * 255, + SIZE_256KB, + }, + { // BootMon non-volatile storage + ARM_VE_SMB_NOR0_BASE, + ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255, + SIZE_64KB * 4, + SIZE_64KB, + }, +#ifndef ENABLE_UEFI_SECURE_VARIABLE + { // UEFI + ARM_VE_SMB_NOR1_BASE, + ARM_VE_SMB_NOR1_BASE, + SIZE_256KB * 255, + SIZE_256KB, + }, + { // UEFI Variable Services non-volatile storage + ARM_VE_SMB_NOR1_BASE, + ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255, + 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. It should be 4 blocks + SIZE_64KB, + }, +#endif +}; + +UINT32 mNorFlashCount = ARRAY_SIZE(mNorFlashDevices); diff --git a/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmInfo.c b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmInfo.c new file mode 100644 index 0000000000000000000000000000000000000000..165e265e2c47a4ab66326fcc924c3aeaeaf68c62 --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmInfo.c @@ -0,0 +1,28 @@ +/** @file + + Copyright (c) 2024, Arm Limited. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + + **/ + +#include <Base.h> +#include <Library/NorFlashPlatformLib.h> +#include <ArmPlatform.h> + +NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { + { + ARM_VE_SMB_NOR1_BASE, + ARM_VE_SMB_NOR1_BASE, + SIZE_256KB * 255, + SIZE_256KB, + }, + { // UEFI Variable Services non-volatile storage + ARM_VE_SMB_NOR1_BASE, + ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255, + SIZE_64KB * 4, + SIZE_64KB, + }, +}; + +UINT32 mNorFlashCount = ARRAY_SIZE (mNorFlashDevices); -- 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] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [edk2-devel] [PATCH edk2-platform v2 2/3] Platform/Arm: Enable UEFI Secure Variable support for FVP 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 1/3] Platform/Arm: FVP: Add a NorFlashLib instance for StandaloneMm levi.yun @ 2024-03-15 10:59 ` levi.yun 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 3/3] Platform/Arm: Add Standalone MM " levi.yun 0 siblings, 1 reply; 4+ messages in thread From: levi.yun @ 2024-03-15 10:59 UTC (permalink / raw) To: devel; +Cc: yeoreum.yun, sami.mujawar, pierre.gondois, nd, thomas.abraham UEFI Secure variable support can be enabled using Standalone MM for FVP RevC model. The following steps enable UEFI variable service using StandaloneMm: 1. Add MmComminucationDxe. - Enables communication with StandaloneMm. The PcdMmBufferBase & PcdBufferSize definitions are used as the NS Shared Buffer for communication. 2. Use VariableSmmRuntimeDxe - Use Standalone MM instance of Variable Runtime Dxe. 3. Disable caching of variable data as this is cached on the normal world side. This is done to prevent arbitrary accesses. Therefore, set PcdEnableVariableRuntimeCache to FALSE. 4. Although MmUnblockMemoryLib is required for supporting variable caching (which we disabled), we need a NULL instance of the MmUnblockMemoryLib for the build to succeed. Also, the Arm implementation does not support modification of the StandaloneMm memory map from normal world, so we have no real need for MmUnblockMemoryLib. Signed-off-by: levi.yun <yeoreum.yun@arm.com> --- Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 49 +++++++++++++++++++- Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf | 9 ++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc index f70a4d52ba06f570e017ab5286f06d87193753e5..92e6ebc70aeb887b8c610c256b5fece9b9b87664 100644 --- a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc +++ b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc @@ -25,6 +25,15 @@ [Defines] SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf + # To allow the use of ueif secure variable feature, set this to TRUE. + DEFINE ENABLE_UEFI_SECURE_VARIABLE = FALSE + +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + DEFINE ENABLE_STMM = TRUE +!else + DEFINE ENABLE_STMM = FALSE +!endif + !ifndef ARM_FVP_RUN_NORFLASH DEFINE EDK2_SKIP_PEICORE=1 !endif @@ -53,6 +62,10 @@ [LibraryClasses.common] FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf !endif +!if $(ENABLE_STMM) == TRUE + MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf +!endif + DtPlatformDtbLoaderLib|Platform/ARM/VExpressPkg/Library/ArmVExpressDtPlatformDtbLoaderLib/ArmVExpressDtPlatformDtbLoaderLib.inf [LibraryClasses.common.DXE_RUNTIME_DRIVER] @@ -71,7 +84,9 @@ [LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, Libr [BuildOptions] GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Platform/ARM/VExpressPkg/Include/Platform/RTSM - +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + GCC:*_*_*_CC_FLAGS = -DENABLE_UEFI_SECURE_VARIABLE +!endif ################################################################################ # @@ -85,6 +100,11 @@ [PcdsFeatureFlag.common] # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + ## Disable Runtime Variable Cache. + gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE +!endif + [PcdsFixedAtBuild.common] # Only one core enters UEFI, and PSCI is implemented in EL3 by ATF gArmPlatformTokenSpaceGuid.PcdCoreCount|1 @@ -92,12 +112,26 @@ [PcdsFixedAtBuild.common] # # NV Storage PCDs. Use base of 0x0C000000 for NOR1 # +!if $(ENABLE_UEFI_SECURE_VARIABLE) == FALSE gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000 +!endif + + # + # Set the base address and size of the buffer used + # by MM_COMMUNICATE for communication between the + # Normal world edk2 and the StandaloneMm image at S-EL0. + # This buffer is allocated in TF-A. + # +!if $(ENABLE_STMM) == TRUE + ## MM Communicate + gArmTokenSpaceGuid.PcdMmBufferBase|0xFF600000 + gArmTokenSpaceGuid.PcdMmBufferSize|0x10000 +!endif gArmTokenSpaceGuid.PcdVFPEnabled|1 @@ -252,6 +286,10 @@ [Components.common] MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf !endif MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +!else MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { <LibraryClasses> NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf @@ -259,6 +297,8 @@ [Components.common] BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf +!endif + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf @@ -368,3 +408,10 @@ [Components.common] # SATA Controller # MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf + +!if $(ENABLE_STMM) == TRUE + ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf { + <LibraryClasses> + NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf + } +!endif diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf index e836691ddf6f9fd7e9abff97a560af6886b14ccb..612535caa7ee518a0bb083461f2573e182c78281 100644 --- a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf +++ b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.fdf @@ -80,8 +80,14 @@ [FV.FvMain] !if $(SECURE_BOOT_ENABLE) == TRUE INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf !endif + +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +!else INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf +!endif + INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf @@ -168,6 +174,9 @@ [FV.FvMain] INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf INF MdeModulePkg/Application/UiApp/UiApp.inf +!if $(ENABLE_STMM) == TRUE + INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf +!endif # # PCI Support -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116810): https://edk2.groups.io/g/devel/message/116810 Mute This Topic: https://groups.io/mt/104945006/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [edk2-devel] [PATCH edk2-platform v2 3/3] Platform/Arm: Add Standalone MM support for FVP 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 2/3] Platform/Arm: Enable UEFI Secure Variable support for FVP levi.yun @ 2024-03-15 10:59 ` levi.yun 0 siblings, 0 replies; 4+ messages in thread From: levi.yun @ 2024-03-15 10:59 UTC (permalink / raw) To: devel; +Cc: yeoreum.yun, sami.mujawar, pierre.gondois, nd, thomas.abraham Add Standalone MM support for FVP model. Signed-off-by: levi.yun <yeoreum.yun@arm.com> --- Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc | 208 ++++++++++++++++++++ Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf | 106 ++++++++++ 2 files changed, 314 insertions(+) diff --git a/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc new file mode 100644 index 0000000000000000000000000000000000000000..0e77b76cae698c5e0cba3ce3249b88e4cffc98a0 --- /dev/null +++ b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.dsc @@ -0,0 +1,208 @@ +## @file +# Standalone MM Platform. +# +# Copyright (c) 2024, Arm Limited. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + PLATFORM_NAME = StandaloneMm + PLATFORM_GUID = 9A4BBA60-B4F9-47C7-9258-3BD77CAE9322 + PLATFORM_VERSION = 1.0 + DSC_SPECIFICATION = 0x0001001C +!ifdef $(EDK2_OUT_DIR) + OUTPUT_DIRECTORY = $(EDK2_OUT_DIR) +!else + OUTPUT_DIRECTORY = Build/ArmVExpress-FVP-AArch64 +!endif + SUPPORTED_ARCHITECTURES = AARCH64|ARM + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf + DEFINE DEBUG_MESSAGE = TRUE + + # To allow the use of ueif secure variable feature, set this to TRUE. + DEFINE ENABLE_UEFI_SECURE_VARIABLE = FALSE + + # LzmaF86 + DEFINE COMPRESSION_TOOL_GUID = D42AE6BD-1352-4bfb-909A-CA72A6EAE889 + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this Platform. +# +################################################################################ + +!include MdePkg/MdeLibs.dsc.inc + +[LibraryClasses] + # + # Basic + # + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + + CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf + FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf + HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf + MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf + MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf + StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf + StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf + VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf + + # ARM PL011 UART Driver + PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf + PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf + SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf + +[LibraryClasses.AARCH64, LibraryClasses.ARM] + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + StandaloneMmMmuLib|ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf + ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf + PeCoffExtraActionLib|StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf + + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + +[LibraryClasses.common.MM_CORE_STANDALONE] + HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf + +[LibraryClasses.common.MM_STANDALONE] + MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf + + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf + PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + + # STMM for Variable runtime service. +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + NorFlashPlatformLib|Platform/ARM/VExpressPkg/Library/NorFlashArmVExpressLib/NorFlashStMmLib.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf +!endif + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ +[PcdsFixedAtBuild] + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000008F + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xff + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + + ## PL011 - Serial Terminal. + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c090000 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 + gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2 + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + + # + # NV Storage PCDs. + # Use its base last 256KB block for NOR1 flash. + # NOR1 base is 0x0C000000 for and its size 64MB. + # Therefore, 0x0C000000 + 0x04000000 (64MB) - 0x40000 (256KB) = 0x0FFC0000. + # +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000 +!endif + +################################################################################################### +# +# Components Section - list of the modules and components that will be processed by compilation +# tools and the EDK II tools to generate PE32/PE32+/Coff image files. +# +# Note: The EDK II DSC file is not used to specify how compiled binary images get placed +# into firmware volume images. This section is just a list of modules to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary files into firmware +# volume images, whose concept is beyond UEFI and is described in PI specification. +# Binary modules do not need to be listed in this section, as they should be +# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi), +# Logo (Logo.bmp), and etc. +# There may also be modules listed in this section that are not required in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be +# generated for it, but the binary will not be put into any firmware volume. +# +################################################################################################### +[Components.common] + # + # MM Core + # + StandaloneMmPkg/Core/StandaloneMmCore.inf + StandaloneMmPkg/Library/FvLib/FvLib.inf + StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf + StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf + StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf + StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf + StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf + StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf + StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf + +[Components.AARCH64, Components.ARM] + StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf + StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf + +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + Platform/ARM/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf { + <LibraryClasses> + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLibStandaloneMm.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf + } + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf +!endif + +################################################################################################### +# +# BuildOptions Section - Define the module specific tool chain flags that should be used as +# the default flags for a module. These flags are appended to any +# standard flags that are defined by the build process. They can be +# applied for any modules or only those modules with the specific +# module style (EDK or EDKII) specified in [Components] section. +# +################################################################################################### +[BuildOptions.AARCH64] + GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv8-a+nofp -mstrict-align + GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/Platform/ARM/VExpressPkg/Include/Platform/RTSM + GCC:*_*_*_CC_FLAGS = -mstrict-align + +[BuildOptions.ARM] + GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv7-a + GCC:*_*_*_CC_FLAGS = -fno-stack-protector diff --git a/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf new file mode 100644 index 0000000000000000000000000000000000000000..f4715433d107d38fd57205d546607e923d0aff9b --- /dev/null +++ b/Platform/ARM/VExpressPkg/PlatformStandaloneMm.fdf @@ -0,0 +1,106 @@ +# +# Copyright (c) 2024, Arm Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +################################################################################ +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +################################################################################ + +[FD.BL32_AP_MM] +# See macro definition BL32_BASE in TF-A code at include/plat/arm/common/arm_def.h +BaseAddress = 0xff200000|gArmTokenSpaceGuid.PcdFdBaseAddress + +# Maximum size of BL32 Image in TF-A (see include/plat/arm/common/arm_spm.def.h) +Size = 0x00300000|gArmTokenSpaceGuid.PcdFdSize + +ErasePolarity = 0 +BlockSize = 0x00001000 +NumBlocks = 0x300 + +# +# Limit the size of the binary to 1MB. +# If required this can be increased up to PcdFdSize. +# +0x00000000|0x00100000 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV = FVMAIN_COMPACT + +[FV.FVMAIN_COMPACT] +FvAlignment = 16 +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + + INF StandaloneMmPkg/Core/StandaloneMmCore.inf + INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf + +!if $(ENABLE_UEFI_SECURE_VARIABLE) == TRUE + INF Platform/ARM/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf +!endif + +################################################################################ +# +# Rules are use with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are the default +# rules for the different module type. User can add the customized rules to define the +# content of the FFS file. +# +################################################################################ + + +############################################################################ +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section # +############################################################################ +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER = $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING="$(MODULE_NAME)" Optional +# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) +# } +# } +# } +# +############################################################################ + +[Rule.Common.MM_CORE_STANDALONE] + FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED { + PE32 PE32 Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.MM_STANDALONE] + FILE MM_STANDALONE = $(NAMED_GUID) { + SMM_DEPEX SMM_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116811): https://edk2.groups.io/g/devel/message/116811 Mute This Topic: https://groups.io/mt/104945007/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-15 10:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-15 10:59 [edk2-devel] [PATCH edk2-platform v2 0/3] StandloneMm support for FVP levi.yun 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 1/3] Platform/Arm: FVP: Add a NorFlashLib instance for StandaloneMm levi.yun 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 2/3] Platform/Arm: Enable UEFI Secure Variable support for FVP levi.yun 2024-03-15 10:59 ` [edk2-devel] [PATCH edk2-platform v2 3/3] Platform/Arm: Add Standalone MM " levi.yun
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox