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