]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
NetworkPkg: Remove some clarification from IScsiDxe.inf
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcImpl.h
CommitLineData
30368135 1/** @file\r
2\r
ac6c3d90 3Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 4This program and the accompanying materials\r
30368135 5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
30368135 12**/\r
13\r
14#ifndef __EFI_PXEBC_IMPL_H__\r
15#define __EFI_PXEBC_IMPL_H__\r
16\r
17\r
18typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;\r
19\r
2517435c 20#include <Uefi.h>\r
30368135 21\r
22#include <Guid/SmBios.h>\r
23#include <IndustryStandard/SmBios.h>\r
ac6c3d90 24#include <IndustryStandard/Dhcp.h>\r
30368135 25#include <Protocol/Dhcp4.h>\r
26#include <Protocol/PxeBaseCode.h>\r
27#include <Protocol/Mtftp4.h>\r
28#include <Protocol/Udp4.h>\r
29#include <Protocol/LoadFile.h>\r
30#include <Protocol/NetworkInterfaceIdentifier.h>\r
31#include <Protocol/PxeBaseCodeCallBack.h>\r
32#include <Protocol/Arp.h>\r
33#include <Protocol/Ip4.h>\r
14e84fd8 34#include <Protocol/Ip4Config2.h>\r
30368135 35\r
36#include <Library/DebugLib.h>\r
6758032d 37#include <Library/DevicePathLib.h>\r
30368135 38#include <Library/BaseMemoryLib.h>\r
20610fa8 39#include <Library/MemoryAllocationLib.h>\r
30368135 40#include <Library/UefiDriverEntryPoint.h>\r
41#include <Library/UefiBootServicesTableLib.h>\r
42#include <Library/UefiLib.h>\r
43#include <Library/BaseLib.h>\r
44#include <Library/NetLib.h>\r
d8d26fb2 45#include <Library/DpcLib.h>\r
cfbc1a75 46#include <Library/PcdLib.h>\r
30368135 47\r
48#include "PxeBcDriver.h"\r
30368135 49#include "PxeBcDhcp.h"\r
50#include "PxeBcMtftp.h"\r
51#include "PxeBcSupport.h"\r
52\r
f3f2e05d 53#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')\r
fa6d3ee4 54#define PXEBC_MTFTP_TIMEOUT 4\r
55#define PXEBC_MTFTP_RETRIES 6\r
4b738c76 56#define PXEBC_DEFAULT_UDP_OVERHEAD_SIZE 8\r
fa6d3ee4 57#define PXEBC_DEFAULT_TFTP_OVERHEAD_SIZE 4\r
7bc01e86 58#define PXEBC_DEFAULT_PACKET_SIZE 1480\r
2e4c2a04 59#define PXEBC_DEFAULT_LIFETIME 50000 // 50ms, unit is microsecond\r
8ce6b650 60#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)\r
30368135 61\r
62struct _PXEBC_PRIVATE_DATA {\r
63 UINT32 Signature;\r
64 EFI_HANDLE Controller;\r
65 EFI_HANDLE Image;\r
66 EFI_HANDLE ArpChild;\r
67 EFI_HANDLE Dhcp4Child;\r
68 EFI_HANDLE Ip4Child;\r
69 EFI_HANDLE Mtftp4Child;\r
70 EFI_HANDLE Udp4ReadChild;\r
71 EFI_HANDLE Udp4WriteChild;\r
72\r
73 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;\r
74\r
75 EFI_PXE_BASE_CODE_PROTOCOL PxeBc;\r
76 EFI_LOAD_FILE_PROTOCOL LoadFile;\r
77 EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL LoadFileCallback;\r
78 EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *PxeBcCallback;\r
79 EFI_ARP_PROTOCOL *Arp;\r
80 EFI_DHCP4_PROTOCOL *Dhcp4;\r
81 EFI_IP4_PROTOCOL *Ip4;\r
14e84fd8 82 EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;\r
30368135 83 EFI_IP4_CONFIG_DATA Ip4ConfigData;\r
84 EFI_MTFTP4_PROTOCOL *Mtftp4;\r
85 EFI_UDP4_PROTOCOL *Udp4Read;\r
86 EFI_UDP4_PROTOCOL *Udp4Write;\r
87 UINT16 CurrentUdpSrcPort;\r
88 EFI_UDP4_CONFIG_DATA Udp4CfgData;\r
89\r
90\r
91 EFI_PXE_BASE_CODE_MODE Mode;\r
92 EFI_PXE_BASE_CODE_FUNCTION Function;\r
93\r
94 CHAR8 *BootFileName;\r
95\r
96 EFI_IP_ADDRESS StationIp;\r
97 EFI_IP_ADDRESS SubnetMask;\r
98 EFI_IP_ADDRESS GatewayIp;\r
99 EFI_IP_ADDRESS ServerIp;\r
100 BOOLEAN AddressIsOk;\r
fa6d3ee4 101 UINT32 Ip4MaxPacketSize;\r
102 UINTN BlockSize;\r
30368135 103 UINTN FileSize;\r
104\r
105 UINT8 OptionBuffer[PXEBC_DHCP4_MAX_OPTION_SIZE];\r
106 EFI_DHCP4_PACKET SeedPacket;\r
107 EFI_MAC_ADDRESS Mac;\r
108 UINT8 MacLen;\r
109\r
110 BOOLEAN SortOffers;\r
111 BOOLEAN GotProxyOffer;\r
112 UINT32 NumOffers;\r
113 UINT32 SelectedOffer;\r
114 UINT32 ProxyOfferType;\r
115\r
116 //\r
117 // Cached packets as complements of pxe mode data\r
118 //\r
119 PXEBC_CACHED_DHCP4_PACKET ProxyOffer;\r
120 PXEBC_CACHED_DHCP4_PACKET Dhcp4Ack;\r
121 PXEBC_CACHED_DHCP4_PACKET PxeReply;\r
122 PXEBC_CACHED_DHCP4_PACKET Dhcp4Offers[PXEBC_MAX_OFFER_NUM];\r
123\r
124 //\r
125 // Arrays for different types of offers:\r
126 // ServerCount records the count of the servers we got the offers,\r
127 // OfferIndex records the index of the offer sent by the server indexed by ServerCount.\r
128 //\r
129 UINT32 ServerCount[DHCP4_PACKET_TYPE_MAX];\r
130 UINT32 OfferIndex[DHCP4_PACKET_TYPE_MAX][PXEBC_MAX_OFFER_NUM];\r
131 UINT32 BootpIndex;\r
132 UINT32 ProxyIndex[DHCP4_PACKET_TYPE_MAX];\r
133 UINT32 BinlIndex[PXEBC_MAX_OFFER_NUM];\r
134\r
135 EFI_EVENT GetArpCacheEvent;\r
136 //\r
137 // token and event used to get ICMP error data from IP\r
138 //\r
139 EFI_IP4_COMPLETION_TOKEN IcmpErrorRcvToken;\r
140};\r
141\r
142#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)\r
143\r
144#define PXEBC_PRIVATE_DATA_FROM_LOADFILE(a) CR (a, PXEBC_PRIVATE_DATA, LoadFile, PXEBC_PRIVATE_DATA_SIGNATURE)\r
145\r
146#define PXEBC_PRIVATE_DATA_FROM_PXEBCCALLBACK(a) CR (a, PXEBC_PRIVATE_DATA, PxeBcCallback, PXEBC_PRIVATE_DATA_SIGNATURE)\r
147\r
148extern EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate;\r
149extern EFI_LOAD_FILE_PROTOCOL mLoadFileProtocolTemplate;\r
150\r
f737cfb9 151/**\r
152 Causes the driver to load a specified file.\r
153\r
154 @param This Protocol instance pointer.\r
155 @param FilePath The device specific path of the file to load.\r
7bc01e86 156 @param BootPolicy If TRUE, indicates that the request originates from the\r
f737cfb9 157 boot manager is attempting to load FilePath as a boot\r
158 selection. If FALSE, then FilePath must match as exact file\r
159 to be loaded.\r
160 @param BufferSize On input the size of Buffer in bytes. On output with a return\r
7bc01e86 161 code of EFI_SUCCESS, the amount of data transferred to\r
f737cfb9 162 Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,\r
163 the size of Buffer required to retrieve the requested file.\r
164 @param Buffer The memory buffer to transfer the file to. IF Buffer is NULL,\r
7bc01e86 165 then no the size of the requested file is returned in\r
f737cfb9 166 BufferSize.\r
167\r
168 @retval EFI_SUCCESS The file was loaded.\r
169 @retval EFI_UNSUPPORTED The device does not support the provided BootPolicy\r
7bc01e86 170 @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or\r
f737cfb9 171 BufferSize is NULL.\r
172 @retval EFI_NO_MEDIA No medium was present to load the file.\r
173 @retval EFI_DEVICE_ERROR The file was not loaded due to a device error.\r
174 @retval EFI_NO_RESPONSE The remote system did not respond.\r
175 @retval EFI_NOT_FOUND The file was not found.\r
176 @retval EFI_ABORTED The file load process was manually cancelled.\r
177\r
178**/\r
179EFI_STATUS\r
180EFIAPI\r
181EfiPxeLoadFile (\r
182 IN EFI_LOAD_FILE_PROTOCOL * This,\r
183 IN EFI_DEVICE_PATH_PROTOCOL * FilePath,\r
184 IN BOOLEAN BootPolicy,\r
185 IN OUT UINTN *BufferSize,\r
186 IN VOID *Buffer OPTIONAL\r
187 );\r
188\r
30368135 189#endif\r