From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: hao.a.wu@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Wed, 08 May 2019 20:03:45 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 20:03:45 -0700 X-ExtLoop1: 1 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 08 May 2019 20:03:45 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 8 May 2019 20:03:44 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.7]) with mapi id 14.03.0415.000; Thu, 9 May 2019 11:03:43 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Dong, Eric" Subject: Re: [edk2-devel] [Patch v2 2/3] SecurityPkg/OpalPassword: Change send BlockSID policy. Thread-Topic: [edk2-devel] [Patch v2 2/3] SecurityPkg/OpalPassword: Change send BlockSID policy. Thread-Index: AQHVBUp74UaTw3V3xUGkOHMC1QIVSaZiE0dg Date: Thu, 9 May 2019 03:03:42 +0000 Message-ID: References: <20190508030150.3968-1-eric.dong@intel.com> <20190508030150.3968-3-eric.dong@intel.com> In-Reply-To: <20190508030150.3968-3-eric.dong@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Do= ng, > Eric > Sent: Wednesday, May 08, 2019 11:02 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A > Subject: [edk2-devel] [Patch v2 2/3] SecurityPkg/OpalPassword: Change se= nd > BlockSID policy. >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1782 >=20 > Change Send BlockSID command time from ReadyToBoot to > EndOfDxe. Reviewed-by: Hao A Wu Best Regards, Hao Wu >=20 > Signed-off-by: Eric Dong > Cc: Hao Wu > --- > .../Tcg/Opal/OpalPassword/OpalDriver.c | 104 ++++++++---------- > 1 file changed, 46 insertions(+), 58 deletions(-) >=20 > diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > index 42999c89f0..009a97f66f 100644 > --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > @@ -424,6 +424,47 @@ BuildOpalDeviceInfo ( > FreePool (S3InitDevices); > } >=20 > +/** > + > + Send BlockSid command if needed. > + > +**/ > +VOID > +SendBlockSidCommand ( > + VOID > + ) > +{ > + OPAL_DRIVER_DEVICE *Itr; > + TCG_RESULT Result; > + OPAL_SESSION Session; > + UINT32 PpStorageFlag; > + > + PpStorageFlag =3D Tcg2PhysicalPresenceLibGetManagementFlags (); > + if ((PpStorageFlag & > TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) !=3D 0) { > + // > + // Send BlockSID command to each Opal disk > + // > + Itr =3D mOpalDriver.DeviceList; > + while (Itr !=3D NULL) { > + if (Itr->OpalDisk.SupportedAttributes.BlockSid) { > + ZeroMem(&Session, sizeof(Session)); > + Session.Sscp =3D Itr->OpalDisk.Sscp; > + Session.MediaId =3D Itr->OpalDisk.MediaId; > + Session.OpalBaseComId =3D Itr->OpalDisk.OpalBaseComId; > + > + DEBUG ((DEBUG_INFO, "OpalPassword: EndOfDxe point, send BlockSi= d > command to device!\n")); > + Result =3D OpalBlockSid (&Session, TRUE); // HardwareReset mus= t always > be TRUE > + if (Result !=3D TcgResultSuccess) { > + DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n")); > + break; > + } > + } > + > + Itr =3D Itr->Next; > + } > + } > +} > + > /** > Notification function of EFI_END_OF_DXE_EVENT_GROUP_GUID event group. >=20 > @@ -475,6 +516,11 @@ OpalEndOfDxeEventNotify ( > TmpDev =3D TmpDev->Next; > } >=20 > + // > + // Send BlockSid command if needed. > + // > + SendBlockSidCommand (); > + > DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__)); >=20 > gBS->CloseEvent (Event); > @@ -2262,53 +2308,6 @@ OpalDriverGetDeviceList( > return mOpalDriver.DeviceList; > } >=20 > -/** > - ReadyToBoot callback to send BlockSid command. > - > - @param Event Pointer to this event > - @param Context Event handler private Data > - > -**/ > -VOID > -EFIAPI > -ReadyToBootCallback ( > - IN EFI_EVENT Event, > - IN VOID *Context > - ) > -{ > - OPAL_DRIVER_DEVICE *Itr; > - TCG_RESULT Result; > - OPAL_SESSION Session; > - UINT32 PpStorageFlag; > - > - gBS->CloseEvent (Event); > - > - PpStorageFlag =3D Tcg2PhysicalPresenceLibGetManagementFlags (); > - if ((PpStorageFlag & > TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) !=3D 0) { > - // > - // Send BlockSID command to each Opal disk > - // > - Itr =3D mOpalDriver.DeviceList; > - while (Itr !=3D NULL) { > - if (Itr->OpalDisk.SupportedAttributes.BlockSid) { > - ZeroMem(&Session, sizeof(Session)); > - Session.Sscp =3D Itr->OpalDisk.Sscp; > - Session.MediaId =3D Itr->OpalDisk.MediaId; > - Session.OpalBaseComId =3D Itr->OpalDisk.OpalBaseComId; > - > - DEBUG ((DEBUG_INFO, "OpalPassword: ReadyToBoot point, send Bloc= kSid > command to device!\n")); > - Result =3D OpalBlockSid (&Session, TRUE); // HardwareReset mus= t always > be TRUE > - if (Result !=3D TcgResultSuccess) { > - DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n")); > - break; > - } > - } > - > - Itr =3D Itr->Next; > - } > - } > -} > - > /** > Stop this Controller. >=20 > @@ -2571,7 +2570,6 @@ EfiDriverEntryPoint( > ) > { > EFI_STATUS Status; > - EFI_EVENT ReadyToBootEvent; > EFI_EVENT EndOfDxeEvent; >=20 > Status =3D EfiLibInstallDriverBindingComponentName2 ( > @@ -2604,16 +2602,6 @@ EfiDriverEntryPoint( > ); > ASSERT_EFI_ERROR (Status); >=20 > - // > - // register a ReadyToBoot event callback for sending BlockSid command > - // > - Status =3D EfiCreateEventReadyToBootEx ( > - TPL_CALLBACK, > - ReadyToBootCallback, > - (VOID *) &ImageHandle, > - &ReadyToBootEvent > - ); > - > // > // Install Hii packages. > // > -- > 2.21.0.windows.1 >=20 >=20 >=20