Thank you very much for pointing out that I should use the xxxServiceBinding
Protocols.
With only one NIC in the system it worked fine to go directly on  the MTFTP4
protocol or the ManagedNetworkService protocol and it wasn't really clear to
me what's the benefit in using the different ServiceBinding protocols.

Now I understand that I have to use the ServiceBinding protocols if I want
to represent different driver dependencies.
I'll change my code to the new model and try to solve my problem this way.
I'll report when I'm done.

Thank you very much.
Regards,
Michael

-----Ursprüngliche Nachricht-----
Von: Laszlo Ersek [mailto:[email protected]] 
Gesendet: Dienstag, 5. November 2013 15:04
An: Michael Lorer
Cc: [email protected]
Betreff: Re: AW: [edk2] UEFI Networkstack: Chosing the right protocol if two
network interfaces are available

On 11/05/13 13:59, Michael Lorer wrote:
> Hello Laszlo,
> 
> thank you for your input.
> I just tried what you have suggested. Now I use the handle I get from 
> the first LocateHandleBuffer-function where a cable is connected on 
> the OpenProtocol()-function.
> But that's not working. OpenProtocol() returns:
> EFI_UNSUPPORTED (Handle does not support Protocol).
> 
> Any ideas on that?

Shouldn't you try to open MTFTPv4ServiceBinding on the handle that the
initial search for ManagedNetworkServiceBinding returned (and the media
present check let through), instead of going for MTFTPv4 immediately?

See
- 26.3 EFI MTFTPv4 Protocol
- 10.6 EFI Service Binding Protocol
in the UEFI spec.

At least for virtio-net in OVMF, ManagedNetworkServiceBinding and
MTFTPv4ServiceBinding are both (automatically) installed:

(1) Shell> ifconfig -s eth0 dhcp

Create an IP and start to get the default address Please wait, your console
may stop responding for a while ...
      Default: 192.168.122.54

(2) Shell> dh -p ManagedNetworkServiceBinding -d -v

(this mirrors your initial search)

98: UnknownDevice LoadFile PXEBaseCode MTFTPv4ServiceBinding
                                       ^^^^^^^^^^^^^^^^^^^^^
DHCPv4ServiceBinding UDPv4ServiceBinding TCPv4ServiceBinding
IPv4ServiceBinding IPv4Config ARPServiceBinding UnknownDevice
ManagedNetworkServiceBinding EfiVlanConfigProtocolGuid DevicePath
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400938342,0x1) SimpleNetwork

   Controller Name    : Virtio Network Device
   Device Path        : PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400938342,0x1)
   Controller Type    : BUS
   Configuration      : NO
   Diagnostics        : NO
   Managed by         :
     Drv[66]          : MNP Network Service Driver
     Drv[67]          : VLAN Configuration Driver
     Drv[6A]          : IP4 CONFIG Network Service Driver
     Drv[6B]          : IP4 Network Service Driver
   Parent Controllers :
     Parent[83]       : Virtio Network Device
   Child Controllers  :
     Child[9A]        : MNP (MAC=52-54-00-93-83-42, ProtocolType=0x806,
VlanId=0)
     Child[9B]        : MNP (Not started)
     Child[9D]        : MNP (MAC=52-54-00-93-83-42, ProtocolType=0x800,
VlanId=0)
     Child[99]        :
PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400938342,0x1)/VenHw(D79DF6B0-EF44-43BD-979
7-43E93BCF5FA8)
     Child[9C]        :
PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400938342,0x1)/VenHw(D8944553-C4DD-41F4-9B3
0-E1397CFB267B)


I guess once you have such a handle, you'd call
EFI_MTFTP4_SERVICE_BINDING_PROTOCOL.CreateChild() on it (see the
implementation in Mtftp4ServiceBindingCreateChild(), file
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c), and then you could
use the output child handle (supporting MTFTPv4) for transfer.

Laszlo


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to