]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
1.Fix a bug in Dhcp4Dxe driver to correct the ‘secs’ field in DHCP message.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcSupport.c
index 087c2619aa0967956e31fbb046e23bae329f5020..327e4a26d81cad633d30d7aa502d4a4e4ea6ea52 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Support routines for PxeBc.\r
-  \r
-Copyright (c) 2007 - 2009, Intel Corporation.<BR>                                                         \r
-All rights reserved. This program and the accompanying materials\r
+\r
+Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -17,133 +17,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 /**\r
-  This function returns SMBIOS string given the string number.\r
-  \r
-  @param  Smbios              Pointer to SMBIOS structure\r
-  @param  StringNumber        String number to return. 0 is used to skip all\r
-                              strings and  point to the next SMBIOS structure.\r
-\r
-  @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == 0\r
-\r
-**/\r
-CHAR8 *\r
-GetSmbiosString (\r
-  IN  SMBIOS_STRUCTURE_POINTER  *Smbios,\r
-  IN  UINT16                    StringNumber\r
-  )\r
-{\r
-  UINT16  Index;\r
-  CHAR8   *String;\r
-\r
-  //\r
-  // Skip over formatted section\r
-  //\r
-  String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length);\r
-\r
-  //\r
-  // Look through unformated section\r
-  //\r
-  for (Index = 1; Index <= StringNumber || StringNumber == 0; Index++) {\r
-    if (StringNumber == Index) {\r
-      return String;\r
-    }\r
-    //\r
-    // Skip string\r
-    //\r
-    for (; *String != 0; String++)\r
-      ;\r
-    String++;\r
-\r
-    if (*String == 0) {\r
-      //\r
-      // If double NULL then we are done.\r
-      //  Return pointer to next structure in Smbios.\r
-      //  if you pass in a 0 you will always get here\r
-      //\r
-      Smbios->Raw = (UINT8 *)++String;\r
-      return NULL;\r
-    }\r
-  }\r
-\r
-  return NULL;\r
-}\r
-\r
-\r
-/**\r
-  This function gets system guid and serial number from the smbios table.\r
-\r
-  @param  SystemGuid          The pointer of returned system guid.\r
-  @param  SystemSerialNumber  The pointer of returned system serial number.\r
-\r
-  @retval EFI_SUCCESS         Successfully get the system guid and system serial\r
-                              number.\r
-  @retval EFI_NOT_FOUND       Not find the SMBIOS table.\r
-\r
-**/\r
-EFI_STATUS\r
-GetSmbiosSystemGuidAndSerialNumber (\r
-  IN  EFI_GUID  *SystemGuid,\r
-  OUT CHAR8     **SystemSerialNumber\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  SMBIOS_TABLE_ENTRY_POINT  *SmbiosTable;\r
-  SMBIOS_STRUCTURE_POINTER  Smbios;\r
-  SMBIOS_STRUCTURE_POINTER  SmbiosEnd;\r
-  UINT16                    Index;\r
-\r
-  Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-\r
-  Smbios.Hdr    = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress;\r
-  SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength);\r
-\r
-  for (Index = 0; Index < SmbiosTable->TableLength; Index++) {\r
-    if (Smbios.Hdr->Type == 1) {\r
-      if (Smbios.Hdr->Length < 0x19) {\r
-        //\r
-        // Older version did not support Guid and Serial number\r
-        //\r
-        continue;\r
-      }\r
-      //\r
-      // SMBIOS tables are byte packed so we need to do a byte copy to\r
-      // prevend alignment faults on Itanium-based platform.\r
-      //\r
-      CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID));\r
-      *SystemSerialNumber = GetSmbiosString (&Smbios, Smbios.Type1->SerialNumber);\r
-\r
-      return EFI_SUCCESS;\r
-    }\r
-    //\r
-    // Make Smbios point to the next record\r
-    //\r
-    GetSmbiosString (&Smbios, 0);\r
-\r
-    if (Smbios.Raw >= SmbiosEnd.Raw) {\r
-      //\r
-      // SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e.\r
-      // given this we must double check against the length of the structure.\r
-      //\r
-      return EFI_SUCCESS;\r
-    }\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
-  The common notify function associated with various PxeBc events. \r
+  The common notify function associated with various PxeBc events.\r
 \r
   @param  Event     The event signaled.\r
   @param  Context   The context.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -158,13 +36,13 @@ PxeBcCommonNotify (
 \r
 /**\r
   This function initialize(or configure) the Udp4Write instance.\r
-  \r
+\r
   @param  Udp4       Pointer to the EFI_UDP4_PROTOCOL instance.\r
   @param  StationIp  Pointer to the station ip address.\r
   @param  SubnetMask Pointer to the subnetmask of the station ip address.\r
   @param  Gateway    Pointer to the gateway ip address.\r
   @param  SrcPort    Pointer to the srouce port of the station.\r
-  \r
+\r
   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
                                 RARP, etc.) is not finished yet.\r
@@ -179,7 +57,7 @@ PxeBcCommonNotify (
   @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance\r
                                 was not opened.\r
   @retval Others                Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 PxeBcConfigureUdpWriteInstance (\r
@@ -195,7 +73,7 @@ PxeBcConfigureUdpWriteInstance (
 \r
   ZeroMem (&Udp4CfgData, sizeof (Udp4CfgData));\r
 \r
-  Udp4CfgData.ReceiveTimeout = 1000;\r
+  Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;\r
   Udp4CfgData.TypeOfService  = DEFAULT_ToS;\r
   Udp4CfgData.TimeToLive     = DEFAULT_TTL;\r
   Udp4CfgData.AllowDuplicatePort = TRUE;\r