From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Dong, Eric" <eric.dong@intel.com>
Subject: Re: [edk2-devel] [Patch v2 2/3] SecurityPkg/OpalPassword: Change send BlockSID policy.
Date: Thu, 9 May 2019 03:03:42 +0000 [thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C8D1917@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190508030150.3968-3-eric.dong@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Dong,
> 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 send
> BlockSID policy.
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1782
>
> Change Send BlockSID command time from ReadyToBoot to
> EndOfDxe.
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> ---
> .../Tcg/Opal/OpalPassword/OpalDriver.c | 104 ++++++++----------
> 1 file changed, 46 insertions(+), 58 deletions(-)
>
> 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);
> }
>
> +/**
> +
> + Send BlockSid command if needed.
> +
> +**/
> +VOID
> +SendBlockSidCommand (
> + VOID
> + )
> +{
> + OPAL_DRIVER_DEVICE *Itr;
> + TCG_RESULT Result;
> + OPAL_SESSION Session;
> + UINT32 PpStorageFlag;
> +
> + PpStorageFlag = Tcg2PhysicalPresenceLibGetManagementFlags ();
> + if ((PpStorageFlag &
> TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) != 0) {
> + //
> + // Send BlockSID command to each Opal disk
> + //
> + Itr = mOpalDriver.DeviceList;
> + while (Itr != NULL) {
> + if (Itr->OpalDisk.SupportedAttributes.BlockSid) {
> + ZeroMem(&Session, sizeof(Session));
> + Session.Sscp = Itr->OpalDisk.Sscp;
> + Session.MediaId = Itr->OpalDisk.MediaId;
> + Session.OpalBaseComId = Itr->OpalDisk.OpalBaseComId;
> +
> + DEBUG ((DEBUG_INFO, "OpalPassword: EndOfDxe point, send BlockSid
> command to device!\n"));
> + Result = OpalBlockSid (&Session, TRUE); // HardwareReset must always
> be TRUE
> + if (Result != TcgResultSuccess) {
> + DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n"));
> + break;
> + }
> + }
> +
> + Itr = Itr->Next;
> + }
> + }
> +}
> +
> /**
> Notification function of EFI_END_OF_DXE_EVENT_GROUP_GUID event group.
>
> @@ -475,6 +516,11 @@ OpalEndOfDxeEventNotify (
> TmpDev = TmpDev->Next;
> }
>
> + //
> + // Send BlockSid command if needed.
> + //
> + SendBlockSidCommand ();
> +
> DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__));
>
> gBS->CloseEvent (Event);
> @@ -2262,53 +2308,6 @@ OpalDriverGetDeviceList(
> return mOpalDriver.DeviceList;
> }
>
> -/**
> - 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 = Tcg2PhysicalPresenceLibGetManagementFlags ();
> - if ((PpStorageFlag &
> TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) != 0) {
> - //
> - // Send BlockSID command to each Opal disk
> - //
> - Itr = mOpalDriver.DeviceList;
> - while (Itr != NULL) {
> - if (Itr->OpalDisk.SupportedAttributes.BlockSid) {
> - ZeroMem(&Session, sizeof(Session));
> - Session.Sscp = Itr->OpalDisk.Sscp;
> - Session.MediaId = Itr->OpalDisk.MediaId;
> - Session.OpalBaseComId = Itr->OpalDisk.OpalBaseComId;
> -
> - DEBUG ((DEBUG_INFO, "OpalPassword: ReadyToBoot point, send BlockSid
> command to device!\n"));
> - Result = OpalBlockSid (&Session, TRUE); // HardwareReset must always
> be TRUE
> - if (Result != TcgResultSuccess) {
> - DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n"));
> - break;
> - }
> - }
> -
> - Itr = Itr->Next;
> - }
> - }
> -}
> -
> /**
> Stop this Controller.
>
> @@ -2571,7 +2570,6 @@ EfiDriverEntryPoint(
> )
> {
> EFI_STATUS Status;
> - EFI_EVENT ReadyToBootEvent;
> EFI_EVENT EndOfDxeEvent;
>
> Status = EfiLibInstallDriverBindingComponentName2 (
> @@ -2604,16 +2602,6 @@ EfiDriverEntryPoint(
> );
> ASSERT_EFI_ERROR (Status);
>
> - //
> - // register a ReadyToBoot event callback for sending BlockSid command
> - //
> - Status = EfiCreateEventReadyToBootEx (
> - TPL_CALLBACK,
> - ReadyToBootCallback,
> - (VOID *) &ImageHandle,
> - &ReadyToBootEvent
> - );
> -
> //
> // Install Hii packages.
> //
> --
> 2.21.0.windows.1
>
>
>
next prev parent reply other threads:[~2019-05-09 3:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 3:01 [Patch v2 0/3] SecurityPkg/Opal: Change BlockSid policy Dong, Eric
2019-05-08 3:01 ` [Patch v2 1/3] SecurityPkg/SecurityPkg.dec: Change default value Dong, Eric
2019-05-09 3:03 ` [edk2-devel] " Wu, Hao A
2019-05-09 11:16 ` Laszlo Ersek
2019-05-09 9:53 ` Laszlo Ersek
2019-05-09 12:41 ` Yao, Jiewen
2019-05-09 21:26 ` Laszlo Ersek
2019-05-09 21:48 ` Yao, Jiewen
2019-05-08 3:01 ` [Patch v2 2/3] SecurityPkg/OpalPassword: Change send BlockSID policy Dong, Eric
2019-05-09 3:03 ` Wu, Hao A [this message]
2019-05-08 3:01 ` [Patch v2 3/3] SecurityPkg/OpalPassword: Fix "Enable Feature" Menu disappear issue Dong, Eric
2019-05-09 3:03 ` [edk2-devel] " Wu, Hao A
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A093C8D1917@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox