From nobody Tue May 7 03:46:14 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+40167+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+40167+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557284521; cv=none; d=zoho.com; s=zohoarc; b=ieslGDtv3AZ+0Zmbr4Or4XJdgZ0Hpc6mKhWx8BnzeozNP8BqVhDlnP+cbJQwcdUBNjKsCVYSVa4yoFD2gHK/1xCWa3440rASFvRbEodpOmSTcU4VSFx73KENIwPxZZgHZWtOuAki26KHMCgJraltJ6O3aItNImr0GpPlrWiJndc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557284521; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=aLwFRCFz7+QvvsgLYBhwJchRdBceryOUDh/5WS5H/Uw=; b=JHji3SGWv7DyDa8Sl65fJ5qaFP+FHqStn+dq6AaBRXf9txJ9pWjkyBwOfopcrWAwwssU1zF7QBRqwH82HVENML9bXAZFGd/Rf4j/WNObRfp1hkJ+JDVyzUZDzR7NsHTm1VvjOkMm3zyMUoGG0b3usSIvAebT7c9p3nujD25ktiQ= 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+40167+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 155728452081360.69666036281092; Tue, 7 May 2019 20:02:00 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Tue, 07 May 2019 20:02:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 20:01:53 -0700 X-ExtLoop1: 1 X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by fmsmga008.fm.intel.com with ESMTP; 07 May 2019 20:01:53 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Hao Wu Subject: [edk2-devel] [Patch v2 1/3] SecurityPkg/SecurityPkg.dec: Change default value. Date: Wed, 8 May 2019 11:01:48 +0800 Message-Id: <20190508030150.3968-2-eric.dong@intel.com> In-Reply-To: <20190508030150.3968-1-eric.dong@intel.com> References: <20190508030150.3968-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=1557284520; bh=o0rC5ROM8WsoiIxNqOP4XSE2CNQli3owPb3KlWA6Zwc=; h=Cc:Date:From:Reply-To:Subject:To; b=gNDq3YE2ScW+PdaKUaXUSxzlC74Apns9hZkbmJNlh/HXArV892GceD0VzJWsEz5gbk+ evRHf+/LpLJmDZsD6lblvp/uLiGrIDkEMcTOTs8ucVVqfWOMF8fzrXnIrHzVYvdjbTnjX ZalYV7dt+jIuis767TSqmiQHPMj6XIBriXc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D1782 Change BlockSID default policy, default enable BlockSid. Signed-off-by: Eric Dong Cc: Hao Wu Reviewed-by: Hao A Wu --- 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 d9eee7f3e8..8da3deaf86 100644 --- a/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h +++ b/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h @@ -51,7 +51,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // 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 6e4c4c3a02..3314f1854b 100644 --- a/SecurityPkg/SecurityPkg.dec +++ b/SecurityPkg/SecurityPkg.dec @@ -410,7 +410,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.21.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 (#40167): https://edk2.groups.io/g/devel/message/40167 Mute This Topic: https://groups.io/mt/31539610/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 Tue May 7 03:46:14 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+40166+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+40166+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557284521; cv=none; d=zoho.com; s=zohoarc; b=PamkEXOYIOB/081eH3HRZKN/A/eZpCX5ih75b7sNIPWJqlFbpISVSdMGgPNPUIEtQnrWXBMdkNu3W2NgA45uUEs4WNv9wwwgA0yf/t5ZUIXR8EKOEMBn/yG+xd+VI0wOL/hL8GuJL4DIbfo2bLaSqlF+6qflJS0L9bG6i9Qp3fY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557284521; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=LcT5WWuVFNCjF9Tfl8aiXqG2JdXbjJbFkV0YBPF0uqY=; b=QOAwKWqBIORtXy5WQCn58ba/wxCMiBlvf5N89BOx/h09vfo+iDojhU2ANvCRagY2yts5HwhLpblbLQSMYTCnmVI/VaovACbo8qlKQTQfOMcHMMW0Z+zw2qZvRslF++q74hs08Q3oNnDKwKCpVyX5DhPNCc8HnAoBCmtkYkG2iWg= 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+40166+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 1557284520828447.5429143861048; Tue, 7 May 2019 20:02:00 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Tue, 07 May 2019 20:01:59 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 20:01:54 -0700 X-ExtLoop1: 1 X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by fmsmga008.fm.intel.com with ESMTP; 07 May 2019 20:01:54 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Hao Wu Subject: [edk2-devel] [Patch v2 2/3] SecurityPkg/OpalPassword: Change send BlockSID policy. Date: Wed, 8 May 2019 11:01:49 +0800 Message-Id: <20190508030150.3968-3-eric.dong@intel.com> In-Reply-To: <20190508030150.3968-1-eric.dong@intel.com> References: <20190508030150.3968-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=1557284520; bh=E6vEKJI76aZypCHfS0tEGt1puHOvMHPc3P33uaj0cXU=; h=Cc:Date:From:Reply-To:Subject:To; b=e392oEpHJU1tXtxsx3+b/eFGnD6+jRs8mq87eNM8CSUT2e+Pt1iQxuoeqE9EnAoYEOj EI59w22KYulZbTiSM9kTysaGdYRbdZ7C6NzdCuN8gFlL6nBBBE5y7hkMbApw+kvFlAHvL bTIEBShtZFhjhBJCVrJFfCCVN1ZgaTvDki4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D1782 Change Send BlockSID command time from ReadyToBoot to EndOfDxe. Signed-off-by: Eric Dong Cc: Hao Wu Reviewed-by: Hao A Wu --- .../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 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 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 @@ -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 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 @@ -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. // --=20 2.21.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 (#40166): https://edk2.groups.io/g/devel/message/40166 Mute This Topic: https://groups.io/mt/31539609/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 Tue May 7 03:46:14 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+40165+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+40165+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557284521; cv=none; d=zoho.com; s=zohoarc; b=gfjbHfAkFhaM4U0zYdv53Oun1+tjbdjkoVjfYygNffDvCIoRrKaC8i1OSxHKXEJv/u77udwUo8Ax0RKGCFTKP6dI11vFXmQarvx1nOy1mT4MxluItknWqG3m7+tdG0bF5BGFTyW18GjwmtpAu3ED/WNvjhRnB6WopU5fhuZ78RA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557284521; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=DJUQklR4VE1aRjQOCfMyjQxcdiY7S5hUijwc4NdWC8Y=; b=EEc0brAyxk+O0FsZGQpACf/QmNbSooyrh6TG38b5J3PIeEpw3FiGEMDAq26ePTxLa9jU50mv06ws/SAeCGO43IKcEPjLweK0Zgh1hRMUoptT4hoUc+rn+lhMgV878IfzR+fl0PV2kZ4PbIFmvOcavKMsOopUw6bMaFs5JowbDjo= 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+40165+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 1557284521541633.875981495472; Tue, 7 May 2019 20:02:01 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Tue, 07 May 2019 20:01:59 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 20:01:55 -0700 X-ExtLoop1: 1 X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by fmsmga008.fm.intel.com with ESMTP; 07 May 2019 20:01:55 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Hao Wu Subject: [edk2-devel] [Patch v2 3/3] SecurityPkg/OpalPassword: Fix "Enable Feature" Menu disappear issue. Date: Wed, 8 May 2019 11:01:50 +0800 Message-Id: <20190508030150.3968-4-eric.dong@intel.com> In-Reply-To: <20190508030150.3968-1-eric.dong@intel.com> References: <20190508030150.3968-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=1557284520; bh=CImd1AhB6LYQaVoy0ygzleb66sv2oUk3B8vsoPQKLac=; h=Cc:Date:From:Reply-To:Subject:To; b=d6YDFicnrCDA/Aas0XjEy8jfN9JrcN7VA1YJBZRUVXuHH7AddR3602+80GIqnl6UHhn ddz1095waTsiTE49pdM2KK0QDWtxPpvRBtARi/60/6vuNmNknZLk8ocHVo9CvDp9DWKlU GZL7szbO1RfnM58zHzzsZWPazbbZWUvTRmQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D1782 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 Cc: Hao Wu Reviewed-by: Hao A Wu --- .../Tcg/Opal/OpalPassword/OpalDriver.c | 11 +++++ .../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 009a97f66f..965205c0b2 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -458,6 +458,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; @@ -2204,6 +2209,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 a056e06106..beeabb1c0a 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h @@ -143,6 +143,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 d0f3eda1e8..f101ca1c20 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c @@ -1215,6 +1215,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 @@ -1223,6 +1257,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 @@ -1243,15 +1278,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 d3e236e2fe..89c709df99 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h @@ -357,4 +357,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.21.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 (#40165): https://edk2.groups.io/g/devel/message/40165 Mute This Topic: https://groups.io/mt/31539608/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-