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.14484.1599546729966368933 for ; Mon, 07 Sep 2020 23:32:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=gRAJEYO9; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0520748f13=abner.chang@hpe.com) Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0886R3S4002743; Tue, 8 Sep 2020 06:32:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pps0720; bh=aIsFHbCrBUkdPzuGhD60gMw6O9ncl+bw/OcoUPUf5cs=; b=gRAJEYO9y0gFAlYSqHa4hwRCEb6vfvkGJup176bL2J+bHCfo49zLEq4dEC2x9tpSxFGj MyXDgmKJWEh4nxPzjhcoBtTIiLsBZ1K2RXTGpPUwrbL36Bxv9356GAvWNT9BF2YGSunR tG1ii9LF79kEThl6o8eJ/LQGJ0cIHS6ZFMhWV3rLGwkHf05yIHyS1ql+TkByknzgKFTN VGcYrnDu/PmychUYtJY4j5Vdbqg2YfRm56MsdDhewiVUhPIYmz4QPbLFcAY56i+jBCLR xucGDCYeYKEue/qhr/tMVzt8GouGwov9+eWKgE6Q0pHYjGPQ2sMORmylKLZjbbz6nIbm VA== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 33c1nnnps9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Sep 2020 06:32:08 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id 7084251; Tue, 8 Sep 2020 06:32:08 +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 30EFB4C; Tue, 8 Sep 2020 06:32:06 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Leif Lindholm Subject: [edk2-platforms][PATCH 1/2] ProcessorPkg/RiscVEdk2SbiLib: Error handling for locating firmware context Date: Tue, 8 Sep 2020 13:48:43 +0800 Message-Id: <20200908054844.25755-1-abner.chang@hpe.com> X-Mailer: git-send-email 2.25.0 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 clxscore=1015 impostorscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 spamscore=0 bulkscore=0 adultscore=0 malwarescore=0 suspectscore=1 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009080061 Content-Transfer-Encoding: quoted-printable Return EFI_NOT_FOUND if opensbi firmware context can not be located using SBI call. Signed-off-by: Abner Chang Cc: Daniel Schaefer Cc: Leif Lindholm --- .../ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2S= biLib.c b/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiL= ib.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 ( =0D @param[out] FirmwareContext The firmware context pointer.=0D @retval EFI_SUCCESS The operation succeeds.=0D + @retval EFI_NOT_FOUND Failed to get the pointer of EFI_RISCV_= OPENSBI_FIRMWARE_CONTEXT.=0D +=0D **/=0D EFI_STATUS=0D EFIAPI=0D @@ -866,8 +868,9 @@ SbiGetFirmwareContext ( ScratchSpace =3D (SBI_SCRATCH *)Ret.Value;=0D SbiPlatform =3D (SBI_PLATFORM *)sbi_platform_ptr(ScratchSpace);=0D *FirmwareContext =3D (EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *)SbiPlatform= ->firmware_context;=0D + } else {=0D + return EFI_NOT_FOUND;=0D }=0D -=0D return EFI_SUCCESS;=0D }=0D =0D --=20 2.25.0