public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Amit kumar <akamit91@hotmail.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>
Subject: Re: [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Date: Wed, 28 Jun 2017 20:15:05 +0200	[thread overview]
Message-ID: <bdd86e4e-169a-e0bf-0ecf-43a9eb16c0c3@redhat.com> (raw)
In-Reply-To: <DM5PR11MB15787CAD71FF0A26629AF4CFDCDD0@DM5PR11MB1578.namprd11.prod.outlook.com>

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 <edk2-devel-bounces@lists.01.org> on behalf of Laszlo Ersek <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 returned 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 = 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 <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 != 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
> 



  reply	other threads:[~2017-06-28 18:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 13:22 [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol Star Zeng
     [not found] ` <CGME20170628132257epcas2p179c316d36aced662ceb27feef4d4d48a@epcms5p7>
2017-06-28 13:43   ` Amit Kumar
2017-06-28 14:04 ` Gabriel L. Somlo
2017-06-28 14:13 ` Laszlo Ersek
2017-06-28 18:08   ` Amit kumar
2017-06-28 18:15     ` Laszlo Ersek [this message]
2017-09-19  7:13   ` Zeng, Star
2017-09-22  2:07     ` Zeng, Star
2017-06-28 18:10 ` Amit kumar
2017-06-28 18:15   ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bdd86e4e-169a-e0bf-0ecf-43a9eb16c0c3@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox