2010-11-01 07:13:54 +01:00
|
|
|
/** @file
|
|
|
|
This EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
|
|
|
|
interfaces declaration.
|
|
|
|
|
2018-06-27 15:12:32 +02:00
|
|
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
2010-11-01 07:13:54 +01:00
|
|
|
|
2019-04-04 01:06:13 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2010-11-01 07:13:54 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __EFI_PXEBC_IMPL_H__
|
|
|
|
#define __EFI_PXEBC_IMPL_H__
|
|
|
|
|
|
|
|
#include <Uefi.h>
|
|
|
|
|
|
|
|
#include <Guid/SmBios.h>
|
|
|
|
#include <IndustryStandard/SmBios.h>
|
2016-06-22 04:25:21 +02:00
|
|
|
#include <IndustryStandard/Dhcp.h>
|
2010-11-01 07:13:54 +01:00
|
|
|
#include <Protocol/NetworkInterfaceIdentifier.h>
|
|
|
|
#include <Protocol/Arp.h>
|
|
|
|
#include <Protocol/Ip4.h>
|
2015-07-29 06:10:09 +02:00
|
|
|
#include <Protocol/Ip4Config2.h>
|
2010-11-01 07:13:54 +01:00
|
|
|
#include <Protocol/Ip6.h>
|
|
|
|
#include <Protocol/Ip6Config.h>
|
|
|
|
#include <Protocol/Udp4.h>
|
|
|
|
#include <Protocol/Udp6.h>
|
|
|
|
#include <Protocol/Dhcp4.h>
|
|
|
|
#include <Protocol/Dhcp6.h>
|
2016-10-14 09:12:09 +02:00
|
|
|
#include <Protocol/Dns6.h>
|
2010-11-01 07:13:54 +01:00
|
|
|
#include <Protocol/Mtftp4.h>
|
|
|
|
#include <Protocol/Mtftp6.h>
|
|
|
|
#include <Protocol/PxeBaseCode.h>
|
|
|
|
#include <Protocol/LoadFile.h>
|
|
|
|
#include <Protocol/PxeBaseCodeCallBack.h>
|
|
|
|
#include <Protocol/ServiceBinding.h>
|
|
|
|
#include <Protocol/DriverBinding.h>
|
2015-04-30 04:57:10 +02:00
|
|
|
#include <Protocol/AdapterInformation.h>
|
2010-11-01 07:13:54 +01:00
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
2011-08-12 08:18:29 +02:00
|
|
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
2010-11-01 07:13:54 +01:00
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/NetLib.h>
|
|
|
|
#include <Library/DpcLib.h>
|
|
|
|
#include <Library/DevicePathLib.h>
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
|
|
|
|
typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;
|
2010-12-01 08:04:48 +01:00
|
|
|
typedef struct _PXEBC_PRIVATE_PROTOCOL PXEBC_PRIVATE_PROTOCOL;
|
2010-11-01 07:13:54 +01:00
|
|
|
typedef struct _PXEBC_VIRTUAL_NIC PXEBC_VIRTUAL_NIC;
|
|
|
|
|
|
|
|
#include "PxeBcDriver.h"
|
|
|
|
#include "PxeBcDhcp4.h"
|
|
|
|
#include "PxeBcDhcp6.h"
|
|
|
|
#include "PxeBcMtftp.h"
|
|
|
|
#include "PxeBcBoot.h"
|
|
|
|
#include "PxeBcSupport.h"
|
|
|
|
|
|
|
|
#define PXEBC_DEFAULT_HOPLIMIT 64
|
|
|
|
#define PXEBC_DEFAULT_LIFETIME 50000 // 50 ms, unit is microsecond
|
|
|
|
#define PXEBC_UDP_TIMEOUT 30000000 // 3 seconds, unit is 100nanosecond
|
2012-07-04 06:34:10 +02:00
|
|
|
#define PXEBC_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
|
2010-11-01 07:13:54 +01:00
|
|
|
#define PXEBC_MTFTP_TIMEOUT 4
|
|
|
|
#define PXEBC_MTFTP_RETRIES 6
|
|
|
|
#define PXEBC_DHCP_RETRIES 4 // refers to mPxeDhcpTimeout, also by PXE2.1 spec.
|
|
|
|
#define PXEBC_MENU_MAX_NUM 24
|
|
|
|
#define PXEBC_OFFER_MAX_NUM 16
|
|
|
|
|
2017-12-18 02:20:26 +01:00
|
|
|
#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
|
|
|
|
|
2010-11-01 07:13:54 +01:00
|
|
|
#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')
|
|
|
|
#define PXEBC_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'V')
|
|
|
|
#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)
|
2010-12-01 08:04:48 +01:00
|
|
|
#define PXEBC_PRIVATE_DATA_FROM_ID(a) CR (a, PXEBC_PRIVATE_DATA, Id, PXEBC_PRIVATE_DATA_SIGNATURE)
|
2010-11-01 07:13:54 +01:00
|
|
|
#define PXEBC_VIRTUAL_NIC_FROM_LOADFILE(a) CR (a, PXEBC_VIRTUAL_NIC, LoadFile, PXEBC_VIRTUAL_NIC_SIGNATURE)
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
PXEBC_DHCP4_PACKET_CACHE Dhcp4;
|
|
|
|
PXEBC_DHCP6_PACKET_CACHE Dhcp6;
|
|
|
|
} PXEBC_DHCP_PACKET_CACHE;
|
|
|
|
|
2010-12-01 08:04:48 +01:00
|
|
|
struct _PXEBC_PRIVATE_PROTOCOL {
|
|
|
|
UINT64 Reserved;
|
|
|
|
};
|
|
|
|
|
2010-11-01 07:13:54 +01:00
|
|
|
struct _PXEBC_VIRTUAL_NIC {
|
|
|
|
UINT32 Signature;
|
|
|
|
EFI_HANDLE Controller;
|
|
|
|
EFI_LOAD_FILE_PROTOCOL LoadFile;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
PXEBC_PRIVATE_DATA *Private;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _PXEBC_PRIVATE_DATA {
|
|
|
|
UINT32 Signature;
|
|
|
|
EFI_HANDLE Controller;
|
|
|
|
EFI_HANDLE Image;
|
|
|
|
|
2010-12-01 08:04:48 +01:00
|
|
|
PXEBC_PRIVATE_PROTOCOL Id;
|
2018-06-27 15:12:32 +02:00
|
|
|
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
2010-12-01 08:04:48 +01:00
|
|
|
|
2010-11-01 07:13:54 +01:00
|
|
|
PXEBC_VIRTUAL_NIC *Ip4Nic;
|
|
|
|
PXEBC_VIRTUAL_NIC *Ip6Nic;
|
|
|
|
|
|
|
|
EFI_HANDLE ArpChild;
|
|
|
|
EFI_HANDLE Ip4Child;
|
|
|
|
EFI_HANDLE Dhcp4Child;
|
|
|
|
EFI_HANDLE Mtftp4Child;
|
|
|
|
EFI_HANDLE Udp4ReadChild;
|
|
|
|
EFI_HANDLE Udp4WriteChild;
|
|
|
|
|
|
|
|
EFI_ARP_PROTOCOL *Arp;
|
|
|
|
EFI_IP4_PROTOCOL *Ip4;
|
2015-07-29 06:10:09 +02:00
|
|
|
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
|
2010-11-01 07:13:54 +01:00
|
|
|
EFI_DHCP4_PROTOCOL *Dhcp4;
|
|
|
|
EFI_MTFTP4_PROTOCOL *Mtftp4;
|
|
|
|
EFI_UDP4_PROTOCOL *Udp4Read;
|
|
|
|
EFI_UDP4_PROTOCOL *Udp4Write;
|
|
|
|
|
|
|
|
EFI_HANDLE Ip6Child;
|
|
|
|
EFI_HANDLE Dhcp6Child;
|
|
|
|
EFI_HANDLE Mtftp6Child;
|
|
|
|
EFI_HANDLE Udp6ReadChild;
|
|
|
|
EFI_HANDLE Udp6WriteChild;
|
|
|
|
|
|
|
|
EFI_IP6_PROTOCOL *Ip6;
|
|
|
|
EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
|
|
|
|
EFI_DHCP6_PROTOCOL *Dhcp6;
|
|
|
|
EFI_MTFTP6_PROTOCOL *Mtftp6;
|
|
|
|
EFI_UDP6_PROTOCOL *Udp6Read;
|
|
|
|
EFI_UDP6_PROTOCOL *Udp6Write;
|
2016-10-14 09:12:09 +02:00
|
|
|
EFI_DNS6_PROTOCOL *Dns6;
|
2010-11-01 07:13:54 +01:00
|
|
|
|
|
|
|
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;
|
|
|
|
EFI_PXE_BASE_CODE_PROTOCOL PxeBc;
|
|
|
|
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL LoadFileCallback;
|
|
|
|
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *PxeBcCallback;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
|
|
|
|
EFI_PXE_BASE_CODE_MODE Mode;
|
|
|
|
EFI_PXE_BASE_CODE_FUNCTION Function;
|
|
|
|
UINT32 Ip6Policy;
|
2011-08-12 08:18:29 +02:00
|
|
|
UINT32 SolicitTimes;
|
|
|
|
UINT64 ElapsedTime;
|
2010-11-01 07:13:54 +01:00
|
|
|
|
|
|
|
EFI_UDP4_CONFIG_DATA Udp4CfgData;
|
|
|
|
EFI_UDP6_CONFIG_DATA Udp6CfgData;
|
|
|
|
EFI_IP4_CONFIG_DATA Ip4CfgData;
|
|
|
|
EFI_IP6_CONFIG_DATA Ip6CfgData;
|
|
|
|
|
|
|
|
EFI_EVENT UdpTimeOutEvent;
|
|
|
|
EFI_EVENT ArpUpdateEvent;
|
|
|
|
EFI_IP4_COMPLETION_TOKEN IcmpToken;
|
|
|
|
EFI_IP6_COMPLETION_TOKEN Icmp6Token;
|
|
|
|
|
|
|
|
BOOLEAN IsAddressOk;
|
|
|
|
BOOLEAN IsOfferSorted;
|
|
|
|
BOOLEAN IsProxyRecved;
|
|
|
|
BOOLEAN IsDoDiscover;
|
|
|
|
|
2014-09-18 13:44:36 +02:00
|
|
|
EFI_IP_ADDRESS TmpStationIp;
|
2010-11-01 07:13:54 +01:00
|
|
|
EFI_IP_ADDRESS StationIp;
|
|
|
|
EFI_IP_ADDRESS SubnetMask;
|
|
|
|
EFI_IP_ADDRESS GatewayIp;
|
|
|
|
EFI_IP_ADDRESS ServerIp;
|
2016-10-14 09:12:09 +02:00
|
|
|
EFI_IPv6_ADDRESS *DnsServer;
|
2010-11-01 07:13:54 +01:00
|
|
|
UINT16 CurSrcPort;
|
2012-10-17 10:23:41 +02:00
|
|
|
UINT32 IaId;
|
2010-11-01 07:13:54 +01:00
|
|
|
|
|
|
|
UINT32 Ip4MaxPacketSize;
|
|
|
|
UINT32 Ip6MaxPacketSize;
|
|
|
|
UINT8 *BootFileName;
|
|
|
|
UINTN BootFileSize;
|
|
|
|
UINTN BlockSize;
|
|
|
|
|
|
|
|
PXEBC_DHCP_PACKET_CACHE ProxyOffer;
|
|
|
|
PXEBC_DHCP_PACKET_CACHE DhcpAck;
|
|
|
|
PXEBC_DHCP_PACKET_CACHE PxeReply;
|
|
|
|
EFI_DHCP6_PACKET *Dhcp6Request;
|
|
|
|
EFI_DHCP4_PACKET SeedPacket;
|
|
|
|
|
|
|
|
//
|
|
|
|
// OfferIndex records the index of DhcpOffer[] buffer, and OfferCount records the num of each type of offer.
|
|
|
|
//
|
|
|
|
// It supposed that
|
|
|
|
//
|
|
|
|
// OfferNum: 8
|
|
|
|
// OfferBuffer: [ProxyBinl, ProxyBinl, DhcpOnly, ProxyPxe10, DhcpOnly, DhcpPxe10, DhcpBinl, ProxyBinl]
|
|
|
|
// (OfferBuffer is 0-based.)
|
|
|
|
//
|
|
|
|
// And assume that (DhcpPxe10 is the first priority actually.)
|
|
|
|
//
|
|
|
|
// SelectIndex: 2
|
|
|
|
// SelectProxyType: PXEBC_OFFER_TYPE_PROXY_BINL
|
|
|
|
// (SelectIndex is 1-based, and 0 means no one is selected.)
|
|
|
|
//
|
|
|
|
// So it should be
|
|
|
|
//
|
|
|
|
// DhcpOnly DhcpPxe10 DhcpWfm11a DhcpBinl ProxyPxe10 ProxyWfm11a ProxyBinl Bootp
|
|
|
|
// OfferCount: [ 2(n), 1(n), 0(n), 1(n), 1(1), 0(1), 3(n), 1(1)]
|
|
|
|
//
|
|
|
|
// OfferIndex: {[ 2, 5, 0, 6, 3, 0, *0, 0]
|
|
|
|
// [ 4, 0, 0, 0, 0, 0, 1, 0]
|
|
|
|
// [ 0, 0, 0, 0, 0, 0, 7, 0]
|
|
|
|
// ... ]}
|
|
|
|
// (OfferIndex is 0-based.)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
UINT32 SelectIndex;
|
|
|
|
UINT32 SelectProxyType;
|
|
|
|
PXEBC_DHCP_PACKET_CACHE OfferBuffer[PXEBC_OFFER_MAX_NUM];
|
|
|
|
UINT32 OfferNum;
|
|
|
|
UINT32 OfferCount[PxeOfferTypeMax];
|
|
|
|
UINT32 OfferIndex[PxeOfferTypeMax][PXEBC_OFFER_MAX_NUM];
|
|
|
|
};
|
|
|
|
|
|
|
|
extern EFI_PXE_BASE_CODE_PROTOCOL gPxeBcProtocolTemplate;
|
|
|
|
extern EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL gPxeBcCallBackTemplate;
|
|
|
|
extern EFI_LOAD_FILE_PROTOCOL gLoadFileProtocolTemplate;
|
|
|
|
|
|
|
|
#endif
|