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.web12.3722.1641630366224526245 for ; Sat, 08 Jan 2022 00:26:06 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=cT+SFdDB; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=000704d8ca=abner.chang@hpe.com) Received: from pps.filterd (m0134425.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2084o87J022551 for ; Sat, 8 Jan 2022 08:26:05 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=RQ/3XxjlFUj9LEIe4snyknzJST6th73eivsFpWhtPn0=; b=cT+SFdDBUEm/SQLlaZfdRkTVazgP3bRYygq1dkbAVT/oxC3JSS2vq1411x/s+3wZ1oT3 JOrNM/SS6NVIPZzs/Asc8+XavM+CeCtxZ5ak23Sc4XOgjXLOuFHaQHj+RPA9zxGtBTMm Y8Z5R3oZdITwoK3QanymEdPVHILztHfAGM6CFcxvEfGiEvGgBjrlb8G3Z1BUqUKUxZzR CuPd25tmCGr4AjOx1p6KM1I3hKt1gfPUDBsIs1ozSIY8PWYJ4B0QoBsnUSDW07a7Zkmh CHSw9H+5F6b0DbYPmyo8ER//MfIZWXxWjPSPGewjFGTfKv8b3rNSDFJPALgXb1gceTox 0w== Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3df3wtgqtc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 08 Jan 2022 08:26:05 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2354.austin.hpe.com (Postfix) with ESMTP id B15AA81 for ; Sat, 8 Jan 2022 08:26:04 +0000 (UTC) Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 04D1639; Sat, 8 Jan 2022 08:26:03 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com Subject: [PATCH 60/79] Platform/RISC-V: Add debug message to SecMain.c Date: Sat, 8 Jan 2022 15:24:43 +0800 Message-Id: <20220108072444.17879-19-abner.chang@hpe.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220108072444.17879-1-abner.chang@hpe.com> References: <20220108072444.17879-1-abner.chang@hpe.com> MIME-Version: 1.0 X-Proofpoint-GUID: BAO2hgLokr9s8G4u712VQxf5OHoHAz_6 X-Proofpoint-ORIG-GUID: BAO2hgLokr9s8G4u712VQxf5OHoHAz_6 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-08_03,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 mlxscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201080064 Content-Transfer-Encoding: quoted-printable (This is migrated from edk2-platforms:Platform) Add more debug messages when search FFS in SEC phase. Signed-off-by: Abner Chang Cc: Daniel Schaefer Cc: Sunil V L Reviewed-by: Daniel Schaefer --- .../RISC-V/PlatformPkg/Universal/Sec/SecMain.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c b/Platform= /RISC-V/PlatformPkg/Universal/Sec/SecMain.c index 17f33a02cc..05f228c44d 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c @@ -166,6 +166,8 @@ FindFfsFileAndSection ( UINT32 Size;=0D EFI_PHYSICAL_ADDRESS EndOfFile;=0D =0D + DEBUG ((DEBUG_INFO, "%a: DBT FV at 0x%x\n", __FUNCTION__, Fv));=0D +=0D if (Fv->Signature !=3D EFI_FVH_SIGNATURE) {=0D DEBUG ((DEBUG_ERROR, "%a: FV at %p does not have FV header signature\n= ", __FUNCTION__, Fv));=0D return EFI_VOLUME_CORRUPTED;=0D @@ -181,17 +183,20 @@ FindFfsFileAndSection ( =0D CurrentAddress =3D (EndOfFile + 7) & ~(7ULL);=0D if (CurrentAddress > EndOfFirmwareVolume) {=0D + DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D return EFI_VOLUME_CORRUPTED;=0D }=0D =0D File =3D (EFI_FFS_FILE_HEADER*)(UINTN) CurrentAddress;=0D Size =3D *(UINT32*) File->Size & 0xffffff;=0D if (Size < (sizeof (*File) + sizeof (EFI_COMMON_SECTION_HEADER))) {=0D + DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D return EFI_VOLUME_CORRUPTED;=0D }=0D =0D EndOfFile =3D CurrentAddress + Size;=0D if (EndOfFile > EndOfFirmwareVolume) {=0D + DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D return EFI_VOLUME_CORRUPTED;=0D }=0D =0D @@ -199,6 +204,7 @@ FindFfsFileAndSection ( // Look for the request file type=0D //=0D if (File->Type !=3D FileType) {=0D + DEBUG ((DEBUG_INFO, "%a: (File->Type !=3D FileType), find next FFS\n= ", __FUNCTION__));=0D continue;=0D }=0D =0D @@ -208,9 +214,15 @@ FindFfsFileAndSection ( SectionType,=0D FoundSection=0D );=0D - if (!EFI_ERROR (Status) || (Status =3D=3D EFI_VOLUME_CORRUPTED)) {=0D + if (!EFI_ERROR(Status)) {=0D + DEBUG ((DEBUG_INFO, "%a: Get firmware file section\n", __FUNCTION__)= );=0D + return Status;=0D + }=0D + if (Status =3D=3D EFI_VOLUME_CORRUPTED) {=0D + DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D return Status;=0D }=0D + DEBUG ((DEBUG_INFO, "%a: Find next FFS\n", __FUNCTION__));=0D }=0D }=0D =0D --=20 2.31.1