]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/PxeUndi.c
IntelFrameworkModulePkg Snp16Dxe: Remove redundant functions
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / Snp16Dxe / PxeUndi.c
CommitLineData
0a6f4824
LG
1/** @file\r
2 Wrapper routines that use a PXE-enabled NIC option ROM to\r
3 supply internal routines for an EFI SNI (Simple Network\r
bcecde14 4 Interface) Protocol.\r
5\r
6 This file relies upon the existence of a PXE-compliant ROM\r
0a6f4824 7 in memory, as defined by the Preboot Execution Environment\r
bcecde14 8 Specification (PXE), Version 2.1, located at\r
9\r
10 http://developer.intel.com/ial/wfm/wfmspecs.htm\r
11\r
0a6f4824 12Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r
bcecde14 13\r
14This program and the accompanying materials\r
15are licensed and made available under the terms and conditions\r
16of the BSD License which accompanies this distribution. The\r
17full text of the license may be found at\r
18http://opensource.org/licenses/bsd-license.php\r
19\r
20THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
21WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
22\r
23**/\r
24\r
25#include "BiosSnp16.h"\r
26\r
27/**\r
0a6f4824 28 PXE\r
bcecde14 29 START UNDI\r
30 Op-Code: PXENV_START_UNDI (0000h)\r
31 Input: Far pointer to a PXENV_START_UNDI_T parameter structure that has been initialized by the caller.\r
32 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
33 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
34 constants.\r
35 Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is\r
36 responsible for saving the information it needs to communicate with the hardware.\r
37 This service is also responsible for hooking the Int 1Ah service routine\r
38 Note: This API service must be called only once during UNDI Option ROM boot.\r
39 The UNDI driver is responsible for saving this information and using it every time\r
40 PXENV_UNDI_STARTUP is called.\r
41 Service cannot be used in protected mode.\r
42 typedef struct {\r
43 PXENV_STATUS Status;\r
44 UINT16 AX;\r
45 UINT16 BX;\r
46 UINT16 DX;\r
47 UINT16 DI;\r
48 UINT16 ES;\r
49 } PXENV_START_UNDI_T;\r
50 Set before calling API service\r
51 AX, BX, DX, DI, ES: BIOS initialization parameter registers. These\r
52 fields should contain the same information passed to the option ROM\r
53 initialization routine by the Host System BIOS. Information about the\r
54 contents of these registers can be found in the [PnP], [PCI] and\r
55 [BBS] specifications.\r
56 Returned from API service\r
0a6f4824 57 Status: See the PXENV_STATUS_xxx constants.\r
bcecde14 58\r
59 @param SimpleNetworkDevice Device instance\r
0a6f4824 60 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 61 for option ROM call.\r
0a6f4824
LG
62\r
63 @return Return value of PXE option ROM far call.\r
bcecde14 64**/\r
65EFI_STATUS\r
66PxeStartUndi (\r
67 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
68 IN OUT PXENV_START_UNDI_T *PxeUndiTable\r
69 )\r
70{\r
71 return MakePxeCall (\r
72 SimpleNetworkDevice,\r
73 PxeUndiTable,\r
74 sizeof (PXENV_START_UNDI_T),\r
75 PXENV_START_UNDI\r
76 );\r
77}\r
78\r
79/**\r
0a6f4824
LG
80 PXE\r
81 UNDI STARTUP\r
bcecde14 82 Op-Code: PXENV_UNDI_STARTUP (0001h)\r
83 Input: Far pointer to a PXENV_UNDI_STARTUP_T parameter structure that has been initialized by the\r
84 caller.\r
85 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
86 the parameter structure must be set to one of the values represented by the\r
87 PXENV_STATUS_xxx constants.\r
88 Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper\r
89 operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used\r
90 to complete this initialization. The rest of the UNDI APIs will not be available until this call has\r
91 been completed.\r
92 Note: PXENV_UNDI_STARTUP must not be called again without first calling\r
93 PXENV_UNDI_SHUTDOWN.\r
94 PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for\r
95 chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and\r
96 PXENV_STOP_UNDI API calls.\r
97 This service cannot be used in protected mode.\r
0a6f4824 98 typedef struct\r
bcecde14 99 {\r
100 PXENV_STATUS Status;\r
101 } PXENV_UNDI_STARTUP_T;\r
102 Set before calling API service\r
103 N/A\r
104 Returned from API service\r
105 Status: See the PXENV_STATUS_xxx constants.\r
106\r
107 @param SimpleNetworkDevice Device instance\r
0a6f4824 108 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 109 for option ROM call.\r
0a6f4824
LG
110\r
111 @return Return value of PXE option ROM far call.\r
bcecde14 112**/\r
113EFI_STATUS\r
114PxeUndiStartup (\r
115 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
116 IN OUT PXENV_UNDI_STARTUP_T *PxeUndiTable\r
117 )\r
118{\r
119 return MakePxeCall (\r
120 SimpleNetworkDevice,\r
121 PxeUndiTable,\r
122 sizeof (PXENV_UNDI_STARTUP_T),\r
123 PXENV_UNDI_STARTUP\r
124 );\r
125}\r
126\r
127/**\r
0a6f4824 128 PXE\r
bcecde14 129 UNDI CLEANUP\r
130 Op-Code: PXENV_UNDI_CLEANUP (0002h)\r
131 Input: Far pointer to a PXENV_UNDI_CLEANUP_T parameter structure.\r
132 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field\r
133 in the parameter structure must be set to one of the values represented by the\r
134 PXENV_STATUS_xxx constants.\r
135 Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be\r
136 made just before unloading the Universal NIC Driver. The rest of the API will not be available\r
137 after this call executes.\r
138 This service cannot be used in protected mode.\r
139 typedef struct {\r
140 PXENX_STATUS Status;\r
141 } PXENV_UNDI_CLEANUP_T;\r
142 Set before calling API service\r
143 N/A\r
144 Returned from API service\r
145 Status: See the PXENV_STATUS_xxx constants.\r
146\r
147 @param SimpleNetworkDevice Device instance\r
0a6f4824 148 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 149 for option ROM call.\r
0a6f4824
LG
150\r
151 @return Return value of PXE option ROM far call.\r
bcecde14 152**/\r
153EFI_STATUS\r
154PxeUndiCleanup (\r
155 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
156 IN OUT PXENV_UNDI_CLEANUP_T *PxeUndiTable\r
157 )\r
158{\r
159 return MakePxeCall (\r
160 SimpleNetworkDevice,\r
161 PxeUndiTable,\r
162 sizeof (PXENV_UNDI_CLEANUP_T),\r
163 PXENV_UNDI_CLEANUP\r
164 );\r
165}\r
166\r
167/**\r
0a6f4824 168 PXE\r
bcecde14 169 UNDI INITIALIZE\r
170 Op-Code: PXENV_UNDI_INITIALIZE (0003h)\r
171 Input: Far pointer to a PXENV_UNDI_INITIALIZE_T parameter structure that has been initialized by the\r
172 caller.\r
173 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
174 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
175 constants.\r
176 Description: This call resets the adapter and programs it with default parameters. The default parameters used\r
177 are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the\r
178 receive and transmit units of the network adapter to readily receive or transmit packets. The\r
179 application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.\r
180 This call must be made by an application to establish an interface to the network adapter driver.\r
181 Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for\r
182 the Protocol field in the parameter structure.\r
183 typedef struct {\r
184 PXENV_STATUS Status;\r
185 ADDR32 ProtocolIni;\r
186 UINT8 reserved[8];\r
187 } PXENV_UNDI_INITIALIZE_T;\r
188 Set before calling API service\r
189 ProtocolIni: Physical address of a memory copy of the driver\r
190 module from the protocol.ini file obtained from the protocol manager\r
191 driver (refer to the NDIS 2.0 specification). This parameter is\r
192 supported for the universal NDIS driver to pass the information\r
193 contained in the protocol.ini file to the NIC driver for any specific\r
194 configuration of the NIC. (Note that the module identification in the\r
195 protocol.ini file was done by NDIS.) This value can be NULL for any\r
196 other application interfacing to the universal NIC driver\r
197 Returned from API service\r
0a6f4824
LG
198 Status: See the PXENV_STATUS_xxx constants.\r
199\r
bcecde14 200 @param SimpleNetworkDevice Device instance\r
0a6f4824 201 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 202 for option ROM call.\r
0a6f4824
LG
203\r
204 @return Return value of PXE option ROM far call.\r
bcecde14 205**/\r
206EFI_STATUS\r
207PxeUndiInitialize (\r
208 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
209 IN OUT PXENV_UNDI_INITIALIZE_T *PxeUndiTable\r
210 )\r
211{\r
212 return MakePxeCall (\r
213 SimpleNetworkDevice,\r
214 PxeUndiTable,\r
215 sizeof (PXENV_UNDI_INITIALIZE_T),\r
216 PXENV_UNDI_INITIALIZE\r
217 );\r
218}\r
219\r
220/**\r
221 Wrapper routine for reset adapter.\r
0a6f4824
LG
222\r
223 PXE\r
bcecde14 224 UNDI RESET ADAPTER\r
225 Op-Code: PXENV_UNDI_RESET_ADAPTER (0004h)\r
226 Input: Far pointer to a PXENV_UNDI_RESET_ADAPTER_t parameter structure that has been initialized\r
227 by the caller.\r
228 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
229 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
230 constants.\r
231 Description: This call resets and reinitializes the network adapter with the same set of parameters supplied to\r
232 Initialize Routine. Unlike Initialize, this call opens the adapter that is, it connects logically to the\r
233 network. This routine cannot be used to replace Initialize or Shutdown calls.\r
234 typedef struct {\r
235 PXENV_STATUS Status;\r
236 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r
237 } PXENV_UNDI_RESET_T;\r
238\r
239 #define MAXNUM_MCADDR 8\r
240\r
241 typedef struct {\r
242 UINT16 MCastAddrCount;\r
243 MAC_ADDR McastAddr[MAXNUM_MCADDR];\r
244 } PXENV_UNDI_MCAST_ADDRESS_t;\r
245\r
246 Set before calling API service\r
247 R_Mcast_Buf: This is a structure of MCastAddrCount and\r
248 McastAddr.\r
249 MCastAddrCount: Number of multicast MAC addresses in the\r
250 buffer.\r
251 McastAddr: List of up to MAXNUM_MCADDR multicast MAC\r
252 addresses.\r
253 Returned from API service\r
254 Status: See the PXENV_STATUS_xxx constants.\r
0a6f4824 255\r
bcecde14 256 @param SimpleNetworkDevice Device instance.\r
0a6f4824 257 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 258 for option ROM call.\r
0a6f4824
LG
259 @param RxFilter Filter setting mask value for PXE recive .\r
260\r
261 @return Return value of PXE option ROM far call.\r
bcecde14 262**/\r
263EFI_STATUS\r
264PxeUndiResetNic (\r
265 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
266 IN OUT PXENV_UNDI_RESET_T *PxeUndiTable,\r
267 IN UINT16 RxFilter\r
268 )\r
269{\r
270 PXENV_UNDI_OPEN_T Open;\r
271 PXENV_UNDI_CLOSE_T Close;\r
272 UINTN Status;\r
273\r
274 Status = MakePxeCall (\r
275 SimpleNetworkDevice,\r
276 PxeUndiTable,\r
277 sizeof (PXENV_UNDI_RESET_T),\r
278 PXENV_UNDI_RESET_NIC\r
279 );\r
280 if (!EFI_ERROR(Status)) {\r
281 return Status;\r
282 }\r
283\r
284 Close.Status = PXENV_STATUS_SUCCESS;\r
285\r
286 Status = MakePxeCall (\r
287 SimpleNetworkDevice,\r
288 &Close,\r
289 sizeof (Close),\r
290 PXENV_UNDI_CLOSE\r
291 );\r
292 if (EFI_ERROR(Status)) {\r
293 return EFI_DEVICE_ERROR;\r
294 }\r
295\r
296 Status = MakePxeCall (\r
297 SimpleNetworkDevice,\r
298 PxeUndiTable,\r
299 sizeof (PXENV_UNDI_RESET_T),\r
300 PXENV_UNDI_RESET_NIC\r
301 );\r
302 if (EFI_ERROR(Status)) {\r
303 return EFI_DEVICE_ERROR;\r
304 }\r
305\r
306 Open.Status = PXENV_STATUS_SUCCESS;\r
307 Open.OpenFlag = 0;\r
308 Open.PktFilter = RxFilter;\r
309 CopyMem (\r
310 &Open.McastBuffer,\r
311 &PxeUndiTable->R_Mcast_Buf,\r
312 sizeof (PXENV_UNDI_MCAST_ADDR_T)\r
0a6f4824
LG
313 );\r
314\r
bcecde14 315\r
316 Status = MakePxeCall (\r
317 SimpleNetworkDevice,\r
318 &Open,\r
319 sizeof (Open),\r
320 PXENV_UNDI_OPEN\r
321 );\r
322 if (EFI_ERROR(Status)) {\r
323 return EFI_DEVICE_ERROR;\r
324 }\r
325\r
326 return EFI_SUCCESS;\r
327}\r
328\r
329/**\r
0a6f4824 330 PXE\r
bcecde14 331 UNDI SHUTDOWN\r
332 Op-Code: PXENV_UNDI_SHUTDOWN (0005h)\r
333 Input: Far pointer to a PXENV_UNDI_SHUTDOWN_T parameter.\r
334 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
335 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
336 constants.\r
337 Description: This call resets the network adapter and leaves it in a safe state for another driver to program it.\r
338 Note: The contents of the PXENV_UNDI_STARTUP parameter structure need to be saved by the\r
339 Universal NIC Driver in case PXENV_UNDI_INITIALIZE is called again.\r
0a6f4824 340 typedef struct\r
bcecde14 341 {\r
342 PXENV_STATUS Status;\r
343 } PXENV_UNDI_SHUTDOWN_T;\r
344 Set before calling API service\r
345 N/A\r
346 Returned from API service\r
347 Status: See the PXENV_STATUS_xxx constants.\r
0a6f4824 348\r
bcecde14 349 @param SimpleNetworkDevice Device instance\r
0a6f4824 350 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 351 for option ROM call.\r
0a6f4824
LG
352\r
353 @return Return value of PXE option ROM far call.\r
bcecde14 354**/\r
355EFI_STATUS\r
356PxeUndiShutdown (\r
357 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
358 IN OUT PXENV_UNDI_SHUTDOWN_T *PxeUndiTable\r
359 )\r
360{\r
361 return MakePxeCall (\r
362 SimpleNetworkDevice,\r
363 PxeUndiTable,\r
364 sizeof (PXENV_UNDI_SHUTDOWN_T),\r
365 PXENV_UNDI_SHUTDOWN\r
366 );\r
367}\r
368\r
369/**\r
0a6f4824 370 PXE\r
bcecde14 371 UNDI OPEN\r
372 Op-Code: PXENV_UNDI_OPEN (0006h)\r
373 Input: Far pointer to a PXENV_UNDI_OPEN_T parameter structure that has been initialized by the caller.\r
374 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
375 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
376 constants.\r
377 Description: This call activates the adapter network connection and sets the adapter ready to accept packets\r
378 for transmit and receive.\r
379 typedef struct {\r
380 PXENV_STATUS Status;\r
381 UINT16 OpenFlag;\r
382 UINT16 PktFilter;\r
383 #define FLTR_DIRECTED 0x0001\r
384 #define FLTR_BRDCST 0x0002\r
385 #define FLTR_PRMSCS 0x0004\r
386 #define FLTR_SRC_RTG 0x0008\r
387 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r
388 } PXENV_UNDI_OPEN_T;\r
389 Set before calling API service\r
390 OpenFlag: This is an adapter specific input parameter. This is\r
391 supported for the universal NDIS 2.0 driver to pass in the open flags\r
392 provided by the protocol driver. (See the NDIS 2.0 specification.)\r
393 This can be zero.\r
394 PktFilter: Filter for receiving packets. This can be one, or more, of\r
395 the FLTR_xxx constants. Multiple values are arithmetically or-ed\r
396 together.\r
397 directed packets are packets that may come to your MAC address\r
398 or the multicast MAC address.\r
399 R_Mcast_Buf: See definition in UNDI RESET ADAPTER (0004h).\r
400 Returned from API service\r
401 Status: See the PXENV_STATUS_xxx constants.\r
0a6f4824 402\r
bcecde14 403 @param SimpleNetworkDevice Device instance\r
0a6f4824 404 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 405 for option ROM call.\r
0a6f4824
LG
406\r
407 @return Return value of PXE option ROM far call.\r
bcecde14 408**/\r
409EFI_STATUS\r
410PxeUndiOpen (\r
411 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
412 IN OUT PXENV_UNDI_OPEN_T *PxeUndiTable\r
413 )\r
414{\r
415 return MakePxeCall (\r
416 SimpleNetworkDevice,\r
417 PxeUndiTable,\r
418 sizeof (PXENV_UNDI_OPEN_T),\r
419 PXENV_UNDI_OPEN\r
420 );\r
421}\r
422\r
423/**\r
0a6f4824 424 PXE\r
bcecde14 425 UNDI CLOSE\r
426 Op-Code: PXENV_UNDI_CLOSE (0007h)\r
427 Input: Far pointer to a PXENV_UNDI_CLOSE_T parameter.\r
428 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
429 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
430 constants.\r
431 Description: This call disconnects the network adapter from the network. Packets cannot be transmitted or\r
432 received until the network adapter is open again.\r
433 typedef struct {\r
434 PXENV_STATUS Status;\r
435 } PXENV_UNDI_CLOSE_T;\r
436 Set before calling API service\r
437 N/A\r
438 Returned from API service\r
439 Status: See the PXENV_STATUS_xxx constants.\r
0a6f4824 440\r
bcecde14 441 @param SimpleNetworkDevice Device instance\r
0a6f4824 442 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 443 for option ROM call.\r
0a6f4824
LG
444\r
445 @return Return value of PXE option ROM far call.\r
bcecde14 446**/\r
447EFI_STATUS\r
448PxeUndiClose (\r
449 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
450 IN OUT PXENV_UNDI_CLOSE_T *PxeUndiTable\r
451 )\r
452{\r
453 return MakePxeCall (\r
454 SimpleNetworkDevice,\r
455 PxeUndiTable,\r
456 sizeof (PXENV_UNDI_CLOSE_T),\r
457 PXENV_UNDI_CLOSE\r
458 );\r
459}\r
460\r
461/**\r
0a6f4824 462 PXE\r
bcecde14 463 UNDI TRANSMIT PACKET\r
464 Op-Code: PXENV_UNDI_TRANSMIT (0008h)\r
465 Input: Far pointer to a PXENV_UNDI_TRANSMIT_T parameter structure that\r
466 has been initialized by the caller.\r
467 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX.\r
468 The status code must be set to one of the values represented by the\r
469 PXENV_STATUS_xxx constants.\r
470 Description: This call transmits a buffer to the network. The media header\r
471 for the packet can be filled by the calling protocol, but it might not be.\r
472 The network adapter driver will fill it if required by the values in the\r
473 parameter block. The packet is buffered for transmission provided there is\r
474 an available buffer, and the function returns PXENV_EXIT_SUCCESS. If no\r
475 buffer is available the function returns PXENV_EXIT_FAILURE with a status\r
476 code of PXE_UNDI_STATUS__OUT OF_RESOURCE. The number of buffers is\r
477 implementation-dependent. An interrupt is generated on completion of the\r
478 transmission of one or more packets. A call to PXENV_UNDI_TRANSMIT is\r
479 permitted in the context of a transmit complete interrupt.\r
480\r
481 typedef struct {\r
482 PXENV_STATUS Status;\r
483 UINT8 Protocol;\r
484 #define P_UNKNOWN 0\r
485 #define P_IP 1\r
486 #define P_ARP 2\r
487 #define P_RARP 3\r
488 UINT8 XmitFlag;\r
489 #define XMT_DESTADDR 0x0000\r
490 #define XMT_BROADCAST 0x0001\r
491 SEGOFF16 DestAddr;\r
492 SEGOFF16 TBD;\r
493 UINT32 Reserved[2];\r
494 } t_PXENV_UNDI_TRANSMIT;\r
495\r
496 #define MAX_DATA_BLKS 8\r
497\r
498 typedef struct {\r
499 UINT16 ImmedLength;\r
500 SEGOFF16 Xmit;\r
501 UINT16 DataBlkCount;\r
502 struct DataBlk {\r
503 UINT8 TDPtrType;\r
504 UINT8 TDRsvdByte;\r
505 UINT16 TDDataLen;\r
506 SEGOFF16 TDDataPtr;\r
507 } DataBlock[MAX_DATA_BLKS];\r
508 } PXENV_UNDI_TBD_T\r
509\r
510 Set before calling API service\r
511 Protocol: This is the protocol of the upper layer that is calling UNDI\r
512 TRANSMIT call. If the upper layer has filled the media header, this\r
513 field must be P_UNKNOWN.\r
514 XmitFlag: If this flag is XMT_DESTADDR, the NIC driver expects a\r
515 pointer to the destination media address in the field DestAddr. If\r
516 XMT_BROADCAST, the NIC driver fills the broadcast address for the\r
517 destination.\r
518 TBD: Segment:Offset address of the transmit buffer descriptor.\r
519 ImmedLength: Length of the immediate transmit buffer: Xmit.\r
520 Xmit: Segment:Offset of the immediate transmit buffer.\r
521 DataBlkCount: Number of blocks in this transmit buffer.\r
522 TDPtrType:\r
523 0 => 32-bit physical address in TDDataPtr (not supported in this\r
524 version of PXE)\r
525 1 => segment:offset in TDDataPtr which can be a real mode or 16-bit\r
526 protected mode pointer\r
527 TDRsvdByte: Reserved must be zero.\r
528 TDDatalen: Data block length in bytes.\r
529 TDDataPtr: Segment:Offset of the transmit block.\r
530 DataBlock: Array of transmit data blocks.\r
531 Returned from API service\r
0a6f4824
LG
532 Status: See the PXENV_STATUS_xxx constants\r
533\r
bcecde14 534 @param SimpleNetworkDevice Device instance\r
0a6f4824 535 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 536 for option ROM call.\r
0a6f4824
LG
537\r
538 @return Return value of PXE option ROM far call.\r
bcecde14 539**/\r
540EFI_STATUS\r
541PxeUndiTransmit (\r
542 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
543 IN OUT PXENV_UNDI_TRANSMIT_T *PxeUndiTable\r
544 )\r
545{\r
546 EFI_STATUS Status;\r
547\r
548 Status = MakePxeCall (\r
549 SimpleNetworkDevice,\r
550 PxeUndiTable,\r
551 sizeof (PXENV_UNDI_TRANSMIT_T),\r
552 PXENV_UNDI_TRANSMIT\r
553 );\r
554 if (Status == EFI_SUCCESS) {\r
555 return EFI_SUCCESS;\r
556 }\r
557\r
558 switch (PxeUndiTable->Status) {\r
559 case PXENV_STATUS_OUT_OF_RESOURCES:\r
560 return EFI_NOT_READY;\r
561\r
562 default:\r
563 return EFI_DEVICE_ERROR;\r
564 }\r
565}\r
566\r
0a6f4824 567\r
bcecde14 568\r
569/**\r
0a6f4824 570 PXE\r
bcecde14 571 UNDI SET STATION ADDRESS\r
572 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)\r
573 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been\r
574 initialized by the caller.\r
575 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
576 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
577 constants.\r
578 Description: This call sets the MAC address to be the input value and is called before opening the network\r
579 adapter. Later, the open call uses this variable as a temporary MAC address to program the\r
580 adapter individual address registers.\r
581 typedef struct {\r
582 PXENV_STATUS Status;\r
583 MAC_ADDR StationAddress;\r
584 } PXENV_UNDI_SET_STATION_ADDR_T;\r
585 Set before calling API service\r
586 StationAddress: Temporary MAC address to be used for\r
587 transmit and receive.\r
588 Returned from API service\r
0a6f4824
LG
589 Status: See the PXENV_STATUS_xxx constants.\r
590\r
bcecde14 591 @param SimpleNetworkDevice Device instance\r
0a6f4824 592 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 593 for option ROM call.\r
0a6f4824
LG
594\r
595 @return Return value of PXE option ROM far call.\r
bcecde14 596**/\r
597EFI_STATUS\r
598PxeUndiSetStationAddr (\r
599 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
600 IN OUT PXENV_UNDI_SET_STATION_ADDR_T *PxeUndiTable\r
601 )\r
602{\r
603 return MakePxeCall (\r
604 SimpleNetworkDevice,\r
605 PxeUndiTable,\r
606 sizeof (PXENV_UNDI_SET_STATION_ADDR_T),\r
607 PXENV_UNDI_SET_STATION_ADDR\r
608 );\r
609}\r
610\r
611/**\r
0a6f4824 612 PXE\r
bcecde14 613 UNDI SET PACKET FILTER\r
614 Op-Code: PXENV_UNDI_SET_PACKET_FILTER (000Bh)\r
615 Input: Far pointer to a PXENV_UNDI_SET_PACKET_FILTER_T parameter structure that has been\r
616 initialized by the caller.\r
617 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
618 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
619 constants.\r
620 Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with\r
621 the open call.\r
622 typedef struct {\r
623 PXENV_STATUS Status;\r
624 UINT8 filter;\r
625 } PXENV_UNDI_SET_PACKET_FILTER_T;\r
626 Set before calling API service\r
627 Filter: See the receive filter values in the UNDI OPEN\r
628 (0006h) API description.\r
629 Returned from API service\r
0a6f4824
LG
630 Status: See the PXENV_STATUS_xxx constants.\r
631\r
bcecde14 632 @param SimpleNetworkDevice Device instance\r
0a6f4824 633 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 634 for option ROM call.\r
0a6f4824
LG
635\r
636 @return Return value of PXE option ROM far call.\r
bcecde14 637**/\r
bcecde14 638\r
639/**\r
0a6f4824 640 PXE\r
bcecde14 641 UNDI GET INFORMATION\r
642 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)\r
643 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been\r
644 initialized by the caller.\r
645 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
646 the parameter structure must be set to one of the values represented by the\r
647 PXENV_STATUS_xxx constants.\r
648 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.\r
649 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and\r
650 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after\r
651 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been\r
652 called.\r
653 typedef struct {\r
654 PXENV_STATUS Status;\r
655 UINT16 BaseIo;\r
656 UINT16 IntNumber;\r
657 UINT16 MaxTranUnit;\r
658 UINT16 HwType;\r
659 #define ETHER_TYPE 1\r
660 #define EXP_ETHER_TYPE 2\r
661 #define IEEE_TYPE 6\r
662 #define ARCNET_TYPE 7\r
663 UINT16 HwAddrLen;\r
664 MAC_ADDR CurrentNodeAddress;\r
665 MAC_ADDR PermNodeAddress;\r
666 SEGSEL ROMAddress;\r
667 UINT16 RxBufCt;\r
668 UINT16 TxBufCt;\r
669 } PXENV_UNDI_GET_INFORMATION_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 BaseIO: Adapter base I/O address.\r
675 IntNumber: Adapter IRQ number.\r
676 MaxTranUnit: Adapter maximum transmit unit.\r
677 HWType: Type of protocol at the hardware level.\r
678 HWAddrLen: Length of the hardware address.\r
679 CurrentNodeAddress: Current hardware address.\r
680 PermNodeAddress: Permanent hardware address.\r
681 ROMAddress: Real mode ROM segment address.\r
682 RxBufCnt: Receive queue length.\r
0a6f4824
LG
683 TxBufCnt: Transmit queue length.\r
684\r
bcecde14 685 @param SimpleNetworkDevice Device instance\r
0a6f4824 686 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 687 for option ROM call.\r
0a6f4824
LG
688\r
689 @return Return value of PXE option ROM far call.\r
bcecde14 690**/\r
691EFI_STATUS\r
692PxeUndiGetInformation (\r
693 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
694 IN OUT PXENV_UNDI_GET_INFORMATION_T *PxeUndiTable\r
695 )\r
696{\r
697 return MakePxeCall (\r
698 SimpleNetworkDevice,\r
699 PxeUndiTable,\r
700 sizeof (PXENV_UNDI_GET_INFORMATION_T),\r
701 PXENV_UNDI_GET_INFORMATION\r
702 );\r
703}\r
704\r
705/**\r
0a6f4824 706 PXE\r
bcecde14 707 UNDI GET STATISTICS\r
708 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)\r
709 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized\r
710 by the caller.\r
711 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
712 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
713 constants.\r
714 Description: This call reads statistical information from the network adapter, and returns.\r
715 typedef struct {\r
716 PXENV_STATUS Status;\r
717 UINT32 XmtGoodFrames;\r
718 UINT32 RcvGoodFrames;\r
719 UINT32 RcvCRCErrors;\r
720 UINT32 RcvResourceErrors;\r
721 } PXENV_UNDI_GET_STATISTICS_T;\r
722 Set before calling API service\r
723 N/A\r
724 Returned from API service\r
725 Status: See the PXENV_STATUS_xxx constants.\r
726 XmtGoodFrames: Number of successful transmissions.\r
727 RcvGoodFrames: Number of good frames received.\r
728 RcvCRCErrors: Number of frames received with CRC\r
729 error.\r
730 RcvResourceErrors: Number of frames discarded\r
731 because receive queue was full.\r
0a6f4824 732\r
bcecde14 733 @param SimpleNetworkDevice Device instance\r
0a6f4824 734 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 735 for option ROM call.\r
0a6f4824
LG
736\r
737 @return Return value of PXE option ROM far call.\r
bcecde14 738**/\r
739EFI_STATUS\r
740PxeUndiGetStatistics (\r
741 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
742 IN OUT PXENV_UNDI_GET_STATISTICS_T *PxeUndiTable\r
743 )\r
744{\r
745 return MakePxeCall (\r
746 SimpleNetworkDevice,\r
747 PxeUndiTable,\r
748 sizeof (PXENV_UNDI_GET_STATISTICS_T),\r
749 PXENV_UNDI_GET_STATISTICS\r
750 );\r
751}\r
752\r
753/**\r
0a6f4824 754 PXE\r
bcecde14 755 UNDI CLEAR STATISTICS\r
756 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)\r
757 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.\r
758 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
759 the parameter structure must be set to one of the values represented by the\r
760 PXENV_STATUS_xxx constants.\r
761 Description: This call clears the statistical information from the network adapter.\r
762 typedef struct {\r
763 PXENV_STATUS Status;\r
764 } PXENV_UNDI_CLEAR_STATISTICS_T;\r
765 Set before calling API service\r
766 N/A\r
767 Returned from API service\r
768 Status: See the PXENV_STATUS_xxx constants.\r
0a6f4824 769\r
bcecde14 770 @param SimpleNetworkDevice Device instance\r
0a6f4824 771 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 772 for option ROM call.\r
0a6f4824
LG
773\r
774 @return Return value of PXE option ROM far call.\r
bcecde14 775**/\r
776EFI_STATUS\r
777PxeUndiClearStatistics (\r
778 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
779 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T *PxeUndiTable\r
780 )\r
781{\r
782 return MakePxeCall (\r
783 SimpleNetworkDevice,\r
784 PxeUndiTable,\r
785 sizeof (PXENV_UNDI_CLEAR_STATISTICS_T),\r
786 PXENV_UNDI_CLEAR_STATISTICS\r
787 );\r
788}\r
789\r
790/**\r
0a6f4824 791 PXE\r
bcecde14 792 UNDI INITIATE DIAGS\r
793 Op-Code: PXENV_UNDI_INITIATE_DIAGS (000Fh)\r
794 Input: Far pointer to a PXENV_UNDI_INITIATE_DIAGS_T parameter.\r
795 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
796 the parameter structure must be set to one of the values represented by the\r
797 PXENV_STATUS_xxx constants.\r
798 Description: This call can be used to initiate the run-time diagnostics. It causes the network adapter to run\r
799 hardware diagnostics and to update its status information.\r
800 typedef struct {\r
801 PXENV_STATUS Status;\r
802 } PXENV_UNDI_INITIATE_DIAGS_T;\r
803 Set before calling API service\r
804 N/A\r
805 Returned from API service\r
0a6f4824
LG
806 Status: See the PXENV_STATUS_xxx constants.\r
807\r
bcecde14 808 @param SimpleNetworkDevice Device instance\r
0a6f4824 809 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 810 for option ROM call.\r
0a6f4824
LG
811\r
812 @return Return value of PXE option ROM far call.\r
bcecde14 813**/\r
bcecde14 814\r
815/**\r
0a6f4824 816 PXE\r
bcecde14 817 UNDI FORCE INTERRUPT\r
818 Op-Code: PXENV_UNDI_FORCE_INTERRUPT (0010h)\r
819 Input: Far pointer to a PXENV_UNDI_FORCE_INTERRUPT_T parameter structure that has been\r
820 initialized by the caller.\r
821 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
822 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
823 constants.\r
824 Description: This call forces the network adapter to generate an interrupt. When a receive interrupt occurs, the\r
825 network adapter driver usually queues the packet and calls the application's callback receive\r
826 routine with a pointer to the packet received. Then, the callback routine either can copy the packet\r
827 to its buffer or can decide to delay the copy to a later time. If the packet is not immediately copied,\r
828 the network adapter driver does not remove it from the input queue. When the application wants to\r
829 copy the packet, it can call the PXENV_UNDI_FORCE_INTERRUPT routine to simulate the receive\r
830 interrupt.\r
831 typedef struct {\r
832 PXENV_STATUS Status;\r
833 } PXENV_UNDI_FORCE_INTERRUPT_T;\r
834 Set before calling API service\r
835 N/A\r
836 Returned from API service\r
0a6f4824
LG
837 Status: See the PXENV_STATUS_xxx constants.\r
838\r
bcecde14 839 @param SimpleNetworkDevice Device instance\r
0a6f4824 840 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 841 for option ROM call.\r
0a6f4824
LG
842\r
843 @return Return value of PXE option ROM far call.\r
bcecde14 844**/\r
bcecde14 845\r
846/**\r
0a6f4824 847 PXE\r
bcecde14 848 UNDI GET MULTICAST ADDRESS\r
849 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)\r
850 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized\r
851 by the caller.\r
852 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
853 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
854 constants.\r
855 Description: This call converts the given IP multicast address to a hardware multicast address.\r
856 typedef struct {\r
857 PXENV_STATUS Status;\r
858 IP4 InetAddr;\r
859 MAC_ADDR MediaAddr;\r
860 } PXENV_UNDI_GET_MCAST_ADDR_T;\r
861 Set before calling API service\r
862 InetAddr: IP multicast address.\r
863 Returned from API service\r
864 Status: See the PXENV_STATUS_xxx constants.\r
865 MediaAddr: MAC multicast address.\r
0a6f4824 866\r
bcecde14 867 @param SimpleNetworkDevice Device instance\r
0a6f4824 868 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 869 for option ROM call.\r
0a6f4824
LG
870\r
871 @return Return value of PXE option ROM far call.\r
bcecde14 872**/\r
873EFI_STATUS\r
874PxeUndiGetMcastAddr (\r
875 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
876 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T *PxeUndiTable\r
877 )\r
878{\r
879 return MakePxeCall (\r
880 SimpleNetworkDevice,\r
881 PxeUndiTable,\r
882 sizeof (PXENV_UNDI_GET_MCAST_ADDR_T),\r
883 PXENV_UNDI_GET_MCAST_ADDR\r
884 );\r
885}\r
886\r
887/**\r
0a6f4824 888 PXE\r
bcecde14 889 UNDI GET NIC TYPE\r
890 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)\r
891 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE parameter structure that has been initialized by\r
892 the caller.\r
893 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
894 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
895 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the\r
896 NIC information.\r
897 Description: This call, if successful, provides the NIC-specific information necessary to identify the network\r
898 adapter that is used to boot the system.\r
899 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if\r
900 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific\r
901 information can be obtained from the DHCPDISCOVER packet itself.\r
902 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r
903 before the information provided is valid.\r
904 typedef {\r
905 PXENV_STATUS Status;\r
906 UINT8 NicType;\r
907 #define PCI_NIC 2\r
908 #define PnP_NIC 3\r
909 #define CardBus_NIC 4\r
910 Union {\r
911 Struct {\r
912 UINT16 Vendor_ID;\r
913 UINT16 Dev_ID;\r
914 UINT8 Base_Class;\r
915 UINT8 Sub_Class;\r
916 UINT8 Prog_Intf;\r
917 UINT8 Rev;\r
918 UINT16 BusDevFunc;\r
919 UINT16 SubVendor_ID;\r
920 UINT16 SubDevice_ID;\r
921 } pci, cardbus;\r
922 struct {\r
923 UINT32 EISA_Dev_ID;\r
924 UINT8 Base_Class;\r
925 UINT8 Sub_Class;\r
926 UINT8 Prog_Intf;\r
927 UINT16 CardSelNum;\r
928 } pnp;\r
929 } info;\r
930 } PXENV_UNDI_GET_NIC_TYPE_T;\r
931 Set before calling API service\r
932 N/A\r
933 Returned from API service\r
934 Status: See the PXENV_STATUS_xxx constants.\r
935 NICType: Type of NIC information stored in the parameter\r
936 structure.\r
937 Info: Information about the fields in this union can be found\r
0a6f4824
LG
938 in the [PnP] and [PCI] specifications\r
939\r
bcecde14 940 @param SimpleNetworkDevice Device instance\r
0a6f4824 941 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 942 for option ROM call.\r
0a6f4824
LG
943\r
944 @return Return value of PXE option ROM far call.\r
bcecde14 945**/\r
946EFI_STATUS\r
947PxeUndiGetNicType (\r
948 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
949 IN OUT PXENV_UNDI_GET_NIC_TYPE_T *PxeUndiTable\r
950 )\r
951{\r
952 return MakePxeCall (\r
953 SimpleNetworkDevice,\r
954 PxeUndiTable,\r
955 sizeof (PXENV_UNDI_GET_NIC_TYPE_T),\r
956 PXENV_UNDI_GET_NIC_TYPE\r
957 );\r
958}\r
959\r
960/**\r
0a6f4824 961 PXE\r
bcecde14 962 UNDI GET IFACE INFO\r
963 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)\r
964 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized\r
965 by the caller.\r
966 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
967 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
968 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the\r
969 interface specific information.\r
970 Description: This call, if successful, provides the network interface specific information such as the interface\r
971 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the\r
972 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.\r
973 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the\r
974 universal driver to translate/convert this information into a format that is required in its specification\r
975 or to suit the expectation of the upper level protocol modules.\r
976 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r
977 before the information provided is valid.\r
978 typedef struct {\r
979 PXENV_STATUS Status\r
980 UINT8 IfaceType[16];\r
981 UINT32 LinkSpeed;\r
982 UINT32 ServiceFlags;\r
983 UINT32 Reserved[4];\r
984 } PXENV_UNDI_GET_NDIS_INFO_T;\r
985 Set before calling API service\r
986 N/A\r
987 Returned from API service\r
988 Status: See the PXENV_STATUS_xxx constants.\r
989 IfaceType: Name of MAC type in ASCIIZ format. This is\r
990 used by the universal NDIS driver to specify its driver type\r
991 to the protocol driver.\r
992 LinkSpeed: Defined in the NDIS 2.0 specification.\r
993 ServiceFlags: Defined in the NDIS 2.0 specification.\r
0a6f4824
LG
994 Reserved: Must be zero.\r
995\r
bcecde14 996 @param SimpleNetworkDevice Device instance\r
0a6f4824 997 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 998 for option ROM call.\r
0a6f4824
LG
999\r
1000 @return Return value of PXE option ROM far call.\r
bcecde14 1001**/\r
1002EFI_STATUS\r
1003PxeUndiGetNdisInfo (\r
1004 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1005 IN OUT PXENV_UNDI_GET_NDIS_INFO_T *PxeUndiTable\r
1006 )\r
1007{\r
1008 return MakePxeCall (\r
1009 SimpleNetworkDevice,\r
1010 PxeUndiTable,\r
1011 sizeof (PXENV_UNDI_GET_NDIS_INFO_T),\r
1012 PXENV_UNDI_GET_NDIS_INFO\r
1013 );\r
1014}\r
1015\r
1016/**\r
0a6f4824 1017 PXE\r
bcecde14 1018 UNDI ISR\r
1019 Op-Code: PXENV_UNDI_ISR (0014h)\r
1020 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.\r
1021 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1022 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1023 constants.\r
1024 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r
1025 the parameter block indicates the operation to be performed for the call. This field is filled with the\r
1026 status of that operation on return.\r
1027 Note: Interrupt Service Routine Operation:\r
1028 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the\r
1029 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR\r
1030 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing\r
1031 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).\r
1032 When the Network Interface HW generates an interrupt the protocol driver interrupt service\r
1033 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then\r
1034 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for\r
1035 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface\r
1036 level and read any status values required to further process the interrupt. UNDI must return as\r
1037 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or\r
1038 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the\r
1039 interrupt was generated by this particular Network Interface or not.\r
1040 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was\r
1041 not generated by our NIC, and interrupt processing is complete.\r
1042 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start\r
1043 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is\r
1044 now complete.\r
1045 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to\r
1046 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and\r
1047 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the\r
1048 first buffer pointer of that frame in the parameter block.\r
1049 The protocol driver calls UNDI repeatedly with the FuncFlag equal to\r
1050 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received\r
1051 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l\r
1052 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous\r
1053 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter\r
1054 block. Otherwise it must return the first buffer in the next frame.\r
1055 If there is no received frame pending to be processed, UNDI processes the transmit completes and\r
1056 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the\r
1057 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.\r
1058 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the\r
0a6f4824
LG
1059 strategy routine when the UNDI re-enables interrupts.\r
1060\r
bcecde14 1061 @param SimpleNetworkDevice Device instance\r
0a6f4824 1062 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1063 for option ROM call.\r
0a6f4824
LG
1064\r
1065 @return Return value of PXE option ROM far call.\r
bcecde14 1066**/\r
1067EFI_STATUS\r
1068PxeUndiIsr (\r
1069 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1070 IN OUT PXENV_UNDI_ISR_T *PxeUndiTable\r
1071 )\r
1072{\r
1073 return MakePxeCall (\r
1074 SimpleNetworkDevice,\r
1075 PxeUndiTable,\r
1076 sizeof (PXENV_UNDI_ISR_T),\r
1077 PXENV_UNDI_ISR\r
1078 );\r
1079}\r
1080\r
1081/**\r
0a6f4824 1082 PXE\r
bcecde14 1083 STOP UNDI\r
1084 Op-Code: PXENV_STOP_UNDI (0015h)\r
1085 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.\r
1086 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1087 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1088 constants.\r
1089 Description: This routine is responsible for unhooking the Int 1Ah service routine.\r
1090 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid\r
1091 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from\r
1092 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base\r
1093 memory.\r
1094 Service cannot be used in protected mode.\r
1095 typedef struct {\r
1096 PXENV_STATUS Status;\r
1097 } PXENV_STOP_UNDI_T;\r
1098 Set before calling API service\r
1099 N/A\r
1100 Returned from API service\r
0a6f4824
LG
1101 Status: See the PXENV_STATUS_xxx constants.\r
1102\r
bcecde14 1103 @param SimpleNetworkDevice Device instance\r
0a6f4824 1104 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1105 for option ROM call.\r
0a6f4824
LG
1106\r
1107 @return Return value of PXE option ROM far call.\r
bcecde14 1108**/\r
1109EFI_STATUS\r
1110PxeUndiStop (\r
1111 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1112 IN OUT PXENV_STOP_UNDI_T *PxeUndiTable\r
1113 )\r
1114{\r
1115 return MakePxeCall (\r
1116 SimpleNetworkDevice,\r
1117 PxeUndiTable,\r
1118 sizeof (PXENV_STOP_UNDI_T),\r
1119 PXENV_STOP_UNDI\r
1120 );\r
1121}\r
1122\r
1123/**\r
0a6f4824 1124 PXE\r
bcecde14 1125 UNDI GET STATE\r
1126 Op-Code: PXENV_UNDI_GET_STATE (0015h)\r
1127 Input: Far pointer to a PXENV_UNDI_GET_STATE_T parameter.\r
1128 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1129 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1130 constants. The UNDI_STATE field in the parameter structure must be set to one of the valid state\r
1131 constants\r
1132 Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call\r
1133 sequences\r
1134 typedef struct {\r
1135 #define PXE_UNDI_GET_STATE_STARTED 1\r
1136 #define PXE_UNDI_GET_STATE_INITIALIZED 2\r
1137 #define PXE_UNDI_GET_STATE_OPENED 3\r
1138 PXENV_STATUS Status;\r
1139 UINT8 UNDIstate;\r
1140 } PXENV_UNDI_GET_STATE_T;\r
1141 Set before calling API service\r
1142 N/A\r
1143 Returned from API service\r
1144 Status: See the PXENV_STATUS_xxx constants.\r
1145 State: See definitions of the state constants.\r
1146 Note. UNDI implementation is responsible for maintaining\r
1147 internal state machine.\r
1148 UNDI ISR\r
1149 Op-Code: PXENV_UNDI_ISR (0014h)\r
1150 Input: Far pointer to a t_PXENV_UNDI_ISR parameter structure that has been initialized by the caller.\r
1151 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1152 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1153 constants.\r
1154 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r
1155 the parameter block indicates the operation to be performed for the call. This field is filled with the\r
0a6f4824
LG
1156 status of that operation on return.\r
1157\r
bcecde14 1158 @param SimpleNetworkDevice Device instance\r
0a6f4824 1159 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1160 for option ROM call.\r
0a6f4824
LG
1161\r
1162 @return Return value of PXE option ROM far call.\r
bcecde14 1163**/\r