From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.3402.1666731352900153792 for ; Tue, 25 Oct 2022 13:55:53 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZBfsaT8U; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: chasel.chiu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666731352; x=1698267352; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LatHlj7y5RGj9jp1RmnzOpHs5JSQ7vvEtdqgY3SB/6U=; b=ZBfsaT8U1gDwhcqg6yIfxpxZYv7dc7KoEhpHKYfwPzNhaTADGnH2yrgo 9gdU3Vwsu5R74p1V2SRpxxGA8G2CuyApSqF5QStveFQQfQ2wDSjdH73lo vkJNHRYA08tHh1ehuhAXYpdwxU/RjzNvgPHqgDkm4DspAZrDVQ2fn+yvo yibsD9Rii+TD1gDSs8okHztpbV8gzCjntIOWn6W+gLJ/acBTMihlZ+Bev PIfcan6Nvj1O/1EQINS6Ag9weqQSrVIqMs6WXukoFb88KlHF05+szIrKW XsVKExCwyv5CB0n5U1nqa6Mywo2lau4191nyoPVlSpCbi88aPH6XCl+cN w==; X-IronPort-AV: E=McAfee;i="6500,9779,10511"; a="306519805" X-IronPort-AV: E=Sophos;i="5.95,213,1661842800"; d="scan'208";a="306519805" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 13:55:43 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10511"; a="631773074" X-IronPort-AV: E=Sophos;i="5.95,213,1661842800"; d="scan'208";a="631773074" Received: from cchiu4-mobl.gar.corp.intel.com ([10.209.94.253]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 13:55:43 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Star Zeng Subject: [PATCH] IntelFsp2WrapprPkg: Check header revision for MultiPhase support. Date: Tue, 25 Oct 2022 13:55:32 -0700 Message-Id: <20221025205532.2247-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.35.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4119 Earlier version of FSP header may not have MultiPhase fields present in the FspInfoHeader so the handler should verify header revision before accessing the MultiPhase fields from the header. Cc: Nate DeSimone Cc: Star Zeng Signed-off-by: Chasel Chiu --- IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMu= ltiPhaseProcessLib.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/Pei= FspWrapperMultiPhaseProcessLib.c b/IntelFsp2WrapperPkg/Library/FspWrapperMu= ltiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c index 1248accf87..0f524910d5 100644 --- a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrap= perMultiPhaseProcessLib.c +++ b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrap= perMultiPhaseProcessLib.c @@ -73,15 +73,27 @@ CallFspMultiPhaseEntry ( //=0D // FSP_MULTI_PHASE_INIT and FSP_MULTI_PHASE_SI_INIT API functions having= same prototype.=0D //=0D - UINTN FspMultiPhaseApiEntry;=0D - UINTN FspMultiPhaseApiOffset;=0D - EFI_STATUS Status;=0D - BOOLEAN InterruptState;=0D + UINTN FspMultiPhaseApiEntry;=0D + UINTN FspMultiPhaseApiOffset;=0D + EFI_STATUS Status;=0D + BOOLEAN InterruptState;=0D + BOOLEAN IsVariableServiceRequest;=0D + FSP_MULTI_PHASE_PARAMS *FspMultiPhaseParamsPtr;=0D +=0D + FspMultiPhaseParamsPtr =3D (FSP_MULTI_PHASE_PARAMS *)FspMultiPhasePara= ms;=0D + IsVariableServiceRequest =3D FALSE;=0D + if ((FspMultiPhaseParamsPtr->MultiPhaseAction =3D=3D EnumMultiPhaseGetVa= riableRequestInfo) ||=0D + (FspMultiPhaseParamsPtr->MultiPhaseAction =3D=3D EnumMultiPhaseCompl= eteVariableRequest))=0D + {=0D + IsVariableServiceRequest =3D TRUE;=0D + }=0D =0D if (ComponentIndex =3D=3D FspMultiPhaseMemInitApiIndex) {=0D FspHeader =3D (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBa= seAddress));=0D if (FspHeader =3D=3D NULL) {=0D return EFI_DEVICE_ERROR;=0D + } else if (FspHeader->SpecVersion < 0x24) {=0D + return EFI_UNSUPPORTED;=0D }=0D =0D FspMultiPhaseApiOffset =3D FspHeader->FspMultiPhaseMemInitEntryOffset;= =0D @@ -89,6 +101,10 @@ CallFspMultiPhaseEntry ( FspHeader =3D (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBa= seAddress));=0D if (FspHeader =3D=3D NULL) {=0D return EFI_DEVICE_ERROR;=0D + } else if (FspHeader->SpecVersion < 0x22) {=0D + return EFI_UNSUPPORTED;=0D + } else if ((FspHeader->SpecVersion < 0x24) && (IsVariableServiceReques= t =3D=3D TRUE)) {=0D + return EFI_UNSUPPORTED;=0D }=0D =0D FspMultiPhaseApiOffset =3D FspHeader->FspMultiPhaseSiInitEntryOffset;= =0D @@ -120,7 +136,8 @@ CallFspMultiPhaseEntry ( @param[in] FspHobListPtr - Pointer to FSP HobList (valid after FS= P-M completed)=0D @param[in] ComponentIndex - FSP Component which executing MultiPha= se initialization.=0D =0D - @retval EFI_UNSUPPORTED FSP Wrapper cannot support the specific variab= le request=0D + @retval EFI_UNSUPPORTED FSP Wrapper cannot support the specific variab= le request,=0D + or FSP does not support VariableService=0D @retval EFI_STATUS Return FSP returned status=0D =0D **/=0D @@ -287,7 +304,8 @@ FspWrapperVariableRequestHandler ( @param[in] FspHobListPtr - Pointer to FSP HobList (valid after FS= P-M completed)=0D @param[in] ComponentIndex - FSP Component which executing MultiPha= se initialization.=0D =0D - @retval EFI_STATUS Always return EFI_SUCCESS=0D + @retval EFI_UNSUPPORTED Specific MultiPhase action was not supported.= =0D + @retval EFI_SUCCESS MultiPhase action were completed successfully.= =0D =0D **/=0D EFI_STATUS=0D --=20 2.35.0.windows.1