/*++\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
\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
Arguments:\r
\r
Returns:\r
- none - \r
+ none -\r
\r
--*/\r
{\r
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
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
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
\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
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
//\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
if (StatCode != EFI_NOT_READY) {\r
break;\r
}\r
-#endif\r
+\r
//\r
// Check for callback event.\r
//\r
\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
return EFI_ALREADY_STARTED;\r
}\r
\r
-#if !SUPPORT_IPV6\r
//\r
// Fail if IPv6 is requested and not supported.\r
//\r
EfiReleaseLock (&Private->Lock);\r
return EFI_UNSUPPORTED;\r
}\r
-#endif\r
+\r
//\r
// Setup shortcuts to SNP protocol and data structure.\r
//\r
// 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
//\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
\r
EfiAcquireLock (&Private->Lock);\r
\r
- PxebcMode = Private->EfiBc.Mode;\r
SnpPtr = Private->SimpleNetwork;\r
SnpModePtr = SnpPtr->Mode;\r
\r
//\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
--*/\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
// 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