From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.1973.1572998607125748553 for ; Tue, 05 Nov 2019 16:03:27 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: eric.dong@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2019 16:03:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,271,1569308400"; d="scan'208";a="212646161" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 05 Nov 2019 16:03:26 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 5 Nov 2019 16:03:26 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 5 Nov 2019 16:03:25 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.108]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.248]) with mapi id 14.03.0439.000; Wed, 6 Nov 2019 08:03:23 +0800 From: "Dong, Eric" To: "Chu, Maggie" , "devel@edk2.groups.io" CC: "Zhang, Chao B" , "Yao, Jiewen" Subject: Re: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL Thread-Topic: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL Thread-Index: AQHVksT4gnauecPHIEqfaoUOgOZSIad9RZBQ Date: Wed, 6 Nov 2019 00:03:23 +0000 Message-ID: References: <20191104040428.1542-1-maggie.chu@intel.com> In-Reply-To: <20191104040428.1542-1-maggie.chu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.dong@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong -----Original Message----- From: Chu, Maggie=20 Sent: Monday, November 4, 2019 12:04 PM To: devel@edk2.groups.io Cc: Dong, Eric ; Zhang, Chao B ; Yao, Jiewen Subject: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_I= O_PROTOCOL https://bugzilla.tianocore.org/show_bug.cgi?id=3D2327 RAID drivers abstract their physical drives that make up the array into a single unit, and do not supply individual EFI_BLOCK_IO_PROTOCOL instances for each physical drive in the array. This breaks support for the Security Storage Command Protocol, which currently requires an EFI_BLOCK_IO_PROTOCOL to be associated with the same device the protocol is installed on and provide all the same parameters. This patch remove dependency on EFI_BLOCK_IO_PROTOCOL and allows access to Opal drive members of a RAID array. Signed-off-by: Maggie Chu Cc: Eric Dong Cc: Chao Zhang Cc: Jiewen Yao --- SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 70 ++++++++++------------= ---- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/T= cg/Opal/OpalPassword/OpalDriver.c index 77905d2bf9..6bec54b932 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -2667,7 +2667,6 @@ OpalEfiDriverBindingSupported( { EFI_STATUS Status; EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand; - EFI_BLOCK_IO_PROTOCOL* BlkIo; =20 if (mOpalEndOfDxe) { return EFI_UNSUPPORTED; @@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported( Controller ); =20 - // - // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by EFI_STOR= AGE_SECURITY_COMMAND_PROTOCOL - // function APIs - // - Status =3D gBS->OpenProtocol( - Controller, - &gEfiBlockIoProtocolGuid, - (VOID **)&BlkIo, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - - if (EFI_ERROR(Status)) { - DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n")); - return Status; - } - - // - // Close protocol and reopen in Start call - // - gBS->CloseProtocol( - Controller, - &gEfiBlockIoProtocolGuid, - This->DriverBindingHandle, - Controller - ); =20 return EFI_SUCCESS; } @@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart( ); if (EFI_ERROR(Status)) { // - // Close storage security that was opened + // Block_IO not supported on handle // - gBS->CloseProtocol( - Controller, - &gEfiStorageSecurityCommandProtocolGuid, - This->DriverBindingHandle, - Controller - ); + if(Status =3D=3D EFI_UNSUPPORTED) { + BlkIo =3D NULL; + } else { + // + // Close storage security that was opened + // + gBS->CloseProtocol( + Controller, + &gEfiStorageSecurityCommandProtocolGuid, + This->DriverBindingHandle, + Controller + ); =20 - FreePool(Dev); - return Status; + FreePool(Dev); + return Status; + } } =20 // // Save mediaId // - Dev->MediaId =3D BlkIo->Media->MediaId; + if(BlkIo =3D=3D NULL) { + // If no Block IO present, use defined MediaId value. + Dev->MediaId =3D 0x0; + } else { + Dev->MediaId =3D BlkIo->Media->MediaId; =20 - gBS->CloseProtocol( - Controller, - &gEfiBlockIoProtocolGuid, - This->DriverBindingHandle, - Controller + gBS->CloseProtocol( + Controller, + &gEfiBlockIoProtocolGuid, + This->DriverBindingHandle, + Controller ); + } =20 // // Acquire Ascii printable name of child, if not found, then ignore devi= ce --=20 2.16.2.windows.1