]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
OvmfPkg/VirtioScsiDxe: list "VirtioScsi.h" in the INF file
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcImpl.h
... / ...
CommitLineData
1/** @file\r
2 This EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.\r
3 interfaces declaration.\r
4\r
5 Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef __EFI_PXEBC_IMPL_H__\r
18#define __EFI_PXEBC_IMPL_H__\r
19\r
20#include <Uefi.h>\r
21\r
22#include <Guid/SmBios.h>\r
23#include <IndustryStandard/SmBios.h>\r
24#include <IndustryStandard/Dhcp.h>\r
25#include <Protocol/NetworkInterfaceIdentifier.h>\r
26#include <Protocol/Arp.h>\r
27#include <Protocol/Ip4.h>\r
28#include <Protocol/Ip4Config2.h>\r
29#include <Protocol/Ip6.h>\r
30#include <Protocol/Ip6Config.h>\r
31#include <Protocol/Udp4.h>\r
32#include <Protocol/Udp6.h>\r
33#include <Protocol/Dhcp4.h>\r
34#include <Protocol/Dhcp6.h>\r
35#include <Protocol/Dns6.h>\r
36#include <Protocol/Mtftp4.h>\r
37#include <Protocol/Mtftp6.h>\r
38#include <Protocol/PxeBaseCode.h>\r
39#include <Protocol/LoadFile.h>\r
40#include <Protocol/PxeBaseCodeCallBack.h>\r
41#include <Protocol/ServiceBinding.h>\r
42#include <Protocol/DriverBinding.h>\r
43#include <Protocol/AdapterInformation.h>\r
44\r
45#include <Library/DebugLib.h>\r
46#include <Library/BaseMemoryLib.h>\r
47#include <Library/MemoryAllocationLib.h>\r
48#include <Library/UefiDriverEntryPoint.h>\r
49#include <Library/UefiBootServicesTableLib.h>\r
50#include <Library/UefiRuntimeServicesTableLib.h>\r
51#include <Library/UefiLib.h>\r
52#include <Library/BaseLib.h>\r
53#include <Library/NetLib.h>\r
54#include <Library/DpcLib.h>\r
55#include <Library/DevicePathLib.h>\r
56#include <Library/PcdLib.h>\r
57\r
58typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;\r
59typedef struct _PXEBC_PRIVATE_PROTOCOL PXEBC_PRIVATE_PROTOCOL;\r
60typedef struct _PXEBC_VIRTUAL_NIC PXEBC_VIRTUAL_NIC;\r
61\r
62#include "PxeBcDriver.h"\r
63#include "PxeBcDhcp4.h"\r
64#include "PxeBcDhcp6.h"\r
65#include "PxeBcMtftp.h"\r
66#include "PxeBcBoot.h"\r
67#include "PxeBcSupport.h"\r
68\r
69#define PXEBC_DEFAULT_HOPLIMIT 64\r
70#define PXEBC_DEFAULT_LIFETIME 50000 // 50 ms, unit is microsecond\r
71#define PXEBC_UDP_TIMEOUT 30000000 // 3 seconds, unit is 100nanosecond\r
72#define PXEBC_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds\r
73#define PXEBC_MTFTP_TIMEOUT 4\r
74#define PXEBC_MTFTP_RETRIES 6\r
75#define PXEBC_DHCP_RETRIES 4 // refers to mPxeDhcpTimeout, also by PXE2.1 spec.\r
76#define PXEBC_MENU_MAX_NUM 24\r
77#define PXEBC_OFFER_MAX_NUM 16\r
78\r
79#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)\r
80\r
81#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')\r
82#define PXEBC_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'V')\r
83#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)\r
84#define PXEBC_PRIVATE_DATA_FROM_ID(a) CR (a, PXEBC_PRIVATE_DATA, Id, PXEBC_PRIVATE_DATA_SIGNATURE)\r
85#define PXEBC_VIRTUAL_NIC_FROM_LOADFILE(a) CR (a, PXEBC_VIRTUAL_NIC, LoadFile, PXEBC_VIRTUAL_NIC_SIGNATURE)\r
86\r
87typedef union {\r
88 PXEBC_DHCP4_PACKET_CACHE Dhcp4;\r
89 PXEBC_DHCP6_PACKET_CACHE Dhcp6;\r
90} PXEBC_DHCP_PACKET_CACHE;\r
91\r
92struct _PXEBC_PRIVATE_PROTOCOL {\r
93 UINT64 Reserved;\r
94};\r
95\r
96struct _PXEBC_VIRTUAL_NIC {\r
97 UINT32 Signature;\r
98 EFI_HANDLE Controller;\r
99 EFI_LOAD_FILE_PROTOCOL LoadFile;\r
100 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
101 PXEBC_PRIVATE_DATA *Private;\r
102};\r
103\r
104struct _PXEBC_PRIVATE_DATA {\r
105 UINT32 Signature;\r
106 EFI_HANDLE Controller;\r
107 EFI_HANDLE Image;\r
108\r
109 PXEBC_PRIVATE_PROTOCOL Id;\r
110 EFI_SIMPLE_NETWORK_PROTOCOL *Snp; \r
111\r
112 PXEBC_VIRTUAL_NIC *Ip4Nic;\r
113 PXEBC_VIRTUAL_NIC *Ip6Nic;\r
114\r
115 EFI_HANDLE ArpChild;\r
116 EFI_HANDLE Ip4Child;\r
117 EFI_HANDLE Dhcp4Child;\r
118 EFI_HANDLE Mtftp4Child;\r
119 EFI_HANDLE Udp4ReadChild;\r
120 EFI_HANDLE Udp4WriteChild;\r
121\r
122 EFI_ARP_PROTOCOL *Arp;\r
123 EFI_IP4_PROTOCOL *Ip4;\r
124 EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;\r
125 EFI_DHCP4_PROTOCOL *Dhcp4;\r
126 EFI_MTFTP4_PROTOCOL *Mtftp4;\r
127 EFI_UDP4_PROTOCOL *Udp4Read;\r
128 EFI_UDP4_PROTOCOL *Udp4Write;\r
129\r
130 EFI_HANDLE Ip6Child;\r
131 EFI_HANDLE Dhcp6Child;\r
132 EFI_HANDLE Mtftp6Child;\r
133 EFI_HANDLE Udp6ReadChild;\r
134 EFI_HANDLE Udp6WriteChild;\r
135\r
136 EFI_IP6_PROTOCOL *Ip6;\r
137 EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;\r
138 EFI_DHCP6_PROTOCOL *Dhcp6;\r
139 EFI_MTFTP6_PROTOCOL *Mtftp6;\r
140 EFI_UDP6_PROTOCOL *Udp6Read;\r
141 EFI_UDP6_PROTOCOL *Udp6Write;\r
142 EFI_DNS6_PROTOCOL *Dns6;\r
143\r
144 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;\r
145 EFI_PXE_BASE_CODE_PROTOCOL PxeBc;\r
146 EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL LoadFileCallback;\r
147 EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *PxeBcCallback;\r
148 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
149\r
150 EFI_PXE_BASE_CODE_MODE Mode;\r
151 EFI_PXE_BASE_CODE_FUNCTION Function;\r
152 UINT32 Ip6Policy;\r
153 UINT32 SolicitTimes;\r
154 UINT64 ElapsedTime;\r
155\r
156 EFI_UDP4_CONFIG_DATA Udp4CfgData;\r
157 EFI_UDP6_CONFIG_DATA Udp6CfgData;\r
158 EFI_IP4_CONFIG_DATA Ip4CfgData;\r
159 EFI_IP6_CONFIG_DATA Ip6CfgData;\r
160\r
161 EFI_EVENT UdpTimeOutEvent;\r
162 EFI_EVENT ArpUpdateEvent;\r
163 EFI_IP4_COMPLETION_TOKEN IcmpToken;\r
164 EFI_IP6_COMPLETION_TOKEN Icmp6Token;\r
165\r
166 BOOLEAN IsAddressOk;\r
167 BOOLEAN IsOfferSorted;\r
168 BOOLEAN IsProxyRecved;\r
169 BOOLEAN IsDoDiscover;\r
170\r
171 EFI_IP_ADDRESS TmpStationIp;\r
172 EFI_IP_ADDRESS StationIp;\r
173 EFI_IP_ADDRESS SubnetMask;\r
174 EFI_IP_ADDRESS GatewayIp;\r
175 EFI_IP_ADDRESS ServerIp;\r
176 EFI_IPv6_ADDRESS *DnsServer;\r
177 UINT16 CurSrcPort;\r
178 UINT32 IaId;\r
179\r
180 UINT32 Ip4MaxPacketSize;\r
181 UINT32 Ip6MaxPacketSize;\r
182 UINT8 *BootFileName;\r
183 UINTN BootFileSize;\r
184 UINTN BlockSize;\r
185\r
186 PXEBC_DHCP_PACKET_CACHE ProxyOffer;\r
187 PXEBC_DHCP_PACKET_CACHE DhcpAck;\r
188 PXEBC_DHCP_PACKET_CACHE PxeReply;\r
189 EFI_DHCP6_PACKET *Dhcp6Request;\r
190 EFI_DHCP4_PACKET SeedPacket;\r
191\r
192 //\r
193 // OfferIndex records the index of DhcpOffer[] buffer, and OfferCount records the num of each type of offer.\r
194 //\r
195 // It supposed that\r
196 //\r
197 // OfferNum: 8\r
198 // OfferBuffer: [ProxyBinl, ProxyBinl, DhcpOnly, ProxyPxe10, DhcpOnly, DhcpPxe10, DhcpBinl, ProxyBinl]\r
199 // (OfferBuffer is 0-based.)\r
200 //\r
201 // And assume that (DhcpPxe10 is the first priority actually.)\r
202 //\r
203 // SelectIndex: 2\r
204 // SelectProxyType: PXEBC_OFFER_TYPE_PROXY_BINL\r
205 // (SelectIndex is 1-based, and 0 means no one is selected.)\r
206 //\r
207 // So it should be\r
208 //\r
209 // DhcpOnly DhcpPxe10 DhcpWfm11a DhcpBinl ProxyPxe10 ProxyWfm11a ProxyBinl Bootp\r
210 // OfferCount: [ 2(n), 1(n), 0(n), 1(n), 1(1), 0(1), 3(n), 1(1)]\r
211 //\r
212 // OfferIndex: {[ 2, 5, 0, 6, 3, 0, *0, 0]\r
213 // [ 4, 0, 0, 0, 0, 0, 1, 0]\r
214 // [ 0, 0, 0, 0, 0, 0, 7, 0]\r
215 // ... ]}\r
216 // (OfferIndex is 0-based.)\r
217 //\r
218 //\r
219 UINT32 SelectIndex;\r
220 UINT32 SelectProxyType;\r
221 PXEBC_DHCP_PACKET_CACHE OfferBuffer[PXEBC_OFFER_MAX_NUM];\r
222 UINT32 OfferNum;\r
223 UINT32 OfferCount[PxeOfferTypeMax];\r
224 UINT32 OfferIndex[PxeOfferTypeMax][PXEBC_OFFER_MAX_NUM];\r
225};\r
226\r
227extern EFI_PXE_BASE_CODE_PROTOCOL gPxeBcProtocolTemplate;\r
228extern EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL gPxeBcCallBackTemplate;\r
229extern EFI_LOAD_FILE_PROTOCOL gLoadFileProtocolTemplate;\r
230\r
231#endif\r