From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.2502.1572239287973950744 for ; Sun, 27 Oct 2019 22:08:08 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: maggie.chu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Oct 2019 22:08:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,238,1569308400"; d="scan'208";a="193150928" Received: from chumaggi-mobl1.gar.corp.intel.com ([10.5.246.26]) by orsmga008.jf.intel.com with ESMTP; 27 Oct 2019 22:08:05 -0700 From: "Maggie Chu" To: devel@edk2.groups.io Cc: Hao A Wu , Jian J Wang , Ray Ni , Star Zeng , Eric Dong Subject: [PATCH] MdeModulePkg/NvmExpressPei: Fix Opal S3 unlock issue Date: Mon, 28 Oct 2019 13:08:02 +0800 Message-Id: <20191028050802.856-1-maggie.chu@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable https://bugzilla.tianocore.org/show_bug.cgi?id=3D2312 This patch is for fixing unexpected system hang during S3 unlock process. FatPei driver maintained and updated internal BlockIo devices list when there is new BlockIo PPI has installed, and it relied on BlockIo PPI s= ervice to get data from devices. Because BlockIo Ppi leverage NvmExpressPei Ppi to= transit Nvm command to device, we should make sure NvmePassThruPpi installed before= BlockIo PPI. Signed-off-by: Maggie Chu Cc: Hao A Wu Cc: Jian J Wang Cc: Ray Ni Cc: Star Zeng Cc: Eric Dong --- MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c | 43 ++++++++++++------= ---- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c b/MdeModule= Pkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c index 987eed420e..a8cb7f3a67 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c @@ -376,6 +376,29 @@ NvmExpressPeimEntry ( continue;=0D }=0D =0D + //=0D + // Nvm Express Pass Thru PPI=0D + //=0D + Private->PassThruMode.Attributes =3D EFI_NVM_EXPRESS_PASS_T= HRU_ATTRIBUTES_PHYSICAL |=0D + EFI_NVM_EXPRESS_PASS_THR= U_ATTRIBUTES_LOGICAL |=0D + EFI_NVM_EXPRESS_PASS_THR= U_ATTRIBUTES_CMD_SET_NVM;=0D + Private->PassThruMode.IoAlign =3D sizeof (UINTN);=0D + Private->PassThruMode.NvmeVersion =3D EDKII_PEI_NVM_EXPRESS_= PASS_THRU_PPI_REVISION;=0D + Private->NvmePassThruPpi.Mode =3D &Private->PassThruMode= ;=0D + Private->NvmePassThruPpi.GetDevicePath =3D NvmePassThruGetDeviceP= ath;=0D + Private->NvmePassThruPpi.GetNextNameSpace =3D NvmePassThruGetNextNam= eSpace;=0D + Private->NvmePassThruPpi.PassThru =3D NvmePassThru;=0D + CopyMem (=0D + &Private->NvmePassThruPpiList,=0D + &mNvmePassThruPpiListTemplate,=0D + sizeof (EFI_PEI_PPI_DESCRIPTOR)=0D + );=0D + Private->NvmePassThruPpiList.Ppi =3D &Private->NvmePassThru= Ppi;=0D + PeiServicesInstallPpi (&Private->NvmePassThruPpiList);=0D +=0D + //=0D + // Block Io PPI=0D + //=0D Private->BlkIoPpi.GetNumberOfBlockDevices =3D NvmeBlockIoPeimGetDevic= eNo;=0D Private->BlkIoPpi.GetBlockDeviceMediaInfo =3D NvmeBlockIoPeimGetMedia= Info;=0D Private->BlkIoPpi.ReadBlocks =3D NvmeBlockIoPeimReadBloc= ks;=0D @@ -398,26 +421,6 @@ NvmExpressPeimEntry ( Private->BlkIo2PpiList.Ppi =3D &Private->BlkIo2Ppi;=0D PeiServicesInstallPpi (&Private->BlkIoPpiList);=0D =0D - //=0D - // Nvm Express Pass Thru PPI=0D - //=0D - Private->PassThruMode.Attributes =3D EFI_NVM_EXPRESS_PASS_T= HRU_ATTRIBUTES_PHYSICAL |=0D - EFI_NVM_EXPRESS_PASS_THR= U_ATTRIBUTES_LOGICAL |=0D - EFI_NVM_EXPRESS_PASS_THR= U_ATTRIBUTES_CMD_SET_NVM;=0D - Private->PassThruMode.IoAlign =3D sizeof (UINTN);=0D - Private->PassThruMode.NvmeVersion =3D EDKII_PEI_NVM_EXPRESS_= PASS_THRU_PPI_REVISION;=0D - Private->NvmePassThruPpi.Mode =3D &Private->PassThruMode= ;=0D - Private->NvmePassThruPpi.GetDevicePath =3D NvmePassThruGetDeviceP= ath;=0D - Private->NvmePassThruPpi.GetNextNameSpace =3D NvmePassThruGetNextNam= eSpace;=0D - Private->NvmePassThruPpi.PassThru =3D NvmePassThru;=0D - CopyMem (=0D - &Private->NvmePassThruPpiList,=0D - &mNvmePassThruPpiListTemplate,=0D - sizeof (EFI_PEI_PPI_DESCRIPTOR)=0D - );=0D - Private->NvmePassThruPpiList.Ppi =3D &Private->NvmePassThru= Ppi;=0D - PeiServicesInstallPpi (&Private->NvmePassThruPpiList);=0D -=0D //=0D // Check if the NVME controller supports the Security Receive/Send com= mands=0D //=0D --=20 2.16.2.windows.1