If we have a driver that installs a protocol in EDK2/UEFI and then that driver is unloaded, does the protocol continue to exist and be usable by other drivers and services? Same question for UEFI applications. I am mostly wondering if the UEFI framework somehow ties the protocols to the drivers that installed them and if the driver is unloaded does the protocol remain usable by other drivers after the image is unloaded or does the protocol also exit memory when the driver is unloaded.
I think code could certainly be made to make this be the case that when the driver exits it uninstalls the protocol it made, however does this occur by default within UEFI/EDK2? Or would this only occur if the driver explicitly stated to uninstall the protocol when it is unloaded?
Additionally, what is best practice for industry here? Should protocols generally continue to live on past the drivers that installed them or should the two be linked?
Sorry if this question is high level. I am trying to gain some high-level intuition for this topic.