]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Driver.c
index 4d78b87ad1187ffa24591d0572fd9060d9f17f11..360193ea4be8db37985eefcfa0f62a9607a3e9ae 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\r
 All rights reserved. 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
@@ -36,30 +36,22 @@ EFI_SERVICE_BINDING_PROTOCOL mDhcp4ServiceBindingTemplete = {
   Dhcp4ServiceBindingDestroyChild\r
 };\r
 \r
+/**\r
+  Entry point of the DHCP driver to install various protocols.\r
+\r
+  @param  ImageHandle            The image handle of the driver.\r
+  @param  SystemTable            The system table.\r
+\r
+  @retval EFI_SUCCES             if the driver binding and component name protocols are successfully\r
+  @retval Others                 Failed to install the protocols.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverEntryPoint (\r
   IN EFI_HANDLE             ImageHandle,\r
   IN EFI_SYSTEM_TABLE       *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Entry point of the DHCP driver to install various protocols.\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The driver's image handle\r
-  SystemTable - The system table\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - All the related protocols are installed.\r
-  Others      - Failed to install the protocols.\r
-\r
---*/\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
@@ -141,9 +133,9 @@ DhcpConfigUdpIo (
   UdpConfigData.StationPort               = DHCP_CLIENT_PORT;\r
   UdpConfigData.RemotePort                = DHCP_SERVER_PORT;\r
 \r
-  NetZeroMem (&UdpConfigData.StationAddress, sizeof (EFI_IPv4_ADDRESS));\r
-  NetZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));\r
-  NetZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));\r
+  ZeroMem (&UdpConfigData.StationAddress, sizeof (EFI_IPv4_ADDRESS));\r
+  ZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));\r
+  ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));\r
 \r
   return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);;\r
 }\r
@@ -208,7 +200,7 @@ Dhcp4CreateService (
   EFI_STATUS                Status;\r
 \r
   *Service  = NULL;\r
-  DhcpSb    = NetAllocateZeroPool (sizeof (DHCP_SERVICE));\r
+  DhcpSb    = AllocateZeroPool (sizeof (DHCP_SERVICE));\r
 \r
   if (DhcpSb == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -220,7 +212,7 @@ Dhcp4CreateService (
   DhcpSb->InDestory       = FALSE;\r
   DhcpSb->Controller      = Controller;\r
   DhcpSb->Image           = ImageHandle;\r
-  NetListInit (&DhcpSb->Children);\r
+  InitializeListHead (&DhcpSb->Children);\r
   DhcpSb->DhcpState       = Dhcp4Stopped;\r
   DhcpSb->Xid             = NET_RANDOM (NetRandomInitSeed ());\r
 \r
@@ -229,7 +221,7 @@ Dhcp4CreateService (
   //\r
   Status = gBS->CreateEvent (\r
                   EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
-                  NET_TPL_TIMER,\r
+                  TPL_CALLBACK,\r
                   DhcpOnTimerTick,\r
                   DhcpSb,\r
                   &DhcpSb->Timer\r
@@ -255,7 +247,7 @@ Dhcp4CreateService (
 \r
 ON_ERROR:\r
   Dhcp4CloseService (DhcpSb);\r
-  NetFreePool (DhcpSb);\r
+  gBS->FreePool (DhcpSb);\r
 \r
   return Status;\r
 }\r
@@ -331,7 +323,7 @@ Dhcp4DriverBindingStart (
 \r
 ON_ERROR:\r
   Dhcp4CloseService (DhcpSb);\r
-  NetFreePool (DhcpSb);\r
+  gBS->FreePool (DhcpSb);\r
   return Status;\r
 }\r
 \r
@@ -394,7 +386,7 @@ Dhcp4DriverBindingStop (
     return EFI_SUCCESS;\r
   }\r
 \r
-  OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   if (NumberOfChildren == 0) {\r
 \r
@@ -409,13 +401,13 @@ Dhcp4DriverBindingStop (
 \r
     Dhcp4CloseService (DhcpSb);\r
 \r
-    NetFreePool (DhcpSb);\r
+    gBS->FreePool (DhcpSb);\r
   } else {\r
     //\r
     // Don't use NET_LIST_FOR_EACH_SAFE here, Dhcp4ServiceBindingDestoryChild\r
     // may cause other child to be deleted.\r
     //\r
-    while (!NetListIsEmpty (&DhcpSb->Children)) {\r
+    while (!IsListEmpty (&DhcpSb->Children)) {\r
       Instance = NET_LIST_HEAD (&DhcpSb->Children, DHCP_PROTOCOL, Link);\r
       ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);\r
     }\r
@@ -425,14 +417,14 @@ Dhcp4DriverBindingStop (
     }\r
   }\r
 \r
-  NET_RESTORE_TPL (OldTpl);\r
+  gBS->RestoreTPL (OldTpl);\r
 \r
   return Status;\r
 }\r
 \r
 \r
 /**\r
-  Initialize a new DHCP child\r
+  Initialize a new DHCP child.\r
 \r
   @param  DhcpSb                 The dhcp service instance\r
   @param  Instance               The dhcp instance to initialize\r
@@ -448,7 +440,7 @@ DhcpInitProtocol (
 {\r
   Instance->Signature         = DHCP_PROTOCOL_SIGNATURE;\r
   CopyMem (&Instance->Dhcp4Protocol, &mDhcp4ProtocolTemplate, sizeof (Instance->Dhcp4Protocol));\r
-  NetListInit (&Instance->Link);\r
+  InitializeListHead (&Instance->Link);\r
   Instance->Handle            = NULL;\r
   Instance->Service           = DhcpSb;\r
   Instance->InDestory         = FALSE;\r
@@ -492,7 +484,7 @@ Dhcp4ServiceBindingCreateChild (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Instance = NetAllocatePool (sizeof (*Instance));\r
+  Instance = AllocatePool (sizeof (*Instance));\r
 \r
   if (Instance == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -512,7 +504,7 @@ Dhcp4ServiceBindingCreateChild (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    NetFreePool (Instance);\r
+    gBS->FreePool (Instance);\r
     return Status;\r
   }\r
 \r
@@ -537,16 +529,16 @@ Dhcp4ServiceBindingCreateChild (
            NULL\r
            );\r
 \r
-    NetFreePool (Instance);\r
+    gBS->FreePool (Instance);\r
     return Status;\r
   }\r
 \r
-  OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  NetListInsertTail (&DhcpSb->Children, &Instance->Link);\r
+  InsertTailList (&DhcpSb->Children, &Instance->Link);\r
   DhcpSb->NumChildren++;\r
 \r
-  NET_RESTORE_TPL (OldTpl);\r
+  gBS->RestoreTPL (OldTpl);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -617,7 +609,7 @@ Dhcp4ServiceBindingDestroyChild (
     return EFI_SUCCESS;\r
   }\r
 \r
-  OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
   Instance->InDestory = TRUE;\r
 \r
   //\r
@@ -642,7 +634,7 @@ Dhcp4ServiceBindingDestroyChild (
   if (EFI_ERROR (Status)) {\r
     Instance->InDestory = FALSE;\r
 \r
-    NET_RESTORE_TPL (OldTpl);\r
+    gBS->RestoreTPL (OldTpl);\r
     return Status;\r
   }\r
 \r
@@ -650,11 +642,11 @@ Dhcp4ServiceBindingDestroyChild (
     DhcpYieldControl (DhcpSb);\r
   }\r
 \r
-  NetListRemoveEntry (&Instance->Link);\r
+  RemoveEntryList (&Instance->Link);\r
   DhcpSb->NumChildren--;\r
 \r
-  NET_RESTORE_TPL (OldTpl);\r
+  gBS->RestoreTPL (OldTpl);\r
 \r
-  NetFreePool (Instance);\r
+  gBS->FreePool (Instance);\r
   return EFI_SUCCESS;\r
 }\r