summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/UefiPxeBcDxe
diff options
context:
space:
mode:
authorhhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-14 11:27:05 +0000
committerhhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-14 11:27:05 +0000
commit57b301b569ec392b7bcad5f19a44fe93e0502a7f (patch)
tree65cccdab87be2332b26a3f1c48d97d3ea057fc5b /MdeModulePkg/Universal/Network/UefiPxeBcDxe
parente47f0da4087bd00f1ee0697d0a9020ec4373e447 (diff)
downloadedk2-platforms-57b301b569ec392b7bcad5f19a44fe93e0502a7f.tar.xz
1. Define a netlib library function NetLibGetSystemGuid()
2. Update PXE driver to use NetLibGetSystemGuid() git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12017 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/UefiPxeBcDxe')
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c11
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c123
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h19
3 files changed, 6 insertions, 147 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 6b25cab33d..a9c86dc042 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -1,7 +1,7 @@
/** @file
Support for PxeBc dhcp functions.
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 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
which accompanies this distribution. The full text of the license may be found at
@@ -788,7 +788,6 @@ PxeBcDhcpCallBack (
UINT16 Value;
EFI_STATUS Status;
BOOLEAN Received;
- CHAR8 *SystemSerialNumber;
EFI_DHCP4_HEADER *DhcpHeader;
if ((Dhcp4Event != Dhcp4RcvdOffer) &&
@@ -843,7 +842,7 @@ PxeBcDhcpCallBack (
//
DhcpHeader = &Packet->Dhcp4.Header;
- if (EFI_ERROR (GetSmbiosSystemGuidAndSerialNumber ((EFI_GUID *) DhcpHeader->ClientHwAddr, &SystemSerialNumber))) {
+ if (EFI_ERROR (NetLibGetSystemGuid ((EFI_GUID *) DhcpHeader->ClientHwAddr))) {
//
// GUID not yet set - send all 0xff's to show programable (via SetVariable)
// SetMem(DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof(EFI_GUID), 0xff);
@@ -928,7 +927,6 @@ PxeBcBuildDhcpOptions (
UINT32 Index;
PXEBC_DHCP4_OPTION_ENTRY OptEnt;
UINT16 Value;
- CHAR8 *SystemSerialNumber;
Index = 0;
OptList[0] = (EFI_DHCP4_PACKET_OPTION *) Private->OptionBuffer;
@@ -1009,7 +1007,7 @@ PxeBcBuildDhcpOptions (
Index++;
OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]);
- if (EFI_ERROR (GetSmbiosSystemGuidAndSerialNumber ((EFI_GUID *) OptEnt.Uuid->Guid, &SystemSerialNumber))) {
+ if (EFI_ERROR (NetLibGetSystemGuid ((EFI_GUID *) OptEnt.Uuid->Guid))) {
//
// GUID not yet set - send all 0xff's to show programable (via SetVariable)
// SetMem(DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof(EFI_GUID), 0xff);
@@ -1120,7 +1118,6 @@ PxeBcDiscvBootService (
EFI_DHCP4_PACKET_OPTION *PxeOpt;
PXEBC_OPTION_BOOT_ITEM *PxeBootItem;
UINT8 VendorOptLen;
- CHAR8 *SystemSerialNumber;
EFI_DHCP4_HEADER *DhcpHeader;
UINT32 Xid;
@@ -1180,7 +1177,7 @@ PxeBcDiscvBootService (
DhcpHeader = &Token.Packet->Dhcp4.Header;
if (Mode->SendGUID) {
- if (EFI_ERROR (GetSmbiosSystemGuidAndSerialNumber ((EFI_GUID *) DhcpHeader->ClientHwAddr, &SystemSerialNumber))) {
+ if (EFI_ERROR (NetLibGetSystemGuid ((EFI_GUID *) DhcpHeader->ClientHwAddr))) {
//
// GUID not yet set - send all 0's to show not programable
//
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
index 60cace885d..327e4a26d8 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,7 +1,7 @@
/** @file
Support routines for PxeBc.
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 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
which accompanies this distribution. The full text of the license may be found at
@@ -17,127 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
- This function returns SMBIOS string given the string number.
-
- @param Smbios Pointer to SMBIOS structure
- @param StringNumber String number to return. 0 is used to skip all
- strings and point to the next SMBIOS structure.
-
- @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == 0
-
-**/
-CHAR8 *
-GetSmbiosString (
- 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 string
- //
- for (; *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 gets system guid and serial number from the smbios table.
-
- @param SystemGuid The pointer of returned system guid.
- @param SystemSerialNumber The pointer of returned system serial number.
-
- @retval EFI_SUCCESS Successfully get the system guid and system serial
- number.
- @retval EFI_NOT_FOUND Not find the SMBIOS table.
-
-**/
-EFI_STATUS
-GetSmbiosSystemGuidAndSerialNumber (
- IN EFI_GUID *SystemGuid,
- OUT CHAR8 **SystemSerialNumber
- )
-{
- EFI_STATUS Status;
- SMBIOS_TABLE_ENTRY_POINT *SmbiosTable;
- SMBIOS_STRUCTURE_POINTER Smbios;
- SMBIOS_STRUCTURE_POINTER SmbiosEnd;
- UINT16 Index;
-
- Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);
-
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- ASSERT (SmbiosTable != NULL);
-
- 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));
- *SystemSerialNumber = GetSmbiosString (&Smbios, Smbios.Type1->SerialNumber);
-
- return EFI_SUCCESS;
- }
- //
- // Make Smbios point to the next record
- //
- GetSmbiosString (&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_SUCCESS;
-}
-
-
-/**
The common notify function associated with various PxeBc events.
@param Event The event signaled.
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h
index 8eb9574e80..96f48f56de 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h
@@ -1,6 +1,6 @@
/** @file
Support routines for PxeBc.
-Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 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
which accompanies this distribution. The full text of the license may be found at
@@ -14,23 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_PXEBC_SUPPORT_H__
#define __EFI_PXEBC_SUPPORT_H__
-/**
- This function gets system guid and serial number from the smbios table.
-
- @param SystemGuid The pointer of returned system guid.
- @param SystemSerialNumber The pointer of returned system serial number.
-
- @retval EFI_SUCCESS Successfully get the system guid and system serial
- number.
- @retval EFI_NOT_FOUND Not find the SMBIOS table.
-
-**/
-EFI_STATUS
-GetSmbiosSystemGuidAndSerialNumber (
- IN EFI_GUID *SystemGuid,
- OUT CHAR8 **SystemSerialNumber
- );
-
/**
The common notify function associated with various PxeBc events.