]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.c
1. Remove #ifdef _MSC_EXTENSION_ from all source files
[mirror_edk2.git] / EdkModulePkg / Universal / Network / PxeBc / Dxe / bc.c
index 303f3547ae6f855b7e6533a5df096c939e956616..4444b20d0012456990347b0d879c39d154b33e8d 100644 (file)
@@ -1,12 +1,13 @@
 /*++\r
-Copyright (c) 2006, 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Copyright (c) 2006 - 2007, 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
         bc.c\r
@@ -17,45 +18,6 @@ Abstract:
 \r
 #include "Bc.h"\r
 \r
-//\r
-//\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-PxeBcDriverSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PxeBcDriverStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PxeBcDriverStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN  EFI_HANDLE                     Controller,\r
-  IN  UINTN                          NumberOfChildren,\r
-  IN  EFI_HANDLE                     *ChildHandleBuffer\r
-  );\r
-\r
-extern\r
-VOID\r
-InitArpHeader (\r
-  VOID\r
-  );\r
-extern\r
-VOID\r
-OptionsStrucInit (\r
-  VOID\r
-  );\r
-\r
 //\r
 // helper routines\r
 //\r
@@ -201,7 +163,7 @@ SeedRandom (
   Arguments:\r
 \r
   Returns:\r
-    none                - \r
+    none                -\r
 \r
 --*/\r
 {\r
@@ -255,7 +217,7 @@ IpChecksum (
     Length             - Length to be checksummed\r
 \r
   Returns:\r
-    Checksum           - Returns the 16 bit ones complement of \r
+    Checksum           - Returns the 16 bit ones complement of\r
                          ones complement sum of 16 bit words\r
 \r
 --*/\r
@@ -303,15 +265,15 @@ IpChecksum2 (
     MessageLen    - Length to be checksummed\r
 \r
   Returns:\r
-    Checksum      - Returns the 16 bit ones complement of \r
+    Checksum      - Returns the 16 bit ones complement of\r
                     ones complement sum of 16 bit words\r
 \r
 --*/\r
 {\r
   UINT32  Sum;\r
 \r
-  Sum = (UINT16)~IpChecksum (Header, HeaderLen) + (UINT16)~IpChecksum (Message, MessageLen);\r
-\r
+  Sum = (UINT16)~IpChecksum (Header, HeaderLen);\r
+  Sum = Sum + (UINT16)~IpChecksum (Message, MessageLen);\r
   //\r
   // in case above carried\r
   //\r
@@ -337,7 +299,7 @@ UpdateChecksum (
     NewWord            - New Value\r
 \r
   Returns:\r
-    Checksum           - Returns the 16 bit ones complement of \r
+    Checksum           - Returns the 16 bit ones complement of\r
                          ones complement sum of 16 bit words\r
 \r
 --*/\r
@@ -367,7 +329,7 @@ SetMakeCallback (
 \r
   Returns:\r
     0                  - Callbacks are active on the handle\r
-    1                  - Callbacks are not active on the handle                         \r
+    1                  - Callbacks are not active on the handle\r
 \r
 --*/\r
 {\r
@@ -424,7 +386,7 @@ WaitForReceive (
   Arguments:\r
     Private       - Pointer to Pxe BaseCode Protocol\r
     Function      - What PXE function to callback\r
-    TimeoutEvent  - Timer event that will trigger when we have waited too \r
+    TimeoutEvent  - Timer event that will trigger when we have waited too\r
                     long for an incoming packet\r
     HeaderSizePtr - Pointer to the size of the Header size\r
     BufferSizePtr - Pointer to the size of the Buffer size\r
@@ -485,52 +447,6 @@ WaitForReceive (
   //\r
   for (;;)\r
   {\r
-#if 0\r
-    //\r
-    // Check for received packet event.\r
-    //\r
-    if (!EFI_ERROR (gBS->CheckEvent (SnpPtr->WaitForPacket))) {\r
-      //\r
-      // Packet should be available.  Attempt to read it.\r
-      //\r
-      *BufferSizePtr = BUFFER_ALLOCATE_SIZE;\r
-\r
-      StatCode = SnpPtr->Receive (\r
-                          SnpPtr,\r
-                          HeaderSizePtr,\r
-                          BufferSizePtr,\r
-                          Private->ReceiveBufferPtr,\r
-                          0,\r
-                          0,\r
-                          ProtocolPtr\r
-                          );\r
-\r
-      if (EFI_ERROR (StatCode)) {\r
-        break;\r
-      }\r
-      //\r
-      // Packet was received.  Make received callback then return.\r
-      //\r
-      if (CallbackPtr != NULL) {\r
-        StatCode = CallbackPtr (\r
-                    Private->CallbackProtocolPtr,\r
-                    Function,\r
-                    TRUE,\r
-                    (UINT32) *BufferSizePtr,\r
-                    (EFI_PXE_BASE_CODE_PACKET *) Private->ReceiveBufferPtr\r
-                    );\r
-\r
-        if (StatCode != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {\r
-          StatCode = EFI_ABORTED;\r
-        } else {\r
-          StatCode = EFI_SUCCESS;\r
-        }\r
-      }\r
-\r
-      break;\r
-    }\r
-\r
-#else\r
     //\r
     // Poll for received packet.\r
     //\r
@@ -572,7 +488,7 @@ WaitForReceive (
     if (StatCode != EFI_NOT_READY) {\r
       break;\r
     }\r
-#endif\r
+\r
     //\r
     // Check for callback event.\r
     //\r
@@ -638,7 +554,7 @@ SendPacket (
 \r
   Arguments:\r
     Private       - Pointer to Pxe BaseCode Protocol\r
-    HeaderPtr          - Pointer to the buffer \r
+    HeaderPtr          - Pointer to the buffer\r
     PacketPtr          - Pointer to the packet to send\r
     PacketLen        - The length of the entire packet to send\r
     HardwareAddr        - Pointer to the MAC address of the destination\r
@@ -1302,7 +1218,6 @@ BcStart (
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
-#if !SUPPORT_IPV6\r
   //\r
   // Fail if IPv6 is requested and not supported.\r
   //\r
@@ -1311,7 +1226,7 @@ BcStart (
     EfiReleaseLock (&Private->Lock);\r
     return EFI_UNSUPPORTED;\r
   }\r
-#endif\r
+\r
   //\r
   // Setup shortcuts to SNP protocol and data structure.\r
   //\r
@@ -1544,12 +1459,8 @@ BcStart (
   // supports IPv6.\r
   //\r
   Private->EfiBc.Mode->Ipv6Supported = SUPPORT_IPV6;\r
-\r
-#if SUPPORT_IPV6\r
-  Private->EfiBc.Mode->Ipv6Available = Private->NiiPtr->Ipv6Supported;\r
-#else\r
   Private->EfiBc.Mode->Ipv6Available = FALSE;\r
-#endif\r
+\r
   //\r
   // Set to TRUE by the BC constructor if this BC implementation\r
   // supports BIS.\r
@@ -1597,7 +1508,6 @@ BcStop (
   //\r
   // Lock the instance data\r
   //\r
-  EFI_PXE_BASE_CODE_MODE      *PxebcMode;\r
   EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;\r
   EFI_SIMPLE_NETWORK_MODE     *SnpModePtr;\r
   EFI_STATUS                  StatCode;\r
@@ -1619,7 +1529,6 @@ BcStop (
 \r
   EfiAcquireLock (&Private->Lock);\r
 \r
-  PxebcMode   = Private->EfiBc.Mode;\r
   SnpPtr      = Private->SimpleNetwork;\r
   SnpModePtr  = SnpPtr->Mode;\r
 \r
@@ -1797,14 +1706,7 @@ IpFilter (
           //\r
           if (!Index2)\r
           {\r
-#if SUPPORT_IPV6\r
-            if (PxebcMode->UsingIpv6) {\r
-              //\r
-              // TBD\r
-              //\r
-            } else\r
-#endif\r
-              TmpIp = (EFI_IP_ADDRESS *) &AllSystemsGroup;\r
+            TmpIp = (EFI_IP_ADDRESS *) &AllSystemsGroup;\r
             --Index;\r
           } else {\r
             TmpIp = (EFI_IP_ADDRESS *) &Filter->IpList[Index];\r
@@ -2069,13 +1971,11 @@ BcSetStationIP (
 --*/\r
 {\r
   EFI_PXE_BASE_CODE_MODE  *PxebcMode;\r
-  EFI_STATUS              StatCode;\r
   PXE_BASECODE_DEVICE     *Private;\r
 \r
   //\r
   // Lock the instance data and make sure started\r
   //\r
-  StatCode = EFI_SUCCESS;\r
 \r
   if (This == NULL) {\r
     DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));\r
@@ -2352,12 +2252,8 @@ PxeBcDriverStart (
   // implementation supports IPv6.\r
   //\r
   Private->EfiBc.Mode->Ipv6Supported = SUPPORT_IPV6;\r
-\r
-#if SUPPORT_IPV6\r
-  Private->EfiBc.Mode->Ipv6Available = Private->NiiPtr->Ipv6Supported;\r
-#else\r
   Private->EfiBc.Mode->Ipv6Available = FALSE;\r
-#endif\r
+\r
   //\r
   // Set to TRUE by the BC constructor if this BC\r
   // implementation supports BIS.\r