On 02/13/19 05:28, Rebecca Cran wrote:
> On February 6, 2019 at 4:08:03 PM, Rebecca Cran via edk2-devel
> (edk2-devel@lists.01.org <mailto:edk2-devel@lists.01.org>) wrote:
>> Oh, that makes sense! Thanks, after disabling the existing code that was 
>> opening SNP exclusively, things started working much better. 
> I have a follow-up question. After opening the EFI_SIMPLE_NETWORK
> protocol exclusively, should code be able to later call
> gBS->CloseProtocol on the handle and subsequently start using TCP/HTTP? 
> From what I’ve seen, closing the protocol (I’m also calling
> net->Shutdown(), and the CloseProtocol succeeds) has no effect and the
> TCP and HTTP protocols still can’t be found/used.

Sure, that's expected.

Just because an agent releases a reference to a protocol interface, no
other agent is expected to automatically bind the interface. In order to
get back from SNP to the HTTP SB, you have to re-connect the related
drivers (recursively).

"Recursive" has dual meaning here. First, it means that, given a
specific handle, and a protocol interface on that handle, another driver
-- a device driver -- can consume the protocol interace, and install
another protocol interface on the *same* handle.

The other meaning of "recursive" is that a *bus* driver may produce a
number of direct child handles (with appropriate device paths on them)
for the original handle, and install the suitable protocol interface(s)
on those child handles. In turn another driver will bind the protocol
interfaces on the child handles.

Thus "recursion" may occur on two axes -- one axis is the protocol stack
on a given, single, handle; the other axis is the hierarchy of child
handles (reflected by device paths). In the ConnectController() boot
service, the first axis is covered automatically (it is not optional).
The second axis is controlled by the "Recursive" parameter.

In your case, I think it should suffice to call ConnectController() with
Recursive=FALSE, on the controller that already has SNP. The
HttpServiceBinding, Tcp6ServiceBinding and TCPv4ServiceBinding protocols
seem to be installed on the same handle. (The device path on this handle
ends with the MAC() node.)

Once the HttpServiceBinding protocol instance exists, UEFI 2.7 "
Usage Examples" provides a code example for a HTTP file download,
including IPv4 address configuration with DHCP.

edk2-devel mailing list

Reply via email to