From 523dbb6d597b63181bba85a337d1f53e511f4822 Mon Sep 17 00:00:00 2001 From: Kun Qin Date: Wed, 5 Feb 2025 16:00:12 -0800 Subject: ArmPkg: ArmFfaStandaloneMmLib: Fix non-FFA path ArmFfaLibCommonInit will return EFI_UNSUPPORTED when there is no FFA supported on the platform. This is expected behavior. However, the return of error code will incur program asserts. This change fixed the non-FFA path for the Standalone MM instance. Signed-off-by: Kun Qin --- ArmPkg/Library/ArmFfaLib/ArmFfaStandaloneMmLib.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Library/ArmFfaLib/ArmFfaStandaloneMmLib.c b/ArmPkg/Library/ArmFfaLib/ArmFfaStandaloneMmLib.c index ce70e07d48..2d7f834219 100644 --- a/ArmPkg/Library/ArmFfaLib/ArmFfaStandaloneMmLib.c +++ b/ArmPkg/Library/ArmFfaLib/ArmFfaStandaloneMmLib.c @@ -68,5 +68,22 @@ ArmFfaStandaloneMmLibConstructor ( IN EFI_MM_SYSTEM_TABLE *MmSystemTable ) { - return ArmFfaLibCommonInit (); + EFI_STATUS Status; + + Status = ArmFfaLibCommonInit (); + if (Status == EFI_UNSUPPORTED) { + /* + * EFI_UNSUPPORTED means FF-A interface isn't available. + * However, for Standalone MM modules, FF-A availability is not required. + * i.e. Standalone MM could use SpmMm as a legitimate protocol. + * Thus, returning EFI_SUCCESS here to avoid the entrypoint to assert. + */ + return EFI_SUCCESS; + } + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a failed. Status = %r\n", __func__, Status)); + } + + return Status; } -- cgit