Return EFI_NOT_FOUND if opensbi firmware context can not be
located using SBI call.

Signed-off-by: Abner Chang <abner.ch...@hpe.com>
Cc: Daniel Schaefer <daniel.schae...@hpe.com>
Cc: Leif Lindholm <l...@nuviainc.com>
---
 .../ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c 
b/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c
index 0df505d267..64c30b950d 100644
--- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c
+++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c
@@ -851,6 +851,8 @@ SbiGetMscratchHartid (
 
   @param[out] FirmwareContext      The firmware context pointer.
   @retval EFI_SUCCESS              The operation succeeds.
+  @retval EFI_NOT_FOUND            Failed to get the pointer of 
EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT.
+
 **/
 EFI_STATUS
 EFIAPI
@@ -866,8 +868,9 @@ SbiGetFirmwareContext (
     ScratchSpace = (SBI_SCRATCH *)Ret.Value;
     SbiPlatform = (SBI_PLATFORM *)sbi_platform_ptr(ScratchSpace);
     *FirmwareContext = (EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT 
*)SbiPlatform->firmware_context;
+  } else {
+    return EFI_NOT_FOUND;
   }
-
   return EFI_SUCCESS;
 }
 
-- 
2.25.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#65126): https://edk2.groups.io/g/devel/message/65126
Mute This Topic: https://groups.io/mt/76703528/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to