From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.463.1572840274146770488 for ; Sun, 03 Nov 2019 20:04:34 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: maggie.chu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2019 20:04:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,265,1569308400"; d="scan'208";a="195329420" Received: from chumaggi-mobl1.gar.corp.intel.com ([10.5.246.26]) by orsmga008.jf.intel.com with ESMTP; 03 Nov 2019 20:04:32 -0800 From: "Maggie Chu" To: devel@edk2.groups.io Cc: Eric Dong , Chao Zhang , Jiewen Yao Subject: [PATCH] SecurityPkg/OpalPassword: Remove dependency on EFI_BLOCK_IO_PROTOCOL Date: Mon, 4 Nov 2019 12:04:28 +0800 Message-Id: <20191104040428.1542-1-maggie.chu@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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( {=0D EFI_STATUS Status;=0D EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand;=0D - EFI_BLOCK_IO_PROTOCOL* BlkIo;=0D =0D if (mOpalEndOfDxe) {=0D return EFI_UNSUPPORTED;=0D @@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported( Controller=0D );=0D =0D - //=0D - // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by EFI_STOR= AGE_SECURITY_COMMAND_PROTOCOL=0D - // function APIs=0D - //=0D - Status =3D gBS->OpenProtocol(=0D - Controller,=0D - &gEfiBlockIoProtocolGuid,=0D - (VOID **)&BlkIo,=0D - This->DriverBindingHandle,=0D - Controller,=0D - EFI_OPEN_PROTOCOL_BY_DRIVER=0D - );=0D -=0D - if (EFI_ERROR(Status)) {=0D - DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n"));=0D - return Status;=0D - }=0D -=0D - //=0D - // Close protocol and reopen in Start call=0D - //=0D - gBS->CloseProtocol(=0D - Controller,=0D - &gEfiBlockIoProtocolGuid,=0D - This->DriverBindingHandle,=0D - Controller=0D - );=0D =0D return EFI_SUCCESS;=0D }=0D @@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart( );=0D if (EFI_ERROR(Status)) {=0D //=0D - // Close storage security that was opened=0D + // Block_IO not supported on handle=0D //=0D - gBS->CloseProtocol(=0D - Controller,=0D - &gEfiStorageSecurityCommandProtocolGuid,=0D - This->DriverBindingHandle,=0D - Controller=0D - );=0D + if(Status =3D=3D EFI_UNSUPPORTED) {=0D + BlkIo =3D NULL;=0D + } else {=0D + //=0D + // Close storage security that was opened=0D + //=0D + gBS->CloseProtocol(=0D + Controller,=0D + &gEfiStorageSecurityCommandProtocolGuid,=0D + This->DriverBindingHandle,=0D + Controller=0D + );=0D =0D - FreePool(Dev);=0D - return Status;=0D + FreePool(Dev);=0D + return Status;=0D + }=0D }=0D =0D //=0D // Save mediaId=0D //=0D - Dev->MediaId =3D BlkIo->Media->MediaId;=0D + if(BlkIo =3D=3D NULL) {=0D + // If no Block IO present, use defined MediaId value.=0D + Dev->MediaId =3D 0x0;=0D + } else {=0D + Dev->MediaId =3D BlkIo->Media->MediaId;=0D =0D - gBS->CloseProtocol(=0D - Controller,=0D - &gEfiBlockIoProtocolGuid,=0D - This->DriverBindingHandle,=0D - Controller=0D + gBS->CloseProtocol(=0D + Controller,=0D + &gEfiBlockIoProtocolGuid,=0D + This->DriverBindingHandle,=0D + Controller=0D );=0D + }=0D =0D //=0D // Acquire Ascii printable name of child, if not found, then ignore devi= ce=0D --=20 2.16.2.windows.1