]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpDriver.c
CryptoPkg/BaseCryptLib: Add missing OpenSSL includes
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpDriver.c
index 43f42e29bf0c975b7dffdddabfb85e3ce6ce5a5b..bd1d04e78cc430acbba194d78f2e5eb9e9b8a5a3 100644 (file)
@@ -15,6 +15,8 @@
 \r
 #include "HttpDriver.h"\r
 \r
+EFI_HTTP_UTILITIES_PROTOCOL *mHttpUtilities = NULL;\r
+\r
 ///\r
 /// Driver Binding Protocol instance\r
 ///\r
@@ -100,6 +102,35 @@ HttpCleanService (
   }\r
 }\r
 \r
+/**\r
+  The event process routine when the http utilities protocol is installed\r
+  in the system.\r
+\r
+  @param[in]     Event         Not used.\r
+  @param[in]     Context       The pointer to the IP4 config2 instance data.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+HttpUtilitiesInstalledCallback (\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
+  )\r
+{\r
+  gBS->LocateProtocol (\r
+         &gEfiHttpUtilitiesProtocolGuid, \r
+         NULL, \r
+         (VOID **) &mHttpUtilities\r
+         );\r
+                \r
+  //\r
+  // Close the event if Http utilities protocol is loacted.\r
+  //\r
+  if (mHttpUtilities != NULL && Event != NULL) {\r
+     gBS->CloseEvent (Event);\r
+  }\r
+}\r
+\r
 /**\r
   This is the declaration of an EFI image entry point. This entry point is\r
   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
@@ -118,7 +149,28 @@ HttpDxeDriverEntryPoint (
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
-{\r
+{ \r
+  VOID           *Registration;\r
+\r
+  gBS->LocateProtocol (\r
+         &gEfiHttpUtilitiesProtocolGuid, \r
+         NULL, \r
+         (VOID **) &mHttpUtilities\r
+         );\r
+\r
+  if (mHttpUtilities == NULL) {\r
+    //\r
+    // No Http utilities protocol, register a notify.\r
+    //\r
+    EfiCreateProtocolNotifyEvent (\r
+      &gEfiHttpUtilitiesProtocolGuid,\r
+      TPL_CALLBACK,\r
+      HttpUtilitiesInstalledCallback,\r
+      NULL,\r
+      &Registration\r
+      );\r
+  }\r
+\r
   //\r
   // Install UEFI Driver Model protocol(s).\r
   //\r