From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web11.14485.1599546731048021726 for ; Mon, 07 Sep 2020 23:32:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=K5jKCfPG; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0520748f13=abner.chang@hpe.com) Received: from pps.filterd (m0150245.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0886Si35022834; Tue, 8 Sep 2020 06:32:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pps0720; bh=9a6aID0mC3ik+vdOTOazF1HQmCPf4i55mWBRnMmRr98=; b=K5jKCfPGEpKiTjw7QKUV9p8/XAlugybR6LHOligY6c3H8e/6pGtypZwzphp6VxJp8D/y WEldzDiWE/ptSfeM681R8WTM1g2LW8XohGuu5W8YXO0B66kor8t1XPxzSzdf9HyUlVZ0 AyAxxC90FmyCPHbO8XgxaLwCcGAl37TYjabe1uki++bRWOBj2/R9dqVCVCPCYUVin+IQ 8s/ROeLfGn2jJmLEkJRkFnOtRYKL6ZZyRD1NJG1wxxJP+gXJYb3G8IKrzpb145zeAjrH AHhU+S4OFVR6kayBGDAIpRNc4wd7HwESeZwFAC69PMKjLLF+zN+ynFxps2zHYqI59gZv 2g== Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0b-002e3701.pphosted.com with ESMTP id 33c3vddbf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Sep 2020 06:32:10 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id 110846F; Tue, 8 Sep 2020 06:32:09 +0000 (UTC) Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.39]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id B61C348; Tue, 8 Sep 2020 06:32:08 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Leif Lindholm Subject: [edk2-platforms][PATCH 2/2] Silicon/SiFive: Error handling for locating firmware context Date: Tue, 8 Sep 2020 13:48:44 +0800 Message-Id: <20200908054844.25755-2-abner.chang@hpe.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200908054844.25755-1-abner.chang@hpe.com> References: <20200908054844.25755-1-abner.chang@hpe.com> MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-08_02:2020-09-07,2020-09-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 malwarescore=0 spamscore=0 adultscore=0 impostorscore=0 phishscore=0 suspectscore=1 bulkscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009080061 Content-Transfer-Encoding: quoted-printable Add error handling in CreateU54E51CoreProcessorSpecificDataHob () when opensbi firmware context can't be located. Signed-off-by: Abner Chang Cc: Daniel Schaefer Cc: Leif Lindholm --- .../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/S= ilicon/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 @@ =0D @return EFI_SUCCESS The PEIM initialized successfully.=0D EFI_UNSUPPORTED HART is ignored by platform.=0D -=0D + EFI_NOT_FOUND Processor specific data hob is not available.=0D **/=0D EFI_STATUS=0D EFIAPI=0D @@ -64,9 +64,14 @@ CreateU54E51CoreProcessorSpecificDataHob ( return EFI_INVALID_PARAMETER;=0D }=0D =0D + FirmwareContext =3D NULL;=0D Status =3D SbiGetFirmwareContext (&FirmwareContext);=0D ASSERT_EFI_ERROR (Status);=0D - DEBUG ((DEBUG_INFO, " Firmware Context is at 0x%x.\n", FirmwareContex= t));=0D + if (EFI_ERROR (Status) || FirmwareContext =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "Failed to get the pointer of EFI_RISCV_OPENSBI_F= IRMWARE_CONTEXT of hart %d\n", HartId));=0D + return Status;=0D + }=0D + DEBUG((DEBUG_INFO, " Firmware Context is at 0x%x.\n", FirmwareContext= ));=0D FirmwareContextHartSpecific =3D FirmwareContext->HartSpecific[HartId];=0D DEBUG ((DEBUG_INFO, " Firmware Context Hart specific is at 0x%x.\n", = FirmwareContextHartSpecific));=0D if (FirmwareContextHartSpecific =3D=3D NULL) {=0D --=20 2.25.0