public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Amit kumar <akamit91@hotmail.com>
To: Andrew Fish <afish@apple.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: Problem in EFI_BOOT_SERVICES.OpenProtocol()
Date: Thu, 1 Jun 2017 17:13:16 +0000	[thread overview]
Message-ID: <MWHPR11MB18226E9AAC5F5413F2FA435BDCF60@MWHPR11MB1822.namprd11.prod.outlook.com> (raw)
In-Reply-To: <6B16DFE0-54D1-4CBF-AC56-F255013B6FA5@apple.com>

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 ?

Status = gBS->OpenProtocol (
                  Controller,
                  &gEfiPciIoProtocolGuid,
                  (VOID **) &PciIo,
                  This->DriverBindingHandle,
                  Controller,
                  EFI_OPEN_PROTOCOL_BY_DRIVER
                  );

________________________________
From: afish@apple.com <afish@apple.com> on behalf of Andrew Fish <afish@apple.com>
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 <akamit91@hotmail.com> 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



  reply	other threads:[~2017-06-01 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 16:46 Problem in EFI_BOOT_SERVICES.OpenProtocol() Amit kumar
2017-06-01 16:58 ` Andrew Fish
2017-06-01 17:13   ` Amit kumar [this message]
2017-06-01 17:29     ` Andrew Fish
2017-06-01 17:37       ` Amit kumar
2017-06-01 17:38         ` Andrew Fish
2017-06-01 17:40           ` Amit kumar
2017-06-01 17:41             ` Andrew Fish

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=MWHPR11MB18226E9AAC5F5413F2FA435BDCF60@MWHPR11MB1822.namprd11.prod.outlook.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