public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Nikolay Bodunov <for_internet_shops@mail.ru>, edk2-devel@lists.01.org
Subject: Re: Can't open PciIo protocol in both qemu (Nt32Pkg) and VirtualBox EFI
Date: Thu, 26 Oct 2017 12:33:26 +0200	[thread overview]
Message-ID: <0fd89d93-255f-0d17-1eb1-23888c85a249@redhat.com> (raw)
In-Reply-To: <1508970001.253907598@f184.i.mail.ru>

On 10/26/17 00:20, Nikolay Bodunov wrote:
> 
> Hello
> 
> I try to make work a code from "UEFI Driver Writer Guide", but always receive EFI_UNSUPPORTED status:
> 
> EFI_STATUS
> EFIAPI
> PciDriverOnlyDriverBindingSupported (
>   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
>   IN EFI_HANDLE                   ControllerHandle,
>   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL
>   )
> {
>     EFI_STATUS                       Status;
>     EFI_PCI_IO_PROTOCOL        *PciIo;
>     Status = gBS->OpenProtocol (
>         ControllerHandle,
>         &gEfiPciIoProtocolGuid,
>         (VOID **)&PciIo,
>         This->DriverBindingHandle,
>         ControllerHandle,
>         EFI_OPEN_PROTOCOL_BY_DRIVER 
>         );
>     DEBUG((EFI_D_INFO, "Status is %r \r\n", Status));
>     if (EFI_ERROR (Status)) {
>         return Status;
>     }
>     return EFI_SUCCESS;
> }
> 
> However, for example, with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL instead of  EFI_PCI_IO_PROTOCOL  OpenProtocol() works fine and returns EFI_SUCCESS.
> 
> Driver project was created with UEFI Driver Wizard. Inf file contains gEfiPciIoProtocolGuid.
> Where I could make a mistake?

There's no mistake, it just means that the ControllerHandle passed to
the function does not support the PciIo interface.

Please read "Driver Writer’s Guide for UEFI 2.3.1", sections:
- 6   UEFI Driver Categories
- 7.2 UEFI Driver Model
- 18  PCI Driver Design Guidelines

https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Driver-Writer%27s-Guide

Thanks
Laszlo


      reply	other threads:[~2017-10-26 10:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 22:20 Can't open PciIo protocol in both qemu (Nt32Pkg) and VirtualBox EFI Nikolay Bodunov
2017-10-26 10:33 ` Laszlo Ersek [this message]

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=0fd89d93-255f-0d17-1eb1-23888c85a249@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