public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: Arka Sharma <arka.sw1988@gmail.com>
Cc: edk2-devel@lists.01.org
Subject: Re: Closing PciIo protocol inside Stop()
Date: Thu, 15 Dec 2016 10:08:05 -0800	[thread overview]
Message-ID: <744508F7-BA9E-4DEA-B065-010B01515EEC@apple.com> (raw)
In-Reply-To: <CAPO=kN1-6-E2sPTOtzW906yo3=AN4khEWzmT6E0qePPp568FkA@mail.gmail.com>


> On Dec 15, 2016, at 3:15 AM, Arka Sharma <arka.sw1988@gmail.com> wrote:
> 
> I am wondering if the PciIo protocol instance for a PCI driver, is
> opened with _BY_DRIVER | EXCLUSIVE in Start() function, is not closed
> in the Stop() will the instance be uninstalled and the
> ControllerHandle removed ?
> 

Don't do that. The Start() and Stop() need to be symmetric. If you don't Stop() properly I think your Stop() function could get called again, and that would be really bad if you your driver was unloaded or something like that. 


> Also is it possible to Close() the PciIo in Stop() and reopen the
> PciIo instance on the same controller handle from some other driver
> image with _BY_DRIVER attribute and accessing Pci resources on the
> ControllerHandle even after Stop() is called. I know it is not
> recommended way but curious about it. Or it could be specific to the
> implementation ?

Maybe you should just ask what you want to do?

If you just want to dump out PCI info you can use gEfiPciRootBridgeIoProtocolGuid ByProtocol. There is an example in the Shell PCI command: https://github.com/tianocore/edk2/blob/master/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c#L2537 <https://github.com/tianocore/edk2/blob/master/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c#L2537>

Note: On a large server, or exotic SoC there could be multiple gEfiPciRootBridgeIoProtocolGuid instances, and the Shell command deals with that. 

Thanks,

Andrew Fish

> 
> Thanks & Regards,
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2016-12-15 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15 11:15 Closing PciIo protocol inside Stop() Arka Sharma
2016-12-15 18:08 ` Andrew Fish [this message]
2016-12-16  9:22   ` Arka Sharma
2016-12-16 18:57     ` 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=744508F7-BA9E-4DEA-B065-010B01515EEC@apple.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