]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Update tftp to build with current tip
authorJaben Carsey <jaben.carsey@intel.com>
Thu, 24 Sep 2015 20:44:59 +0000 (20:44 +0000)
committerjcarsey <jcarsey@Edk2>
Thu, 24 Sep 2015 20:44:59 +0000 (20:44 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18543 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.h
ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.uni

index d2f7046de037cdcaacce7a7265f4cbd2ca4e3e0d..2dc9287020d7d7d9b43496d25b57188c70b57e78 100644 (file)
@@ -2,6 +2,8 @@
   The implementation for the 'tftp' Shell command.\r
 \r
   Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2015, Intel Corporation. All rights reserved. <BR>\r
+  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -14,6 +16,8 @@
 \r
 #include "UefiShellTftpCommandLib.h"\r
 \r
+#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32\r
+\r
 /*\r
    Constant strings and definitions related to the message indicating the amount of\r
    progress in the dowloading of a TFTP file.\r
@@ -59,7 +63,8 @@ StringToUint16 (
   @param[in]   NicNumber         The network physical device number.\r
   @param[out]  NicName           Address where to store the NIC name.\r
                                  The memory area has to be at least\r
-                                 IP4_NIC_NAME_LENGTH bytes wide.\r
+                                 IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH \r
+                                 double byte wide.\r
 \r
   @return  EFI_SUCCESS  The name of the NIC was returned.\r
   @return  Others       The creation of the child for the Managed\r
@@ -258,7 +263,7 @@ ShellCommandRunTftp (
   EFI_HANDLE              *Handles;\r
   UINTN                   HandleCount;\r
   UINTN                   NicNumber;\r
-  CHAR16                  NicName[IP4_NIC_NAME_LENGTH];\r
+  CHAR16                  NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH];\r
   EFI_HANDLE              ControllerHandle;\r
   EFI_HANDLE              Mtftp4ChildHandle;\r
   EFI_MTFTP4_PROTOCOL     *Mtftp4;\r
@@ -271,6 +276,7 @@ ShellCommandRunTftp (
   NicFound            = FALSE;\r
   AsciiRemoteFilePath = NULL;\r
   Handles             = NULL;\r
+  FileSize            = 0;\r
 \r
   //\r
   // Initialize the Shell library (we must be in non-auto-init...)\r
@@ -571,7 +577,7 @@ StringToUint16 (
     return FALSE;\r
   }\r
 \r
-  *Value = Val;\r
+  *Value = (UINT16)Val;\r
   return TRUE;\r
 }\r
 \r
@@ -582,7 +588,8 @@ StringToUint16 (
   @param[in]   NicNumber         The network physical device number.\r
   @param[out]  NicName           Address where to store the NIC name.\r
                                  The memory area has to be at least\r
-                                 IP4_NIC_NAME_LENGTH bytes wide.\r
+                                 IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH \r
+                                 double byte wide.\r
 \r
   @return  EFI_SUCCESS  The name of the NIC was returned.\r
   @return  Others       The creation of the child for the Managed\r
@@ -623,7 +630,7 @@ GetNicName (
 \r
   UnicodeSPrint (\r
     NicName,\r
-    IP4_NIC_NAME_LENGTH,\r
+    IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH,\r
     SnpMode.IfType == NET_IFTYPE_ETHERNET ?\r
     L"eth%d" :\r
     L"unk%d" ,\r
@@ -942,7 +949,7 @@ CheckPacket (
 {\r
   DOWNLOAD_CONTEXT  *Context;\r
   CHAR16            Progress[TFTP_PROGRESS_MESSAGE_SIZE];\r
-  UINT64            NbOfKb;\r
+  UINT            NbOfKb;\r
   UINTN             Index;\r
   UINTN             LastStep;\r
   UINTN             Step;\r
@@ -966,10 +973,9 @@ CheckPacket (
   NbOfKb = Context->DownloadedNbOfBytes / 1024;\r
 \r
   Progress[0] = L'\0';\r
-  LastStep  = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) /\r
-              Context->FileSize;\r
-  Step      = (Context->DownloadedNbOfBytes   * TFTP_PROGRESS_SLIDER_STEPS) /\r
-              Context->FileSize;\r
+  LastStep  = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;\r
+  Step      = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;\r
+\r
   if (Step <= LastStep) {\r
     return EFI_SUCCESS;\r
   }\r
index a73b86c85b12e0aa1b612f1402fefad18c3ee190..bef1e1d9f74db3edc11df0382d72d6639bc808dd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   header file for NULL named library for 'tftp' Shell command functions.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved. <BR>\r
   Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
@@ -21,7 +21,6 @@
 #include <ShellBase.h>\r
 \r
 #include <Guid/ShellLibHiiGuid.h>\r
-#include <Guid/NicIp4ConfigNvData.h>\r
 \r
 #include <Protocol/ServiceBinding.h>\r
 #include <Protocol/Mtftp4.h>\r
@@ -42,9 +41,9 @@
 extern EFI_HANDLE gShellTftpHiiHandle;\r
 \r
 typedef struct {\r
-  UINT64  FileSize;\r
-  UINT64  DownloadedNbOfBytes;\r
-  UINT64  LastReportedNbOfBytes;\r
+  UINTN  FileSize;\r
+  UINTN  DownloadedNbOfBytes;\r
+  UINTN  LastReportedNbOfBytes;\r
 } DOWNLOAD_CONTEXT;\r
 \r
 /**\r
index 607a3602d2a3aad30619c0844162e7399c0aba9a..43b8cc5e7cd8726138c600b96b4ebbb1c960824c 100644 (file)
Binary files a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.uni and b/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.uni differ