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 2/2] Silicon/SiFive: Error handling for locating firmware context
Date: Tue, 8 Sep 2020 13:48:44 +0800 [thread overview]
Message-ID: <20200908054844.25755-2-abner.chang@hpe.com> (raw)
In-Reply-To: <20200908054844.25755-1-abner.chang@hpe.com>
Add error handling in CreateU54E51CoreProcessorSpecificDataHob ()
when opensbi firmware context can't be located.
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
---
.../SiFive/U54/Library/PeiCoreInfoHobLib/CoreInfoHob.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Silicon/SiFive/U54/Library/PeiCoreInfoHobLib/CoreInfoHob.c b/Silicon/SiFive/U54/Library/PeiCoreInfoHobLib/CoreInfoHob.c
index edeabf028f..ea947a9d28 100644
--- a/Silicon/SiFive/U54/Library/PeiCoreInfoHobLib/CoreInfoHob.c
+++ b/Silicon/SiFive/U54/Library/PeiCoreInfoHobLib/CoreInfoHob.c
@@ -38,7 +38,7 @@
@return EFI_SUCCESS The PEIM initialized successfully.
EFI_UNSUPPORTED HART is ignored by platform.
-
+ EFI_NOT_FOUND Processor specific data hob is not available.
**/
EFI_STATUS
EFIAPI
@@ -64,9 +64,14 @@ CreateU54E51CoreProcessorSpecificDataHob (
return EFI_INVALID_PARAMETER;
}
+ FirmwareContext = NULL;
Status = SbiGetFirmwareContext (&FirmwareContext);
ASSERT_EFI_ERROR (Status);
- DEBUG ((DEBUG_INFO, " Firmware Context is at 0x%x.\n", FirmwareContext));
+ if (EFI_ERROR (Status) || FirmwareContext == NULL) {
+ DEBUG ((DEBUG_ERROR, "Failed to get the pointer of EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT of hart %d\n", HartId));
+ return Status;
+ }
+ DEBUG((DEBUG_INFO, " Firmware Context is at 0x%x.\n", FirmwareContext));
FirmwareContextHartSpecific = FirmwareContext->HartSpecific[HartId];
DEBUG ((DEBUG_INFO, " Firmware Context Hart specific is at 0x%x.\n", FirmwareContextHartSpecific));
if (FirmwareContextHartSpecific == NULL) {
--
2.25.0
next prev parent 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 [edk2-platforms][PATCH 1/2] ProcessorPkg/RiscVEdk2SbiLib: Error handling for locating firmware context Abner Chang
2020-09-08 5:48 ` Abner Chang [this message]
2020-09-11 8:01 ` [edk2-platforms][PATCH 2/2] Silicon/SiFive: " 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-2-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