]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
Patch to remove STATIC modifier. This is on longer recommended by EFI Framework codin...
[mirror_edk2.git] / MdeModulePkg / Library / DxeNetLib / DxeNetLib.c
index 0eee6076f71ea52028a42167ccef3e5865201c13..58e3541a2db3c4cc5acb41ee6367be4aa1adb02f 100644 (file)
@@ -25,6 +25,8 @@ Abstract:
 #include <Protocol/SimpleNetwork.h>\r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/NicIp4Config.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/ComponentName2.h>\r
 \r
 #include <Library/NetLib.h>\r
 #include <Library/BaseLib.h>\r
@@ -36,10 +38,12 @@ Abstract:
 #include <Library/MemoryAllocationLib.h>\r
 \r
 \r
+EFI_DPC_PROTOCOL *mDpc = NULL;\r
+\r
 //\r
 // All the supported IP4 maskes in host byte order.\r
 //\r
-IP4_ADDR  mIp4AllMasks[IP4_MASK_NUM] = {\r
+IP4_ADDR  gIp4AllMasks[IP4_MASK_NUM] = {\r
   0x00000000,\r
   0x80000000,\r
   0xC0000000,\r
@@ -80,33 +84,6 @@ IP4_ADDR  mIp4AllMasks[IP4_MASK_NUM] = {
 \r
 EFI_IPv4_ADDRESS  mZeroIp4Addr = {{0, 0, 0, 0}};\r
 \r
-/**\r
-  Converts the low nibble of a byte  to hex unicode character.\r
-\r
-  @param  Nibble  lower nibble of a byte.\r
-\r
-  @return Hex unicode character.\r
-\r
-**/\r
-CHAR16\r
-NibbleToHexChar (\r
-  IN UINT8      Nibble\r
-  )\r
-{\r
-  //\r
-  // Porting Guide:\r
-  // This library interface is simply obsolete.\r
-  // Include the source code to user code.\r
-  //\r
-\r
-  Nibble &= 0x0F;\r
-  if (Nibble <= 0x9) {\r
-    return (CHAR16)(Nibble + L'0');\r
-  }\r
-\r
-  return (CHAR16)(Nibble - 0xA + L'A');\r
-}\r
-\r
 /**\r
   Return the length of the mask. If the mask is invalid,\r
   return the invalid length 33, which is IP4_MASK_NUM.\r
@@ -119,6 +96,7 @@ NibbleToHexChar (
 \r
 **/\r
 INTN\r
+EFIAPI\r
 NetGetMaskLength (\r
   IN IP4_ADDR               NetMask\r
   )\r
@@ -126,7 +104,7 @@ NetGetMaskLength (
   INTN                      Index;\r
 \r
   for (Index = 0; Index < IP4_MASK_NUM; Index++) {\r
-    if (NetMask == mIp4AllMasks[Index]) {\r
+    if (NetMask == gIp4AllMasks[Index]) {\r
       break;\r
     }\r
   }\r
@@ -146,6 +124,7 @@ NetGetMaskLength (
 \r
 **/\r
 INTN\r
+EFIAPI\r
 NetGetIpClass (\r
   IN IP4_ADDR               Addr\r
   )\r
@@ -185,6 +164,7 @@ NetGetIpClass (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 Ip4IsUnicast (\r
   IN IP4_ADDR               Ip,\r
   IN IP4_ADDR               NetMask\r
@@ -199,7 +179,7 @@ Ip4IsUnicast (
   }\r
 \r
   if (NetMask == 0) {\r
-    NetMask = mIp4AllMasks[Class << 3];\r
+    NetMask = gIp4AllMasks[Class << 3];\r
   }\r
 \r
   if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {\r
@@ -219,6 +199,7 @@ Ip4IsUnicast (
 \r
 **/\r
 UINT32\r
+EFIAPI\r
 NetRandomInitSeed (\r
   VOID\r
   )\r
@@ -227,7 +208,7 @@ NetRandomInitSeed (
   UINT32                    Seed;\r
 \r
   gRT->GetTime (&Time, NULL);\r
-  Seed = (~Time.Hour << 24 | Time.Second << 16 | Time.Minute << 8 | Time.Day);\r
+  Seed = (~Time.Hour << 24 | Time.Day << 16 | Time.Minute << 8 | Time.Second);\r
   Seed ^= Time.Nanosecond;\r
   Seed ^= Time.Year << 7;\r
 \r
@@ -245,13 +226,14 @@ NetRandomInitSeed (
 \r
 **/\r
 UINT32\r
+EFIAPI\r
 NetGetUint32 (\r
   IN UINT8                  *Buf\r
   )\r
 {\r
   UINT32                    Value;\r
 \r
-  NetCopyMem (&Value, Buf, sizeof (UINT32));\r
+  CopyMem (&Value, Buf, sizeof (UINT32));\r
   return NTOHL (Value);\r
 }\r
 \r
@@ -267,13 +249,14 @@ NetGetUint32 (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 NetPutUint32 (\r
   IN UINT8                  *Buf,\r
   IN UINT32                 Data\r
   )\r
 {\r
   Data = HTONL (Data);\r
-  NetCopyMem (Buf, &Data, sizeof (UINT32));\r
+  CopyMem (Buf, &Data, sizeof (UINT32));\r
 }\r
 \r
 \r
@@ -285,16 +268,17 @@ NetPutUint32 (
   @return The entry that is removed from the list, NULL if the list is empty.\r
 \r
 **/\r
-NET_LIST_ENTRY *\r
+LIST_ENTRY *\r
+EFIAPI\r
 NetListRemoveHead (\r
-  NET_LIST_ENTRY            *Head\r
+  LIST_ENTRY            *Head\r
   )\r
 {\r
-  NET_LIST_ENTRY            *First;\r
+  LIST_ENTRY            *First;\r
 \r
   ASSERT (Head != NULL);\r
 \r
-  if (NetListIsEmpty (Head)) {\r
+  if (IsListEmpty (Head)) {\r
     return NULL;\r
   }\r
 \r
@@ -303,8 +287,8 @@ NetListRemoveHead (
   First->ForwardLink->BackLink  = Head;\r
 \r
   DEBUG_CODE (\r
-    First->ForwardLink  = (LIST_ENTRY     *) NULL;\r
-    First->BackLink     = (LIST_ENTRY     *) NULL;\r
+    First->ForwardLink  = (LIST_ENTRY *) NULL;\r
+    First->BackLink     = (LIST_ENTRY *) NULL;\r
   );\r
 \r
   return First;\r
@@ -319,16 +303,17 @@ NetListRemoveHead (
   @return The entry that is removed from the list, NULL if the list is empty.\r
 \r
 **/\r
-NET_LIST_ENTRY *\r
+LIST_ENTRY *\r
+EFIAPI\r
 NetListRemoveTail (\r
-  NET_LIST_ENTRY            *Head\r
+  LIST_ENTRY            *Head\r
   )\r
 {\r
-  NET_LIST_ENTRY            *Last;\r
+  LIST_ENTRY            *Last;\r
 \r
   ASSERT (Head != NULL);\r
 \r
-  if (NetListIsEmpty (Head)) {\r
+  if (IsListEmpty (Head)) {\r
     return NULL;\r
   }\r
 \r
@@ -337,8 +322,8 @@ NetListRemoveTail (
   Last->BackLink->ForwardLink = Head;\r
 \r
   DEBUG_CODE (\r
-    Last->ForwardLink = (LIST_ENTRY     *) NULL;\r
-    Last->BackLink    = (LIST_ENTRY     *) NULL;\r
+    Last->ForwardLink = (LIST_ENTRY *) NULL;\r
+    Last->BackLink    = (LIST_ENTRY *) NULL;\r
   );\r
 \r
   return Last;\r
@@ -355,9 +340,10 @@ NetListRemoveTail (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 NetListInsertAfter (\r
-  IN NET_LIST_ENTRY         *PrevEntry,\r
-  IN NET_LIST_ENTRY         *NewEntry\r
+  IN LIST_ENTRY         *PrevEntry,\r
+  IN LIST_ENTRY         *NewEntry\r
   )\r
 {\r
   NewEntry->BackLink                = PrevEntry;\r
@@ -377,9 +363,10 @@ NetListInsertAfter (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 NetListInsertBefore (\r
-  IN NET_LIST_ENTRY *PostEntry,\r
-  IN NET_LIST_ENTRY *NewEntry\r
+  IN LIST_ENTRY     *PostEntry,\r
+  IN LIST_ENTRY     *NewEntry\r
   )\r
 {\r
   NewEntry->ForwardLink             = PostEntry;\r
@@ -398,14 +385,15 @@ NetListInsertBefore (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 NetMapInit (\r
   IN NET_MAP                *Map\r
   )\r
 {\r
   ASSERT (Map != NULL);\r
 \r
-  NetListInit (&Map->Used);\r
-  NetListInit (&Map->Recycled);\r
+  InitializeListHead (&Map->Used);\r
+  InitializeListHead (&Map->Recycled);\r
   Map->Count = 0;\r
 }\r
 \r
@@ -419,35 +407,36 @@ NetMapInit (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 NetMapClean (\r
   IN NET_MAP                *Map\r
   )\r
 {\r
   NET_MAP_ITEM              *Item;\r
-  NET_LIST_ENTRY            *Entry;\r
-  NET_LIST_ENTRY            *Next;\r
+  LIST_ENTRY                *Entry;\r
+  LIST_ENTRY                *Next;\r
 \r
   ASSERT (Map != NULL);\r
 \r
   NET_LIST_FOR_EACH_SAFE (Entry, Next, &Map->Used) {\r
     Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);\r
 \r
-    NetListRemoveEntry (&Item->Link);\r
+    RemoveEntryList (&Item->Link);\r
     Map->Count--;\r
 \r
-    NetFreePool (Item);\r
+    gBS->FreePool (Item);\r
   }\r
 \r
-  ASSERT ((Map->Count == 0) && NetListIsEmpty (&Map->Used));\r
+  ASSERT ((Map->Count == 0) && IsListEmpty (&Map->Used));\r
 \r
   NET_LIST_FOR_EACH_SAFE (Entry, Next, &Map->Recycled) {\r
     Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);\r
 \r
-    NetListRemoveEntry (&Item->Link);\r
-    NetFreePool (Item);\r
+    RemoveEntryList (&Item->Link);\r
+    gBS->FreePool (Item);\r
   }\r
 \r
-  ASSERT (NetListIsEmpty (&Map->Recycled));\r
+  ASSERT (IsListEmpty (&Map->Recycled));\r
 }\r
 \r
 \r
@@ -460,6 +449,7 @@ NetMapClean (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 NetMapIsEmpty (\r
   IN NET_MAP                *Map\r
   )\r
@@ -478,6 +468,7 @@ NetMapIsEmpty (
 \r
 **/\r
 UINTN\r
+EFIAPI\r
 NetMapGetCount (\r
   IN NET_MAP                *Map\r
   )\r
@@ -495,23 +486,22 @@ NetMapGetCount (
   @return The allocated item or NULL\r
 \r
 **/\r
-STATIC\r
 NET_MAP_ITEM *\r
 NetMapAllocItem (\r
   IN NET_MAP                *Map\r
   )\r
 {\r
   NET_MAP_ITEM              *Item;\r
-  NET_LIST_ENTRY            *Head;\r
+  LIST_ENTRY                *Head;\r
   UINTN                     Index;\r
 \r
   ASSERT (Map != NULL);\r
 \r
   Head = &Map->Recycled;\r
 \r
-  if (NetListIsEmpty (Head)) {\r
+  if (IsListEmpty (Head)) {\r
     for (Index = 0; Index < NET_MAP_INCREAMENT; Index++) {\r
-      Item = NetAllocatePool (sizeof (NET_MAP_ITEM));\r
+      Item = AllocatePool (sizeof (NET_MAP_ITEM));\r
 \r
       if (Item == NULL) {\r
         if (Index == 0) {\r
@@ -521,7 +511,7 @@ NetMapAllocItem (
         break;\r
       }\r
 \r
-      NetListInsertHead (Head, &Item->Link);\r
+      InsertHeadList (Head, &Item->Link);\r
     }\r
   }\r
 \r
@@ -544,6 +534,7 @@ NetMapAllocItem (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetMapInsertHead (\r
   IN NET_MAP                *Map,\r
   IN VOID                   *Key,\r
@@ -562,7 +553,7 @@ NetMapInsertHead (
 \r
   Item->Key   = Key;\r
   Item->Value = Value;\r
-  NetListInsertHead (&Map->Used, &Item->Link);\r
+  InsertHeadList (&Map->Used, &Item->Link);\r
 \r
   Map->Count++;\r
   return EFI_SUCCESS;\r
@@ -581,6 +572,7 @@ NetMapInsertHead (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetMapInsertTail (\r
   IN NET_MAP                *Map,\r
   IN VOID                   *Key,\r
@@ -599,7 +591,7 @@ NetMapInsertTail (
 \r
   Item->Key   = Key;\r
   Item->Value = Value;\r
-  NetListInsertTail (&Map->Used, &Item->Link);\r
+  InsertTailList (&Map->Used, &Item->Link);\r
 \r
   Map->Count++;\r
 \r
@@ -616,14 +608,13 @@ NetMapInsertTail (
   @return TRUE if the item is in the netmap, otherwise FALSE.\r
 \r
 **/\r
-STATIC\r
 BOOLEAN\r
 NetItemInMap (\r
   IN NET_MAP                *Map,\r
   IN NET_MAP_ITEM           *Item\r
   )\r
 {\r
-  NET_LIST_ENTRY            *ListEntry;\r
+  LIST_ENTRY            *ListEntry;\r
 \r
   NET_LIST_FOR_EACH (ListEntry, &Map->Used) {\r
     if (ListEntry == &Item->Link) {\r
@@ -645,12 +636,13 @@ NetItemInMap (
 \r
 **/\r
 NET_MAP_ITEM *\r
+EFIAPI\r
 NetMapFindKey (\r
   IN  NET_MAP               *Map,\r
   IN  VOID                  *Key\r
   )\r
 {\r
-  NET_LIST_ENTRY          *Entry;\r
+  LIST_ENTRY              *Entry;\r
   NET_MAP_ITEM            *Item;\r
 \r
   ASSERT (Map != NULL);\r
@@ -678,6 +670,7 @@ NetMapFindKey (
 \r
 **/\r
 VOID *\r
+EFIAPI\r
 NetMapRemoveItem (\r
   IN  NET_MAP             *Map,\r
   IN  NET_MAP_ITEM        *Item,\r
@@ -687,9 +680,9 @@ NetMapRemoveItem (
   ASSERT ((Map != NULL) && (Item != NULL));\r
   ASSERT (NetItemInMap (Map, Item));\r
 \r
-  NetListRemoveEntry (&Item->Link);\r
+  RemoveEntryList (&Item->Link);\r
   Map->Count--;\r
-  NetListInsertHead (&Map->Recycled, &Item->Link);\r
+  InsertHeadList (&Map->Recycled, &Item->Link);\r
 \r
   if (Value != NULL) {\r
     *Value = Item->Value;\r
@@ -709,6 +702,7 @@ NetMapRemoveItem (
 \r
 **/\r
 VOID *\r
+EFIAPI\r
 NetMapRemoveHead (\r
   IN  NET_MAP               *Map,\r
   OUT VOID                  **Value         OPTIONAL\r
@@ -720,12 +714,12 @@ NetMapRemoveHead (
   // Often, it indicates a programming error to remove\r
   // the first entry in an empty list\r
   //\r
-  ASSERT (Map && !NetListIsEmpty (&Map->Used));\r
+  ASSERT (Map && !IsListEmpty (&Map->Used));\r
 \r
   Item = NET_LIST_HEAD (&Map->Used, NET_MAP_ITEM, Link);\r
-  NetListRemoveEntry (&Item->Link);\r
+  RemoveEntryList (&Item->Link);\r
   Map->Count--;\r
-  NetListInsertHead (&Map->Recycled, &Item->Link);\r
+  InsertHeadList (&Map->Recycled, &Item->Link);\r
 \r
   if (Value != NULL) {\r
     *Value = Item->Value;\r
@@ -745,6 +739,7 @@ NetMapRemoveHead (
 \r
 **/\r
 VOID *\r
+EFIAPI\r
 NetMapRemoveTail (\r
   IN  NET_MAP               *Map,\r
   OUT VOID                  **Value       OPTIONAL\r
@@ -756,12 +751,12 @@ NetMapRemoveTail (
   // Often, it indicates a programming error to remove\r
   // the last entry in an empty list\r
   //\r
-  ASSERT (Map && !NetListIsEmpty (&Map->Used));\r
+  ASSERT (Map && !IsListEmpty (&Map->Used));\r
 \r
   Item = NET_LIST_TAIL (&Map->Used, NET_MAP_ITEM, Link);\r
-  NetListRemoveEntry (&Item->Link);\r
+  RemoveEntryList (&Item->Link);\r
   Map->Count--;\r
-  NetListInsertHead (&Map->Recycled, &Item->Link);\r
+  InsertHeadList (&Map->Recycled, &Item->Link);\r
 \r
   if (Value != NULL) {\r
     *Value = Item->Value;\r
@@ -785,6 +780,7 @@ NetMapRemoveTail (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetMapIterate (\r
   IN NET_MAP                *Map,\r
   IN NET_MAP_CALLBACK       CallBack,\r
@@ -792,9 +788,9 @@ NetMapIterate (
   )\r
 {\r
 \r
-  NET_LIST_ENTRY            *Entry;\r
-  NET_LIST_ENTRY            *Next;\r
-  NET_LIST_ENTRY            *Head;\r
+  LIST_ENTRY            *Entry;\r
+  LIST_ENTRY            *Next;\r
+  LIST_ENTRY            *Head;\r
   NET_MAP_ITEM              *Item;\r
   EFI_STATUS                Result;\r
 \r
@@ -802,7 +798,7 @@ NetMapIterate (
 \r
   Head = &Map->Used;\r
 \r
-  if (NetListIsEmpty (Head)) {\r
+  if (IsListEmpty (Head)) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
@@ -840,8 +836,7 @@ NetLibDefaultUnload (
   UINTN                             Index;\r
   EFI_DRIVER_BINDING_PROTOCOL       *DriverBinding;\r
   EFI_COMPONENT_NAME_PROTOCOL       *ComponentName;\r
-  EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration;\r
-  EFI_DRIVER_DIAGNOSTICS_PROTOCOL   *DriverDiagnostics;\r
+  EFI_COMPONENT_NAME2_PROTOCOL      *ComponentName2;\r
 \r
   //\r
   // Get the list of all the handles in the handle database.\r
@@ -910,30 +905,15 @@ NetLibDefaultUnload (
 \r
     Status = gBS->HandleProtocol (\r
                     DeviceHandleBuffer[Index],\r
-                    &gEfiDriverConfigurationProtocolGuid,\r
-                    (VOID **) &DriverConfiguration\r
+                    &gEfiComponentName2ProtocolGuid,\r
+                    (VOID **) &ComponentName2\r
                     );\r
-\r
-    if (!EFI_ERROR (Status)) {\r
-      gBS->UninstallProtocolInterface (\r
-            ImageHandle,\r
-            &gEfiDriverConfigurationProtocolGuid,\r
-            DriverConfiguration\r
-            );\r
-    }\r
-\r
-    Status = gBS->HandleProtocol (\r
-                    DeviceHandleBuffer[Index],\r
-                    &gEfiDriverDiagnosticsProtocolGuid,\r
-                    (VOID **) &DriverDiagnostics\r
-                    );\r
-\r
     if (!EFI_ERROR (Status)) {\r
       gBS->UninstallProtocolInterface (\r
-            ImageHandle,\r
-            &gEfiDriverDiagnosticsProtocolGuid,\r
-            DriverDiagnostics\r
-            );\r
+             ImageHandle,\r
+             &gEfiComponentName2ProtocolGuid,\r
+             ComponentName2\r
+             );\r
     }\r
   }\r
 \r
@@ -962,6 +942,7 @@ NetLibDefaultUnload (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibCreateServiceChild (\r
   IN  EFI_HANDLE            Controller,\r
   IN  EFI_HANDLE            Image,\r
@@ -1012,6 +993,7 @@ NetLibCreateServiceChild (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibDestroyServiceChild (\r
   IN  EFI_HANDLE            Controller,\r
   IN  EFI_HANDLE            Image,\r
@@ -1065,6 +1047,7 @@ NetLibDestroyServiceChild (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibGetMacString (\r
   IN           EFI_HANDLE  SnpHandle,\r
   IN           EFI_HANDLE  ImageHandle,\r
@@ -1100,7 +1083,7 @@ NetLibGetMacString (
   // It takes 2 unicode characters to represent a 1 byte binary buffer.\r
   // Plus one unicode character for the null-terminator.\r
   //\r
-  MacAddress = NetAllocatePool ((2 * Mode->HwAddressSize + 1) * sizeof (CHAR16));\r
+  MacAddress = AllocatePool ((2 * Mode->HwAddressSize + 1) * sizeof (CHAR16));\r
   if (MacAddress == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -1131,7 +1114,6 @@ NetLibGetMacString (
   @retval FALSE          If the default address is acquired from DHCP.\r
 \r
 **/\r
-STATIC\r
 BOOLEAN\r
 NetLibDefaultAddressIsStatic (\r
   IN EFI_HANDLE  Controller\r
@@ -1158,7 +1140,7 @@ NetLibDefaultAddressIsStatic (
     return TRUE;\r
   }\r
 \r
-  ConfigInfo = NetAllocatePool (Len);\r
+  ConfigInfo = AllocatePool (Len);\r
   if (ConfigInfo == NULL) {\r
     return TRUE;\r
   }\r
@@ -1173,7 +1155,7 @@ NetLibDefaultAddressIsStatic (
 \r
 ON_EXIT:\r
 \r
-  NetFreePool (ConfigInfo);\r
+  gBS->FreePool (ConfigInfo);\r
 \r
   return IsStatic;\r
 }\r
@@ -1193,6 +1175,7 @@ ON_EXIT:
   @retval None\r
 **/\r
 VOID\r
+EFIAPI\r
 NetLibCreateIPv4DPathNode (\r
   IN OUT IPv4_DEVICE_PATH  *Node,\r
   IN EFI_HANDLE            Controller,\r
@@ -1208,8 +1191,8 @@ NetLibCreateIPv4DPathNode (
   Node->Header.SubType = MSG_IPv4_DP;\r
   SetDevicePathNodeLength (&Node->Header, 19);\r
 \r
-  NetCopyMem (&Node->LocalIpAddress, &LocalIp, sizeof (EFI_IPv4_ADDRESS));\r
-  NetCopyMem (&Node->RemoteIpAddress, &RemoteIp, sizeof (EFI_IPv4_ADDRESS));\r
+  CopyMem (&Node->LocalIpAddress, &LocalIp, sizeof (EFI_IPv4_ADDRESS));\r
+  CopyMem (&Node->RemoteIpAddress, &RemoteIp, sizeof (EFI_IPv4_ADDRESS));\r
 \r
   Node->LocalPort  = LocalPort;\r
   Node->RemotePort = RemotePort;\r
@@ -1241,6 +1224,7 @@ NetLibCreateIPv4DPathNode (
 \r
 **/\r
 EFI_HANDLE\r
+EFIAPI\r
 NetLibGetNicHandle (\r
   IN EFI_HANDLE             Controller,\r
   IN EFI_GUID               *ProtocolGuid\r
@@ -1276,3 +1260,73 @@ NetLibGetNicHandle (
   return Handle;\r
 }\r
 \r
+/**\r
+  Add a Deferred Procedure Call to the end of the DPC queue.\r
+\r
+  @DpcTpl           The EFI_TPL that the DPC should be invoked.\r
+  @DpcProcedure     Pointer to the DPC's function.\r
+  @DpcContext       Pointer to the DPC's context.  Passed to DpcProcedure\r
+                    when DpcProcedure is invoked.\r
+\r
+  @retval  EFI_SUCCESS              The DPC was queued.\r
+  @retval  EFI_INVALID_PARAMETER    DpcTpl is not a valid EFI_TPL.\r
+                                    DpcProcedure is NULL.\r
+  @retval  EFI_OUT_OF_RESOURCES     There are not enough resources available to\r
+                                    add the DPC to the queue.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+NetLibQueueDpc (\r
+  IN EFI_TPL            DpcTpl,\r
+  IN EFI_DPC_PROCEDURE  DpcProcedure,\r
+  IN VOID               *DpcContext    OPTIONAL\r
+  )\r
+{\r
+  return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);\r
+}\r
+\r
+/**\r
+  Add a Deferred Procedure Call to the end of the DPC queue.\r
+\r
+  @retval  EFI_SUCCESS              One or more DPCs were invoked.\r
+  @retval  EFI_NOT_FOUND            No DPCs were invoked.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+NetLibDispatchDpc (\r
+  VOID\r
+  )\r
+{\r
+  return mDpc->DispatchDpc(mDpc);\r
+}\r
+\r
+\r
+/**\r
+  The constructor function caches the pointer to DPC protocol.\r
+\r
+  The constructor function locates DPC protocol from protocol database.\r
+  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
+\r
+  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param  SystemTable   A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+NetLibConstructor (\r
+  IN EFI_HANDLE                ImageHandle,\r
+  IN EFI_SYSTEM_TABLE          *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, (VOID**) &mDpc);\r
+  ASSERT_EFI_ERROR (Status);\r
+  ASSERT (mDpc != NULL);\r
+\r
+  return Status;\r
+}\r