TianoCore EDK2
master
Loading...
Searching...
No Matches
PxeBcImpl.h
Go to the documentation of this file.
1
11
#ifndef __EFI_PXEBC_IMPL_H__
12
#define __EFI_PXEBC_IMPL_H__
13
14
#include <
Uefi.h
>
15
16
#include <
Guid/SmBios.h
>
17
#include <
IndustryStandard/SmBios.h
>
18
#include <
IndustryStandard/Dhcp.h
>
19
#include <
Protocol/NetworkInterfaceIdentifier.h
>
20
#include <
Protocol/Arp.h
>
21
#include <
Protocol/Ip4.h
>
22
#include <
Protocol/Ip4Config2.h
>
23
#include <
Protocol/Ip6.h
>
24
#include <
Protocol/Ip6Config.h
>
25
#include <
Protocol/Udp4.h
>
26
#include <
Protocol/Udp6.h
>
27
#include <
Protocol/Dhcp4.h
>
28
#include <
Protocol/Dhcp6.h
>
29
#include <
Protocol/Dns6.h
>
30
#include <
Protocol/Mtftp4.h
>
31
#include <
Protocol/Mtftp6.h
>
32
#include <
Protocol/PxeBaseCode.h
>
33
#include <
Protocol/LoadFile.h
>
34
#include <
Protocol/PxeBaseCodeCallBack.h
>
35
#include <
Protocol/ServiceBinding.h
>
36
#include <
Protocol/DriverBinding.h
>
37
#include <
Protocol/AdapterInformation.h
>
38
39
#include <
Library/DebugLib.h
>
40
#include <
Library/BaseMemoryLib.h
>
41
#include <
Library/MemoryAllocationLib.h
>
42
#include <
Library/UefiDriverEntryPoint.h
>
43
#include <
Library/UefiBootServicesTableLib.h
>
44
#include <
Library/UefiRuntimeServicesTableLib.h
>
45
#include <
Library/UefiLib.h
>
46
#include <
Library/BaseLib.h
>
47
#include <
Library/NetLib.h
>
48
#include <
Library/DpcLib.h
>
49
#include <
Library/DevicePathLib.h
>
50
#include <
Library/PcdLib.h
>
51
#include <
Library/ReportStatusCodeLib.h
>
52
53
typedef
struct
_PXEBC_PRIVATE_DATA
PXEBC_PRIVATE_DATA
;
54
typedef
struct
_PXEBC_PRIVATE_PROTOCOL
PXEBC_PRIVATE_PROTOCOL
;
55
typedef
struct
_PXEBC_VIRTUAL_NIC
PXEBC_VIRTUAL_NIC
;
56
57
#include "
PxeBcDriver.h
"
58
#include "
PxeBcDhcp4.h
"
59
#include "
PxeBcDhcp6.h
"
60
#include "
PxeBcMtftp.h
"
61
#include "
PxeBcBoot.h
"
62
#include "
PxeBcSupport.h
"
63
64
#define PXEBC_DEFAULT_HOPLIMIT 64
65
#define PXEBC_DEFAULT_LIFETIME 50000
// 50 ms, unit is microsecond
66
#define PXEBC_UDP_TIMEOUT 30000000
// 3 seconds, unit is 100nanosecond
67
#define PXEBC_DAD_ADDITIONAL_DELAY 30000000
// 3 seconds
68
#define PXEBC_MTFTP_TIMEOUT 4
69
#define PXEBC_MTFTP_RETRIES 6
70
#define PXEBC_DHCP_RETRIES 4
// refers to mPxeDhcpTimeout, also by PXE2.1 spec.
71
#define PXEBC_MENU_MAX_NUM 24
72
#define PXEBC_OFFER_MAX_NUM 16
73
74
#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
75
76
#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')
77
#define PXEBC_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'V')
78
#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)
79
#define PXEBC_PRIVATE_DATA_FROM_ID(a) CR (a, PXEBC_PRIVATE_DATA, Id, PXEBC_PRIVATE_DATA_SIGNATURE)
80
#define PXEBC_VIRTUAL_NIC_FROM_LOADFILE(a) CR (a, PXEBC_VIRTUAL_NIC, LoadFile, PXEBC_VIRTUAL_NIC_SIGNATURE)
81
82
#define PXE_ENABLED 0x01
83
#define PXE_DISABLED 0x00
84
85
typedef
union
{
86
PXEBC_DHCP4_PACKET_CACHE
Dhcp4;
87
PXEBC_DHCP6_PACKET_CACHE
Dhcp6;
88
}
PXEBC_DHCP_PACKET_CACHE
;
89
90
struct
_PXEBC_PRIVATE_PROTOCOL
{
91
UINT64 Reserved;
92
};
93
94
struct
_PXEBC_VIRTUAL_NIC
{
95
UINT32 Signature;
96
EFI_HANDLE
Controller;
97
EFI_LOAD_FILE_PROTOCOL
LoadFile;
98
EFI_DEVICE_PATH_PROTOCOL
*DevicePath;
99
PXEBC_PRIVATE_DATA
*Private;
100
};
101
102
struct
_PXEBC_PRIVATE_DATA
{
103
UINT32 Signature;
104
EFI_HANDLE
Controller;
105
EFI_HANDLE
Image;
106
107
PXEBC_PRIVATE_PROTOCOL
Id;
108
EFI_SIMPLE_NETWORK_PROTOCOL
*Snp;
109
110
PXEBC_VIRTUAL_NIC
*Ip4Nic;
111
PXEBC_VIRTUAL_NIC
*Ip6Nic;
112
113
EFI_HANDLE
ArpChild;
114
EFI_HANDLE
Ip4Child;
115
EFI_HANDLE
Dhcp4Child;
116
EFI_HANDLE
Mtftp4Child;
117
EFI_HANDLE
Udp4ReadChild;
118
EFI_HANDLE
Udp4WriteChild;
119
120
EFI_ARP_PROTOCOL
*Arp;
121
EFI_IP4_PROTOCOL
*Ip4;
122
EFI_IP4_CONFIG2_PROTOCOL
*Ip4Config2;
123
EFI_DHCP4_PROTOCOL
*Dhcp4;
124
EFI_MTFTP4_PROTOCOL
*Mtftp4;
125
EFI_UDP4_PROTOCOL
*Udp4Read;
126
EFI_UDP4_PROTOCOL
*Udp4Write;
127
128
EFI_HANDLE
Ip6Child;
129
EFI_HANDLE
Dhcp6Child;
130
EFI_HANDLE
Mtftp6Child;
131
EFI_HANDLE
Udp6ReadChild;
132
EFI_HANDLE
Udp6WriteChild;
133
134
EFI_IP6_PROTOCOL
*Ip6;
135
EFI_IP6_CONFIG_PROTOCOL
*Ip6Cfg;
136
EFI_DHCP6_PROTOCOL
*Dhcp6;
137
EFI_MTFTP6_PROTOCOL
*Mtftp6;
138
EFI_UDP6_PROTOCOL
*Udp6Read;
139
EFI_UDP6_PROTOCOL
*Udp6Write;
140
EFI_DNS6_PROTOCOL
*Dns6;
141
142
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*Nii;
143
EFI_PXE_BASE_CODE_PROTOCOL
PxeBc;
144
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
LoadFileCallback;
145
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
*PxeBcCallback;
146
EFI_DEVICE_PATH_PROTOCOL
*DevicePath;
147
148
EFI_PXE_BASE_CODE_MODE
Mode;
149
EFI_PXE_BASE_CODE_FUNCTION
Function;
150
UINT32 Ip6Policy;
151
UINT32 SolicitTimes;
152
UINT64 ElapsedTime;
153
154
EFI_UDP4_CONFIG_DATA
Udp4CfgData;
155
EFI_UDP6_CONFIG_DATA
Udp6CfgData;
156
EFI_IP4_CONFIG_DATA
Ip4CfgData;
157
EFI_IP6_CONFIG_DATA
Ip6CfgData;
158
159
EFI_EVENT
UdpTimeOutEvent;
160
EFI_EVENT
ArpUpdateEvent;
161
EFI_IP4_COMPLETION_TOKEN
IcmpToken;
162
EFI_IP6_COMPLETION_TOKEN
Icmp6Token;
163
164
BOOLEAN IsAddressOk;
165
BOOLEAN IsOfferSorted;
166
BOOLEAN IsProxyRecved;
167
BOOLEAN IsDoDiscover;
168
169
EFI_IP_ADDRESS
TmpStationIp;
170
EFI_IP_ADDRESS
StationIp;
171
EFI_IP_ADDRESS
SubnetMask;
172
EFI_IP_ADDRESS
GatewayIp;
173
EFI_IP_ADDRESS
ServerIp;
174
EFI_IPv6_ADDRESS
*DnsServer;
175
UINT16 CurSrcPort;
176
UINT32 IaId;
177
178
UINT32 Ip4MaxPacketSize;
179
UINT32 Ip6MaxPacketSize;
180
UINT8 *BootFileName;
181
UINTN
BootFileSize;
182
UINTN
BlockSize;
183
184
PXEBC_DHCP_PACKET_CACHE
ProxyOffer;
185
PXEBC_DHCP_PACKET_CACHE
DhcpAck;
186
PXEBC_DHCP_PACKET_CACHE
PxeReply;
187
EFI_DHCP6_PACKET
*Dhcp6Request;
188
EFI_DHCP4_PACKET
SeedPacket;
189
190
//
191
// OfferIndex records the index of DhcpOffer[] buffer, and OfferCount records the num of each type of offer.
192
//
193
// It supposed that
194
//
195
// OfferNum: 8
196
// OfferBuffer: [ProxyBinl, ProxyBinl, DhcpOnly, ProxyPxe10, DhcpOnly, DhcpPxe10, DhcpBinl, ProxyBinl]
197
// (OfferBuffer is 0-based.)
198
//
199
// And assume that (DhcpPxe10 is the first priority actually.)
200
//
201
// SelectIndex: 2
202
// SelectProxyType: PXEBC_OFFER_TYPE_PROXY_BINL
203
// (SelectIndex is 1-based, and 0 means no one is selected.)
204
//
205
// So it should be
206
//
207
// DhcpOnly DhcpPxe10 DhcpWfm11a DhcpBinl ProxyPxe10 ProxyWfm11a ProxyBinl Bootp
208
// OfferCount: [ 2(n), 1(n), 0(n), 1(n), 1(1), 0(1), 3(n), 1(1)]
209
//
210
// OfferIndex: {[ 2, 5, 0, 6, 3, 0, *0, 0]
211
// [ 4, 0, 0, 0, 0, 0, 1, 0]
212
// [ 0, 0, 0, 0, 0, 0, 7, 0]
213
// ... ]}
214
// (OfferIndex is 0-based.)
215
//
216
//
217
UINT32 SelectIndex;
218
UINT32 SelectProxyType;
219
PXEBC_DHCP_PACKET_CACHE
OfferBuffer[PXEBC_OFFER_MAX_NUM];
220
UINT32 OfferNum;
221
UINT32 OfferCount[PxeOfferTypeMax];
222
UINT32 OfferIndex[PxeOfferTypeMax][PXEBC_OFFER_MAX_NUM];
223
};
224
225
extern
EFI_PXE_BASE_CODE_PROTOCOL
gPxeBcProtocolTemplate;
226
extern
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
gPxeBcCallBackTemplate;
227
extern
EFI_LOAD_FILE_PROTOCOL
gLoadFileProtocolTemplate;
228
229
#endif
UINTN
UINT64 UINTN
Definition:
ProcessorBind.h:112
AdapterInformation.h
Arp.h
BaseLib.h
BaseMemoryLib.h
DevicePathLib.h
Dhcp4.h
Dhcp6.h
Dhcp.h
Dns6.h
DpcLib.h
SmBios.h
SmBios.h
Ip4.h
Ip4Config2.h
Ip6.h
Ip6Config.h
DebugLib.h
ReportStatusCodeLib.h
DriverBinding.h
MemoryAllocationLib.h
Mtftp4.h
Mtftp6.h
NetLib.h
NetworkInterfaceIdentifier.h
PcdLib.h
LoadFile.h
PxeBaseCode.h
PxeBaseCodeCallBack.h
EFI_PXE_BASE_CODE_FUNCTION
EFI_PXE_BASE_CODE_FUNCTION
Definition:
PxeBaseCodeCallBack.h:48
PxeBcBoot.h
PxeBcDhcp4.h
PxeBcDhcp6.h
PxeBcDriver.h
PxeBcMtftp.h
PxeBcSupport.h
ServiceBinding.h
Udp4.h
Udp6.h
Uefi.h
EFI_EVENT
VOID * EFI_EVENT
Definition:
UefiBaseType.h:37
EFI_HANDLE
VOID * EFI_HANDLE
Definition:
UefiBaseType.h:33
UefiBootServicesTableLib.h
UefiDriverEntryPoint.h
UefiLib.h
UefiRuntimeServicesTableLib.h
_EFI_ARP_PROTOCOL
Definition:
Arp.h:363
_EFI_DHCP4_PROTOCOL
Definition:
Dhcp4.h:747
_EFI_DHCP6_PROTOCOL
Definition:
Dhcp6.h:765
_EFI_DNS6_PROTOCOL
Definition:
Dns6.h:519
_EFI_IP4_CONFIG2_PROTOCOL
Definition:
Ip4Config2.h:307
_EFI_IP4_PROTOCOL
Definition:
Ip4.h:588
_EFI_IP6_CONFIG_PROTOCOL
Definition:
Ip6Config.h:358
_EFI_IP6_PROTOCOL
Definition:
Ip6.h:931
_EFI_LOAD_FILE_PROTOCOL
Definition:
LoadFile.h:76
_EFI_MTFTP4_PROTOCOL
Definition:
Mtftp4.h:499
_EFI_MTFTP6_PROTOCOL
Definition:
Mtftp6.h:804
_EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
Definition:
NetworkInterfaceIdentifier.h:55
_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
Definition:
PxeBaseCodeCallBack.h:111
_EFI_PXE_BASE_CODE_PROTOCOL
Definition:
PxeBaseCode.h:906
_EFI_SIMPLE_NETWORK_PROTOCOL
Definition:
SimpleNetwork.h:643
_EFI_UDP4_PROTOCOL
Definition:
Udp4.h:423
_EFI_UDP6_PROTOCOL
Definition:
Udp6.h:561
_PXEBC_PRIVATE_DATA
Definition:
PxeBcImpl.h:102
_PXEBC_PRIVATE_PROTOCOL
Definition:
PxeBcImpl.h:90
_PXEBC_VIRTUAL_NIC
Definition:
PxeBcImpl.h:94
EFI_DEVICE_PATH_PROTOCOL
Definition:
DevicePath.h:43
EFI_DHCP4_PACKET
Definition:
Dhcp4.h:70
EFI_DHCP6_PACKET
Definition:
Dhcp6.h:181
EFI_IP4_COMPLETION_TOKEN
Definition:
Ip4.h:237
EFI_IP4_CONFIG_DATA
Definition:
Ip4.h:58
EFI_IP6_COMPLETION_TOKEN
Definition:
Ip6.h:517
EFI_IP6_CONFIG_DATA
Definition:
Ip6.h:137
EFI_PXE_BASE_CODE_MODE
Definition:
PxeBaseCode.h:269
EFI_UDP4_CONFIG_DATA
Definition:
Udp4.h:67
EFI_UDP6_CONFIG_DATA
Definition:
Udp6.h:118
IPv6_ADDRESS
Definition:
Base.h:230
PXEBC_DHCP4_PACKET_CACHE
Definition:
PxeBcDhcp4.h:266
PXEBC_DHCP6_PACKET_CACHE
Definition:
PxeBcDhcp6.h:121
EFI_IP_ADDRESS
Definition:
UefiBaseType.h:103
PXEBC_DHCP_PACKET_CACHE
Definition:
PxeBcImpl.h:85
NetworkPkg
UefiPxeBcDxe
PxeBcImpl.h
Generated on Fri Nov 15 2024 18:01:20 for TianoCore EDK2 by
1.9.6