From 7e038442a84e882ddc8a6b2e23243c6d4e371090 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Wed, 24 Jun 2009 02:30:53 +0000 Subject: [PATCH] remove the self-implementation on checksum() in this module by using BaseLib. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8637 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Decode.c | 43 ++----------------- MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Undi32.h | 1 + .../Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf | 1 + 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Decode.c b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Decode.c index f169d88ffe..670fa18d53 100644 --- a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Decode.c +++ b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Decode.c @@ -1380,38 +1380,6 @@ badcdb: } -/** - This does an 8 bit check sum of the passed in buffer for Len bytes. - This is primarily used to update the check sum in the SW UNDI header. - - @param Buffer Pointer to the passed in buffer to check sum - @param Len Length of buffer to be check summed in bytes. - - @return None - -**/ -UINT8 -ChkSum ( - IN VOID *Buffer, - IN UINT16 Len - ) -{ - UINT8 Chksum; - INT8 *Bp; - - Chksum = 0; - if ((Bp = Buffer) != NULL) { - while (Len--) { - Chksum = (UINT8) (Chksum +*Bp++); - - } - - } - - return Chksum; -} - - /** When called with a null NicPtr, this routine decrements the number of NICs this UNDI is supporting and removes the NIC_DATA_POINTER from the array. @@ -1423,7 +1391,6 @@ ChkSum ( @return None **/ -// TODO: PxePtr - add argument and description to function comment VOID PxeUpdate ( IN NIC_DATA_INSTANCE *NicPtr, @@ -1438,7 +1405,7 @@ PxeUpdate ( PxePtr->IFcnt--; } - PxePtr->Fudge = (UINT8) (PxePtr->Fudge - ChkSum ((VOID *) PxePtr, PxePtr->Len)); + PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len)); return ; } @@ -1446,7 +1413,7 @@ PxeUpdate ( // number of NICs this undi supports // PxePtr->IFcnt++; - PxePtr->Fudge = (UINT8) (PxePtr->Fudge - ChkSum ((VOID *) PxePtr, PxePtr->Len)); + PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len)); return ; } @@ -1455,14 +1422,12 @@ PxeUpdate ( /** Initialize the !PXE structure - @param RemainingDevicePath Not used, always produce all possible children. + @param PxePtr Pointer to SW_UNDI data structure. @retval EFI_SUCCESS This driver is added to Controller. @retval other This driver does not support this device. **/ -// TODO: PxePtr - add argument and description to function comment -// TODO: VersionFlag - add argument and description to function comment VOID PxeStructInit ( IN PXE_SW_UNDI *PxePtr @@ -1507,6 +1472,6 @@ PxeStructInit ( PxePtr->BusCnt = 1; PxePtr->BusType[0] = PXE_BUSTYPE_PCI; - PxePtr->Fudge = (UINT8) (PxePtr->Fudge - ChkSum ((VOID *) PxePtr, PxePtr->Len)); + PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len)); } diff --git a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Undi32.h b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Undi32.h index 256da46b9d..fc6e3525ce 100644 --- a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Undi32.h +++ b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Undi32.h @@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include diff --git a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf index 2fd1da2125..2eee03efdf 100644 --- a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf +++ b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf @@ -46,6 +46,7 @@ DebugLib UefiRuntimeLib UefiDriverEntryPoint + BaseLib [Protocols] gEfiNetworkInterfaceIdentifierProtocolGuid_31 -- 2.39.2