From nobody Thu May 2 09:01:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40089+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40089+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557216100; cv=none; d=zoho.com; s=zohoarc; b=WpvdkyDt+8xS5fTBX7dsajN6syT9fb+lWBrzL+FEs94rcWcqcFktBSZ0h/S+tCsNBZSglzcF+C13ufibBXU4WTln/TUcBLhnykCFPlGNCoEbfiFN7PnsTOLJczEub0TnL8HTZRRz/yvj/L0z+0UOqVFd5J3Iw4Yfok9pDkES6aI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557216100; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=sv0WINJ23t2S03kQ7V5FgauGB43yhOgfVF24+UmPHZ0=; b=jwupo0bHCq+sVLWk152kMGALALLav+W2HdhC71qcqLBJioixjg/z/q1i/jgRlM2NDd4O57IR0XGfUZRD5IZVM9EHDj9u3WzvBJjDlgiFC1C3o1GuyVZ1bAFqe80mm9FDSN5qqsfEznMjVeOUIEWhoEmTaS0lFFm3WrnWo13dzoA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40089+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557216100105480.94735119036727; Tue, 7 May 2019 01:01:40 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Tue, 07 May 2019 01:01:38 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 01:01:38 -0700 X-ExtLoop1: 1 X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by fmsmga006.fm.intel.com with ESMTP; 07 May 2019 01:01:38 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Subject: [edk2-devel] [Patch 1/3] SecurityPkg/SecurityPkg.dec: Change default value. Date: Tue, 7 May 2019 16:00:51 +0800 Message-Id: <20190507080053.15056-2-eric.dong@intel.com> In-Reply-To: <20190507080053.15056-1-eric.dong@intel.com> References: <20190507080053.15056-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557216099; bh=77VX8A/mD82Oa1lwA1EQ6Slr6KVsI8uGaZLczFt5pvg=; h=Date:From:Reply-To:Subject:To; b=q3fIWZtNa4Bg/ht/J0vP2f1qdupXDNo8VbUVZyHzJvXIog6Qp93H+2vdl8SnwSOwKmI YUS9wBMElAqcQ0BxvuFq3tmaeU7xh3x9IStVsneR4yvnPGohzBCzp3/PUcUnEk2CXzNyT zpMUxLHvIOqkUCsg+wYBTxCNQ4Vd7MpFbXs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" For safe concern, change BlockSID default policy. Signed-off-by: Eric Dong --- SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h | 3 ++- SecurityPkg/SecurityPkg.dec | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h b/Securi= tyPkg/Include/Library/Tcg2PhysicalPresenceLib.h index e08719003d..d8aedf1e4c 100644 --- a/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h +++ b/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h @@ -57,7 +57,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. // Default value // #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_STORAGE_MANAG= EMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID | \ - TCG2_BIOS_STORAGE_MANAG= EMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID) + TCG2_BIOS_STORAGE_MANAG= EMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID |\ + TCG2_BIOS_STORAGE_MANAG= EMENT_FLAG_ENABLE_BLOCK_SID) =20 /** Check and execute the pending TPM request. diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec index 8d64b4fefe..edb31a1456 100644 --- a/SecurityPkg/SecurityPkg.dec +++ b/SecurityPkg/SecurityPkg.dec @@ -428,7 +428,7 @@ # PCD can be configured for different settings in different scenarios # Default setting is TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS_S= TORAGE_MANAGEMENT_FLAG_DEFAULT # @Prompt Initial setting of TCG2 Persistent Firmware Management Flags - gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags|0x300E2|UINT3= 2|0x0001001B + gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags|0x700E2|UINT3= 2|0x0001001B =20 ## Indicate current TPM2 Interrupt Number reported by _CRS control metho= d.

# TPM2 Interrupt feature is disabled If the pcd is set to 0.
--=20 2.15.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 (#40089): https://edk2.groups.io/g/devel/message/40089 Mute This Topic: https://groups.io/mt/31529814/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- From nobody Thu May 2 09:01:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40090+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40090+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557216100; cv=none; d=zoho.com; s=zohoarc; b=R/K1JCCqExDKW9PHAv4L0I99i2EW8z9HEgDQD4RJj+kbbPyd94G15RwiajvdPANdn7ulv4yg1jDgdVVxYokHOyfgBrhUiPWAGG0TS2/j3r4Iq725bW4NjBHZjIkKflTs3IHyjX+8zm4x7bOXh/Cly1V/M5bB6bIlDYlo7Yi6pNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557216100; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=6BElNAZqxygXTpThMfmx+tvgCLuayz4vXKGD8E2tCX8=; b=MsdyXxbAT1mdIWncmHYRPfUxv0W9PbKaQpQ36/zHDXiUOFGpLOMtCt+5I5LIXMdq/Vsz/f1emwby/wOz/l0WhBfhI2Er1A+zj6719xHyRxFYA688PD142SnBVlCjc2bYvrsFL+09PpRhQGQItVuYMfjwbBsFot8gmDTHjyegnJw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40090+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557216100462857.9190531985904; Tue, 7 May 2019 01:01:40 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Tue, 07 May 2019 01:01:39 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 01:01:39 -0700 X-ExtLoop1: 1 X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by fmsmga006.fm.intel.com with ESMTP; 07 May 2019 01:01:38 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Subject: [edk2-devel] [Patch 2/3] SecurityPkg/OpalPassword: Change send BlockSID policy. Date: Tue, 7 May 2019 16:00:52 +0800 Message-Id: <20190507080053.15056-3-eric.dong@intel.com> In-Reply-To: <20190507080053.15056-1-eric.dong@intel.com> References: <20190507080053.15056-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557216100; bh=EP5jqPKT9fDeTPh3jAn6MSH2+JL0U3zAwnoVvD+bHxo=; h=Date:From:Reply-To:Subject:To; b=jj3K3mkVT9xLcnNLZCE0Unq7vI5bobR5aZXb47oJikfGh26oO6tp6A86NIzNm0okBvZ 0sbRXLgOjssi3K0a9q9LDG8l7Nuw5xHbWTixqCmKO87r+EnvKnujC2BDUzN2VjLEwmHVK gou89GuxDt9eTEUxv3tuenDggpC/mSKGJ5Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Change SendBlockSID command time from ReadyToBoot to EndOfDxe. Signed-off-by: Eric Dong --- SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 104 +++++++++++----------= ---- 1 file changed, 46 insertions(+), 58 deletions(-) diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/T= cg/Opal/OpalPassword/OpalDriver.c index e3f5056953..a3d4350c67 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -574,6 +574,47 @@ BuildOpalDeviceInfoNvme ( FreePool (DevInfoNvme); } =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 BlockSid c= ommand to device!\n")); + Result =3D OpalBlockSid (&Session, TRUE); // HardwareReset must a= lways 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 @@ -645,6 +686,11 @@ OpalEndOfDxeEventNotify ( TmpDev =3D TmpDev->Next; } =20 + // + // Send BlockSid command if needed. + // + SendBlockSidCommand (); + DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__)); =20 gBS->CloseEvent (Event); @@ -2368,53 +2414,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 BlockSi= d command to device!\n")); - Result =3D OpalBlockSid (&Session, TRUE); // HardwareReset must a= lways be TRUE - if (Result !=3D TcgResultSuccess) { - DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n")); - break; - } - } - - Itr =3D Itr->Next; - } - } -} - /** Stop this Controller. =20 @@ -2677,7 +2676,6 @@ EfiDriverEntryPoint( ) { EFI_STATUS Status; - EFI_EVENT ReadyToBootEvent; EFI_EVENT EndOfDxeEvent; =20 Status =3D EfiLibInstallDriverBindingComponentName2 ( @@ -2710,16 +2708,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. // --=20 2.15.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 (#40090): https://edk2.groups.io/g/devel/message/40090 Mute This Topic: https://groups.io/mt/31529815/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- From nobody Thu May 2 09:01:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+40091+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40091+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557216101; cv=none; d=zoho.com; s=zohoarc; b=eAPBtVM79o0EmphwTC1fskSVAzFqoX2hsBPbF/eprhhHhysQDHxZGPEE1S9T2FIEG1wMgH/MR76FvVt8YjB4TBOnDKFi1enGDGGP9cgxxmzlUvQCwjDr8CzhXWiZOVvQYohgfdYqSjawEmHw2P8J1FiWd+kMrr/sUpMCoF07tik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557216101; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=4OUsM2WGxNJKuAbBTsvCCRFADbx8PXOyYDbdaexcrGc=; b=SxAPjjlrHoL8jAFY6CTuqrPqIytSeVzSyH3x44PKe/lCOKtsO3+XAis36cOrTHPNb803yX8N1kUPhpT7O7GOlbHYT611cC2KpkwVr5Ret6z0AZxTjWaGQ1fWZIQzzV7wKY+Nw64u1/i5JQp1Z98/C6b+w0EYk0+SEDP7an86Vgo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+40091+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1557216101408634.334930520497; Tue, 7 May 2019 01:01:41 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Tue, 07 May 2019 01:01:40 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 01:01:40 -0700 X-ExtLoop1: 1 X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by fmsmga006.fm.intel.com with ESMTP; 07 May 2019 01:01:39 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Subject: [edk2-devel] [Patch 3/3] SecurityPkg/OpalPassword: Fix "Enable Feature" Menu disappear issue. Date: Tue, 7 May 2019 16:00:53 +0800 Message-Id: <20190507080053.15056-4-eric.dong@intel.com> In-Reply-To: <20190507080053.15056-1-eric.dong@intel.com> References: <20190507080053.15056-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1557216100; bh=Q1Peq6avzSFjbebzxTwEjm4eYgxWOE3z1Z7fUy8vYyg=; h=Date:From:Reply-To:Subject:To; b=Vcy030WfbcSY2QJle1qJAQciNrDBoYH0XYm2T3VRFzsjAhdqel45vNVO9snGEdOxaEg GnjwJz/JwiYW8NOiDdVN32Y72zGfRfJK2gpnL9kq9usNzu3UVKFa1czSVFdmcmKT53uHU s2P1dUbQJrtMB8Qm3b+6DOqjWP/yMiMj1jg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" After change behavior to send BlockSid command at EndOfDxe point, check device ownership command will return un-authority error, it finally caused opal driver can't show "Enable Feature" menu. Update the code logic to send detect device ownership command before send BlockSID command. Signed-off-by: Eric Dong --- SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 11 ++++++ SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h | 1 + SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c | 46 ++++++++++++++++++++--= ---- SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h | 15 +++++++++ 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/T= cg/Opal/OpalPassword/OpalDriver.c index a3d4350c67..847749be66 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -608,6 +608,11 @@ SendBlockSidCommand ( DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n")); break; } + + // + // Record BlockSID command has been sent. + // + Itr->OpalDisk.SentBlockSID =3D TRUE; } =20 Itr =3D Itr->Next; @@ -2310,6 +2315,12 @@ ProcessOpalRequest ( ProcessOpalRequestEnableFeature (Dev, L"Enable Feature:"); } =20 + // + // Update Device ownership. + // Later BlockSID command may block the update. + // + OpalDiskUpdateOwnerShip (&Dev->OpalDisk); + break; } =20 diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h b/SecurityPkg/T= cg/Opal/OpalPassword/OpalDriver.h index 2bca770620..1b1e372c51 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h @@ -149,6 +149,7 @@ typedef struct { UINT8 Password[OPAL_MAX_PASSWO= RD_SIZE]; =20 UINT32 EstimateTimeCost; + BOOLEAN SentBlockSID; = // Check whether BlockSid command has been sent. } OPAL_DISK; =20 // diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c b/SecurityPkg/Tcg/= Opal/OpalPassword/OpalHii.c index 4336604d0d..6587e0dd1a 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c @@ -1220,6 +1220,40 @@ OpalDiskInitialize ( return OpalDiskUpdateStatus (&Dev->OpalDisk); } =20 +/** + Update the device ownship + + @param OpalDisk The Opal device. + + @retval EFI_SUCESS Get ownership success. + @retval EFI_ACCESS_DENIED Has send BlockSID command, can't change o= wnership. + @retval EFI_INVALID_PARAMETER Not get Msid info before get ownership in= fo. + +**/ +EFI_STATUS +OpalDiskUpdateOwnerShip ( + OPAL_DISK *OpalDisk + ) +{ + OPAL_SESSION Session; + + if (OpalDisk->MsidLength =3D=3D 0) { + return EFI_INVALID_PARAMETER; + } + + if (OpalDisk->SentBlockSID) { + return EFI_ACCESS_DENIED; + } + + ZeroMem(&Session, sizeof(Session)); + Session.Sscp =3D OpalDisk->Sscp; + Session.MediaId =3D OpalDisk->MediaId; + Session.OpalBaseComId =3D OpalDisk->OpalBaseComId; + + OpalDisk->Owner =3D OpalUtilDetermineOwnership(&Session, OpalDisk->Msid,= OpalDisk->MsidLength); + return EFI_SUCCESS; +} + /** Update the device info. =20 @@ -1228,6 +1262,7 @@ OpalDiskInitialize ( @retval EFI_SUCESS Initialize the device success. @retval EFI_DEVICE_ERROR Get info from device failed. @retval EFI_INVALID_PARAMETER Not get Msid info before get ownership in= fo. + @retval EFI_ACCESS_DENIED Has send BlockSID command, can't change o= wnership. =20 **/ EFI_STATUS @@ -1248,15 +1283,6 @@ OpalDiskUpdateStatus ( return EFI_DEVICE_ERROR; } =20 - if (OpalDisk->MsidLength =3D=3D 0) { - return EFI_INVALID_PARAMETER; - } else { - // - // Base on the Msid info to get the ownership, so Msid info must get f= irst. - // - OpalDisk->Owner =3D OpalUtilDetermineOwnership(&Session, OpalDisk->Msi= d, OpalDisk->MsidLength); - } - - return EFI_SUCCESS; + return OpalDiskUpdateOwnerShip (OpalDisk); } =20 diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h b/SecurityPkg/Tcg/= Opal/OpalPassword/OpalHii.h index a4bb19ad60..6d01d3e614 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h @@ -385,4 +385,19 @@ OpalDiskInitialize ( IN OPAL_DRIVER_DEVICE *Dev ); =20 +/** + Update the device ownership + + @param OpalDisk The Opal device. + + @retval EFI_SUCESS Get ownership success. + @retval EFI_ACCESS_DENIED Has send BlockSID command, can't change o= wnership. + @retval EFI_INVALID_PARAMETER Not get Msid info before get ownership in= fo. + +**/ +EFI_STATUS +OpalDiskUpdateOwnerShip ( + OPAL_DISK *OpalDisk + ); + #endif // _HII_H_ --=20 2.15.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 (#40091): https://edk2.groups.io/g/devel/message/40091 Mute This Topic: https://groups.io/mt/31529816/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-