]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcDhcp.c
index f0720e5a8cf2a89ffb014da5099eb2b96bbf0cb9..f7b975f2997f19db2a328c2aaf423f090d7659bf 100644 (file)
@@ -2,7 +2,7 @@
   Support for PxeBc dhcp functions.\r
 \r
 Copyright (c) 2013, Red Hat, Inc.\r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2018, 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
@@ -171,7 +171,7 @@ PxeBcParseCachedDhcpPacket (
                        );\r
   }\r
   //\r
-  // Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132. \r
+  // Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132.\r
   // If yes, try to parse options from the BootFileName field, then ServerName field.\r
   //\r
   Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD];\r
@@ -229,7 +229,7 @@ PxeBcParseCachedDhcpPacket (
   //\r
   if (Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) {\r
     //\r
-    // RFC 2132, Section 9.5 does not strictly state Bootfile name (option 67) is null \r
+    // RFC 2132, Section 9.5 does not strictly state Bootfile name (option 67) is null\r
     // terminated string. So force to append null terminated character at the end of string.\r
     //\r
     Ptr8 =  (UINT8*)&Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data[0];\r
@@ -685,7 +685,7 @@ PxeBcCacheDhcpOffer (
 \r
 **/\r
 EFI_STATUS\r
-PxeBcSetIp4Policy (   \r
+PxeBcSetIp4Policy (\r
   IN PXEBC_PRIVATE_DATA            *Private\r
   )\r
 {\r
@@ -705,7 +705,7 @@ PxeBcSetIp4Policy (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   if (Policy != Ip4Config2PolicyStatic) {\r
     Policy = Ip4Config2PolicyStatic;\r
     Status= Ip4Config2->SetData (\r
@@ -716,7 +716,7 @@ PxeBcSetIp4Policy (
                           );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
-    } \r
+    }\r
   }\r
 \r
   return  EFI_SUCCESS;\r
@@ -943,7 +943,7 @@ PxeBcDhcpCallBack (
       Status = EFI_ABORTED;\r
       break;\r
     }\r
-    \r
+\r
     if (Mode->SendGUID) {\r
       //\r
       // send the system GUID instead of the MAC address as the hardware address\r
@@ -957,6 +957,7 @@ PxeBcDhcpCallBack (
         // SetMem(DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof(EFI_GUID), 0xff);\r
         // GUID not yet set - send all 0's to show not programable\r
         //\r
+        DEBUG ((EFI_D_WARN, "PXE: Failed to read system GUID from the smbios table!\n"));\r
         ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));\r
       }\r
 \r
@@ -980,7 +981,7 @@ PxeBcDhcpCallBack (
       //\r
       break;\r
     }\r
-    \r
+\r
     if (Private->NumOffers < PXEBC_MAX_OFFER_NUM) {\r
       //\r
       // Cache the dhcp offers in Private->Dhcp4Offers[]\r
@@ -1133,6 +1134,7 @@ PxeBcBuildDhcpOptions (
     // SetMem(DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof(EFI_GUID), 0xff);\r
     // GUID not yet set - send all 0's to show not programable\r
     //\r
+    DEBUG ((EFI_D_WARN, "PXE: Failed to read system GUID from the smbios table!\n"));\r
     ZeroMem (OptEnt.Uuid->Guid, sizeof (EFI_GUID));\r
   }\r
 \r
@@ -1301,6 +1303,7 @@ PxeBcDiscvBootService (
       //\r
       // GUID not yet set - send all 0's to show not programable\r
       //\r
+      DEBUG ((EFI_D_WARN, "PXE: Failed to read system GUID from the smbios table!\n"));\r
       ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));\r
     }\r
 \r
@@ -1666,12 +1669,12 @@ PxeBcSelectBootPrompt (
 \r
   VendorOpt = &Packet->PxeVendorOption;\r
   //\r
-  // According to the PXE specification 2.1, Table 2-1 PXE DHCP Options  (Full  \r
-  // List), we must not consider a boot prompt or boot menu if all of the  \r
+  // According to the PXE specification 2.1, Table 2-1 PXE DHCP Options  (Full\r
+  // List), we must not consider a boot prompt or boot menu if all of the\r
   // following hold:\r
   // - the PXE_DISCOVERY_CONTROL PXE tag is present inside the Vendor Options\r
   //   (=43) DHCP tag, and\r
-  // - the PXE_DISCOVERY_CONTROL PXE tag has bit 3 set, and  \r
+  // - the PXE_DISCOVERY_CONTROL PXE tag has bit 3 set, and\r
   // - a boot file name has been presented with DHCP option 67.\r
   //\r
   if (IS_DISABLE_PROMPT_MENU (VendorOpt->DiscoverCtrl) &&\r
@@ -1845,7 +1848,7 @@ PxeBcSelectBootMenu (
   PXEBC_BOOT_MENU_ENTRY      *MenuArray[PXEBC_MAX_MENU_NUM];\r
 \r
   Finish  = FALSE;\r
-  Select  = 1;\r
+  Select  = 0;\r
   Index   = 0;\r
   *Type   = 0;\r
 \r
@@ -1914,7 +1917,7 @@ PxeBcSelectBootMenu (
       gBS->Stall (10 * TICKS_PER_MS);\r
     }\r
 \r
-    if (InputKey.ScanCode != 0) {\r
+    if (InputKey.ScanCode == 0) {\r
       switch (InputKey.UnicodeChar) {\r
       case CTRL ('c'):\r
         InputKey.ScanCode = SCAN_ESC;\r