From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in22.apple.com (mail-out22.apple.com [17.171.2.32]) (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 175BF21A08D89 for ; Thu, 1 Jun 2017 10:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1496338917; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gyzQcl9md+lXhKP5Ee9/1ajMnjiIAVxfFVDijQrC3do=; b=c/mJGrhwWnh5/K1mkdnBeDzQ33VVdziT3yYrF98LW0tkNn9ppH71jtJQXn5GskLH FhqPzsrKdNi73TbH8pcGup5CcJCAmlgsMPOUskKEmSLN6l4dKrqC7QBxc66AYHej 9clUYj/okPYwnKdbbzhoonbJj97hEQM2ZoRSnFzrgsQOSBjjeBMn8egV4Vyp3IL9 /cBMgbwNPjMbArFvASx5cAPDIF9Rs+48tCGtCN12b2EQoat/gDoPSUYoxI/+SUAs KHGRF+dL93rEWfi67b26pAkEajAFRTnuMDusNdsAhvfamZ2U+hDppvKDTYdvWVZq BlT+qVcrBLhfWGDU9LFJ1A==; Received: from relay8.apple.com (relay8.apple.com [17.128.113.102]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in22.apple.com (Apple Secure Mail Relay) with SMTP id E4.F7.02740.4E150395; Thu, 1 Jun 2017 10:41:56 -0700 (PDT) X-AuditID: 11ab0216-12b3a9a000000ab4-52-593051e465de Received: from nwk-mmpp-sz12.apple.com (nwk-mmpp-sz12.apple.com [17.128.115.204]) by relay8.apple.com (Apple SCV relay) with SMTP id 56.14.21490.4E150395; Thu, 1 Jun 2017 10:41:56 -0700 (PDT) MIME-version: 1.0 Received: from da0601a-dhcp124.apple.com (da0601a-dhcp124.apple.com [17.226.15.124]) by nwk-mmpp-sz12.apple.com (Oracle Communications Messaging Server 8.0.1.2.20170210 64bit (built Feb 10 2017)) with ESMTPSA id <0OQV00AQ8QHV3F50@nwk-mmpp-sz12.apple.com>; Thu, 01 Jun 2017 10:41:56 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish Message-id: <9201A7E9-15E6-4EFE-AE27-B07B67EEDAE5@apple.com> Date: Thu, 01 Jun 2017 10:41:55 -0700 In-reply-to: Cc: "edk2-devel@lists.01.org" To: Amit kumar References: <6B16DFE0-54D1-4CBF-AC56-F255013B6FA5@apple.com> <19ECB4A0-FFA8-440B-A1B6-79F07BB392F0@apple.com> <5A5C3E91-A28A-412F-83EC-FCB53DA8EAFA@apple.com> X-Mailer: Apple Mail (2.3273) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRmVeSWpSXmKPExsUi2FCYpvsk0CDSYM1xG4t9r3cyWew5dJTZ gcnjcc8ZNo/u2f9YApiiuGxSUnMyy1KL9O0SuDIurxEu+HqcsWLXs7IGxu/rGLsYOTkkBEwk 5p2YwdbFyMUhJLCWSeLDlcnsMIllv96yQiQOMUrM2vqEGSTBKyAo8WPyPRYQm1kgTKLrTjc7 XPfnOe/BxgoLiEu8O7MJrIFNQFlixfwPQEUcQM02Eq9/eEOU2Et8+vmOFcRmEVCVODzhCVgr p0C8xJPbfawQ880lZlz4wgRiiwDV9LdPgdr1gVni+61rrBCXykrcmn2JGSQhIbCHTeL/pfXM ExiFZiE5dhaSYyFsLYnvj1qB4hxAtrzEwfOyEGFNiWf3PkGVaEs8eXeBdQEj2ypG4dzEzBzd zDwjI73EgoKcVL3k/NxNjKB4WM0ktoPx3mvDQ4wCHIxKPLwzNA0ihVgTy4orcw8xSn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eDel 2.1.22 Subject: Re: Problem in EFI_BOOT_SERVICES.OpenProtocol() 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: Thu, 01 Jun 2017 17:40:56 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Jun 1, 2017, at 10:40 AM, Amit kumar wrote: > > Certainly i will do that. > Meanwhile can i submit the patch too ? Yes as long as you follow the process. Thanks, Andrew Fish > Amit > From: afish@apple.com > on behalf of Andrew Fish > > Sent: Thursday, June 1, 2017 11:08:59 PM > To: Amit kumar > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > > >> On Jun 1, 2017, at 10:37 AM, Amit kumar > wrote: >> >> Hello Andrew, >> >> Thanks for quick reply and acknowledging my query. >> > > Please file a bugzilla against the code. > > Thanks, > > Andrew Fish > >> Amit >> From: afish@apple.com > on behalf of Andrew Fish > >> Sent: Thursday, June 1, 2017 10:59:03 PM >> To: Amit kumar >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() >> >> >> > On Jun 1, 2017, at 10:13 AM, Amit kumar > wrote: >> > >> > Hello Andrew, >> > >> > As per UEFI Spec EFI_ALREADY_STARTED is treated as error code, thus PciIo (The Interface 3rd parameter ) should remain NULL. >> > But after OpenProtocol call even though Status = EFI_ALREADY_STARTED PciIo (The Interface 3rd parameter ) is getting modified and it not NULL anymore. >> > Is this not a problem ? >> > >> >> Amit, >> >> I agree it looks like the code will fill in the Interface and return EFI_ALREADY_STARTED. And that does seem to conflict with the section of the spec you quote. Good catch. >> >> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Hand/Handle.c#L1097 >> // >> // This is the protocol interface entry for this protocol >> // >> if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { >> *Interface = Prot->Interface; >> } >> Status = EFI_SUCCESS; >> >> ByDriver = FALSE; >> Exclusive = FALSE; >> for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) { >> OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); >> ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) && >> (OpenData->Attributes == Attributes) && >> (OpenData->ControllerHandle == ControllerHandle)); >> if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { >> ByDriver = TRUE; >> if (ExactMatch) { >> Status = EFI_ALREADY_STARTED; >> goto Done; >> } >> } >> if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) { >> Exclusive = TRUE; >> } else if (ExactMatch) { >> OpenData->OpenCount++; >> Status = EFI_SUCCESS; >> goto Done; >> } >> } >> >> Thanks, >> >> Andrew Fish >> >> > Status = gBS->OpenProtocol ( >> > Controller, >> > &gEfiPciIoProtocolGuid, >> > (VOID **) &PciIo, >> > This->DriverBindingHandle, >> > Controller, >> > EFI_OPEN_PROTOCOL_BY_DRIVER >> > ); >> > >> > ________________________________ >> > From: afish@apple.com > on behalf of Andrew Fish > >> > Sent: Thursday, June 1, 2017 10:28:16 PM >> > To: Amit kumar >> > Cc: edk2-devel@lists.01.org >> > Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() >> > >> > >> >> On Jun 1, 2017, at 9:46 AM, Amit kumar > wrote: >> >> >> >> Hi, >> >> I am trying to open PciIoProtocol and facing some issue. >> >> >> >> below is the code >> >> >> >> EFI_PCI_IO_PROTOCOL *PciIo=NULL; >> >> EFI_STATUS Status; >> >> >> >> Status = gBS->OpenProtocol ( >> >> Controller, >> >> &gEfiPciIoProtocolGuid, >> >> (VOID **) &PciIo, >> >> This->DriverBindingHandle, >> >> Controller, >> >> EFI_OPEN_PROTOCOL_BY_DRIVER >> >> ); >> >> >> >> it returns Status = EFI_ALREADY_STARTED, but PciIo is not NULL. >> >> Is it not supposed to return PciIo as NULL ? >> >> As per UEFI 2.6 Spec Section 6.3 page 182. >> >> >> > >> > Amit, >> > >> > Look at the Status Codes Returned section at the end of that section. >> > >> > Attributes is BY_DRIVER and there is an item on the open list with an attribute of BY_DRIVER whose agent handle is the same as AgentHandle. >> > >> > Attributes is BY_DRIVER|EXCLUSIVE and there is an item on the open list with an attribute of BY_DRIVER|EXCLUSIVE whose agent handle is the same as AgentHandle. >> > >> > Thanks, >> > >> > Andrew Fish >> > >> >> There are a number of reasons that this function call can return an error. If an error is returned, then >> >> AgentHandle, ControllerHandle, and Attributes are not added to the list of agents >> >> consuming the protocol interface specified by Handle and Protocol, and Interface is >> >> returned unmodified. >> >> >> >> Thanks And Regards >> >> Amit >> >> _______________________________________________ >> >> edk2-devel mailing list >> >> edk2-devel@lists.01.org >> >> https://lists.01.org/mailman/listinfo/edk2-devel >> > >> > _______________________________________________ >> > edk2-devel mailing list >> > edk2-devel@lists.01.org >> > https://lists.01.org/mailman/listinfo/edk2-devel