On 05/03/16 08:54, Shaveta Leekha wrote:
> Hi,
>
> I have a scenario where two separate drivers are installing/producing "PCI
> IO" protocol with same GUID (gEfiPciIoProtocolGuid).
>
> Where:
>
> (1) One of the PCI Io protocol instance is produced by
> "MdeModulePkg/Bus/Pci/PciBus" driver for real PCI devices to use( like
> E1000/NIC card to use)
>
> (2) Other PCI Io protocol instance is produced by "Pci Emulation" layer
> created for USB and SATA kind of controllers. This protocol (APIs) is
> intended to be used by USB and SATA controller drivers.
>
> Now when I use "OpenProtocol" in my "Platform specific Sata controller
> driver" using:
>
> Status = gBS->OpenProtocol (
> Controller,
> &gEfiPciIoProtocolGuid,
> (VOID **) &PciIo,
> This->DriverBindingHandle,
> Controller,
> EFI_OPEN_PROTOCOL_GET_PROTOCOL
> );
>
> How can I make sure that PCI Io protocol that is produced by "PciEmulation"
> layer driver is getting opened?
>
> As "gEfiPciIoProtocolGuid" is same for both protocol instances.
>
> How to handle such scenarios?
The UEFI spec forbids installing more than one protocol interface with
the same GUID on the same handle. See
EFI_BOOT_SERVICES.InstallProtocolInterface():
[... The same GUID cannot be installed more than once onto the same
handle. If installation of a duplicate GUID on a handle is attempted,
an EFI_INVALID_PARAMETER will result. [...]
EFI_INVALID_PARAMETER Protocol is already installed on the handle
specified by Handle.
If you have two separate UEFI drivers that install PciIo interfaces on
handles, then their EFI_DRIVER_BINDING_PROTOCOL.Supported() methods may
report success only on distinct sets of handles. There must be no overlap.
But, in any case, I think it's very unusual to have two drivers that
produce PciIo interfaces. According to the "Driver Writer’s Guide
for UEFI 2.3.1" (03/08/2012, Version 1.01), section "18.2
PCI Bus Drivers":
TIP: PCI Bus Driver customizations are *strongly discouraged*
because the PCI Bus Driver is designed to be conformant with
the /PCI Specification/. Instead, focus platform specific
customizations on the Root Bridge Driver that produced
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL and its PCI Device Drivers.
Laszlo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel