]>
Commit | Line | Data |
---|---|---|
bcecde14 | 1 | /** @file\r |
2 | \r | |
0a6f4824 | 3 | Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r |
bcecde14 | 4 | \r |
c0a00b14 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
bcecde14 | 6 | \r |
7 | **/\r | |
8 | \r | |
9 | #ifndef _BIOS_SNP_16_H_\r | |
10 | #define _BIOS_SNP_16_H_\r | |
11 | \r | |
12 | #include <Uefi.h>\r | |
13 | \r | |
14 | #include <Protocol/LegacyBios.h>\r | |
15 | #include <Protocol/SimpleNetwork.h>\r | |
16 | #include <Protocol/PciIo.h>\r | |
17 | #include <Protocol/NetworkInterfaceIdentifier.h>\r | |
18 | #include <Protocol/DevicePath.h>\r | |
19 | \r | |
20 | #include <Library/UefiDriverEntryPoint.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/BaseMemoryLib.h>\r | |
23 | #include <Library/UefiBootServicesTableLib.h>\r | |
24 | #include <Library/UefiLib.h>\r | |
25 | #include <Library/BaseLib.h>\r | |
26 | #include <Library/DevicePathLib.h>\r | |
27 | #include <Library/MemoryAllocationLib.h>\r | |
28 | \r | |
29 | #include <Guid/EventGroup.h>\r | |
30 | \r | |
31 | #include <IndustryStandard/Pci.h>\r | |
32 | \r | |
33 | #include "Pxe.h"\r | |
34 | \r | |
35 | //\r | |
36 | // BIOS Simple Network Protocol Device Structure\r | |
37 | //\r | |
38 | #define EFI_SIMPLE_NETWORK_DEV_SIGNATURE SIGNATURE_32 ('s', 'n', '1', '6')\r | |
39 | \r | |
40 | #define INIT_PXE_STATUS 0xabcd\r | |
41 | \r | |
42 | #define EFI_SIMPLE_NETWORK_MAX_TX_FIFO_SIZE 64\r | |
43 | \r | |
44 | typedef struct {\r | |
45 | UINT32 First;\r | |
46 | UINT32 Last;\r | |
47 | VOID * Data[EFI_SIMPLE_NETWORK_MAX_TX_FIFO_SIZE];\r | |
48 | } EFI_SIMPLE_NETWORK_DEV_FIFO;\r | |
49 | \r | |
50 | typedef struct {\r | |
51 | UINTN Signature;\r | |
52 | EFI_HANDLE Handle;\r | |
53 | EFI_SIMPLE_NETWORK_PROTOCOL SimpleNetwork;\r | |
54 | EFI_SIMPLE_NETWORK_MODE SimpleNetworkMode;\r | |
55 | EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL Nii;\r | |
56 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
57 | EFI_PCI_IO_PROTOCOL *PciIo;\r | |
58 | EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;\r | |
59 | \r | |
60 | //\r | |
61 | // Local Data for Simple Network Protocol interface goes here\r | |
62 | //\r | |
63 | BOOLEAN UndiLoaded;\r | |
64 | EFI_EVENT EfiBootEvent;\r | |
65 | EFI_EVENT LegacyBootEvent;\r | |
66 | UINT16 PxeEntrySegment;\r | |
67 | UINT16 PxeEntryOffset;\r | |
68 | EFI_SIMPLE_NETWORK_DEV_FIFO TxBufferFifo;\r | |
69 | EFI_DEVICE_PATH_PROTOCOL *BaseDevicePath;\r | |
70 | PXE_T *Pxe; ///< Pointer to !PXE structure\r | |
71 | PXENV_UNDI_GET_INFORMATION_T GetInformation; ///< Data from GET INFORMATION\r | |
72 | PXENV_UNDI_GET_NIC_TYPE_T GetNicType; ///< Data from GET NIC TYPE\r | |
73 | PXENV_UNDI_GET_NDIS_INFO_T GetNdisInfo; ///< Data from GET NDIS INFO\r | |
74 | BOOLEAN IsrValid; ///< TRUE if Isr contains valid data\r | |
75 | PXENV_UNDI_ISR_T Isr; ///< Data from ISR\r | |
76 | PXENV_UNDI_TBD_T *Xmit; //\r | |
77 | VOID *TxRealModeMediaHeader; ///< < 1 MB Size = 0x100\r | |
78 | VOID *TxRealModeDataBuffer; ///< < 1 MB Size = GetInformation.MaxTranUnit\r | |
79 | VOID *TxDestAddr; ///< < 1 MB Size = 16\r | |
80 | UINT8 InterruptStatus; ///< returned/cleared by GetStatus, set in ISR\r | |
81 | UINTN UndiLoaderTablePages;\r | |
82 | UINTN DestinationDataSegmentPages;\r | |
83 | UINTN DestinationStackSegmentPages;\r | |
84 | UINTN DestinationCodeSegmentPages;\r | |
85 | VOID *UndiLoaderTable;\r | |
86 | VOID *DestinationDataSegment;\r | |
87 | VOID *DestinationStackSegment;\r | |
88 | VOID *DestinationCodeSegment;\r | |
89 | } EFI_SIMPLE_NETWORK_DEV;\r | |
90 | \r | |
91 | #define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) \\r | |
92 | CR (a, \\r | |
93 | EFI_SIMPLE_NETWORK_DEV, \\r | |
94 | SimpleNetwork, \\r | |
95 | EFI_SIMPLE_NETWORK_DEV_SIGNATURE \\r | |
96 | )\r | |
97 | \r | |
98 | //\r | |
99 | // Global Variables\r | |
100 | //\r | |
101 | extern EFI_DRIVER_BINDING_PROTOCOL gBiosSnp16DriverBinding;\r | |
102 | extern EFI_COMPONENT_NAME_PROTOCOL gBiosSnp16ComponentName;\r | |
103 | extern EFI_COMPONENT_NAME2_PROTOCOL gBiosSnp16ComponentName2;\r | |
104 | \r | |
105 | \r | |
106 | //\r | |
107 | // Driver Binding Protocol functions\r | |
108 | //\r | |
109 | /**\r | |
110 | Tests to see if this driver supports a given controller.\r | |
111 | \r | |
112 | @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
113 | @param Controller The handle of the controller to test.\r | |
114 | @param RemainingDevicePath A pointer to the remaining portion of a device path.\r | |
0a6f4824 | 115 | \r |
bcecde14 | 116 | @retval EFI_SUCCESS The driver supports given controller.\r |
117 | @retval EFI_UNSUPPORT The driver doesn't support given controller.\r | |
118 | @retval Other Other errors prevent driver finishing to test\r | |
119 | if the driver supports given controller.\r | |
120 | **/\r | |
121 | EFI_STATUS\r | |
122 | EFIAPI\r | |
123 | BiosSnp16DriverBindingSupported (\r | |
124 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
125 | IN EFI_HANDLE Controller,\r | |
126 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
127 | )\r | |
128 | ;\r | |
129 | \r | |
130 | /**\r | |
131 | Starts the Snp device controller\r | |
132 | \r | |
133 | @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
134 | @param Controller The handle of the controller to test.\r | |
135 | @param RemainingDevicePath A pointer to the remaining portion of a device path.\r | |
0a6f4824 LG |
136 | \r |
137 | @retval EFI_SUCCESS - The device was started.\r | |
bcecde14 | 138 | @retval EFI_DEVICE_ERROR - The device could not be started due to a device error.\r |
139 | @retval EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r | |
140 | **/\r | |
141 | EFI_STATUS\r | |
142 | EFIAPI\r | |
143 | BiosSnp16DriverBindingStart (\r | |
144 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
145 | IN EFI_HANDLE Controller,\r | |
146 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
147 | )\r | |
148 | ;\r | |
149 | \r | |
150 | /**\r | |
151 | Stops the device by given device controller.\r | |
152 | \r | |
153 | @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
154 | @param Controller The handle of the controller to test.\r | |
155 | @param NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
156 | @param ChildHandleBuffer An array of child handles to be freed. May be NULL if\r | |
157 | NumberOfChildren is 0.\r | |
0a6f4824 | 158 | \r |
bcecde14 | 159 | @retval EFI_SUCCESS - The device was stopped.\r |
160 | @retval EFI_DEVICE_ERROR - The device could not be stopped due to a device error.\r | |
161 | **/\r | |
162 | EFI_STATUS\r | |
163 | EFIAPI\r | |
164 | BiosSnp16DriverBindingStop (\r | |
165 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
166 | IN EFI_HANDLE Controller,\r | |
167 | IN UINTN NumberOfChildren,\r | |
168 | IN EFI_HANDLE *ChildHandleBuffer\r | |
169 | )\r | |
170 | ;\r | |
171 | \r | |
172 | //\r | |
173 | // Simple Network Protocol functions\r | |
174 | //\r | |
175 | /**\r | |
176 | Call 16 bit UNDI ROM to start the network interface\r | |
177 | \r | |
178 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
0a6f4824 | 179 | \r |
bcecde14 | 180 | @retval EFI_DEVICE_ERROR Network interface has not be initialized.\r |
181 | @retval EFI_DEVICE_ERROR Fail to execute 16 bit ROM call.\r | |
182 | @retval EFI_SUCESS Success operation.\r | |
183 | **/\r | |
184 | EFI_STATUS\r | |
185 | EFIAPI\r | |
186 | Undi16SimpleNetworkStart (\r | |
187 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r | |
188 | )\r | |
189 | ;\r | |
190 | \r | |
191 | /**\r | |
192 | Call 16 bit UNDI ROM to stop the network interface\r | |
193 | \r | |
194 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
0a6f4824 | 195 | \r |
bcecde14 | 196 | @retval EFI_DEVICE_ERROR Network interface has not be initialized.\r |
197 | @retval EFI_DEVICE_ERROR Fail to execute 16 bit ROM call.\r | |
198 | @retval EFI_SUCESS Success operation.\r | |
199 | **/\r | |
200 | EFI_STATUS\r | |
201 | EFIAPI\r | |
202 | Undi16SimpleNetworkStop (\r | |
203 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r | |
204 | )\r | |
205 | ;\r | |
206 | \r | |
207 | /**\r | |
0a6f4824 | 208 | Initialize network interface\r |
bcecde14 | 209 | \r |
210 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
211 | @param ExtraRxBufferSize The size of extra request receive buffer.\r | |
212 | @param ExtraTxBufferSize The size of extra request transmit buffer.\r | |
0a6f4824 | 213 | \r |
bcecde14 | 214 | @retval EFI_DEVICE_ERROR Fail to execute 16 bit ROM call.\r |
215 | @retval EFI_SUCESS Success operation.\r | |
216 | **/\r | |
217 | EFI_STATUS\r | |
218 | EFIAPI\r | |
219 | Undi16SimpleNetworkInitialize (\r | |
220 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
221 | IN UINTN ExtraRxBufferSize OPTIONAL,\r | |
222 | IN UINTN ExtraTxBufferSize OPTIONAL\r | |
223 | )\r | |
224 | ;\r | |
225 | \r | |
226 | /**\r | |
227 | Reset network interface.\r | |
228 | \r | |
229 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
230 | @param ExtendedVerification Need extended verfication.\r | |
0a6f4824 | 231 | \r |
70d3fe9d | 232 | @retval EFI_INVALID_PARAMETER Invalid This parameter.\r |
bcecde14 | 233 | @retval EFI_DEVICE_ERROR Network device has not been initialized.\r |
234 | @retval EFI_NOT_STARTED Network device has been stopped.\r | |
235 | @retval EFI_DEVICE_ERROR Invalid status for network device\r | |
236 | @retval EFI_SUCCESS Success operation.\r | |
237 | **/\r | |
238 | EFI_STATUS\r | |
239 | EFIAPI\r | |
240 | Undi16SimpleNetworkReset (\r | |
241 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
242 | IN BOOLEAN ExtendedVerification\r | |
243 | )\r | |
244 | ;\r | |
245 | \r | |
246 | /**\r | |
247 | Shutdown network interface.\r | |
248 | \r | |
249 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
0a6f4824 | 250 | \r |
70d3fe9d | 251 | @retval EFI_INVALID_PARAMETER Invalid This parameter.\r |
bcecde14 | 252 | @retval EFI_DEVICE_ERROR Network device has not been initialized.\r |
253 | @retval EFI_NOT_STARTED Network device has been stopped.\r | |
254 | @retval EFI_DEVICE_ERROR Invalid status for network device\r | |
255 | @retval EFI_SUCCESS Success operation.\r | |
256 | **/\r | |
257 | EFI_STATUS\r | |
258 | EFIAPI\r | |
259 | Undi16SimpleNetworkShutdown (\r | |
260 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r | |
261 | )\r | |
262 | ;\r | |
263 | \r | |
264 | /**\r | |
265 | Reset network interface.\r | |
266 | \r | |
267 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
268 | @param Enable Enable mask value\r | |
269 | @param Disable Disable mask value\r | |
270 | @param ResetMCastFilter Whether reset multi cast filter or not\r | |
271 | @param MCastFilterCnt Count of mutli cast filter for different MAC address\r | |
272 | @param MCastFilter Buffer for mustli cast filter for different MAC address.\r | |
0a6f4824 | 273 | \r |
70d3fe9d | 274 | @retval EFI_INVALID_PARAMETER Invalid This parameter.\r |
bcecde14 | 275 | @retval EFI_DEVICE_ERROR Network device has not been initialized.\r |
276 | @retval EFI_NOT_STARTED Network device has been stopped.\r | |
277 | @retval EFI_DEVICE_ERROR Invalid status for network device\r | |
278 | @retval EFI_SUCCESS Success operation.\r | |
279 | **/\r | |
280 | EFI_STATUS\r | |
281 | EFIAPI\r | |
282 | Undi16SimpleNetworkReceiveFilters (\r | |
283 | IN EFI_SIMPLE_NETWORK_PROTOCOL * This,\r | |
284 | IN UINT32 Enable,\r | |
285 | IN UINT32 Disable,\r | |
286 | IN BOOLEAN ResetMCastFilter,\r | |
287 | IN UINTN MCastFilterCnt OPTIONAL,\r | |
288 | IN EFI_MAC_ADDRESS * MCastFilter OPTIONAL\r | |
289 | )\r | |
290 | ;\r | |
291 | \r | |
292 | /**\r | |
293 | Set new MAC address.\r | |
294 | \r | |
295 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
70d3fe9d | 296 | @param Reset Whether reset station MAC address to permanent address\r |
bcecde14 | 297 | @param New A pointer to New address\r |
0a6f4824 | 298 | \r |
70d3fe9d | 299 | @retval EFI_INVALID_PARAMETER Invalid This parameter.\r |
bcecde14 | 300 | @retval EFI_DEVICE_ERROR Network device has not been initialized.\r |
301 | @retval EFI_NOT_STARTED Network device has been stopped.\r | |
302 | @retval EFI_DEVICE_ERROR Invalid status for network device\r | |
303 | @retval EFI_SUCCESS Success operation.\r | |
304 | **/\r | |
305 | EFI_STATUS\r | |
306 | EFIAPI\r | |
307 | Undi16SimpleNetworkStationAddress (\r | |
308 | IN EFI_SIMPLE_NETWORK_PROTOCOL * This,\r | |
309 | IN BOOLEAN Reset,\r | |
310 | IN EFI_MAC_ADDRESS * New OPTIONAL\r | |
311 | )\r | |
312 | ;\r | |
313 | \r | |
314 | /**\r | |
315 | Collect statistics.\r | |
316 | \r | |
317 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
318 | @param Reset Whether cleanup old statistics data.\r | |
319 | @param StatisticsSize The buffer of statistics table.\r | |
320 | @param StatisticsTable A pointer to statistics buffer.\r | |
0a6f4824 | 321 | \r |
70d3fe9d | 322 | @retval EFI_INVALID_PARAMETER Invalid This parameter.\r |
bcecde14 | 323 | @retval EFI_DEVICE_ERROR Network device has not been initialized.\r |
324 | @retval EFI_NOT_STARTED Network device has been stopped.\r | |
325 | @retval EFI_DEVICE_ERROR Invalid status for network device\r | |
326 | @retval EFI_SUCCESS Success operation.\r | |
327 | **/\r | |
328 | EFI_STATUS\r | |
329 | EFIAPI\r | |
330 | Undi16SimpleNetworkStatistics (\r | |
331 | IN EFI_SIMPLE_NETWORK_PROTOCOL * This,\r | |
332 | IN BOOLEAN Reset,\r | |
333 | IN OUT UINTN *StatisticsSize OPTIONAL,\r | |
334 | OUT EFI_NETWORK_STATISTICS * StatisticsTable OPTIONAL\r | |
335 | )\r | |
336 | ;\r | |
337 | \r | |
338 | /**\r | |
339 | Translate IP address to MAC address.\r | |
340 | \r | |
341 | @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.\r | |
342 | @param IPv6 IPv6 or IPv4\r | |
343 | @param IP A pointer to given Ip address.\r | |
344 | @param MAC On return, translated MAC address.\r | |
0a6f4824 | 345 | \r |
70d3fe9d | 346 | @retval EFI_INVALID_PARAMETER Invalid This parameter.\r |
bcecde14 | 347 | @retval EFI_INVALID_PARAMETER Invalid IP address.\r |
348 | @retval EFI_INVALID_PARAMETER Invalid return buffer for holding MAC address.\r | |
0a6f4824 | 349 | @retval EFI_UNSUPPORTED Do not support IPv6\r |
bcecde14 | 350 | @retval EFI_DEVICE_ERROR Network device has not been initialized.\r |
351 | @retval EFI_NOT_STARTED Network device has been stopped.\r | |
352 | @retval EFI_DEVICE_ERROR Invalid status for network device\r | |
353 | @retval EFI_SUCCESS Success operation.\r | |
354 | **/\r | |
355 | EFI_STATUS\r | |
356 | EFIAPI\r | |
357 | Undi16SimpleNetworkMCastIpToMac (\r | |
358 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
359 | IN BOOLEAN IPv6,\r | |
360 | IN EFI_IP_ADDRESS *IP,\r | |
361 | OUT EFI_MAC_ADDRESS *MAC\r | |
362 | )\r | |
363 | ;\r | |
364 | \r | |
365 | /**\r | |
0a6f4824 | 366 | Performs read and write operations on the NVRAM device attached to a\r |
bcecde14 | 367 | network interface.\r |
368 | \r | |
369 | @param This The protocol instance pointer.\r | |
370 | @param ReadWrite TRUE for read operations, FALSE for write operations.\r | |
371 | @param Offset Byte offset in the NVRAM device at which to start the read or\r | |
372 | write operation. This must be a multiple of NvRamAccessSize and\r | |
373 | less than NvRamSize.\r | |
374 | @param BufferSize The number of bytes to read or write from the NVRAM device.\r | |
375 | This must also be a multiple of NvramAccessSize.\r | |
376 | @param Buffer A pointer to the data buffer.\r | |
377 | \r | |
378 | @retval EFI_SUCCESS The NVRAM access was performed.\r | |
379 | @retval EFI_NOT_STARTED The network interface has not been started.\r | |
380 | @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r | |
381 | @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r | |
382 | @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r | |
383 | \r | |
384 | **/\r | |
385 | EFI_STATUS\r | |
386 | EFIAPI\r | |
387 | Undi16SimpleNetworkNvData (\r | |
388 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
389 | IN BOOLEAN Write,\r | |
390 | IN UINTN Offset,\r | |
391 | IN UINTN BufferSize,\r | |
392 | IN OUT VOID *Buffer\r | |
393 | )\r | |
394 | ;\r | |
395 | \r | |
396 | /**\r | |
0a6f4824 | 397 | Reads the current interrupt status and recycled transmit buffer status from\r |
bcecde14 | 398 | a network interface.\r |
399 | \r | |
400 | @param This The protocol instance pointer.\r | |
401 | @param InterruptStatus A pointer to the bit mask of the currently active interrupts\r | |
402 | If this is NULL, the interrupt status will not be read from\r | |
403 | the device. If this is not NULL, the interrupt status will\r | |
404 | be read from the device. When the interrupt status is read,\r | |
405 | it will also be cleared. Clearing the transmit interrupt\r | |
406 | does not empty the recycled transmit buffer array.\r | |
407 | @param TxBuf Recycled transmit buffer address. The network interface will\r | |
408 | not transmit if its internal recycled transmit buffer array\r | |
409 | is full. Reading the transmit buffer does not clear the\r | |
410 | transmit interrupt. If this is NULL, then the transmit buffer\r | |
411 | status will not be read. If there are no transmit buffers to\r | |
412 | recycle and TxBuf is not NULL, * TxBuf will be set to NULL.\r | |
413 | \r | |
414 | @retval EFI_SUCCESS The status of the network interface was retrieved.\r | |
415 | @retval EFI_NOT_STARTED The network interface has not been started.\r | |
416 | @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r | |
417 | @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r | |
418 | @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r | |
419 | \r | |
420 | **/\r | |
421 | EFI_STATUS\r | |
422 | EFIAPI\r | |
423 | Undi16SimpleNetworkGetStatus (\r | |
424 | IN EFI_SIMPLE_NETWORK_PROTOCOL * This,\r | |
425 | OUT UINT32 *InterruptStatus OPTIONAL,\r | |
426 | OUT VOID **TxBuf OPTIONAL\r | |
427 | )\r | |
428 | ;\r | |
429 | \r | |
430 | /**\r | |
431 | Places a packet in the transmit queue of a network interface.\r | |
432 | \r | |
433 | @param This The protocol instance pointer.\r | |
434 | @param HeaderSize The size, in bytes, of the media header to be filled in by\r | |
435 | the Transmit() function. If HeaderSize is non-zero, then it\r | |
436 | must be equal to This->Mode->MediaHeaderSize and the DestAddr\r | |
437 | and Protocol parameters must not be NULL.\r | |
438 | @param BufferSize The size, in bytes, of the entire packet (media header and\r | |
439 | data) to be transmitted through the network interface.\r | |
440 | @param Buffer A pointer to the packet (media header followed by data) to be\r | |
441 | transmitted. This parameter cannot be NULL. If HeaderSize is zero,\r | |
442 | then the media header in Buffer must already be filled in by the\r | |
443 | caller. If HeaderSize is non-zero, then the media header will be\r | |
444 | filled in by the Transmit() function.\r | |
445 | @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter\r | |
446 | is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then\r | |
447 | This->Mode->CurrentAddress is used for the source HW MAC address.\r | |
448 | @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this\r | |
449 | parameter is ignored.\r | |
450 | @param Protocol The type of header to build. If HeaderSize is zero, then this\r | |
451 | parameter is ignored. See RFC 1700, section "Ether Types", for\r | |
452 | examples.\r | |
453 | \r | |
454 | @retval EFI_SUCCESS The packet was placed on the transmit queue.\r | |
455 | @retval EFI_NOT_STARTED The network interface has not been started.\r | |
0a6f4824 | 456 | @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.\r |
bcecde14 | 457 | @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r |
458 | @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r | |
459 | @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r | |
460 | @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r | |
461 | \r | |
462 | **/\r | |
463 | EFI_STATUS\r | |
464 | EFIAPI\r | |
465 | Undi16SimpleNetworkTransmit (\r | |
466 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
467 | IN UINTN HeaderSize,\r | |
468 | IN UINTN BufferSize,\r | |
469 | IN VOID *Buffer,\r | |
470 | IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r | |
471 | IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r | |
472 | IN UINT16 *Protocol OPTIONAL\r | |
473 | )\r | |
474 | ;\r | |
475 | \r | |
476 | /**\r | |
477 | Receives a packet from a network interface.\r | |
478 | \r | |
479 | @param This The protocol instance pointer.\r | |
480 | @param HeaderSize The size, in bytes, of the media header received on the network\r | |
481 | interface. If this parameter is NULL, then the media header size\r | |
482 | will not be returned.\r | |
483 | @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in\r | |
484 | bytes, of the packet that was received on the network interface.\r | |
485 | @param Buffer A pointer to the data buffer to receive both the media header and\r | |
486 | the data.\r | |
487 | @param SrcAddr The source HW MAC address. If this parameter is NULL, the\r | |
488 | HW MAC source address will not be extracted from the media\r | |
489 | header.\r | |
490 | @param DestAddr The destination HW MAC address. If this parameter is NULL,\r | |
491 | the HW MAC destination address will not be extracted from the\r | |
492 | media header.\r | |
493 | @param Protocol The media header type. If this parameter is NULL, then the\r | |
494 | protocol will not be extracted from the media header. See\r | |
495 | RFC 1700 section "Ether Types" for examples.\r | |
496 | \r | |
497 | @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has\r | |
498 | been updated to the number of bytes received.\r | |
499 | @retval EFI_NOT_STARTED The network interface has not been started.\r | |
500 | @retval EFI_NOT_READY The network interface is too busy to accept this transmit\r | |
501 | request.\r | |
502 | @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r | |
503 | @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r | |
504 | @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r | |
505 | @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r | |
506 | \r | |
507 | **/\r | |
508 | EFI_STATUS\r | |
509 | EFIAPI\r | |
510 | Undi16SimpleNetworkReceive (\r | |
511 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
512 | OUT UINTN *HeaderSize OPTIONAL,\r | |
513 | IN OUT UINTN *BufferSize,\r | |
514 | OUT VOID *Buffer,\r | |
515 | OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r | |
516 | OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r | |
517 | OUT UINT16 *Protocol OPTIONAL\r | |
518 | )\r | |
519 | ;\r | |
520 | \r | |
521 | /**\r | |
522 | wait for a packet to be received.\r | |
523 | \r | |
524 | @param Event Event used with WaitForEvent() to wait for a packet to be received.\r | |
525 | @param Context Event Context\r | |
0a6f4824 | 526 | \r |
bcecde14 | 527 | **/\r |
528 | VOID\r | |
529 | EFIAPI\r | |
530 | Undi16SimpleNetworkWaitForPacket (\r | |
531 | IN EFI_EVENT Event,\r | |
532 | IN VOID *Context\r | |
533 | )\r | |
534 | ;\r | |
535 | \r | |
536 | /**\r | |
537 | Check whether packet is ready for receive.\r | |
538 | \r | |
539 | @param This The protocol instance pointer.\r | |
0a6f4824 | 540 | \r |
bcecde14 | 541 | @retval EFI_SUCCESS Receive data is ready.\r |
542 | @retval EFI_NOT_STARTED The network interface has not been started.\r | |
543 | @retval EFI_NOT_READY The network interface is too busy to accept this transmit\r | |
544 | request.\r | |
545 | @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r | |
546 | @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r | |
547 | @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r | |
548 | @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r | |
549 | **/\r | |
550 | EFI_STATUS\r | |
551 | Undi16SimpleNetworkCheckForPacket (\r | |
552 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r | |
553 | )\r | |
554 | ;\r | |
555 | \r | |
556 | /**\r | |
557 | Cache Interrupt verctor address converted from IVT number.\r | |
558 | \r | |
559 | @param VectorNumber IVT number\r | |
0a6f4824 | 560 | \r |
bcecde14 | 561 | @retval EFI_SUCCESS Success to operation.\r |
562 | **/\r | |
563 | EFI_STATUS\r | |
564 | CacheVectorAddress (\r | |
565 | UINT8 VectorNumber\r | |
566 | )\r | |
567 | ;\r | |
568 | \r | |
569 | /**\r | |
0a6f4824 LG |
570 | Get interrupt vector address according to IVT number.\r |
571 | \r | |
bcecde14 | 572 | @param VectorNumber Given IVT number\r |
0a6f4824 | 573 | \r |
bcecde14 | 574 | @return cached interrupt vector address.\r |
575 | **/\r | |
576 | EFI_STATUS\r | |
577 | RestoreCachedVectorAddress (\r | |
578 | UINT8 VectorNumber\r | |
579 | )\r | |
580 | ;\r | |
581 | \r | |
582 | /**\r | |
583 | If available, launch the BaseCode from a NIC option ROM.\r | |
584 | This should install the !PXE and PXENV+ structures in memory for\r | |
585 | subsequent use.\r | |
0a6f4824 | 586 | \r |
bcecde14 | 587 | \r |
588 | @param SimpleNetworkDevice Simple network device instance\r | |
589 | @param RomAddress The ROM base address for NIC rom.\r | |
0a6f4824 LG |
590 | \r |
591 | @retval EFI_NOT_FOUND The check sum does not match\r | |
592 | @retval EFI_NOT_FOUND Rom ID offset is wrong\r | |
593 | @retval EFI_NOT_FOUND No Rom ID structure is found\r | |
bcecde14 | 594 | **/\r |
595 | EFI_STATUS\r | |
596 | LaunchBaseCode (\r | |
597 | EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
598 | UINTN RomAddress\r | |
599 | )\r | |
600 | ;\r | |
601 | \r | |
602 | /**\r | |
0a6f4824 | 603 | PXE\r |
bcecde14 | 604 | START UNDI\r |
605 | Op-Code: PXENV_START_UNDI (0000h)\r | |
606 | Input: Far pointer to a PXENV_START_UNDI_T parameter structure that has been initialized by the caller.\r | |
607 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
608 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
609 | constants.\r | |
610 | Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is\r | |
611 | responsible for saving the information it needs to communicate with the hardware.\r | |
612 | This service is also responsible for hooking the Int 1Ah service routine\r | |
613 | Note: This API service must be called only once during UNDI Option ROM boot.\r | |
614 | The UNDI driver is responsible for saving this information and using it every time\r | |
615 | PXENV_UNDI_STARTUP is called.\r | |
616 | Service cannot be used in protected mode.\r | |
617 | typedef struct {\r | |
618 | PXENV_STATUS Status;\r | |
619 | UINT16 AX;\r | |
620 | UINT16 BX;\r | |
621 | UINT16 DX;\r | |
622 | UINT16 DI;\r | |
623 | UINT16 ES;\r | |
624 | } PXENV_START_UNDI_T;\r | |
625 | Set before calling API service\r | |
626 | AX, BX, DX, DI, ES: BIOS initialization parameter registers. These\r | |
627 | fields should contain the same information passed to the option ROM\r | |
628 | initialization routine by the Host System BIOS. Information about the\r | |
629 | contents of these registers can be found in the [PnP], [PCI] and\r | |
630 | [BBS] specifications.\r | |
631 | Returned from API service\r | |
0a6f4824 | 632 | Status: See the PXENV_STATUS_xxx constants.\r |
bcecde14 | 633 | \r |
634 | @param SimpleNetworkDevice Device instance\r | |
0a6f4824 | 635 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 636 | for option ROM call.\r |
0a6f4824 LG |
637 | \r |
638 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 639 | **/\r |
640 | EFI_STATUS\r | |
641 | PxeStartUndi (\r | |
642 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
643 | IN OUT PXENV_START_UNDI_T *PxeUndiTable\r | |
644 | )\r | |
645 | ;\r | |
646 | \r | |
647 | /**\r | |
0a6f4824 LG |
648 | PXE\r |
649 | UNDI STARTUP\r | |
bcecde14 | 650 | Op-Code: PXENV_UNDI_STARTUP (0001h)\r |
651 | Input: Far pointer to a PXENV_UNDI_STARTUP_T parameter structure that has been initialized by the\r | |
652 | caller.\r | |
653 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
654 | the parameter structure must be set to one of the values represented by the\r | |
655 | PXENV_STATUS_xxx constants.\r | |
656 | Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper\r | |
657 | operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used\r | |
658 | to complete this initialization. The rest of the UNDI APIs will not be available until this call has\r | |
659 | been completed.\r | |
660 | Note: PXENV_UNDI_STARTUP must not be called again without first calling\r | |
661 | PXENV_UNDI_SHUTDOWN.\r | |
662 | PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for\r | |
663 | chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and\r | |
664 | PXENV_STOP_UNDI API calls.\r | |
665 | This service cannot be used in protected mode.\r | |
0a6f4824 | 666 | typedef struct\r |
bcecde14 | 667 | {\r |
668 | PXENV_STATUS Status;\r | |
669 | } PXENV_UNDI_STARTUP_T;\r | |
670 | Set before calling API service\r | |
671 | N/A\r | |
672 | Returned from API service\r | |
673 | Status: See the PXENV_STATUS_xxx constants.\r | |
674 | \r | |
675 | @param SimpleNetworkDevice Device instance\r | |
0a6f4824 | 676 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 677 | for option ROM call.\r |
0a6f4824 LG |
678 | \r |
679 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 680 | **/\r |
681 | EFI_STATUS\r | |
682 | PxeUndiStartup (\r | |
683 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
684 | IN OUT PXENV_UNDI_STARTUP_T *PxeUndiTable\r | |
685 | )\r | |
686 | ;\r | |
687 | \r | |
688 | /**\r | |
0a6f4824 | 689 | PXE\r |
bcecde14 | 690 | UNDI CLEANUP\r |
691 | Op-Code: PXENV_UNDI_CLEANUP (0002h)\r | |
692 | Input: Far pointer to a PXENV_UNDI_CLEANUP_T parameter structure.\r | |
693 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field\r | |
694 | in the parameter structure must be set to one of the values represented by the\r | |
695 | PXENV_STATUS_xxx constants.\r | |
696 | Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be\r | |
697 | made just before unloading the Universal NIC Driver. The rest of the API will not be available\r | |
698 | after this call executes.\r | |
699 | This service cannot be used in protected mode.\r | |
700 | typedef struct {\r | |
701 | PXENX_STATUS Status;\r | |
702 | } PXENV_UNDI_CLEANUP_T;\r | |
703 | Set before calling API service\r | |
704 | N/A\r | |
705 | Returned from API service\r | |
706 | Status: See the PXENV_STATUS_xxx constants.\r | |
707 | \r | |
708 | @param SimpleNetworkDevice Device instance\r | |
0a6f4824 | 709 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 710 | for option ROM call.\r |
0a6f4824 LG |
711 | \r |
712 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 713 | **/\r |
714 | EFI_STATUS\r | |
715 | PxeUndiCleanup (\r | |
716 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
717 | IN OUT PXENV_UNDI_CLEANUP_T *PxeUndiTable\r | |
718 | )\r | |
719 | ;\r | |
720 | \r | |
721 | /**\r | |
0a6f4824 | 722 | PXE\r |
bcecde14 | 723 | UNDI INITIALIZE\r |
724 | Op-Code: PXENV_UNDI_INITIALIZE (0003h)\r | |
725 | Input: Far pointer to a PXENV_UNDI_INITIALIZE_T parameter structure that has been initialized by the\r | |
726 | caller.\r | |
727 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
728 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
729 | constants.\r | |
730 | Description: This call resets the adapter and programs it with default parameters. The default parameters used\r | |
731 | are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the\r | |
732 | receive and transmit units of the network adapter to readily receive or transmit packets. The\r | |
733 | application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.\r | |
734 | This call must be made by an application to establish an interface to the network adapter driver.\r | |
735 | Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for\r | |
736 | the Protocol field in the parameter structure.\r | |
737 | typedef struct {\r | |
738 | PXENV_STATUS Status;\r | |
739 | ADDR32 ProtocolIni;\r | |
740 | UINT8 reserved[8];\r | |
741 | } PXENV_UNDI_INITIALIZE_T;\r | |
742 | Set before calling API service\r | |
743 | ProtocolIni: Physical address of a memory copy of the driver\r | |
744 | module from the protocol.ini file obtained from the protocol manager\r | |
745 | driver (refer to the NDIS 2.0 specification). This parameter is\r | |
746 | supported for the universal NDIS driver to pass the information\r | |
747 | contained in the protocol.ini file to the NIC driver for any specific\r | |
748 | configuration of the NIC. (Note that the module identification in the\r | |
749 | protocol.ini file was done by NDIS.) This value can be NULL for any\r | |
750 | other application interfacing to the universal NIC driver\r | |
751 | Returned from API service\r | |
0a6f4824 LG |
752 | Status: See the PXENV_STATUS_xxx constants.\r |
753 | \r | |
bcecde14 | 754 | @param SimpleNetworkDevice Device instance.\r |
0a6f4824 | 755 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 756 | for option ROM call.\r |
0a6f4824 LG |
757 | \r |
758 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 759 | **/\r |
760 | EFI_STATUS\r | |
761 | PxeUndiInitialize (\r | |
762 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
763 | IN OUT PXENV_UNDI_INITIALIZE_T *PxeUndiTable\r | |
764 | )\r | |
765 | ;\r | |
766 | \r | |
767 | /**\r | |
768 | Wrapper routine for reset adapter.\r | |
0a6f4824 LG |
769 | \r |
770 | PXE\r | |
bcecde14 | 771 | UNDI RESET ADAPTER\r |
772 | Op-Code: PXENV_UNDI_RESET_ADAPTER (0004h)\r | |
773 | Input: Far pointer to a PXENV_UNDI_RESET_ADAPTER_t parameter structure that has been initialized\r | |
774 | by the caller.\r | |
775 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
776 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
777 | constants.\r | |
778 | Description: This call resets and reinitializes the network adapter with the same set of parameters supplied to\r | |
779 | Initialize Routine. Unlike Initialize, this call opens the adapter that is, it connects logically to the\r | |
780 | network. This routine cannot be used to replace Initialize or Shutdown calls.\r | |
781 | typedef struct {\r | |
782 | PXENV_STATUS Status;\r | |
783 | PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r | |
784 | } PXENV_UNDI_RESET_T;\r | |
785 | \r | |
786 | #define MAXNUM_MCADDR 8\r | |
787 | \r | |
788 | typedef struct {\r | |
789 | UINT16 MCastAddrCount;\r | |
790 | MAC_ADDR McastAddr[MAXNUM_MCADDR];\r | |
791 | } PXENV_UNDI_MCAST_ADDRESS_t;\r | |
792 | \r | |
793 | Set before calling API service\r | |
794 | R_Mcast_Buf: This is a structure of MCastAddrCount and\r | |
795 | McastAddr.\r | |
796 | MCastAddrCount: Number of multicast MAC addresses in the\r | |
797 | buffer.\r | |
798 | McastAddr: List of up to MAXNUM_MCADDR multicast MAC\r | |
799 | addresses.\r | |
800 | Returned from API service\r | |
801 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 802 | \r |
bcecde14 | 803 | @param SimpleNetworkDevice Device instance.\r |
0a6f4824 | 804 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 805 | for option ROM call.\r |
0a6f4824 LG |
806 | @param RxFilter Filter setting mask value for PXE recive .\r |
807 | \r | |
808 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 809 | **/\r |
810 | EFI_STATUS\r | |
811 | PxeUndiResetNic (\r | |
812 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
813 | IN OUT PXENV_UNDI_RESET_T *PxeUndiTable,\r | |
814 | IN UINT16 RxFilter\r | |
815 | )\r | |
816 | ;\r | |
817 | \r | |
818 | /**\r | |
0a6f4824 | 819 | PXE\r |
bcecde14 | 820 | UNDI SHUTDOWN\r |
821 | Op-Code: PXENV_UNDI_SHUTDOWN (0005h)\r | |
822 | Input: Far pointer to a PXENV_UNDI_SHUTDOWN_T parameter.\r | |
823 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
824 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
825 | constants.\r | |
826 | Description: This call resets the network adapter and leaves it in a safe state for another driver to program it.\r | |
827 | Note: The contents of the PXENV_UNDI_STARTUP parameter structure need to be saved by the\r | |
828 | Universal NIC Driver in case PXENV_UNDI_INITIALIZE is called again.\r | |
0a6f4824 | 829 | typedef struct\r |
bcecde14 | 830 | {\r |
831 | PXENV_STATUS Status;\r | |
832 | } PXENV_UNDI_SHUTDOWN_T;\r | |
833 | Set before calling API service\r | |
834 | N/A\r | |
835 | Returned from API service\r | |
836 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 837 | \r |
bcecde14 | 838 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 839 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 840 | for option ROM call.\r |
0a6f4824 LG |
841 | \r |
842 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 843 | **/\r |
844 | EFI_STATUS\r | |
845 | PxeUndiShutdown (\r | |
846 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
847 | IN OUT PXENV_UNDI_SHUTDOWN_T *PxeUndiTable\r | |
848 | )\r | |
849 | ;\r | |
850 | \r | |
851 | /**\r | |
0a6f4824 | 852 | PXE\r |
bcecde14 | 853 | UNDI OPEN\r |
854 | Op-Code: PXENV_UNDI_OPEN (0006h)\r | |
855 | Input: Far pointer to a PXENV_UNDI_OPEN_T parameter structure that has been initialized by the caller.\r | |
856 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
857 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
858 | constants.\r | |
859 | Description: This call activates the adapter network connection and sets the adapter ready to accept packets\r | |
860 | for transmit and receive.\r | |
861 | typedef struct {\r | |
862 | PXENV_STATUS Status;\r | |
863 | UINT16 OpenFlag;\r | |
864 | UINT16 PktFilter;\r | |
865 | #define FLTR_DIRECTED 0x0001\r | |
866 | #define FLTR_BRDCST 0x0002\r | |
867 | #define FLTR_PRMSCS 0x0004\r | |
868 | #define FLTR_SRC_RTG 0x0008\r | |
869 | PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r | |
870 | } PXENV_UNDI_OPEN_T;\r | |
871 | Set before calling API service\r | |
872 | OpenFlag: This is an adapter specific input parameter. This is\r | |
873 | supported for the universal NDIS 2.0 driver to pass in the open flags\r | |
874 | provided by the protocol driver. (See the NDIS 2.0 specification.)\r | |
875 | This can be zero.\r | |
876 | PktFilter: Filter for receiving packets. This can be one, or more, of\r | |
877 | the FLTR_xxx constants. Multiple values are arithmetically or-ed\r | |
878 | together.\r | |
879 | directed packets are packets that may come to your MAC address\r | |
880 | or the multicast MAC address.\r | |
881 | R_Mcast_Buf: See definition in UNDI RESET ADAPTER (0004h).\r | |
882 | Returned from API service\r | |
883 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 884 | \r |
bcecde14 | 885 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 886 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 887 | for option ROM call.\r |
0a6f4824 LG |
888 | \r |
889 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 890 | **/\r |
891 | EFI_STATUS\r | |
892 | PxeUndiOpen (\r | |
893 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
894 | IN OUT PXENV_UNDI_OPEN_T *PxeUndiTable\r | |
895 | )\r | |
896 | ;\r | |
897 | \r | |
898 | /**\r | |
0a6f4824 | 899 | PXE\r |
bcecde14 | 900 | UNDI CLOSE\r |
901 | Op-Code: PXENV_UNDI_CLOSE (0007h)\r | |
902 | Input: Far pointer to a PXENV_UNDI_CLOSE_T parameter.\r | |
903 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
904 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
905 | constants.\r | |
906 | Description: This call disconnects the network adapter from the network. Packets cannot be transmitted or\r | |
907 | received until the network adapter is open again.\r | |
908 | typedef struct {\r | |
909 | PXENV_STATUS Status;\r | |
910 | } PXENV_UNDI_CLOSE_T;\r | |
911 | Set before calling API service\r | |
912 | N/A\r | |
913 | Returned from API service\r | |
914 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 915 | \r |
bcecde14 | 916 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 917 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 918 | for option ROM call.\r |
0a6f4824 LG |
919 | \r |
920 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 921 | **/\r |
922 | EFI_STATUS\r | |
923 | PxeUndiClose (\r | |
924 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
925 | IN OUT PXENV_UNDI_CLOSE_T *PxeUndiTable\r | |
926 | )\r | |
927 | ;\r | |
928 | \r | |
929 | /**\r | |
0a6f4824 | 930 | PXE\r |
bcecde14 | 931 | UNDI TRANSMIT PACKET\r |
932 | Op-Code: PXENV_UNDI_TRANSMIT (0008h)\r | |
933 | Input: Far pointer to a PXENV_UNDI_TRANSMIT_T parameter structure that\r | |
934 | has been initialized by the caller.\r | |
935 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX.\r | |
936 | The status code must be set to one of the values represented by the\r | |
937 | PXENV_STATUS_xxx constants.\r | |
938 | Description: This call transmits a buffer to the network. The media header\r | |
939 | for the packet can be filled by the calling protocol, but it might not be.\r | |
940 | The network adapter driver will fill it if required by the values in the\r | |
941 | parameter block. The packet is buffered for transmission provided there is\r | |
942 | an available buffer, and the function returns PXENV_EXIT_SUCCESS. If no\r | |
943 | buffer is available the function returns PXENV_EXIT_FAILURE with a status\r | |
944 | code of PXE_UNDI_STATUS__OUT OF_RESOURCE. The number of buffers is\r | |
945 | implementation-dependent. An interrupt is generated on completion of the\r | |
946 | transmission of one or more packets. A call to PXENV_UNDI_TRANSMIT is\r | |
947 | permitted in the context of a transmit complete interrupt.\r | |
948 | \r | |
949 | typedef struct {\r | |
950 | PXENV_STATUS Status;\r | |
951 | UINT8 Protocol;\r | |
952 | #define P_UNKNOWN 0\r | |
953 | #define P_IP 1\r | |
954 | #define P_ARP 2\r | |
955 | #define P_RARP 3\r | |
956 | UINT8 XmitFlag;\r | |
957 | #define XMT_DESTADDR 0x0000\r | |
958 | #define XMT_BROADCAST 0x0001\r | |
959 | SEGOFF16 DestAddr;\r | |
960 | SEGOFF16 TBD;\r | |
961 | UINT32 Reserved[2];\r | |
962 | } t_PXENV_UNDI_TRANSMIT;\r | |
963 | \r | |
964 | #define MAX_DATA_BLKS 8\r | |
965 | \r | |
966 | typedef struct {\r | |
967 | UINT16 ImmedLength;\r | |
968 | SEGOFF16 Xmit;\r | |
969 | UINT16 DataBlkCount;\r | |
970 | struct DataBlk {\r | |
971 | UINT8 TDPtrType;\r | |
972 | UINT8 TDRsvdByte;\r | |
973 | UINT16 TDDataLen;\r | |
974 | SEGOFF16 TDDataPtr;\r | |
975 | } DataBlock[MAX_DATA_BLKS];\r | |
976 | } PXENV_UNDI_TBD_T\r | |
977 | \r | |
978 | Set before calling API service\r | |
979 | Protocol: This is the protocol of the upper layer that is calling UNDI\r | |
980 | TRANSMIT call. If the upper layer has filled the media header, this\r | |
981 | field must be P_UNKNOWN.\r | |
982 | XmitFlag: If this flag is XMT_DESTADDR, the NIC driver expects a\r | |
983 | pointer to the destination media address in the field DestAddr. If\r | |
984 | XMT_BROADCAST, the NIC driver fills the broadcast address for the\r | |
985 | destination.\r | |
986 | TBD: Segment:Offset address of the transmit buffer descriptor.\r | |
987 | ImmedLength: Length of the immediate transmit buffer: Xmit.\r | |
988 | Xmit: Segment:Offset of the immediate transmit buffer.\r | |
989 | DataBlkCount: Number of blocks in this transmit buffer.\r | |
990 | TDPtrType:\r | |
991 | 0 => 32-bit physical address in TDDataPtr (not supported in this\r | |
992 | version of PXE)\r | |
993 | 1 => segment:offset in TDDataPtr which can be a real mode or 16-bit\r | |
994 | protected mode pointer\r | |
995 | TDRsvdByte: Reserved must be zero.\r | |
996 | TDDatalen: Data block length in bytes.\r | |
997 | TDDataPtr: Segment:Offset of the transmit block.\r | |
998 | DataBlock: Array of transmit data blocks.\r | |
999 | Returned from API service\r | |
0a6f4824 LG |
1000 | Status: See the PXENV_STATUS_xxx constants\r |
1001 | \r | |
bcecde14 | 1002 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1003 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1004 | for option ROM call.\r |
0a6f4824 LG |
1005 | \r |
1006 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1007 | **/\r |
1008 | EFI_STATUS\r | |
1009 | PxeUndiTransmit (\r | |
1010 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1011 | IN OUT PXENV_UNDI_TRANSMIT_T *PxeUndiTable\r | |
1012 | )\r | |
1013 | ;\r | |
1014 | \r | |
bcecde14 | 1015 | \r |
1016 | /**\r | |
0a6f4824 | 1017 | PXE\r |
bcecde14 | 1018 | UNDI SET STATION ADDRESS\r |
1019 | Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)\r | |
1020 | Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been\r | |
1021 | initialized by the caller.\r | |
1022 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1023 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1024 | constants.\r | |
1025 | Description: This call sets the MAC address to be the input value and is called before opening the network\r | |
1026 | adapter. Later, the open call uses this variable as a temporary MAC address to program the\r | |
1027 | adapter individual address registers.\r | |
1028 | typedef struct {\r | |
1029 | PXENV_STATUS Status;\r | |
1030 | MAC_ADDR StationAddress;\r | |
1031 | } PXENV_UNDI_SET_STATION_ADDR_T;\r | |
1032 | Set before calling API service\r | |
1033 | StationAddress: Temporary MAC address to be used for\r | |
1034 | transmit and receive.\r | |
1035 | Returned from API service\r | |
0a6f4824 LG |
1036 | Status: See the PXENV_STATUS_xxx constants.\r |
1037 | \r | |
bcecde14 | 1038 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1039 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1040 | for option ROM call.\r |
0a6f4824 LG |
1041 | \r |
1042 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1043 | **/\r |
1044 | EFI_STATUS\r | |
1045 | PxeUndiSetStationAddr (\r | |
1046 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1047 | IN OUT PXENV_UNDI_SET_STATION_ADDR_T *PxeUndiTable\r | |
1048 | )\r | |
1049 | ;\r | |
1050 | \r | |
bcecde14 | 1051 | \r |
1052 | /**\r | |
0a6f4824 | 1053 | PXE\r |
bcecde14 | 1054 | UNDI GET INFORMATION\r |
1055 | Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)\r | |
1056 | Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been\r | |
1057 | initialized by the caller.\r | |
1058 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1059 | the parameter structure must be set to one of the values represented by the\r | |
1060 | PXENV_STATUS_xxx constants.\r | |
1061 | Description: This call copies the network adapter variables, including the MAC address, into the input buffer.\r | |
1062 | Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and\r | |
1063 | PXENV_UNDI_STARTUP have been issued. All other fields must be valid after\r | |
1064 | PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been\r | |
1065 | called.\r | |
1066 | typedef struct {\r | |
1067 | PXENV_STATUS Status;\r | |
1068 | UINT16 BaseIo;\r | |
1069 | UINT16 IntNumber;\r | |
1070 | UINT16 MaxTranUnit;\r | |
1071 | UINT16 HwType;\r | |
1072 | #define ETHER_TYPE 1\r | |
1073 | #define EXP_ETHER_TYPE 2\r | |
1074 | #define IEEE_TYPE 6\r | |
1075 | #define ARCNET_TYPE 7\r | |
1076 | UINT16 HwAddrLen;\r | |
1077 | MAC_ADDR CurrentNodeAddress;\r | |
1078 | MAC_ADDR PermNodeAddress;\r | |
1079 | SEGSEL ROMAddress;\r | |
1080 | UINT16 RxBufCt;\r | |
1081 | UINT16 TxBufCt;\r | |
1082 | } PXENV_UNDI_GET_INFORMATION_T;\r | |
1083 | Set before calling API service\r | |
1084 | N/A\r | |
1085 | Returned from API service\r | |
1086 | Status: See the PXENV_STATUS_xxx constants.\r | |
1087 | BaseIO: Adapter base I/O address.\r | |
1088 | IntNumber: Adapter IRQ number.\r | |
1089 | MaxTranUnit: Adapter maximum transmit unit.\r | |
1090 | HWType: Type of protocol at the hardware level.\r | |
1091 | HWAddrLen: Length of the hardware address.\r | |
1092 | CurrentNodeAddress: Current hardware address.\r | |
1093 | PermNodeAddress: Permanent hardware address.\r | |
1094 | ROMAddress: Real mode ROM segment address.\r | |
1095 | RxBufCnt: Receive queue length.\r | |
0a6f4824 LG |
1096 | TxBufCnt: Transmit queue length.\r |
1097 | \r | |
bcecde14 | 1098 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1099 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1100 | for option ROM call.\r |
0a6f4824 LG |
1101 | \r |
1102 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1103 | **/\r |
1104 | EFI_STATUS\r | |
1105 | PxeUndiGetInformation (\r | |
1106 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1107 | IN OUT PXENV_UNDI_GET_INFORMATION_T *PxeUndiTable\r | |
1108 | )\r | |
1109 | ;\r | |
1110 | \r | |
1111 | /**\r | |
0a6f4824 | 1112 | PXE\r |
bcecde14 | 1113 | UNDI GET STATISTICS\r |
1114 | Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)\r | |
1115 | Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized\r | |
1116 | by the caller.\r | |
1117 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1118 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1119 | constants.\r | |
1120 | Description: This call reads statistical information from the network adapter, and returns.\r | |
1121 | typedef struct {\r | |
1122 | PXENV_STATUS Status;\r | |
1123 | UINT32 XmtGoodFrames;\r | |
1124 | UINT32 RcvGoodFrames;\r | |
1125 | UINT32 RcvCRCErrors;\r | |
1126 | UINT32 RcvResourceErrors;\r | |
1127 | } PXENV_UNDI_GET_STATISTICS_T;\r | |
1128 | Set before calling API service\r | |
1129 | N/A\r | |
1130 | Returned from API service\r | |
1131 | Status: See the PXENV_STATUS_xxx constants.\r | |
1132 | XmtGoodFrames: Number of successful transmissions.\r | |
1133 | RcvGoodFrames: Number of good frames received.\r | |
1134 | RcvCRCErrors: Number of frames received with CRC\r | |
1135 | error.\r | |
1136 | RcvResourceErrors: Number of frames discarded\r | |
1137 | because receive queue was full.\r | |
0a6f4824 | 1138 | \r |
bcecde14 | 1139 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1140 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1141 | for option ROM call.\r |
0a6f4824 LG |
1142 | \r |
1143 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1144 | **/\r |
1145 | EFI_STATUS\r | |
1146 | PxeUndiGetStatistics (\r | |
1147 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1148 | IN OUT PXENV_UNDI_GET_STATISTICS_T *PxeUndiTable\r | |
1149 | )\r | |
1150 | ;\r | |
1151 | \r | |
1152 | /**\r | |
0a6f4824 | 1153 | PXE\r |
bcecde14 | 1154 | UNDI CLEAR STATISTICS\r |
1155 | Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)\r | |
1156 | Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.\r | |
1157 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1158 | the parameter structure must be set to one of the values represented by the\r | |
1159 | PXENV_STATUS_xxx constants.\r | |
1160 | Description: This call clears the statistical information from the network adapter.\r | |
1161 | typedef struct {\r | |
1162 | PXENV_STATUS Status;\r | |
1163 | } PXENV_UNDI_CLEAR_STATISTICS_T;\r | |
1164 | Set before calling API service\r | |
1165 | N/A\r | |
1166 | Returned from API service\r | |
1167 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 1168 | \r |
bcecde14 | 1169 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1170 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1171 | for option ROM call.\r |
0a6f4824 LG |
1172 | \r |
1173 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1174 | **/\r |
1175 | EFI_STATUS\r | |
1176 | PxeUndiClearStatistics (\r | |
1177 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1178 | IN OUT PXENV_UNDI_CLEAR_STATISTICS_T *PxeUndiTable\r | |
1179 | )\r | |
1180 | ;\r | |
1181 | \r | |
bcecde14 | 1182 | \r |
1183 | /**\r | |
0a6f4824 | 1184 | PXE\r |
bcecde14 | 1185 | UNDI GET MULTICAST ADDRESS\r |
1186 | Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)\r | |
1187 | Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized\r | |
1188 | by the caller.\r | |
1189 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1190 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1191 | constants.\r | |
1192 | Description: This call converts the given IP multicast address to a hardware multicast address.\r | |
1193 | typedef struct {\r | |
1194 | PXENV_STATUS Status;\r | |
1195 | IP4 InetAddr;\r | |
1196 | MAC_ADDR MediaAddr;\r | |
1197 | } PXENV_UNDI_GET_MCAST_ADDR_T;\r | |
1198 | Set before calling API service\r | |
1199 | InetAddr: IP multicast address.\r | |
1200 | Returned from API service\r | |
1201 | Status: See the PXENV_STATUS_xxx constants.\r | |
1202 | MediaAddr: MAC multicast address.\r | |
0a6f4824 | 1203 | \r |
bcecde14 | 1204 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1205 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1206 | for option ROM call.\r |
0a6f4824 LG |
1207 | \r |
1208 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1209 | **/\r |
1210 | EFI_STATUS\r | |
1211 | PxeUndiGetMcastAddr (\r | |
1212 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1213 | IN OUT PXENV_UNDI_GET_MCAST_ADDR_T *PxeUndiTable\r | |
1214 | )\r | |
1215 | ;\r | |
1216 | \r | |
1217 | /**\r | |
0a6f4824 | 1218 | PXE\r |
bcecde14 | 1219 | UNDI GET NIC TYPE\r |
1220 | Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)\r | |
1221 | Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE_T parameter structure that has been initialized by\r | |
1222 | the caller.\r | |
1223 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1224 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1225 | constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the\r | |
1226 | NIC information.\r | |
1227 | Description: This call, if successful, provides the NIC-specific information necessary to identify the network\r | |
1228 | adapter that is used to boot the system.\r | |
1229 | Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if\r | |
1230 | the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific\r | |
1231 | information can be obtained from the DHCPDISCOVER packet itself.\r | |
1232 | PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r | |
1233 | before the information provided is valid.\r | |
1234 | typedef {\r | |
1235 | PXENV_STATUS Status;\r | |
1236 | UINT8 NicType;\r | |
1237 | #define PCI_NIC 2\r | |
1238 | #define PnP_NIC 3\r | |
1239 | #define CardBus_NIC 4\r | |
1240 | Union {\r | |
1241 | Struct {\r | |
1242 | UINT16 Vendor_ID;\r | |
1243 | UINT16 Dev_ID;\r | |
1244 | UINT8 Base_Class;\r | |
1245 | UINT8 Sub_Class;\r | |
1246 | UINT8 Prog_Intf;\r | |
1247 | UINT8 Rev;\r | |
1248 | UINT16 BusDevFunc;\r | |
1249 | UINT16 SubVendor_ID;\r | |
1250 | UINT16 SubDevice_ID;\r | |
1251 | } pci, cardbus;\r | |
1252 | struct {\r | |
1253 | UINT32 EISA_Dev_ID;\r | |
1254 | UINT8 Base_Class;\r | |
1255 | UINT8 Sub_Class;\r | |
1256 | UINT8 Prog_Intf;\r | |
1257 | UINT16 CardSelNum;\r | |
1258 | } pnp;\r | |
1259 | } info;\r | |
1260 | } PXENV_UNDI_GET_NIC_TYPE_T;\r | |
1261 | Set before calling API service\r | |
1262 | N/A\r | |
1263 | Returned from API service\r | |
1264 | Status: See the PXENV_STATUS_xxx constants.\r | |
1265 | NICType: Type of NIC information stored in the parameter\r | |
1266 | structure.\r | |
1267 | Info: Information about the fields in this union can be found\r | |
0a6f4824 LG |
1268 | in the [PnP] and [PCI] specifications\r |
1269 | \r | |
bcecde14 | 1270 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1271 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1272 | for option ROM call.\r |
0a6f4824 LG |
1273 | \r |
1274 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1275 | **/\r |
1276 | EFI_STATUS\r | |
1277 | PxeUndiGetNicType (\r | |
1278 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1279 | IN OUT PXENV_UNDI_GET_NIC_TYPE_T *PxeUndiTable\r | |
1280 | )\r | |
1281 | ;\r | |
1282 | \r | |
1283 | /**\r | |
0a6f4824 | 1284 | PXE\r |
bcecde14 | 1285 | UNDI GET IFACE INFO\r |
1286 | Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)\r | |
1287 | Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized\r | |
1288 | by the caller.\r | |
1289 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1290 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1291 | constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the\r | |
1292 | interface specific information.\r | |
1293 | Description: This call, if successful, provides the network interface specific information such as the interface\r | |
1294 | type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the\r | |
1295 | universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.\r | |
1296 | Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the\r | |
1297 | universal driver to translate/convert this information into a format that is required in its specification\r | |
1298 | or to suit the expectation of the upper level protocol modules.\r | |
1299 | PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r | |
1300 | before the information provided is valid.\r | |
1301 | typedef struct {\r | |
1302 | PXENV_STATUS Status\r | |
1303 | UINT8 IfaceType[16];\r | |
1304 | UINT32 LinkSpeed;\r | |
1305 | UINT32 ServiceFlags;\r | |
1306 | UINT32 Reserved[4];\r | |
1307 | } PXENV_UNDI_GET_NDIS_INFO_T;\r | |
1308 | Set before calling API service\r | |
1309 | N/A\r | |
1310 | Returned from API service\r | |
1311 | Status: See the PXENV_STATUS_xxx constants.\r | |
1312 | IfaceType: Name of MAC type in ASCIIZ format. This is\r | |
1313 | used by the universal NDIS driver to specify its driver type\r | |
1314 | to the protocol driver.\r | |
1315 | LinkSpeed: Defined in the NDIS 2.0 specification.\r | |
1316 | ServiceFlags: Defined in the NDIS 2.0 specification.\r | |
0a6f4824 LG |
1317 | Reserved: Must be zero.\r |
1318 | \r | |
bcecde14 | 1319 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1320 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1321 | for option ROM call.\r |
0a6f4824 LG |
1322 | \r |
1323 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1324 | **/\r |
1325 | EFI_STATUS\r | |
1326 | PxeUndiGetNdisInfo (\r | |
1327 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1328 | IN OUT PXENV_UNDI_GET_NDIS_INFO_T *PxeUndiTable\r | |
1329 | )\r | |
1330 | ;\r | |
1331 | \r | |
1332 | /**\r | |
0a6f4824 | 1333 | PXE\r |
bcecde14 | 1334 | UNDI ISR\r |
1335 | Op-Code: PXENV_UNDI_ISR (0014h)\r | |
1336 | Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.\r | |
1337 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1338 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1339 | constants.\r | |
1340 | Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r | |
1341 | the parameter block indicates the operation to be performed for the call. This field is filled with the\r | |
1342 | status of that operation on return.\r | |
1343 | Note: Interrupt Service Routine Operation:\r | |
1344 | In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the\r | |
1345 | application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR\r | |
1346 | API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing\r | |
1347 | (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).\r | |
1348 | When the Network Interface HW generates an interrupt the protocol driver interrupt service\r | |
1349 | routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then\r | |
1350 | calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for\r | |
1351 | the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface\r | |
1352 | level and read any status values required to further process the interrupt. UNDI must return as\r | |
1353 | quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or\r | |
1354 | PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the\r | |
1355 | interrupt was generated by this particular Network Interface or not.\r | |
1356 | If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was\r | |
1357 | not generated by our NIC, and interrupt processing is complete.\r | |
1358 | If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start\r | |
1359 | a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is\r | |
1360 | now complete.\r | |
1361 | The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to\r | |
1362 | PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and\r | |
1363 | return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the\r | |
1364 | first buffer pointer of that frame in the parameter block.\r | |
1365 | The protocol driver calls UNDI repeatedly with the FuncFlag equal to\r | |
1366 | PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received\r | |
1367 | frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l\r | |
1368 | remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous\r | |
1369 | buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter\r | |
1370 | block. Otherwise it must return the first buffer in the next frame.\r | |
1371 | If there is no received frame pending to be processed, UNDI processes the transmit completes and\r | |
1372 | if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the\r | |
1373 | NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.\r | |
1374 | IMPORTANT: It is possible for the protocol driver to be interrupted again while in the\r | |
0a6f4824 LG |
1375 | strategy routine when the UNDI re-enables interrupts.\r |
1376 | \r | |
bcecde14 | 1377 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1378 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1379 | for option ROM call.\r |
0a6f4824 LG |
1380 | \r |
1381 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1382 | **/\r |
1383 | EFI_STATUS\r | |
1384 | PxeUndiIsr (\r | |
1385 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1386 | IN OUT PXENV_UNDI_ISR_T *PxeUndiTable\r | |
1387 | )\r | |
1388 | ;\r | |
1389 | \r | |
1390 | /**\r | |
0a6f4824 | 1391 | PXE\r |
bcecde14 | 1392 | STOP UNDI\r |
1393 | Op-Code: PXENV_STOP_UNDI (0015h)\r | |
1394 | Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.\r | |
1395 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1396 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1397 | constants.\r | |
1398 | Description: This routine is responsible for unhooking the Int 1Ah service routine.\r | |
1399 | Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid\r | |
1400 | status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from\r | |
1401 | base memory. Also, UNDI must not be removed from base memory if BC is not removed from base\r | |
1402 | memory.\r | |
1403 | Service cannot be used in protected mode.\r | |
1404 | typedef struct {\r | |
1405 | PXENV_STATUS Status;\r | |
1406 | } PXENV_STOP_UNDI_T;\r | |
1407 | Set before calling API service\r | |
1408 | N/A\r | |
1409 | Returned from API service\r | |
0a6f4824 LG |
1410 | Status: See the PXENV_STATUS_xxx constants.\r |
1411 | \r | |
bcecde14 | 1412 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1413 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1414 | for option ROM call.\r |
0a6f4824 LG |
1415 | \r |
1416 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1417 | **/\r |
1418 | EFI_STATUS\r | |
1419 | PxeUndiStop (\r | |
1420 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1421 | IN OUT PXENV_STOP_UNDI_T *PxeUndiTable\r | |
1422 | )\r | |
1423 | ;\r | |
1424 | \r | |
bcecde14 | 1425 | \r |
1426 | /**\r | |
1427 | Effect the Far Call into the PXE Layer\r | |
1428 | \r | |
1429 | Note: When using a 32-bit stack segment do not push 32-bit words onto the stack. The PXE API\r | |
1430 | services will not work, unless there are three 16-bit parameters pushed onto the stack.\r | |
1431 | push DS ;Far pointer to parameter structure\r | |
1432 | push offset pxe_data_call_struct ;is pushed onto stack.\r | |
1433 | push Index ;UINT16 is pushed onto stack.\r | |
1434 | call dword ptr (s_PXE ptr es:[di]).EntryPointSP\r | |
0a6f4824 | 1435 | add sp, 6 ;Caller cleans up stack.\r |
bcecde14 | 1436 | \r |
1437 | @param SimpleNetworkDevice Device instance for simple network\r | |
1438 | @param Table Point to parameter/retun value table for legacy far call\r | |
70d3fe9d | 1439 | @param TableSize The size of parameter/return value table\r |
bcecde14 | 1440 | @param CallIndex The index of legacy call.\r |
0a6f4824 LG |
1441 | \r |
1442 | @return EFI_STATUS\r | |
bcecde14 | 1443 | **/\r |
1444 | EFI_STATUS\r | |
1445 | MakePxeCall (\r | |
1446 | EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1447 | IN OUT VOID *Table,\r | |
1448 | IN UINTN TableSize,\r | |
1449 | IN UINT16 CallIndex\r | |
1450 | )\r | |
1451 | ;\r | |
1452 | \r | |
1453 | /**\r | |
1454 | Allocate buffer below 1M for real mode.\r | |
1455 | \r | |
1456 | @param NumPages The number pages want to be allocated.\r | |
1457 | @param Buffer On return, allocated buffer.\r | |
0a6f4824 | 1458 | \r |
bcecde14 | 1459 | @return Status of allocating pages.\r |
1460 | **/\r | |
1461 | EFI_STATUS\r | |
1462 | BiosSnp16AllocatePagesBelowOneMb (\r | |
1463 | UINTN NumPages,\r | |
1464 | VOID **Buffer\r | |
1465 | )\r | |
1466 | ;\r | |
1467 | \r | |
1468 | #endif\r |