]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
Fix X64 clang warnings.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiDhcp.c
index 996a29061049eaf4102f6f5c82d25b2f3a2706bf..79e70934e6c83d726b3732204149bbbd82ab210a 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   iSCSI DHCP related configuration routines.\r
 \r
-Copyright (c) 2004 - 2009, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2010, 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
@@ -235,7 +235,7 @@ IScsiDhcpSelectOffer (
     break;\r
   }\r
 \r
-  if ((Index == OptionCount)) {\r
+  if (Index == OptionCount) {\r
     Status = EFI_NOT_READY;\r
   }\r
 \r
@@ -344,7 +344,9 @@ IScsiParseDhcpAck (
 \r
   @retval EFI_SUCCESS           The DNS information is got from the DHCP ACK.\r
   @retval EFI_OUT_OF_RESOURCES  Failed to allocate memory.\r
+  @retval EFI_NO_MEDIA          There was a media error.\r
   @retval Others                Other errors as indicated.\r
+\r
 **/\r
 EFI_STATUS\r
 IScsiDoDhcp (\r
@@ -358,11 +360,22 @@ IScsiDoDhcp (
   EFI_STATUS              Status;\r
   EFI_DHCP4_PACKET_OPTION *ParaList;\r
   EFI_DHCP4_CONFIG_DATA   Dhcp4ConfigData;\r
+  BOOLEAN                 MediaPresent;\r
+  UINT8                   *Data;\r
 \r
   Dhcp4Handle = NULL;\r
   Dhcp4       = NULL;\r
   ParaList    = NULL;\r
 \r
+  //\r
+  // Check media status before do DHCP\r
+  //\r
+  MediaPresent = TRUE;\r
+  NetLibDetectMedia (Controller, &MediaPresent);\r
+  if (!MediaPresent) {\r
+    return EFI_NO_MEDIA;\r
+  }\r
+\r
   //\r
   // Create a DHCP4 child instance and get the protocol.\r
   //\r
@@ -398,10 +411,11 @@ IScsiDoDhcp (
   //\r
   ParaList->OpCode  = DHCP4_TAG_PARA_LIST;\r
   ParaList->Length  = (UINT8) (ConfigData->NvData.TargetInfoFromDhcp ? 4 : 3);\r
-  ParaList->Data[0] = DHCP4_TAG_NETMASK;\r
-  ParaList->Data[1] = DHCP4_TAG_ROUTER;\r
-  ParaList->Data[2] = DHCP4_TAG_DNS;\r
-  ParaList->Data[3] = DHCP4_TAG_ROOT_PATH;\r
+  Data = &ParaList->Data[0];\r
+  Data[0] = DHCP4_TAG_NETMASK;\r
+  Data[1] = DHCP4_TAG_ROUTER;\r
+  Data[2] = DHCP4_TAG_DNS;\r
+  Data[3] = DHCP4_TAG_ROOT_PATH;\r
 \r
   ZeroMem (&Dhcp4ConfigData, sizeof (EFI_DHCP4_CONFIG_DATA));\r
   Dhcp4ConfigData.OptionCount = 1;\r