NetworkPkg: Add RAM disk boot support to HTTP Boot driver.

This patch updates the HTTP Boot driver to support the download and boot
a RAM disk image from HTTP server.
The HTTP RAM disk boot is described in section 23.7 "HTTP Boot" in
UEFI 2.6. HTTP server could provide either an UEFI image or a RAM disk image
for the HTTP boot client to use. The RAM disk image must contain a UEFI
compliant file system in it.
HTTP boot driver will identify the image type either by the "Content-Type"
entity header filed or by the file name extension as below:
  "application/efi" or *.efi -> EFI Image
  *.iso                      -> CD/DVD Image
  *.img                      -> Virtual Disk Image

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com>
This commit is contained in:
Fu Siyuan
2016-03-22 13:30:58 +08:00
parent 64ee6ed72a
commit 587d204ccd
7 changed files with 334 additions and 55 deletions

View File

@ -347,4 +347,51 @@ HttpBootParseFilePath (
OUT CHAR8 **UriAddress
);
/**
This function returns the image type according to server replied HTTP message
and also the image's URI info.
@param[in] Uri The pointer to the image's URI string.
@param[in] UriParser URI Parse result returned by NetHttpParseUrl().
@param[in] HeaderCount Number of HTTP header structures in Headers list.
@param[in] Headers Array containing list of HTTP headers.
@param[out] ImageType The image type of the downloaded file.
@retval EFI_SUCCESS The image type is returned in ImageType.
@retval EFI_INVALID_PARAMETER ImageType, Uri or UriParser is NULL.
@retval EFI_INVALID_PARAMETER HeaderCount is not zero, and Headers is NULL.
@retval EFI_NOT_FOUND Failed to identify the image type.
@retval Others Unexpect error happened.
**/
EFI_STATUS
HttpBootCheckImageType (
IN CHAR8 *Uri,
IN VOID *UriParser,
IN UINTN HeaderCount,
IN EFI_HTTP_HEADER *Headers,
OUT HTTP_BOOT_IMAGE_TYPE *ImageType
);
/**
This function register the RAM disk info to the system.
@param[in] Private The pointer to the driver's private data.
@param[in] BufferSize The size of Buffer in bytes.
@param[in] Buffer The base address of the RAM disk.
@param[in] ImageType The image type of the file in Buffer.
@retval EFI_SUCCESS The RAM disk has been registered.
@retval EFI_NOT_FOUND No RAM disk protocol instances were found.
@retval EFI_UNSUPPORTED The ImageType is not supported.
@retval Others Unexpected error happened.
**/
EFI_STATUS
HttpBootRegisterRamDisk (
IN HTTP_BOOT_PRIVATE_DATA *Private,
IN UINTN BufferSize,
IN VOID *Buffer,
IN HTTP_BOOT_IMAGE_TYPE ImageType
);
#endif