public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Abner Chang" <abner.chang@hpe.com>
To: "Schaefer, Daniel" <daniel.schaefer@hpe.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>
Subject: Re: [edk2-platforms][PATCH 2/2] Silicon/SiFive: Error handling for locating firmware context
Date: Sat, 12 Sep 2020 06:33:14 +0000	[thread overview]
Message-ID: <CS1PR8401MB11448E6D55ED90A4C13B10B2FF250@CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <cd696412-6fbc-e65a-624b-b5cd2745259b@hpe.com>



> -----Original Message-----
> From: Schaefer, Daniel
> Sent: Friday, September 11, 2020 4:01 PM
> To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> devel@edk2.groups.io
> Cc: Leif Lindholm <leif@nuviainc.com>
> Subject: Re: [edk2-platforms][PATCH 2/2] Silicon/SiFive: Error handling for
> locating firmware context
> 
> On 9/8/20 1:48 PM, Abner Chang wrote:
> > 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) {
> 
> The assert should already catch this, right? Especially if we fix the return
> value for SbiGetFirmwareContext we don't also need to check the pointer.
> I'd say: Let's fix the return value (like your other patch) and remove assert, as
> well as the null-check here.
That's fine to me, Daniel. Just don’t let process keep going with an unexpected error. Now you got the ownership of this issue, just send out your patch for review.
Thanks
> 
> > +    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) {
> >

  reply	other threads:[~2020-09-12  6:34 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 ` [edk2-platforms][PATCH 2/2] Silicon/SiFive: " Abner Chang
2020-09-11  8:01   ` Daniel Schaefer
2020-09-12  6:33     ` Abner Chang [this message]
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=CS1PR8401MB11448E6D55ED90A4C13B10B2FF250@CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.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