From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A16882095A6C4 for ; Wed, 28 Jun 2017 11:13:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF56680F8E; Wed, 28 Jun 2017 18:15:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CF56680F8E Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CF56680F8E Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-57.phx2.redhat.com [10.3.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D92589E7E; Wed, 28 Jun 2017 18:15:05 +0000 (UTC) To: Amit kumar , Star Zeng , "edk2-devel@lists.01.org" Cc: Michael D Kinney , Gabriel Somlo , Liming Gao References: <1498656170-184428-1-git-send-email-star.zeng@intel.com> From: Laszlo Ersek Message-ID: Date: Wed, 28 Jun 2017 20:15:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 28 Jun 2017 18:15:08 +0000 (UTC) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2017 18:13:36 -0000 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit On 06/28/17 20:08, Amit kumar wrote: > 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); } Sorry, what is this program supposed to do, and what are the (likely undesirable) symptoms that you are witnessing (... presumably as a consequence of the v5 patch below)? Thanks Laszlo > > > ________________________________ > From: edk2-devel on behalf of Laszlo Ersek > 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 returned by CoreOpenProtocol > > On 06/28/17 15:22, Star Zeng wrote: >> From: Amit Kumar >> >> 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 = EFI_OPEN_PROTOCOL_TEST_PROTOCOL >> and Inteface = 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 >> Cc: Amit Kumar >> Cc: Michael D Kinney >> Cc: Liming Gao >> Cc: Gabriel Somlo >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Amit Kumar >> Signed-off-by: Star Zeng >> --- >> MdeModulePkg/Core/Dxe/Hand/Handle.c | 36 +++++++++++++++++++++++------------- >> 1 file changed, 23 insertions(+), 13 deletions(-) > > Reviewed-by: Laszlo Ersek > Tested-by: Laszlo Ersek > > 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 != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { >> - if (Interface == NULL) { >> - return EFI_INVALID_PARAMETER; >> - } else { >> - *Interface = NULL; >> - } >> + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { >> + return EFI_INVALID_PARAMETER; >> } >> >> // >> @@ -1078,12 +1074,6 @@ CoreOpenProtocol ( >> goto Done; >> } >> >> - // >> - // This is the protocol interface entry for this protocol >> - // >> - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { >> - *Interface = Prot->Interface; >> - } >> Status = EFI_SUCCESS; >> >> ByDriver = FALSE; >> @@ -1177,8 +1167,28 @@ CoreOpenProtocol ( >> } >> >> Done: >> + >> + if (Attributes != 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 == EFI_ALREADY_STARTED) { >> + // >> + // EFI_ALREADY_STARTED is not an error for bus driver. >> + // Return the corresponding protocol interface. >> + // >> + *Interface = Prot->Interface; >> + } else if (Status == EFI_UNSUPPORTED) { >> + // >> + // Return NULL Interface if Unsupported Protocol. >> + // >> + *Interface = 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 >