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