From 19ddbb25872eb727e1751fb842f0f5948a0b3aa7 Mon Sep 17 00:00:00 2001 From: hhuan13 Date: Thu, 14 Jul 2011 11:32:19 +0000 Subject: [PATCH] 1. Update NetworkPkg\PXE driver to consume netlib library function NetLibGetSystemGuid() git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12019 6f19259b-4bc3-4df7-8a09-765794883524 --- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 8 +- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 2 +- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 122 ------------------------- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h | 14 --- 4 files changed, 5 insertions(+), 141 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c index 08415d97b4..a30ae177ef 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c @@ -1,7 +1,7 @@ /** @file Functions implementation related with DHCPv4 for UefiPxeBc Driver. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -316,7 +316,7 @@ PxeBcBuildDhcp4Options ( Index++; OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]); - if (EFI_ERROR (PxeBcGetSystemGuid ((EFI_GUID *) OptEnt.Uuid->Guid))) { + if (EFI_ERROR (NetLibGetSystemGuid ((EFI_GUID *) OptEnt.Uuid->Guid))) { // // Zero the Guid to indicate NOT programable if failed to get system Guid. // @@ -1193,7 +1193,7 @@ PxeBcDhcp4CallBack ( // // Send the system Guid instead of the MAC address as the hardware address if required. // - if (EFI_ERROR (PxeBcGetSystemGuid ((EFI_GUID *) Packet->Dhcp4.Header.ClientHwAddr))) { + if (EFI_ERROR (NetLibGetSystemGuid ((EFI_GUID *) Packet->Dhcp4.Header.ClientHwAddr))) { // // Zero the Guid to indicate NOT programable if failed to get system Guid. // @@ -1369,7 +1369,7 @@ PxeBcDhcp4Discover ( } if (Mode->SendGUID) { - if (EFI_ERROR (PxeBcGetSystemGuid ((EFI_GUID *) Token.Packet->Dhcp4.Header.ClientHwAddr))) { + if (EFI_ERROR (NetLibGetSystemGuid ((EFI_GUID *) Token.Packet->Dhcp4.Header.ClientHwAddr))) { // // Zero the Guid to indicate NOT programable if failed to get system Guid. // diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index 83c24f0cc1..cd8eab3df9 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -1800,7 +1800,7 @@ EfiPxeBcSetParameters ( } if (NewSendGUID != NULL) { - if (*NewSendGUID && EFI_ERROR (PxeBcGetSystemGuid (&SystemGuid))) { + if (*NewSendGUID && EFI_ERROR (NetLibGetSystemGuid (&SystemGuid))) { return EFI_INVALID_PARAMETER; } Mode->SendGUID = *NewSendGUID; diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c index 28383b32aa..30418c3b6a 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c @@ -16,128 +16,6 @@ #include "PxeBcImpl.h" - -/** - This function returns SMBIOS string given the string number. - - @param[in] Smbios The pointer to the SMBIOS structure - @param[in] StringNumber String number to return. 0 is used to skip all - strings and point to the next SMBIOS structure. - - @return String The pointer to the next SMBIOS structure if - StringNumber == 0. - -**/ -CHAR8 * -PxeBcGetSmbiosString ( - IN SMBIOS_STRUCTURE_POINTER *Smbios, - IN UINT16 StringNumber - ) -{ - UINT16 Index; - CHAR8 *String; - - // - // Skip over formatted section. - // - String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length); - - // - // Look through unformated section. - // - for (Index = 1; Index <= StringNumber || StringNumber == 0; Index++) { - if (StringNumber == Index) { - return String; - } - - // - // Skip zero string. - // - while (*String != 0) { - String++; - } - String++; - - if (*String == 0) { - // - // If double NULL then we are done. - // Return pointer to next structure in Smbios. - // if you pass in a 0 you will always get here - // - Smbios->Raw = (UINT8 *)++String; - return NULL; - } - } - - return NULL; -} - - -/** - This function obtains the system guid and the serial number from the smbios table. - - @param[out] SystemGuid The pointer of the returned system guid. - - @retval EFI_SUCCESS Successfully obtained the system guid. - @retval EFI_NOT_FOUND Did not find the SMBIOS table. - -**/ -EFI_STATUS -PxeBcGetSystemGuid ( - OUT EFI_GUID *SystemGuid - ) -{ - EFI_STATUS Status; - SMBIOS_TABLE_ENTRY_POINT *SmbiosTable; - SMBIOS_STRUCTURE_POINTER Smbios; - SMBIOS_STRUCTURE_POINTER SmbiosEnd; - UINT16 Index; - - SmbiosTable = NULL; - Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable); - - if (EFI_ERROR (Status) || SmbiosTable == NULL) { - return EFI_NOT_FOUND; - } - - Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress; - SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength); - - for (Index = 0; Index < SmbiosTable->TableLength; Index++) { - if (Smbios.Hdr->Type == 1) { - if (Smbios.Hdr->Length < 0x19) { - // - // Older version did not support Guid and Serial number - // - continue; - } - // - // SMBIOS tables are byte packed so we need to do a byte copy to - // prevend alignment faults on Itanium-based platform. - // - CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID)); - PxeBcGetSmbiosString (&Smbios, Smbios.Type1->SerialNumber); - - return EFI_SUCCESS; - } - // - // Make Smbios point to the next record - // - PxeBcGetSmbiosString (&Smbios, 0); - - if (Smbios.Raw >= SmbiosEnd.Raw) { - // - // SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e. - // given this we must double check against the length of the structure. - // - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - - /** Flush the previous configration using the new station Ip address. diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h index 59975d59c3..a4f5d3131a 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h @@ -25,20 +25,6 @@ #define ICMP_PARAMETER_PROBLEM 12 -/** - This function obtain the system guid and serial number from the smbios table. - - @param[out] SystemGuid The pointer of returned system guid. - - @retval EFI_SUCCESS Successfully obtained the system guid. - @retval EFI_NOT_FOUND Did not find the SMBIOS table. - -**/ -EFI_STATUS -PxeBcGetSystemGuid ( - OUT EFI_GUID *SystemGuid - ); - /** Flush the previous configration using the new station Ip address. -- 2.39.2