]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
MdeModulePkg: Removing ipf which is no longer supported from edk2.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Driver.c
index 8da47fc8df02b39e24c0102cd0f10046a4172eda..e6f101d5e9a0e6da3ef3b4700633b58a217598bd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of Mtftp drivers.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -162,11 +162,12 @@ Mtftp4CreateService (
   MtftpSb->ChildrenNum    = 0;\r
   InitializeListHead (&MtftpSb->Children);\r
 \r
-  MtftpSb->Timer          = NULL;\r
-  MtftpSb->TimerToGetMap  = NULL;\r
-  MtftpSb->Controller     = Controller;\r
-  MtftpSb->Image          = Image;\r
-  MtftpSb->ConnectUdp     = NULL;\r
+  MtftpSb->Timer            = NULL;\r
+  MtftpSb->TimerNotifyLevel = NULL;\r
+  MtftpSb->TimerToGetMap    = NULL;\r
+  MtftpSb->Controller       = Controller;\r
+  MtftpSb->Image            = Image;\r
+  MtftpSb->ConnectUdp       = NULL;\r
 \r
   //\r
   // Create the timer and a udp to be notified when UDP is uninstalled\r
@@ -178,8 +179,20 @@ Mtftp4CreateService (
                   MtftpSb,\r
                   &MtftpSb->Timer\r
                   );\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (MtftpSb);\r
+    return Status;\r
+  }\r
 \r
+  Status = gBS->CreateEvent (\r
+                  EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
+                  TPL_NOTIFY,\r
+                  Mtftp4OnTimerTickNotifyLevel,\r
+                  MtftpSb,\r
+                  &MtftpSb->TimerNotifyLevel\r
+                  );\r
   if (EFI_ERROR (Status)) {\r
+    gBS->CloseEvent (MtftpSb->Timer);\r
     FreePool (MtftpSb);\r
     return Status;\r
   }\r
@@ -196,6 +209,7 @@ Mtftp4CreateService (
                   &MtftpSb->TimerToGetMap\r
                   );\r
   if (EFI_ERROR (Status)) {\r
+    gBS->CloseEvent (MtftpSb->TimerNotifyLevel);\r
     gBS->CloseEvent (MtftpSb->Timer);\r
     FreePool (MtftpSb);\r
     return Status;\r
@@ -211,6 +225,7 @@ Mtftp4CreateService (
 \r
   if (MtftpSb->ConnectUdp == NULL) {\r
     gBS->CloseEvent (MtftpSb->TimerToGetMap);\r
+    gBS->CloseEvent (MtftpSb->TimerNotifyLevel);\r
     gBS->CloseEvent (MtftpSb->Timer);\r
     FreePool (MtftpSb);\r
     return EFI_DEVICE_ERROR;\r
@@ -234,6 +249,7 @@ Mtftp4CleanService (
 {\r
   UdpIoFreeIo (MtftpSb->ConnectUdp);\r
   gBS->CloseEvent (MtftpSb->TimerToGetMap);\r
+  gBS->CloseEvent (MtftpSb->TimerNotifyLevel);\r
   gBS->CloseEvent (MtftpSb->Timer);\r
 }\r
 \r
@@ -294,6 +310,12 @@ Mtftp4DriverBindingStart (
     goto ON_ERROR;\r
   }\r
 \r
+  Status = gBS->SetTimer (MtftpSb->TimerNotifyLevel, TimerPeriodic, TICKS_PER_SECOND);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
+\r
   //\r
   // Install the Mtftp4ServiceBinding Protocol onto Controller\r
   //\r
@@ -319,7 +341,7 @@ ON_ERROR:
 \r
 /**\r
   Callback function which provided by user to remove one node in NetDestroyLinkList process.\r
-  \r
+\r
   @param[in]    Entry           The entry to be removed.\r
   @param[in]    Context         Pointer to the callback context corresponds to the Context in NetDestroyLinkList.\r
 \r
@@ -328,10 +350,11 @@ ON_ERROR:
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 Mtftp4DestroyChildEntryInHandleBuffer (\r
   IN LIST_ENTRY         *Entry,\r
   IN VOID               *Context\r
-)\r
+  )\r
 {\r
   MTFTP4_PROTOCOL               *Instance;\r
   EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;\r
@@ -690,7 +713,7 @@ Mtftp4ServiceBindingDestroyChild (
            &gEfiUdp4ProtocolGuid,\r
            gMtftp4DriverBinding.DriverBindingHandle,\r
            ChildHandle\r
-           );  \r
+           );\r
   }\r
 \r
   //\r