From nobody Sun Feb 8 19:55:06 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+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-