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
This commit is contained in:
hhuan13 2011-07-14 11:32:19 +00:00
parent 33c09637c6
commit 19ddbb2587
4 changed files with 5 additions and 141 deletions

View File

@ -1,7 +1,7 @@
/** @file
Functions implementation related with DHCPv4 for UefiPxeBc Driver.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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.
//

View File

@ -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;

View File

@ -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.

View File

@ -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.