public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Abner Chang" <abner.chang@hpe.com>
To: devel@edk2.groups.io
Cc: abner.chang@hpe.com, Daniel Schaefer <daniel.schaefer@hpe.com>,
	Leif Lindholm <leif@nuviainc.com>
Subject: [edk2-platforms][PATCH 1/2] ProcessorPkg/RiscVEdk2SbiLib: Error handling for locating firmware context
Date: Tue,  8 Sep 2020 13:48:43 +0800	[thread overview]
Message-ID: <20200908054844.25755-1-abner.chang@hpe.com> (raw)

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Leif Lindholm <leif@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


             reply	other threads:[~2020-09-08  6:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  5:48 Abner Chang [this message]
2020-09-08  5:48 ` [edk2-platforms][PATCH 2/2] Silicon/SiFive: Error handling for locating firmware context Abner Chang
2020-09-11  8:01   ` Daniel Schaefer
2020-09-12  6:33     ` Abner Chang
2020-09-11  7:59 ` [edk2-platforms][PATCH 1/2] ProcessorPkg/RiscVEdk2SbiLib: " Daniel Schaefer
2020-09-12  6:29   ` Abner Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200908054844.25755-1-abner.chang@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox