Hi Laszlo,

I believe that is exactly what you have done in VirtioNetDxe driver and I am 
following that exactly. I believe this dump from 'devtree' command proves that 
I have populated the child handle 0x7B. Your example of SNP from OVMF platform 
does show a couple of children with exact same MAC address not sure if that is 
making any difference in terms of MNF binding to it.

 Ctrl[33] PciRoot(0x2)
   Ctrl[78] PciRoot(0x2)/Pci(0x1,0x0)
   Ctrl[79] PciRoot(0x2)/Pci(0x2,0x0)
   Ctrl[7A] PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)
     Ctrl[7B] PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)

Shell> dh -v -d 7a
7A: 7F33A118
PCIIO
DevicePath
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)
   Controller Name    : PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)
   Device Path        : PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)
   Controller Type    : BUS
   Configuration      : NO
   Diagnostics        : NO
   Managed by         : 
     Drv[54]          : FvFile(AC7E2A1E-B975-4C79-8ADA-C9EEFC55A407)
   Parent Controllers : 
     Parent[33]       : PciRoot(0x2)
   Child Controllers  : 
     Child[7B]        : 
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)

Shell> dh -v -d 7b
7B: 7F338518
DevicePath
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)
SimpleNetwork
   Controller Name    : 
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)
   Device Path        : 
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)
   Controller Type    : DEVICE
   Configuration      : NO
   Diagnostics        : NO
   Managed by         : <None>
   Parent Controllers : 
     Parent[7A]       : PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)
   Child Controllers  : <None>
Shell> 

Shell> dh -v -d -p simplenetwork
7B: DevicePath PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1) 
SimpleNetwork 
   Controller Name    : 
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)
   Device Path        : 
PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)
   Controller Type    : DEVICE
   Configuration      : NO
   Diagnostics        : NO
   Managed by         : <None>
   Parent Controllers : 
     Parent[7A]       : PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)
   Child Controllers  : <None>
Shell> 


> Date: Thu, 7 Aug 2014 19:18:05 +0200
> From: ler...@redhat.com
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2]   UEFI Shell Command "ifconfig" Error‏
> 
> On 08/07/14 18:39, Chris Cuthbert wrote:
> > Hi Andrew, Laszlo,
> > 
> > The output from the 'devices' shell command is:
> > 
> > 7B D - -  1  0  0
> > PciRoot(0x2)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(121212121212,0x1)
> > 
> > And the output from 'disconnect' and 'reconnect' shell command is:
> > 
> > Shell> disconnect 7b
> > Disconnect - (7B,7A9E39E4,7A9E393C) Result Success.
> > Shell> reconnect 7b
> > Disconnect - (7B,7A9D3AA8,7AAA5BD0) Result Success.
> > MnpDriverBindingSupported:0x7F338518 YES
> > 
> > What this is showing me is that on 'reconnect', the MNP driver does find
> > a SNP protocol handle implemented by device handle 0x7B. Unfortunately
> > my system crashes at this point indicating that my driver is not
> > unloading/loading properly, I will have to work on that.
> > 
> > I am trying to avoid turning this email chain into a UEFI tutorial but I
> > did not quiet understand what you are trying to convey.
> > 
> > My driver is implementing UEFI driver model and at some point in time
> > "Supported" function is called with a PCIe device handle. Driver figures
> > out which device it supports and that causes the "Start" function to be
> > called with that handle. In "Start" function I initialize the PCIe
> > device and the driver data structures.
> > 
> > As part of "Start" function driver registers a protocol that it is
> > producing. Now, how does the UEFI "ConnectController" manage to connect
> > the MNP driver to my driver ?
> > The "ConnectController" is for connecting devices to drivers. How are
> > the service drivers connected to devices providing the services ?
> 
> See the recursion in CoreConnectController()
> [MdeModulePkg/Core/Dxe/Hand/DriverSupport.c].
> 
> Your driver consumes (tries to consume) the PciIo protocol on the
> handles that are passed to it. On suitable handles, your driver is
> expected to produce a child handle, and to install the
> SimpleNetworkProtocol on it.
> 
> - open handle's PciIo -- this is the parent handle
> 
> - grab handle's DevicePath
> 
> - create another device path with a MAC node appended
> 
> - create a pristine, new handle, with the fresh (longer) device path
>   installed on it. This is the child handle.
> 
> - On the child handle, install SNP
> 
> - communicate parent-child relationship to the protocol system by
>   opening the parent handle's PciIo instance with the child handle as
>   ControllerHandle, and EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER as
>   Attributes.
> 
> >From the specification of the OpenProtocol() boot service:
> 
> BY_CHILD_CONTROLLER  Used by bus drivers to show that a protocol
>                      interface is being used by one of the child
>                      controllers of a bus. This information is used by
>                      the boot service ConnectController() to
>                      recursively connect all child controllers and by
>                      the boot service DisconnectController() to get the
>                      list of child controllers that a bus driver
>                      created.
> 
> In turn, the MNP driver consumes SNP instances on the handles that are
> passed to it, and produces MNP instances. And so on.
> 
> Again, read through CoreConnectController() in
> [MdeModulePkg/Core/Dxe/Hand/DriverSupport.c]. It has good comments. Note
> the filtering for EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
> 
> Service binding protocols work a bit differently (the programmer
> requests creation of child nodes explicitly), but I have no experience
> with them, so I can only refer you to the spec. You can identify service
> binding protocols in the "dh" output because they usually have
> "ServiceBinding" in their names.
> 
> Laszlo
> 
> 
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls. 
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

                                          
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to