From nobody Fri Apr 26 00:34:16 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+49903+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+49903+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1572840275; cv=none; d=zoho.com; s=zohoarc; b=js5yt0shreZPX/Y8AblUSQvcOvoyfBtoL8sw+sDJRmMXAfNylYwTflVvc/diIuuaCfTL23nLA1aWQphj2GrZh9AY3Bz7g/ALLsOKH3cGrY08rfJ+RrCv/RZFZ+T/mfLP939Y/D0WrNGfewbK9NvHboDePp1p5+JBEDNiApOaSv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572840275; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=qdk4Hmf8iDahm87YlnlRQTvYxP96vXsHKov2icWE2mc=; b=KClatBFvqLyqmWBx6G/dEF/9QETP9Vp4ZquvBPI9PDibnLIAjaGI977ZXRrs7sZehRvd9vOICw3TSkGXS3jjJcTCDo40+I4mb4Cp2NGED5HnPHWivrOwfCERNRo48c0RjwKKHkT/oZ/0HeH5b2TZUN4pr4k/N/UQN4EJ9FODW00= 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+49903+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 1572840275639761.0646512956214; Sun, 3 Nov 2019 20:04:35 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4m1uYY1788612x7Q7YaPFnde; Sun, 03 Nov 2019 20:04:35 -0800 X-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 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-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" X-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: [edk2-devel] [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> 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,maggie.chu@intel.com X-Gm-Message-State: NaDIv5CJoBenhpe2fTMl6EFXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1572840275; bh=h1iZI722lHOzwEpfBRjrf0jQnqjcq+Bq++O3WsKpnck=; h=Cc:Date:From:Reply-To:Subject:To; b=cciLLn/76cYt7MVZTOrkxolFJreCd8hqzyCizcFs3wIii6XK89QWyeM8ynRnyfXQH13 0h4R2A4ohsn/bhNfOsY6pito8/irzoLUyHzDaVg+svhxSJhI3gnvAERAnJ3Kw5nJgC346 DajT2jboGLapX2xvSLUU/GonMpzsTzGRQvk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Dong --- 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 -=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 (#49903): https://edk2.groups.io/g/devel/message/49903 Mute This Topic: https://groups.io/mt/41056838/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-