]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
MdeModulePkg/UefiPxeBcDxe: Refine the PXE boot displayed information
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcSupport.c
index a20fdb7a84aac3f877f15691260a0fa727611a4c..c1cabca8b96a2a7524d5f4c0d5d2d78ada1d0d28 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for PxeBc.\r
 \r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, 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
@@ -79,7 +79,7 @@ PxeBcConfigureUdpWriteInstance (
 \r
   Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;\r
   Udp4CfgData.TypeOfService  = ToS;\r
-  Udp4CfgData.TimeToLive     = TTL;\r
+  Udp4CfgData.TimeToLive     = Ttl;\r
   Udp4CfgData.AllowDuplicatePort = TRUE;\r
 \r
   CopyMem (&Udp4CfgData.StationAddress, StationIp, sizeof (*StationIp));\r
@@ -114,6 +114,26 @@ PxeBcConfigureUdpWriteInstance (
   return Status;\r
 }\r
 \r
+/**\r
+  This function is to display the IPv4 address.\r
+\r
+  @param[in]  Ip        The pointer to the IPv4 address.\r
+\r
+**/\r
+VOID\r
+PxeBcShowIp4Addr (\r
+  IN EFI_IPv4_ADDRESS   *Ip\r
+  )\r
+{\r
+  UINTN                 Index;\r
+\r
+  for (Index = 0; Index < 4; Index++) {\r
+    AsciiPrint ("%d", Ip->Addr[Index]);\r
+    if (Index < 3) {\r
+      AsciiPrint (".");\r
+    }\r
+  }\r
+}\r
 \r
 /**\r
   Convert number to ASCII value.\r
@@ -132,11 +152,10 @@ CvtNum (
 {\r
   UINTN Remainder;\r
 \r
-  while (Length > 0) {\r
+  for (; Length > 0; Length--) {\r
     Remainder = Number % 10;\r
     Number /= 10;\r
-    Length--;\r
-    Buffer[Length] = (UINT8) ('0' + Remainder);\r
+    Buffer[Length - 1] = (UINT8) ('0' + Remainder);\r
   }\r
 }\r
 \r