TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpBootImpl.c File Reference
#include "HttpBootDxe.h"

Go to the source code of this file.

Functions

EFI_STATUS HttpBootInstallCallback (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
VOID HttpBootUninstallCallback (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootStart (IN HTTP_BOOT_PRIVATE_DATA *Private, IN BOOLEAN UsingIpv6, IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
 
EFI_STATUS HttpBootDhcp (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootGetBootFileCaller (IN HTTP_BOOT_PRIVATE_DATA *Private, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL, OUT HTTP_BOOT_IMAGE_TYPE *ImageType)
 
EFI_STATUS HttpBootLoadFile (IN HTTP_BOOT_PRIVATE_DATA *Private, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL, OUT HTTP_BOOT_IMAGE_TYPE *ImageType)
 
EFI_STATUS HttpBootStop (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS EFIAPI HttpBootDxeLoadFile (IN EFI_LOAD_FILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
 
EFI_STATUS EFIAPI HttpBootCallback (IN EFI_HTTP_BOOT_CALLBACK_PROTOCOL *This, IN EFI_HTTP_BOOT_CALLBACK_DATA_TYPE DataType, IN BOOLEAN Received, IN UINT32 DataLength, IN VOID *Data OPTIONAL)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOAD_FILE_PROTOCOL gHttpBootDxeLoadFile
 
GLOBAL_REMOVE_IF_UNREFERENCED EFI_HTTP_BOOT_CALLBACK_PROTOCOL gHttpBootDxeHttpBootCallback
 

Detailed Description

The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.

Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file HttpBootImpl.c.

Function Documentation

◆ HttpBootCallback()

EFI_STATUS EFIAPI HttpBootCallback ( IN EFI_HTTP_BOOT_CALLBACK_PROTOCOL This,
IN EFI_HTTP_BOOT_CALLBACK_DATA_TYPE  DataType,
IN BOOLEAN  Received,
IN UINT32  DataLength,
IN VOID *Data  OPTIONAL 
)

Callback function that is invoked when the HTTP Boot driver is about to transmit or has received a packet.

This function is invoked when the HTTP Boot driver is about to transmit or has received packet. Parameters DataType and Received specify the type of event and the format of the buffer pointed to by Data. Due to the polling nature of UEFI device drivers, this callback function should not execute for more than 5 ms. The returned status code determines the behavior of the HTTP Boot driver.

Parameters
[in]ThisPointer to the EFI_HTTP_BOOT_CALLBACK_PROTOCOL instance.
[in]DataTypeThe event that occurs in the current state.
[in]ReceivedTRUE if the callback is being invoked due to a receive event. FALSE if the callback is being invoked due to a transmit event.
[in]DataLengthThe length in bytes of the buffer pointed to by Data.
[in]DataA pointer to the buffer of data, the data type is specified by DataType.
Return values
EFI_SUCCESSTells the HTTP Boot driver to continue the HTTP Boot process.
EFI_ABORTEDTells the HTTP Boot driver to abort the current HTTP Boot process.

Definition at line 786 of file HttpBootImpl.c.

◆ HttpBootDhcp()

EFI_STATUS HttpBootDhcp ( IN HTTP_BOOT_PRIVATE_DATA Private)

Attempt to complete a DHCPv4 D.O.R.A or DHCPv6 S.R.A.A sequence to retrieve the boot resource information.

Parameters
[in]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSBoot info was successfully retrieved.
EFI_INVALID_PARAMETERPrivate is NULL.
EFI_NOT_STARTEDThe driver is in stopped state.
EFI_DEVICE_ERRORAn unexpected network error occurred.
OthersOther errors as indicated.

Definition at line 254 of file HttpBootImpl.c.

◆ HttpBootDxeLoadFile()

EFI_STATUS EFIAPI HttpBootDxeLoadFile ( IN EFI_LOAD_FILE_PROTOCOL This,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN BOOLEAN  BootPolicy,
IN OUT UINTN BufferSize,
IN VOID *Buffer  OPTIONAL 
)

Causes the driver to load a specified file.

Parameters
ThisProtocol instance pointer.
FilePathThe device specific path of the file to load.
BootPolicyIf TRUE, indicates that the request originates from the boot manager is attempting to load FilePath as a boot selection. If FALSE, then FilePath must match as exact file to be loaded.
BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
BufferThe memory buffer to transfer the file to. IF Buffer is NULL, then the size of the requested file is returned in BufferSize.
Return values
EFI_SUCCESSThe file was loaded.
EFI_UNSUPPORTEDThe device does not support the provided BootPolicy
EFI_INVALID_PARAMETERFilePath is not a valid device path, or BufferSize is NULL.
EFI_NO_MEDIANo medium was present to load the file.
EFI_DEVICE_ERRORThe file was not loaded due to a device error.
EFI_NO_RESPONSEThe remote system did not respond.
EFI_NOT_FOUNDThe file was not found.
EFI_ABORTEDThe file load process was manually cancelled.
EFI_BUFFER_TOO_SMALLThe BufferSize is too small to read the current directory entry. BufferSize has been updated with the size needed to complete the request.

Definition at line 666 of file HttpBootImpl.c.

◆ HttpBootGetBootFileCaller()

EFI_STATUS HttpBootGetBootFileCaller ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN OUT UINTN BufferSize,
IN VOID *Buffer  OPTIONAL,
OUT HTTP_BOOT_IMAGE_TYPE *  ImageType 
)

Issue calls to HttpBootGetBootFile() based on current Boot File State

Parameters
[in]PrivateThe pointer to the driver's private data.
[in,out]BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
[in]BufferThe memory buffer to transfer the file to. If Buffer is NULL, then the size of the requested file is returned in BufferSize.
[out]ImageTypeThe image type of the downloaded file.
Return values
EFI_SUCCESSThe file was loaded.
EFI_INVALID_PARAMETERBufferSize is NULL or Buffer Size is not NULL but Buffer is NULL.
EFI_OUT_OF_RESOURCESCould not allocate needed resources
EFI_BUFFER_TOO_SMALLThe BufferSize is too small to read the current directory entry. BufferSize has been updated with the size needed to complete the request.
EFI_ACCESS_DENIEDServer authentication failed.
OthersUnexpected error happened.

Definition at line 306 of file HttpBootImpl.c.

◆ HttpBootInstallCallback()

EFI_STATUS HttpBootInstallCallback ( IN HTTP_BOOT_PRIVATE_DATA Private)

Install HTTP Boot Callback Protocol if not installed before.

Parameters
[in]PrivatePointer to HTTP Boot private data.
Return values
EFI_SUCCESSHTTP Boot Callback Protocol installed successfully.
OthersFailed to install HTTP Boot Callback Protocol.

Definition at line 22 of file HttpBootImpl.c.

◆ HttpBootLoadFile()

EFI_STATUS HttpBootLoadFile ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN OUT UINTN BufferSize,
IN VOID *Buffer  OPTIONAL,
OUT HTTP_BOOT_IMAGE_TYPE *  ImageType 
)

Attempt to download the boot file through HTTP message exchange.

Parameters
[in]PrivateThe pointer to the driver's private data.
[in,out]BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
[in]BufferThe memory buffer to transfer the file to. If Buffer is NULL, then the size of the requested file is returned in BufferSize.
[out]ImageTypeThe image type of the downloaded file.
Return values
EFI_SUCCESSBoot file was loaded successfully.
EFI_INVALID_PARAMETERPrivate is NULL, or ImageType is NULL, or BufferSize is NULL.
EFI_INVALID_PARAMETER*BufferSize is not zero, and Buffer is NULL.
EFI_NOT_STARTEDThe driver is in stopped state.
EFI_BUFFER_TOO_SMALLThe BufferSize is too small to read the boot file. BufferSize has been updated with the size needed to complete the request.
EFI_DEVICE_ERRORAn unexpected network error occurred.
OthersOther errors as indicated.

Definition at line 451 of file HttpBootImpl.c.

◆ HttpBootStart()

EFI_STATUS HttpBootStart ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN BOOLEAN  UsingIpv6,
IN EFI_DEVICE_PATH_PROTOCOL FilePath 
)

Enable the use of UEFI HTTP boot function.

If the driver has already been started but not satisfy the requirement (IP stack and specified boot file path), this function will stop the driver and start it again.

Parameters
[in]PrivateThe pointer to the driver's private data.
[in]UsingIpv6Specifies the type of IP addresses that are to be used during the session that is being started. Set to TRUE for IPv6, and FALSE for IPv4.
[in]FilePathThe device specific path of the file to load.
Return values
EFI_SUCCESSHTTP boot was successfully enabled.
EFI_INVALID_PARAMETERPrivate is NULL or FilePath is NULL.
EFI_INVALID_PARAMETERThe FilePath doesn't contain a valid URI device path node.
EFI_ALREADY_STARTEDThe driver is already in started state.
EFI_OUT_OF_RESOURCESThere are not enough resources.

Definition at line 118 of file HttpBootImpl.c.

◆ HttpBootStop()

EFI_STATUS HttpBootStop ( IN HTTP_BOOT_PRIVATE_DATA Private)

Disable the use of UEFI HTTP boot function.

Parameters
[in]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSHTTP boot was successfully disabled.
EFI_NOT_STARTEDThe driver is already in stopped state.
EFI_INVALID_PARAMETERPrivate is NULL.
OthersUnexpected error when stop the function.

Definition at line 539 of file HttpBootImpl.c.

◆ HttpBootUninstallCallback()

VOID HttpBootUninstallCallback ( IN HTTP_BOOT_PRIVATE_DATA Private)

Uninstall HTTP Boot Callback Protocol if it's installed by this driver.

Parameters
[in]PrivatePointer to HTTP Boot private data.

Definition at line 76 of file HttpBootImpl.c.

Variable Documentation

◆ gHttpBootDxeHttpBootCallback

Initial value:
= {
}
EFI_STATUS EFIAPI HttpBootCallback(IN EFI_HTTP_BOOT_CALLBACK_PROTOCOL *This, IN EFI_HTTP_BOOT_CALLBACK_DATA_TYPE DataType, IN BOOLEAN Received, IN UINT32 DataLength, IN VOID *Data OPTIONAL)
Definition: HttpBootImpl.c:786

HTTP Boot Callback Protocol instance

Definition at line 907 of file HttpBootImpl.c.

◆ gHttpBootDxeLoadFile

Initial value:
= {
}
EFI_STATUS EFIAPI HttpBootDxeLoadFile(IN EFI_LOAD_FILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
Definition: HttpBootImpl.c:666

Load File Protocol instance

Definition at line 759 of file HttpBootImpl.c.