]> 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 3c68235d4236fc76c6de28f37f0f59850f44c3b3..03b7f28171a3e5befa9049ec1f9b7c97f141d401 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Interface routine for Mtftp4.\r
   \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\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
@@ -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
@@ -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