]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
1. Fix a bug in PXE driver that the PXE boot do not restart if a new boot option...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4If.c
index d5a46082277a1a0f01340fa40b98bb427345ccdc..224244164e41a7b1b5385036b3372157debd05c9 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implement IP4 pesudo interface.\r
   \r
-Copyright (c) 2005 - 2007, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2005 - 2012, 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\r
@@ -123,7 +123,7 @@ VOID
 Ip4CancelFrameArp (\r
   IN IP4_ARP_QUE            *ArpQue,\r
   IN EFI_STATUS             IoStatus,\r
-  IN IP4_FRAME_TO_CANCEL    FrameToCancel, OPTIONAL\r
+  IN IP4_FRAME_TO_CANCEL    FrameToCancel  OPTIONAL,\r
   IN VOID                   *Context\r
   );\r
 \r
@@ -146,7 +146,7 @@ Ip4CancelFrameArp (
 IP4_LINK_TX_TOKEN *\r
 Ip4WrapLinkTxToken (\r
   IN IP4_INTERFACE          *Interface,\r
-  IN IP4_PROTOCOL           *IpInstance,    OPTIONAL\r
+  IN IP4_PROTOCOL           *IpInstance     OPTIONAL,\r
   IN NET_BUF                *Packet,\r
   IN IP4_FRAME_CALLBACK     CallBack,\r
   IN VOID                   *Context\r
@@ -188,7 +188,7 @@ Ip4WrapLinkTxToken (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (Token);\r
+    FreePool (Token);\r
     return NULL;\r
   }\r
 \r
@@ -225,7 +225,7 @@ Ip4FreeLinkTxToken (
   NET_CHECK_SIGNATURE (Token, IP4_FRAME_TX_SIGNATURE);\r
 \r
   gBS->CloseEvent (Token->MnpToken.Event);\r
-  gBS->FreePool (Token);\r
+  FreePool (Token);\r
 }\r
 \r
 \r
@@ -269,7 +269,7 @@ Ip4CreateArpQue (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (ArpQue);\r
+    FreePool (ArpQue);\r
     return NULL;\r
   }\r
 \r
@@ -302,7 +302,7 @@ Ip4FreeArpQue (
   Ip4CancelFrameArp (ArpQue, IoStatus, NULL, NULL);\r
 \r
   gBS->CloseEvent (ArpQue->OnResolved);\r
-  gBS->FreePool (ArpQue);\r
+  FreePool (ArpQue);\r
 }\r
 \r
 \r
@@ -353,7 +353,7 @@ Ip4CreateLinkRxToken (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (Token);\r
+    FreePool (Token);\r
     return NULL;\r
   }\r
 \r
@@ -378,7 +378,7 @@ Ip4FreeFrameRxToken (
   NET_CHECK_SIGNATURE (Token, IP4_FRAME_RX_SIGNATURE);\r
 \r
   gBS->CloseEvent (Token->MnpToken.Event);\r
-  gBS->FreePool (Token);\r
+  FreePool (Token);\r
 }\r
 \r
 \r
@@ -397,7 +397,7 @@ VOID
 Ip4CancelFrameArp (\r
   IN IP4_ARP_QUE            *ArpQue,\r
   IN EFI_STATUS             IoStatus,\r
-  IN IP4_FRAME_TO_CANCEL    FrameToCancel, OPTIONAL\r
+  IN IP4_FRAME_TO_CANCEL    FrameToCancel  OPTIONAL,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -435,7 +435,7 @@ VOID
 Ip4CancelFrames (\r
   IN IP4_INTERFACE          *Interface,\r
   IN EFI_STATUS             IoStatus,\r
-  IN IP4_FRAME_TO_CANCEL    FrameToCancel,   OPTIONAL\r
+  IN IP4_FRAME_TO_CANCEL    FrameToCancel    OPTIONAL,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -523,7 +523,7 @@ Ip4CreateInterface (
   // Get the interface's Mac address and broadcast mac address from SNP\r
   //\r
   if (EFI_ERROR (Mnp->GetModeData (Mnp, NULL, &SnpMode))) {\r
-    gBS->FreePool (Interface);\r
+    FreePool (Interface);\r
     return NULL;\r
   }\r
 \r
@@ -582,7 +582,7 @@ Ip4SetAddress (
 \r
   Type                      = NetGetIpClass (IpAddr);\r
   Len                       = NetGetMaskLength (SubnetMask);\r
-  Netmask                   = gIp4AllMasks[MIN (Len, Type << 3)];\r
+  Netmask                   = gIp4AllMasks[MIN ((Len - 1), Type << 3)];\r
   Interface->NetBrdcast     = (IpAddr | ~Netmask);\r
 \r
   //\r
@@ -745,10 +745,10 @@ Ip4FreeInterface (
   }\r
 \r
   //\r
-  // Destory the interface if this is the last IP instance that\r
+  // Destroy the interface if this is the last IP instance that\r
   // has the address. Remove all the system transmitted packets\r
   // from this interface, cancel the receive request if there is\r
-  // one, and destory the ARP requests.\r
+  // one, and destroy the ARP requests.\r
   //\r
   Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, NULL);\r
   Ip4CancelReceive (Interface);\r
@@ -774,7 +774,7 @@ Ip4FreeInterface (
   }\r
 \r
   RemoveEntryList (&Interface->Link);\r
-  gBS->FreePool (Interface);\r
+  FreePool (Interface);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -871,7 +871,7 @@ Ip4OnArpResolved (
   //\r
   // Request Ip4OnArpResolvedDpc as a DPC at TPL_CALLBACK\r
   //\r
-  NetLibQueueDpc (TPL_CALLBACK, Ip4OnArpResolvedDpc, Context);\r
+  QueueDpc (TPL_CALLBACK, Ip4OnArpResolvedDpc, Context);\r
 }\r
 \r
 \r
@@ -924,7 +924,7 @@ Ip4OnFrameSent (
   //\r
   // Request Ip4OnFrameSentDpc as a DPC at TPL_CALLBACK\r
   //\r
-  NetLibQueueDpc (TPL_CALLBACK, Ip4OnFrameSentDpc, Context);\r
+  QueueDpc (TPL_CALLBACK, Ip4OnFrameSentDpc, Context);\r
 }\r
 \r
 \r
@@ -954,7 +954,7 @@ Ip4OnFrameSent (
 EFI_STATUS\r
 Ip4SendFrame (\r
   IN  IP4_INTERFACE         *Interface,\r
-  IN  IP4_PROTOCOL          *IpInstance,      OPTIONAL\r
+  IN  IP4_PROTOCOL          *IpInstance       OPTIONAL,\r
   IN  NET_BUF               *Packet,\r
   IN  IP4_ADDR              NextHop,\r
   IN  IP4_FRAME_CALLBACK    CallBack,\r
@@ -1088,6 +1088,7 @@ ON_ERROR:
 \r
 **/\r
 VOID\r
+EFIAPI\r
 Ip4RecycleFrame (\r
   IN VOID                   *Context\r
   )\r
@@ -1187,7 +1188,7 @@ Ip4OnFrameReceived (
   //\r
   // Request Ip4OnFrameReceivedDpc as a DPC at TPL_CALLBACK\r
   //\r
-  NetLibQueueDpc (TPL_CALLBACK, Ip4OnFrameReceivedDpc, Context);\r
+  QueueDpc (TPL_CALLBACK, Ip4OnFrameReceivedDpc, Context);\r
 }\r
 \r
 \r
@@ -1209,7 +1210,7 @@ Ip4OnFrameReceived (
 EFI_STATUS\r
 Ip4ReceiveFrame (\r
   IN  IP4_INTERFACE         *Interface,\r
-  IN  IP4_PROTOCOL          *IpInstance,      OPTIONAL\r
+  IN  IP4_PROTOCOL          *IpInstance       OPTIONAL,\r
   IN  IP4_FRAME_CALLBACK    CallBack,\r
   IN  VOID                  *Context\r
   )\r