From nobody Fri May 3 05:21:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95566+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95566+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1666731354; cv=none; d=zohomail.com; s=zohoarc; b=nB6vo7+kjBienpcVxIUS34y9P2tsbtRQ/QQFBEERlGRS+6rCAhba4P2UjJ9bhVfQ4ipYugrao4J5mqbzISoIuSkm3t62OhOrjuqdUBuxpKOTwRX9kqkprHnvOkquaE8dswpIkWWjDD1QOv9hx91L13jJRplN+rbqT2ZojA8LRVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666731354; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=4pDJdSli8QbFmwuodn3GOS6NVs6mmQoY2uWQlYQlmHQ=; b=lxjTORw2LOahzRf/1hdyaWU9CZ2A3m3QeCrBn3/H4Iww6zsPiQICLYhdEDS+9cd5bXM1BxlhzwsBa8MeIY29m0r9XYV2JeMExjoJNwXpZlpAiml8yLvrvO809hu8s1f8/33hrGg8vXW3c+vSz5tEYUa1kMhKf7YFgvZcy8CQtks= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95566+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666731354025993.8534251566941; Tue, 25 Oct 2022 13:55:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3PkeYY1788612xT7l87MLvOG; Tue, 25 Oct 2022 13:55:53 -0700 X-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 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" X-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" X-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: [edk2-devel] [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> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: YslUSpRY0ZHlSUa1KUkt9yMjx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666731353; bh=TkWLKCicY7PJ/UUiSWK/7IkMthHB4eWviIGtveG2gtI=; h=Cc:Date:From:Reply-To:Subject:To; b=Imk/KeI21sUxpgIIuJlOrIZNSZFTdzl16wxb+Ix+/N+AhYcjb/YtWcQc/R3H5LgF843 GJrnTUoE40z4vbJtcv8KSEi9eF7NMwLOnfNgJa2QTa5LE+KsYDGjmyJXBANazhRuTeBnU vQRS2+mgSTzTMmbuXxWqIEiE4euze4DUa/4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666731355219100001 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Nate DeSimone --- 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 ( // // FSP_MULTI_PHASE_INIT and FSP_MULTI_PHASE_SI_INIT API functions having= same prototype. // - UINTN FspMultiPhaseApiEntry; - UINTN FspMultiPhaseApiOffset; - EFI_STATUS Status; - BOOLEAN InterruptState; + UINTN FspMultiPhaseApiEntry; + UINTN FspMultiPhaseApiOffset; + EFI_STATUS Status; + BOOLEAN InterruptState; + BOOLEAN IsVariableServiceRequest; + FSP_MULTI_PHASE_PARAMS *FspMultiPhaseParamsPtr; + + FspMultiPhaseParamsPtr =3D (FSP_MULTI_PHASE_PARAMS *)FspMultiPhasePara= ms; + IsVariableServiceRequest =3D FALSE; + if ((FspMultiPhaseParamsPtr->MultiPhaseAction =3D=3D EnumMultiPhaseGetVa= riableRequestInfo) || + (FspMultiPhaseParamsPtr->MultiPhaseAction =3D=3D EnumMultiPhaseCompl= eteVariableRequest)) + { + IsVariableServiceRequest =3D TRUE; + } =20 if (ComponentIndex =3D=3D FspMultiPhaseMemInitApiIndex) { FspHeader =3D (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBa= seAddress)); if (FspHeader =3D=3D NULL) { return EFI_DEVICE_ERROR; + } else if (FspHeader->SpecVersion < 0x24) { + return EFI_UNSUPPORTED; } =20 FspMultiPhaseApiOffset =3D FspHeader->FspMultiPhaseMemInitEntryOffset; @@ -89,6 +101,10 @@ CallFspMultiPhaseEntry ( FspHeader =3D (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBa= seAddress)); if (FspHeader =3D=3D NULL) { return EFI_DEVICE_ERROR; + } else if (FspHeader->SpecVersion < 0x22) { + return EFI_UNSUPPORTED; + } else if ((FspHeader->SpecVersion < 0x24) && (IsVariableServiceReques= t =3D=3D TRUE)) { + return EFI_UNSUPPORTED; } =20 FspMultiPhaseApiOffset =3D FspHeader->FspMultiPhaseSiInitEntryOffset; @@ -120,7 +136,8 @@ CallFspMultiPhaseEntry ( @param[in] FspHobListPtr - Pointer to FSP HobList (valid after FS= P-M completed) @param[in] ComponentIndex - FSP Component which executing MultiPha= se initialization. =20 - @retval EFI_UNSUPPORTED FSP Wrapper cannot support the specific variab= le request + @retval EFI_UNSUPPORTED FSP Wrapper cannot support the specific variab= le request, + or FSP does not support VariableService @retval EFI_STATUS Return FSP returned status =20 **/ @@ -287,7 +304,8 @@ FspWrapperVariableRequestHandler ( @param[in] FspHobListPtr - Pointer to FSP HobList (valid after FS= P-M completed) @param[in] ComponentIndex - FSP Component which executing MultiPha= se initialization. =20 - @retval EFI_STATUS Always return EFI_SUCCESS + @retval EFI_UNSUPPORTED Specific MultiPhase action was not supported. + @retval EFI_SUCCESS MultiPhase action were completed successfully. =20 **/ EFI_STATUS --=20 2.35.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95566): https://edk2.groups.io/g/devel/message/95566 Mute This Topic: https://groups.io/mt/94568053/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-