]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Print error message to screen if error occurs during HTTP boot.
authorFu Siyuan <siyuan.fu@intel.com>
Mon, 13 Nov 2017 07:20:37 +0000 (15:20 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Thu, 16 Nov 2017 06:08:18 +0000 (14:08 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
NetworkPkg/HttpBootDxe/HttpBootImpl.c
NetworkPkg/HttpBootDxe/HttpBootSupport.c
NetworkPkg/HttpDxe/HttpImpl.c

index 06a8a6a386155fef8f852f483ec721d4acfcf37b..d591db5bd421ddec250f988480e1c48777b039c7 100644 (file)
@@ -327,6 +327,7 @@ HttpBootLoadFile (
     //\r
     Status = HttpBootDiscoverBootInfo (Private);\r
     if (EFI_ERROR (Status)) {\r
+      AsciiPrint ("\n  Error: Could not discover the boot information for DHCP server.\n");\r
       goto ON_EXIT;\r
     }\r
   }\r
@@ -369,6 +370,7 @@ HttpBootLoadFile (
                  &Private->ImageType\r
                  );\r
       if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {\r
+        AsciiPrint ("\n  Error: Could not retrieve NBP file size from HTTP server.\n");\r
         goto ON_EXIT;\r
       }\r
     }\r
@@ -394,6 +396,22 @@ HttpBootLoadFile (
   \r
 ON_EXIT:\r
   HttpBootUninstallCallback (Private);\r
+\r
+  if (Status == EFI_ACCESS_DENIED) {\r
+    AsciiPrint ("\n  Error: Could not establish connection with HTTP server.\n");\r
+  } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {\r
+    AsciiPrint ("\n  Error: Buffer size is smaller than the requested file.\n");\r
+  } else if (Status == EFI_OUT_OF_RESOURCES) {\r
+    AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");\r
+  } else if (Status == EFI_DEVICE_ERROR) {\r
+    AsciiPrint ("\n  Error: Network device error.\n");\r
+  } else if (Status == EFI_TIMEOUT) {\r
+    AsciiPrint ("\n  Error: Server response timeout.\n");\r
+  } else if (Status == EFI_ABORTED) {\r
+    AsciiPrint ("\n  Error: Remote boot cancelled.\n");\r
+  } else if (Status != EFI_BUFFER_TOO_SMALL) {\r
+    AsciiPrint ("\n  Error: Unexpected network error.\n");\r
+  }\r
   return Status;\r
 }\r
 \r
@@ -555,6 +573,7 @@ HttpBootDxeLoadFile (
   MediaPresent = TRUE;\r
   NetLibDetectMedia (Private->Controller, &MediaPresent);\r
   if (!MediaPresent) {\r
+    AsciiPrint ("\n  Error: Could not detect network connection.\n");\r
     return EFI_NO_MEDIA;\r
   }\r
   \r
@@ -595,6 +614,8 @@ HttpBootDxeLoadFile (
     Status = HttpBootRegisterRamDisk (Private, *BufferSize, Buffer, ImageType);\r
     if (!EFI_ERROR (Status)) {\r
       Status = EFI_WARN_FILE_SYSTEM;\r
+    } else {\r
+      AsciiPrint ("\n  Error: Could not register RAM disk to the system.\n");\r
     }\r
   }\r
 \r
index d508e2c1a979f85df8ace5f4a5c2940bdfb2c921..7ca48f33d7b7d8716f64dfdfda63ce9a73028f83 100644 (file)
@@ -1093,6 +1093,7 @@ HttpBootCheckUriScheme (
   // Return EFI_INVALID_PARAMETER if the URI is not HTTP or HTTPS.\r
   //\r
   if ((AsciiStrnCmp (Uri, "http://", 7) != 0) && (AsciiStrnCmp (Uri, "https://", 8) != 0)) {\r
+    AsciiPrint ("\n  Error: Invalid URI address.\n");\r
     DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: Invalid Uri.\n"));\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -1101,6 +1102,7 @@ HttpBootCheckUriScheme (
   // HTTP is disabled, return EFI_ACCESS_DENIED if the URI is HTTP.\r
   //\r
   if (!PcdGetBool (PcdAllowHttpConnections) && (AsciiStrnCmp (Uri, "http://", 7) == 0)) {\r
+    AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");\r
     DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: HTTP is disabled.\n"));\r
     return EFI_ACCESS_DENIED;\r
   }\r
index 46d0323050e7ab4375173e7e9c18b1acd2f5b626..57fa39f094e8b8a5d0377272fa0421d767362809 100644 (file)
@@ -523,6 +523,7 @@ EfiHttpRequest (
       \r
       FreePool (HostNameStr);\r
       if (EFI_ERROR (Status)) {\r
+        DEBUG ((EFI_D_ERROR, "Error: Could not retrieve the host address from DNS server.\n"));\r
         goto Error1;\r
       }\r
     }\r