]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Driver.c
index ceeee0545e6876fe0c2e0f33d4c08fe0de0286be..1c74b5b08344cf9014df2ce341f51991f1f2b9da 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation of Mtftp drivers.\r
-  \r
-Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
+\r
+Copyright (c) 2006 - 2010, 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
 http://opensource.org/licenses/bsd-license.php<BR>\r
@@ -35,7 +35,7 @@ EFI_SERVICE_BINDING_PROTOCOL  gMtftp4ServiceBindingTemplete = {
   @param ImageHandle    The MTFTP's image handle.\r
   @param SystemTable    The system table.\r
 \r
-  @retval EFI_SUCCESS  The handles are successfully installed on the image. \r
+  @retval EFI_SUCCESS  The handles are successfully installed on the image.\r
   @retval others       some EFI_ERROR occured.\r
 \r
 **/\r
@@ -66,7 +66,16 @@ Mtftp4DriverEntryPoint (
 \r
   @retval EFI_SUCCESS            The controller has UDP service binding protocol\r
                                  installed, MTFTP can support it.\r
-  @retval Others                 MTFTP can't support the controller.\r
+  @retval EFI_ALREADY_STARTED    The device specified by ControllerHandle and\r
+                                 RemainingDevicePath is already being managed by\r
+                                 the driver specified by This.\r
+  @retval EFI_ACCESS_DENIED      The device specified by ControllerHandle and\r
+                                 RemainingDevicePath is already being managed by a\r
+                                 different driver or an application that requires\r
+                                 exclusive access.\r
+  @retval EFI_UNSUPPORTED        The device specified by ControllerHandle and\r
+                                 RemainingDevicePath is not supported by the driver\r
+                                 specified by This.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -93,20 +102,21 @@ Mtftp4DriverBindingSupported (
 \r
 \r
 /**\r
-  Config a NULL UDP that is used to keep the connection between UDP and MTFTP. \r
-  \r
-  Just leave the Udp child unconfigured. When UDP is unloaded, \r
+  Config a NULL UDP that is used to keep the connection between UDP and MTFTP.\r
+\r
+  Just leave the Udp child unconfigured. When UDP is unloaded,\r
     MTFTP will be informed with DriverBinding Stop.\r
 \r
-  @param  UdpIo                  The UDP port to configure\r
+  @param  UdpIo                  The UDP_IO to configure\r
   @param  Context                The opaque parameter to the callback\r
 \r
   @retval EFI_SUCCESS            It always return EFI_SUCCESS directly.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 Mtftp4ConfigNullUdp (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -171,7 +181,7 @@ Mtftp4CreateService (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (MtftpSb);\r
+    FreePool (MtftpSb);\r
     return Status;\r
   }\r
 \r
@@ -188,16 +198,22 @@ Mtftp4CreateService (
                   );\r
   if (EFI_ERROR (Status)) {\r
     gBS->CloseEvent (MtftpSb->Timer);\r
-    gBS->FreePool (MtftpSb);\r
+    FreePool (MtftpSb);\r
     return Status;\r
   }\r
 \r
-  MtftpSb->ConnectUdp = UdpIoCreatePort (Controller, Image, Mtftp4ConfigNullUdp, NULL);\r
+  MtftpSb->ConnectUdp = UdpIoCreateIo (\r
+                          Controller,\r
+                          Image,\r
+                          Mtftp4ConfigNullUdp,\r
+                          UDP_IO_UDP4_VERSION,\r
+                          NULL\r
+                          );\r
 \r
   if (MtftpSb->ConnectUdp == NULL) {\r
     gBS->CloseEvent (MtftpSb->TimerToGetMap);\r
     gBS->CloseEvent (MtftpSb->Timer);\r
-    gBS->FreePool (MtftpSb);\r
+    FreePool (MtftpSb);\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
@@ -217,15 +233,15 @@ Mtftp4CleanService (
   IN MTFTP4_SERVICE     *MtftpSb\r
   )\r
 {\r
-  UdpIoFreePort (MtftpSb->ConnectUdp);\r
+  UdpIoFreeIo (MtftpSb->ConnectUdp);\r
   gBS->CloseEvent (MtftpSb->TimerToGetMap);\r
   gBS->CloseEvent (MtftpSb->Timer);\r
 }\r
 \r
 \r
 /**\r
-  Start the MTFTP driver on this controller. \r
-  \r
+  Start the MTFTP driver on this controller.\r
+\r
   MTFTP driver will install a MTFTP SERVICE BINDING protocol on the supported\r
   controller, which can be used to create/destroy MTFTP children.\r
 \r
@@ -271,6 +287,7 @@ Mtftp4DriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+  ASSERT (MtftpSb != NULL);\r
 \r
   Status = gBS->SetTimer (MtftpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);\r
 \r
@@ -296,7 +313,7 @@ Mtftp4DriverBindingStart (
 \r
 ON_ERROR:\r
   Mtftp4CleanService (MtftpSb);\r
-  gBS->FreePool (MtftpSb);\r
+  FreePool (MtftpSb);\r
 \r
   return Status;\r
 }\r
@@ -375,7 +392,7 @@ Mtftp4DriverBindingStop (
 \r
     Mtftp4CleanService (MtftpSb);\r
 \r
-    gBS->FreePool (MtftpSb);\r
+    FreePool (MtftpSb);\r
   } else {\r
 \r
     while (!IsListEmpty (&MtftpSb->Children)) {\r
@@ -458,15 +475,16 @@ Mtftp4ServiceBindingCreateChild (
 \r
   Mtftp4InitProtocol (MtftpSb, Instance);\r
 \r
-  Instance->UnicastPort = UdpIoCreatePort (\r
+  Instance->UnicastPort = UdpIoCreateIo (\r
                             MtftpSb->Controller,\r
                             MtftpSb->Image,\r
                             Mtftp4ConfigNullUdp,\r
+                            UDP_IO_UDP4_VERSION,\r
                             Instance\r
                             );\r
 \r
   if (Instance->UnicastPort == NULL) {\r
-    gBS->FreePool (Instance);\r
+    FreePool (Instance);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -521,8 +539,8 @@ Mtftp4ServiceBindingCreateChild (
 ON_ERROR:\r
 \r
   if (EFI_ERROR (Status)) {\r
-    UdpIoFreePort (Instance->UnicastPort);\r
-    gBS->FreePool (Instance);\r
+    UdpIoFreeIo (Instance->UnicastPort);\r
+    FreePool (Instance);\r
   }\r
 \r
   return Status;\r
@@ -614,13 +632,13 @@ Mtftp4ServiceBindingDestroyChild (
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   Mtftp4CleanOperation (Instance, EFI_DEVICE_ERROR);\r
-  UdpIoFreePort (Instance->UnicastPort);\r
+  UdpIoFreeIo (Instance->UnicastPort);\r
 \r
   RemoveEntryList (&Instance->Link);\r
   MtftpSb->ChildrenNum--;\r
 \r
   gBS->RestoreTPL (OldTpl);\r
 \r
-  gBS->FreePool (Instance);\r
+  FreePool (Instance);\r
   return EFI_SUCCESS;\r
 }\r