From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <akamit91@hotmail.com>
Received: from NAM02-SN1-obe.outbound.protection.outlook.com
 (mail-oln040092005075.outbound.protection.outlook.com [40.92.5.75])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
 (No client certificate requested)
 by ml01.01.org (Postfix) with ESMTPS id 014EC2095A6C4
 for <edk2-devel@lists.01.org>; Wed, 28 Jun 2017 11:06:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com;
 s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version;
 bh=y6b+EdGHu8raAyVegbv1D0MwmpWcS/Pu0ezmbncevko=;
 b=PKp3YL1tpwrMJNsTg/BHBU7VykqxteNPkxJrppF6pYITF+xEANByYaWyEA0+UZ9KAi4i71/e9ZY/54XnXPCQPBiFfSsEAmHiLshwGhf8jLOPFDSBpfm3nQwL3F6kIFDKa6UGjX9wNGgfEZXuGUAywrcgNyHzRxs1DmiLI/DrOFyum6fjoHPyDYmC/aU2re7M2cwbZp8AtcALROG4hp/maOQVozEvgW+cg28tiGQ4DR7mAfhCTwF9r982TZqxl2gGIIzJ36Bg9G/RiNiZIwj/UD9i9YDLVm7MiP2eBOtYDhKGfhNSYHZ8NP8FlbU5ncrm7vlLqqBWXl9rhQ+b+svYJQ==
Received: from CY1NAM02FT016.eop-nam02.prod.protection.outlook.com
 (10.152.74.53) by CY1NAM02HT198.eop-nam02.prod.protection.outlook.com
 (10.152.75.62) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1199.9; Wed, 28
 Jun 2017 18:08:10 +0000
Received: from DM5PR11MB1578.namprd11.prod.outlook.com (10.152.74.59) by
 CY1NAM02FT016.mail.protection.outlook.com (10.152.75.164) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id
 15.1.1199.9 via Frontend Transport; Wed, 28 Jun 2017 18:08:10 +0000
Received: from DM5PR11MB1578.namprd11.prod.outlook.com ([10.172.37.22]) by
 DM5PR11MB1578.namprd11.prod.outlook.com ([10.172.37.22]) with mapi id
 15.01.1220.014; Wed, 28 Jun 2017 18:08:10 +0000
From: Amit kumar <akamit91@hotmail.com>
To: Laszlo Ersek <lersek@redhat.com>, Star Zeng <star.zeng@intel.com>,
 "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
CC: Michael D Kinney <michael.d.kinney@intel.com>, Gabriel Somlo
 <gsomlo@gmail.com>, Liming Gao <liming.gao@intel.com>
Thread-Topic: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned
 by CoreOpenProtocol
Thread-Index: AQHS8BGqbkyHW/V6TUGc82VnZHUTvKI6UV6AgABAtno=
Date: Wed, 28 Jun 2017 18:08:10 +0000
Message-ID: <DM5PR11MB15787CAD71FF0A26629AF4CFDCDD0@DM5PR11MB1578.namprd11.prod.outlook.com>
References: <1498656170-184428-1-git-send-email-star.zeng@intel.com>,
 <a23de091-cd60-5c37-af39-399a4c453dd5@redhat.com>
In-Reply-To: <a23de091-cd60-5c37-af39-399a4c453dd5@redhat.com>
Accept-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: redhat.com; dkim=none (message not signed)
 header.d=none;redhat.com; dmarc=none action=none header.from=hotmail.com;
x-incomingtopheadermarker: OriginalChecksum:04EE82E559DF0CB3AD1C2BD162BC23624D6D9C2DF4424F4AEE2897E0C3CE907F;
 UpperCasedChecksum:B2DF9BDE4010B32E87FDE0390E7C60C3E9112A5D1181B80F53E6EFBB784614B0;
 SizeAsReceived:7533; Count:46
x-ms-exchange-messagesentrepresentingtype: 1
x-tmn: [OvDMKaJN/AP/qnuxcRksiMa/Zsdn48zk]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; CY1NAM02HT198;
 7:BPp6HPyCfUveVb+Ic3Pt3TpjXLTRdOGpqeC094T5GjxK3qyfZKIqzh/xjJFfiynCzdIScYBOKuKYiqbGcOjZhvMJJAWw3fK5G2zfHelQeYzMlwrdMeJzY03MuM+qhQhE8CZJIBGtJ43/U2klVIN40HXtoVPxnnsxigLDPpALWm5/4Gu2ourYAku4T1pCFug18ebwGbuMGTxjqGCI71wVbsTCTiISaMEnBm4YPrJLkfTOhsT6N/7u9WmAC8rjlnlI71z/KOhSlmxttrblm8NC5v8zVnxN6WcSiumrPxpkfnWzpi6NhIhxwZp0QMEANuGM8HP2EbSWVWLC9AF7s5QJ8iRKZPylbaqVlDHG6c3zJS2hAjKDDb34KkT/aEwzzMmeE/okcZ4A5MnBGNIAuh1/CVYS9b+976Mc1OwsJZBJHg/HjMKih3af6eYrxF8Vv04fwUaUcioaTqKb89QJZ2UyXUuaEELi+/f7qwSHPWPNkrn/6wFkSSastj5THjay1N7OduMx2ipMI4WYRiJ4iBH7lHJ2qnKj3vOAY8Dh8tVuLj0Re20RlSkhgwCcceDt2JiqONPKw+LeLL6/+/SFXpj7gqAa15kQ/Q8CXzLWVY0KBvxkoljLZFAWXAhWJv04LrTrvD6o3RnLY/hEy02vKfCWVjQDwGcwy+MiaZBm98OSXHY9yRQfUxuJM96sIMmT+7uYSjnKmqyZyHXDyyJjzQs8EnKTCRylipEzDJhOJGaxCAxA2Q5s0vNBZV8T1MYQgksRwyOe9+bXWHgmg9oXK143RA==
x-incomingheadercount: 46
x-eopattributedmessage: 0
x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004);
 DIR:OUT; SFP:1901; SCL:1; SRVR:CY1NAM02HT198;
 H:DM5PR11MB1578.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; 
x-ms-office365-filtering-correlation-id: 47bf72b7-50f2-4cf0-d222-08d4be50a2f7
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1601125374)(1603101448)(1701031045)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);
 SRVR:CY1NAM02HT198; 
x-ms-traffictypediagnostic: CY1NAM02HT198:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031);
 SRVR:CY1NAM02HT198; BCL:0; PCL:0;
 RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);
 SRVR:CY1NAM02HT198; 
x-forefront-prvs: 03524FBD26
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
MIME-Version: 1.0
X-OriginatorOrg: hotmail.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2017 18:08:10.5552 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT198
X-Content-Filtered-By: Mailman/MimeDel 2.1.22
Subject: Re: [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
X-BeenThere: edk2-devel@lists.01.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: EDK II Development  <edk2-devel.lists.01.org>
List-Unsubscribe: <https://lists.01.org/mailman/options/edk2-devel>,
 <mailto:edk2-devel-request@lists.01.org?subject=unsubscribe>
List-Archive: <http://lists.01.org/pipermail/edk2-devel/>
List-Post: <mailto:edk2-devel@lists.01.org>
List-Help: <mailto:edk2-devel-request@lists.01.org?subject=help>
List-Subscribe: <https://lists.01.org/mailman/listinfo/edk2-devel>,
 <mailto:edk2-devel-request@lists.01.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Jun 2017 18:06:40 -0000
Content-Language: en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Try this; just a quick thing



EFI_STATUS
EFIAPI
UefiMain (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
    EFI_STATUS Status;

ConvertHandleIndexToHandle((UINTN)Intermediate);


gBS->DisconnectController (

       ConvertHandleIndexToHandle (175),

       ConvertHandleIndexToHandle (176),
       NULL);

return (Status); }


________________________________
From: edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Laszlo Erse=
k <lersek@redhat.com>
Sent: Wednesday, June 28, 2017 7:43:45 PM
To: Star Zeng; edk2-devel@lists.01.org
Cc: Michael D Kinney; Gabriel Somlo; Liming Gao
Subject: Re: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface return=
ed by CoreOpenProtocol

On 06/28/17 15:22, Star Zeng wrote:
> From: Amit Kumar <amit.ak@samsung.com>
>
> Change since v4: Revise the patch based on V4 sent by Amit Kumar
> 1) Only return the corresponding protocol interface in *Interface
> if the return status is EFI_SUCCESS or EFI_ALREADY_STARTED.
> 2) Interface is returned unmodified for all error conditions except
> EFI_UNSUPPORTED and EFI_ALREADY_STARTED, NULL will be returned in
> *Interface when EFI_UNSUPPORTED and Attributes is not
> EFI_OPEN_PROTOCOL_TEST_PROTOCOL, the protocol interface will be
> returned in *Interface when EFI_ALREADY_STARTED.
>
> Change since v3:
> 1) Fixed issue when Attributes =3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL
> and Inteface =3D NULL case. [Reported by:star.zeng at intel.com]
>
> Change Since v2:
> 1) Modified to use EFI_ERROR to get status code
>
> Change since v1:
> 1) Fixed typo protocal to protocol
> 2) Fixed coding style
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Amit Kumar <amit.ak@samsung.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Gabriel Somlo <gsomlo@gmail.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Amit Kumar <amit.ak@samsung.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdeModulePkg/Core/Dxe/Hand/Handle.c | 36 +++++++++++++++++++++++--------=
-----
>  1 file changed, 23 insertions(+), 13 deletions(-)

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo

> diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/=
Hand/Handle.c
> index 59b89148c8f0..3862a3876f4a 100644
> --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
> +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
> @@ -1006,12 +1006,8 @@ CoreOpenProtocol (
>    //
>    // Check for invalid Interface
>    //
> -  if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
> -    if (Interface =3D=3D NULL) {
> -      return EFI_INVALID_PARAMETER;
> -    } else {
> -      *Interface =3D NULL;
> -    }
> +  if ((Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface =
=3D=3D NULL)) {
> +    return EFI_INVALID_PARAMETER;
>    }
>
>    //
> @@ -1078,12 +1074,6 @@ CoreOpenProtocol (
>      goto Done;
>    }
>
> -  //
> -  // This is the protocol interface entry for this protocol
> -  //
> -  if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
> -    *Interface =3D Prot->Interface;
> -  }
>    Status =3D EFI_SUCCESS;
>
>    ByDriver        =3D FALSE;
> @@ -1177,8 +1167,28 @@ CoreOpenProtocol (
>    }
>
>  Done:
> +
> +  if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
> +    //
> +    // Keep Interface unmodified in case of any Error
> +    // except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.
> +    //
> +    if (!EFI_ERROR (Status) || Status =3D=3D EFI_ALREADY_STARTED) {
> +      //
> +      // EFI_ALREADY_STARTED is not an error for bus driver.
> +      // Return the corresponding protocol interface.
> +      //
> +      *Interface =3D Prot->Interface;
> +    } else if (Status =3D=3D EFI_UNSUPPORTED) {
> +      //
> +      // Return NULL Interface if Unsupported Protocol.
> +      //
> +      *Interface =3D NULL;
> +    }
> +  }
> +
>    //
> -  // Done. Release the database lock are return
> +  // Done. Release the database lock and return
>    //
>    CoreReleaseProtocolLock ();
>    return Status;
>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel