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 277D7AC0BD2 for ; Thu, 7 Sep 2023 04:59:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5WJzORBVfIs1hyTruVwijWxQcFfHoQowfd/PBvJhnbk=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1694062767; v=1; b=rd9SMx8ZG8a1MlhZVaIpbMPWs7Ii99g1sC4QdrpKaKORd1tI+lH2P2dhwZMZr3Pr//1Dsmxx 9hks0r5U01P7IMV9a4OsMg3JCzvYjLQQLmr1wDTDIR5ZSQNy7jyd6h4rAbNBjuJuN5YNv+yHHoU fKkH5ozfO6P6Xno5HfbEOUEU= X-Received: by 127.0.0.2 with SMTP id 7RIRYY7687511xwzszYcDZpj; Wed, 06 Sep 2023 21:59:27 -0700 X-Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mx.groups.io with SMTP id smtpd.web10.6560.1694062766787577722 for ; Wed, 06 Sep 2023 21:59:26 -0700 X-Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-573e67cc6eeso434626a12.2 for ; Wed, 06 Sep 2023 21:59:26 -0700 (PDT) X-Gm-Message-State: 1UaqsjeKxBmDLql2g73q0e7bx7686176AA= X-Google-Smtp-Source: AGHT+IEaVLQPmEoPpPwSHq4jHkQDeCMTN/nLurxKey7GZAu2dQZ9F+kNNMgTwmLXig8jhm5n5ys6JQ== X-Received: by 2002:a05:6a20:a122:b0:14c:d0c0:d406 with SMTP id q34-20020a056a20a12200b0014cd0c0d406mr18326162pzk.58.1694062765388; Wed, 06 Sep 2023 21:59:25 -0700 (PDT) X-Received: from localhost.localdomain (c-76-20-53-72.hsd1.ca.comcast.net. [76.20.53.72]) by smtp.gmail.com with ESMTPSA id q25-20020a63bc19000000b00553d42a7cb5sm11762266pge.68.2023.09.06.21.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 21:59:24 -0700 (PDT) From: "Tuan Phan" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, sami.mujawar@arm.com, ray.ni@intel.com, huangming@linux.alibaba.com, sunilvl@ventanamicro.com, yong.li@intel.com, Tuan Phan Subject: [edk2-devel] [PATCH] StandaloneMmPkg: Make StandaloneMmCpu driver platform independent Date: Wed, 6 Sep 2023 21:59:14 -0700 Message-Id: <20230907045914.29608-1-tphan@ventanamicro.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 Reply-To: devel@edk2.groups.io,tphan@ventanamicro.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=rd9SMx8Z; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io StandaloneMmCpu now can supports more platforms like RISC-V besides ARM/AARCH64. Signed-off-by: Tuan Phan --- .../Drivers/StandaloneMmCpu/EventHandle.c | 25 +++-------- .../Drivers/StandaloneMmCpu/StandaloneMmCpu.c | 42 +++++++++--------- .../StandaloneMmCpu/StandaloneMmCpu.inf | 9 ++-- .../Library/Arm/StandaloneMmCoreEntryPoint.h | 17 ++------ .../StandaloneMmCpu.h | 22 +++++++--- .../Arm/CreateHobList.c | 43 ++++++++++--------- .../Arm/StandaloneMmCoreEntryPoint.c | 15 ++++++- .../StandaloneMmCoreEntryPoint.inf | 2 +- StandaloneMmPkg/StandaloneMmPkg.dec | 2 +- 9 files changed, 86 insertions(+), 91 deletions(-) rename StandaloneMmPkg/{Drivers/StandaloneMmCpu =3D> Include}/StandaloneMm= Cpu.h (82%) diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c b/Standa= loneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c index 818e147f874c..dc11d4375a02 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c @@ -3,6 +3,7 @@ Copyright (c) 2016 HP Development Company, L.P.=0D Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.=0D Copyright (c) 2021, Linaro Limited=0D + Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -11,8 +12,6 @@ #include =0D #include =0D =0D -#include =0D -#include =0D #include =0D #include =0D #include =0D @@ -22,10 +21,7 @@ #include =0D #include =0D =0D -#include =0D -#include =0D -=0D -#include "StandaloneMmCpu.h"=0D +#include =0D =0D EFI_STATUS=0D EFIAPI=0D @@ -108,7 +104,7 @@ CheckBufferAddr ( }=0D =0D /**=0D - The PI Standalone MM entry point for the TF-A CPU driver.=0D + The PI Standalone MM entry point for the CPU driver.=0D =0D @param [in] EventId The event Id.=0D @param [in] CpuNumber The CPU number.=0D @@ -121,7 +117,7 @@ CheckBufferAddr ( @retval EFI_UNSUPPORTED Operation not supported.=0D **/=0D EFI_STATUS=0D -PiMmStandaloneArmTfCpuDriverEntry (=0D +PiMmStandaloneMmCpuDriverEntry (=0D IN UINTN EventId,=0D IN UINTN CpuNumber,=0D IN UINTN NsCommBufferAddr=0D @@ -135,17 +131,6 @@ PiMmStandaloneArmTfCpuDriverEntry ( DEBUG ((DEBUG_INFO, "Received event - 0x%x on cpu %d\n", EventId, CpuNum= ber));=0D =0D Status =3D EFI_SUCCESS;=0D - //=0D - // ARM TF passes SMC FID of the MM_COMMUNICATE interface as the Event ID= upon=0D - // receipt of a synchronous MM request. Use the Event ID to distinguish= =0D - // between synchronous and asynchronous events.=0D - //=0D - if ((ARM_SMC_ID_MM_COMMUNICATE !=3D EventId) &&=0D - (ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ !=3D EventId))=0D - {=0D - DEBUG ((DEBUG_ERROR, "UnRecognized Event - 0x%x\n", EventId));=0D - return EFI_INVALID_PARAMETER;=0D - }=0D =0D // Perform parameter validation of NsCommBufferAddr=0D if (NsCommBufferAddr =3D=3D (UINTN)NULL) {=0D @@ -177,7 +162,7 @@ PiMmStandaloneArmTfCpuDriverEntry ( }=0D =0D // X1 contains the VA of the normal world memory accessible from=0D - // S-EL0=0D + // secure world.=0D CopyMem (GuidedEventContext, (CONST VOID *)NsCommBufferAddr, NsCommBuffe= rSize);=0D =0D // Stash the pointer to the allocated Event Context for this CPU=0D diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c b/St= andaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c index 3d1dc6181bd9..c5ec1a5a80c5 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c @@ -3,6 +3,7 @@ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
=0D Copyright (c) 2016 HP Development Company, L.P.=0D Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.=0D + Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -10,10 +11,7 @@ =0D #include =0D #include =0D -#include =0D #include =0D -#include =0D -#include =0D #include =0D #include =0D =0D @@ -22,7 +20,7 @@ #include =0D #include =0D =0D -#include "StandaloneMmCpu.h"=0D +#include =0D =0D // GUID to identify HOB with whereabouts of communication buffer with Norm= al=0D // World=0D @@ -31,7 +29,7 @@ extern EFI_GUID gEfiStandaloneMmNonSecureBufferGuid; // GUID to identify HOB where the entry point of this CPU driver will be=0D // populated to allow the entry point driver to invoke it upon receipt of = an=0D // event=0D -extern EFI_GUID gEfiArmTfCpuDriverEpDescriptorGuid;=0D +extern EFI_GUID gEfiMmCpuDriverEpDescriptorGuid;=0D =0D //=0D // Private copy of the MM system table for future use=0D @@ -96,17 +94,17 @@ StandaloneMmCpuInitialize ( IN EFI_MM_SYSTEM_TABLE *SystemTable // not actual systemtable=0D )=0D {=0D - ARM_TF_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;=0D - EFI_CONFIGURATION_TABLE *ConfigurationTable;=0D - MP_INFORMATION_HOB_DATA *MpInformationHobData;=0D - EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;=0D - EFI_STATUS Status;=0D - EFI_HANDLE DispatchHandle;=0D - UINT32 MpInfoSize;=0D - UINTN Index;=0D - UINTN ArraySize;=0D - VOID *HobStart;=0D - EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;=0D + MM_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;=0D + EFI_CONFIGURATION_TABLE *ConfigurationTable;=0D + MP_INFORMATION_HOB_DATA *MpInformationHobData;=0D + EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;=0D + EFI_STATUS Status;=0D + EFI_HANDLE DispatchHandle;=0D + UINT32 MpInfoSize;=0D + UINTN Index;=0D + UINTN ArraySize;=0D + VOID *HobStart;=0D + EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;=0D =0D ASSERT (SystemTable !=3D NULL);=0D mMmst =3D SystemTable;=0D @@ -133,7 +131,7 @@ StandaloneMmCpuInitialize ( }=0D =0D // Retrieve the Hoblist from the MMST to extract the details of the NS=0D - // communication buffer that has been reserved by S-EL1/EL3=0D + // communication buffer that has been reserved for StandaloneMmPkg=0D ConfigurationTable =3D mMmst->MmConfigurationTable;=0D for (Index =3D 0; Index < mMmst->NumberOfTableEntries; Index++) {=0D if (CompareGuid (&gEfiHobListGuid, &(ConfigurationTable[Index].VendorG= uid))) {=0D @@ -154,11 +152,11 @@ StandaloneMmCpuInitialize ( //=0D Status =3D GetGuidedHobData (=0D HobStart,=0D - &gEfiArmTfCpuDriverEpDescriptorGuid,=0D + &gEfiMmCpuDriverEpDescriptorGuid,=0D (VOID **)&CpuDriverEntryPointDesc=0D );=0D if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "ArmTfCpuDriverEpDesc HOB data extraction failed = - 0x%x\n", Status));=0D + DEBUG ((DEBUG_ERROR, "MmCpuDriverEpDesc HOB data extraction failed - 0= x%x\n", Status));=0D return Status;=0D }=0D =0D @@ -166,10 +164,10 @@ StandaloneMmCpuInitialize ( DEBUG ((=0D DEBUG_INFO,=0D "Sharing Cpu Driver EP *0x%lx =3D 0x%lx\n",=0D - (UINTN)CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr,=0D - (UINTN)PiMmStandaloneArmTfCpuDriverEntry=0D + (UINTN)CpuDriverEntryPointDesc->MmCpuDriverEpPtr,=0D + (UINTN)PiMmStandaloneMmCpuDriverEntry=0D ));=0D - *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) =3D PiMmStandaloneArmTfC= puDriverEntry;=0D + *(CpuDriverEntryPointDesc->MmCpuDriverEpPtr) =3D PiMmStandaloneMmCpuDriv= erEntry;=0D =0D // Find the descriptor that contains the whereabouts of the buffer for=0D // communication with the Normal world.=0D diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf b/= StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf index 1fcb17d89d36..486ccbac1b7c 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf @@ -1,9 +1,10 @@ ## @file=0D -# Standalone MM CPU driver for ARM Standard Platforms=0D +# Standalone MM CPU driver=0D #=0D # Copyright (c) 2009, Apple Inc. All rights reserved.
=0D # Copyright (c) 2016 HP Development Company, L.P.=0D # Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.=0D +# Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D ##=0D @@ -19,18 +20,14 @@ =0D [Sources]=0D StandaloneMmCpu.c=0D - StandaloneMmCpu.h=0D EventHandle.c=0D =0D [Packages]=0D - ArmPkg/ArmPkg.dec=0D MdePkg/MdePkg.dec=0D MdeModulePkg/MdeModulePkg.dec=0D StandaloneMmPkg/StandaloneMmPkg.dec=0D =0D [LibraryClasses]=0D - ArmLib=0D - ArmSvcLib=0D BaseMemoryLib=0D DebugLib=0D HobLib=0D @@ -46,7 +43,7 @@ gZeroGuid=0D gMpInformationHobGuid=0D gEfiStandaloneMmNonSecureBufferGuid=0D - gEfiArmTfCpuDriverEpDescriptorGuid=0D + gEfiMmCpuDriverEpDescriptorGuid=0D =0D [Depex]=0D TRUE=0D diff --git a/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint= .h b/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h index 41bf0f132b4f..dbb81610ff8e 100644 --- a/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h +++ b/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef __STANDALONEMMCORE_ENTRY_POINT_H__=0D #define __STANDALONEMMCORE_ENTRY_POINT_H__=0D =0D +#include =0D #include =0D #include =0D =0D @@ -47,18 +48,6 @@ typedef struct { EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;=0D } EFI_SECURE_PARTITION_BOOT_INFO;=0D =0D -typedef=0D -EFI_STATUS=0D -(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) (=0D - IN UINTN EventId,=0D - IN UINTN CpuNumber,=0D - IN UINTN NsCommBufferAddr=0D - );=0D -=0D -typedef struct {=0D - PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *ArmTfCpuDriverEpPtr;=0D -} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR;=0D -=0D typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (=0D IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D IN UINT64 Length=0D @@ -145,8 +134,8 @@ LocateStandaloneMmCorePeCoffData ( VOID *=0D EFIAPI=0D CreateHobListFromBootInfo (=0D - IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D - IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D + IN OUT PI_MM_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D + IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D );=0D =0D /**=0D diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h b/St= andaloneMmPkg/Include/StandaloneMmCpu.h similarity index 82% rename from StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h rename to StandaloneMmPkg/Include/StandaloneMmCpu.h index 3d4698ec1957..1dce7c132ec2 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h +++ b/StandaloneMmPkg/Include/StandaloneMmCpu.h @@ -7,14 +7,26 @@ =0D **/=0D =0D -#ifndef _ARM_TF_CPU_DRIVER_H_=0D -#define _ARM_TF_CPU_DRIVER_H_=0D +#ifndef MM_CPU_DRIVER_H_=0D +#define MM_CPU_DRIVER_H_=0D =0D #include =0D #include =0D #include =0D #include =0D =0D +typedef=0D +EFI_STATUS=0D +(*PI_MM_CPU_DRIVER_ENTRYPOINT) (=0D + IN UINTN EventId,=0D + IN UINTN CpuNumber,=0D + IN UINTN NsCommBufferAddr=0D + );=0D +=0D +typedef struct {=0D + PI_MM_CPU_DRIVER_ENTRYPOINT *MmCpuDriverEpPtr;=0D +} MM_CPU_DRIVER_EP_DESCRIPTOR;=0D +=0D //=0D // CPU driver initialization specific declarations=0D //=0D @@ -35,7 +47,7 @@ extern MP_INFORMATION_HOB_DATA *mMpInformationHobD= ata; extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig;=0D =0D /**=0D - The PI Standalone MM entry point for the TF-A CPU driver.=0D + The PI Standalone MM entry point for the CPU driver.=0D =0D @param [in] EventId The event Id.=0D @param [in] CpuNumber The CPU number.=0D @@ -48,7 +60,7 @@ extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig; @retval EFI_UNSUPPORTED Operation not supported.=0D **/=0D EFI_STATUS=0D -PiMmStandaloneArmTfCpuDriverEntry (=0D +PiMmStandaloneMmCpuDriverEntry (=0D IN UINTN EventId,=0D IN UINTN CpuNumber,=0D IN UINTN NsCommBufferAddr=0D @@ -79,4 +91,4 @@ PiMmCpuTpFwRootMmiHandler ( IN OUT UINTN *CommBufferSize OPTIONAL=0D );=0D =0D -#endif=0D +#endif /* MM_CPU_DRIVER_H_ */=0D diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateH= obList.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHob= List.c index 2ac2d354f06a..80ed532352af 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include =0D #include =0D =0D +#include =0D #include =0D #include =0D #include =0D @@ -39,7 +40,7 @@ extern EFI_GUID gEfiStandaloneMmNonSecureBufferGuid; // GUID to identify HOB where the entry point of the CPU driver will be=0D // populated to allow this entry point driver to invoke it upon receipt of= an=0D // event=0D -extern EFI_GUID gEfiArmTfCpuDriverEpDescriptorGuid;=0D +extern EFI_GUID gEfiMmCpuDriverEpDescriptorGuid;=0D =0D /**=0D Use the boot information passed by privileged firmware to populate a HOB= list=0D @@ -52,22 +53,22 @@ extern EFI_GUID gEfiArmTfCpuDriverEpDescriptorGuid; **/=0D VOID *=0D CreateHobListFromBootInfo (=0D - IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D - IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D + IN OUT PI_MM_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D + IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D )=0D {=0D - EFI_HOB_HANDOFF_INFO_TABLE *HobStart;=0D - EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;=0D - UINT32 Index;=0D - UINT32 BufferSize;=0D - UINT32 Flags;=0D - EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;=0D - EFI_MMRAM_DESCRIPTOR *MmramRanges;=0D - EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;=0D - MP_INFORMATION_HOB_DATA *MpInformationHobData;=0D - EFI_PROCESSOR_INFORMATION *ProcInfoBuffer;=0D - EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;=0D - ARM_TF_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;=0D + EFI_HOB_HANDOFF_INFO_TABLE *HobStart;=0D + EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;=0D + UINT32 Index;=0D + UINT32 BufferSize;=0D + UINT32 Flags;=0D + EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;=0D + EFI_MMRAM_DESCRIPTOR *MmramRanges;=0D + EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;=0D + MP_INFORMATION_HOB_DATA *MpInformationHobData;=0D + EFI_PROCESSOR_INFORMATION *ProcInfoBuffer;=0D + EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;=0D + MM_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;=0D =0D // Create a hoblist with a PHIT and EOH=0D HobStart =3D HobConstructor (=0D @@ -144,13 +145,13 @@ CreateHobListFromBootInfo ( =0D // Create a Guided HOB to enable the ARM TF CPU driver to share its entr= y=0D // point and populate it with the address of the shared buffer=0D - CpuDriverEntryPointDesc =3D (ARM_TF_CPU_DRIVER_EP_DESCRIPTOR *)BuildGuid= Hob (=0D - &gEfiArmT= fCpuDriverEpDescriptorGuid,=0D - sizeof (A= RM_TF_CPU_DRIVER_EP_DESCRIPTOR)=0D - );=0D + CpuDriverEntryPointDesc =3D (MM_CPU_DRIVER_EP_DESCRIPTOR *)BuildGuidHob = (=0D + &gEfiMmCpuDri= verEpDescriptorGuid,=0D + sizeof (MM_CP= U_DRIVER_EP_DESCRIPTOR)=0D + );=0D =0D - *CpuDriverEntryPoint =3D NULL;=0D - CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr =3D CpuDriverEntryPoint;=0D + *CpuDriverEntryPoint =3D NULL;=0D + CpuDriverEntryPointDesc->MmCpuDriverEpPtr =3D CpuDriverEntryPoint;=0D =0D // Find the size of the GUIDed HOB with SRAM ranges=0D BufferSize =3D sizeof (EFI_MMRAM_HOB_DESCRIPTOR_BLOCK);=0D diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/Standal= oneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/= Arm/StandaloneMmCoreEntryPoint.c index 96de10405af8..900e0252ef9f 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCo= reEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCo= reEntryPoint.c @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include =0D #include =0D =0D +#include =0D #include =0D #include =0D #include =0D @@ -41,7 +42,7 @@ STATIC CONST UINT32 mSpmMinorVerFfa =3D SPM_MINOR_VERSIO= N_FFA; =0D #define BOOT_PAYLOAD_VERSION 1=0D =0D -PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT CpuDriverEntryPoint =3D NULL;=0D +PI_MM_CPU_DRIVER_ENTRYPOINT CpuDriverEntryPoint =3D NULL;=0D =0D /**=0D Retrieve a pointer to and print the boot information passed by privilege= d=0D @@ -140,6 +141,18 @@ DelegatedEventLoop ( DEBUG ((DEBUG_INFO, "X6 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg6= ));=0D DEBUG ((DEBUG_INFO, "X7 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg7= ));=0D =0D + //=0D + // ARM TF passes SMC FID of the MM_COMMUNICATE interface as the Event = ID upon=0D + // receipt of a synchronous MM request. Use the Event ID to distinguis= h=0D + // between synchronous and asynchronous events.=0D + //=0D + if ((ARM_SMC_ID_MM_COMMUNICATE !=3D (UINT32)EventCompleteSvcArgs->Arg0= ) &&=0D + (ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ !=3D (UINT32)EventCompleteSvcA= rgs->Arg0))=0D + {=0D + DEBUG ((DEBUG_ERROR, "UnRecognized Event - 0x%x\n", (UINT32)EventCom= pleteSvcArgs->Arg0));=0D + continue;=0D + }=0D +=0D FfaEnabled =3D FeaturePcdGet (PcdFfaEnable);=0D if (FfaEnabled) {=0D Status =3D CpuDriverEntryPoint (=0D diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 75cfb98c0e75..d41d7630b614 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -49,7 +49,7 @@ gMpInformationHobGuid=0D gEfiMmPeiMmramMemoryReserveGuid=0D gEfiStandaloneMmNonSecureBufferGuid=0D - gEfiArmTfCpuDriverEpDescriptorGuid=0D + gEfiMmCpuDriverEpDescriptorGuid=0D =0D [FeaturePcd.ARM, FeaturePcd.AARCH64]=0D gArmTokenSpaceGuid.PcdFfaEnable=0D diff --git a/StandaloneMmPkg/StandaloneMmPkg.dec b/StandaloneMmPkg/Standalo= neMmPkg.dec index 46784d94e421..f7cb9e8e2687 100644 --- a/StandaloneMmPkg/StandaloneMmPkg.dec +++ b/StandaloneMmPkg/StandaloneMmPkg.dec @@ -46,5 +46,5 @@ gEfiMmPeiMmramMemoryReserveGuid =3D { 0x0703f912, 0xbf8d, 0x4e2= a, { 0xbe, 0x07, 0xab, 0x27, 0x25, 0x25, 0xc5, 0x92 }}=0D =0D gEfiStandaloneMmNonSecureBufferGuid =3D { 0xf00497e3, 0xbfa2, 0x41a= 1, { 0x9d, 0x29, 0x54, 0xc2, 0xe9, 0x37, 0x21, 0xc5 }}=0D - gEfiArmTfCpuDriverEpDescriptorGuid =3D { 0x6ecbd5a1, 0xc0f8, 0x470= 2, { 0x83, 0x01, 0x4f, 0xc2, 0xc5, 0x47, 0x0a, 0x51 }}=0D + gEfiMmCpuDriverEpDescriptorGuid =3D { 0x6ecbd5a1, 0xc0f8, 0x470= 2, { 0x83, 0x01, 0x4f, 0xc2, 0xc5, 0x47, 0x0a, 0x51 }}=0D =0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108359): https://edk2.groups.io/g/devel/message/108359 Mute This Topic: https://groups.io/mt/101209230/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-