From nobody Sun Feb 8 05:08:55 2026 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-