* Can't open PciIo protocol in both qemu (Nt32Pkg) and VirtualBox EFI
@ 2017-10-25 22:20 Nikolay Bodunov
2017-10-26 10:33 ` Laszlo Ersek
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Bodunov @ 2017-10-25 22:20 UTC (permalink / raw)
To: edk2-devel
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?
WBR,
John
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Can't open PciIo protocol in both qemu (Nt32Pkg) and VirtualBox EFI
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
0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2017-10-26 10:33 UTC (permalink / raw)
To: Nikolay Bodunov, edk2-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-26 10:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox