/** @file\r
The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.\r
\r
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials are licensed and made available under \r
the terms and conditions of the BSD License that accompanies this distribution. \r
UINTN Index;\r
EFI_STATUS Status;\r
CHAR8 *Uri;\r
- \r
\r
+ Uri = NULL;\r
+ \r
if (Private == NULL || FilePath == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
Status = HttpBootStop (Private);\r
if (EFI_ERROR (Status)) {\r
+ if (Uri != NULL) {\r
+ FreePool (Uri);\r
+ }\r
return Status;\r
}\r
} else {\r
//\r
Status = HttpBootDiscoverBootInfo (Private);\r
if (EFI_ERROR (Status)) {\r
+ AsciiPrint ("\n Error: Could not retrieve NBP file size from HTTP server.\n");\r
goto ON_EXIT;\r
}\r
}\r
&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
\r
ON_EXIT:\r
HttpBootUninstallCallback (Private);\r
+ \r
+ if (EFI_ERROR (Status)) {\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
+ }\r
+ \r
return Status;\r
}\r
\r
{\r
HTTP_BOOT_PRIVATE_DATA *Private;\r
HTTP_BOOT_VIRTUAL_NIC *VirtualNic;\r
- BOOLEAN MediaPresent;\r
+ EFI_STATUS MediaStatus;\r
BOOLEAN UsingIpv6;\r
EFI_STATUS Status;\r
HTTP_BOOT_IMAGE_TYPE ImageType;\r
//\r
// Check media status before HTTP boot start\r
//\r
- MediaPresent = TRUE;\r
- NetLibDetectMedia (Private->Controller, &MediaPresent);\r
- if (!MediaPresent) {\r
+ MediaStatus = EFI_SUCCESS;\r
+ NetLibDetectMediaWaitTimeout (Private->Controller, HTTP_BOOT_CHECK_MEDIA_WAITING_TIME, &MediaStatus);\r
+ if (MediaStatus != EFI_SUCCESS) {\r
+ AsciiPrint ("\n Error: Could not detect network connection.\n");\r
return EFI_NO_MEDIA;\r
}\r
\r
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
if (HttpHeader != NULL) {\r
Print (L"\n HTTP ERROR: Resource Redirected.\n New Location: %a\n", HttpHeader->FieldValue);\r
}\r
+ break; \r
}\r
}\r
\r