]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
Add 'file not found' debug message to MTFTP.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Impl.c
index 8652ba525651234afd5f9fe4c9b2b9b084172e43..03b7f28171a3e5befa9049ec1f9b7c97f141d401 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Interface routine for Mtftp4.\r
   \r
-Copyright (c) 2006 - 2010, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2014, 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<BR>\r
@@ -58,6 +58,12 @@ Mtftp4CleanOperation (
   }\r
 \r
   if (Instance->McastUdpPort != NULL) {\r
+    gBS->CloseProtocol (\r
+           Instance->McastUdpPort->UdpHandle,\r
+           &gEfiUdp4ProtocolGuid,\r
+           gMtftp4DriverBinding.DriverBindingHandle,\r
+           Instance->Handle\r
+           );\r
     UdpIoFreeIo (Instance->McastUdpPort);\r
     Instance->McastUdpPort = NULL;\r
   }\r
@@ -114,6 +120,7 @@ Mtftp4GetInfoCheckPacket (
   MTFTP4_GETINFO_STATE      *State;\r
   EFI_STATUS                Status;\r
   UINT16                    OpCode;\r
+  EFI_MTFTP4_ERROR_HEADER  *ErrorHeader;\r
 \r
   State   = (MTFTP4_GETINFO_STATE *) Token->Context;\r
   OpCode   = NTOHS (Packet->OpCode);\r
@@ -123,6 +130,12 @@ Mtftp4GetInfoCheckPacket (
   //\r
   switch (OpCode) {\r
   case EFI_MTFTP4_OPCODE_ERROR:\r
+    ErrorHeader = (EFI_MTFTP4_ERROR_HEADER *) Packet;\r
+    if (ErrorHeader->ErrorCode == EFI_MTFTP4_ERRORCODE_FILE_NOT_FOUND) {\r
+      DEBUG ((EFI_D_ERROR, "TFTP error code 1 (File Not Found)\n"));\r
+    } else {\r
+      DEBUG ((EFI_D_ERROR, "TFTP error code %d\n", ErrorHeader->ErrorCode));\r
+    }\r
     State->Status = EFI_TFTP_ERROR;\r
     break;\r
 \r
@@ -936,8 +949,8 @@ EfiMtftp4ReadDirectory (
                                  parameters. If NULL, the default parameters that \r
                                  were set in the EFI_MTFTP4_PROTOCOL.Configure() \r
                                  function are used\r
-  @param  Filename               Pointer to ASCIIZ file name string\r
-  @param  ModeStr                Pointer to ASCIIZ mode string. If NULL, "octet" \r
+  @param  Filename               Pointer to null-terminated ASCII file name string\r
+  @param  ModeStr                Pointer to null-terminated ASCII mode string. If NULL, "octet" \r
                                  will be used\r
   @param  OptionCount            Number of option/value string pairs in OptionList\r
   @param  OptionList             Pointer to array of option/value string pairs. \r
@@ -1073,7 +1086,7 @@ EfiMtftp4Poll (
 \r
   if (Instance->State == MTFTP4_STATE_UNCONFIGED) {\r
     return EFI_NOT_STARTED;\r
-  } else if (Instance->State == MTFTP4_STATE_DESTORY) {\r
+  } else if (Instance->State == MTFTP4_STATE_DESTROY) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r