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

@@ -55,6 +55,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/Http.h>
#include <Protocol/Ip4Config2.h>
#include <Protocol/Ip6Config.h>
#include <Protocol/RamDisk.h>
//
// Produced Protocols
//
@@ -70,6 +71,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
#define HTTP_BOOT_DXE_VERSION 0xa
//
// Provisional Standard Media Types defined in
// http://www.iana.org/assignments/provisional-standard-media-types/provisional-standard-media-types.xhtml
//
#define HTTP_CONTENT_TYPE_APP_EFI "application/efi"
//
// Protocol instances
//
@@ -83,6 +90,13 @@ extern EFI_COMPONENT_NAME_PROTOCOL gHttpBootDxeComponentName;
typedef struct _HTTP_BOOT_PRIVATE_DATA HTTP_BOOT_PRIVATE_DATA;
typedef struct _HTTP_BOOT_VIRTUAL_NIC HTTP_BOOT_VIRTUAL_NIC;
typedef enum {
ImageTypeEfi,
ImageTypeVirtualCd,
ImageTypeVirtualDisk,
ImageTypeMax
} HTTP_BOOT_IMAGE_TYPE;
//
// Include files with internal function prototypes
//
@@ -166,6 +180,11 @@ struct _HTTP_BOOT_PRIVATE_DATA {
EFI_IP_ADDRESS GatewayIp;
EFI_IP_ADDRESS ServerIp;
UINT16 Port;
//
// The URI string attempt to download through HTTP, may point to
// the memory in cached DHCP offer, or to the memory in FilePathUri.
//
CHAR8 *BootFileUri;
VOID *BootFileUriParser;
UINTN BootFileSize;