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

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI EfiPxeBcStart (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN UseIpv6)
 
EFI_STATUS EFIAPI EfiPxeBcStop (IN EFI_PXE_BASE_CODE_PROTOCOL *This)
 
EFI_STATUS EFIAPI EfiPxeBcDhcp (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN SortOffers)
 
EFI_STATUS EFIAPI EfiPxeBcDiscover (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL)
 
EFI_STATUS EFIAPI EfiPxeBcMtftp (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT VOID *BufferPtr OPTIONAL, IN BOOLEAN Overwrite, IN OUT UINT64 *BufferSize, IN UINTN *BlockSize OPTIONAL, IN EFI_IP_ADDRESS *ServerIp, IN UINT8 *Filename, IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL, IN BOOLEAN DontUseBuffer)
 
EFI_STATUS EFIAPI EfiPxeBcUdpWrite (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN UINT16 OpFlags, IN EFI_IP_ADDRESS *DestIp, IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, IN EFI_IP_ADDRESS *GatewayIp OPTIONAL, IN EFI_IP_ADDRESS *SrcIp OPTIONAL, IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort OPTIONAL, IN UINTN *HeaderSize OPTIONAL, IN VOID *HeaderPtr OPTIONAL, IN UINTN *BufferSize, IN VOID *BufferPtr)
 
EFI_STATUS EFIAPI EfiPxeBcUdpRead (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN UINT16 OpFlags, IN OUT EFI_IP_ADDRESS *DestIp OPTIONAL, IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort OPTIONAL, IN OUT EFI_IP_ADDRESS *SrcIp OPTIONAL, IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort OPTIONAL, IN UINTN *HeaderSize OPTIONAL, IN VOID *HeaderPtr OPTIONAL, IN OUT UINTN *BufferSize, IN VOID *BufferPtr)
 
EFI_STATUS EFIAPI EfiPxeBcSetIpFilter (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter)
 
EFI_STATUS EFIAPI EfiPxeBcArp (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_IP_ADDRESS *IpAddr, IN EFI_MAC_ADDRESS *MacAddr OPTIONAL)
 
EFI_STATUS EFIAPI EfiPxeBcSetParameters (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN *NewAutoArp OPTIONAL, IN BOOLEAN *NewSendGUID OPTIONAL, IN UINT8 *NewTTL OPTIONAL, IN UINT8 *NewToS OPTIONAL, IN BOOLEAN *NewMakeCallback OPTIONAL)
 
EFI_STATUS EFIAPI EfiPxeBcSetStationIP (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_IP_ADDRESS *NewStationIp OPTIONAL, IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL)
 
EFI_STATUS EFIAPI EfiPxeBcSetPackets (IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN *NewDhcpDiscoverValid OPTIONAL, IN BOOLEAN *NewDhcpAckReceived OPTIONAL, IN BOOLEAN *NewProxyOfferReceived OPTIONAL, IN BOOLEAN *NewPxeDiscoverValid OPTIONAL, IN BOOLEAN *NewPxeReplyReceived OPTIONAL, IN BOOLEAN *NewPxeBisReplyReceived OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL)
 
EFI_PXE_BASE_CODE_CALLBACK_STATUS EFIAPI EfiPxeLoadFileCallback (IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This, IN EFI_PXE_BASE_CODE_FUNCTION Function, IN BOOLEAN Received, IN UINT32 PacketLength, IN EFI_PXE_BASE_CODE_PACKET *PacketPtr OPTIONAL)
 
EFI_STATUS EFIAPI EfiPxeLoadFile (IN EFI_LOAD_FILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
 

Variables

EFI_PXE_BASE_CODE_PROTOCOL gPxeBcProtocolTemplate
 
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL gPxeBcCallBackTemplate
 
EFI_LOAD_FILE_PROTOCOL gLoadFileProtocolTemplate = { EfiPxeLoadFile }
 

Detailed Description

This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PxeBcImpl.c.

Function Documentation

◆ EfiPxeBcArp()

EFI_STATUS EFIAPI EfiPxeBcArp ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN EFI_IP_ADDRESS IpAddr,
IN EFI_MAC_ADDRESS *MacAddr  OPTIONAL 
)

Uses the ARP protocol to resolve a MAC address. It is not supported for IPv6.

This function uses the ARP protocol to resolve a MAC address. The IP address specified by IpAddr is used to resolve a MAC address. If the ARP protocol succeeds in resolving the specified address, then the ArpCacheEntries and ArpCache fields of the mode data are updated, and EFI_SUCCESS is returned. If MacAddr is not NULL, the resolved MAC address is placed there as well. If the PXE Base Code protocol is in the stopped state, then EFI_NOT_STARTED is returned. If the ARP protocol encounters a timeout condition while attempting to resolve an address, then EFI_TIMEOUT is returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED is returned.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]IpAddrPointer to the IP address that is used to resolve a MAC address.
[in]MacAddrIf not NULL, a pointer to the MAC address that was resolved with the ARP protocol.
Return values
EFI_SUCCESSThe IP or MAC address was resolved.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_DEVICE_ERRORThe network device encountered an error during this operation.
EFI_ICMP_ERRORAn error occur with the ICMP packet message.

Definition at line 1797 of file PxeBcImpl.c.

◆ EfiPxeBcDhcp()

EFI_STATUS EFIAPI EfiPxeBcDhcp ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN BOOLEAN  SortOffers 
)

Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6 S.A.R.R (solicit / advertise / request / reply) sequence.

If SortOffers is TRUE, then the cached DHCP offer packets will be sorted before they are tried. If SortOffers is FALSE, then the cached DHCP offer packets will be tried in the order in which they are received. Please see the Preboot Execution Environment (PXE) Specification and Unified Extensible Firmware Interface (UEFI) Specification for additional details on the implementation of DHCP. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then the DHCP sequence will be stopped and EFI_ABORTED will be returned.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]SortOffersTRUE if the offers received should be sorted. Set to FALSE to try the offers in the order that they are received.
Return values
EFI_SUCCESSValid DHCP has completed.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETERThe This parameter is NULL or does not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
EFI_DEVICE_ERRORThe network device encountered an error during this operation.
EFI_OUT_OF_RESOURCESCould not allocate enough memory to complete the DHCP Protocol.
EFI_ABORTEDThe callback function aborted the DHCP Protocol.
EFI_TIMEOUTThe DHCP Protocol timed out.
EFI_ICMP_ERRORAn ICMP error packet was received during the DHCP session.
EFI_NO_RESPONSEValid PXE offer was not received.

Definition at line 424 of file PxeBcImpl.c.

◆ EfiPxeBcDiscover()

EFI_STATUS EFIAPI EfiPxeBcDiscover ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN UINT16  Type,
IN UINT16 *  Layer,
IN BOOLEAN  UseBis,
IN EFI_PXE_BASE_CODE_DISCOVER_INFO *Info  OPTIONAL 
)

Attempts to complete the PXE Boot Server and/or boot image discovery sequence.

This function attempts to complete the PXE Boot Server and/or boot image discovery sequence. If this sequence is completed, then EFI_SUCCESS is returned, and the PxeDiscoverValid, PxeDiscover, PxeReplyReceived, and PxeReply fields of the EFI_PXE_BASE_CODE_MODE structure are filled in. If UseBis is TRUE, then the PxeBisReplyReceived and PxeBisReply fields of the EFI_PXE_BASE_CODE_MODE structure will also be filled in. If UseBis is FALSE, then PxeBisReplyValid will be set to FALSE. In the structure referenced by parameter Info, the PXE Boot Server list, SrvList[], has two uses: It is the Boot Server IP address list used for unicast discovery (if the UseUCast field is TRUE), and it is the list used for Boot Server verification (if the MustUseList field is TRUE). Also, if the MustUseList field in that structure is TRUE and the AcceptAnyResponse field in the SrvList[] array is TRUE, any Boot Server reply of that type will be accepted. If the AcceptAnyResponse field is FALSE, only responses from Boot Servers with matching IP addresses will be accepted. This function can take at least 10 seconds to timeout and return control to the caller. If the Discovery sequence does not complete, then EFI_TIMEOUT will be returned. Please see the Preboot Execution Environment (PXE) Specification for additional details on the implementation of the Discovery sequence. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then the Discovery sequence is stopped and EFI_ABORTED will be returned.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]TypeThe type of bootstrap to perform.
[in]LayerPointer to the boot server layer number to discover, which must be PXE_BOOT_LAYER_INITIAL when a new server type is being discovered.
[in]UseBisTRUE if Boot Integrity Services are to be used. FALSE otherwise.
[in]InfoPointer to a data structure that contains additional information on the type of discovery operation that is to be performed. It is optional.
Return values
EFI_SUCCESSThe Discovery sequence has been completed.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_DEVICE_ERRORThe network device encountered an error during this operation.
EFI_OUT_OF_RESOURCESCould not allocate enough memory to complete Discovery.
EFI_ABORTEDThe callback function aborted the Discovery sequence.
EFI_TIMEOUTThe Discovery sequence timed out.
EFI_ICMP_ERRORAn ICMP error packet was received during the PXE discovery session.

Definition at line 539 of file PxeBcImpl.c.

◆ EfiPxeBcMtftp()

EFI_STATUS EFIAPI EfiPxeBcMtftp ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN EFI_PXE_BASE_CODE_TFTP_OPCODE  Operation,
IN OUT VOID *BufferPtr  OPTIONAL,
IN BOOLEAN  Overwrite,
IN OUT UINT64 *  BufferSize,
IN UINTN *BlockSize  OPTIONAL,
IN EFI_IP_ADDRESS ServerIp,
IN UINT8 *  Filename,
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info  OPTIONAL,
IN BOOLEAN  DontUseBuffer 
)

Used to perform TFTP and MTFTP services.

This function is used to perform TFTP and MTFTP services. This includes the TFTP operations to get the size of a file, read a directory, read a file, and write a file. It also includes the MTFTP operations to get the size of a file, read a directory, and read a file. The type of operation is specified by Operation. If the callback function that is invoked during the TFTP/MTFTP operation does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will be returned. For read operations, the return data will be placed in the buffer specified by BufferPtr. If BufferSize is too small to contain the entire downloaded file, then EFI_BUFFER_TOO_SMALL will be returned and BufferSize will be set to zero, or the size of the requested file. (NOTE: the size of the requested file is only returned if the TFTP server supports TFTP options). If BufferSize is large enough for the read operation, then BufferSize will be set to the size of the downloaded file, and EFI_SUCCESS will be returned. Applications using the PxeBc.Mtftp() services should use the get-file-size operations to determine the size of the downloaded file prior to using the read-file operations-especially when downloading large (greater than 64 MB) files-instead of making two calls to the read-file operation. Following this recommendation will save time if the file is larger than expected and the TFTP server does not support TFTP option extensions. Without TFTP option extension support, the client must download the entire file, counting and discarding the received packets, to determine the file size. For write operations, the data to be sent is in the buffer specified by BufferPtr. BufferSize specifies the number of bytes to send. If the write operation completes successfully, then EFI_SUCCESS will be returned. For TFTP "get file size" operations, the size of the requested file or directory is returned in BufferSize, and EFI_SUCCESS will be returned. If the TFTP server does not support options, the file will be downloaded into a bit bucket and the length of the downloaded file will be returned. For MTFTP "get file size" operations, if the MTFTP server does not support the "get file size" option, EFI_UNSUPPORTED will be returned. This function can take up to 10 seconds to timeout and return control to the caller. If the TFTP sequence does not complete, EFI_TIMEOUT will be returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then the TFTP sequence is stopped and EFI_ABORTED will be returned.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]OperationThe type of operation to perform.
[in,out]BufferPtrA pointer to the data buffer.
[in]OverwriteOnly used on write file operations. TRUE if a file on a remote server can be overwritten.
[in,out]BufferSizeFor get-file-size operations, *BufferSize returns the size of the requested file.
[in]BlockSizeThe requested block size to be used during a TFTP transfer.
[in]ServerIpThe TFTP / MTFTP server IP address.
[in]FilenameA Null-terminated ASCII string that specifies a directory name or a file name.
[in]InfoPointer to the MTFTP information.
[in]DontUseBufferSet to FALSE for normal TFTP and MTFTP read file operation.
Return values
EFI_SUCCESSThe TFTP/MTFTP operation was completed.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_DEVICE_ERRORThe network device encountered an error during this operation.
EFI_BUFFER_TOO_SMALLThe buffer is not large enough to complete the read operation.
EFI_ABORTEDThe callback function aborted the TFTP/MTFTP operation.
EFI_TIMEOUTThe TFTP/MTFTP operation timed out.
EFI_ICMP_ERRORAn ICMP error packet was received during the MTFTP session.
EFI_TFTP_ERRORA TFTP error packet was received during the MTFTP session.

Definition at line 834 of file PxeBcImpl.c.

◆ EfiPxeBcSetIpFilter()

EFI_STATUS EFIAPI EfiPxeBcSetIpFilter ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN EFI_PXE_BASE_CODE_IP_FILTER NewFilter 
)

Updates the IP receive filters of a network device and enables software filtering.

The NewFilter field is used to modify the network device's current IP receive filter settings and to enable a software filter. This function updates the IpFilter field of the EFI_PXE_BASE_CODE_MODE structure with the contents of NewIpFilter. The software filter is used when the USE_FILTER in OpFlags is set to UdpRead(). The current hardware filter remains in effect no matter what the settings of OpFlags. This is so that the meaning of ANY_DEST_IP set in OpFlags to UdpRead() is from those packets whose reception is enabled in hardware-physical NIC address (unicast), broadcast address, logical address or addresses (multicast), or all (promiscuous). UdpRead() does not modify the IP filter settings. Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP. If an application or driver wishes to preserve the IP receive filter settings, it will have to preserve the IP receive filter settings before these calls, and use SetIpFilter() to restore them after the calls. If incompatible filtering is requested (for example, PROMISCUOUS with anything else), or if the device does not support a requested filter setting and it cannot be accommodated in software (for example, PROMISCUOUS not supported), EFI_INVALID_PARAMETER will be returned. The IPlist field is used to enable IPs other than the StationIP. They may be multicast or unicast. If IPcnt is set as well as EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP, then both the StationIP and the IPs from the IPlist will be used.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]NewFilterPointer to the new set of IP receive filters.
Return values
EFI_SUCCESSThe IP receive filter settings were updated.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 1590 of file PxeBcImpl.c.

◆ EfiPxeBcSetPackets()

EFI_STATUS EFIAPI EfiPxeBcSetPackets ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN BOOLEAN *NewDhcpDiscoverValid  OPTIONAL,
IN BOOLEAN *NewDhcpAckReceived  OPTIONAL,
IN BOOLEAN *NewProxyOfferReceived  OPTIONAL,
IN BOOLEAN *NewPxeDiscoverValid  OPTIONAL,
IN BOOLEAN *NewPxeReplyReceived  OPTIONAL,
IN BOOLEAN *NewPxeBisReplyReceived  OPTIONAL,
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover  OPTIONAL,
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck  OPTIONAL,
IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer  OPTIONAL,
IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover  OPTIONAL,
IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply  OPTIONAL,
IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply  OPTIONAL 
)

Updates the contents of the cached DHCP and Discover packets.

The pointers to the new packets are used to update the contents of the cached packets in the EFI_PXE_BASE_CODE_MODE structure.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]NewDhcpDiscoverValidPointer to a value that will replace the current DhcpDiscoverValid field.
[in]NewDhcpAckReceivedPointer to a value that will replace the current DhcpAckReceived field.
[in]NewProxyOfferReceivedPointer to a value that will replace the current ProxyOfferReceived field.
[in]NewPxeDiscoverValidPointer to a value that will replace the current ProxyOfferReceived field.
[in]NewPxeReplyReceivedPointer to a value that will replace the current PxeReplyReceived field.
[in]NewPxeBisReplyReceivedPointer to a value that will replace the current PxeBisReplyReceived field.
[in]NewDhcpDiscoverPointer to the new cached DHCP Discover packet contents.
[in]NewDhcpAckPointer to the new cached DHCP Ack packet contents.
[in]NewProxyOfferPointer to the new cached Proxy Offer packet contents.
[in]NewPxeDiscoverPointer to the new cached PXE Discover packet contents.
[in]NewPxeReplyPointer to the new cached PXE Reply packet contents.
[in]NewPxeBisReplyPointer to the new cached PXE BIS Reply packet contents.
Return values
EFI_SUCCESSThe cached packet contents were updated.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETERThis is NULL or does not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.

Definition at line 2129 of file PxeBcImpl.c.

◆ EfiPxeBcSetParameters()

EFI_STATUS EFIAPI EfiPxeBcSetParameters ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN BOOLEAN *NewAutoArp  OPTIONAL,
IN BOOLEAN *NewSendGUID  OPTIONAL,
IN UINT8 *NewTTL  OPTIONAL,
IN UINT8 *NewToS  OPTIONAL,
IN BOOLEAN *NewMakeCallback  OPTIONAL 
)

Updates the parameters that affect the operation of the PXE Base Code Protocol.

This function sets parameters that affect the operation of the PXE Base Code Protocol. The parameter specified by NewAutoArp is used to control the generation of ARP protocol packets. If NewAutoArp is TRUE, then ARP Protocol packets will be generated as required by the PXE Base Code Protocol. If NewAutoArp is FALSE, then no ARP Protocol packets will be generated. In this case, the only mappings that are available are those stored in the ArpCache of the EFI_PXE_BASE_CODE_MODE structure. If there are not enough mappings in the ArpCache to perform a PXE Base Code Protocol service, then the service will fail. This function updates the AutoArp field of the EFI_PXE_BASE_CODE_MODE structure to NewAutoArp. The SetParameters() call must be invoked after a Callback Protocol is installed to enable the use of callbacks.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]NewAutoArpIf not NULL, a pointer to a value that specifies whether to replace the current value of AutoARP.
[in]NewSendGUIDIf not NULL, a pointer to a value that specifies whether to replace the current value of SendGUID.
[in]NewTTLIf not NULL, a pointer to be used in place of the current value of TTL, the "time to live" field of the IP header.
[in]NewToSIf not NULL, a pointer to be used in place of the current value of ToS, the "type of service" field of the IP header.
[in]NewMakeCallbackIf not NULL, a pointer to a value that specifies whether to replace the current value of the MakeCallback field of the Mode structure.
Return values
EFI_SUCCESSThe new parameters values were updated.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 1931 of file PxeBcImpl.c.

◆ EfiPxeBcSetStationIP()

EFI_STATUS EFIAPI EfiPxeBcSetStationIP ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN EFI_IP_ADDRESS *NewStationIp  OPTIONAL,
IN EFI_IP_ADDRESS *NewSubnetMask  OPTIONAL 
)

Updates the station IP address and/or subnet mask values of a network device.

This function updates the station IP address and/or subnet mask values of a network device. The NewStationIp field is used to modify the network device's current IP address. If NewStationIP is NULL, then the current IP address will not be modified. Otherwise, this function updates the StationIp field of the EFI_PXE_BASE_CODE_MODE structure with NewStationIp. The NewSubnetMask field is used to modify the network device's current subnet mask. If NewSubnetMask is NULL, then the current subnet mask will not be modified. Otherwise, this function updates the SubnetMask field of the EFI_PXE_BASE_CODE_MODE structure with NewSubnetMask.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]NewStationIpPointer to the new IP address to be used by the network device.
[in]NewSubnetMaskPointer to the new subnet mask to be used by the network device.
Return values
EFI_SUCCESSThe new station IP address and/or subnet mask were updated.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 2024 of file PxeBcImpl.c.

◆ EfiPxeBcStart()

EFI_STATUS EFIAPI EfiPxeBcStart ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN BOOLEAN  UseIpv6 
)

Enables the use of the PXE Base Code Protocol functions.

This function enables the use of the PXE Base Code Protocol functions. If the Started field of the EFI_PXE_BASE_CODE_MODE structure is already TRUE, then EFI_ALREADY_STARTED will be returned. If UseIpv6 is TRUE, then IPv6 formatted addresses will be used in this session. If UseIpv6 is FALSE, then IPv4 formatted addresses will be used in this session. If UseIpv6 is TRUE, and the Ipv6Supported field of the EFI_PXE_BASE_CODE_MODE structure is FALSE, then EFI_UNSUPPORTED will be returned. If there is not enough memory or other resources to start the PXE Base Code Protocol, then EFI_OUT_OF_RESOURCES will be returned. Otherwise, the PXE Base Code Protocol will be started.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]UseIpv6Specifies 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.
Return values
EFI_SUCCESSThe PXE Base Code Protocol was started.
EFI_DEVICE_ERRORThe network device encountered an error during this operation.
EFI_UNSUPPORTEDUseIpv6 is TRUE, but the Ipv6Supported field of the EFI_PXE_BASE_CODE_MODE structure is FALSE.
EFI_ALREADY_STARTEDThe PXE Base Code Protocol is already in the started state.
EFI_INVALID_PARAMETERThe This parameter is NULL or does not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
EFI_OUT_OF_RESOURCESCould not allocate enough memory or other resources to start the PXE Base Code Protocol.

Definition at line 43 of file PxeBcImpl.c.

◆ EfiPxeBcStop()

EFI_STATUS EFIAPI EfiPxeBcStop ( IN EFI_PXE_BASE_CODE_PROTOCOL This)

Disable the use of the PXE Base Code Protocol functions.

This function stops all activity on the network device. All the resources allocated in Start() are released, the Started field of the EFI_PXE_BASE_CODE_MODE structure is set to FALSE, and EFI_SUCCESS is returned. If the Started field of the EFI_PXE_BASE_CODE_MODE structure is already FALSE, then EFI_NOT_STARTED will be returned.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
Return values
EFI_SUCCESSThe PXE Base Code Protocol was stopped.
EFI_NOT_STARTEDThe PXE Base Code Protocol is already in the stopped state.
EFI_INVALID_PARAMETERThe This parameter is NULL or does not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
Others

Definition at line 293 of file PxeBcImpl.c.

◆ EfiPxeBcUdpRead()

EFI_STATUS EFIAPI EfiPxeBcUdpRead ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN UINT16  OpFlags,
IN OUT EFI_IP_ADDRESS *DestIp  OPTIONAL,
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort  OPTIONAL,
IN OUT EFI_IP_ADDRESS *SrcIp  OPTIONAL,
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort  OPTIONAL,
IN UINTN *HeaderSize  OPTIONAL,
IN VOID *HeaderPtr  OPTIONAL,
IN OUT UINTN BufferSize,
IN VOID *  BufferPtr 
)

Reads a UDP packet from the network interface.

  • This function reads a UDP packet from a network interface. The data contents are returned in (the optional HeaderPtr and) BufferPtr, and the size of the buffer received is returned in BufferSize . If the input BufferSize is smaller than the UDP packet received (less optional HeaderSize), it will be set to the required size, and EFI_BUFFER_TOO_SMALL will be returned. In this case, the contents of BufferPtr are undefined, and the packet is lost. If a UDP packet is successfully received, then EFI_SUCCESS will be returned, and the information from the UDP header will be returned in DestIp, DestPort, SrcIp, and SrcPort if they are not NULL. Depending on the values of OpFlags and the DestIp, DestPort, SrcIp, and SrcPort input values, different types of UDP packet receive filtering will be performed. The following tables summarize these receive filter operations.
Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]OpFlagsThe UDP operation flags.
[in,out]DestIpThe destination IP address.
[in,out]DestPortThe destination UDP port number.
[in,out]SrcIpThe source IP address.
[in,out]SrcPortThe source UDP port number.
[in]HeaderSizeAn optional field which may be set to the length of a header at HeaderPtr to be prefixed to the data at BufferPtr.
[in]HeaderPtrIf HeaderSize is not NULL, a pointer to a header to be prefixed to the data at BufferPtr.
[in,out]BufferSizeA pointer to the size of the data at BufferPtr.
[in]BufferPtrA pointer to the data to be read.
Return values
EFI_SUCCESSThe UDP Read operation was completed.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_DEVICE_ERRORThe network device encountered an error during this operation.
EFI_BUFFER_TOO_SMALLThe packet is larger than Buffer can hold.
EFI_ABORTEDThe callback function aborted the UDP Read operation.
EFI_TIMEOUTThe UDP Read operation timed out.

Definition at line 1284 of file PxeBcImpl.c.

◆ EfiPxeBcUdpWrite()

EFI_STATUS EFIAPI EfiPxeBcUdpWrite ( IN EFI_PXE_BASE_CODE_PROTOCOL This,
IN UINT16  OpFlags,
IN EFI_IP_ADDRESS DestIp,
IN EFI_PXE_BASE_CODE_UDP_PORT *  DestPort,
IN EFI_IP_ADDRESS *GatewayIp  OPTIONAL,
IN EFI_IP_ADDRESS *SrcIp  OPTIONAL,
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort  OPTIONAL,
IN UINTN *HeaderSize  OPTIONAL,
IN VOID *HeaderPtr  OPTIONAL,
IN UINTN BufferSize,
IN VOID *  BufferPtr 
)

Writes a UDP packet to the network interface.

This function writes a UDP packet specified by the (optional HeaderPtr and) BufferPtr parameters to the network interface. The UDP header is automatically built by this routine. It uses the parameters OpFlags, DestIp, DestPort, GatewayIp, SrcIp, and SrcPort to build this header. If the packet is successfully built and transmitted through the network interface, then EFI_SUCCESS will be returned. If a timeout occurs during the transmission of the packet, then EFI_TIMEOUT will be returned. If an ICMP error occurs during the transmission of the packet, then the IcmpErrorReceived field is set to TRUE, the IcmpError field is filled in and EFI_ICMP_ERROR will be returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will be returned.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
[in]OpFlagsThe UDP operation flags.
[in]DestIpThe destination IP address.
[in]DestPortThe destination UDP port number.
[in]GatewayIpThe gateway IP address.
[in]SrcIpThe source IP address.
[in,out]SrcPortThe source UDP port number.
[in]HeaderSizeAn optional field which may be set to the length of a header at HeaderPtr to be prefixed to the data at BufferPtr.
[in]HeaderPtrIf HeaderSize is not NULL, a pointer to a header to be prefixed to the data at BufferPtr.
[in]BufferSizeA pointer to the size of the data at BufferPtr.
[in]BufferPtrA pointer to the data to be written.
Return values
EFI_SUCCESSThe UDP Write operation completed.
EFI_NOT_STARTEDThe PXE Base Code Protocol is in the stopped state.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_BAD_BUFFER_SIZEThe buffer is too long to be transmitted.
EFI_ABORTEDThe callback function aborted the UDP Write operation.
EFI_TIMEOUTThe UDP Write operation timed out.
EFI_ICMP_ERRORAn ICMP error packet was received during the UDP write session.

Definition at line 1073 of file PxeBcImpl.c.

◆ EfiPxeLoadFile()

EFI_STATUS EFIAPI EfiPxeLoadFile ( 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
[in]ThisProtocol instance pointer.
[in]FilePathThe device specific path of the file to load.
[in]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 an exact file to be loaded.
[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 no 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.

Definition at line 2354 of file PxeBcImpl.c.

◆ EfiPxeLoadFileCallback()

EFI_PXE_BASE_CODE_CALLBACK_STATUS EFIAPI EfiPxeLoadFileCallback ( IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This,
IN EFI_PXE_BASE_CODE_FUNCTION  Function,
IN BOOLEAN  Received,
IN UINT32  PacketLength,
IN EFI_PXE_BASE_CODE_PACKET *PacketPtr  OPTIONAL 
)

Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has received, or is waiting to receive a packet.

This function is invoked when the PXE Base Code Protocol is about to transmit, has received, or is waiting to receive a packet. Parameters Function and Received specify the type of event. Parameters PacketLen and Packet specify the packet that generated the event. If these fields are zero and NULL respectively, then this is a status update callback. If the operation specified by Function is to continue, then CALLBACK_STATUS_CONTINUE should be returned. If the operation specified by Function should be aborted, then CALLBACK_STATUS_ABORT should be returned. Due to the polling nature of UEFI device drivers, a callback function should not execute for more than 5 ms. The SetParameters() function must be called after a Callback Protocol is installed to enable the use of callbacks.

Parameters
[in]ThisPointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance.
[in]FunctionThe PXE Base Code Protocol function that is waiting for an event.
[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]PacketLengthThe length, in bytes, of Packet. This field will have a value of zero if this is a wait for receive event.
[in]PacketPtrIf Received is TRUE, a pointer to the packet that was just received; otherwise a pointer to the packet that is about to be transmitted.
Return values
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUEIf Function specifies a continue operation.
EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORTIf Function specifies an abort operation.

Definition at line 2256 of file PxeBcImpl.c.

Variable Documentation

◆ gLoadFileProtocolTemplate

EFI_LOAD_FILE_PROTOCOL gLoadFileProtocolTemplate = { EfiPxeLoadFile }

Definition at line 2446 of file PxeBcImpl.c.

◆ gPxeBcCallBackTemplate

EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL gPxeBcCallBackTemplate
Initial value:
= {
}
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION
EFI_PXE_BASE_CODE_CALLBACK_STATUS EFIAPI EfiPxeLoadFileCallback(IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This, IN EFI_PXE_BASE_CODE_FUNCTION Function, IN BOOLEAN Received, IN UINT32 PacketLength, IN EFI_PXE_BASE_CODE_PACKET *PacketPtr OPTIONAL)
Definition: PxeBcImpl.c:2256

Definition at line 2319 of file PxeBcImpl.c.

◆ gPxeBcProtocolTemplate

EFI_PXE_BASE_CODE_PROTOCOL gPxeBcProtocolTemplate
Initial value:
= {
EFI_PXE_BASE_CODE_PROTOCOL_REVISION,
}
#define NULL
Definition: Base.h:319
EFI_STATUS EFIAPI EfiPxeBcUdpRead(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN UINT16 OpFlags, IN OUT EFI_IP_ADDRESS *DestIp OPTIONAL, IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort OPTIONAL, IN OUT EFI_IP_ADDRESS *SrcIp OPTIONAL, IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort OPTIONAL, IN UINTN *HeaderSize OPTIONAL, IN VOID *HeaderPtr OPTIONAL, IN OUT UINTN *BufferSize, IN VOID *BufferPtr)
Definition: PxeBcImpl.c:1284
EFI_STATUS EFIAPI EfiPxeBcSetStationIP(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_IP_ADDRESS *NewStationIp OPTIONAL, IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL)
Definition: PxeBcImpl.c:2024
EFI_STATUS EFIAPI EfiPxeBcStart(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN UseIpv6)
Definition: PxeBcImpl.c:43
EFI_STATUS EFIAPI EfiPxeBcSetIpFilter(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter)
Definition: PxeBcImpl.c:1590
EFI_STATUS EFIAPI EfiPxeBcSetParameters(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN *NewAutoArp OPTIONAL, IN BOOLEAN *NewSendGUID OPTIONAL, IN UINT8 *NewTTL OPTIONAL, IN UINT8 *NewToS OPTIONAL, IN BOOLEAN *NewMakeCallback OPTIONAL)
Definition: PxeBcImpl.c:1931
EFI_STATUS EFIAPI EfiPxeBcSetPackets(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN *NewDhcpDiscoverValid OPTIONAL, IN BOOLEAN *NewDhcpAckReceived OPTIONAL, IN BOOLEAN *NewProxyOfferReceived OPTIONAL, IN BOOLEAN *NewPxeDiscoverValid OPTIONAL, IN BOOLEAN *NewPxeReplyReceived OPTIONAL, IN BOOLEAN *NewPxeBisReplyReceived OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply OPTIONAL, IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL)
Definition: PxeBcImpl.c:2129
EFI_STATUS EFIAPI EfiPxeBcDhcp(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN BOOLEAN SortOffers)
Definition: PxeBcImpl.c:424
EFI_STATUS EFIAPI EfiPxeBcMtftp(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT VOID *BufferPtr OPTIONAL, IN BOOLEAN Overwrite, IN OUT UINT64 *BufferSize, IN UINTN *BlockSize OPTIONAL, IN EFI_IP_ADDRESS *ServerIp, IN UINT8 *Filename, IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL, IN BOOLEAN DontUseBuffer)
Definition: PxeBcImpl.c:834
EFI_STATUS EFIAPI EfiPxeBcStop(IN EFI_PXE_BASE_CODE_PROTOCOL *This)
Definition: PxeBcImpl.c:293
EFI_STATUS EFIAPI EfiPxeBcUdpWrite(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN UINT16 OpFlags, IN EFI_IP_ADDRESS *DestIp, IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, IN EFI_IP_ADDRESS *GatewayIp OPTIONAL, IN EFI_IP_ADDRESS *SrcIp OPTIONAL, IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort OPTIONAL, IN UINTN *HeaderSize OPTIONAL, IN VOID *HeaderPtr OPTIONAL, IN UINTN *BufferSize, IN VOID *BufferPtr)
Definition: PxeBcImpl.c:1073
EFI_STATUS EFIAPI EfiPxeBcArp(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN EFI_IP_ADDRESS *IpAddr, IN EFI_MAC_ADDRESS *MacAddr OPTIONAL)
Definition: PxeBcImpl.c:1797
EFI_STATUS EFIAPI EfiPxeBcDiscover(IN EFI_PXE_BASE_CODE_PROTOCOL *This, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL)
Definition: PxeBcImpl.c:539

Definition at line 2210 of file PxeBcImpl.c.